Initial Commit

This commit is contained in:
2026-03-06 04:54:20 -04:00
commit 63677bfcf5
9332 changed files with 1507319 additions and 0 deletions

1614
node_modules/@firebase/performance/dist/esm/index.esm.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"type":"module"}

View File

@@ -0,0 +1,38 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const SDK_VERSION: string;
/** The prefix for start User Timing marks used for creating Traces. */
export declare const TRACE_START_MARK_PREFIX = "FB-PERF-TRACE-START";
/** The prefix for stop User Timing marks used for creating Traces. */
export declare const TRACE_STOP_MARK_PREFIX = "FB-PERF-TRACE-STOP";
/** The prefix for User Timing measure used for creating Traces. */
export declare const TRACE_MEASURE_PREFIX = "FB-PERF-TRACE-MEASURE";
/** The prefix for out of the box page load Trace name. */
export declare const OOB_TRACE_PAGE_LOAD_PREFIX = "_wt_";
export declare const FIRST_PAINT_COUNTER_NAME = "_fp";
export declare const FIRST_CONTENTFUL_PAINT_COUNTER_NAME = "_fcp";
export declare const FIRST_INPUT_DELAY_COUNTER_NAME = "_fid";
export declare const LARGEST_CONTENTFUL_PAINT_METRIC_NAME = "_lcp";
export declare const LARGEST_CONTENTFUL_PAINT_ATTRIBUTE_NAME = "lcp_element";
export declare const INTERACTION_TO_NEXT_PAINT_METRIC_NAME = "_inp";
export declare const INTERACTION_TO_NEXT_PAINT_ATTRIBUTE_NAME = "inp_interactionTarget";
export declare const CUMULATIVE_LAYOUT_SHIFT_METRIC_NAME = "_cls";
export declare const CUMULATIVE_LAYOUT_SHIFT_ATTRIBUTE_NAME = "cls_largestShiftTarget";
export declare const CONFIG_LOCAL_STORAGE_KEY = "@firebase/performance/config";
export declare const CONFIG_EXPIRY_LOCAL_STORAGE_KEY = "@firebase/performance/configexpire";
export declare const SERVICE = "performance";
export declare const SERVICE_NAME = "Performance";

View File

@@ -0,0 +1,39 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
import { PerformanceSettings, FirebasePerformance } from '../public_types';
export declare class PerformanceController implements FirebasePerformance {
readonly app: FirebaseApp;
readonly installations: _FirebaseInstallationsInternal;
private initialized;
constructor(app: FirebaseApp, installations: _FirebaseInstallationsInternal);
/**
* This method *must* be called internally as part of creating a
* PerformanceController instance.
*
* Currently it's not possible to pass the settings object through the
* constructor using Components, so this method exists to be called with the
* desired settings, to ensure nothing is collected without the user's
* consent.
*/
_init(settings?: PerformanceSettings): void;
set instrumentationEnabled(val: boolean);
get instrumentationEnabled(): boolean;
set dataCollectionEnabled(val: boolean);
get dataCollectionEnabled(): boolean;
}

View File

@@ -0,0 +1,46 @@
/**
* The Firebase Performance Monitoring Web SDK.
* This SDK does not work in a Node.js environment.
*
* @packageDocumentation
*/
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebasePerformance, PerformanceSettings, PerformanceTrace } from './public_types';
import { FirebaseApp } from '@firebase/app';
import '@firebase/installations';
/**
* Returns a {@link FirebasePerformance} instance for the given app.
* @param app - The {@link @firebase/app#FirebaseApp} to use.
* @public
*/
export declare function getPerformance(app?: FirebaseApp): FirebasePerformance;
/**
* Returns a {@link FirebasePerformance} instance for the given app. Can only be called once.
* @param app - The {@link @firebase/app#FirebaseApp} to use.
* @param settings - Optional settings for the {@link FirebasePerformance} instance.
* @public
*/
export declare function initializePerformance(app: FirebaseApp, settings?: PerformanceSettings): FirebasePerformance;
/**
* Returns a new `PerformanceTrace` instance.
* @param performance - The {@link FirebasePerformance} instance to use.
* @param name - The name of the trace.
* @public
*/
export declare function trace(performance: FirebasePerformance, name: string): PerformanceTrace;
export { FirebasePerformance, PerformanceSettings, PerformanceTrace };

View File

@@ -0,0 +1,136 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
/**
* Defines configuration options for the Performance Monitoring SDK.
*
* @public
*/
export interface PerformanceSettings {
/** Whether to collect custom events. */
dataCollectionEnabled?: boolean;
/** Whether to collect out of the box events. */
instrumentationEnabled?: boolean;
}
/**
* The Firebase Performance Monitoring service interface.
*
* @public
*/
export interface FirebasePerformance {
/**
* The {@link @firebase/app#FirebaseApp} this `FirebasePerformance` instance is associated with.
*/
app: FirebaseApp;
/**
* Controls the logging of automatic traces and HTTP/S network monitoring.
*/
instrumentationEnabled: boolean;
/**
* Controls the logging of custom traces.
*/
dataCollectionEnabled: boolean;
}
/**
* The interface representing a `Trace`.
*
* @public
*/
export interface PerformanceTrace {
/**
* Starts the timing for the trace instance.
*/
start(): void;
/**
* Stops the timing of the trace instance and logs the data of the instance.
*/
stop(): void;
/**
* Records a trace from given parameters. This provides a direct way to use trace without a need to
* start/stop. This is useful for use cases in which the trace cannot directly be used
* (e.g. if the duration was captured before the Performance SDK was loaded).
*
* @param startTime - trace start time since epoch in millisec.
* @param duration - The duration of the trace in millisec.
* @param options - An object which can optionally hold maps of custom metrics and
* custom attributes.
*/
record(startTime: number, duration: number, options?: {
metrics?: {
[key: string]: number;
};
attributes?: {
[key: string]: string;
};
}): void;
/**
* Adds to the value of a custom metric. If a custom metric with the provided name does not
* exist, it creates one with that name and the value equal to the given number. The value will be floored down to an
* integer.
*
* @param metricName - The name of the custom metric.
* @param num - The number to be added to the value of the custom metric. If not provided, it
* uses a default value of one.
*/
incrementMetric(metricName: string, num?: number): void;
/**
* Sets the value of the specified custom metric to the given number regardless of whether
* a metric with that name already exists on the trace instance or not. The value will be floored down to an
* integer.
*
* @param metricName - Name of the custom metric.
* @param num - Value to of the custom metric.
*/
putMetric(metricName: string, num: number): void;
/**
* Returns the value of the custom metric by that name. If a custom metric with that name does
* not exist will return zero.
*
* @param metricName - Name of the custom metric.
*/
getMetric(metricName: string): number;
/**
* Set a custom attribute of a trace to a certain value.
*
* @param attr - Name of the custom attribute.
* @param value - Value of the custom attribute.
*/
putAttribute(attr: string, value: string): void;
/**
* Retrieves the value which a custom attribute is set to.
*
* @param attr - Name of the custom attribute.
*/
getAttribute(attr: string): string | undefined;
/**
* Removes the specified custom attribute from a trace instance.
*
* @param attr - Name of the custom attribute.
*/
removeAttribute(attr: string): void;
/**
* Returns a map of all custom attributes of a trace instance.
*/
getAttributes(): {
[key: string]: string;
};
}
declare module '@firebase/component' {
interface NameServiceMapping {
'performance': FirebasePerformance;
}
}

View File

@@ -0,0 +1,43 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceController } from '../controllers/perf';
export declare const enum HttpMethod {
HTTP_METHOD_UNKNOWN = 0,
GET = 1,
PUT = 2,
POST = 3,
DELETE = 4,
HEAD = 5,
PATCH = 6,
OPTIONS = 7,
TRACE = 8,
CONNECT = 9
}
export interface NetworkRequest {
performanceController: PerformanceController;
url: string;
httpMethod?: HttpMethod;
requestPayloadBytes?: number;
responsePayloadBytes?: number;
httpResponseCode?: number;
responseContentType?: string;
startTimeUs?: number;
timeToRequestCompletedUs?: number;
timeToResponseInitiatedUs?: number;
timeToResponseCompletedUs?: number;
}
export declare function createNetworkRequestEntry(performanceController: PerformanceController, entry: PerformanceEntry): void;

View File

@@ -0,0 +1,121 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceTrace } from '../public_types';
import { PerformanceController } from '../controllers/perf';
import { CoreVitalMetric, WebVitalMetrics } from './web_vitals';
export declare class Trace implements PerformanceTrace {
readonly performanceController: PerformanceController;
readonly name: string;
readonly isAuto: boolean;
private state;
startTimeUs: number;
durationUs: number;
private customAttributes;
counters: {
[counterName: string]: number;
};
private api;
private randomId;
private traceStartMark;
private traceStopMark;
private traceMeasure;
/**
* @param performanceController The performance controller running.
* @param name The name of the trace.
* @param isAuto If the trace is auto-instrumented.
* @param traceMeasureName The name of the measure marker in user timing specification. This field
* is only set when the trace is built for logging when the user directly uses the user timing
* api (performance.mark and performance.measure).
*/
constructor(performanceController: PerformanceController, name: string, isAuto?: boolean, traceMeasureName?: string);
/**
* Starts a trace. The measurement of the duration starts at this point.
*/
start(): void;
/**
* Stops the trace. The measurement of the duration of the trace stops at this point and trace
* is logged.
*/
stop(): void;
/**
* Records a trace with predetermined values. If this method is used a trace is created and logged
* directly. No need to use start and stop methods.
* @param startTime Trace start time since epoch in millisec
* @param duration The duration of the trace in millisec
* @param options An object which can optionally hold maps of custom metrics and custom attributes
*/
record(startTime: number, duration: number, options?: {
metrics?: {
[key: string]: number;
};
attributes?: {
[key: string]: string;
};
}): void;
/**
* Increments a custom metric by a certain number or 1 if number not specified. Will create a new
* custom metric if one with the given name does not exist. The value will be floored down to an
* integer.
* @param counter Name of the custom metric
* @param numAsInteger Increment by value
*/
incrementMetric(counter: string, numAsInteger?: number): void;
/**
* Sets a custom metric to a specified value. Will create a new custom metric if one with the
* given name does not exist. The value will be floored down to an integer.
* @param counter Name of the custom metric
* @param numAsInteger Set custom metric to this value
*/
putMetric(counter: string, numAsInteger: number): void;
/**
* Returns the value of the custom metric by that name. If a custom metric with that name does
* not exist will return zero.
* @param counter
*/
getMetric(counter: string): number;
/**
* Sets a custom attribute of a trace to a certain value.
* @param attr
* @param value
*/
putAttribute(attr: string, value: string): void;
/**
* Retrieves the value a custom attribute of a trace is set to.
* @param attr
*/
getAttribute(attr: string): string | undefined;
removeAttribute(attr: string): void;
getAttributes(): {
[key: string]: string;
};
private setStartTime;
private setDuration;
/**
* Calculates and assigns the duration and start time of the trace using the measure performance
* entry.
*/
private calculateTraceMetrics;
/**
* @param navigationTimings A single element array which contains the navigationTIming object of
* the page load
* @param paintTimings A array which contains paintTiming object of the page load
* @param firstInputDelay First input delay in millisec
*/
static createOobTrace(performanceController: PerformanceController, navigationTimings: PerformanceNavigationTiming[], paintTimings: PerformanceEntry[], webVitalMetrics: WebVitalMetrics, firstInputDelay?: number): void;
static addWebVitalMetric(trace: Trace, metricKey: string, attributeKey: string, metric?: CoreVitalMetric): void;
static createUserTimingTrace(performanceController: PerformanceController, measureName: string): void;
}

View File

@@ -0,0 +1,25 @@
/**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface CoreVitalMetric {
value: number;
elementAttribution?: string;
}
export interface WebVitalMetrics {
cls?: CoreVitalMetric;
inp?: CoreVitalMetric;
lcp?: CoreVitalMetric;
}

View File

@@ -0,0 +1,55 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CLSMetricWithAttribution, INPMetricWithAttribution, LCPMetricWithAttribution } from 'web-vitals/attribution';
declare global {
interface Window {
PerformanceObserver: typeof PerformanceObserver;
perfMetrics?: {
onFirstInputDelay(fn: (fid: number) => void): void;
};
}
}
export type EntryType = 'mark' | 'measure' | 'paint' | 'resource' | 'frame' | 'navigation';
/**
* This class holds a reference to various browser related objects injected by
* set methods.
*/
export declare class Api {
readonly window?: Window | undefined;
private readonly performance;
/** PerformanceObserver constructor function. */
private readonly PerformanceObserver;
private readonly windowLocation;
readonly onFirstInputDelay?: (fn: (fid: number) => void) => void;
readonly onLCP: (fn: (metric: LCPMetricWithAttribution) => void) => void;
readonly onINP: (fn: (metric: INPMetricWithAttribution) => void) => void;
readonly onCLS: (fn: (metric: CLSMetricWithAttribution) => void) => void;
readonly localStorage?: Storage;
readonly document: Document;
readonly navigator: Navigator;
constructor(window?: Window | undefined);
getUrl(): string;
mark(name: string): void;
measure(measureName: string, mark1: string, mark2: string): void;
getEntriesByType(type: EntryType): PerformanceEntry[];
getEntriesByName(name: string): PerformanceEntry[];
getTimeOrigin(): number;
requiredApisAvailable(): boolean;
setupObserver(entryType: EntryType, callback: (entry: PerformanceEntry) => void): void;
static getInstance(): Api;
}
export declare function setupApi(window: Window): void;

View File

@@ -0,0 +1,21 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { _FirebaseInstallationsInternal } from '@firebase/installations';
export declare function getIidPromise(installationsService: _FirebaseInstallationsInternal): Promise<string>;
export declare function getIid(): string | undefined;
export declare function getAuthTokenPromise(installationsService: _FirebaseInstallationsInternal): Promise<string>;
export declare function getAuthenticationToken(): string | undefined;

View File

@@ -0,0 +1,19 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceController } from '../controllers/perf';
export declare function getInitializationPromise(performanceController: PerformanceController): Promise<void>;
export declare function isPerfInitialized(): boolean;

View File

@@ -0,0 +1,23 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceController } from '../controllers/perf';
export declare function setupOobResources(performanceController: PerformanceController): void;
/**
* This service will only export the page load trace once. This function allows
* resetting it for unit tests
*/
export declare function resetForUnitTests(): void;

View File

@@ -0,0 +1,21 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NetworkRequest } from '../resources/network_request';
import { Trace } from '../resources/trace';
export declare function logTrace(trace: Trace): void;
export declare function flushLogs(): void;
export declare function logNetworkRequest(networkRequest: NetworkRequest): void;

View File

@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceController } from '../controllers/perf';
export declare function getConfig(performanceController: PerformanceController, iid: string): Promise<void>;

View File

@@ -0,0 +1,33 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare class SettingsService {
instrumentationEnabled: boolean;
dataCollectionEnabled: boolean;
loggingEnabled: boolean;
tracesSamplingRate: number;
networkRequestsSamplingRate: number;
logEndPointUrl: string;
flTransportEndpointUrl: string;
transportKey: string;
logSource: number;
logTraceAfterSampling: boolean;
logNetworkAfterSampling: boolean;
configTimeToLive: number;
logMaxFlushSize: number;
getFlTransportFullUrl(): string;
static getInstance(): SettingsService;
}

View File

@@ -0,0 +1,29 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare function setupTransportService(): void;
/**
* Utilized by testing to clean up message queue and un-initialize transport service.
*/
export declare function resetTransportService(): void;
/** Log handler for cc service to send the performance logs to the server. */
export declare function transportHandler(serializer: (...args: any[]) => string): (...args: unknown[]) => void;
/**
* Force flush the queued events. Useful at page unload time to ensure all events are uploaded.
* Flush will attempt to use sendBeacon to send events async and defaults back to fetch as soon as a
* sendBeacon fails. Firefox
*/
export declare function flushQueuedEvents(): void;

View File

@@ -0,0 +1,20 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
export declare function getAppId(firebaseApp: FirebaseApp): string;
export declare function getProjectId(firebaseApp: FirebaseApp): string;
export declare function getApiKey(firebaseApp: FirebaseApp): string;

View File

@@ -0,0 +1,41 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare const enum ServiceWorkerStatus {
UNKNOWN = 0,
UNSUPPORTED = 1,
CONTROLLED = 2,
UNCONTROLLED = 3
}
export declare enum VisibilityState {
UNKNOWN = 0,
VISIBLE = 1,
HIDDEN = 2
}
declare const enum EffectiveConnectionType {
UNKNOWN = 0,
CONNECTION_SLOW_2G = 1,
CONNECTION_2G = 2,
CONNECTION_3G = 3,
CONNECTION_4G = 4
}
export declare const MAX_ATTRIBUTE_VALUE_LENGTH = 100;
export declare function getServiceWorkerStatus(): ServiceWorkerStatus;
export declare function getVisibilityState(): VisibilityState;
export declare function getEffectiveConnectionType(): EffectiveConnectionType;
export declare function isValidCustomAttributeName(name: string): boolean;
export declare function isValidCustomAttributeValue(value: string): boolean;
export {};

View File

@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Logger } from '@firebase/logger';
export declare const consoleLogger: Logger;

View File

@@ -0,0 +1,60 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ErrorFactory } from '@firebase/util';
export declare const enum ErrorCode {
TRACE_STARTED_BEFORE = "trace started",
TRACE_STOPPED_BEFORE = "trace stopped",
NONPOSITIVE_TRACE_START_TIME = "nonpositive trace startTime",
NONPOSITIVE_TRACE_DURATION = "nonpositive trace duration",
NO_WINDOW = "no window",
NO_APP_ID = "no app id",
NO_PROJECT_ID = "no project id",
NO_API_KEY = "no api key",
INVALID_CC_LOG = "invalid cc log",
FB_NOT_DEFAULT = "FB not default",
RC_NOT_OK = "RC response not ok",
INVALID_ATTRIBUTE_NAME = "invalid attribute name",
INVALID_ATTRIBUTE_VALUE = "invalid attribute value",
INVALID_CUSTOM_METRIC_NAME = "invalid custom metric name",
INVALID_STRING_MERGER_PARAMETER = "invalid String merger input",
ALREADY_INITIALIZED = "already initialized"
}
interface ErrorParams {
[ErrorCode.TRACE_STARTED_BEFORE]: {
traceName: string;
};
[ErrorCode.TRACE_STOPPED_BEFORE]: {
traceName: string;
};
[ErrorCode.NONPOSITIVE_TRACE_START_TIME]: {
traceName: string;
};
[ErrorCode.NONPOSITIVE_TRACE_DURATION]: {
traceName: string;
};
[ErrorCode.INVALID_ATTRIBUTE_NAME]: {
attributeName: string;
};
[ErrorCode.INVALID_ATTRIBUTE_VALUE]: {
attributeValue: string;
};
[ErrorCode.INVALID_CUSTOM_METRIC_NAME]: {
customMetricName: string;
};
}
export declare const ERROR_FACTORY: ErrorFactory<ErrorCode, ErrorParams>;
export {};

View File

@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Returns true if the metric is custom and does not start with reserved prefix, or if
* the metric is one of out of the box page load trace metrics.
*/
export declare function isValidMetricName(name: string, traceName?: string): boolean;
/**
* Converts the provided value to an integer value to be used in case of a metric.
* @param providedValue Provided number value of the metric that needs to be converted to an integer.
*
* @returns Converted integer number to be set for the metric.
*/
export declare function convertMetricValueToInteger(providedValue: number): number;

View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare function mergeStrings(part1: string, part2: string): string;

View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};

1620
node_modules/@firebase/performance/dist/index.cjs.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,38 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const SDK_VERSION: string;
/** The prefix for start User Timing marks used for creating Traces. */
export declare const TRACE_START_MARK_PREFIX = "FB-PERF-TRACE-START";
/** The prefix for stop User Timing marks used for creating Traces. */
export declare const TRACE_STOP_MARK_PREFIX = "FB-PERF-TRACE-STOP";
/** The prefix for User Timing measure used for creating Traces. */
export declare const TRACE_MEASURE_PREFIX = "FB-PERF-TRACE-MEASURE";
/** The prefix for out of the box page load Trace name. */
export declare const OOB_TRACE_PAGE_LOAD_PREFIX = "_wt_";
export declare const FIRST_PAINT_COUNTER_NAME = "_fp";
export declare const FIRST_CONTENTFUL_PAINT_COUNTER_NAME = "_fcp";
export declare const FIRST_INPUT_DELAY_COUNTER_NAME = "_fid";
export declare const LARGEST_CONTENTFUL_PAINT_METRIC_NAME = "_lcp";
export declare const LARGEST_CONTENTFUL_PAINT_ATTRIBUTE_NAME = "lcp_element";
export declare const INTERACTION_TO_NEXT_PAINT_METRIC_NAME = "_inp";
export declare const INTERACTION_TO_NEXT_PAINT_ATTRIBUTE_NAME = "inp_interactionTarget";
export declare const CUMULATIVE_LAYOUT_SHIFT_METRIC_NAME = "_cls";
export declare const CUMULATIVE_LAYOUT_SHIFT_ATTRIBUTE_NAME = "cls_largestShiftTarget";
export declare const CONFIG_LOCAL_STORAGE_KEY = "@firebase/performance/config";
export declare const CONFIG_EXPIRY_LOCAL_STORAGE_KEY = "@firebase/performance/configexpire";
export declare const SERVICE = "performance";
export declare const SERVICE_NAME = "Performance";

View File

@@ -0,0 +1,39 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
import { PerformanceSettings, FirebasePerformance } from '../public_types';
export declare class PerformanceController implements FirebasePerformance {
readonly app: FirebaseApp;
readonly installations: _FirebaseInstallationsInternal;
private initialized;
constructor(app: FirebaseApp, installations: _FirebaseInstallationsInternal);
/**
* This method *must* be called internally as part of creating a
* PerformanceController instance.
*
* Currently it's not possible to pass the settings object through the
* constructor using Components, so this method exists to be called with the
* desired settings, to ensure nothing is collected without the user's
* consent.
*/
_init(settings?: PerformanceSettings): void;
set instrumentationEnabled(val: boolean);
get instrumentationEnabled(): boolean;
set dataCollectionEnabled(val: boolean);
get dataCollectionEnabled(): boolean;
}

46
node_modules/@firebase/performance/dist/src/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,46 @@
/**
* The Firebase Performance Monitoring Web SDK.
* This SDK does not work in a Node.js environment.
*
* @packageDocumentation
*/
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebasePerformance, PerformanceSettings, PerformanceTrace } from './public_types';
import { FirebaseApp } from '@firebase/app';
import '@firebase/installations';
/**
* Returns a {@link FirebasePerformance} instance for the given app.
* @param app - The {@link @firebase/app#FirebaseApp} to use.
* @public
*/
export declare function getPerformance(app?: FirebaseApp): FirebasePerformance;
/**
* Returns a {@link FirebasePerformance} instance for the given app. Can only be called once.
* @param app - The {@link @firebase/app#FirebaseApp} to use.
* @param settings - Optional settings for the {@link FirebasePerformance} instance.
* @public
*/
export declare function initializePerformance(app: FirebaseApp, settings?: PerformanceSettings): FirebasePerformance;
/**
* Returns a new `PerformanceTrace` instance.
* @param performance - The {@link FirebasePerformance} instance to use.
* @param name - The name of the trace.
* @public
*/
export declare function trace(performance: FirebasePerformance, name: string): PerformanceTrace;
export { FirebasePerformance, PerformanceSettings, PerformanceTrace };

View File

@@ -0,0 +1,136 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
/**
* Defines configuration options for the Performance Monitoring SDK.
*
* @public
*/
export interface PerformanceSettings {
/** Whether to collect custom events. */
dataCollectionEnabled?: boolean;
/** Whether to collect out of the box events. */
instrumentationEnabled?: boolean;
}
/**
* The Firebase Performance Monitoring service interface.
*
* @public
*/
export interface FirebasePerformance {
/**
* The {@link @firebase/app#FirebaseApp} this `FirebasePerformance` instance is associated with.
*/
app: FirebaseApp;
/**
* Controls the logging of automatic traces and HTTP/S network monitoring.
*/
instrumentationEnabled: boolean;
/**
* Controls the logging of custom traces.
*/
dataCollectionEnabled: boolean;
}
/**
* The interface representing a `Trace`.
*
* @public
*/
export interface PerformanceTrace {
/**
* Starts the timing for the trace instance.
*/
start(): void;
/**
* Stops the timing of the trace instance and logs the data of the instance.
*/
stop(): void;
/**
* Records a trace from given parameters. This provides a direct way to use trace without a need to
* start/stop. This is useful for use cases in which the trace cannot directly be used
* (e.g. if the duration was captured before the Performance SDK was loaded).
*
* @param startTime - trace start time since epoch in millisec.
* @param duration - The duration of the trace in millisec.
* @param options - An object which can optionally hold maps of custom metrics and
* custom attributes.
*/
record(startTime: number, duration: number, options?: {
metrics?: {
[key: string]: number;
};
attributes?: {
[key: string]: string;
};
}): void;
/**
* Adds to the value of a custom metric. If a custom metric with the provided name does not
* exist, it creates one with that name and the value equal to the given number. The value will be floored down to an
* integer.
*
* @param metricName - The name of the custom metric.
* @param num - The number to be added to the value of the custom metric. If not provided, it
* uses a default value of one.
*/
incrementMetric(metricName: string, num?: number): void;
/**
* Sets the value of the specified custom metric to the given number regardless of whether
* a metric with that name already exists on the trace instance or not. The value will be floored down to an
* integer.
*
* @param metricName - Name of the custom metric.
* @param num - Value to of the custom metric.
*/
putMetric(metricName: string, num: number): void;
/**
* Returns the value of the custom metric by that name. If a custom metric with that name does
* not exist will return zero.
*
* @param metricName - Name of the custom metric.
*/
getMetric(metricName: string): number;
/**
* Set a custom attribute of a trace to a certain value.
*
* @param attr - Name of the custom attribute.
* @param value - Value of the custom attribute.
*/
putAttribute(attr: string, value: string): void;
/**
* Retrieves the value which a custom attribute is set to.
*
* @param attr - Name of the custom attribute.
*/
getAttribute(attr: string): string | undefined;
/**
* Removes the specified custom attribute from a trace instance.
*
* @param attr - Name of the custom attribute.
*/
removeAttribute(attr: string): void;
/**
* Returns a map of all custom attributes of a trace instance.
*/
getAttributes(): {
[key: string]: string;
};
}
declare module '@firebase/component' {
interface NameServiceMapping {
'performance': FirebasePerformance;
}
}

View File

@@ -0,0 +1,43 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceController } from '../controllers/perf';
export declare const enum HttpMethod {
HTTP_METHOD_UNKNOWN = 0,
GET = 1,
PUT = 2,
POST = 3,
DELETE = 4,
HEAD = 5,
PATCH = 6,
OPTIONS = 7,
TRACE = 8,
CONNECT = 9
}
export interface NetworkRequest {
performanceController: PerformanceController;
url: string;
httpMethod?: HttpMethod;
requestPayloadBytes?: number;
responsePayloadBytes?: number;
httpResponseCode?: number;
responseContentType?: string;
startTimeUs?: number;
timeToRequestCompletedUs?: number;
timeToResponseInitiatedUs?: number;
timeToResponseCompletedUs?: number;
}
export declare function createNetworkRequestEntry(performanceController: PerformanceController, entry: PerformanceEntry): void;

View File

@@ -0,0 +1,121 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceTrace } from '../public_types';
import { PerformanceController } from '../controllers/perf';
import { CoreVitalMetric, WebVitalMetrics } from './web_vitals';
export declare class Trace implements PerformanceTrace {
readonly performanceController: PerformanceController;
readonly name: string;
readonly isAuto: boolean;
private state;
startTimeUs: number;
durationUs: number;
private customAttributes;
counters: {
[counterName: string]: number;
};
private api;
private randomId;
private traceStartMark;
private traceStopMark;
private traceMeasure;
/**
* @param performanceController The performance controller running.
* @param name The name of the trace.
* @param isAuto If the trace is auto-instrumented.
* @param traceMeasureName The name of the measure marker in user timing specification. This field
* is only set when the trace is built for logging when the user directly uses the user timing
* api (performance.mark and performance.measure).
*/
constructor(performanceController: PerformanceController, name: string, isAuto?: boolean, traceMeasureName?: string);
/**
* Starts a trace. The measurement of the duration starts at this point.
*/
start(): void;
/**
* Stops the trace. The measurement of the duration of the trace stops at this point and trace
* is logged.
*/
stop(): void;
/**
* Records a trace with predetermined values. If this method is used a trace is created and logged
* directly. No need to use start and stop methods.
* @param startTime Trace start time since epoch in millisec
* @param duration The duration of the trace in millisec
* @param options An object which can optionally hold maps of custom metrics and custom attributes
*/
record(startTime: number, duration: number, options?: {
metrics?: {
[key: string]: number;
};
attributes?: {
[key: string]: string;
};
}): void;
/**
* Increments a custom metric by a certain number or 1 if number not specified. Will create a new
* custom metric if one with the given name does not exist. The value will be floored down to an
* integer.
* @param counter Name of the custom metric
* @param numAsInteger Increment by value
*/
incrementMetric(counter: string, numAsInteger?: number): void;
/**
* Sets a custom metric to a specified value. Will create a new custom metric if one with the
* given name does not exist. The value will be floored down to an integer.
* @param counter Name of the custom metric
* @param numAsInteger Set custom metric to this value
*/
putMetric(counter: string, numAsInteger: number): void;
/**
* Returns the value of the custom metric by that name. If a custom metric with that name does
* not exist will return zero.
* @param counter
*/
getMetric(counter: string): number;
/**
* Sets a custom attribute of a trace to a certain value.
* @param attr
* @param value
*/
putAttribute(attr: string, value: string): void;
/**
* Retrieves the value a custom attribute of a trace is set to.
* @param attr
*/
getAttribute(attr: string): string | undefined;
removeAttribute(attr: string): void;
getAttributes(): {
[key: string]: string;
};
private setStartTime;
private setDuration;
/**
* Calculates and assigns the duration and start time of the trace using the measure performance
* entry.
*/
private calculateTraceMetrics;
/**
* @param navigationTimings A single element array which contains the navigationTIming object of
* the page load
* @param paintTimings A array which contains paintTiming object of the page load
* @param firstInputDelay First input delay in millisec
*/
static createOobTrace(performanceController: PerformanceController, navigationTimings: PerformanceNavigationTiming[], paintTimings: PerformanceEntry[], webVitalMetrics: WebVitalMetrics, firstInputDelay?: number): void;
static addWebVitalMetric(trace: Trace, metricKey: string, attributeKey: string, metric?: CoreVitalMetric): void;
static createUserTimingTrace(performanceController: PerformanceController, measureName: string): void;
}

View File

@@ -0,0 +1,25 @@
/**
* @license
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface CoreVitalMetric {
value: number;
elementAttribution?: string;
}
export interface WebVitalMetrics {
cls?: CoreVitalMetric;
inp?: CoreVitalMetric;
lcp?: CoreVitalMetric;
}

View File

@@ -0,0 +1,55 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CLSMetricWithAttribution, INPMetricWithAttribution, LCPMetricWithAttribution } from 'web-vitals/attribution';
declare global {
interface Window {
PerformanceObserver: typeof PerformanceObserver;
perfMetrics?: {
onFirstInputDelay(fn: (fid: number) => void): void;
};
}
}
export type EntryType = 'mark' | 'measure' | 'paint' | 'resource' | 'frame' | 'navigation';
/**
* This class holds a reference to various browser related objects injected by
* set methods.
*/
export declare class Api {
readonly window?: Window | undefined;
private readonly performance;
/** PerformanceObserver constructor function. */
private readonly PerformanceObserver;
private readonly windowLocation;
readonly onFirstInputDelay?: (fn: (fid: number) => void) => void;
readonly onLCP: (fn: (metric: LCPMetricWithAttribution) => void) => void;
readonly onINP: (fn: (metric: INPMetricWithAttribution) => void) => void;
readonly onCLS: (fn: (metric: CLSMetricWithAttribution) => void) => void;
readonly localStorage?: Storage;
readonly document: Document;
readonly navigator: Navigator;
constructor(window?: Window | undefined);
getUrl(): string;
mark(name: string): void;
measure(measureName: string, mark1: string, mark2: string): void;
getEntriesByType(type: EntryType): PerformanceEntry[];
getEntriesByName(name: string): PerformanceEntry[];
getTimeOrigin(): number;
requiredApisAvailable(): boolean;
setupObserver(entryType: EntryType, callback: (entry: PerformanceEntry) => void): void;
static getInstance(): Api;
}
export declare function setupApi(window: Window): void;

View File

@@ -0,0 +1,21 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { _FirebaseInstallationsInternal } from '@firebase/installations';
export declare function getIidPromise(installationsService: _FirebaseInstallationsInternal): Promise<string>;
export declare function getIid(): string | undefined;
export declare function getAuthTokenPromise(installationsService: _FirebaseInstallationsInternal): Promise<string>;
export declare function getAuthenticationToken(): string | undefined;

View File

@@ -0,0 +1,19 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceController } from '../controllers/perf';
export declare function getInitializationPromise(performanceController: PerformanceController): Promise<void>;
export declare function isPerfInitialized(): boolean;

View File

@@ -0,0 +1,23 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceController } from '../controllers/perf';
export declare function setupOobResources(performanceController: PerformanceController): void;
/**
* This service will only export the page load trace once. This function allows
* resetting it for unit tests
*/
export declare function resetForUnitTests(): void;

View File

@@ -0,0 +1,21 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NetworkRequest } from '../resources/network_request';
import { Trace } from '../resources/trace';
export declare function logTrace(trace: Trace): void;
export declare function flushLogs(): void;
export declare function logNetworkRequest(networkRequest: NetworkRequest): void;

View File

@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PerformanceController } from '../controllers/perf';
export declare function getConfig(performanceController: PerformanceController, iid: string): Promise<void>;

View File

@@ -0,0 +1,33 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare class SettingsService {
instrumentationEnabled: boolean;
dataCollectionEnabled: boolean;
loggingEnabled: boolean;
tracesSamplingRate: number;
networkRequestsSamplingRate: number;
logEndPointUrl: string;
flTransportEndpointUrl: string;
transportKey: string;
logSource: number;
logTraceAfterSampling: boolean;
logNetworkAfterSampling: boolean;
configTimeToLive: number;
logMaxFlushSize: number;
getFlTransportFullUrl(): string;
static getInstance(): SettingsService;
}

View File

@@ -0,0 +1,29 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare function setupTransportService(): void;
/**
* Utilized by testing to clean up message queue and un-initialize transport service.
*/
export declare function resetTransportService(): void;
/** Log handler for cc service to send the performance logs to the server. */
export declare function transportHandler(serializer: (...args: any[]) => string): (...args: unknown[]) => void;
/**
* Force flush the queued events. Useful at page unload time to ensure all events are uploaded.
* Flush will attempt to use sendBeacon to send events async and defaults back to fetch as soon as a
* sendBeacon fails. Firefox
*/
export declare function flushQueuedEvents(): void;

View File

@@ -0,0 +1,11 @@
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
// It should be published with your NPM package. It should not be tracked by Git.
{
"tsdocVersion": "0.12",
"toolPackages": [
{
"packageName": "@microsoft/api-extractor",
"packageVersion": "0.1.2"
}
]
}

View File

@@ -0,0 +1,20 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
export declare function getAppId(firebaseApp: FirebaseApp): string;
export declare function getProjectId(firebaseApp: FirebaseApp): string;
export declare function getApiKey(firebaseApp: FirebaseApp): string;

View File

@@ -0,0 +1,41 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
declare const enum ServiceWorkerStatus {
UNKNOWN = 0,
UNSUPPORTED = 1,
CONTROLLED = 2,
UNCONTROLLED = 3
}
export declare enum VisibilityState {
UNKNOWN = 0,
VISIBLE = 1,
HIDDEN = 2
}
declare const enum EffectiveConnectionType {
UNKNOWN = 0,
CONNECTION_SLOW_2G = 1,
CONNECTION_2G = 2,
CONNECTION_3G = 3,
CONNECTION_4G = 4
}
export declare const MAX_ATTRIBUTE_VALUE_LENGTH = 100;
export declare function getServiceWorkerStatus(): ServiceWorkerStatus;
export declare function getVisibilityState(): VisibilityState;
export declare function getEffectiveConnectionType(): EffectiveConnectionType;
export declare function isValidCustomAttributeName(name: string): boolean;
export declare function isValidCustomAttributeValue(value: string): boolean;
export {};

View File

@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Logger } from '@firebase/logger';
export declare const consoleLogger: Logger;

View File

@@ -0,0 +1,60 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ErrorFactory } from '@firebase/util';
export declare const enum ErrorCode {
TRACE_STARTED_BEFORE = "trace started",
TRACE_STOPPED_BEFORE = "trace stopped",
NONPOSITIVE_TRACE_START_TIME = "nonpositive trace startTime",
NONPOSITIVE_TRACE_DURATION = "nonpositive trace duration",
NO_WINDOW = "no window",
NO_APP_ID = "no app id",
NO_PROJECT_ID = "no project id",
NO_API_KEY = "no api key",
INVALID_CC_LOG = "invalid cc log",
FB_NOT_DEFAULT = "FB not default",
RC_NOT_OK = "RC response not ok",
INVALID_ATTRIBUTE_NAME = "invalid attribute name",
INVALID_ATTRIBUTE_VALUE = "invalid attribute value",
INVALID_CUSTOM_METRIC_NAME = "invalid custom metric name",
INVALID_STRING_MERGER_PARAMETER = "invalid String merger input",
ALREADY_INITIALIZED = "already initialized"
}
interface ErrorParams {
[ErrorCode.TRACE_STARTED_BEFORE]: {
traceName: string;
};
[ErrorCode.TRACE_STOPPED_BEFORE]: {
traceName: string;
};
[ErrorCode.NONPOSITIVE_TRACE_START_TIME]: {
traceName: string;
};
[ErrorCode.NONPOSITIVE_TRACE_DURATION]: {
traceName: string;
};
[ErrorCode.INVALID_ATTRIBUTE_NAME]: {
attributeName: string;
};
[ErrorCode.INVALID_ATTRIBUTE_VALUE]: {
attributeValue: string;
};
[ErrorCode.INVALID_CUSTOM_METRIC_NAME]: {
customMetricName: string;
};
}
export declare const ERROR_FACTORY: ErrorFactory<ErrorCode, ErrorParams>;
export {};

View File

@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Returns true if the metric is custom and does not start with reserved prefix, or if
* the metric is one of out of the box page load trace metrics.
*/
export declare function isValidMetricName(name: string, traceName?: string): boolean;
/**
* Converts the provided value to an integer value to be used in case of a metric.
* @param providedValue Provided number value of the metric that needs to be converted to an integer.
*
* @returns Converted integer number to be set for the metric.
*/
export declare function convertMetricValueToInteger(providedValue: number): number;

View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare function mergeStrings(part1: string, part2: string): string;

View File

@@ -0,0 +1,17 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};