@openfin/core 45.100.94 → 45.100.95
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.
- package/out/mock-alpha.d.ts +34 -25
- package/out/mock-beta.d.ts +34 -25
- package/out/mock-public.d.ts +34 -25
- package/out/stub.d.ts +34 -25
- package/out/stub.js +106 -30
- package/out/stub.mjs +106 -30
- package/package.json +1 -1
package/out/mock-alpha.d.ts
CHANGED
|
@@ -13737,6 +13737,9 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
13737
13737
|
namespace: 'System';
|
|
13738
13738
|
};
|
|
13739
13739
|
'register-usage': ApiCall<OpenFin_2.RegisterUsageData, void>;
|
|
13740
|
+
'register-usage-batch': ApiCall<{
|
|
13741
|
+
items: OpenFin_2.RegisterUsageData[];
|
|
13742
|
+
}, void>;
|
|
13740
13743
|
'system-get-printers': GetterCall<OpenFin_2.PrinterInfo[]>;
|
|
13741
13744
|
'system-update-process-logging-options': ApiCall<{
|
|
13742
13745
|
options: OpenFin_2.ProcessLoggingOptions;
|
|
@@ -15099,13 +15102,8 @@ declare type SubscriptionOptions = {
|
|
|
15099
15102
|
timestamp?: number;
|
|
15100
15103
|
};
|
|
15101
15104
|
|
|
15102
|
-
/**
|
|
15103
|
-
* An object representing the core of OpenFin Runtime. Allows the developer
|
|
15104
|
-
* to perform system-level actions, such as accessing logs, viewing processes,
|
|
15105
|
-
* clearing the cache and exiting the runtime as well as listen to {@link OpenFin.SystemEvents system events}.
|
|
15106
|
-
*
|
|
15107
|
-
*/
|
|
15108
15105
|
declare class System extends EmitterBase<OpenFin_2.SystemEvent> {
|
|
15106
|
+
#private;
|
|
15109
15107
|
/**
|
|
15110
15108
|
* Chromium content tracing APIs.
|
|
15111
15109
|
*/
|
|
@@ -16453,30 +16451,41 @@ declare class System extends EmitterBase<OpenFin_2.SystemEvent> {
|
|
|
16453
16451
|
queryPermissionForCurrentContext(apiName: string): Promise<OpenFin_2.QueryPermissionResult>;
|
|
16454
16452
|
enableNativeWindowIntegrationProvider(permissions: any): Promise<OpenFin_2.NativeWindowIntegrationProviderAuthorization>;
|
|
16455
16453
|
/**
|
|
16456
|
-
* (Internal) Register the usage of a component with a platform
|
|
16457
|
-
*
|
|
16454
|
+
* (Internal) Register the usage of a component with a platform.
|
|
16455
|
+
*
|
|
16456
|
+
* @param options - Object with `data` and `type`.
|
|
16457
|
+
*
|
|
16458
|
+
* @remarks
|
|
16459
|
+
* **This method never throws.** All errors — including IPC failures, RVM timeouts, and
|
|
16460
|
+
* serialization errors — are caught internally and logged at `debug` level. Usage tracking
|
|
16461
|
+
* must never break the calling feature.
|
|
16462
|
+
*
|
|
16463
|
+
* Calls are automatically deduplicated client-side for the lifetime of the current window
|
|
16464
|
+
* (i.e. until the window is closed or the page is reloaded). The first call with a given
|
|
16465
|
+
* `type` + `data` combination is forwarded to the Runtime as normal. Any subsequent call
|
|
16466
|
+
* with the same `type` and `data` values within the same window lifetime is silently
|
|
16467
|
+
* suppressed without making an IPC round-trip.
|
|
16468
|
+
*
|
|
16469
|
+
* If `data` cannot be serialized to JSON (for example, a circular reference), deduplication
|
|
16470
|
+
* is skipped for that call and the IPC call is still forwarded unconditionally.
|
|
16458
16471
|
*
|
|
16459
16472
|
* @example
|
|
16460
16473
|
* ```js
|
|
16461
|
-
*
|
|
16462
|
-
*
|
|
16463
|
-
*
|
|
16464
|
-
*
|
|
16465
|
-
*
|
|
16466
|
-
*
|
|
16467
|
-
*
|
|
16468
|
-
*
|
|
16469
|
-
*
|
|
16470
|
-
*
|
|
16471
|
-
*
|
|
16472
|
-
*
|
|
16473
|
-
* });
|
|
16474
|
-
* }
|
|
16475
|
-
*
|
|
16476
|
-
* registerUsage().then(() => console.log('Successfully registered component application')).catch(err => console.log(err));
|
|
16474
|
+
* // Safe to fire-and-forget — will never throw or reject.
|
|
16475
|
+
* // Duplicate calls within the same window lifetime are suppressed automatically.
|
|
16476
|
+
* fin.System.registerUsage({
|
|
16477
|
+
* type: 'workspace-licensing',
|
|
16478
|
+
* data: {
|
|
16479
|
+
* apiVersion: '1.0',
|
|
16480
|
+
* componentName: 'home',
|
|
16481
|
+
* componentVersion: '1.0',
|
|
16482
|
+
* allowed: true,
|
|
16483
|
+
* rejectionCode: ''
|
|
16484
|
+
* }
|
|
16485
|
+
* });
|
|
16477
16486
|
* ```
|
|
16478
16487
|
*/
|
|
16479
|
-
registerUsage({ data, type }: OpenFin_2.RegisterUsageData):
|
|
16488
|
+
registerUsage({ data, type }: OpenFin_2.RegisterUsageData): void;
|
|
16480
16489
|
/**
|
|
16481
16490
|
* Returns an array with all printers of the caller and not all the printers on the desktop.
|
|
16482
16491
|
*
|
package/out/mock-beta.d.ts
CHANGED
|
@@ -13737,6 +13737,9 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
13737
13737
|
namespace: 'System';
|
|
13738
13738
|
};
|
|
13739
13739
|
'register-usage': ApiCall<OpenFin_2.RegisterUsageData, void>;
|
|
13740
|
+
'register-usage-batch': ApiCall<{
|
|
13741
|
+
items: OpenFin_2.RegisterUsageData[];
|
|
13742
|
+
}, void>;
|
|
13740
13743
|
'system-get-printers': GetterCall<OpenFin_2.PrinterInfo[]>;
|
|
13741
13744
|
'system-update-process-logging-options': ApiCall<{
|
|
13742
13745
|
options: OpenFin_2.ProcessLoggingOptions;
|
|
@@ -15099,13 +15102,8 @@ declare type SubscriptionOptions = {
|
|
|
15099
15102
|
timestamp?: number;
|
|
15100
15103
|
};
|
|
15101
15104
|
|
|
15102
|
-
/**
|
|
15103
|
-
* An object representing the core of OpenFin Runtime. Allows the developer
|
|
15104
|
-
* to perform system-level actions, such as accessing logs, viewing processes,
|
|
15105
|
-
* clearing the cache and exiting the runtime as well as listen to {@link OpenFin.SystemEvents system events}.
|
|
15106
|
-
*
|
|
15107
|
-
*/
|
|
15108
15105
|
declare class System extends EmitterBase<OpenFin_2.SystemEvent> {
|
|
15106
|
+
#private;
|
|
15109
15107
|
/**
|
|
15110
15108
|
* Chromium content tracing APIs.
|
|
15111
15109
|
*/
|
|
@@ -16453,30 +16451,41 @@ declare class System extends EmitterBase<OpenFin_2.SystemEvent> {
|
|
|
16453
16451
|
queryPermissionForCurrentContext(apiName: string): Promise<OpenFin_2.QueryPermissionResult>;
|
|
16454
16452
|
enableNativeWindowIntegrationProvider(permissions: any): Promise<OpenFin_2.NativeWindowIntegrationProviderAuthorization>;
|
|
16455
16453
|
/**
|
|
16456
|
-
* (Internal) Register the usage of a component with a platform
|
|
16457
|
-
*
|
|
16454
|
+
* (Internal) Register the usage of a component with a platform.
|
|
16455
|
+
*
|
|
16456
|
+
* @param options - Object with `data` and `type`.
|
|
16457
|
+
*
|
|
16458
|
+
* @remarks
|
|
16459
|
+
* **This method never throws.** All errors — including IPC failures, RVM timeouts, and
|
|
16460
|
+
* serialization errors — are caught internally and logged at `debug` level. Usage tracking
|
|
16461
|
+
* must never break the calling feature.
|
|
16462
|
+
*
|
|
16463
|
+
* Calls are automatically deduplicated client-side for the lifetime of the current window
|
|
16464
|
+
* (i.e. until the window is closed or the page is reloaded). The first call with a given
|
|
16465
|
+
* `type` + `data` combination is forwarded to the Runtime as normal. Any subsequent call
|
|
16466
|
+
* with the same `type` and `data` values within the same window lifetime is silently
|
|
16467
|
+
* suppressed without making an IPC round-trip.
|
|
16468
|
+
*
|
|
16469
|
+
* If `data` cannot be serialized to JSON (for example, a circular reference), deduplication
|
|
16470
|
+
* is skipped for that call and the IPC call is still forwarded unconditionally.
|
|
16458
16471
|
*
|
|
16459
16472
|
* @example
|
|
16460
16473
|
* ```js
|
|
16461
|
-
*
|
|
16462
|
-
*
|
|
16463
|
-
*
|
|
16464
|
-
*
|
|
16465
|
-
*
|
|
16466
|
-
*
|
|
16467
|
-
*
|
|
16468
|
-
*
|
|
16469
|
-
*
|
|
16470
|
-
*
|
|
16471
|
-
*
|
|
16472
|
-
*
|
|
16473
|
-
* });
|
|
16474
|
-
* }
|
|
16475
|
-
*
|
|
16476
|
-
* registerUsage().then(() => console.log('Successfully registered component application')).catch(err => console.log(err));
|
|
16474
|
+
* // Safe to fire-and-forget — will never throw or reject.
|
|
16475
|
+
* // Duplicate calls within the same window lifetime are suppressed automatically.
|
|
16476
|
+
* fin.System.registerUsage({
|
|
16477
|
+
* type: 'workspace-licensing',
|
|
16478
|
+
* data: {
|
|
16479
|
+
* apiVersion: '1.0',
|
|
16480
|
+
* componentName: 'home',
|
|
16481
|
+
* componentVersion: '1.0',
|
|
16482
|
+
* allowed: true,
|
|
16483
|
+
* rejectionCode: ''
|
|
16484
|
+
* }
|
|
16485
|
+
* });
|
|
16477
16486
|
* ```
|
|
16478
16487
|
*/
|
|
16479
|
-
registerUsage({ data, type }: OpenFin_2.RegisterUsageData):
|
|
16488
|
+
registerUsage({ data, type }: OpenFin_2.RegisterUsageData): void;
|
|
16480
16489
|
/**
|
|
16481
16490
|
* Returns an array with all printers of the caller and not all the printers on the desktop.
|
|
16482
16491
|
*
|
package/out/mock-public.d.ts
CHANGED
|
@@ -13737,6 +13737,9 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
13737
13737
|
namespace: 'System';
|
|
13738
13738
|
};
|
|
13739
13739
|
'register-usage': ApiCall<OpenFin_2.RegisterUsageData, void>;
|
|
13740
|
+
'register-usage-batch': ApiCall<{
|
|
13741
|
+
items: OpenFin_2.RegisterUsageData[];
|
|
13742
|
+
}, void>;
|
|
13740
13743
|
'system-get-printers': GetterCall<OpenFin_2.PrinterInfo[]>;
|
|
13741
13744
|
'system-update-process-logging-options': ApiCall<{
|
|
13742
13745
|
options: OpenFin_2.ProcessLoggingOptions;
|
|
@@ -15099,13 +15102,8 @@ declare type SubscriptionOptions = {
|
|
|
15099
15102
|
timestamp?: number;
|
|
15100
15103
|
};
|
|
15101
15104
|
|
|
15102
|
-
/**
|
|
15103
|
-
* An object representing the core of OpenFin Runtime. Allows the developer
|
|
15104
|
-
* to perform system-level actions, such as accessing logs, viewing processes,
|
|
15105
|
-
* clearing the cache and exiting the runtime as well as listen to {@link OpenFin.SystemEvents system events}.
|
|
15106
|
-
*
|
|
15107
|
-
*/
|
|
15108
15105
|
declare class System extends EmitterBase<OpenFin_2.SystemEvent> {
|
|
15106
|
+
#private;
|
|
15109
15107
|
/**
|
|
15110
15108
|
* Chromium content tracing APIs.
|
|
15111
15109
|
*/
|
|
@@ -16453,30 +16451,41 @@ declare class System extends EmitterBase<OpenFin_2.SystemEvent> {
|
|
|
16453
16451
|
queryPermissionForCurrentContext(apiName: string): Promise<OpenFin_2.QueryPermissionResult>;
|
|
16454
16452
|
enableNativeWindowIntegrationProvider(permissions: any): Promise<OpenFin_2.NativeWindowIntegrationProviderAuthorization>;
|
|
16455
16453
|
/**
|
|
16456
|
-
* (Internal) Register the usage of a component with a platform
|
|
16457
|
-
*
|
|
16454
|
+
* (Internal) Register the usage of a component with a platform.
|
|
16455
|
+
*
|
|
16456
|
+
* @param options - Object with `data` and `type`.
|
|
16457
|
+
*
|
|
16458
|
+
* @remarks
|
|
16459
|
+
* **This method never throws.** All errors — including IPC failures, RVM timeouts, and
|
|
16460
|
+
* serialization errors — are caught internally and logged at `debug` level. Usage tracking
|
|
16461
|
+
* must never break the calling feature.
|
|
16462
|
+
*
|
|
16463
|
+
* Calls are automatically deduplicated client-side for the lifetime of the current window
|
|
16464
|
+
* (i.e. until the window is closed or the page is reloaded). The first call with a given
|
|
16465
|
+
* `type` + `data` combination is forwarded to the Runtime as normal. Any subsequent call
|
|
16466
|
+
* with the same `type` and `data` values within the same window lifetime is silently
|
|
16467
|
+
* suppressed without making an IPC round-trip.
|
|
16468
|
+
*
|
|
16469
|
+
* If `data` cannot be serialized to JSON (for example, a circular reference), deduplication
|
|
16470
|
+
* is skipped for that call and the IPC call is still forwarded unconditionally.
|
|
16458
16471
|
*
|
|
16459
16472
|
* @example
|
|
16460
16473
|
* ```js
|
|
16461
|
-
*
|
|
16462
|
-
*
|
|
16463
|
-
*
|
|
16464
|
-
*
|
|
16465
|
-
*
|
|
16466
|
-
*
|
|
16467
|
-
*
|
|
16468
|
-
*
|
|
16469
|
-
*
|
|
16470
|
-
*
|
|
16471
|
-
*
|
|
16472
|
-
*
|
|
16473
|
-
* });
|
|
16474
|
-
* }
|
|
16475
|
-
*
|
|
16476
|
-
* registerUsage().then(() => console.log('Successfully registered component application')).catch(err => console.log(err));
|
|
16474
|
+
* // Safe to fire-and-forget — will never throw or reject.
|
|
16475
|
+
* // Duplicate calls within the same window lifetime are suppressed automatically.
|
|
16476
|
+
* fin.System.registerUsage({
|
|
16477
|
+
* type: 'workspace-licensing',
|
|
16478
|
+
* data: {
|
|
16479
|
+
* apiVersion: '1.0',
|
|
16480
|
+
* componentName: 'home',
|
|
16481
|
+
* componentVersion: '1.0',
|
|
16482
|
+
* allowed: true,
|
|
16483
|
+
* rejectionCode: ''
|
|
16484
|
+
* }
|
|
16485
|
+
* });
|
|
16477
16486
|
* ```
|
|
16478
16487
|
*/
|
|
16479
|
-
registerUsage({ data, type }: OpenFin_2.RegisterUsageData):
|
|
16488
|
+
registerUsage({ data, type }: OpenFin_2.RegisterUsageData): void;
|
|
16480
16489
|
/**
|
|
16481
16490
|
* Returns an array with all printers of the caller and not all the printers on the desktop.
|
|
16482
16491
|
*
|
package/out/stub.d.ts
CHANGED
|
@@ -14154,6 +14154,9 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
14154
14154
|
namespace: 'System';
|
|
14155
14155
|
};
|
|
14156
14156
|
'register-usage': ApiCall<OpenFin_2.RegisterUsageData, void>;
|
|
14157
|
+
'register-usage-batch': ApiCall<{
|
|
14158
|
+
items: OpenFin_2.RegisterUsageData[];
|
|
14159
|
+
}, void>;
|
|
14157
14160
|
'system-get-printers': GetterCall<OpenFin_2.PrinterInfo[]>;
|
|
14158
14161
|
'system-update-process-logging-options': ApiCall<{
|
|
14159
14162
|
options: OpenFin_2.ProcessLoggingOptions;
|
|
@@ -15519,13 +15522,8 @@ declare type SubscriptionOptions = {
|
|
|
15519
15522
|
timestamp?: number;
|
|
15520
15523
|
};
|
|
15521
15524
|
|
|
15522
|
-
/**
|
|
15523
|
-
* An object representing the core of OpenFin Runtime. Allows the developer
|
|
15524
|
-
* to perform system-level actions, such as accessing logs, viewing processes,
|
|
15525
|
-
* clearing the cache and exiting the runtime as well as listen to {@link OpenFin.SystemEvents system events}.
|
|
15526
|
-
*
|
|
15527
|
-
*/
|
|
15528
15525
|
declare class System extends EmitterBase<OpenFin_2.SystemEvent> {
|
|
15526
|
+
#private;
|
|
15529
15527
|
/**
|
|
15530
15528
|
* Chromium content tracing APIs.
|
|
15531
15529
|
*/
|
|
@@ -16876,30 +16874,41 @@ declare class System extends EmitterBase<OpenFin_2.SystemEvent> {
|
|
|
16876
16874
|
queryPermissionForCurrentContext(apiName: string): Promise<OpenFin_2.QueryPermissionResult>;
|
|
16877
16875
|
enableNativeWindowIntegrationProvider(permissions: any): Promise<OpenFin_2.NativeWindowIntegrationProviderAuthorization>;
|
|
16878
16876
|
/**
|
|
16879
|
-
* (Internal) Register the usage of a component with a platform
|
|
16880
|
-
*
|
|
16877
|
+
* (Internal) Register the usage of a component with a platform.
|
|
16878
|
+
*
|
|
16879
|
+
* @param options - Object with `data` and `type`.
|
|
16880
|
+
*
|
|
16881
|
+
* @remarks
|
|
16882
|
+
* **This method never throws.** All errors — including IPC failures, RVM timeouts, and
|
|
16883
|
+
* serialization errors — are caught internally and logged at `debug` level. Usage tracking
|
|
16884
|
+
* must never break the calling feature.
|
|
16885
|
+
*
|
|
16886
|
+
* Calls are automatically deduplicated client-side for the lifetime of the current window
|
|
16887
|
+
* (i.e. until the window is closed or the page is reloaded). The first call with a given
|
|
16888
|
+
* `type` + `data` combination is forwarded to the Runtime as normal. Any subsequent call
|
|
16889
|
+
* with the same `type` and `data` values within the same window lifetime is silently
|
|
16890
|
+
* suppressed without making an IPC round-trip.
|
|
16891
|
+
*
|
|
16892
|
+
* If `data` cannot be serialized to JSON (for example, a circular reference), deduplication
|
|
16893
|
+
* is skipped for that call and the IPC call is still forwarded unconditionally.
|
|
16881
16894
|
*
|
|
16882
16895
|
* @example
|
|
16883
16896
|
* ```js
|
|
16884
|
-
*
|
|
16885
|
-
*
|
|
16886
|
-
*
|
|
16887
|
-
*
|
|
16888
|
-
*
|
|
16889
|
-
*
|
|
16890
|
-
*
|
|
16891
|
-
*
|
|
16892
|
-
*
|
|
16893
|
-
*
|
|
16894
|
-
*
|
|
16895
|
-
*
|
|
16896
|
-
* });
|
|
16897
|
-
* }
|
|
16898
|
-
*
|
|
16899
|
-
* registerUsage().then(() => console.log('Successfully registered component application')).catch(err => console.log(err));
|
|
16897
|
+
* // Safe to fire-and-forget — will never throw or reject.
|
|
16898
|
+
* // Duplicate calls within the same window lifetime are suppressed automatically.
|
|
16899
|
+
* fin.System.registerUsage({
|
|
16900
|
+
* type: 'workspace-licensing',
|
|
16901
|
+
* data: {
|
|
16902
|
+
* apiVersion: '1.0',
|
|
16903
|
+
* componentName: 'home',
|
|
16904
|
+
* componentVersion: '1.0',
|
|
16905
|
+
* allowed: true,
|
|
16906
|
+
* rejectionCode: ''
|
|
16907
|
+
* }
|
|
16908
|
+
* });
|
|
16900
16909
|
* ```
|
|
16901
16910
|
*/
|
|
16902
|
-
registerUsage({ data, type }: OpenFin_2.RegisterUsageData):
|
|
16911
|
+
registerUsage({ data, type }: OpenFin_2.RegisterUsageData): void;
|
|
16903
16912
|
/**
|
|
16904
16913
|
* Returns an array with all printers of the caller and not all the printers on the desktop.
|
|
16905
16914
|
*
|
package/out/stub.js
CHANGED
|
@@ -211,13 +211,13 @@ var OpenFin = /*#__PURE__*/Object.freeze({
|
|
|
211
211
|
WindowEvents: window$1
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
-
var __classPrivateFieldSet$
|
|
214
|
+
var __classPrivateFieldSet$l = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
215
215
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
216
216
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
217
217
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
218
218
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
219
219
|
};
|
|
220
|
-
var __classPrivateFieldGet$
|
|
220
|
+
var __classPrivateFieldGet$m = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
221
221
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
222
222
|
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");
|
|
223
223
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -298,9 +298,9 @@ class EmitterBase extends Base {
|
|
|
298
298
|
this.emit = (eventType, payload, ...args) => {
|
|
299
299
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
300
300
|
};
|
|
301
|
-
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$
|
|
301
|
+
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$m(this, _EmitterBase_emitterAccessor, "f"));
|
|
302
302
|
this.getOrCreateEmitter = () => {
|
|
303
|
-
return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
|
303
|
+
return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$m(this, _EmitterBase_emitterAccessor, "f"));
|
|
304
304
|
};
|
|
305
305
|
this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
|
|
306
306
|
this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
|
|
@@ -338,8 +338,8 @@ class EmitterBase extends Base {
|
|
|
338
338
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
|
339
339
|
return Promise.resolve();
|
|
340
340
|
};
|
|
341
|
-
__classPrivateFieldSet$
|
|
342
|
-
__classPrivateFieldSet$
|
|
341
|
+
__classPrivateFieldSet$l(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
342
|
+
__classPrivateFieldSet$l(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
|
343
343
|
}
|
|
344
344
|
/**
|
|
345
345
|
* Adds a listener to the end of the listeners array for the specified event.
|
|
@@ -367,7 +367,7 @@ class EmitterBase extends Base {
|
|
|
367
367
|
*/
|
|
368
368
|
async once(eventType, listener, options) {
|
|
369
369
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
370
|
-
__classPrivateFieldGet$
|
|
370
|
+
__classPrivateFieldGet$m(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
371
371
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
372
372
|
emitter.once(eventType, deregister);
|
|
373
373
|
emitter.once(eventType, listener);
|
|
@@ -398,7 +398,7 @@ class EmitterBase extends Base {
|
|
|
398
398
|
*/
|
|
399
399
|
async prependOnceListener(eventType, listener, options) {
|
|
400
400
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
401
|
-
__classPrivateFieldGet$
|
|
401
|
+
__classPrivateFieldGet$m(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
402
402
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
403
403
|
emitter.prependOnceListener(eventType, listener);
|
|
404
404
|
emitter.once(eventType, deregister);
|
|
@@ -417,7 +417,7 @@ class EmitterBase extends Base {
|
|
|
417
417
|
const emitter = await this.deregisterEventListener(eventType, options);
|
|
418
418
|
if (emitter) {
|
|
419
419
|
emitter.removeListener(eventType, listener);
|
|
420
|
-
const deregister = __classPrivateFieldGet$
|
|
420
|
+
const deregister = __classPrivateFieldGet$m(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
421
421
|
if (deregister) {
|
|
422
422
|
emitter.removeListener(eventType, deregister);
|
|
423
423
|
}
|
|
@@ -463,7 +463,7 @@ class EmitterBase extends Base {
|
|
|
463
463
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
464
464
|
// TODO: maybe emitterMap should clean up itself..
|
|
465
465
|
if (emitter.eventNames().length === 0) {
|
|
466
|
-
this.wire.eventAggregator.delete(__classPrivateFieldGet$
|
|
466
|
+
this.wire.eventAggregator.delete(__classPrivateFieldGet$m(this, _EmitterBase_emitterAccessor, "f"));
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
}
|
|
@@ -5085,18 +5085,36 @@ class SystemContentTracing extends Base {
|
|
|
5085
5085
|
*
|
|
5086
5086
|
* @packageDocumentation
|
|
5087
5087
|
*/
|
|
5088
|
+
var __classPrivateFieldGet$l = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
5089
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
5090
|
+
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");
|
|
5091
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5092
|
+
};
|
|
5093
|
+
var __classPrivateFieldSet$k = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
5094
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
5095
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5096
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5097
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
5098
|
+
};
|
|
5099
|
+
var _System_instances, _System_registeredUsageKeys, _System_pendingUsageKeys, _System_usageBatch, _System_usageFlushScheduled, _System_flushUsageBatch;
|
|
5088
5100
|
/**
|
|
5089
5101
|
* An object representing the core of OpenFin Runtime. Allows the developer
|
|
5090
5102
|
* to perform system-level actions, such as accessing logs, viewing processes,
|
|
5091
5103
|
* clearing the cache and exiting the runtime as well as listen to {@link OpenFin.SystemEvents system events}.
|
|
5092
5104
|
*
|
|
5093
5105
|
*/
|
|
5106
|
+
const sortedKeysReplacer = (_, v) => v && typeof v === 'object' && !Array.isArray(v) ? Object.fromEntries(Object.entries(v).sort()) : v;
|
|
5094
5107
|
class System extends EmitterBase {
|
|
5095
5108
|
/**
|
|
5096
5109
|
* @internal
|
|
5097
5110
|
*/
|
|
5098
5111
|
constructor(wire) {
|
|
5099
5112
|
super(wire, 'system');
|
|
5113
|
+
_System_instances.add(this);
|
|
5114
|
+
_System_registeredUsageKeys.set(this, new Set());
|
|
5115
|
+
_System_pendingUsageKeys.set(this, new Set());
|
|
5116
|
+
_System_usageBatch.set(this, []);
|
|
5117
|
+
_System_usageFlushScheduled.set(this, false);
|
|
5100
5118
|
this.ContentTracing = new SystemContentTracing(wire);
|
|
5101
5119
|
}
|
|
5102
5120
|
sendExternalProcessRequest(action, options) {
|
|
@@ -6833,31 +6851,58 @@ class System extends EmitterBase {
|
|
|
6833
6851
|
return payload.data;
|
|
6834
6852
|
}
|
|
6835
6853
|
/**
|
|
6836
|
-
* (Internal) Register the usage of a component with a platform
|
|
6837
|
-
*
|
|
6854
|
+
* (Internal) Register the usage of a component with a platform.
|
|
6855
|
+
*
|
|
6856
|
+
* @param options - Object with `data` and `type`.
|
|
6857
|
+
*
|
|
6858
|
+
* @remarks
|
|
6859
|
+
* **This method never throws.** All errors — including IPC failures, RVM timeouts, and
|
|
6860
|
+
* serialization errors — are caught internally and logged at `debug` level. Usage tracking
|
|
6861
|
+
* must never break the calling feature.
|
|
6862
|
+
*
|
|
6863
|
+
* Calls are automatically deduplicated client-side for the lifetime of the current window
|
|
6864
|
+
* (i.e. until the window is closed or the page is reloaded). The first call with a given
|
|
6865
|
+
* `type` + `data` combination is forwarded to the Runtime as normal. Any subsequent call
|
|
6866
|
+
* with the same `type` and `data` values within the same window lifetime is silently
|
|
6867
|
+
* suppressed without making an IPC round-trip.
|
|
6868
|
+
*
|
|
6869
|
+
* If `data` cannot be serialized to JSON (for example, a circular reference), deduplication
|
|
6870
|
+
* is skipped for that call and the IPC call is still forwarded unconditionally.
|
|
6838
6871
|
*
|
|
6839
6872
|
* @example
|
|
6840
6873
|
* ```js
|
|
6841
|
-
*
|
|
6842
|
-
*
|
|
6843
|
-
*
|
|
6844
|
-
*
|
|
6845
|
-
*
|
|
6846
|
-
*
|
|
6847
|
-
*
|
|
6848
|
-
*
|
|
6849
|
-
*
|
|
6850
|
-
*
|
|
6851
|
-
*
|
|
6852
|
-
*
|
|
6853
|
-
* });
|
|
6854
|
-
* }
|
|
6855
|
-
*
|
|
6856
|
-
* registerUsage().then(() => console.log('Successfully registered component application')).catch(err => console.log(err));
|
|
6874
|
+
* // Safe to fire-and-forget — will never throw or reject.
|
|
6875
|
+
* // Duplicate calls within the same window lifetime are suppressed automatically.
|
|
6876
|
+
* fin.System.registerUsage({
|
|
6877
|
+
* type: 'workspace-licensing',
|
|
6878
|
+
* data: {
|
|
6879
|
+
* apiVersion: '1.0',
|
|
6880
|
+
* componentName: 'home',
|
|
6881
|
+
* componentVersion: '1.0',
|
|
6882
|
+
* allowed: true,
|
|
6883
|
+
* rejectionCode: ''
|
|
6884
|
+
* }
|
|
6885
|
+
* });
|
|
6857
6886
|
* ```
|
|
6858
6887
|
*/
|
|
6859
|
-
|
|
6860
|
-
|
|
6888
|
+
registerUsage({ data, type }) {
|
|
6889
|
+
let dedupKey;
|
|
6890
|
+
try {
|
|
6891
|
+
const key = `${type}\0${JSON.stringify(data, sortedKeysReplacer)}`;
|
|
6892
|
+
if (__classPrivateFieldGet$l(this, _System_registeredUsageKeys, "f").has(key) || __classPrivateFieldGet$l(this, _System_pendingUsageKeys, "f").has(key)) {
|
|
6893
|
+
return;
|
|
6894
|
+
}
|
|
6895
|
+
__classPrivateFieldGet$l(this, _System_pendingUsageKeys, "f").add(key);
|
|
6896
|
+
dedupKey = key;
|
|
6897
|
+
}
|
|
6898
|
+
catch {
|
|
6899
|
+
console.debug(`[registerUsage] Failed to serialize 'data' for deduplication (type: "${type}"). Sending unconditionally.`);
|
|
6900
|
+
}
|
|
6901
|
+
__classPrivateFieldGet$l(this, _System_usageBatch, "f").push({ payload: { data, type }, dedupKey });
|
|
6902
|
+
if (!__classPrivateFieldGet$l(this, _System_usageFlushScheduled, "f")) {
|
|
6903
|
+
__classPrivateFieldSet$k(this, _System_usageFlushScheduled, true, "f");
|
|
6904
|
+
queueMicrotask(() => __classPrivateFieldGet$l(this, _System_instances, "m", _System_flushUsageBatch).call(this));
|
|
6905
|
+
}
|
|
6861
6906
|
}
|
|
6862
6907
|
/**
|
|
6863
6908
|
* Returns an array with all printers of the caller and not all the printers on the desktop.
|
|
@@ -7163,6 +7208,37 @@ class System extends EmitterBase {
|
|
|
7163
7208
|
return payload.data;
|
|
7164
7209
|
}
|
|
7165
7210
|
}
|
|
7211
|
+
_System_registeredUsageKeys = new WeakMap(), _System_pendingUsageKeys = new WeakMap(), _System_usageBatch = new WeakMap(), _System_usageFlushScheduled = new WeakMap(), _System_instances = new WeakSet(), _System_flushUsageBatch = function _System_flushUsageBatch() {
|
|
7212
|
+
__classPrivateFieldSet$k(this, _System_usageFlushScheduled, false, "f");
|
|
7213
|
+
const batch = __classPrivateFieldGet$l(this, _System_usageBatch, "f");
|
|
7214
|
+
__classPrivateFieldSet$k(this, _System_usageBatch, [], "f");
|
|
7215
|
+
if (batch.length === 0)
|
|
7216
|
+
return;
|
|
7217
|
+
const items = batch.map(({ payload }) => payload);
|
|
7218
|
+
const keys = batch.map(({ dedupKey }) => dedupKey);
|
|
7219
|
+
const commitKeys = () => {
|
|
7220
|
+
for (const key of keys) {
|
|
7221
|
+
if (key !== undefined) {
|
|
7222
|
+
__classPrivateFieldGet$l(this, _System_pendingUsageKeys, "f").delete(key);
|
|
7223
|
+
__classPrivateFieldGet$l(this, _System_registeredUsageKeys, "f").add(key);
|
|
7224
|
+
}
|
|
7225
|
+
}
|
|
7226
|
+
};
|
|
7227
|
+
const rollbackKeys = () => {
|
|
7228
|
+
for (const key of keys) {
|
|
7229
|
+
if (key !== undefined) {
|
|
7230
|
+
__classPrivateFieldGet$l(this, _System_pendingUsageKeys, "f").delete(key);
|
|
7231
|
+
}
|
|
7232
|
+
}
|
|
7233
|
+
};
|
|
7234
|
+
const action = items.length === 1
|
|
7235
|
+
? this.wire.sendAction('register-usage', items[0])
|
|
7236
|
+
: this.wire.sendAction('register-usage-batch', { items });
|
|
7237
|
+
action.then(commitKeys).catch((e) => {
|
|
7238
|
+
rollbackKeys();
|
|
7239
|
+
console.debug('[registerUsage] Failed to send usage data.', e);
|
|
7240
|
+
});
|
|
7241
|
+
};
|
|
7166
7242
|
|
|
7167
7243
|
class RefCounter {
|
|
7168
7244
|
constructor() {
|
package/out/stub.mjs
CHANGED
|
@@ -207,13 +207,13 @@ var OpenFin = /*#__PURE__*/Object.freeze({
|
|
|
207
207
|
WindowEvents: window$1
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
var __classPrivateFieldSet$
|
|
210
|
+
var __classPrivateFieldSet$l = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
211
211
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
212
212
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
213
213
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
214
214
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
215
215
|
};
|
|
216
|
-
var __classPrivateFieldGet$
|
|
216
|
+
var __classPrivateFieldGet$m = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
217
217
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
218
218
|
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");
|
|
219
219
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -294,9 +294,9 @@ class EmitterBase extends Base {
|
|
|
294
294
|
this.emit = (eventType, payload, ...args) => {
|
|
295
295
|
return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
|
|
296
296
|
};
|
|
297
|
-
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$
|
|
297
|
+
this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet$m(this, _EmitterBase_emitterAccessor, "f"));
|
|
298
298
|
this.getOrCreateEmitter = () => {
|
|
299
|
-
return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$
|
|
299
|
+
return this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet$m(this, _EmitterBase_emitterAccessor, "f"));
|
|
300
300
|
};
|
|
301
301
|
this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
|
|
302
302
|
this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
|
|
@@ -334,8 +334,8 @@ class EmitterBase extends Base {
|
|
|
334
334
|
// This will only be reached if unsubscribe from event that does not exist but do not want to error here
|
|
335
335
|
return Promise.resolve();
|
|
336
336
|
};
|
|
337
|
-
__classPrivateFieldSet$
|
|
338
|
-
__classPrivateFieldSet$
|
|
337
|
+
__classPrivateFieldSet$l(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
|
|
338
|
+
__classPrivateFieldSet$l(this, _EmitterBase_deregisterOnceListeners, new WeakMap(), "f");
|
|
339
339
|
}
|
|
340
340
|
/**
|
|
341
341
|
* Adds a listener to the end of the listeners array for the specified event.
|
|
@@ -363,7 +363,7 @@ class EmitterBase extends Base {
|
|
|
363
363
|
*/
|
|
364
364
|
async once(eventType, listener, options) {
|
|
365
365
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
366
|
-
__classPrivateFieldGet$
|
|
366
|
+
__classPrivateFieldGet$m(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
367
367
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
368
368
|
emitter.once(eventType, deregister);
|
|
369
369
|
emitter.once(eventType, listener);
|
|
@@ -394,7 +394,7 @@ class EmitterBase extends Base {
|
|
|
394
394
|
*/
|
|
395
395
|
async prependOnceListener(eventType, listener, options) {
|
|
396
396
|
const deregister = () => this.deregisterEventListener(eventType);
|
|
397
|
-
__classPrivateFieldGet$
|
|
397
|
+
__classPrivateFieldGet$m(this, _EmitterBase_deregisterOnceListeners, "f").set(listener, deregister);
|
|
398
398
|
await this.registerEventListener(eventType, options, (emitter) => {
|
|
399
399
|
emitter.prependOnceListener(eventType, listener);
|
|
400
400
|
emitter.once(eventType, deregister);
|
|
@@ -413,7 +413,7 @@ class EmitterBase extends Base {
|
|
|
413
413
|
const emitter = await this.deregisterEventListener(eventType, options);
|
|
414
414
|
if (emitter) {
|
|
415
415
|
emitter.removeListener(eventType, listener);
|
|
416
|
-
const deregister = __classPrivateFieldGet$
|
|
416
|
+
const deregister = __classPrivateFieldGet$m(this, _EmitterBase_deregisterOnceListeners, "f").get(listener);
|
|
417
417
|
if (deregister) {
|
|
418
418
|
emitter.removeListener(eventType, deregister);
|
|
419
419
|
}
|
|
@@ -459,7 +459,7 @@ class EmitterBase extends Base {
|
|
|
459
459
|
deleteEmitterIfNothingRegistered(emitter) {
|
|
460
460
|
// TODO: maybe emitterMap should clean up itself..
|
|
461
461
|
if (emitter.eventNames().length === 0) {
|
|
462
|
-
this.wire.eventAggregator.delete(__classPrivateFieldGet$
|
|
462
|
+
this.wire.eventAggregator.delete(__classPrivateFieldGet$m(this, _EmitterBase_emitterAccessor, "f"));
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
}
|
|
@@ -5081,18 +5081,36 @@ class SystemContentTracing extends Base {
|
|
|
5081
5081
|
*
|
|
5082
5082
|
* @packageDocumentation
|
|
5083
5083
|
*/
|
|
5084
|
+
var __classPrivateFieldGet$l = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
5085
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
5086
|
+
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");
|
|
5087
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5088
|
+
};
|
|
5089
|
+
var __classPrivateFieldSet$k = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
5090
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
5091
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5092
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5093
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
5094
|
+
};
|
|
5095
|
+
var _System_instances, _System_registeredUsageKeys, _System_pendingUsageKeys, _System_usageBatch, _System_usageFlushScheduled, _System_flushUsageBatch;
|
|
5084
5096
|
/**
|
|
5085
5097
|
* An object representing the core of OpenFin Runtime. Allows the developer
|
|
5086
5098
|
* to perform system-level actions, such as accessing logs, viewing processes,
|
|
5087
5099
|
* clearing the cache and exiting the runtime as well as listen to {@link OpenFin.SystemEvents system events}.
|
|
5088
5100
|
*
|
|
5089
5101
|
*/
|
|
5102
|
+
const sortedKeysReplacer = (_, v) => v && typeof v === 'object' && !Array.isArray(v) ? Object.fromEntries(Object.entries(v).sort()) : v;
|
|
5090
5103
|
class System extends EmitterBase {
|
|
5091
5104
|
/**
|
|
5092
5105
|
* @internal
|
|
5093
5106
|
*/
|
|
5094
5107
|
constructor(wire) {
|
|
5095
5108
|
super(wire, 'system');
|
|
5109
|
+
_System_instances.add(this);
|
|
5110
|
+
_System_registeredUsageKeys.set(this, new Set());
|
|
5111
|
+
_System_pendingUsageKeys.set(this, new Set());
|
|
5112
|
+
_System_usageBatch.set(this, []);
|
|
5113
|
+
_System_usageFlushScheduled.set(this, false);
|
|
5096
5114
|
this.ContentTracing = new SystemContentTracing(wire);
|
|
5097
5115
|
}
|
|
5098
5116
|
sendExternalProcessRequest(action, options) {
|
|
@@ -6829,31 +6847,58 @@ class System extends EmitterBase {
|
|
|
6829
6847
|
return payload.data;
|
|
6830
6848
|
}
|
|
6831
6849
|
/**
|
|
6832
|
-
* (Internal) Register the usage of a component with a platform
|
|
6833
|
-
*
|
|
6850
|
+
* (Internal) Register the usage of a component with a platform.
|
|
6851
|
+
*
|
|
6852
|
+
* @param options - Object with `data` and `type`.
|
|
6853
|
+
*
|
|
6854
|
+
* @remarks
|
|
6855
|
+
* **This method never throws.** All errors — including IPC failures, RVM timeouts, and
|
|
6856
|
+
* serialization errors — are caught internally and logged at `debug` level. Usage tracking
|
|
6857
|
+
* must never break the calling feature.
|
|
6858
|
+
*
|
|
6859
|
+
* Calls are automatically deduplicated client-side for the lifetime of the current window
|
|
6860
|
+
* (i.e. until the window is closed or the page is reloaded). The first call with a given
|
|
6861
|
+
* `type` + `data` combination is forwarded to the Runtime as normal. Any subsequent call
|
|
6862
|
+
* with the same `type` and `data` values within the same window lifetime is silently
|
|
6863
|
+
* suppressed without making an IPC round-trip.
|
|
6864
|
+
*
|
|
6865
|
+
* If `data` cannot be serialized to JSON (for example, a circular reference), deduplication
|
|
6866
|
+
* is skipped for that call and the IPC call is still forwarded unconditionally.
|
|
6834
6867
|
*
|
|
6835
6868
|
* @example
|
|
6836
6869
|
* ```js
|
|
6837
|
-
*
|
|
6838
|
-
*
|
|
6839
|
-
*
|
|
6840
|
-
*
|
|
6841
|
-
*
|
|
6842
|
-
*
|
|
6843
|
-
*
|
|
6844
|
-
*
|
|
6845
|
-
*
|
|
6846
|
-
*
|
|
6847
|
-
*
|
|
6848
|
-
*
|
|
6849
|
-
* });
|
|
6850
|
-
* }
|
|
6851
|
-
*
|
|
6852
|
-
* registerUsage().then(() => console.log('Successfully registered component application')).catch(err => console.log(err));
|
|
6870
|
+
* // Safe to fire-and-forget — will never throw or reject.
|
|
6871
|
+
* // Duplicate calls within the same window lifetime are suppressed automatically.
|
|
6872
|
+
* fin.System.registerUsage({
|
|
6873
|
+
* type: 'workspace-licensing',
|
|
6874
|
+
* data: {
|
|
6875
|
+
* apiVersion: '1.0',
|
|
6876
|
+
* componentName: 'home',
|
|
6877
|
+
* componentVersion: '1.0',
|
|
6878
|
+
* allowed: true,
|
|
6879
|
+
* rejectionCode: ''
|
|
6880
|
+
* }
|
|
6881
|
+
* });
|
|
6853
6882
|
* ```
|
|
6854
6883
|
*/
|
|
6855
|
-
|
|
6856
|
-
|
|
6884
|
+
registerUsage({ data, type }) {
|
|
6885
|
+
let dedupKey;
|
|
6886
|
+
try {
|
|
6887
|
+
const key = `${type}\0${JSON.stringify(data, sortedKeysReplacer)}`;
|
|
6888
|
+
if (__classPrivateFieldGet$l(this, _System_registeredUsageKeys, "f").has(key) || __classPrivateFieldGet$l(this, _System_pendingUsageKeys, "f").has(key)) {
|
|
6889
|
+
return;
|
|
6890
|
+
}
|
|
6891
|
+
__classPrivateFieldGet$l(this, _System_pendingUsageKeys, "f").add(key);
|
|
6892
|
+
dedupKey = key;
|
|
6893
|
+
}
|
|
6894
|
+
catch {
|
|
6895
|
+
console.debug(`[registerUsage] Failed to serialize 'data' for deduplication (type: "${type}"). Sending unconditionally.`);
|
|
6896
|
+
}
|
|
6897
|
+
__classPrivateFieldGet$l(this, _System_usageBatch, "f").push({ payload: { data, type }, dedupKey });
|
|
6898
|
+
if (!__classPrivateFieldGet$l(this, _System_usageFlushScheduled, "f")) {
|
|
6899
|
+
__classPrivateFieldSet$k(this, _System_usageFlushScheduled, true, "f");
|
|
6900
|
+
queueMicrotask(() => __classPrivateFieldGet$l(this, _System_instances, "m", _System_flushUsageBatch).call(this));
|
|
6901
|
+
}
|
|
6857
6902
|
}
|
|
6858
6903
|
/**
|
|
6859
6904
|
* Returns an array with all printers of the caller and not all the printers on the desktop.
|
|
@@ -7159,6 +7204,37 @@ class System extends EmitterBase {
|
|
|
7159
7204
|
return payload.data;
|
|
7160
7205
|
}
|
|
7161
7206
|
}
|
|
7207
|
+
_System_registeredUsageKeys = new WeakMap(), _System_pendingUsageKeys = new WeakMap(), _System_usageBatch = new WeakMap(), _System_usageFlushScheduled = new WeakMap(), _System_instances = new WeakSet(), _System_flushUsageBatch = function _System_flushUsageBatch() {
|
|
7208
|
+
__classPrivateFieldSet$k(this, _System_usageFlushScheduled, false, "f");
|
|
7209
|
+
const batch = __classPrivateFieldGet$l(this, _System_usageBatch, "f");
|
|
7210
|
+
__classPrivateFieldSet$k(this, _System_usageBatch, [], "f");
|
|
7211
|
+
if (batch.length === 0)
|
|
7212
|
+
return;
|
|
7213
|
+
const items = batch.map(({ payload }) => payload);
|
|
7214
|
+
const keys = batch.map(({ dedupKey }) => dedupKey);
|
|
7215
|
+
const commitKeys = () => {
|
|
7216
|
+
for (const key of keys) {
|
|
7217
|
+
if (key !== undefined) {
|
|
7218
|
+
__classPrivateFieldGet$l(this, _System_pendingUsageKeys, "f").delete(key);
|
|
7219
|
+
__classPrivateFieldGet$l(this, _System_registeredUsageKeys, "f").add(key);
|
|
7220
|
+
}
|
|
7221
|
+
}
|
|
7222
|
+
};
|
|
7223
|
+
const rollbackKeys = () => {
|
|
7224
|
+
for (const key of keys) {
|
|
7225
|
+
if (key !== undefined) {
|
|
7226
|
+
__classPrivateFieldGet$l(this, _System_pendingUsageKeys, "f").delete(key);
|
|
7227
|
+
}
|
|
7228
|
+
}
|
|
7229
|
+
};
|
|
7230
|
+
const action = items.length === 1
|
|
7231
|
+
? this.wire.sendAction('register-usage', items[0])
|
|
7232
|
+
: this.wire.sendAction('register-usage-batch', { items });
|
|
7233
|
+
action.then(commitKeys).catch((e) => {
|
|
7234
|
+
rollbackKeys();
|
|
7235
|
+
console.debug('[registerUsage] Failed to send usage data.', e);
|
|
7236
|
+
});
|
|
7237
|
+
};
|
|
7162
7238
|
|
|
7163
7239
|
class RefCounter {
|
|
7164
7240
|
constructor() {
|