@openfin/node-adapter 45.100.51 → 45.100.56

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.
@@ -18,6 +18,7 @@ declare type BaseConfig = {
18
18
  devToolsPort?: number;
19
19
  installerUI?: boolean;
20
20
  runtime?: RuntimeConfig;
21
+ apiDiagnostics?: boolean;
21
22
  appAssets?: [
22
23
  {
23
24
  src: string;
@@ -18,6 +18,7 @@ declare type BaseConfig = {
18
18
  devToolsPort?: number;
19
19
  installerUI?: boolean;
20
20
  runtime?: RuntimeConfig;
21
+ apiDiagnostics?: boolean;
21
22
  appAssets?: [
22
23
  {
23
24
  src: string;
@@ -18,6 +18,7 @@ declare type BaseConfig = {
18
18
  devToolsPort?: number;
19
19
  installerUI?: boolean;
20
20
  runtime?: RuntimeConfig;
21
+ apiDiagnostics?: boolean;
21
22
  appAssets?: [
22
23
  {
23
24
  src: string;
@@ -18,6 +18,7 @@ declare type BaseConfig = {
18
18
  devToolsPort?: number;
19
19
  installerUI?: boolean;
20
20
  runtime?: RuntimeConfig;
21
+ apiDiagnostics?: boolean;
21
22
  appAssets?: [
22
23
  {
23
24
  src: string;
@@ -543,9 +543,7 @@ class ViewModule extends Base {
543
543
  * @experimental
544
544
  */
545
545
  async wrap(identity) {
546
- this.wire.sendAction('view-wrap').catch((e) => {
547
- // we do not want to expose this error, just continue if this analytics-only call fails
548
- });
546
+ this.wire.recordAnalytic('view-wrap');
549
547
  const errorMsg = validateIdentity(identity);
550
548
  if (errorMsg) {
551
549
  throw new Error(errorMsg);
@@ -567,9 +565,7 @@ class ViewModule extends Base {
567
565
  * @experimental
568
566
  */
569
567
  wrapSync(identity) {
570
- this.wire.sendAction('view-wrap-sync').catch((e) => {
571
- // we do not want to expose this error, just continue if this analytics-only call fails
572
- });
568
+ this.wire.recordAnalytic('view-wrap-sync');
573
569
  const errorMsg = validateIdentity(identity);
574
570
  if (errorMsg) {
575
571
  throw new Error(errorMsg);
@@ -589,9 +585,7 @@ class ViewModule extends Base {
589
585
  * @experimental
590
586
  */
591
587
  getCurrent() {
592
- this.wire.sendAction('view-get-current').catch((e) => {
593
- // we do not want to expose this error, just continue if this analytics-only call fails
594
- });
588
+ this.wire.recordAnalytic('view-get-current');
595
589
  if (!this.wire.me.isView) {
596
590
  throw new Error('You are not in a View context');
597
591
  }
@@ -610,9 +604,7 @@ class ViewModule extends Base {
610
604
  * @experimental
611
605
  */
612
606
  getCurrentSync() {
613
- this.wire.sendAction('view-get-current-sync').catch((e) => {
614
- // we do not want to expose this error, just continue if this analytics-only call fails
615
- });
607
+ this.wire.recordAnalytic('view-get-current-sync');
616
608
  if (!this.wire.me.isView) {
617
609
  throw new Error('You are not in a View context');
618
610
  }
@@ -1664,9 +1656,7 @@ class WebContents extends EmitterBase {
1664
1656
  * {@link OpenFin.WebContentsEvents event namespace}.
1665
1657
  */
1666
1658
  async showPopupWindow(options) {
1667
- this.wire.sendAction(`${this.entityType}-show-popup-window`, this.identity).catch(() => {
1668
- // we do not want to expose this error, just continue if this analytics-only call fails
1669
- });
1659
+ this.wire.recordAnalytic(`${this.entityType}-show-popup-window`);
1670
1660
  if (options?.onPopupReady) {
1671
1661
  const readyListener = async ({ popupName }) => {
1672
1662
  try {
@@ -2080,9 +2070,7 @@ class View extends WebContents {
2080
2070
  * @experimental
2081
2071
  */
2082
2072
  this.getParentLayout = async () => {
2083
- this.wire.sendAction('view-get-parent-layout').catch(() => {
2084
- // don't expose
2085
- });
2073
+ this.wire.recordAnalytic('view-get-parent-layout');
2086
2074
  return this.fin.Platform.Layout.getLayoutByViewIdentity(this.identity);
2087
2075
  };
2088
2076
  /**
@@ -2195,9 +2183,7 @@ class View extends WebContents {
2195
2183
  * ```
2196
2184
  */
2197
2185
  this.getCurrentStack = async () => {
2198
- this.wire.sendAction('view-get-current-stack').catch(() => {
2199
- // don't expose
2200
- });
2186
+ this.wire.recordAnalytic('view-get-current-stack');
2201
2187
  try {
2202
2188
  const layout = await this.getParentLayout();
2203
2189
  return layout.getStackByViewIdentity(this.identity);
@@ -2392,9 +2378,7 @@ class Application extends EmitterBase {
2392
2378
  */
2393
2379
  close(force = false) {
2394
2380
  console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
2395
- this.wire.sendAction('application-close', this.identity).catch((e) => {
2396
- // we do not want to expose this error, just continue if this analytics-only call fails
2397
- });
2381
+ this.wire.recordAnalytic('application-close');
2398
2382
  return this._close(force);
2399
2383
  }
2400
2384
  /**
@@ -2535,9 +2519,7 @@ class Application extends EmitterBase {
2535
2519
  * ```
2536
2520
  */
2537
2521
  getWindow() {
2538
- this.wire.sendAction('application-get-window', this.identity).catch((e) => {
2539
- // we do not want to expose this error, just continue if this analytics-only call fails
2540
- });
2522
+ this.wire.recordAnalytic('application-get-window');
2541
2523
  return Promise.resolve(this.window);
2542
2524
  }
2543
2525
  /**
@@ -2615,9 +2597,7 @@ class Application extends EmitterBase {
2615
2597
  */
2616
2598
  run() {
2617
2599
  console.warn('Deprecation Warning: Application.run is deprecated Please use fin.Application.start');
2618
- this.wire.sendAction('application-run', this.identity).catch((e) => {
2619
- // we do not want to expose this error, just continue if this analytics-only call fails
2620
- });
2600
+ this.wire.recordAnalytic('application-run');
2621
2601
  return this._run();
2622
2602
  }
2623
2603
  _run(opts = {}) {
@@ -3129,9 +3109,7 @@ class ApplicationModule extends Base {
3129
3109
  *
3130
3110
  */
3131
3111
  async wrap(identity) {
3132
- this.wire.sendAction('wrap-application').catch((e) => {
3133
- // we do not want to expose this error, just continue if this analytics-only call fails
3134
- });
3112
+ this.wire.recordAnalytic('wrap-application');
3135
3113
  const errorMsg = validateIdentity(identity);
3136
3114
  if (errorMsg) {
3137
3115
  throw new Error(errorMsg);
@@ -3154,9 +3132,7 @@ class ApplicationModule extends Base {
3154
3132
  *
3155
3133
  */
3156
3134
  wrapSync(identity) {
3157
- this.wire.sendAction('wrap-application-sync').catch((e) => {
3158
- // we do not want to expose this error, just continue if this analytics-only call fails
3159
- });
3135
+ this.wire.recordAnalytic('wrap-application-sync');
3160
3136
  const errorMsg = validateIdentity(identity);
3161
3137
  if (errorMsg) {
3162
3138
  throw new Error(errorMsg);
@@ -3197,9 +3173,7 @@ class ApplicationModule extends Base {
3197
3173
  */
3198
3174
  create(appOptions) {
3199
3175
  console.warn('Deprecation Warning: fin.Application.create is deprecated. Please use fin.Application.start');
3200
- this.wire.sendAction('application-create').catch((e) => {
3201
- // we do not want to expose this error, just continue if this analytics-only call fails
3202
- });
3176
+ this.wire.recordAnalytic('application-create');
3203
3177
  return this._create(appOptions);
3204
3178
  }
3205
3179
  /**
@@ -3221,9 +3195,7 @@ class ApplicationModule extends Base {
3221
3195
  *
3222
3196
  */
3223
3197
  async start(appOptions) {
3224
- this.wire.sendAction('start-application').catch((e) => {
3225
- // we do not want to expose this error, just continue if this analytics-only call fails
3226
- });
3198
+ this.wire.recordAnalytic('start-application');
3227
3199
  const app = await this._create(appOptions);
3228
3200
  await this.wire.sendAction('run-application', { uuid: appOptions.uuid });
3229
3201
  return app;
@@ -3286,9 +3258,7 @@ class ApplicationModule extends Base {
3286
3258
  * ```
3287
3259
  */
3288
3260
  getCurrent() {
3289
- this.wire.sendAction('get-current-application').catch((e) => {
3290
- // we do not want to expose this error, just continue if this analytics-only call fails
3291
- });
3261
+ this.wire.recordAnalytic('get-current-application');
3292
3262
  return this.wrap({ uuid: this.wire.me.uuid });
3293
3263
  }
3294
3264
  /**
@@ -3311,9 +3281,7 @@ class ApplicationModule extends Base {
3311
3281
  * ```
3312
3282
  */
3313
3283
  getCurrentSync() {
3314
- this.wire.sendAction('get-current-application-sync').catch((e) => {
3315
- // we do not want to expose this error, just continue if this analytics-only call fails
3316
- });
3284
+ this.wire.recordAnalytic('get-current-application-sync');
3317
3285
  return this.wrapSync({ uuid: this.wire.me.uuid });
3318
3286
  }
3319
3287
  /**
@@ -3331,9 +3299,7 @@ class ApplicationModule extends Base {
3331
3299
  * ```
3332
3300
  */
3333
3301
  async startFromManifest(manifestUrl, opts) {
3334
- this.wire.sendAction('application-start-from-manifest').catch((e) => {
3335
- // we do not want to expose this error, just continue if this analytics-only call fails
3336
- });
3302
+ this.wire.recordAnalytic('application-start-from-manifest');
3337
3303
  const app = await this._createFromManifest(manifestUrl);
3338
3304
  // @ts-expect-error using private method without warning.
3339
3305
  await app._run(opts); // eslint-disable-line no-underscore-dangle
@@ -3355,9 +3321,7 @@ class ApplicationModule extends Base {
3355
3321
  */
3356
3322
  createFromManifest(manifestUrl) {
3357
3323
  console.warn('Deprecation Warning: fin.Application.createFromManifest is deprecated. Please use fin.Application.startFromManifest');
3358
- this.wire.sendAction('application-create-from-manifest').catch((e) => {
3359
- // we do not want to expose this error, just continue if this analytics-only call fails
3360
- });
3324
+ this.wire.recordAnalytic('application-create-from-manifest');
3361
3325
  return this._createFromManifest(manifestUrl);
3362
3326
  }
3363
3327
  _createFromManifest(manifestUrl) {
@@ -3420,9 +3384,7 @@ class _Window extends WebContents {
3420
3384
  super(wire, identity, 'window');
3421
3385
  }
3422
3386
  async createWindow(options) {
3423
- this.wire.sendAction('window-create-window').catch((e) => {
3424
- // we do not want to expose this error, just continue if this analytics-only call fails
3425
- });
3387
+ this.wire.recordAnalytic('window-create-window');
3426
3388
  const CONSTRUCTOR_CB_TOPIC = 'fire-constructor-callback';
3427
3389
  const responseSubscription = await promisifySubscription(this, CONSTRUCTOR_CB_TOPIC);
3428
3390
  // set defaults:
@@ -3896,9 +3858,7 @@ class _Window extends WebContents {
3896
3858
  * @experimental
3897
3859
  */
3898
3860
  async getLayout(layoutIdentity) {
3899
- this.wire.sendAction('window-get-layout').catch((e) => {
3900
- // don't expose
3901
- });
3861
+ this.wire.recordAnalytic('window-get-layout');
3902
3862
  const opts = await this.getOptions();
3903
3863
  if (!opts.layout && !opts.layoutSnapshot) {
3904
3864
  throw new Error('Window does not have a Layout');
@@ -3947,9 +3907,7 @@ class _Window extends WebContents {
3947
3907
  * ```
3948
3908
  */
3949
3909
  getParentApplication() {
3950
- this.wire.sendAction('window-get-parent-application').catch((e) => {
3951
- // we do not want to expose this error, just continue if this analytics-only call fails
3952
- });
3910
+ this.wire.recordAnalytic('window-get-parent-application');
3953
3911
  return Promise.resolve(new Application(this.wire, this.identity));
3954
3912
  }
3955
3913
  /**
@@ -3972,9 +3930,7 @@ class _Window extends WebContents {
3972
3930
  * ```
3973
3931
  */
3974
3932
  getParentWindow() {
3975
- this.wire.sendAction('window-get-parent-window').catch((e) => {
3976
- // we do not want to expose this error, just continue if this analytics-only call fails
3977
- });
3933
+ this.wire.recordAnalytic('window-get-parent-window');
3978
3934
  return Promise.resolve(new Application(this.wire, this.identity)).then((app) => app.getWindow());
3979
3935
  }
3980
3936
  /**
@@ -4078,9 +4034,7 @@ class _Window extends WebContents {
4078
4034
  * ```
4079
4035
  */
4080
4036
  getWebWindow() {
4081
- this.wire.sendAction('window-get-web-window').catch((e) => {
4082
- // we do not want to expose this error, just continue if this analytics-only call fails
4083
- });
4037
+ this.wire.recordAnalytic('window-get-web-window');
4084
4038
  return this.wire.environment.getWebWindow(this.identity);
4085
4039
  }
4086
4040
  /**
@@ -4094,9 +4048,7 @@ class _Window extends WebContents {
4094
4048
  * ```
4095
4049
  */
4096
4050
  isMainWindow() {
4097
- this.wire.sendAction('window-is-main-window').catch((e) => {
4098
- // we do not want to expose this error, just continue if this analytics-only call fails
4099
- });
4051
+ this.wire.recordAnalytic('window-is-main-window');
4100
4052
  return this.me.uuid === this.me.name;
4101
4053
  }
4102
4054
  /**
@@ -4618,9 +4570,7 @@ class _Window extends WebContents {
4618
4570
  * ```
4619
4571
  */
4620
4572
  async dispatchPopupResult(data) {
4621
- this.wire.sendAction('window-dispatch-popup-result').catch((e) => {
4622
- // we do not want to expose this error, just continue if this analytics-only call fails
4623
- });
4573
+ this.wire.recordAnalytic('window-dispatch-popup-result');
4624
4574
  await this.wire.sendAction('dispatch-popup-result', { data, ...this.identity });
4625
4575
  }
4626
4576
  /**
@@ -4769,9 +4719,7 @@ class _WindowModule extends Base {
4769
4719
  * ```
4770
4720
  */
4771
4721
  async wrap(identity) {
4772
- this.wire.sendAction('window-wrap').catch((e) => {
4773
- // we do not want to expose this error, just continue if this analytics-only call fails
4774
- });
4722
+ this.wire.recordAnalytic('window-wrap');
4775
4723
  const errorMsg = validateIdentity(identity);
4776
4724
  if (errorMsg) {
4777
4725
  throw new Error(errorMsg);
@@ -4801,9 +4749,7 @@ class _WindowModule extends Base {
4801
4749
  * ```
4802
4750
  */
4803
4751
  wrapSync(identity) {
4804
- this.wire.sendAction('window-wrap-sync').catch((e) => {
4805
- // we do not want to expose this error, just continue if this analytics-only call fails
4806
- });
4752
+ this.wire.recordAnalytic('window-wrap-sync');
4807
4753
  const errorMsg = validateIdentity(identity);
4808
4754
  if (errorMsg) {
4809
4755
  throw new Error(errorMsg);
@@ -4832,9 +4778,7 @@ class _WindowModule extends Base {
4832
4778
  * ```
4833
4779
  */
4834
4780
  create(options) {
4835
- this.wire.sendAction('create-window').catch((e) => {
4836
- // we do not want to expose this error, just continue if this analytics-only call fails
4837
- });
4781
+ this.wire.recordAnalytic('create-window');
4838
4782
  const win = new _Window(this.wire, { uuid: this.me.uuid, name: options.name });
4839
4783
  return win.createWindow(options);
4840
4784
  }
@@ -4850,9 +4794,7 @@ class _WindowModule extends Base {
4850
4794
  * ```
4851
4795
  */
4852
4796
  getCurrent() {
4853
- this.wire.sendAction('get-current-window').catch((e) => {
4854
- // we do not want to expose this error, just continue if this analytics-only call fails
4855
- });
4797
+ this.wire.recordAnalytic('get-current-window');
4856
4798
  if (!this.wire.me.isWindow) {
4857
4799
  throw new Error('You are not in a Window context');
4858
4800
  }
@@ -4871,9 +4813,7 @@ class _WindowModule extends Base {
4871
4813
  * ```
4872
4814
  */
4873
4815
  getCurrentSync() {
4874
- this.wire.sendAction('get-current-window-sync').catch((e) => {
4875
- // we do not want to expose this error, just continue if this analytics-only call fails
4876
- });
4816
+ this.wire.recordAnalytic('get-current-window-sync');
4877
4817
  if (!this.wire.me.isWindow) {
4878
4818
  throw new Error('You are not in a Window context');
4879
4819
  }
@@ -4882,6 +4822,47 @@ class _WindowModule extends Base {
4882
4822
  }
4883
4823
  }
4884
4824
 
4825
+ /**
4826
+ * Chromium content tracing APIs exposed under `fin.System.ContentTracing`.
4827
+ */
4828
+ class SystemContentTracing extends Base {
4829
+ /**
4830
+ * Gets the currently known tracing category groups.
4831
+ */
4832
+ async getCategories() {
4833
+ const { payload } = await this.wire.sendAction('content-tracing-get-categories');
4834
+ return payload.data;
4835
+ }
4836
+ /**
4837
+ * Starts content tracing across runtime processes.
4838
+ *
4839
+ * Only one content tracing session may be active across the runtime at a time.
4840
+ * This method rejects if another identity already owns the active session.
4841
+ */
4842
+ async startRecording(options) {
4843
+ await this.wire.sendAction('content-tracing-start-recording', { options });
4844
+ }
4845
+ /**
4846
+ * Stops the active content tracing session and writes the trace to the runtime-managed cache folder.
4847
+ *
4848
+ * The calling identity must match the identity that started the active tracing session.
4849
+ * This method rejects if tracing is not active or is owned by another identity.
4850
+ */
4851
+ async stopRecording() {
4852
+ const { payload } = await this.wire.sendAction('content-tracing-stop-recording');
4853
+ return payload.data;
4854
+ }
4855
+ /**
4856
+ * Returns the current maximum trace buffer usage across processes.
4857
+ *
4858
+ * This method is not supported on macOS and rejects on that platform.
4859
+ */
4860
+ async getTraceBufferUsage() {
4861
+ const { payload } = await this.wire.sendAction('content-tracing-get-trace-buffer-usage');
4862
+ return payload.data;
4863
+ }
4864
+ }
4865
+
4885
4866
  /**
4886
4867
  * Entry point for the OpenFin `System` API (`fin.System`).
4887
4868
  *
@@ -4901,6 +4882,7 @@ class System extends EmitterBase {
4901
4882
  */
4902
4883
  constructor(wire) {
4903
4884
  super(wire, 'system');
4885
+ this.ContentTracing = new SystemContentTracing(wire);
4904
4886
  }
4905
4887
  sendExternalProcessRequest(action, options) {
4906
4888
  return new Promise((resolve, reject) => {
@@ -6426,9 +6408,7 @@ class System extends EmitterBase {
6426
6408
  * @experimental
6427
6409
  */
6428
6410
  async registerShutdownHandler(handler) {
6429
- this.wire.sendAction('system-register-shutdown-handler').catch((e) => {
6430
- // don't expose, analytics-only call
6431
- });
6411
+ this.wire.recordAnalytic('system-register-shutdown-handler');
6432
6412
  const SystemShutdownEventName = 'system-shutdown';
6433
6413
  const SystemShutdownHandledEventName = 'system-shutdown-handled';
6434
6414
  const { uuid, name } = this.wire.me;
@@ -9122,6 +9102,16 @@ class InterApplicationBus extends Base {
9122
9102
  */
9123
9103
  constructor(wire) {
9124
9104
  super(wire);
9105
+ /**
9106
+ * Event types for the InterApplicationBus.
9107
+ *
9108
+ * @remarks The `subscriber-added` and `subscriber-removed` events are disabled by default.
9109
+ * To re-enable them, launch the runtime with the `--emit-legacy-iab-events` flag.
9110
+ * These events will be removed in a future version. Use {@link Channel} for connection
9111
+ * lifecycle management instead.
9112
+ *
9113
+ * @deprecated Use {@link Channel} `onConnection` / `onDisconnection` instead.
9114
+ */
9125
9115
  this.events = {
9126
9116
  subscriberAdded: 'subscriber-added',
9127
9117
  subscriberRemoved: 'subscriber-removed'
@@ -9544,9 +9534,7 @@ class ExternalApplicationModule extends Base {
9544
9534
  * ```
9545
9535
  */
9546
9536
  wrap(uuid) {
9547
- this.wire.sendAction('external-application-wrap').catch((e) => {
9548
- // we do not want to expose this error, just continue if this analytics-only call fails
9549
- });
9537
+ this.wire.recordAnalytic('external-application-wrap');
9550
9538
  return Promise.resolve(new ExternalApplication(this.wire, { uuid }));
9551
9539
  }
9552
9540
  /**
@@ -9563,9 +9551,7 @@ class ExternalApplicationModule extends Base {
9563
9551
  * ```
9564
9552
  */
9565
9553
  wrapSync(uuid) {
9566
- this.wire.sendAction('external-application-wrap-sync').catch((e) => {
9567
- // we do not want to expose this error, just continue if this analytics-only call fails
9568
- });
9554
+ this.wire.recordAnalytic('external-application-wrap-sync');
9569
9555
  return new ExternalApplication(this.wire, { uuid });
9570
9556
  }
9571
9557
  }
@@ -9653,9 +9639,7 @@ class _FrameModule extends Base {
9653
9639
  * ```
9654
9640
  */
9655
9641
  async wrap(identity) {
9656
- this.wire.sendAction('frame-wrap').catch((e) => {
9657
- // we do not want to expose this error, just continue if this analytics-only call fails
9658
- });
9642
+ this.wire.recordAnalytic('frame-wrap');
9659
9643
  const errorMsg = validateIdentity(identity);
9660
9644
  if (errorMsg) {
9661
9645
  throw new Error(errorMsg);
@@ -9677,9 +9661,7 @@ class _FrameModule extends Base {
9677
9661
  * ```
9678
9662
  */
9679
9663
  wrapSync(identity) {
9680
- this.wire.sendAction('frame-wrap-sync').catch((e) => {
9681
- // we do not want to expose this error, just continue if this analytics-only call fails
9682
- });
9664
+ this.wire.recordAnalytic('frame-wrap-sync');
9683
9665
  const errorMsg = validateIdentity(identity);
9684
9666
  if (errorMsg) {
9685
9667
  throw new Error(errorMsg);
@@ -9697,9 +9679,7 @@ class _FrameModule extends Base {
9697
9679
  * ```
9698
9680
  */
9699
9681
  getCurrent() {
9700
- this.wire.sendAction('frame-get-current').catch((e) => {
9701
- // we do not want to expose this error, just continue if this analytics-only call fails
9702
- });
9682
+ this.wire.recordAnalytic('frame-get-current');
9703
9683
  return Promise.resolve(new _Frame(this.wire, this.wire.environment.getCurrentEntityIdentity()));
9704
9684
  }
9705
9685
  /**
@@ -9713,9 +9693,7 @@ class _FrameModule extends Base {
9713
9693
  * ```
9714
9694
  */
9715
9695
  getCurrentSync() {
9716
- this.wire.sendAction('frame-get-current-sync').catch((e) => {
9717
- // we do not want to expose this error, just continue if this analytics-only call fails
9718
- });
9696
+ this.wire.recordAnalytic('frame-get-current-sync');
9719
9697
  return new _Frame(this.wire, this.wire.environment.getCurrentEntityIdentity());
9720
9698
  }
9721
9699
  }
@@ -11671,9 +11649,7 @@ class LayoutModule extends Base {
11671
11649
  * ```
11672
11650
  */
11673
11651
  this.init = async (options = {}) => {
11674
- this.wire.sendAction('layout-init').catch((e) => {
11675
- // don't expose
11676
- });
11652
+ this.wire.recordAnalytic('layout-init');
11677
11653
  if (!this.wire.environment.layoutAllowedInContext(this.fin)) {
11678
11654
  throw new Error('Layout.init can only be called from a Window context.');
11679
11655
  }
@@ -11751,9 +11727,7 @@ class LayoutModule extends Base {
11751
11727
  * ```
11752
11728
  */
11753
11729
  async wrap(identity) {
11754
- this.wire.sendAction('layout-wrap').catch((e) => {
11755
- // don't expose
11756
- });
11730
+ this.wire.recordAnalytic('layout-wrap');
11757
11731
  return new Layout(identity, this.wire);
11758
11732
  }
11759
11733
  /**
@@ -11776,9 +11750,7 @@ class LayoutModule extends Base {
11776
11750
  * ```
11777
11751
  */
11778
11752
  wrapSync(identity) {
11779
- this.wire.sendAction('layout-wrap-sync').catch((e) => {
11780
- // don't expose
11781
- });
11753
+ this.wire.recordAnalytic('layout-wrap-sync');
11782
11754
  return new Layout(identity, this.wire);
11783
11755
  }
11784
11756
  /**
@@ -11792,9 +11764,7 @@ class LayoutModule extends Base {
11792
11764
  * ```
11793
11765
  */
11794
11766
  async getCurrent() {
11795
- this.wire.sendAction('layout-get-current').catch((e) => {
11796
- // don't expose
11797
- });
11767
+ this.wire.recordAnalytic('layout-get-current');
11798
11768
  if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
11799
11769
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
11800
11770
  }
@@ -11815,9 +11785,7 @@ class LayoutModule extends Base {
11815
11785
  * ```
11816
11786
  */
11817
11787
  getCurrentSync() {
11818
- this.wire.sendAction('layout-get-current-sync').catch((e) => {
11819
- // don't expose
11820
- });
11788
+ this.wire.recordAnalytic('layout-get-current-sync');
11821
11789
  if (this.wire.environment.type === 'openfin' && !this.fin.me.isWindow) {
11822
11790
  throw new Error('You are not in a Window context. Only Windows can have a Layout.');
11823
11791
  }
@@ -11835,9 +11803,7 @@ class LayoutModule extends Base {
11835
11803
  * ```
11836
11804
  */
11837
11805
  async getLayoutByViewIdentity(viewIdentity) {
11838
- this.wire.sendAction('layout-get-by-view-identity').catch(() => {
11839
- // don't expose
11840
- });
11806
+ this.wire.recordAnalytic('layout-get-by-view-identity');
11841
11807
  const winIdentity = await this.wire.environment.getViewWindowIdentity(this.fin, viewIdentity);
11842
11808
  let layoutWindowIdentity = winIdentity;
11843
11809
  // TODO: CORE-1857 - when we tearout active layout or drag a view out of a window, the above identity includes the whole window info.
@@ -11961,9 +11927,7 @@ class PlatformModule extends Base {
11961
11927
  * ```
11962
11928
  */
11963
11929
  async wrap(identity) {
11964
- this.wire.sendAction('platform-wrap').catch((e) => {
11965
- // don't expose
11966
- });
11930
+ this.wire.recordAnalytic('platform-wrap');
11967
11931
  return new Platform(this.wire, { uuid: identity.uuid });
11968
11932
  }
11969
11933
  /**
@@ -11978,9 +11942,7 @@ class PlatformModule extends Base {
11978
11942
  * ```
11979
11943
  */
11980
11944
  wrapSync(identity) {
11981
- this.wire.sendAction('platform-wrap-sync').catch((e) => {
11982
- // don't expose
11983
- });
11945
+ this.wire.recordAnalytic('platform-wrap-sync');
11984
11946
  return new Platform(this.wire, { uuid: identity.uuid });
11985
11947
  }
11986
11948
  /**
@@ -11994,9 +11956,7 @@ class PlatformModule extends Base {
11994
11956
  * ```
11995
11957
  */
11996
11958
  async getCurrent() {
11997
- this.wire.sendAction('platform-get-current').catch((e) => {
11998
- // don't expose
11999
- });
11959
+ this.wire.recordAnalytic('platform-get-current');
12000
11960
  return this.wrap({ uuid: this.wire.me.uuid });
12001
11961
  }
12002
11962
  /**
@@ -12010,9 +11970,7 @@ class PlatformModule extends Base {
12010
11970
  * ```
12011
11971
  */
12012
11972
  getCurrentSync() {
12013
- this.wire.sendAction('platform-get-current-sync').catch((e) => {
12014
- // don't expose
12015
- });
11973
+ this.wire.recordAnalytic('platform-get-current-sync');
12016
11974
  return this.wrapSync({ uuid: this.wire.me.uuid });
12017
11975
  }
12018
11976
  /**
@@ -12040,9 +11998,7 @@ class PlatformModule extends Base {
12040
11998
  * ```
12041
11999
  */
12042
12000
  start(platformOptions) {
12043
- this.wire.sendAction('platform-start').catch((e) => {
12044
- // don't expose
12045
- });
12001
+ this.wire.recordAnalytic('platform-start');
12046
12002
  // eslint-disable-next-line no-async-promise-executor
12047
12003
  return new Promise(async (resolve, reject) => {
12048
12004
  try {
@@ -12084,9 +12040,7 @@ class PlatformModule extends Base {
12084
12040
  * ```
12085
12041
  */
12086
12042
  startFromManifest(manifestUrl, opts) {
12087
- this.wire.sendAction('platform-start-from-manifest').catch((e) => {
12088
- // don't expose
12089
- });
12043
+ this.wire.recordAnalytic('platform-start-from-manifest');
12090
12044
  // eslint-disable-next-line no-async-promise-executor
12091
12045
  return new Promise(async (resolve, reject) => {
12092
12046
  try {
@@ -15216,9 +15170,7 @@ class FDC3ModuleBase {
15216
15170
  * @static
15217
15171
  */
15218
15172
  async broadcast(context) {
15219
- this.wire.sendAction('fdc3-broadcast').catch((e) => {
15220
- // we do not want to expose this error, just continue if this analytics-only call fails
15221
- });
15173
+ this.wire.recordAnalytic('fdc3-broadcast');
15222
15174
  return this.client.setContext(context);
15223
15175
  }
15224
15176
  /**
@@ -15229,9 +15181,7 @@ class FDC3ModuleBase {
15229
15181
  * @tutorial fdc3.open
15230
15182
  */
15231
15183
  async _open(app, context) {
15232
- this.wire.sendAction('fdc3-open').catch((e) => {
15233
- // we do not want to expose this error, just continue if this analytics-only call fails
15234
- });
15184
+ this.wire.recordAnalytic('fdc3-open');
15235
15185
  try {
15236
15186
  return await InteropClient.ferryFdc3Call(this.client, 'fdc3Open', { app, context });
15237
15187
  }
@@ -15255,9 +15205,7 @@ class FDC3ModuleBase {
15255
15205
  * @tutorial fdc3.getOrCreateChannel
15256
15206
  */
15257
15207
  async getOrCreateChannel(channelId, fdc3Factory) {
15258
- this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
15259
- // we do not want to expose this error, just continue if this analytics-only call fails
15260
- });
15208
+ this.wire.recordAnalytic('fdc3-get-or-create-channel');
15261
15209
  const hasChannelIdBeenUsed = await InteropClient.ferryFdc3Call(this.client, 'isIdUsedByPrivateChannel', {
15262
15210
  channelId
15263
15211
  });
@@ -15285,9 +15233,7 @@ class FDC3ModuleBase {
15285
15233
  * @static
15286
15234
  */
15287
15235
  async getSystemChannels() {
15288
- this.wire.sendAction('fdc3-get-system-channels').catch((e) => {
15289
- // we do not want to expose this error, just continue if this analytics-only call fails
15290
- });
15236
+ this.wire.recordAnalytic('fdc3-get-system-channels');
15291
15237
  return this._getChannels();
15292
15238
  }
15293
15239
  /**
@@ -15302,9 +15248,7 @@ class FDC3ModuleBase {
15302
15248
  * @static
15303
15249
  */
15304
15250
  async joinChannel(channelId) {
15305
- this.wire.sendAction('fdc3-join-channel').catch((e) => {
15306
- // we do not want to expose this error, just continue if this analytics-only call fails
15307
- });
15251
+ this.wire.recordAnalytic('fdc3-join-channel');
15308
15252
  try {
15309
15253
  return await this.client.joinContextGroup(channelId);
15310
15254
  }
@@ -15327,9 +15271,7 @@ class FDC3ModuleBase {
15327
15271
  * @tutorial fdc3.getCurrentChannel
15328
15272
  */
15329
15273
  async getCurrentChannel() {
15330
- this.wire.sendAction('fdc3-get-current-channel').catch((e) => {
15331
- // we do not want to expose this error, just continue if this analytics-only call fails
15332
- });
15274
+ this.wire.recordAnalytic('fdc3-get-current-channel');
15333
15275
  const currentContextGroupInfo = await this.getCurrentContextGroupInfo();
15334
15276
  if (!currentContextGroupInfo) {
15335
15277
  return null;
@@ -15344,9 +15286,7 @@ class FDC3ModuleBase {
15344
15286
  * @static
15345
15287
  */
15346
15288
  async leaveCurrentChannel() {
15347
- this.wire.sendAction('fdc3-leave-current-channel').catch((e) => {
15348
- // we do not want to expose this error, just continue if this analytics-only call fails
15349
- });
15289
+ this.wire.recordAnalytic('fdc3-leave-current-channel');
15350
15290
  return this.client.removeFromContextGroup();
15351
15291
  }
15352
15292
  // utils
@@ -15466,9 +15406,7 @@ class Fdc3Module extends FDC3ModuleBase {
15466
15406
  */
15467
15407
  // @ts-expect-error TODO [CORE-1524]
15468
15408
  addContextListener(contextType, handler) {
15469
- this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
15470
- // we do not want to expose this error, just continue if this analytics-only call fails
15471
- });
15409
+ this.wire.recordAnalytic('fdc3-add-context-listener');
15472
15410
  let listener;
15473
15411
  if (typeof contextType === 'function') {
15474
15412
  console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
@@ -15491,9 +15429,7 @@ class Fdc3Module extends FDC3ModuleBase {
15491
15429
  * @static
15492
15430
  */
15493
15431
  addIntentListener(intent, handler) {
15494
- this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
15495
- // we do not want to expose this error, just continue if this analytics-only call fails
15496
- });
15432
+ this.wire.recordAnalytic('fdc3-add-intent-listener');
15497
15433
  const contextHandler = (raisedIntent) => {
15498
15434
  const { context, metadata: intentMetadata } = raisedIntent;
15499
15435
  const { metadata } = context;
@@ -15521,9 +15457,7 @@ class Fdc3Module extends FDC3ModuleBase {
15521
15457
  * @static
15522
15458
  */
15523
15459
  async raiseIntent(intent, context, app) {
15524
- this.wire.sendAction('fdc3-raise-intent').catch((e) => {
15525
- // we do not want to expose this error, just continue if this analytics-only call fails
15526
- });
15460
+ this.wire.recordAnalytic('fdc3-raise-intent');
15527
15461
  const intentObj = app
15528
15462
  ? { name: intent, context, metadata: { target: app } }
15529
15463
  : { name: intent, context };
@@ -15543,9 +15477,7 @@ class Fdc3Module extends FDC3ModuleBase {
15543
15477
  * @tutorial fdc3.findIntent
15544
15478
  */
15545
15479
  async findIntent(intent, context) {
15546
- this.wire.sendAction('fdc3-find-intent').catch((e) => {
15547
- // we do not want to expose this error, just continue if this analytics-only call fails
15548
- });
15480
+ this.wire.recordAnalytic('fdc3-find-intent');
15549
15481
  try {
15550
15482
  return await this.client.getInfoForIntent({ name: intent, context });
15551
15483
  }
@@ -15561,9 +15493,7 @@ class Fdc3Module extends FDC3ModuleBase {
15561
15493
  * @tutorial fdc3.findIntentsByContext
15562
15494
  */
15563
15495
  async findIntentsByContext(context) {
15564
- this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
15565
- // we do not want to expose this error, just continue if this analytics-only call fails
15566
- });
15496
+ this.wire.recordAnalytic('fdc3-find-intents-by-context');
15567
15497
  try {
15568
15498
  return await this.client.getInfoForIntentsByContext(context);
15569
15499
  }
@@ -15580,9 +15510,7 @@ class Fdc3Module extends FDC3ModuleBase {
15580
15510
  * @tutorial fdc3.raiseIntentForContext
15581
15511
  */
15582
15512
  async raiseIntentForContext(context, app) {
15583
- this.wire.sendAction('fdc3-raise-intent-for-context').catch((e) => {
15584
- // we do not want to expose this error, just continue if this analytics-only call fails
15585
- });
15513
+ this.wire.recordAnalytic('fdc3-raise-intent-for-context');
15586
15514
  try {
15587
15515
  return await this.client.fireIntentForContext({ ...context, metadata: { target: app } });
15588
15516
  }
@@ -15606,9 +15534,7 @@ class Fdc3Module extends FDC3ModuleBase {
15606
15534
  * @tutorial fdc3.getInfo
15607
15535
  */
15608
15536
  getInfo() {
15609
- this.wire.sendAction('fdc3-get-info').catch((e) => {
15610
- // we do not want to expose this error, just continue if this analytics-only call fails
15611
- });
15537
+ this.wire.recordAnalytic('fdc3-get-info');
15612
15538
  const version = this.wire.environment.getAdapterVersionSync();
15613
15539
  return {
15614
15540
  providerVersion: version,
@@ -15675,9 +15601,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15675
15601
  * @tutorial fdc3v2.findInstances
15676
15602
  */
15677
15603
  async findInstances(app) {
15678
- this.wire.sendAction('fdc3-find-instances').catch((e) => {
15679
- // we do not want to expose this error, just continue if this analytics-only call fails
15680
- });
15604
+ this.wire.recordAnalytic('fdc3-find-instances');
15681
15605
  try {
15682
15606
  return await InteropClient.ferryFdc3Call(this.client, 'fdc3FindInstances', app);
15683
15607
  }
@@ -15693,9 +15617,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15693
15617
  * @tutorial fdc3v2.getAppMetadata
15694
15618
  */
15695
15619
  async getAppMetadata(app) {
15696
- this.wire.sendAction('fdc3-get-app-metadata').catch((e) => {
15697
- // we do not want to expose this error, just continue if this analytics-only call fails
15698
- });
15620
+ this.wire.recordAnalytic('fdc3-get-app-metadata');
15699
15621
  try {
15700
15622
  return await InteropClient.ferryFdc3Call(this.client, 'fdc3GetAppMetadata', app);
15701
15623
  }
@@ -15713,9 +15635,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15713
15635
  */
15714
15636
  // @ts-expect-error TODO [CORE-1524]
15715
15637
  async addContextListener(contextType, handler) {
15716
- this.wire.sendAction('fdc3-add-context-listener').catch((e) => {
15717
- // we do not want to expose this error, just continue if this analytics-only call fails
15718
- });
15638
+ this.wire.recordAnalytic('fdc3-add-context-listener');
15719
15639
  // The FDC3 ContextHandler only expects the context and optional ContextMetadata, so we wrap the handler
15720
15640
  // here so it only gets passed these parameters
15721
15641
  const getWrappedHandler = (handlerToWrap) => {
@@ -15744,9 +15664,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15744
15664
  * @tutorial fdc3.findIntent
15745
15665
  */
15746
15666
  async findIntent(intent, context, resultType) {
15747
- this.wire.sendAction('fdc3-find-intent').catch((e) => {
15748
- // we do not want to expose this error, just continue if this analytics-only call fails
15749
- });
15667
+ this.wire.recordAnalytic('fdc3-find-intent');
15750
15668
  try {
15751
15669
  return await this.client.getInfoForIntent({ name: intent, context, metadata: { resultType } });
15752
15670
  }
@@ -15763,9 +15681,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15763
15681
  * @tutorial fdc3v2.findIntentsByContext
15764
15682
  */
15765
15683
  async findIntentsByContext(context, resultType) {
15766
- this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
15767
- // we do not want to expose this error, just continue if this analytics-only call fails
15768
- });
15684
+ this.wire.recordAnalytic('fdc3-find-intents-by-context');
15769
15685
  const payload = resultType ? { context, metadata: { resultType } } : context;
15770
15686
  try {
15771
15687
  return await InteropClient.ferryFdc3Call(this.client, 'fdc3v2FindIntentsByContext', payload);
@@ -15784,9 +15700,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15784
15700
  * @tutorial fdc3v2.raiseIntent
15785
15701
  */
15786
15702
  async raiseIntent(intent, context, app) {
15787
- this.wire.sendAction('fdc3-raise-intent').catch((e) => {
15788
- // we do not want to expose this error, just continue if this analytics-only call fails
15789
- });
15703
+ this.wire.recordAnalytic('fdc3-raise-intent');
15790
15704
  try {
15791
15705
  if (typeof app === 'string') {
15792
15706
  console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
@@ -15807,9 +15721,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15807
15721
  */
15808
15722
  async raiseIntentForContext(context, app) {
15809
15723
  // TODO: We have to do the same thing we do for raiseIntent here as well.
15810
- this.wire.sendAction('fdc3-raise-intent-for-context').catch((e) => {
15811
- // we do not want to expose this error, just continue if this analytics-only call fails
15812
- });
15724
+ this.wire.recordAnalytic('fdc3-raise-intent-for-context');
15813
15725
  try {
15814
15726
  if (typeof app === 'string') {
15815
15727
  console.warn('Passing a string as the app parameter is deprecated, please use an AppIdentifier ({ appId: string; instanceId?: string }).');
@@ -15829,9 +15741,7 @@ class Fdc3Module2 extends FDC3ModuleBase {
15829
15741
  * @tutorial fdc3.addIntentListener
15830
15742
  */
15831
15743
  async addIntentListener(intent, handler) {
15832
- this.wire.sendAction('fdc3-add-intent-listener').catch((e) => {
15833
- // we do not want to expose this error, just continue if this analytics-only call fails
15834
- });
15744
+ this.wire.recordAnalytic('fdc3-add-intent-listener');
15835
15745
  if (typeof intent !== 'string') {
15836
15746
  throw new Error('First argument must be an Intent name');
15837
15747
  }
@@ -15989,9 +15899,7 @@ class InteropModule extends Base {
15989
15899
  * ```
15990
15900
  */
15991
15901
  async init(name, override = defaultOverride) {
15992
- this.wire.sendAction('interop-init').catch(() => {
15993
- // don't expose, analytics-only call
15994
- });
15902
+ this.wire.recordAnalytic('interop-init');
15995
15903
  // Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
15996
15904
  const options = await this.wire.environment.getInteropInfo(this.wire.getFin());
15997
15905
  const objectThatThrows = createUnusableObject(BrokerParamAccessError);
@@ -16040,9 +15948,7 @@ class InteropModule extends Base {
16040
15948
  * ```
16041
15949
  */
16042
15950
  connectSync(name, interopConfig) {
16043
- this.wire.sendAction('interop-connect-sync').catch(() => {
16044
- // don't expose, analytics-only call
16045
- });
15951
+ this.wire.recordAnalytic('interop-connect-sync');
16046
15952
  return new InteropClient(this.wire, this.wire.environment.whenReady().then(() => {
16047
15953
  return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
16048
15954
  payload: interopConfig
@@ -16165,9 +16071,7 @@ class SnapshotSource extends Base {
16165
16071
  * ```
16166
16072
  */
16167
16073
  async ready() {
16168
- this.wire.sendAction('snapshot-source-ready').catch((e) => {
16169
- // don't expose, analytics-only call
16170
- });
16074
+ this.wire.recordAnalytic('snapshot-source-ready');
16171
16075
  // eslint-disable-next-line no-async-promise-executor
16172
16076
  try {
16173
16077
  // If getClient was already called before this, do we have a timing issue where the channel might have been created but we missed the event but this still fails?
@@ -16183,9 +16087,7 @@ class SnapshotSource extends Base {
16183
16087
  *
16184
16088
  */
16185
16089
  async getSnapshot() {
16186
- this.wire.sendAction('snapshot-source-get-snapshot').catch((e) => {
16187
- // don't expose, analytics-only call
16188
- });
16090
+ this.wire.recordAnalytic('snapshot-source-get-snapshot');
16189
16091
  const client = await __classPrivateFieldGet$2(this, _SnapshotSource_getClient, "f").call(this);
16190
16092
  const response = (await client.dispatch('get-snapshot'));
16191
16093
  return (await response).snapshot;
@@ -16195,9 +16097,7 @@ class SnapshotSource extends Base {
16195
16097
  *
16196
16098
  */
16197
16099
  async applySnapshot(snapshot) {
16198
- this.wire.sendAction('snapshot-source-apply-snapshot').catch((e) => {
16199
- // don't expose, analytics-only call
16200
- });
16100
+ this.wire.recordAnalytic('snapshot-source-apply-snapshot');
16201
16101
  const client = await __classPrivateFieldGet$2(this, _SnapshotSource_getClient, "f").call(this);
16202
16102
  return client.dispatch('apply-snapshot', { snapshot });
16203
16103
  }
@@ -16232,9 +16132,7 @@ class SnapshotSourceModule extends Base {
16232
16132
  *
16233
16133
  */
16234
16134
  async init(provider) {
16235
- this.wire.sendAction('snapshot-source-init').catch((e) => {
16236
- // don't expose, analytics-only call
16237
- });
16135
+ this.wire.recordAnalytic('snapshot-source-init');
16238
16136
  if (typeof provider !== 'object' ||
16239
16137
  typeof provider.getSnapshot !== 'function' ||
16240
16138
  typeof provider.applySnapshot !== 'function') {
@@ -16258,9 +16156,7 @@ class SnapshotSourceModule extends Base {
16258
16156
  * ```
16259
16157
  */
16260
16158
  wrapSync(identity) {
16261
- this.wire.sendAction('snapshot-source-wrap-sync').catch((e) => {
16262
- // don't expose, analytics-only call
16263
- });
16159
+ this.wire.recordAnalytic('snapshot-source-wrap-sync');
16264
16160
  return new SnapshotSource(this.wire, identity);
16265
16161
  }
16266
16162
  /**
@@ -16274,9 +16170,7 @@ class SnapshotSourceModule extends Base {
16274
16170
  * ```
16275
16171
  */
16276
16172
  async wrap(identity) {
16277
- this.wire.sendAction('snapshot-source-wrap').catch((e) => {
16278
- // don't expose, analytics-only call
16279
- });
16173
+ this.wire.recordAnalytic('snapshot-source-wrap');
16280
16174
  return this.wrapSync(identity);
16281
16175
  }
16282
16176
  }
@@ -17211,7 +17105,7 @@ class NodeEnvironment extends BaseEnvironment {
17211
17105
  };
17212
17106
  }
17213
17107
  getAdapterVersionSync() {
17214
- return "45.100.51";
17108
+ return "45.100.56";
17215
17109
  }
17216
17110
  observeBounds(element, onChange) {
17217
17111
  throw new Error('Method not implemented.');
@@ -17328,15 +17222,19 @@ var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) ||
17328
17222
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
17329
17223
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17330
17224
  };
17331
- var _Transport_wire, _Transport_fin;
17225
+ var _Transport_instances, _Transport_wire, _Transport_analyticsEnabled, _Transport_analyticsBuffer, _Transport_analyticsFlushTimeout, _Transport_fin, _Transport_flushAnalytics;
17332
17226
  class Transport extends events.EventEmitter {
17333
17227
  constructor(factory, environment, config) {
17334
17228
  super();
17229
+ _Transport_instances.add(this);
17335
17230
  this.wireListeners = new Map();
17336
17231
  this.topicRefMap = new Map();
17337
17232
  this.eventAggregator = new EventAggregator();
17338
17233
  this.messageHandlers = [this.eventAggregator.dispatchEvent];
17339
17234
  _Transport_wire.set(this, void 0);
17235
+ _Transport_analyticsEnabled.set(this, true);
17236
+ _Transport_analyticsBuffer.set(this, new Map());
17237
+ _Transport_analyticsFlushTimeout.set(this, void 0);
17340
17238
  // Typing as unknown to avoid circular dependency, should not be used directly.
17341
17239
  _Transport_fin.set(this, void 0);
17342
17240
  this.connectSync = () => {
@@ -17350,6 +17248,7 @@ class Transport extends events.EventEmitter {
17350
17248
  };
17351
17249
  __classPrivateFieldSet(this, _Transport_wire, factory(this.onmessage.bind(this)), "f");
17352
17250
  this.environment = environment;
17251
+ __classPrivateFieldSet(this, _Transport_analyticsEnabled, config.apiDiagnostics !== false, "f");
17353
17252
  this.sendRaw = __classPrivateFieldGet(this, _Transport_wire, "f").send.bind(__classPrivateFieldGet(this, _Transport_wire, "f"));
17354
17253
  this.registerMessageHandler(this.handleMessage.bind(this));
17355
17254
  __classPrivateFieldGet(this, _Transport_wire, "f").on('disconnected', () => {
@@ -17357,6 +17256,9 @@ class Transport extends events.EventEmitter {
17357
17256
  handleNack({ reason: 'Remote connection has closed' });
17358
17257
  }
17359
17258
  this.wireListeners.clear();
17259
+ clearTimeout(__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f"));
17260
+ __classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
17261
+ __classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
17360
17262
  this.emit('disconnected');
17361
17263
  });
17362
17264
  const { uuid, name } = config;
@@ -17375,6 +17277,18 @@ class Transport extends events.EventEmitter {
17375
17277
  }
17376
17278
  __classPrivateFieldSet(this, _Transport_fin, _fin, "f");
17377
17279
  }
17280
+ recordAnalytic(action) {
17281
+ if (!__classPrivateFieldGet(this, _Transport_analyticsEnabled, "f"))
17282
+ return;
17283
+ __classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").set(action, (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").get(action) ?? 0) + 1);
17284
+ if (__classPrivateFieldGet(this, _Transport_analyticsFlushTimeout, "f") === undefined) {
17285
+ const timeout = setTimeout(() => __classPrivateFieldGet(this, _Transport_instances, "m", _Transport_flushAnalytics).call(this), 30000);
17286
+ if (typeof timeout === 'object' && timeout !== null) {
17287
+ timeout.unref?.();
17288
+ }
17289
+ __classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, timeout, "f");
17290
+ }
17291
+ }
17378
17292
  shutdown() {
17379
17293
  const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
17380
17294
  return wire.shutdown();
@@ -17537,7 +17451,16 @@ class Transport extends events.EventEmitter {
17537
17451
  return true;
17538
17452
  }
17539
17453
  }
17540
- _Transport_wire = new WeakMap(), _Transport_fin = new WeakMap();
17454
+ _Transport_wire = new WeakMap(), _Transport_analyticsEnabled = new WeakMap(), _Transport_analyticsBuffer = new WeakMap(), _Transport_analyticsFlushTimeout = new WeakMap(), _Transport_fin = new WeakMap(), _Transport_instances = new WeakSet(), _Transport_flushAnalytics = function _Transport_flushAnalytics() {
17455
+ __classPrivateFieldSet(this, _Transport_analyticsFlushTimeout, undefined, "f");
17456
+ if (__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").size === 0)
17457
+ return;
17458
+ const counts = Object.fromEntries(__classPrivateFieldGet(this, _Transport_analyticsBuffer, "f"));
17459
+ __classPrivateFieldGet(this, _Transport_analyticsBuffer, "f").clear();
17460
+ this.sendAction('send-analytics-batch', { counts }).catch(() => {
17461
+ // analytics flush failure is non-fatal, counts are already cleared
17462
+ });
17463
+ };
17541
17464
 
17542
17465
  function isOpen(receiver) {
17543
17466
  return receiver.readyState === 'open' || receiver.readyState === 1;
@@ -17646,7 +17569,8 @@ async function connect(config) {
17646
17569
  const normalized = await validateConfig(config);
17647
17570
  const wire = new Transport((onmessage) => new WebSocketTransport(onmessage), environment, {
17648
17571
  ...normalized,
17649
- name: normalized.name ?? normalized.uuid
17572
+ name: normalized.name ?? normalized.uuid,
17573
+ apiDiagnostics: config.apiDiagnostics
17650
17574
  });
17651
17575
  await wire.connect(normalized);
17652
17576
  // Casting instead of expect-error to avoid skipLibCheck errors.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/node-adapter",
3
- "version": "45.100.51",
3
+ "version": "45.100.56",
4
4
  "description": "See README.md",
5
5
  "main": "out/node-adapter.js",
6
6
  "types": "out/node-adapter.d.ts",
@@ -20,7 +20,7 @@
20
20
  "lodash": "^4.17.21",
21
21
  "ws": "^7.5.10",
22
22
  "tslib": "2.8.1",
23
- "@openfin/core": "45.100.51"
23
+ "@openfin/core": "45.100.56"
24
24
  },
25
25
  "scripts": {
26
26
  "prebuild": "rimraf ./out",