@openfin/node-adapter 36.80.7 → 36.80.8

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.
@@ -7210,6 +7210,15 @@ declare class InteropBroker extends Base {
7210
7210
  setContext({ context }: {
7211
7211
  context: OpenFin.Context;
7212
7212
  }, clientIdentity: OpenFin.ClientIdentity): void;
7213
+ /**
7214
+ * Sets a context for the context group.
7215
+ * @param setContextOptions - New context to set.
7216
+ * @param contextGroupId - Context group id.
7217
+ *
7218
+ */
7219
+ setContextForGroup({ context }: {
7220
+ context: OpenFin.Context;
7221
+ }, contextGroupId: string): void;
7213
7222
  /**
7214
7223
  * Get current context for a client subscribed to a Context Group.
7215
7224
  *
@@ -12467,6 +12476,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12467
12476
  'interop-broker-remove-client-from-context-group': VoidCall;
12468
12477
  'interop-broker-remove-from-context-group': VoidCall;
12469
12478
  'interop-broker-set-context': VoidCall;
12479
+ 'interop-broker-set-context-for-group': VoidCall;
12470
12480
  'query-permission-for-current-context': {
12471
12481
  request: {
12472
12482
  apiName: string;
@@ -7210,6 +7210,15 @@ declare class InteropBroker extends Base {
7210
7210
  setContext({ context }: {
7211
7211
  context: OpenFin.Context;
7212
7212
  }, clientIdentity: OpenFin.ClientIdentity): void;
7213
+ /**
7214
+ * Sets a context for the context group.
7215
+ * @param setContextOptions - New context to set.
7216
+ * @param contextGroupId - Context group id.
7217
+ *
7218
+ */
7219
+ setContextForGroup({ context }: {
7220
+ context: OpenFin.Context;
7221
+ }, contextGroupId: string): void;
7213
7222
  /**
7214
7223
  * Get current context for a client subscribed to a Context Group.
7215
7224
  *
@@ -12467,6 +12476,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12467
12476
  'interop-broker-remove-client-from-context-group': VoidCall;
12468
12477
  'interop-broker-remove-from-context-group': VoidCall;
12469
12478
  'interop-broker-set-context': VoidCall;
12479
+ 'interop-broker-set-context-for-group': VoidCall;
12470
12480
  'query-permission-for-current-context': {
12471
12481
  request: {
12472
12482
  apiName: string;
@@ -7210,6 +7210,15 @@ declare class InteropBroker extends Base {
7210
7210
  setContext({ context }: {
7211
7211
  context: OpenFin.Context;
7212
7212
  }, clientIdentity: OpenFin.ClientIdentity): void;
7213
+ /**
7214
+ * Sets a context for the context group.
7215
+ * @param setContextOptions - New context to set.
7216
+ * @param contextGroupId - Context group id.
7217
+ *
7218
+ */
7219
+ setContextForGroup({ context }: {
7220
+ context: OpenFin.Context;
7221
+ }, contextGroupId: string): void;
7213
7222
  /**
7214
7223
  * Get current context for a client subscribed to a Context Group.
7215
7224
  *
@@ -12467,6 +12476,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12467
12476
  'interop-broker-remove-client-from-context-group': VoidCall;
12468
12477
  'interop-broker-remove-from-context-group': VoidCall;
12469
12478
  'interop-broker-set-context': VoidCall;
12479
+ 'interop-broker-set-context-for-group': VoidCall;
12470
12480
  'query-permission-for-current-context': {
12471
12481
  request: {
12472
12482
  apiName: string;
@@ -7337,6 +7337,15 @@ declare class InteropBroker extends Base {
7337
7337
  setContext({ context }: {
7338
7338
  context: OpenFin.Context;
7339
7339
  }, clientIdentity: OpenFin.ClientIdentity): void;
7340
+ /**
7341
+ * Sets a context for the context group.
7342
+ * @param setContextOptions - New context to set.
7343
+ * @param contextGroupId - Context group id.
7344
+ *
7345
+ */
7346
+ setContextForGroup({ context }: {
7347
+ context: OpenFin.Context;
7348
+ }, contextGroupId: string): void;
7340
7349
  /**
7341
7350
  * Get current context for a client subscribed to a Context Group.
7342
7351
  *
@@ -12878,6 +12887,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12878
12887
  'interop-broker-remove-client-from-context-group': VoidCall;
12879
12888
  'interop-broker-remove-from-context-group': VoidCall;
12880
12889
  'interop-broker-set-context': VoidCall;
12890
+ 'interop-broker-set-context-for-group': VoidCall;
12881
12891
  'query-permission-for-current-context': {
12882
12892
  request: {
12883
12893
  apiName: string;
@@ -13165,27 +13165,7 @@ function requireInteropBroker () {
13165
13165
  const clientState = this.getClientState(clientIdentity);
13166
13166
  if (clientState && clientState.contextGroupId) {
13167
13167
  const { contextGroupId } = clientState;
13168
- if (!this.contextGroupsById.has(contextGroupId)) {
13169
- // Theoretically not possible.
13170
- throw new Error(`Client has a context group that isn't in the context group mapping: ${contextGroupId}.`);
13171
- }
13172
- const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
13173
- if (contextIntegrityCheckResult.isValid === false) {
13174
- throw new Error(`Failed to set Context - bad Context. Reason: ${contextIntegrityCheckResult.reason}. Context: ${JSON.stringify(context)}`);
13175
- }
13176
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13177
- const contextGroupState = this.contextGroupsById.get(contextGroupId);
13178
- const broadcastedContextType = context.type;
13179
- contextGroupState.set(broadcastedContextType, context);
13180
- this.lastContextMap.set(contextGroupId, broadcastedContextType);
13181
- const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId === contextGroupId);
13182
- clientsInSameContextGroup.forEach((client) => {
13183
- for (const [, handlerInfo] of client.contextHandlers) {
13184
- if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
13185
- this.invokeContextHandler(client.clientIdentity, handlerInfo.handlerId, context);
13186
- }
13187
- }
13188
- });
13168
+ this.setContextForGroup({ context }, contextGroupId);
13189
13169
  }
13190
13170
  else if (clientState) {
13191
13171
  // Client has not joined any context group behavior.
@@ -13196,6 +13176,36 @@ function requireInteropBroker () {
13196
13176
  throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Client State Map`);
13197
13177
  }
13198
13178
  }
13179
+ /**
13180
+ * Sets a context for the context group.
13181
+ * @param setContextOptions - New context to set.
13182
+ * @param contextGroupId - Context group id.
13183
+ *
13184
+ */
13185
+ setContextForGroup({ context }, contextGroupId) {
13186
+ this.wire.sendAction('interop-broker-set-context-for-group').catch((e) => {
13187
+ // don't expose, analytics-only call
13188
+ });
13189
+ const contextGroupState = this.contextGroupsById.get(contextGroupId);
13190
+ if (!contextGroupState) {
13191
+ throw new Error(`Unable to set context for context group that isn't in the context group mapping: ${contextGroupId}.`);
13192
+ }
13193
+ const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
13194
+ if (contextIntegrityCheckResult.isValid === false) {
13195
+ throw new Error(`Failed to set Context - bad Context. Reason: ${contextIntegrityCheckResult.reason}. Context: ${JSON.stringify(context)}`);
13196
+ }
13197
+ const broadcastedContextType = context.type;
13198
+ contextGroupState.set(broadcastedContextType, context);
13199
+ this.lastContextMap.set(contextGroupId, broadcastedContextType);
13200
+ const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId === contextGroupId);
13201
+ clientsInSameContextGroup.forEach((client) => {
13202
+ for (const [, handlerInfo] of client.contextHandlers) {
13203
+ if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
13204
+ this.invokeContextHandler(client.clientIdentity, handlerInfo.handlerId, context);
13205
+ }
13206
+ }
13207
+ });
13208
+ }
13199
13209
  /**
13200
13210
  * Get current context for a client subscribed to a Context Group.
13201
13211
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/node-adapter",
3
- "version": "36.80.7",
3
+ "version": "36.80.8",
4
4
  "description": "See README.md",
5
5
  "main": "out/node-adapter.js",
6
6
  "types": "out/node-adapter.d.ts",