@openfin/node-adapter 37.80.36 → 37.80.39

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.
@@ -7155,6 +7155,15 @@ declare class InteropBroker extends Base {
7155
7155
  setContext({ context }: {
7156
7156
  context: OpenFin.Context;
7157
7157
  }, clientIdentity: OpenFin.ClientIdentity): void;
7158
+ /**
7159
+ * Sets a context for the context group.
7160
+ * @param setContextOptions - New context to set.
7161
+ * @param contextGroupId - Context group id.
7162
+ *
7163
+ */
7164
+ setContextForGroup({ context }: {
7165
+ context: OpenFin.Context;
7166
+ }, contextGroupId: string): void;
7158
7167
  /**
7159
7168
  * Get current context for a client subscribed to a Context Group.
7160
7169
  *
@@ -11946,7 +11955,7 @@ declare type PreloadScriptInfoRunning = {
11946
11955
  * @interface
11947
11956
  */
11948
11957
  declare type PreloadScriptsStateChangedEvent = PreloadScriptsStateChangeEvent & {
11949
- type: 'preload-script-state-changed';
11958
+ type: 'preload-scripts-state-changed';
11950
11959
  };
11951
11960
 
11952
11961
  /**
@@ -11963,7 +11972,7 @@ declare type PreloadScriptsStateChangeEvent = BaseEvent_5 & {
11963
11972
  * @interface
11964
11973
  */
11965
11974
  declare type PreloadScriptsStateChangingEvent = PreloadScriptsStateChangeEvent & {
11966
- type: 'preload-script-state-changing';
11975
+ type: 'preload-scripts-state-changing';
11967
11976
  };
11968
11977
 
11969
11978
  declare type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
@@ -12389,6 +12398,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12389
12398
  'interop-broker-remove-client-from-context-group': VoidCall;
12390
12399
  'interop-broker-remove-from-context-group': VoidCall;
12391
12400
  'interop-broker-set-context': VoidCall;
12401
+ 'interop-broker-set-context-for-group': VoidCall;
12392
12402
  'query-permission-for-current-context': {
12393
12403
  request: {
12394
12404
  apiName: string;
@@ -7155,6 +7155,15 @@ declare class InteropBroker extends Base {
7155
7155
  setContext({ context }: {
7156
7156
  context: OpenFin.Context;
7157
7157
  }, clientIdentity: OpenFin.ClientIdentity): void;
7158
+ /**
7159
+ * Sets a context for the context group.
7160
+ * @param setContextOptions - New context to set.
7161
+ * @param contextGroupId - Context group id.
7162
+ *
7163
+ */
7164
+ setContextForGroup({ context }: {
7165
+ context: OpenFin.Context;
7166
+ }, contextGroupId: string): void;
7158
7167
  /**
7159
7168
  * Get current context for a client subscribed to a Context Group.
7160
7169
  *
@@ -11946,7 +11955,7 @@ declare type PreloadScriptInfoRunning = {
11946
11955
  * @interface
11947
11956
  */
11948
11957
  declare type PreloadScriptsStateChangedEvent = PreloadScriptsStateChangeEvent & {
11949
- type: 'preload-script-state-changed';
11958
+ type: 'preload-scripts-state-changed';
11950
11959
  };
11951
11960
 
11952
11961
  /**
@@ -11963,7 +11972,7 @@ declare type PreloadScriptsStateChangeEvent = BaseEvent_5 & {
11963
11972
  * @interface
11964
11973
  */
11965
11974
  declare type PreloadScriptsStateChangingEvent = PreloadScriptsStateChangeEvent & {
11966
- type: 'preload-script-state-changing';
11975
+ type: 'preload-scripts-state-changing';
11967
11976
  };
11968
11977
 
11969
11978
  declare type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
@@ -12389,6 +12398,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12389
12398
  'interop-broker-remove-client-from-context-group': VoidCall;
12390
12399
  'interop-broker-remove-from-context-group': VoidCall;
12391
12400
  'interop-broker-set-context': VoidCall;
12401
+ 'interop-broker-set-context-for-group': VoidCall;
12392
12402
  'query-permission-for-current-context': {
12393
12403
  request: {
12394
12404
  apiName: string;
@@ -7155,6 +7155,15 @@ declare class InteropBroker extends Base {
7155
7155
  setContext({ context }: {
7156
7156
  context: OpenFin.Context;
7157
7157
  }, clientIdentity: OpenFin.ClientIdentity): void;
7158
+ /**
7159
+ * Sets a context for the context group.
7160
+ * @param setContextOptions - New context to set.
7161
+ * @param contextGroupId - Context group id.
7162
+ *
7163
+ */
7164
+ setContextForGroup({ context }: {
7165
+ context: OpenFin.Context;
7166
+ }, contextGroupId: string): void;
7158
7167
  /**
7159
7168
  * Get current context for a client subscribed to a Context Group.
7160
7169
  *
@@ -11946,7 +11955,7 @@ declare type PreloadScriptInfoRunning = {
11946
11955
  * @interface
11947
11956
  */
11948
11957
  declare type PreloadScriptsStateChangedEvent = PreloadScriptsStateChangeEvent & {
11949
- type: 'preload-script-state-changed';
11958
+ type: 'preload-scripts-state-changed';
11950
11959
  };
11951
11960
 
11952
11961
  /**
@@ -11963,7 +11972,7 @@ declare type PreloadScriptsStateChangeEvent = BaseEvent_5 & {
11963
11972
  * @interface
11964
11973
  */
11965
11974
  declare type PreloadScriptsStateChangingEvent = PreloadScriptsStateChangeEvent & {
11966
- type: 'preload-script-state-changing';
11975
+ type: 'preload-scripts-state-changing';
11967
11976
  };
11968
11977
 
11969
11978
  declare type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
@@ -12389,6 +12398,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12389
12398
  'interop-broker-remove-client-from-context-group': VoidCall;
12390
12399
  'interop-broker-remove-from-context-group': VoidCall;
12391
12400
  'interop-broker-set-context': VoidCall;
12401
+ 'interop-broker-set-context-for-group': VoidCall;
12392
12402
  'query-permission-for-current-context': {
12393
12403
  request: {
12394
12404
  apiName: string;
@@ -7282,6 +7282,15 @@ declare class InteropBroker extends Base {
7282
7282
  setContext({ context }: {
7283
7283
  context: OpenFin.Context;
7284
7284
  }, clientIdentity: OpenFin.ClientIdentity): void;
7285
+ /**
7286
+ * Sets a context for the context group.
7287
+ * @param setContextOptions - New context to set.
7288
+ * @param contextGroupId - Context group id.
7289
+ *
7290
+ */
7291
+ setContextForGroup({ context }: {
7292
+ context: OpenFin.Context;
7293
+ }, contextGroupId: string): void;
7285
7294
  /**
7286
7295
  * Get current context for a client subscribed to a Context Group.
7287
7296
  *
@@ -12357,7 +12366,7 @@ declare type PreloadScriptInfoRunning = {
12357
12366
  * @interface
12358
12367
  */
12359
12368
  declare type PreloadScriptsStateChangedEvent = PreloadScriptsStateChangeEvent & {
12360
- type: 'preload-script-state-changed';
12369
+ type: 'preload-scripts-state-changed';
12361
12370
  };
12362
12371
 
12363
12372
  /**
@@ -12374,7 +12383,7 @@ declare type PreloadScriptsStateChangeEvent = BaseEvent_5 & {
12374
12383
  * @interface
12375
12384
  */
12376
12385
  declare type PreloadScriptsStateChangingEvent = PreloadScriptsStateChangeEvent & {
12377
- type: 'preload-script-state-changing';
12386
+ type: 'preload-scripts-state-changing';
12378
12387
  };
12379
12388
 
12380
12389
  declare type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
@@ -12800,6 +12809,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12800
12809
  'interop-broker-remove-client-from-context-group': VoidCall;
12801
12810
  'interop-broker-remove-from-context-group': VoidCall;
12802
12811
  'interop-broker-set-context': VoidCall;
12812
+ 'interop-broker-set-context-for-group': VoidCall;
12803
12813
  'query-permission-for-current-context': {
12804
12814
  request: {
12805
12815
  apiName: string;
@@ -13216,27 +13216,7 @@ function requireInteropBroker () {
13216
13216
  const clientState = this.getClientState(clientIdentity);
13217
13217
  if (clientState && clientState.contextGroupId) {
13218
13218
  const { contextGroupId } = clientState;
13219
- if (!this.contextGroupsById.has(contextGroupId)) {
13220
- // Theoretically not possible.
13221
- throw new Error(`Client has a context group that isn't in the context group mapping: ${contextGroupId}.`);
13222
- }
13223
- const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
13224
- if (contextIntegrityCheckResult.isValid === false) {
13225
- throw new Error(`Failed to set Context - bad Context. Reason: ${contextIntegrityCheckResult.reason}. Context: ${JSON.stringify(context)}`);
13226
- }
13227
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13228
- const contextGroupState = this.contextGroupsById.get(contextGroupId);
13229
- const broadcastedContextType = context.type;
13230
- contextGroupState.set(broadcastedContextType, context);
13231
- this.lastContextMap.set(contextGroupId, broadcastedContextType);
13232
- const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId === contextGroupId);
13233
- clientsInSameContextGroup.forEach((client) => {
13234
- for (const [, handlerInfo] of client.contextHandlers) {
13235
- if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
13236
- this.invokeContextHandler(client.clientIdentity, handlerInfo.handlerId, context);
13237
- }
13238
- }
13239
- });
13219
+ this.setContextForGroup({ context }, contextGroupId);
13240
13220
  }
13241
13221
  else if (clientState) {
13242
13222
  // Client has not joined any context group behavior.
@@ -13247,6 +13227,36 @@ function requireInteropBroker () {
13247
13227
  throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Client State Map`);
13248
13228
  }
13249
13229
  }
13230
+ /**
13231
+ * Sets a context for the context group.
13232
+ * @param setContextOptions - New context to set.
13233
+ * @param contextGroupId - Context group id.
13234
+ *
13235
+ */
13236
+ setContextForGroup({ context }, contextGroupId) {
13237
+ this.wire.sendAction('interop-broker-set-context-for-group').catch((e) => {
13238
+ // don't expose, analytics-only call
13239
+ });
13240
+ const contextGroupState = this.contextGroupsById.get(contextGroupId);
13241
+ if (!contextGroupState) {
13242
+ throw new Error(`Unable to set context for context group that isn't in the context group mapping: ${contextGroupId}.`);
13243
+ }
13244
+ const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
13245
+ if (contextIntegrityCheckResult.isValid === false) {
13246
+ throw new Error(`Failed to set Context - bad Context. Reason: ${contextIntegrityCheckResult.reason}. Context: ${JSON.stringify(context)}`);
13247
+ }
13248
+ const broadcastedContextType = context.type;
13249
+ contextGroupState.set(broadcastedContextType, context);
13250
+ this.lastContextMap.set(contextGroupId, broadcastedContextType);
13251
+ const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId === contextGroupId);
13252
+ clientsInSameContextGroup.forEach((client) => {
13253
+ for (const [, handlerInfo] of client.contextHandlers) {
13254
+ if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
13255
+ this.invokeContextHandler(client.clientIdentity, handlerInfo.handlerId, context);
13256
+ }
13257
+ }
13258
+ });
13259
+ }
13250
13260
  /**
13251
13261
  * Get current context for a client subscribed to a Context Group.
13252
13262
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/node-adapter",
3
- "version": "37.80.36",
3
+ "version": "37.80.39",
4
4
  "description": "See README.md",
5
5
  "main": "out/node-adapter.js",
6
6
  "types": "out/node-adapter.d.ts",