@interopio/fdc3 2.4.0 → 2.4.2

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/changelog.md CHANGED
@@ -1,3 +1,10 @@
1
+ 2.4.2
2
+ fix: fdc3.raiseIntent with target { appId } starts a new instance
3
+ fix: context passed to io.intents.raise
4
+ chore: Add fdc3Info to window object
5
+ 2.4.1
6
+ fix: fixed initialization delay when running in a io.cd clients outside of io.cd
7
+ chore: improvement to getOrCreateChannel to be more compliant with the standard
1
8
  2.4.0
2
9
  chore: Change log level when fdc3.broadcast is used while not joined on a channel
3
10
  fix: fdc3.raiseIntent filtering by contextType for instance handlers
@@ -894,7 +894,7 @@ const v2InteropDecoder = object$1({
894
894
  appChannels: optional$1(array$1(v2AppChannelDecoder))
895
895
  });
896
896
  const glue42ApplicationDetailsDecoder = object$1({
897
- url: nonEmptyStringDecoder$1,
897
+ url: optional$1(nonEmptyStringDecoder$1),
898
898
  top: optional$1(number$1()),
899
899
  left: optional$1(number$1()),
900
900
  width: optional$1(nonNegativeNumberDecoder),
@@ -912,10 +912,6 @@ const glue42HostManifestsBrowserDecoder = object$1({
912
912
  intents: optional$1(array$1(intentDefinitionDecoder)),
913
913
  hidden: optional$1(boolean())
914
914
  });
915
- const hostManifestsBrowserDecoder = oneOf$1(object$1({
916
- "ioConnect": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1())),
917
- "Glue42": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1()))
918
- }), anyJson$1());
919
915
  const v1DefinitionDecoder = object$1({
920
916
  name: nonEmptyStringDecoder$1,
921
917
  appId: nonEmptyStringDecoder$1,
@@ -950,7 +946,7 @@ const v2LocalizedDefinitionDecoder = object$1({
950
946
  moreInfo: optional$1(nonEmptyStringDecoder$1),
951
947
  publisher: optional$1(nonEmptyStringDecoder$1),
952
948
  customConfig: optional$1(array$1(anyJson$1())),
953
- hostManifests: optional$1(hostManifestsBrowserDecoder),
949
+ hostManifests: optional$1(anyJson$1()),
954
950
  interop: optional$1(v2InteropDecoder)
955
951
  });
956
952
  const v2DefinitionDecoder = object$1({
@@ -971,7 +967,7 @@ const v2DefinitionDecoder = object$1({
971
967
  moreInfo: optional$1(nonEmptyStringDecoder$1),
972
968
  publisher: optional$1(nonEmptyStringDecoder$1),
973
969
  customConfig: optional$1(array$1(anyJson$1())),
974
- hostManifests: optional$1(hostManifestsBrowserDecoder),
970
+ hostManifests: optional$1(anyJson$1()),
975
971
  interop: optional$1(v2InteropDecoder),
976
972
  localizedVersions: optional$1(dict(v2LocalizedDefinitionDecoder))
977
973
  });
@@ -2307,6 +2303,14 @@ class GlueController {
2307
2303
  async checkIsFdc3DataWrappingSupported() {
2308
2304
  const globalBrowserNamespace = window.glue42core || window.iobrowser;
2309
2305
  const methodName = globalBrowserNamespace ? BrowserClientControlMethodName : DesktopClientControlMethodName;
2306
+ const myServer = this.glue.interop.servers().find((server) => server.instance === this.glue.interop.instance.instance);
2307
+ if (!myServer) {
2308
+ return false;
2309
+ }
2310
+ const registersControlMethod = myServer.getMethods().some((method) => method.name === methodName);
2311
+ if (!registersControlMethod) {
2312
+ return false;
2313
+ }
2310
2314
  const data = globalBrowserNamespace ? { domain: "system", operation: "isFdc3DataWrappingSupported" } : { command: "isFdc3DataWrappingSupported" };
2311
2315
  try {
2312
2316
  const res = await this.glue.interop.invoke(methodName, data, { instance: this.interopInstance().instance });
@@ -3012,24 +3016,24 @@ class IntentsController {
3012
3016
  if (!searchedGlueIntent) {
3013
3017
  throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
3014
3018
  }
3015
- const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3016
3019
  if (!target) {
3020
+ const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3017
3021
  this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers.map(h => h.applicationName && h.instanceId)}`);
3018
3022
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
3019
3023
  }
3020
- if (typeof target === "string" || !target.instanceId) {
3021
- this.logger?.info(`[${commandId}] - target app ${target.appId} is a valid handler. Raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers}`);
3024
+ if (target?.instanceId) {
3025
+ this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3022
3026
  return this.invokeRaiseIntent(commandId, {
3023
3027
  intent,
3024
3028
  context: glueContext,
3025
- target: { app: target.appId, instance: filteredGlueIntent.handlers.find((h) => h.instanceId)?.instanceId }
3029
+ target: { instance: target.instanceId }
3026
3030
  });
3027
3031
  }
3028
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3032
+ const targetAppName = typeof target === "string" ? target : target.appId;
3029
3033
  return this.invokeRaiseIntent(commandId, {
3030
3034
  intent,
3031
3035
  context: glueContext,
3032
- target: { instance: target.instanceId }
3036
+ target: { app: targetAppName }
3033
3037
  });
3034
3038
  }
3035
3039
  async raiseIntentForContext({ commandId, context, target }) {
@@ -3038,8 +3042,9 @@ class IntentsController {
3038
3042
  const filteredHandlersMethodExist = this.glueController.doesFilterHandlersExist();
3039
3043
  const getIntentsMethodExist = this.glueController.doesGetIntentsExist();
3040
3044
  const rememberedIntentHandlerForContextType = await this.checkForRememberedIntentHandlerForContext(context.type);
3045
+ const glueContext = { type: context.type, data: { ...context } };
3041
3046
  if (rememberedIntentHandlerForContextType) {
3042
- return this.invokeRaiseIntent(commandId, { context, intent: rememberedIntentHandlerForContextType.intent });
3047
+ return this.invokeRaiseIntent(commandId, { context: glueContext, intent: rememberedIntentHandlerForContextType.intent });
3043
3048
  }
3044
3049
  if (!filteredHandlersMethodExist || !getIntentsMethodExist || target) {
3045
3050
  return this.legacyRaiseIntentForContext({ commandId, context, target });
@@ -3064,7 +3069,11 @@ class IntentsController {
3064
3069
  this.logger?.warn(`[${commandId}] - ${ResolveError.IntentDeliveryFailed} - There's no valid intent for handler ${JSON.stringify(handler)} and context type ${context.type}`);
3065
3070
  throw new Error(ResolveError.IntentDeliveryFailed);
3066
3071
  }
3067
- return this.invokeRaiseIntent(commandId, { intent: validIntent.intent, context, target: { app: handler.applicationName, instance: handler.instanceId } });
3072
+ return this.invokeRaiseIntent(commandId, {
3073
+ intent: validIntent.intent,
3074
+ context: glueContext,
3075
+ target: { app: handler.applicationName, instance: handler.instanceId }
3076
+ });
3068
3077
  }
3069
3078
  async addIntentListener({ commandId, intent, handler }) {
3070
3079
  await this.glueController.gluePromise;
@@ -3295,8 +3304,6 @@ class IntentsController {
3295
3304
  }
3296
3305
  }
3297
3306
 
3298
- var version = "2.4.0";
3299
-
3300
3307
  class ApplicationsController {
3301
3308
  glueController;
3302
3309
  appsStateStore;
@@ -3371,10 +3378,11 @@ class ApplicationsController {
3371
3378
  await this.glueController.gluePromise;
3372
3379
  this.logger?.info(`${commandId} - getInfo() invoked`);
3373
3380
  const appMetadata = await this.getCurrentAppMetadata();
3381
+ const { provider, providerVersion, standardVersion } = window.fdc3Info;
3374
3382
  return {
3375
- provider: "io.Connect",
3376
- providerVersion: version,
3377
- fdc3Version: "2.1",
3383
+ provider,
3384
+ providerVersion,
3385
+ fdc3Version: standardVersion,
3378
3386
  optionalFeatures: {
3379
3387
  OriginatingAppMetadata: true,
3380
3388
  UserChannelMembershipAPIs: true,
@@ -4196,10 +4204,9 @@ class ChannelsBaseController {
4196
4204
  async getOrCreateChannel({ commandId, channelId }) {
4197
4205
  await this.initDonePromise;
4198
4206
  this.logger?.info(`[${commandId}] - getOrCreateChannel() invoked for channel with id ${channelId}`);
4199
- const isUserChannel = this.isUserChannel(channelId);
4200
- if (isUserChannel) {
4201
- this.logger?.error("There's an already existing system channel with passed id. Retrieve it using fdc3.getSystemChannels() or create a new app channel with a different id");
4202
- throw new Error(ChannelError.AccessDenied);
4207
+ const userChannel = (await this.getUserChannels(commandId)).find((ch) => ch.id === channelId);
4208
+ if (userChannel) {
4209
+ return userChannel;
4203
4210
  }
4204
4211
  const isPrivateChannel = this.stateStore.getPrivateChannelById(channelId);
4205
4212
  if (isPrivateChannel) {
@@ -4683,7 +4690,14 @@ const fdc3Factory = () => {
4683
4690
  return ioc.fdc3;
4684
4691
  };
4685
4692
 
4693
+ var version = "2.4.2";
4694
+
4686
4695
  let globalFdc3 = window.fdc3;
4696
+ window.fdc3Info = {
4697
+ provider: "io.Connect",
4698
+ providerVersion: version,
4699
+ standardVersion: "2.1"
4700
+ };
4687
4701
  if (typeof globalFdc3 === "undefined") {
4688
4702
  globalFdc3 = fdc3Factory();
4689
4703
  checkIfInElectron(globalFdc3);
@@ -900,7 +900,7 @@
900
900
  appChannels: optional$1(array$1(v2AppChannelDecoder))
901
901
  });
902
902
  const glue42ApplicationDetailsDecoder = object$1({
903
- url: nonEmptyStringDecoder$1,
903
+ url: optional$1(nonEmptyStringDecoder$1),
904
904
  top: optional$1(number$1()),
905
905
  left: optional$1(number$1()),
906
906
  width: optional$1(nonNegativeNumberDecoder),
@@ -918,10 +918,6 @@
918
918
  intents: optional$1(array$1(intentDefinitionDecoder)),
919
919
  hidden: optional$1(boolean())
920
920
  });
921
- const hostManifestsBrowserDecoder = oneOf$1(object$1({
922
- "ioConnect": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1())),
923
- "Glue42": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1()))
924
- }), anyJson$1());
925
921
  const v1DefinitionDecoder = object$1({
926
922
  name: nonEmptyStringDecoder$1,
927
923
  appId: nonEmptyStringDecoder$1,
@@ -956,7 +952,7 @@
956
952
  moreInfo: optional$1(nonEmptyStringDecoder$1),
957
953
  publisher: optional$1(nonEmptyStringDecoder$1),
958
954
  customConfig: optional$1(array$1(anyJson$1())),
959
- hostManifests: optional$1(hostManifestsBrowserDecoder),
955
+ hostManifests: optional$1(anyJson$1()),
960
956
  interop: optional$1(v2InteropDecoder)
961
957
  });
962
958
  const v2DefinitionDecoder = object$1({
@@ -977,7 +973,7 @@
977
973
  moreInfo: optional$1(nonEmptyStringDecoder$1),
978
974
  publisher: optional$1(nonEmptyStringDecoder$1),
979
975
  customConfig: optional$1(array$1(anyJson$1())),
980
- hostManifests: optional$1(hostManifestsBrowserDecoder),
976
+ hostManifests: optional$1(anyJson$1()),
981
977
  interop: optional$1(v2InteropDecoder),
982
978
  localizedVersions: optional$1(dict(v2LocalizedDefinitionDecoder))
983
979
  });
@@ -2313,6 +2309,14 @@
2313
2309
  async checkIsFdc3DataWrappingSupported() {
2314
2310
  const globalBrowserNamespace = window.glue42core || window.iobrowser;
2315
2311
  const methodName = globalBrowserNamespace ? BrowserClientControlMethodName : DesktopClientControlMethodName;
2312
+ const myServer = this.glue.interop.servers().find((server) => server.instance === this.glue.interop.instance.instance);
2313
+ if (!myServer) {
2314
+ return false;
2315
+ }
2316
+ const registersControlMethod = myServer.getMethods().some((method) => method.name === methodName);
2317
+ if (!registersControlMethod) {
2318
+ return false;
2319
+ }
2316
2320
  const data = globalBrowserNamespace ? { domain: "system", operation: "isFdc3DataWrappingSupported" } : { command: "isFdc3DataWrappingSupported" };
2317
2321
  try {
2318
2322
  const res = await this.glue.interop.invoke(methodName, data, { instance: this.interopInstance().instance });
@@ -3018,24 +3022,24 @@
3018
3022
  if (!searchedGlueIntent) {
3019
3023
  throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
3020
3024
  }
3021
- const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3022
3025
  if (!target) {
3026
+ const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3023
3027
  this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers.map(h => h.applicationName && h.instanceId)}`);
3024
3028
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
3025
3029
  }
3026
- if (typeof target === "string" || !target.instanceId) {
3027
- this.logger?.info(`[${commandId}] - target app ${target.appId} is a valid handler. Raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers}`);
3030
+ if (target?.instanceId) {
3031
+ this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3028
3032
  return this.invokeRaiseIntent(commandId, {
3029
3033
  intent,
3030
3034
  context: glueContext,
3031
- target: { app: target.appId, instance: filteredGlueIntent.handlers.find((h) => h.instanceId)?.instanceId }
3035
+ target: { instance: target.instanceId }
3032
3036
  });
3033
3037
  }
3034
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3038
+ const targetAppName = typeof target === "string" ? target : target.appId;
3035
3039
  return this.invokeRaiseIntent(commandId, {
3036
3040
  intent,
3037
3041
  context: glueContext,
3038
- target: { instance: target.instanceId }
3042
+ target: { app: targetAppName }
3039
3043
  });
3040
3044
  }
3041
3045
  async raiseIntentForContext({ commandId, context, target }) {
@@ -3044,8 +3048,9 @@
3044
3048
  const filteredHandlersMethodExist = this.glueController.doesFilterHandlersExist();
3045
3049
  const getIntentsMethodExist = this.glueController.doesGetIntentsExist();
3046
3050
  const rememberedIntentHandlerForContextType = await this.checkForRememberedIntentHandlerForContext(context.type);
3051
+ const glueContext = { type: context.type, data: { ...context } };
3047
3052
  if (rememberedIntentHandlerForContextType) {
3048
- return this.invokeRaiseIntent(commandId, { context, intent: rememberedIntentHandlerForContextType.intent });
3053
+ return this.invokeRaiseIntent(commandId, { context: glueContext, intent: rememberedIntentHandlerForContextType.intent });
3049
3054
  }
3050
3055
  if (!filteredHandlersMethodExist || !getIntentsMethodExist || target) {
3051
3056
  return this.legacyRaiseIntentForContext({ commandId, context, target });
@@ -3070,7 +3075,11 @@
3070
3075
  this.logger?.warn(`[${commandId}] - ${ResolveError.IntentDeliveryFailed} - There's no valid intent for handler ${JSON.stringify(handler)} and context type ${context.type}`);
3071
3076
  throw new Error(ResolveError.IntentDeliveryFailed);
3072
3077
  }
3073
- return this.invokeRaiseIntent(commandId, { intent: validIntent.intent, context, target: { app: handler.applicationName, instance: handler.instanceId } });
3078
+ return this.invokeRaiseIntent(commandId, {
3079
+ intent: validIntent.intent,
3080
+ context: glueContext,
3081
+ target: { app: handler.applicationName, instance: handler.instanceId }
3082
+ });
3074
3083
  }
3075
3084
  async addIntentListener({ commandId, intent, handler }) {
3076
3085
  await this.glueController.gluePromise;
@@ -3301,8 +3310,6 @@
3301
3310
  }
3302
3311
  }
3303
3312
 
3304
- var version = "2.4.0";
3305
-
3306
3313
  class ApplicationsController {
3307
3314
  glueController;
3308
3315
  appsStateStore;
@@ -3377,10 +3384,11 @@
3377
3384
  await this.glueController.gluePromise;
3378
3385
  this.logger?.info(`${commandId} - getInfo() invoked`);
3379
3386
  const appMetadata = await this.getCurrentAppMetadata();
3387
+ const { provider, providerVersion, standardVersion } = window.fdc3Info;
3380
3388
  return {
3381
- provider: "io.Connect",
3382
- providerVersion: version,
3383
- fdc3Version: "2.1",
3389
+ provider,
3390
+ providerVersion,
3391
+ fdc3Version: standardVersion,
3384
3392
  optionalFeatures: {
3385
3393
  OriginatingAppMetadata: true,
3386
3394
  UserChannelMembershipAPIs: true,
@@ -4202,10 +4210,9 @@
4202
4210
  async getOrCreateChannel({ commandId, channelId }) {
4203
4211
  await this.initDonePromise;
4204
4212
  this.logger?.info(`[${commandId}] - getOrCreateChannel() invoked for channel with id ${channelId}`);
4205
- const isUserChannel = this.isUserChannel(channelId);
4206
- if (isUserChannel) {
4207
- this.logger?.error("There's an already existing system channel with passed id. Retrieve it using fdc3.getSystemChannels() or create a new app channel with a different id");
4208
- throw new Error(ChannelError.AccessDenied);
4213
+ const userChannel = (await this.getUserChannels(commandId)).find((ch) => ch.id === channelId);
4214
+ if (userChannel) {
4215
+ return userChannel;
4209
4216
  }
4210
4217
  const isPrivateChannel = this.stateStore.getPrivateChannelById(channelId);
4211
4218
  if (isPrivateChannel) {
@@ -4689,7 +4696,14 @@
4689
4696
  return ioc.fdc3;
4690
4697
  };
4691
4698
 
4699
+ var version = "2.4.2";
4700
+
4692
4701
  let globalFdc3 = window.fdc3;
4702
+ window.fdc3Info = {
4703
+ provider: "io.Connect",
4704
+ providerVersion: version,
4705
+ standardVersion: "2.1"
4706
+ };
4693
4707
  if (typeof globalFdc3 === "undefined") {
4694
4708
  globalFdc3 = fdc3Factory();
4695
4709
  checkIfInElectron(globalFdc3);
package/dist/fdc3.es.js CHANGED
@@ -883,7 +883,7 @@ const v2InteropDecoder = object$1({
883
883
  appChannels: optional$1(array$1(v2AppChannelDecoder))
884
884
  });
885
885
  const glue42ApplicationDetailsDecoder = object$1({
886
- url: nonEmptyStringDecoder$1,
886
+ url: optional$1(nonEmptyStringDecoder$1),
887
887
  top: optional$1(number$1()),
888
888
  left: optional$1(number$1()),
889
889
  width: optional$1(nonNegativeNumberDecoder),
@@ -901,10 +901,6 @@ const glue42HostManifestsBrowserDecoder = object$1({
901
901
  intents: optional$1(array$1(intentDefinitionDecoder)),
902
902
  hidden: optional$1(boolean())
903
903
  });
904
- const hostManifestsBrowserDecoder = oneOf$1(object$1({
905
- "ioConnect": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1())),
906
- "Glue42": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1()))
907
- }), anyJson$1());
908
904
  const v1DefinitionDecoder = object$1({
909
905
  name: nonEmptyStringDecoder$1,
910
906
  appId: nonEmptyStringDecoder$1,
@@ -939,7 +935,7 @@ const v2LocalizedDefinitionDecoder = object$1({
939
935
  moreInfo: optional$1(nonEmptyStringDecoder$1),
940
936
  publisher: optional$1(nonEmptyStringDecoder$1),
941
937
  customConfig: optional$1(array$1(anyJson$1())),
942
- hostManifests: optional$1(hostManifestsBrowserDecoder),
938
+ hostManifests: optional$1(anyJson$1()),
943
939
  interop: optional$1(v2InteropDecoder)
944
940
  });
945
941
  const v2DefinitionDecoder = object$1({
@@ -960,7 +956,7 @@ const v2DefinitionDecoder = object$1({
960
956
  moreInfo: optional$1(nonEmptyStringDecoder$1),
961
957
  publisher: optional$1(nonEmptyStringDecoder$1),
962
958
  customConfig: optional$1(array$1(anyJson$1())),
963
- hostManifests: optional$1(hostManifestsBrowserDecoder),
959
+ hostManifests: optional$1(anyJson$1()),
964
960
  interop: optional$1(v2InteropDecoder),
965
961
  localizedVersions: optional$1(dict(v2LocalizedDefinitionDecoder))
966
962
  });
@@ -2296,6 +2292,14 @@ class GlueController {
2296
2292
  async checkIsFdc3DataWrappingSupported() {
2297
2293
  const globalBrowserNamespace = window.glue42core || window.iobrowser;
2298
2294
  const methodName = globalBrowserNamespace ? BrowserClientControlMethodName : DesktopClientControlMethodName;
2295
+ const myServer = this.glue.interop.servers().find((server) => server.instance === this.glue.interop.instance.instance);
2296
+ if (!myServer) {
2297
+ return false;
2298
+ }
2299
+ const registersControlMethod = myServer.getMethods().some((method) => method.name === methodName);
2300
+ if (!registersControlMethod) {
2301
+ return false;
2302
+ }
2299
2303
  const data = globalBrowserNamespace ? { domain: "system", operation: "isFdc3DataWrappingSupported" } : { command: "isFdc3DataWrappingSupported" };
2300
2304
  try {
2301
2305
  const res = await this.glue.interop.invoke(methodName, data, { instance: this.interopInstance().instance });
@@ -3001,24 +3005,24 @@ class IntentsController {
3001
3005
  if (!searchedGlueIntent) {
3002
3006
  throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
3003
3007
  }
3004
- const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3005
3008
  if (!target) {
3009
+ const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3006
3010
  this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers.map(h => h.applicationName && h.instanceId)}`);
3007
3011
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
3008
3012
  }
3009
- if (typeof target === "string" || !target.instanceId) {
3010
- this.logger?.info(`[${commandId}] - target app ${target.appId} is a valid handler. Raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers}`);
3013
+ if (target?.instanceId) {
3014
+ this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3011
3015
  return this.invokeRaiseIntent(commandId, {
3012
3016
  intent,
3013
3017
  context: glueContext,
3014
- target: { app: target.appId, instance: filteredGlueIntent.handlers.find((h) => h.instanceId)?.instanceId }
3018
+ target: { instance: target.instanceId }
3015
3019
  });
3016
3020
  }
3017
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3021
+ const targetAppName = typeof target === "string" ? target : target.appId;
3018
3022
  return this.invokeRaiseIntent(commandId, {
3019
3023
  intent,
3020
3024
  context: glueContext,
3021
- target: { instance: target.instanceId }
3025
+ target: { app: targetAppName }
3022
3026
  });
3023
3027
  }
3024
3028
  async raiseIntentForContext({ commandId, context, target }) {
@@ -3027,8 +3031,9 @@ class IntentsController {
3027
3031
  const filteredHandlersMethodExist = this.glueController.doesFilterHandlersExist();
3028
3032
  const getIntentsMethodExist = this.glueController.doesGetIntentsExist();
3029
3033
  const rememberedIntentHandlerForContextType = await this.checkForRememberedIntentHandlerForContext(context.type);
3034
+ const glueContext = { type: context.type, data: { ...context } };
3030
3035
  if (rememberedIntentHandlerForContextType) {
3031
- return this.invokeRaiseIntent(commandId, { context, intent: rememberedIntentHandlerForContextType.intent });
3036
+ return this.invokeRaiseIntent(commandId, { context: glueContext, intent: rememberedIntentHandlerForContextType.intent });
3032
3037
  }
3033
3038
  if (!filteredHandlersMethodExist || !getIntentsMethodExist || target) {
3034
3039
  return this.legacyRaiseIntentForContext({ commandId, context, target });
@@ -3053,7 +3058,11 @@ class IntentsController {
3053
3058
  this.logger?.warn(`[${commandId}] - ${ResolveError.IntentDeliveryFailed} - There's no valid intent for handler ${JSON.stringify(handler)} and context type ${context.type}`);
3054
3059
  throw new Error(ResolveError.IntentDeliveryFailed);
3055
3060
  }
3056
- return this.invokeRaiseIntent(commandId, { intent: validIntent.intent, context, target: { app: handler.applicationName, instance: handler.instanceId } });
3061
+ return this.invokeRaiseIntent(commandId, {
3062
+ intent: validIntent.intent,
3063
+ context: glueContext,
3064
+ target: { app: handler.applicationName, instance: handler.instanceId }
3065
+ });
3057
3066
  }
3058
3067
  async addIntentListener({ commandId, intent, handler }) {
3059
3068
  await this.glueController.gluePromise;
@@ -3284,8 +3293,6 @@ class IntentsController {
3284
3293
  }
3285
3294
  }
3286
3295
 
3287
- var version = "2.4.0";
3288
-
3289
3296
  class ApplicationsController {
3290
3297
  glueController;
3291
3298
  appsStateStore;
@@ -3360,10 +3367,11 @@ class ApplicationsController {
3360
3367
  await this.glueController.gluePromise;
3361
3368
  this.logger?.info(`${commandId} - getInfo() invoked`);
3362
3369
  const appMetadata = await this.getCurrentAppMetadata();
3370
+ const { provider, providerVersion, standardVersion } = window.fdc3Info;
3363
3371
  return {
3364
- provider: "io.Connect",
3365
- providerVersion: version,
3366
- fdc3Version: "2.1",
3372
+ provider,
3373
+ providerVersion,
3374
+ fdc3Version: standardVersion,
3367
3375
  optionalFeatures: {
3368
3376
  OriginatingAppMetadata: true,
3369
3377
  UserChannelMembershipAPIs: true,
@@ -4185,10 +4193,9 @@ class ChannelsBaseController {
4185
4193
  async getOrCreateChannel({ commandId, channelId }) {
4186
4194
  await this.initDonePromise;
4187
4195
  this.logger?.info(`[${commandId}] - getOrCreateChannel() invoked for channel with id ${channelId}`);
4188
- const isUserChannel = this.isUserChannel(channelId);
4189
- if (isUserChannel) {
4190
- this.logger?.error("There's an already existing system channel with passed id. Retrieve it using fdc3.getSystemChannels() or create a new app channel with a different id");
4191
- throw new Error(ChannelError.AccessDenied);
4196
+ const userChannel = (await this.getUserChannels(commandId)).find((ch) => ch.id === channelId);
4197
+ if (userChannel) {
4198
+ return userChannel;
4192
4199
  }
4193
4200
  const isPrivateChannel = this.stateStore.getPrivateChannelById(channelId);
4194
4201
  if (isPrivateChannel) {
@@ -4672,7 +4679,14 @@ const fdc3Factory = () => {
4672
4679
  return ioc.fdc3;
4673
4680
  };
4674
4681
 
4682
+ var version = "2.4.2";
4683
+
4675
4684
  let globalFdc3 = window.fdc3;
4685
+ window.fdc3Info = {
4686
+ provider: "io.Connect",
4687
+ providerVersion: version,
4688
+ standardVersion: "2.1"
4689
+ };
4676
4690
  if (typeof globalFdc3 === "undefined") {
4677
4691
  globalFdc3 = fdc3Factory();
4678
4692
  window.fdc3 = globalFdc3;
package/dist/fdc3.umd.js CHANGED
@@ -889,7 +889,7 @@
889
889
  appChannels: optional$1(array$1(v2AppChannelDecoder))
890
890
  });
891
891
  const glue42ApplicationDetailsDecoder = object$1({
892
- url: nonEmptyStringDecoder$1,
892
+ url: optional$1(nonEmptyStringDecoder$1),
893
893
  top: optional$1(number$1()),
894
894
  left: optional$1(number$1()),
895
895
  width: optional$1(nonNegativeNumberDecoder),
@@ -907,10 +907,6 @@
907
907
  intents: optional$1(array$1(intentDefinitionDecoder)),
908
908
  hidden: optional$1(boolean())
909
909
  });
910
- const hostManifestsBrowserDecoder = oneOf$1(object$1({
911
- "ioConnect": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1())),
912
- "Glue42": optional$1(oneOf$1(glue42HostManifestsBrowserDecoder, anyJson$1()))
913
- }), anyJson$1());
914
910
  const v1DefinitionDecoder = object$1({
915
911
  name: nonEmptyStringDecoder$1,
916
912
  appId: nonEmptyStringDecoder$1,
@@ -945,7 +941,7 @@
945
941
  moreInfo: optional$1(nonEmptyStringDecoder$1),
946
942
  publisher: optional$1(nonEmptyStringDecoder$1),
947
943
  customConfig: optional$1(array$1(anyJson$1())),
948
- hostManifests: optional$1(hostManifestsBrowserDecoder),
944
+ hostManifests: optional$1(anyJson$1()),
949
945
  interop: optional$1(v2InteropDecoder)
950
946
  });
951
947
  const v2DefinitionDecoder = object$1({
@@ -966,7 +962,7 @@
966
962
  moreInfo: optional$1(nonEmptyStringDecoder$1),
967
963
  publisher: optional$1(nonEmptyStringDecoder$1),
968
964
  customConfig: optional$1(array$1(anyJson$1())),
969
- hostManifests: optional$1(hostManifestsBrowserDecoder),
965
+ hostManifests: optional$1(anyJson$1()),
970
966
  interop: optional$1(v2InteropDecoder),
971
967
  localizedVersions: optional$1(dict(v2LocalizedDefinitionDecoder))
972
968
  });
@@ -2302,6 +2298,14 @@
2302
2298
  async checkIsFdc3DataWrappingSupported() {
2303
2299
  const globalBrowserNamespace = window.glue42core || window.iobrowser;
2304
2300
  const methodName = globalBrowserNamespace ? BrowserClientControlMethodName : DesktopClientControlMethodName;
2301
+ const myServer = this.glue.interop.servers().find((server) => server.instance === this.glue.interop.instance.instance);
2302
+ if (!myServer) {
2303
+ return false;
2304
+ }
2305
+ const registersControlMethod = myServer.getMethods().some((method) => method.name === methodName);
2306
+ if (!registersControlMethod) {
2307
+ return false;
2308
+ }
2305
2309
  const data = globalBrowserNamespace ? { domain: "system", operation: "isFdc3DataWrappingSupported" } : { command: "isFdc3DataWrappingSupported" };
2306
2310
  try {
2307
2311
  const res = await this.glue.interop.invoke(methodName, data, { instance: this.interopInstance().instance });
@@ -3007,24 +3011,24 @@
3007
3011
  if (!searchedGlueIntent) {
3008
3012
  throw { message: ResolveError.NoAppsFound, reason: `There's no app registering an intent '${intent}'` };
3009
3013
  }
3010
- const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3011
3014
  if (!target) {
3015
+ const filteredGlueIntent = this.filterGlueIntentHandlers({ commandId, intent: searchedGlueIntent, context, target });
3012
3016
  this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers.map(h => h.applicationName && h.instanceId)}`);
3013
3017
  return this.invokeRaiseIntent(commandId, { intent, context: glueContext, handlers: filteredGlueIntent.handlers });
3014
3018
  }
3015
- if (typeof target === "string" || !target.instanceId) {
3016
- this.logger?.info(`[${commandId}] - target app ${target.appId} is a valid handler. Raising intent ${intent} with contextType ${context.type} and handlers ${filteredGlueIntent.handlers}`);
3019
+ if (target?.instanceId) {
3020
+ this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3017
3021
  return this.invokeRaiseIntent(commandId, {
3018
3022
  intent,
3019
3023
  context: glueContext,
3020
- target: { app: target.appId, instance: filteredGlueIntent.handlers.find((h) => h.instanceId)?.instanceId }
3024
+ target: { instance: target.instanceId }
3021
3025
  });
3022
3026
  }
3023
- this.logger?.info(`[${commandId}] - raising intent ${intent} with contextType ${context.type} to target instance of app ${target.appId} and id ${target.instanceId}`);
3027
+ const targetAppName = typeof target === "string" ? target : target.appId;
3024
3028
  return this.invokeRaiseIntent(commandId, {
3025
3029
  intent,
3026
3030
  context: glueContext,
3027
- target: { instance: target.instanceId }
3031
+ target: { app: targetAppName }
3028
3032
  });
3029
3033
  }
3030
3034
  async raiseIntentForContext({ commandId, context, target }) {
@@ -3033,8 +3037,9 @@
3033
3037
  const filteredHandlersMethodExist = this.glueController.doesFilterHandlersExist();
3034
3038
  const getIntentsMethodExist = this.glueController.doesGetIntentsExist();
3035
3039
  const rememberedIntentHandlerForContextType = await this.checkForRememberedIntentHandlerForContext(context.type);
3040
+ const glueContext = { type: context.type, data: { ...context } };
3036
3041
  if (rememberedIntentHandlerForContextType) {
3037
- return this.invokeRaiseIntent(commandId, { context, intent: rememberedIntentHandlerForContextType.intent });
3042
+ return this.invokeRaiseIntent(commandId, { context: glueContext, intent: rememberedIntentHandlerForContextType.intent });
3038
3043
  }
3039
3044
  if (!filteredHandlersMethodExist || !getIntentsMethodExist || target) {
3040
3045
  return this.legacyRaiseIntentForContext({ commandId, context, target });
@@ -3059,7 +3064,11 @@
3059
3064
  this.logger?.warn(`[${commandId}] - ${ResolveError.IntentDeliveryFailed} - There's no valid intent for handler ${JSON.stringify(handler)} and context type ${context.type}`);
3060
3065
  throw new Error(ResolveError.IntentDeliveryFailed);
3061
3066
  }
3062
- return this.invokeRaiseIntent(commandId, { intent: validIntent.intent, context, target: { app: handler.applicationName, instance: handler.instanceId } });
3067
+ return this.invokeRaiseIntent(commandId, {
3068
+ intent: validIntent.intent,
3069
+ context: glueContext,
3070
+ target: { app: handler.applicationName, instance: handler.instanceId }
3071
+ });
3063
3072
  }
3064
3073
  async addIntentListener({ commandId, intent, handler }) {
3065
3074
  await this.glueController.gluePromise;
@@ -3290,8 +3299,6 @@
3290
3299
  }
3291
3300
  }
3292
3301
 
3293
- var version = "2.4.0";
3294
-
3295
3302
  class ApplicationsController {
3296
3303
  glueController;
3297
3304
  appsStateStore;
@@ -3366,10 +3373,11 @@
3366
3373
  await this.glueController.gluePromise;
3367
3374
  this.logger?.info(`${commandId} - getInfo() invoked`);
3368
3375
  const appMetadata = await this.getCurrentAppMetadata();
3376
+ const { provider, providerVersion, standardVersion } = window.fdc3Info;
3369
3377
  return {
3370
- provider: "io.Connect",
3371
- providerVersion: version,
3372
- fdc3Version: "2.1",
3378
+ provider,
3379
+ providerVersion,
3380
+ fdc3Version: standardVersion,
3373
3381
  optionalFeatures: {
3374
3382
  OriginatingAppMetadata: true,
3375
3383
  UserChannelMembershipAPIs: true,
@@ -4191,10 +4199,9 @@
4191
4199
  async getOrCreateChannel({ commandId, channelId }) {
4192
4200
  await this.initDonePromise;
4193
4201
  this.logger?.info(`[${commandId}] - getOrCreateChannel() invoked for channel with id ${channelId}`);
4194
- const isUserChannel = this.isUserChannel(channelId);
4195
- if (isUserChannel) {
4196
- this.logger?.error("There's an already existing system channel with passed id. Retrieve it using fdc3.getSystemChannels() or create a new app channel with a different id");
4197
- throw new Error(ChannelError.AccessDenied);
4202
+ const userChannel = (await this.getUserChannels(commandId)).find((ch) => ch.id === channelId);
4203
+ if (userChannel) {
4204
+ return userChannel;
4198
4205
  }
4199
4206
  const isPrivateChannel = this.stateStore.getPrivateChannelById(channelId);
4200
4207
  if (isPrivateChannel) {
@@ -4678,7 +4685,14 @@
4678
4685
  return ioc.fdc3;
4679
4686
  };
4680
4687
 
4688
+ var version = "2.4.2";
4689
+
4681
4690
  let globalFdc3 = window.fdc3;
4691
+ window.fdc3Info = {
4692
+ provider: "io.Connect",
4693
+ providerVersion: version,
4694
+ standardVersion: "2.1"
4695
+ };
4682
4696
  if (typeof globalFdc3 === "undefined") {
4683
4697
  globalFdc3 = fdc3Factory();
4684
4698
  window.fdc3 = globalFdc3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interopio/fdc3",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "IO Connect implementation of the FDC3 standard",
5
5
  "main": "dist/fdc3.umd.js",
6
6
  "module": "dist/fdc3.es.js",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "license": "MIT",
34
34
  "devDependencies": {
35
- "@interopio/utils": "^1.4.0"
35
+ "@interopio/utils": "^1.4.1"
36
36
  },
37
37
  "dependencies": {
38
38
  "@finos/fdc3": "2.1.0"
@@ -41,5 +41,5 @@
41
41
  "@interopio:registry": "https://registry.npmjs.org",
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "6ee88fcb1b67936de846ba07537d66df4ff5735e"
44
+ "gitHead": "b190408346eec7b2eae403cee6ea92e8d71599e9"
45
45
  }