@boomi/embedkit-sdk 1.2.2 → 1.2.4

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/dist/index.cjs CHANGED
@@ -4787,20 +4787,29 @@ async function fetchEnvironmentExtensions(httpRequest, requestBody) {
4787
4787
  }
4788
4788
 
4789
4789
  // lib/helpers/fetchExtensionsForPair.ts
4790
- async function fetchExtensionsForPair(httpRequest, processId, envId) {
4791
- const extensionFilter = nestedQueryFilter(
4792
- [
4793
- { property: "environmentId", operator: "EQUALS", value: envId },
4794
- { property: "extensionGroupId", operator: "EQUALS", value: processId }
4795
- ],
4796
- "and"
4797
- );
4790
+ async function fetchExtensionsForPair(httpRequest, processId, envId, isSingleInstall) {
4791
+ let extensionFilter;
4792
+ if (isSingleInstall) {
4793
+ const aFilter = queryFilter(
4794
+ "environmentId",
4795
+ "EQUALS",
4796
+ [envId]
4797
+ );
4798
+ } else {
4799
+ extensionFilter = nestedQueryFilter(
4800
+ [
4801
+ { property: "environmentId", operator: "EQUALS", value: envId },
4802
+ { property: "extensionGroupId", operator: "EQUALS", value: processId }
4803
+ ],
4804
+ "and"
4805
+ );
4806
+ }
4798
4807
  const extResponse = await fetchEnvironmentExtensions(httpRequest, extensionFilter);
4799
4808
  return extResponse?.result || [];
4800
4809
  }
4801
4810
 
4802
4811
  // lib/helpers/fetchExtensions.ts
4803
- async function fetchExtensions(httpRequest, integrationPackInstanceId, environmentId, environments) {
4812
+ async function fetchExtensions(httpRequest, integrationPackInstanceId, environmentId, environments, isSingleInstall) {
4804
4813
  const resp = await fetchProcesses(httpRequest, integrationPackInstanceId);
4805
4814
  if (!resp?.result) {
4806
4815
  throw new Error(
@@ -4809,7 +4818,7 @@ async function fetchExtensions(httpRequest, integrationPackInstanceId, environme
4809
4818
  }
4810
4819
  const processes = resp.result;
4811
4820
  const allExtensions = [];
4812
- const targetEnvs = resolveTargetEnvironments(environments, environmentId);
4821
+ const targetEnvs = environments || [];
4813
4822
  for (const process of processes) {
4814
4823
  if (!process.id) {
4815
4824
  throw new Error(
@@ -4817,21 +4826,17 @@ async function fetchExtensions(httpRequest, integrationPackInstanceId, environme
4817
4826
  );
4818
4827
  }
4819
4828
  if (!targetEnvs?.length) {
4820
- const exts = await fetchExtensionsForPair(httpRequest, process.id, environmentId);
4829
+ const exts = await fetchExtensionsForPair(httpRequest, process.id, environmentId, isSingleInstall);
4821
4830
  allExtensions.push(...exts);
4822
4831
  } else {
4823
4832
  for (const env of targetEnvs) {
4824
- const envId = env.id || "";
4825
- const exts = await fetchExtensionsForPair(httpRequest, process.id, envId);
4833
+ const exts = await fetchExtensionsForPair(httpRequest, process.id, env, isSingleInstall);
4826
4834
  allExtensions.push(...exts);
4827
4835
  }
4828
4836
  }
4829
4837
  }
4830
4838
  return allExtensions;
4831
4839
  }
4832
- function resolveTargetEnvironments(environments, environmentId) {
4833
- return environmentId ? [{ id: environmentId }] : environments;
4834
- }
4835
4840
 
4836
4841
  // lib/helpers/combineEnvironmentExtensions.ts
4837
4842
  function combineEnvironmentExtensions(exts) {
@@ -5329,7 +5334,7 @@ var EnvironmentExtensionsService = class {
5329
5334
  * @throws ApiError
5330
5335
  */
5331
5336
  async fetchEnvironmentExtensions(params) {
5332
- const { integrationPackInstanceId, environmentId, environmentIds } = params;
5337
+ const { integrationPackInstanceId, environmentId, environmentIds, isSingleInstall } = params;
5333
5338
  if (!integrationPackInstanceId) {
5334
5339
  throw Object.assign(new Error("integrationPackInstanceId is required"), { status: 400 });
5335
5340
  }
@@ -5342,7 +5347,13 @@ var EnvironmentExtensionsService = class {
5342
5347
  }
5343
5348
  const chunks = [];
5344
5349
  for (const envId of targets) {
5345
- const list = await fetchExtensions(this.httpRequest, integrationPackInstanceId, envId);
5350
+ const list = await fetchExtensions(
5351
+ this.httpRequest,
5352
+ integrationPackInstanceId,
5353
+ envId,
5354
+ environmentIds || [],
5355
+ isSingleInstall
5356
+ );
5346
5357
  chunks.push(list ?? []);
5347
5358
  }
5348
5359
  const items = [].concat(...chunks);