@capacitor-firebase/performance 6.3.0 → 7.0.0-dev.1765885034

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.
@@ -11,9 +11,9 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
- s.ios.deployment_target = '13.0'
14
+ s.ios.deployment_target = '15.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'FirebasePerformance', '~> 11.0'
16
+ s.dependency 'FirebasePerformance', '~> 12.7.0'
17
17
  s.swift_version = '5.1'
18
18
  s.static_framework = true
19
19
  end
package/Package.swift ADDED
@@ -0,0 +1,31 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "CapacitorFirebasePerformance",
6
+ platforms: [.iOS(.v15)],
7
+ products: [
8
+ .library(
9
+ name: "CapacitorFirebasePerformance",
10
+ targets: ["FirebasePerformancePlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
14
+ .package(url: "https://github.com/firebase/firebase-ios-sdk.git", .upToNextMajor(from: "12.7.0"))
15
+ ],
16
+ targets: [
17
+ .target(
18
+ name: "FirebasePerformancePlugin",
19
+ dependencies: [
20
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
21
+ .product(name: "Cordova", package: "capacitor-swift-pm"),
22
+ .product(name: "FirebaseCore", package: "firebase-ios-sdk"),
23
+ .product(name: "FirebasePerformance", package: "firebase-ios-sdk")
24
+ ],
25
+ path: "ios/Plugin"),
26
+ .testTarget(
27
+ name: "FirebasePerformancePluginTests",
28
+ dependencies: ["FirebasePerformancePlugin"],
29
+ path: "ios/PluginTests")
30
+ ]
31
+ )
package/README.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  Unofficial Capacitor plugin for [Firebase Performance Monitoring](https://firebase.google.com/docs/perf-mon).[^1]
4
4
 
5
+ <div class="capawesome-z29o10a">
6
+ <a href="https://cloud.capawesome.io/" target="_blank">
7
+ <img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-deploy-real-time-app-updates.png?t=1" />
8
+ </a>
9
+ </div>
10
+
11
+ ## Compatibility
12
+
13
+ | Plugin Version | Capacitor Version | Status |
14
+ | -------------- | ----------------- | -------------- |
15
+ | 8.x.x | >=8.x.x | Active support |
16
+ | 7.x.x | 7.x.x | Deprecated |
17
+ | 6.x.x | 6.x.x | Deprecated |
18
+ | 5.x.x | 5.x.x | Deprecated |
19
+ | 1.x.x | 4.x.x | Deprecated |
20
+
5
21
  ## Installation
6
22
 
7
23
  ```bash
@@ -17,9 +33,11 @@ See [Add the Performance Monitoring plugin to your app](https://firebase.google.
17
33
 
18
34
  #### Variables
19
35
 
20
- This plugin will use the following project variables (defined in your app’s `variables.gradle` file):
36
+ If needed, you can define the following project variable in your app’s `variables.gradle` file to change the default version of the dependency:
37
+
38
+ - `$firebasePerfVersion` version of `com.google.firebase:firebase-perf` (default: `22.0.4`)
21
39
 
22
- - `$firebasePerfVersion` version of `com.google.firebase:firebase-perf` (default: `20.3.1`)
40
+ This can be useful if you encounter dependency conflicts with other plugins in your project.
23
41
 
24
42
  ## Configuration
25
43
 
@@ -1,9 +1,9 @@
1
1
  ext {
2
2
  junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
- androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4
- androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5
- androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
6
- firebasePerfVersion = project.hasProperty('firebasePerfVersion') ? rootProject.ext.firebasePerfVersion : '20.5.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
6
+ firebasePerfVersion = project.hasProperty('firebasePerfVersion') ? rootProject.ext.firebasePerfVersion : '22.0.4'
7
7
  }
8
8
 
9
9
  buildscript {
@@ -12,18 +12,18 @@ buildscript {
12
12
  mavenCentral()
13
13
  }
14
14
  dependencies {
15
- classpath 'com.android.tools.build:gradle:8.2.1'
15
+ classpath 'com.android.tools.build:gradle:8.13.0'
16
16
  }
17
17
  }
18
18
 
19
19
  apply plugin: 'com.android.library'
20
20
 
21
21
  android {
22
- namespace "io.capawesome.capacitorjs.plugins.firebase.performance"
23
- compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
22
+ namespace = "io.capawesome.capacitorjs.plugins.firebase.performance"
23
+ compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
24
24
  defaultConfig {
25
- minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
26
- targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
25
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
26
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
27
27
  versionCode 1
28
28
  versionName "1.0"
29
29
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -35,11 +35,11 @@ android {
35
35
  }
36
36
  }
37
37
  lintOptions {
38
- abortOnError false
38
+ abortOnError = false
39
39
  }
40
40
  compileOptions {
41
- sourceCompatibility JavaVersion.VERSION_17
42
- targetCompatibility JavaVersion.VERSION_17
41
+ sourceCompatibility JavaVersion.VERSION_21
42
+ targetCompatibility JavaVersion.VERSION_21
43
43
  }
44
44
  }
45
45
 
@@ -224,7 +224,7 @@ export interface GetAttributesResult {
224
224
  /**
225
225
  * @since 6.3.0
226
226
  */
227
- export declare type RemoveAttributeOptions = GetAttributeOptions;
227
+ export type RemoveAttributeOptions = GetAttributeOptions;
228
228
  /**
229
229
  * @since 6.3.0
230
230
  */
package/dist/esm/web.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
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
+ private static readonly ERROR_TRACE_NOT_FOUND;
4
5
  private traces;
5
6
  startTrace(options: StartTraceOptions): Promise<void>;
6
7
  stopTrace(options: StopTraceOptions): Promise<void>;
package/dist/esm/web.js CHANGED
@@ -14,7 +14,7 @@ export class FirebasePerformanceWeb extends WebPlugin {
14
14
  async stopTrace(options) {
15
15
  const trace = this.traces[options.traceName];
16
16
  if (!trace) {
17
- return;
17
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
18
18
  }
19
19
  trace.stop();
20
20
  delete this.traces[options.traceName];
@@ -22,7 +22,7 @@ export class FirebasePerformanceWeb extends WebPlugin {
22
22
  async incrementMetric(options) {
23
23
  const trace = this.traces[options.traceName];
24
24
  if (!trace) {
25
- return;
25
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
26
26
  }
27
27
  trace.incrementMetric(options.metricName, options.incrementBy);
28
28
  }
@@ -41,7 +41,7 @@ export class FirebasePerformanceWeb extends WebPlugin {
41
41
  async putAttribute({ traceName, attribute, value, }) {
42
42
  const trace = this.traces[traceName];
43
43
  if (!trace) {
44
- return;
44
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
45
45
  }
46
46
  trace.putAttribute(attribute, value);
47
47
  return;
@@ -50,35 +50,35 @@ export class FirebasePerformanceWeb extends WebPlugin {
50
50
  var _a;
51
51
  const trace = this.traces[traceName];
52
52
  if (!trace) {
53
- return { value: null };
53
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
54
54
  }
55
55
  return { value: (_a = trace.getAttribute(attribute)) !== null && _a !== void 0 ? _a : null };
56
56
  }
57
57
  async getAttributes({ traceName, }) {
58
58
  const trace = this.traces[traceName];
59
59
  if (!trace) {
60
- return { attributes: {} };
60
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
61
61
  }
62
62
  return { attributes: trace.getAttributes() };
63
63
  }
64
64
  async removeAttribute({ traceName, attribute, }) {
65
65
  const trace = this.traces[traceName];
66
66
  if (!trace) {
67
- return;
67
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
68
68
  }
69
69
  trace.removeAttribute(attribute);
70
70
  }
71
71
  async putMetric({ traceName, metricName, num, }) {
72
72
  const trace = this.traces[traceName];
73
73
  if (!trace) {
74
- return;
74
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
75
75
  }
76
76
  trace.putMetric(metricName, num);
77
77
  }
78
78
  async getMetric({ traceName, metricName, }) {
79
79
  const trace = this.traces[traceName];
80
80
  if (!trace) {
81
- return { value: 0 };
81
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
82
82
  }
83
83
  return { value: trace.getMetric(metricName) };
84
84
  }
@@ -88,4 +88,5 @@ export class FirebasePerformanceWeb extends WebPlugin {
88
88
  trace.record(startTime, duration, options);
89
89
  }
90
90
  }
91
+ FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND = 'No trace was found with the provided traceName.';
91
92
  //# 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,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,CAAC,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,OAA0B;QAChD,MAAM,IAAI,GAAG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,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"]}
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;;QAMU,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,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC;QAChE,CAAC;QACD,KAAK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ACrB,SAAS,EACT,UAAU,GACO;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC;QAChE,CAAC;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;;AAvHuB,4CAAqB,GAC3C,iDAAiD,AADN,CACO","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 static readonly ERROR_TRACE_NOT_FOUND =\n 'No trace was found with the provided traceName.';\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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"]}
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var core = require('@capacitor/core');
6
4
  var performance = require('firebase/performance');
7
5
 
@@ -23,7 +21,7 @@ class FirebasePerformanceWeb extends core.WebPlugin {
23
21
  async stopTrace(options) {
24
22
  const trace = this.traces[options.traceName];
25
23
  if (!trace) {
26
- return;
24
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
27
25
  }
28
26
  trace.stop();
29
27
  delete this.traces[options.traceName];
@@ -31,7 +29,7 @@ class FirebasePerformanceWeb extends core.WebPlugin {
31
29
  async incrementMetric(options) {
32
30
  const trace = this.traces[options.traceName];
33
31
  if (!trace) {
34
- return;
32
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
35
33
  }
36
34
  trace.incrementMetric(options.metricName, options.incrementBy);
37
35
  }
@@ -50,7 +48,7 @@ class FirebasePerformanceWeb extends core.WebPlugin {
50
48
  async putAttribute({ traceName, attribute, value, }) {
51
49
  const trace = this.traces[traceName];
52
50
  if (!trace) {
53
- return;
51
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
54
52
  }
55
53
  trace.putAttribute(attribute, value);
56
54
  return;
@@ -59,35 +57,35 @@ class FirebasePerformanceWeb extends core.WebPlugin {
59
57
  var _a;
60
58
  const trace = this.traces[traceName];
61
59
  if (!trace) {
62
- return { value: null };
60
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
63
61
  }
64
62
  return { value: (_a = trace.getAttribute(attribute)) !== null && _a !== void 0 ? _a : null };
65
63
  }
66
64
  async getAttributes({ traceName, }) {
67
65
  const trace = this.traces[traceName];
68
66
  if (!trace) {
69
- return { attributes: {} };
67
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
70
68
  }
71
69
  return { attributes: trace.getAttributes() };
72
70
  }
73
71
  async removeAttribute({ traceName, attribute, }) {
74
72
  const trace = this.traces[traceName];
75
73
  if (!trace) {
76
- return;
74
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
77
75
  }
78
76
  trace.removeAttribute(attribute);
79
77
  }
80
78
  async putMetric({ traceName, metricName, num, }) {
81
79
  const trace = this.traces[traceName];
82
80
  if (!trace) {
83
- return;
81
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
84
82
  }
85
83
  trace.putMetric(metricName, num);
86
84
  }
87
85
  async getMetric({ traceName, metricName, }) {
88
86
  const trace = this.traces[traceName];
89
87
  if (!trace) {
90
- return { value: 0 };
88
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
91
89
  }
92
90
  return { value: trace.getMetric(metricName) };
93
91
  }
@@ -97,6 +95,7 @@ class FirebasePerformanceWeb extends core.WebPlugin {
97
95
  trace.record(startTime, duration, options);
98
96
  }
99
97
  }
98
+ FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND = 'No trace was found with the provided traceName.';
100
99
 
101
100
  var web = /*#__PURE__*/Object.freeze({
102
101
  __proto__: null,
@@ -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 { 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,CAAC,SAAS,CAAC,CAAC;AAC3D,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;AACtB,QAAQ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;AAC/C,KAAK;AACL,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;AAC7B,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACrD,QAAQ,IAAI,CAAC,KAAK,EAAE;AACpB,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;AACrB,QAAQ,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAC9C,KAAK;AACL,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;AACnC,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MA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AAS,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;;;;;;;;;"}
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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\n }\n return { attributes: trace.getAttributes() };\n }\n async removeAttribute({ traceName, attribute, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\n }\n trace.removeAttribute(attribute);\n }\n async putMetric({ traceName, metricName, num, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\n }\n trace.putMetric(metricName, num);\n }\n async getMetric({ traceName, metricName, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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}\nFirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND = 'No trace was found with the provided traceName.';\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin","getPerformance","createTrace"],"mappings":";;;;;AACK,MAAC,mBAA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KAAK,CAAC,sBAAsB,CAAC,qBAAqB,CAAC;AACzE,QAAQ;AACR,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;AACrD,IAAI;AACJ,IAAI,MAAM,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE;AAC/D,QAAQ,MAAM,IAAI,GAAGA,0BAAc,EAAE;AACrC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,SAAS,CAAC;AAClD,QAAQ,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC;AAClD,IAAI;AACJ;AACA,sBAAsB,CAAC,qBAAqB,GAAG,iDAAiD;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -19,7 +19,7 @@ var capacitorFirebasePerformance = (function (exports, core, performance) {
19
19
  async stopTrace(options) {
20
20
  const trace = this.traces[options.traceName];
21
21
  if (!trace) {
22
- return;
22
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
23
23
  }
24
24
  trace.stop();
25
25
  delete this.traces[options.traceName];
@@ -27,7 +27,7 @@ var capacitorFirebasePerformance = (function (exports, core, performance) {
27
27
  async incrementMetric(options) {
28
28
  const trace = this.traces[options.traceName];
29
29
  if (!trace) {
30
- return;
30
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
31
31
  }
32
32
  trace.incrementMetric(options.metricName, options.incrementBy);
33
33
  }
@@ -46,7 +46,7 @@ var capacitorFirebasePerformance = (function (exports, core, performance) {
46
46
  async putAttribute({ traceName, attribute, value, }) {
47
47
  const trace = this.traces[traceName];
48
48
  if (!trace) {
49
- return;
49
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
50
50
  }
51
51
  trace.putAttribute(attribute, value);
52
52
  return;
@@ -55,35 +55,35 @@ var capacitorFirebasePerformance = (function (exports, core, performance) {
55
55
  var _a;
56
56
  const trace = this.traces[traceName];
57
57
  if (!trace) {
58
- return { value: null };
58
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
59
59
  }
60
60
  return { value: (_a = trace.getAttribute(attribute)) !== null && _a !== void 0 ? _a : null };
61
61
  }
62
62
  async getAttributes({ traceName, }) {
63
63
  const trace = this.traces[traceName];
64
64
  if (!trace) {
65
- return { attributes: {} };
65
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
66
66
  }
67
67
  return { attributes: trace.getAttributes() };
68
68
  }
69
69
  async removeAttribute({ traceName, attribute, }) {
70
70
  const trace = this.traces[traceName];
71
71
  if (!trace) {
72
- return;
72
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
73
73
  }
74
74
  trace.removeAttribute(attribute);
75
75
  }
76
76
  async putMetric({ traceName, metricName, num, }) {
77
77
  const trace = this.traces[traceName];
78
78
  if (!trace) {
79
- return;
79
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
80
80
  }
81
81
  trace.putMetric(metricName, num);
82
82
  }
83
83
  async getMetric({ traceName, metricName, }) {
84
84
  const trace = this.traces[traceName];
85
85
  if (!trace) {
86
- return { value: 0 };
86
+ throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);
87
87
  }
88
88
  return { value: trace.getMetric(metricName) };
89
89
  }
@@ -93,6 +93,7 @@ var capacitorFirebasePerformance = (function (exports, core, performance) {
93
93
  trace.record(startTime, duration, options);
94
94
  }
95
95
  }
96
+ FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND = 'No trace was found with the provided traceName.';
96
97
 
97
98
  var web = /*#__PURE__*/Object.freeze({
98
99
  __proto__: null,
@@ -101,8 +102,6 @@ var capacitorFirebasePerformance = (function (exports, core, performance) {
101
102
 
102
103
  exports.FirebasePerformance = FirebasePerformance;
103
104
 
104
- Object.defineProperty(exports, '__esModule', { value: true });
105
-
106
105
  return exports;
107
106
 
108
107
  })({}, capacitorExports, firebasePerformanceExports);
@@ -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 { 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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AAK,CAAC,SAAS,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACzC,KAAK;IACL,IAAI,MAAM,SAAS,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,EAAE;IAChD,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7C,QAAQ,IAAI,CAAC,KAAK,EAAE;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;;;;;;;;;;;;;;;;;"}
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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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 throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\n }\n return { attributes: trace.getAttributes() };\n }\n async removeAttribute({ traceName, attribute, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\n }\n trace.removeAttribute(attribute);\n }\n async putMetric({ traceName, metricName, num, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\n }\n trace.putMetric(metricName, num);\n }\n async getMetric({ traceName, metricName, }) {\n const trace = this.traces[traceName];\n if (!trace) {\n throw new Error(FirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND);\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}\nFirebasePerformanceWeb.ERROR_TRACE_NOT_FOUND = 'No trace was found with the provided traceName.';\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;IAC3B,QAAQ,IAAI,CAAC,MAAM,GAAG,EAAE;IACxB,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,OAAO,EAAE;IAC9B,QAAQ,MAAM,IAAI,GAAGC,0BAAc,EAAE;IACrC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC;IAC1D,QAAQ,KAAK,CAAC,KAAK,EAAE;IACrB,QAAQ,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,KAAK;IAC9C,IAAI;IACJ,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;IAC7B,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;IACpD,QAAQ,IAAI,CAAC,KAAK,EAAE;IACpB,YAAY,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,qBAAqB,CAAC;IACzE,QAAQ;IACR,QAAQ,KAAK,CAAC,IAAI,EAAE;IACpB,QAAQ,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;IAC7C,IAAI;IACJ,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;IACnC,QAAQ,MAAM,KAAK,GAAG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AAI,MAAM,SAAS,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,EAAE;IAChD,QAAQ,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC5C,QAAQ,IAAI,CAAC,KAAK,EAAE;IACpB,YAAY,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,qBAAqB,CAAC;IACzE,QAAQ;IACR,QAAQ,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;IACrD,IAAI;IACJ,IAAI,MAAM,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,GAAG,EAAE;IAC/D,QAAQ,MAAM,IAAI,GAAGA,0BAAc,EAAE;IACrC,QAAQ,MAAM,KAAK,GAAGC,iBAAW,CAAC,IAAI,EAAE,SAAS,CAAC;IAClD,QAAQ,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC;IAClD,IAAI;IACJ;IACA,sBAAsB,CAAC,qBAAqB,GAAG,iDAAiD;;;;;;;;;;;;;;;"}
@@ -6,7 +6,23 @@ import Capacitor
6
6
  * here: https://capacitorjs.com/docs/plugins/ios
7
7
  */
8
8
  @objc(FirebasePerformancePlugin)
9
- public class FirebasePerformancePlugin: CAPPlugin {
9
+ public class FirebasePerformancePlugin: CAPPlugin, CAPBridgedPlugin {
10
+ public let identifier = "FirebasePerformancePlugin"
11
+ public let jsName = "FirebasePerformance"
12
+ public let pluginMethods: [CAPPluginMethod] = [
13
+ CAPPluginMethod(name: "startTrace", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "stopTrace", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "incrementMetric", returnType: CAPPluginReturnPromise),
16
+ CAPPluginMethod(name: "setEnabled", returnType: CAPPluginReturnPromise),
17
+ CAPPluginMethod(name: "isEnabled", returnType: CAPPluginReturnPromise),
18
+ CAPPluginMethod(name: "putAttribute", returnType: CAPPluginReturnPromise),
19
+ CAPPluginMethod(name: "getAttribute", returnType: CAPPluginReturnPromise),
20
+ CAPPluginMethod(name: "getAttributes", returnType: CAPPluginReturnPromise),
21
+ CAPPluginMethod(name: "removeAttribute", returnType: CAPPluginReturnPromise),
22
+ CAPPluginMethod(name: "putMetric", returnType: CAPPluginReturnPromise),
23
+ CAPPluginMethod(name: "getMetric", returnType: CAPPluginReturnPromise),
24
+ CAPPluginMethod(name: "record", returnType: CAPPluginReturnPromise)
25
+ ]
10
26
  public let errorTraceNameMissing = "traceName must be provided."
11
27
  public let errorMetricNameMissing = "metricName must be provided."
12
28
  public let errorEnabledMissing = "enabled must be provided."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-firebase/performance",
3
- "version": "6.3.0",
3
+ "version": "7.0.0-dev.1765885034",
4
4
  "description": "Capacitor plugin for Firebase Performance Monitoring.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -11,7 +11,8 @@
11
11
  "android/build.gradle",
12
12
  "dist/",
13
13
  "ios/Plugin/",
14
- "CapacitorFirebasePerformance.podspec"
14
+ "CapacitorFirebasePerformance.podspec",
15
+ "Package.swift"
15
16
  ],
16
17
  "author": "Robin Genz <mail@robingenz.dev>",
17
18
  "license": "Apache-2.0",
@@ -49,32 +50,33 @@
49
50
  "prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
50
51
  "swiftlint": "node-swiftlint",
51
52
  "docgen": "docgen --api FirebasePerformancePlugin --output-readme README.md --output-json dist/docs.json",
52
- "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
53
+ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
53
54
  "clean": "rimraf ./dist",
54
55
  "watch": "tsc --watch",
55
56
  "ios:pod:install": "cd ios && pod install --repo-update && cd ..",
57
+ "ios:spm:install": "cd ios && swift package resolve && cd ..",
56
58
  "prepublishOnly": "npm run build"
57
59
  },
58
60
  "devDependencies": {
59
- "@capacitor/android": "6.0.0",
60
- "@capacitor/cli": "6.0.0",
61
- "@capacitor/core": "6.0.0",
62
- "@capacitor/docgen": "0.3.0",
63
- "@capacitor/ios": "6.0.0",
64
- "@ionic/eslint-config": "0.3.0",
65
- "@ionic/swiftlint-config": "1.1.2",
66
- "eslint": "7.32.0",
67
- "firebase": "10.9.0",
68
- "prettier": "2.3.2",
69
- "prettier-plugin-java": "1.0.2",
70
- "rimraf": "3.0.2",
71
- "rollup": "2.77.2",
72
- "swiftlint": "1.0.1",
73
- "typescript": "4.1.5"
61
+ "@capacitor/android": "8.0.0",
62
+ "@capacitor/cli": "8.0.0",
63
+ "@capacitor/core": "8.0.0",
64
+ "@capacitor/docgen": "0.3.1",
65
+ "@capacitor/ios": "8.0.0",
66
+ "@ionic/eslint-config": "0.4.0",
67
+ "@ionic/swiftlint-config": "2.0.0",
68
+ "eslint": "8.57.0",
69
+ "firebase": "11.2.0",
70
+ "prettier": "3.4.2",
71
+ "prettier-plugin-java": "2.6.7",
72
+ "rimraf": "6.1.2",
73
+ "rollup": "4.53.3",
74
+ "swiftlint": "2.0.0",
75
+ "typescript": "5.9.3"
74
76
  },
75
77
  "peerDependencies": {
76
- "@capacitor/core": "^6.0.0",
77
- "firebase": "^10.9.0 || ^11.0.0"
78
+ "@capacitor/core": ">=8.0.0",
79
+ "firebase": "^11.2.0"
78
80
  },
79
81
  "peerDependenciesMeta": {
80
82
  "firebase": {
@@ -1,10 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
-
3
- //! Project version number for Plugin.
4
- FOUNDATION_EXPORT double PluginVersionNumber;
5
-
6
- //! Project version string for Plugin.
7
- FOUNDATION_EXPORT const unsigned char PluginVersionString[];
8
-
9
- // In this header, you should import all the public headers of your framework using statements like #import <Plugin/PublicHeader.h>
10
-
@@ -1,19 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import <Capacitor/Capacitor.h>
3
-
4
- // Define the plugin using the CAP_PLUGIN Macro, and
5
- // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
- CAP_PLUGIN(FirebasePerformancePlugin, "FirebasePerformance",
7
- CAP_PLUGIN_METHOD(startTrace, CAPPluginReturnPromise);
8
- CAP_PLUGIN_METHOD(stopTrace, CAPPluginReturnPromise);
9
- CAP_PLUGIN_METHOD(incrementMetric, CAPPluginReturnPromise);
10
- CAP_PLUGIN_METHOD(setEnabled, CAPPluginReturnPromise);
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);
19
- )