@openfin/remote-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.
@@ -7245,6 +7245,15 @@ declare class InteropBroker extends Base {
7245
7245
  setContext({ context }: {
7246
7246
  context: OpenFin.Context;
7247
7247
  }, clientIdentity: OpenFin.ClientIdentity): void;
7248
+ /**
7249
+ * Sets a context for the context group.
7250
+ * @param setContextOptions - New context to set.
7251
+ * @param contextGroupId - Context group id.
7252
+ *
7253
+ */
7254
+ setContextForGroup({ context }: {
7255
+ context: OpenFin.Context;
7256
+ }, contextGroupId: string): void;
7248
7257
  /**
7249
7258
  * Get current context for a client subscribed to a Context Group.
7250
7259
  *
@@ -12499,6 +12508,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12499
12508
  'interop-broker-remove-client-from-context-group': VoidCall;
12500
12509
  'interop-broker-remove-from-context-group': VoidCall;
12501
12510
  'interop-broker-set-context': VoidCall;
12511
+ 'interop-broker-set-context-for-group': VoidCall;
12502
12512
  'query-permission-for-current-context': {
12503
12513
  request: {
12504
12514
  apiName: string;
@@ -7245,6 +7245,15 @@ declare class InteropBroker extends Base {
7245
7245
  setContext({ context }: {
7246
7246
  context: OpenFin.Context;
7247
7247
  }, clientIdentity: OpenFin.ClientIdentity): void;
7248
+ /**
7249
+ * Sets a context for the context group.
7250
+ * @param setContextOptions - New context to set.
7251
+ * @param contextGroupId - Context group id.
7252
+ *
7253
+ */
7254
+ setContextForGroup({ context }: {
7255
+ context: OpenFin.Context;
7256
+ }, contextGroupId: string): void;
7248
7257
  /**
7249
7258
  * Get current context for a client subscribed to a Context Group.
7250
7259
  *
@@ -12499,6 +12508,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12499
12508
  'interop-broker-remove-client-from-context-group': VoidCall;
12500
12509
  'interop-broker-remove-from-context-group': VoidCall;
12501
12510
  'interop-broker-set-context': VoidCall;
12511
+ 'interop-broker-set-context-for-group': VoidCall;
12502
12512
  'query-permission-for-current-context': {
12503
12513
  request: {
12504
12514
  apiName: string;
@@ -7245,6 +7245,15 @@ declare class InteropBroker extends Base {
7245
7245
  setContext({ context }: {
7246
7246
  context: OpenFin.Context;
7247
7247
  }, clientIdentity: OpenFin.ClientIdentity): void;
7248
+ /**
7249
+ * Sets a context for the context group.
7250
+ * @param setContextOptions - New context to set.
7251
+ * @param contextGroupId - Context group id.
7252
+ *
7253
+ */
7254
+ setContextForGroup({ context }: {
7255
+ context: OpenFin.Context;
7256
+ }, contextGroupId: string): void;
7248
7257
  /**
7249
7258
  * Get current context for a client subscribed to a Context Group.
7250
7259
  *
@@ -12499,6 +12508,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12499
12508
  'interop-broker-remove-client-from-context-group': VoidCall;
12500
12509
  'interop-broker-remove-from-context-group': VoidCall;
12501
12510
  'interop-broker-set-context': VoidCall;
12511
+ 'interop-broker-set-context-for-group': VoidCall;
12502
12512
  'query-permission-for-current-context': {
12503
12513
  request: {
12504
12514
  apiName: string;
@@ -7350,6 +7350,15 @@ declare class InteropBroker extends Base {
7350
7350
  setContext({ context }: {
7351
7351
  context: OpenFin.Context;
7352
7352
  }, clientIdentity: OpenFin.ClientIdentity): void;
7353
+ /**
7354
+ * Sets a context for the context group.
7355
+ * @param setContextOptions - New context to set.
7356
+ * @param contextGroupId - Context group id.
7357
+ *
7358
+ */
7359
+ setContextForGroup({ context }: {
7360
+ context: OpenFin.Context;
7361
+ }, contextGroupId: string): void;
7353
7362
  /**
7354
7363
  * Get current context for a client subscribed to a Context Group.
7355
7364
  *
@@ -12888,6 +12897,7 @@ declare interface ProtocolMap extends ProtocolMapBase {
12888
12897
  'interop-broker-remove-client-from-context-group': VoidCall;
12889
12898
  'interop-broker-remove-from-context-group': VoidCall;
12890
12899
  'interop-broker-set-context': VoidCall;
12900
+ 'interop-broker-set-context-for-group': VoidCall;
12891
12901
  'query-permission-for-current-context': {
12892
12902
  request: {
12893
12903
  apiName: string;
@@ -1920,27 +1920,7 @@ function requireInteropBroker () {
1920
1920
  const clientState = this.getClientState(clientIdentity);
1921
1921
  if (clientState && clientState.contextGroupId) {
1922
1922
  const { contextGroupId } = clientState;
1923
- if (!this.contextGroupsById.has(contextGroupId)) {
1924
- // Theoretically not possible.
1925
- throw new Error(`Client has a context group that isn't in the context group mapping: ${contextGroupId}.`);
1926
- }
1927
- const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
1928
- if (contextIntegrityCheckResult.isValid === false) {
1929
- throw new Error(`Failed to set Context - bad Context. Reason: ${contextIntegrityCheckResult.reason}. Context: ${JSON.stringify(context)}`);
1930
- }
1931
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1932
- const contextGroupState = this.contextGroupsById.get(contextGroupId);
1933
- const broadcastedContextType = context.type;
1934
- contextGroupState.set(broadcastedContextType, context);
1935
- this.lastContextMap.set(contextGroupId, broadcastedContextType);
1936
- const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId === contextGroupId);
1937
- clientsInSameContextGroup.forEach((client) => {
1938
- for (const [, handlerInfo] of client.contextHandlers) {
1939
- if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
1940
- this.invokeContextHandler(client.clientIdentity, handlerInfo.handlerId, context);
1941
- }
1942
- }
1943
- });
1923
+ this.setContextForGroup({ context }, contextGroupId);
1944
1924
  }
1945
1925
  else if (clientState) {
1946
1926
  // Client has not joined any context group behavior.
@@ -1951,6 +1931,36 @@ function requireInteropBroker () {
1951
1931
  throw new Error(`Client with Identity: ${clientIdentity.uuid} ${clientIdentity.name} not in Client State Map`);
1952
1932
  }
1953
1933
  }
1934
+ /**
1935
+ * Sets a context for the context group.
1936
+ * @param setContextOptions - New context to set.
1937
+ * @param contextGroupId - Context group id.
1938
+ *
1939
+ */
1940
+ setContextForGroup({ context }, contextGroupId) {
1941
+ this.wire.sendAction('interop-broker-set-context-for-group').catch((e) => {
1942
+ // don't expose, analytics-only call
1943
+ });
1944
+ const contextGroupState = this.contextGroupsById.get(contextGroupId);
1945
+ if (!contextGroupState) {
1946
+ throw new Error(`Unable to set context for context group that isn't in the context group mapping: ${contextGroupId}.`);
1947
+ }
1948
+ const contextIntegrityCheckResult = InteropBroker.checkContextIntegrity(context);
1949
+ if (contextIntegrityCheckResult.isValid === false) {
1950
+ throw new Error(`Failed to set Context - bad Context. Reason: ${contextIntegrityCheckResult.reason}. Context: ${JSON.stringify(context)}`);
1951
+ }
1952
+ const broadcastedContextType = context.type;
1953
+ contextGroupState.set(broadcastedContextType, context);
1954
+ this.lastContextMap.set(contextGroupId, broadcastedContextType);
1955
+ const clientsInSameContextGroup = Array.from(this.interopClients.values()).filter((connectedClient) => connectedClient.contextGroupId === contextGroupId);
1956
+ clientsInSameContextGroup.forEach((client) => {
1957
+ for (const [, handlerInfo] of client.contextHandlers) {
1958
+ if (InteropBroker.isContextTypeCompatible(broadcastedContextType, handlerInfo.contextType)) {
1959
+ this.invokeContextHandler(client.clientIdentity, handlerInfo.handlerId, context);
1960
+ }
1961
+ }
1962
+ });
1963
+ }
1954
1964
  /**
1955
1965
  * Get current context for a client subscribed to a Context Group.
1956
1966
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/remote-adapter",
3
- "version": "36.80.7",
3
+ "version": "36.80.8",
4
4
  "description": "Establish intermachine runtime connections using webRTC.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "private": false,