@capacitor-firebase/performance 6.1.0 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,50 @@ export interface FirebasePerformancePlugin {
30
30
  * @since 0.1.0
31
31
  */
32
32
  isEnabled(): Promise<IsEnabledResult>;
33
+ /**
34
+ * Sets a custom attribute of a trace to a given value.
35
+ *
36
+ * @since 6.3.0
37
+ */
38
+ putAttribute(options: PutAttributeOptions): Promise<void>;
39
+ /**
40
+ * Returns the value of a custom attribute of a trace.
41
+ *
42
+ * @since 6.3.0
43
+ */
44
+ getAttribute(options: GetAttributeOptions): Promise<GetAttributeResult>;
45
+ /**
46
+ * Gets the all the custom attributes of a trace with their values.
47
+ *
48
+ * @since 6.3.0
49
+ */
50
+ getAttributes(options: GetAttributesOptions): Promise<GetAttributesResult>;
51
+ /**
52
+ * Removes a custom attribute from a trace given its name.
53
+ *
54
+ * @since 6.3.0
55
+ */
56
+ removeAttribute(options: RemoveAttributeOptions): Promise<void>;
57
+ /**
58
+ * Sets the value of a custom metric.
59
+ *
60
+ * @since 6.3.0
61
+ */
62
+ putMetric(options: PutMetricOptions): Promise<void>;
63
+ /**
64
+ * Get the value of a custom metric by name.
65
+ *
66
+ * @since 6.3.0
67
+ */
68
+ getMetric(options: GetMetricOptions): Promise<GetMetricResult>;
69
+ /**
70
+ * Records a trace given its name and options.
71
+ *
72
+ * Only available on web.
73
+ *
74
+ * @since 6.3.0
75
+ */
76
+ record(options: RecordOptions): Promise<void>;
33
77
  }
34
78
  /**
35
79
  * @since 0.1.0
@@ -100,3 +144,182 @@ export interface IsEnabledResult {
100
144
  */
101
145
  enabled: boolean;
102
146
  }
147
+ /**
148
+ * @since 6.3.0
149
+ */
150
+ export interface PutAttributeOptions {
151
+ /**
152
+ * Name of the trace to set its attribute.
153
+ *
154
+ * @since 6.3.0
155
+ */
156
+ traceName: string;
157
+ /**
158
+ * Name of the attribute to set its value.
159
+ *
160
+ * @since 6.3.0
161
+ * @example "experiment"
162
+ */
163
+ attribute: string;
164
+ /**
165
+ * The value to set to the attribute.
166
+ *
167
+ * @since 6.3.0
168
+ * @example "A"
169
+ */
170
+ value: string;
171
+ }
172
+ /**
173
+ * @since 6.3.0
174
+ */
175
+ export interface GetAttributeOptions {
176
+ /**
177
+ * Name of the trace to set its attribute.
178
+ *
179
+ * @since 6.3.0
180
+ */
181
+ traceName: string;
182
+ /**
183
+ * Name of the attribute to retrieve its value.
184
+ *
185
+ * @since 6.3.0
186
+ */
187
+ attribute: string;
188
+ }
189
+ /**
190
+ * @since 6.3.0
191
+ */
192
+ export interface GetAttributeResult {
193
+ /**
194
+ * The value of the custom attribute.
195
+ *
196
+ * @since 6.3.0
197
+ */
198
+ value: string | null;
199
+ }
200
+ /**
201
+ * @since 6.3.0
202
+ */
203
+ export interface GetAttributesOptions {
204
+ /**
205
+ * Name of the trace to get its attributes.
206
+ *
207
+ * @since 6.3.0
208
+ */
209
+ traceName: string;
210
+ }
211
+ /**
212
+ * @since 6.3.0
213
+ */
214
+ export interface GetAttributesResult {
215
+ /**
216
+ * A map of all custom attributes of a trace with their values.
217
+ *
218
+ * @since 6.3.0
219
+ */
220
+ attributes: {
221
+ [key: string]: string;
222
+ };
223
+ }
224
+ /**
225
+ * @since 6.3.0
226
+ */
227
+ export declare type RemoveAttributeOptions = GetAttributeOptions;
228
+ /**
229
+ * @since 6.3.0
230
+ */
231
+ export interface PutMetricOptions {
232
+ /**
233
+ * Name of the trace to set its metric.
234
+ *
235
+ * @since 6.3.0
236
+ */
237
+ traceName: string;
238
+ /**
239
+ * The metric name.
240
+ *
241
+ * @since 6.3.0
242
+ */
243
+ metricName: string;
244
+ /**
245
+ * The value to set for the metric.
246
+ * The given value is floored down to the nearest integer.
247
+ *
248
+ * @since 6.3.0
249
+ */
250
+ num: number;
251
+ }
252
+ /**
253
+ * @since 6.3.0
254
+ */
255
+ export interface GetMetricOptions {
256
+ /**
257
+ * Name of the trace to get its metric.
258
+ *
259
+ * @since 6.3.0
260
+ */
261
+ traceName: string;
262
+ /**
263
+ * The metric name.
264
+ *
265
+ * @since 6.3.0
266
+ */
267
+ metricName: string;
268
+ }
269
+ /**
270
+ * @since 6.3.0
271
+ */
272
+ export interface GetMetricResult {
273
+ /**
274
+ * The value of the metric if exists.
275
+ *
276
+ * @since 6.3.0
277
+ */
278
+ value: number;
279
+ }
280
+ /**
281
+ * @since 6.3.0
282
+ */
283
+ export interface RecordOptions {
284
+ /**
285
+ * Name of the trace to record.
286
+ *
287
+ * @since 6.3.0
288
+ */
289
+ traceName: string;
290
+ /**
291
+ * Start time of the trace since epoch in milliseconds.
292
+ *
293
+ * @since 6.3.0
294
+ */
295
+ startTime: number;
296
+ /**
297
+ * The duration of the trace in milliseconds.
298
+ *
299
+ * @since 6.3.0
300
+ */
301
+ duration: number;
302
+ /**
303
+ * An optional object that holds optional maps of custom metrics and attributes.
304
+ *
305
+ * @since 6.3.0
306
+ */
307
+ options?: {
308
+ /**
309
+ * An optional map of metrics to be set on the trace.
310
+ *
311
+ * @since 6.3.0
312
+ */
313
+ metrics?: {
314
+ [key: string]: number;
315
+ };
316
+ /**
317
+ * An optional map of attributes to be set on the trace.
318
+ *
319
+ * @since 6.3.0
320
+ */
321
+ attributes?: {
322
+ [key: string]: string;
323
+ };
324
+ };
325
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface FirebasePerformancePlugin {\n /**\n * Starts a trace.\n *\n * @since 0.1.0\n */\n startTrace(options: StartTraceOptions): Promise<void>;\n /**\n * Stops a trace.\n *\n * @since 0.1.0\n */\n stopTrace(options: StopTraceOptions): Promise<void>;\n /**\n * Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.\n *\n * @since 0.1.0\n */\n incrementMetric(options: IncrementMetricOptions): Promise<void>;\n /**\n * Enables or disables performance monitoring.\n * Will be applied with the next start of the app.\n *\n * @since 0.1.0\n */\n setEnabled(options: SetEnabledOptions): Promise<void>;\n /**\n * Determines whether performance monitoring is enabled or disabled.\n *\n * @since 0.1.0\n */\n isEnabled(): Promise<IsEnabledResult>;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface StartTraceOptions {\n /**\n * Custom trace name.\n *\n * Names for custom code traces must meet the following requirements:\n * no leading or trailing whitespace, no leading underscore (_) character,\n * and max length is 100 characters.\n *\n * @since 0.1.0\n */\n traceName: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface StopTraceOptions {\n /**\n * Name of the trace that was set with `startTrace`.\n *\n * @since 0.1.0\n */\n traceName: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface IncrementMetricOptions {\n /**\n * Name of the trace that was set with `startTrace`.\n *\n * @since 0.1.0\n */\n traceName: string;\n /**\n * Name of the metric to be incremented.\n *\n * @since 0.1.0\n */\n metricName: string;\n /**\n * Amount by which the metric has to be incremented.\n *\n * @default 1\n * @since 0.1.0\n */\n incrementBy?: number;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface SetEnabledOptions {\n /**\n * Should performance monitoring be enabled.\n *\n * @since 0.1.0\n */\n enabled: boolean;\n}\n\nexport interface IsEnabledResult {\n /**\n * `true` if performance monitoring is enabled, otherwise `false`.\n *\n * @since 0.1.0\n */\n enabled: boolean;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface FirebasePerformancePlugin {\n /**\n * Starts a trace.\n *\n * @since 0.1.0\n */\n startTrace(options: StartTraceOptions): Promise<void>;\n /**\n * Stops a trace.\n *\n * @since 0.1.0\n */\n stopTrace(options: StopTraceOptions): Promise<void>;\n /**\n * Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.\n *\n * @since 0.1.0\n */\n incrementMetric(options: IncrementMetricOptions): Promise<void>;\n /**\n * Enables or disables performance monitoring.\n * Will be applied with the next start of the app.\n *\n * @since 0.1.0\n */\n setEnabled(options: SetEnabledOptions): Promise<void>;\n /**\n * Determines whether performance monitoring is enabled or disabled.\n *\n * @since 0.1.0\n */\n isEnabled(): Promise<IsEnabledResult>;\n /**\n * Sets a custom attribute of a trace to a given value.\n *\n * @since 6.3.0\n */\n putAttribute(options: PutAttributeOptions): Promise<void>;\n /**\n * Returns the value of a custom attribute of a trace.\n *\n * @since 6.3.0\n */\n getAttribute(options: GetAttributeOptions): Promise<GetAttributeResult>;\n /**\n * Gets the all the custom attributes of a trace with their values.\n *\n * @since 6.3.0\n */\n getAttributes(options: GetAttributesOptions): Promise<GetAttributesResult>;\n /**\n * Removes a custom attribute from a trace given its name.\n *\n * @since 6.3.0\n */\n removeAttribute(options: RemoveAttributeOptions): Promise<void>;\n /**\n * Sets the value of a custom metric.\n *\n * @since 6.3.0\n */\n putMetric(options: PutMetricOptions): Promise<void>;\n /**\n * Get the value of a custom metric by name.\n *\n * @since 6.3.0\n */\n getMetric(options: GetMetricOptions): Promise<GetMetricResult>;\n /**\n * Records a trace given its name and options.\n *\n * Only available on web.\n *\n * @since 6.3.0\n */\n record(options: RecordOptions): Promise<void>;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface StartTraceOptions {\n /**\n * Custom trace name.\n *\n * Names for custom code traces must meet the following requirements:\n * no leading or trailing whitespace, no leading underscore (_) character,\n * and max length is 100 characters.\n *\n * @since 0.1.0\n */\n traceName: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface StopTraceOptions {\n /**\n * Name of the trace that was set with `startTrace`.\n *\n * @since 0.1.0\n */\n traceName: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface IncrementMetricOptions {\n /**\n * Name of the trace that was set with `startTrace`.\n *\n * @since 0.1.0\n */\n traceName: string;\n /**\n * Name of the metric to be incremented.\n *\n * @since 0.1.0\n */\n metricName: string;\n /**\n * Amount by which the metric has to be incremented.\n *\n * @default 1\n * @since 0.1.0\n */\n incrementBy?: number;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface SetEnabledOptions {\n /**\n * Should performance monitoring be enabled.\n *\n * @since 0.1.0\n */\n enabled: boolean;\n}\n\nexport interface IsEnabledResult {\n /**\n * `true` if performance monitoring is enabled, otherwise `false`.\n *\n * @since 0.1.0\n */\n enabled: boolean;\n}\n\n/**\n * @since 6.3.0\n */\nexport interface PutAttributeOptions {\n /**\n * Name of the trace to set its attribute.\n *\n * @since 6.3.0\n */\n traceName: string;\n /**\n * Name of the attribute to set its value.\n *\n * @since 6.3.0\n * @example \"experiment\"\n */\n attribute: string;\n /**\n * The value to set to the attribute.\n *\n * @since 6.3.0\n * @example \"A\"\n */\n value: string;\n}\n\n/**\n * @since 6.3.0\n */\nexport interface GetAttributeOptions {\n /**\n * Name of the trace to set its attribute.\n *\n * @since 6.3.0\n */\n traceName: string;\n /**\n * Name of the attribute to retrieve its value.\n *\n * @since 6.3.0\n */\n attribute: string;\n}\n\n/**\n * @since 6.3.0\n */\nexport interface GetAttributeResult {\n /**\n * The value of the custom attribute.\n *\n * @since 6.3.0\n */\n value: string | null;\n}\n\n/**\n * @since 6.3.0\n */\nexport interface GetAttributesOptions {\n /**\n * Name of the trace to get its attributes.\n *\n * @since 6.3.0\n */\n traceName: string;\n}\n\n/**\n * @since 6.3.0\n */\nexport interface GetAttributesResult {\n /**\n * A map of all custom attributes of a trace with their values.\n *\n * @since 6.3.0\n */\n attributes: { [key: string]: string };\n}\n\n/**\n * @since 6.3.0\n */\nexport type RemoveAttributeOptions = GetAttributeOptions;\n\n/**\n * @since 6.3.0\n */\nexport interface PutMetricOptions {\n /**\n * Name of the trace to set its metric.\n *\n * @since 6.3.0\n */\n traceName: string;\n /**\n * The metric name.\n *\n * @since 6.3.0\n */\n metricName: string;\n /**\n * The value to set for the metric.\n * The given value is floored down to the nearest integer.\n *\n * @since 6.3.0\n */\n num: number;\n}\n\n/**\n * @since 6.3.0\n */\nexport interface GetMetricOptions {\n /**\n * Name of the trace to get its metric.\n *\n * @since 6.3.0\n */\n traceName: string;\n /**\n * The metric name.\n *\n * @since 6.3.0\n */\n metricName: string;\n}\n\n/**\n * @since 6.3.0\n */\nexport interface GetMetricResult {\n /**\n * The value of the metric if exists.\n *\n * @since 6.3.0\n */\n value: number;\n}\n\n/**\n * @since 6.3.0\n */\nexport interface RecordOptions {\n /**\n * Name of the trace to record.\n *\n * @since 6.3.0\n */\n traceName: string;\n /**\n * Start time of the trace since epoch in milliseconds.\n *\n * @since 6.3.0\n */\n startTime: number;\n /**\n * The duration of the trace in milliseconds.\n *\n * @since 6.3.0\n */\n duration: number;\n /**\n * An optional object that holds optional maps of custom metrics and attributes.\n *\n * @since 6.3.0\n */\n options?: {\n /**\n * An optional map of metrics to be set on the trace.\n *\n * @since 6.3.0\n */\n metrics?: { [key: string]: number };\n /**\n * An optional map of attributes to be set on the trace.\n *\n * @since 6.3.0\n */\n attributes?: { [key: string]: string };\n };\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { FirebasePerformancePlugin, IncrementMetricOptions, IsEnabledResult, SetEnabledOptions, StartTraceOptions, StopTraceOptions } from './definitions';
2
+ import type { FirebasePerformancePlugin, GetAttributeOptions, GetAttributeResult, GetAttributesOptions, GetAttributesResult, GetMetricOptions, GetMetricResult, IncrementMetricOptions, IsEnabledResult, PutAttributeOptions, PutMetricOptions, RecordOptions, RemoveAttributeOptions, SetEnabledOptions, StartTraceOptions, StopTraceOptions } from './definitions';
3
3
  export declare class FirebasePerformanceWeb extends WebPlugin implements FirebasePerformancePlugin {
4
4
  private traces;
5
5
  startTrace(options: StartTraceOptions): Promise<void>;
@@ -7,4 +7,11 @@ export declare class FirebasePerformanceWeb extends WebPlugin implements Firebas
7
7
  incrementMetric(options: IncrementMetricOptions): Promise<void>;
8
8
  setEnabled(options: SetEnabledOptions): Promise<void>;
9
9
  isEnabled(): Promise<IsEnabledResult>;
10
+ putAttribute({ traceName, attribute, value, }: PutAttributeOptions): Promise<void>;
11
+ getAttribute({ traceName, attribute, }: GetAttributeOptions): Promise<GetAttributeResult>;
12
+ getAttributes({ traceName, }: GetAttributesOptions): Promise<GetAttributesResult>;
13
+ removeAttribute({ traceName, attribute, }: RemoveAttributeOptions): Promise<void>;
14
+ putMetric({ traceName, metricName, num, }: PutMetricOptions): Promise<void>;
15
+ getMetric({ traceName, metricName, }: GetMetricOptions): Promise<GetMetricResult>;
16
+ record({ traceName, startTime, duration, options, }: RecordOptions): Promise<void>;
10
17
  }
package/dist/esm/web.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import { getPerformance, trace as createTrace } from 'firebase/performance';
2
+ import { trace as createTrace, getPerformance } from 'firebase/performance';
3
3
  export class FirebasePerformanceWeb extends WebPlugin {
4
4
  constructor() {
5
5
  super(...arguments);
@@ -38,5 +38,54 @@ export class FirebasePerformanceWeb extends WebPlugin {
38
38
  };
39
39
  return result;
40
40
  }
41
+ async putAttribute({ traceName, attribute, value, }) {
42
+ const trace = this.traces[traceName];
43
+ if (!trace) {
44
+ return;
45
+ }
46
+ trace.putAttribute(attribute, value);
47
+ return;
48
+ }
49
+ async getAttribute({ traceName, attribute, }) {
50
+ var _a;
51
+ const trace = this.traces[traceName];
52
+ if (!trace) {
53
+ return { value: null };
54
+ }
55
+ return { value: (_a = trace.getAttribute(attribute)) !== null && _a !== void 0 ? _a : null };
56
+ }
57
+ async getAttributes({ traceName, }) {
58
+ const trace = this.traces[traceName];
59
+ if (!trace) {
60
+ return { attributes: {} };
61
+ }
62
+ return { attributes: trace.getAttributes() };
63
+ }
64
+ async removeAttribute({ traceName, attribute, }) {
65
+ const trace = this.traces[traceName];
66
+ if (!trace) {
67
+ return;
68
+ }
69
+ trace.removeAttribute(attribute);
70
+ }
71
+ async putMetric({ traceName, metricName, num, }) {
72
+ const trace = this.traces[traceName];
73
+ if (!trace) {
74
+ return;
75
+ }
76
+ trace.putMetric(metricName, num);
77
+ }
78
+ async getMetric({ traceName, metricName, }) {
79
+ const trace = this.traces[traceName];
80
+ if (!trace) {
81
+ return { value: 0 };
82
+ }
83
+ return { value: trace.getMetric(metricName) };
84
+ }
85
+ async record({ traceName, startTime, duration, options, }) {
86
+ const perf = getPerformance();
87
+ const trace = createTrace(perf, traceName);
88
+ trace.record(startTime, duration, options);
89
+ }
41
90
  }
42
91
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAW5E,MAAM,OAAO,sBACX,SAAQ,SAAS;IADnB;;QAIU,WAAM,GAAoD,EAAE,CAAC;IAuCvE,CAAC;IArCQ,KAAK,CAAC,UAAU,CAAC,OAA0B;QAChD,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACnD,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;IACzC,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,OAAyB;QAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,OAA+B;QAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,OAA0B;QAChD,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;QAC9C,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,SAAS;QACpB,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAoB;YAC9B,OAAO,EAAE,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,qBAAqB;SACnE,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PerformanceTrace } from 'firebase/performance';\nimport { getPerformance, trace as createTrace } from 'firebase/performance';\n\nimport type {\n FirebasePerformancePlugin,\n IncrementMetricOptions,\n IsEnabledResult,\n SetEnabledOptions,\n StartTraceOptions,\n StopTraceOptions,\n} from './definitions';\n\nexport class FirebasePerformanceWeb\n extends WebPlugin\n implements FirebasePerformancePlugin\n{\n private traces: { [key: string]: PerformanceTrace | undefined } = {};\n\n public async startTrace(options: StartTraceOptions): Promise<void> {\n const perf = getPerformance();\n const trace = createTrace(perf, options.traceName);\n trace.start();\n this.traces[options.traceName] = trace;\n }\n\n public async stopTrace(options: StopTraceOptions): Promise<void> {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.stop();\n delete this.traces[options.traceName];\n }\n\n public async incrementMetric(options: IncrementMetricOptions): Promise<void> {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.incrementMetric(options.metricName, options.incrementBy);\n }\n\n public async setEnabled(options: SetEnabledOptions): Promise<void> {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n\n public async isEnabled(): Promise<IsEnabledResult> {\n const perf = getPerformance();\n const result: IsEnabledResult = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAqB5E,MAAM,OAAO,sBACX,SAAQ,SAAS;IADnB;;QAIU,WAAM,GAAoD,EAAE,CAAC;IAsHvE,CAAC;IApHQ,KAAK,CAAC,UAAU,CAAC,OAA0B;QAChD,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;QACnD,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;IACzC,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,OAAyB;QAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,OAA+B;QAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,WAAW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,EAAE,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC;IAC/C,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,EAC3B,SAAS,EACT,SAAS,GACc;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,EACrB,SAAS,EACT,UAAU,EACV,GAAG,GACc;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,KAAK,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,EACrB,SAAS,EACT,UAAU,GACO;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;SACrB;QACD,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,EAClB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,GACO;QACd,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC3C,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PerformanceTrace } from 'firebase/performance';\nimport { trace as createTrace, getPerformance } from 'firebase/performance';\n\nimport type {\n FirebasePerformancePlugin,\n GetAttributeOptions,\n GetAttributeResult,\n GetAttributesOptions,\n GetAttributesResult,\n GetMetricOptions,\n GetMetricResult,\n IncrementMetricOptions,\n IsEnabledResult,\n PutAttributeOptions,\n PutMetricOptions,\n RecordOptions,\n RemoveAttributeOptions,\n SetEnabledOptions,\n StartTraceOptions,\n StopTraceOptions,\n} from './definitions';\n\nexport class FirebasePerformanceWeb\n extends WebPlugin\n implements FirebasePerformancePlugin\n{\n private traces: { [key: string]: PerformanceTrace | undefined } = {};\n\n public async startTrace(options: StartTraceOptions): Promise<void> {\n const perf = getPerformance();\n const trace = createTrace(perf, options.traceName);\n trace.start();\n this.traces[options.traceName] = trace;\n }\n\n public async stopTrace(options: StopTraceOptions): Promise<void> {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.stop();\n delete this.traces[options.traceName];\n }\n\n public async incrementMetric(options: IncrementMetricOptions): Promise<void> {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.incrementMetric(options.metricName, options.incrementBy);\n }\n\n public async setEnabled(options: SetEnabledOptions): Promise<void> {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n\n public async isEnabled(): Promise<IsEnabledResult> {\n const perf = getPerformance();\n const result: IsEnabledResult = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n\n public async putAttribute({\n traceName,\n attribute,\n value,\n }: PutAttributeOptions): Promise<void> {\n const trace = this.traces[traceName];\n if (!trace) {\n return;\n }\n trace.putAttribute(attribute, value);\n return;\n }\n\n public async getAttribute({\n traceName,\n attribute,\n }: GetAttributeOptions): Promise<GetAttributeResult> {\n const trace = this.traces[traceName];\n if (!trace) {\n return { value: null };\n }\n return { value: trace.getAttribute(attribute) ?? null };\n }\n\n public async getAttributes({\n traceName,\n }: GetAttributesOptions): Promise<GetAttributesResult> {\n const trace = this.traces[traceName];\n if (!trace) {\n return { attributes: {} };\n }\n return { attributes: trace.getAttributes() };\n }\n\n public async removeAttribute({\n traceName,\n attribute,\n }: RemoveAttributeOptions): Promise<void> {\n const trace = this.traces[traceName];\n if (!trace) {\n return;\n }\n trace.removeAttribute(attribute);\n }\n\n public async putMetric({\n traceName,\n metricName,\n num,\n }: PutMetricOptions): Promise<void> {\n const trace = this.traces[traceName];\n if (!trace) {\n return;\n }\n trace.putMetric(metricName, num);\n }\n\n public async getMetric({\n traceName,\n metricName,\n }: GetMetricOptions): Promise<GetMetricResult> {\n const trace = this.traces[traceName];\n if (!trace) {\n return { value: 0 };\n }\n return { value: trace.getMetric(metricName) };\n }\n\n public async record({\n traceName,\n startTime,\n duration,\n options,\n }: RecordOptions): Promise<void> {\n const perf = getPerformance();\n const trace = createTrace(perf, traceName);\n trace.record(startTime, duration, options);\n }\n}\n"]}
@@ -47,6 +47,55 @@ class FirebasePerformanceWeb extends core.WebPlugin {
47
47
  };
48
48
  return result;
49
49
  }
50
+ async putAttribute({ traceName, attribute, value, }) {
51
+ const trace = this.traces[traceName];
52
+ if (!trace) {
53
+ return;
54
+ }
55
+ trace.putAttribute(attribute, value);
56
+ return;
57
+ }
58
+ async getAttribute({ traceName, attribute, }) {
59
+ var _a;
60
+ const trace = this.traces[traceName];
61
+ if (!trace) {
62
+ return { value: null };
63
+ }
64
+ return { value: (_a = trace.getAttribute(attribute)) !== null && _a !== void 0 ? _a : null };
65
+ }
66
+ async getAttributes({ traceName, }) {
67
+ const trace = this.traces[traceName];
68
+ if (!trace) {
69
+ return { attributes: {} };
70
+ }
71
+ return { attributes: trace.getAttributes() };
72
+ }
73
+ async removeAttribute({ traceName, attribute, }) {
74
+ const trace = this.traces[traceName];
75
+ if (!trace) {
76
+ return;
77
+ }
78
+ trace.removeAttribute(attribute);
79
+ }
80
+ async putMetric({ traceName, metricName, num, }) {
81
+ const trace = this.traces[traceName];
82
+ if (!trace) {
83
+ return;
84
+ }
85
+ trace.putMetric(metricName, num);
86
+ }
87
+ async getMetric({ traceName, metricName, }) {
88
+ const trace = this.traces[traceName];
89
+ if (!trace) {
90
+ return { value: 0 };
91
+ }
92
+ return { value: trace.getMetric(metricName) };
93
+ }
94
+ async record({ traceName, startTime, duration, options, }) {
95
+ const perf = performance.getPerformance();
96
+ const trace = performance.trace(perf, traceName);
97
+ trace.record(startTime, duration, options);
98
+ }
50
99
  }
51
100
 
52
101
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FirebasePerformance = registerPlugin('FirebasePerformance', {\n web: () => import('./web').then(m => new m.FirebasePerformanceWeb()),\n});\nexport * from './definitions';\nexport { FirebasePerformance };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { getPerformance, trace as createTrace } from 'firebase/performance';\nexport class FirebasePerformanceWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.traces = {};\n }\n async startTrace(options) {\n const perf = getPerformance();\n const trace = createTrace(perf, options.traceName);\n trace.start();\n this.traces[options.traceName] = trace;\n }\n async stopTrace(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.stop();\n delete this.traces[options.traceName];\n }\n async incrementMetric(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.incrementMetric(options.metricName, options.incrementBy);\n }\n async setEnabled(options) {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n async isEnabled() {\n const perf = getPerformance();\n const result = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","getPerformance","createTrace"],"mappings":";;;;;;;AACK,MAAC,mBAAmB,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;AAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,C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AAM,IAAI,GAAGD,0BAAc,EAAE,CAAC;AACtC,QAAQ,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;AACtD,QAAQ,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;AACrD,KAAK;AACL,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,MAAM,IAAI,GAAGA,0BAAc,EAAE,CAAC;AACtC,QAAQ,MAAM,MAAM,GAAG;AACvB,YAAY,OAAO,EAAE,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,qBAAqB;AAC9E,SAAS,CAAC;AACV,QAAQ,OAAO,MAAM,CAAC;AACtB,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FirebasePerformance = registerPlugin('FirebasePerformance', {\n web: () => import('./web').then(m => new m.FirebasePerformanceWeb()),\n});\nexport * from './definitions';\nexport { FirebasePerformance };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { trace as createTrace, getPerformance } from 'firebase/performance';\nexport class FirebasePerformanceWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.traces = {};\n }\n async startTrace(options) {\n const perf = getPerformance();\n const trace = createTrace(perf, options.traceName);\n trace.start();\n this.traces[options.traceName] = trace;\n }\n async stopTrace(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.stop();\n delete this.traces[options.traceName];\n }\n async incrementMetric(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.incrementMetric(options.metricName, options.incrementBy);\n }\n async setEnabled(options) {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n async isEnabled() {\n const perf = getPerformance();\n const result = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n async putAttribute({ traceName, attribute, value, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return;\n }\n trace.putAttribute(attribute, value);\n return;\n }\n async getAttribute({ traceName, attribute, }) {\n var _a;\n const trace = this.traces[traceName];\n if (!trace) {\n return { value: null };\n }\n return { value: (_a = trace.getAttribute(attribute)) !== null && _a !== void 0 ? _a : null };\n }\n async getAttributes({ traceName, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return { attributes: {} };\n }\n return { attributes: trace.getAttributes() };\n }\n async removeAttribute({ traceName, attribute, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return;\n }\n trace.removeAttribute(attribute);\n }\n async putMetric({ traceName, metricName, num, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return;\n }\n trace.putMetric(metricName, num);\n }\n async getMetric({ traceName, metricName, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return { value: 0 };\n }\n return { value: trace.getMetric(metricName) };\n }\n async record({ traceName, startTime, duration, options, }) {\n const perf = getPerformance();\n const trace = createTrace(perf, traceName);\n trace.record(startTime, duration, options);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","getPerformance","createTrace"],"mappings":";;;;;;;AACK,MAAC,mBAAmB,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;AAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;AACxE,CAAC;;ACDM,MAAM,sBAAsB,SAASC,cAAS,CAAC;AACtD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;AAC5B,QAAQ,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;AACzB,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;AAC9B,QAAQ,MAAM,IAAI,GAAGC,0BAAc,EAAE,CAAC;AACtC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,OAAO,CA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AS,CAAC,CAAC;AAC7C,QAAQ,IAAI,CAAC,KAAK,EAAE;AACpB,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;AACzC,KAAK;AACL,IAAI,MAAM,SAAS,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,GAAG,EAAE;AACrD,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC7C,QAAQ,IAAI,CAAC,KAAK,EAAE;AACpB,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,KAAK,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AACzC,KAAK;AACL,IAAI,MAAM,SAAS,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,EAAE;AAChD,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC7C,QAAQ,IAAI,CAAC,KAAK,EAAE;AACpB,YAAY,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAChC,SAAS;AACT,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;AACtD,KAAK;AACL,IAAI,MAAM,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE;AAC/D,QAAQ,MAAM,IAAI,GAAGA,0BAAc,EAAE,CAAC;AACtC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AACnD,QAAQ,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACnD,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -43,6 +43,55 @@ var capacitorFirebasePerformance = (function (exports, core, performance) {
43
43
  };
44
44
  return result;
45
45
  }
46
+ async putAttribute({ traceName, attribute, value, }) {
47
+ const trace = this.traces[traceName];
48
+ if (!trace) {
49
+ return;
50
+ }
51
+ trace.putAttribute(attribute, value);
52
+ return;
53
+ }
54
+ async getAttribute({ traceName, attribute, }) {
55
+ var _a;
56
+ const trace = this.traces[traceName];
57
+ if (!trace) {
58
+ return { value: null };
59
+ }
60
+ return { value: (_a = trace.getAttribute(attribute)) !== null && _a !== void 0 ? _a : null };
61
+ }
62
+ async getAttributes({ traceName, }) {
63
+ const trace = this.traces[traceName];
64
+ if (!trace) {
65
+ return { attributes: {} };
66
+ }
67
+ return { attributes: trace.getAttributes() };
68
+ }
69
+ async removeAttribute({ traceName, attribute, }) {
70
+ const trace = this.traces[traceName];
71
+ if (!trace) {
72
+ return;
73
+ }
74
+ trace.removeAttribute(attribute);
75
+ }
76
+ async putMetric({ traceName, metricName, num, }) {
77
+ const trace = this.traces[traceName];
78
+ if (!trace) {
79
+ return;
80
+ }
81
+ trace.putMetric(metricName, num);
82
+ }
83
+ async getMetric({ traceName, metricName, }) {
84
+ const trace = this.traces[traceName];
85
+ if (!trace) {
86
+ return { value: 0 };
87
+ }
88
+ return { value: trace.getMetric(metricName) };
89
+ }
90
+ async record({ traceName, startTime, duration, options, }) {
91
+ const perf = performance.getPerformance();
92
+ const trace = performance.trace(perf, traceName);
93
+ trace.record(startTime, duration, options);
94
+ }
46
95
  }
47
96
 
48
97
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FirebasePerformance = registerPlugin('FirebasePerformance', {\n web: () => import('./web').then(m => new m.FirebasePerformanceWeb()),\n});\nexport * from './definitions';\nexport { FirebasePerformance };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { getPerformance, trace as createTrace } from 'firebase/performance';\nexport class FirebasePerformanceWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.traces = {};\n }\n async startTrace(options) {\n const perf = getPerformance();\n const trace = createTrace(perf, options.traceName);\n trace.start();\n this.traces[options.traceName] = trace;\n }\n async stopTrace(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.stop();\n delete this.traces[options.traceName];\n }\n async incrementMetric(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.incrementMetric(options.metricName, options.incrementBy);\n }\n async setEnabled(options) {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n async isEnabled() {\n const perf = getPerformance();\n const result = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","getPerformance","createTrace"],"mappings":";;;AACK,UAAC,mBAAmB,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;IAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;IACxE,CAAC;;ICDM,MAAM,sBAAsB,SAASC,cAAS,CAAC;IACtD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,QAAQ,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACzB,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,MAAM,IAAI,GAAGC,0BAAc,EAAE,CAAC;IACtC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3D,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,QAAQ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;IAC/C,KAAK;IACL,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;IAC7B,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrD,QAAQ,IAAI,CAAC,KAAK,EAAE;IACpB,YAAY,OAAO;IACnB,SAAS;IACT,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,QAAQ,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9C,KAAK;IACL,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;IACnC,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrD,QAAQ,IAAI,CAAC,KAAK,EAAE;IACpB,YAAY,OAAO;IACnB,SAAS;IACT,QAAQ,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACvE,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,MAAM,IAAI,GAAGD,0BAAc,EAAE,CAAC;IACtC,QAAQ,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;IACtD,QAAQ,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC;IACrD,KAAK;IACL,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,MAAM,IAAI,GAAGA,0BAAc,EAAE,CAAC;IACtC,QAAQ,MAAM,MAAM,GAAG;IACvB,YAAY,OAAO,EAAE,IAAI,CAAC,sBAAsB,IAAI,IAAI,CAAC,qBAAqB;IAC9E,SAAS,CAAC;IACV,QAAQ,OAAO,MAAM,CAAC;IACtB,KAAK;IACL;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst FirebasePerformance = registerPlugin('FirebasePerformance', {\n web: () => import('./web').then(m => new m.FirebasePerformanceWeb()),\n});\nexport * from './definitions';\nexport { FirebasePerformance };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nimport { trace as createTrace, getPerformance } from 'firebase/performance';\nexport class FirebasePerformanceWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.traces = {};\n }\n async startTrace(options) {\n const perf = getPerformance();\n const trace = createTrace(perf, options.traceName);\n trace.start();\n this.traces[options.traceName] = trace;\n }\n async stopTrace(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.stop();\n delete this.traces[options.traceName];\n }\n async incrementMetric(options) {\n const trace = this.traces[options.traceName];\n if (!trace) {\n return;\n }\n trace.incrementMetric(options.metricName, options.incrementBy);\n }\n async setEnabled(options) {\n const perf = getPerformance();\n perf.instrumentationEnabled = options.enabled;\n perf.dataCollectionEnabled = options.enabled;\n }\n async isEnabled() {\n const perf = getPerformance();\n const result = {\n enabled: perf.instrumentationEnabled || perf.dataCollectionEnabled,\n };\n return result;\n }\n async putAttribute({ traceName, attribute, value, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return;\n }\n trace.putAttribute(attribute, value);\n return;\n }\n async getAttribute({ traceName, attribute, }) {\n var _a;\n const trace = this.traces[traceName];\n if (!trace) {\n return { value: null };\n }\n return { value: (_a = trace.getAttribute(attribute)) !== null && _a !== void 0 ? _a : null };\n }\n async getAttributes({ traceName, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return { attributes: {} };\n }\n return { attributes: trace.getAttributes() };\n }\n async removeAttribute({ traceName, attribute, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return;\n }\n trace.removeAttribute(attribute);\n }\n async putMetric({ traceName, metricName, num, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return;\n }\n trace.putMetric(metricName, num);\n }\n async getMetric({ traceName, metricName, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n return { value: 0 };\n }\n return { value: trace.getMetric(metricName) };\n }\n async record({ traceName, startTime, duration, options, }) {\n const perf = getPerformance();\n const trace = createTrace(perf, traceName);\n trace.record(startTime, duration, options);\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","getPerformance","createTrace"],"mappings":";;;AACK,UAAC,mBAAmB,GAAGA,mBAAc,CAAC,qBAAqB,EAAE;IAClE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,sBAAsB,EAAE,CAAC;IACxE,CAAC;;ICDM,MAAM,sBAAsB,SAASC,cAAS,CAAC;IACtD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC;IAC5B,QAAQ,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACzB,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,MAAM,IAAI,GAAGC,0BAAc,EAAE,CAAC;IACtC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3D,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,QAAQ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;IAC/C,KAAK;IACL,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;IAC7B,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrD,QAAQ,IAAI,CAAC,KAAK,EAAE;IACpB,YAAY,OAAO;IACnB,SAAS;IACT,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,QAAQ,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9C,KAAK;IACL,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;IACnC,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrD,QAAQ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AE;IACpB,YAAY,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAChC,SAAS;IACT,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;IACtD,KAAK;IACL,IAAI,MAAM,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE;IAC/D,QAAQ,MAAM,IAAI,GAAGA,0BAAc,EAAE,CAAC;IACtC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACnD,QAAQ,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,KAAK;IACL;;;;;;;;;;;;;;;;;"}
@@ -43,4 +43,28 @@ import FirebasePerformance
43
43
  @objc public func isEnabled() -> Bool {
44
44
  return Performance.sharedInstance().isDataCollectionEnabled
45
45
  }
46
+
47
+ @objc public static func putAttribute(_ trace: Trace, _ attribute: String, _ value: String) {
48
+ trace.setValue(value, forAttribute: attribute)
49
+ }
50
+
51
+ @objc public static func getAttribute(_ trace: Trace, _ attribute: String) -> String? {
52
+ return trace.value(forAttribute: attribute)
53
+ }
54
+
55
+ @objc public static func getAttributes(_ trace: Trace) -> [String: String] {
56
+ return trace.attributes
57
+ }
58
+
59
+ @objc public static func removeAttribute(_ trace: Trace, _ attribute: String) {
60
+ trace.removeAttribute(attribute)
61
+ }
62
+
63
+ @objc public static func putMetric(_ trace: Trace, _ metricName: String, _ num: Double) {
64
+ trace.setValue(Int64(floor(num)), forMetric: metricName)
65
+ }
66
+
67
+ @objc public static func getMetric(_ trace: Trace, _ metricName: String) -> Int64 {
68
+ return trace.valueForMetric(metricName)
69
+ }
46
70
  }
@@ -9,4 +9,11 @@ CAP_PLUGIN(FirebasePerformancePlugin, "FirebasePerformance",
9
9
  CAP_PLUGIN_METHOD(incrementMetric, CAPPluginReturnPromise);
10
10
  CAP_PLUGIN_METHOD(setEnabled, CAPPluginReturnPromise);
11
11
  CAP_PLUGIN_METHOD(isEnabled, CAPPluginReturnPromise);
12
+ CAP_PLUGIN_METHOD(putAttribute, CAPPluginReturnPromise);
13
+ CAP_PLUGIN_METHOD(getAttribute, CAPPluginReturnPromise);
14
+ CAP_PLUGIN_METHOD(getAttributes, CAPPluginReturnPromise);
15
+ CAP_PLUGIN_METHOD(removeAttribute, CAPPluginReturnPromise);
16
+ CAP_PLUGIN_METHOD(putMetric, CAPPluginReturnPromise);
17
+ CAP_PLUGIN_METHOD(getMetric, CAPPluginReturnPromise);
18
+ CAP_PLUGIN_METHOD(record, CAPPluginReturnPromise);
12
19
  )