@wix/cli-app 1.1.246 → 1.1.248

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.
Files changed (73) hide show
  1. package/build/{AddPermissionCommand-347LFAL3.js → AddPermissionCommand-TLDPXP4D.js} +2 -2
  2. package/build/{DevCommand-EISXSSTW.js → DevCommand-IRSZVWRL.js} +10 -10
  3. package/build/{GenerateCommand-VILDH5NQ.js → GenerateCommand-SC7ZL5SO.js} +7 -7
  4. package/build/{LogsCommand-CRFRO55W.js → LogsCommand-3ONV75BA.js} +3 -3
  5. package/build/PreviewCommand-4FKLXEWE.js +19 -0
  6. package/build/ReleaseCommand-4HJRK7AV.js +23 -0
  7. package/build/{ServeCommand-DXFGEJ3K.js → ServeCommand-H6TH7CRK.js} +3 -3
  8. package/build/{build-YQZQ7SMU.js → build-OJNU7ICY.js} +6 -6
  9. package/build/{chunk-YHGHDWK5.js → chunk-4GXQXEW4.js} +2 -2
  10. package/build/{chunk-YCGOB4QU.js → chunk-7E5V7HHX.js} +3 -3
  11. package/build/{chunk-AAANSDKD.js → chunk-AVYULRPM.js} +3 -3
  12. package/build/{chunk-XQBYQJPN.js → chunk-AWP3CDXI.js} +6 -6
  13. package/build/{chunk-YLNNZOHS.js → chunk-CLLZZDW7.js} +3 -3
  14. package/build/{chunk-KI24RBW7.js → chunk-EMV4XQIK.js} +2 -2
  15. package/build/{chunk-4GFT3TZH.js → chunk-ITICXCXZ.js} +2 -2
  16. package/build/{chunk-CV2YH6WC.js → chunk-IZSFWB5B.js} +2 -2
  17. package/build/{chunk-AOBQCPZV.js → chunk-JFVQ7UL6.js} +2 -2
  18. package/build/{chunk-SOW5IOMO.js → chunk-KRH3PPZ4.js} +6 -6
  19. package/build/{chunk-3NYPWXF3.js → chunk-PUROMSKB.js} +7 -7
  20. package/build/{chunk-IZYUQZ6Q.js → chunk-U3QFJ7TY.js} +2 -2
  21. package/build/{chunk-7NUDUC7M.js → chunk-WMMOJP4L.js} +2 -2
  22. package/build/{chunk-7NUDUC7M.js.map → chunk-WMMOJP4L.js.map} +1 -1
  23. package/build/{chunk-S5FDRMOH.js → chunk-XDRFTXAJ.js} +3 -3
  24. package/build/{chunk-XCC3NDMG.js → chunk-ZHILMSEM.js} +2 -2
  25. package/build/{chunk-J5CH6TCN.js → chunk-ZNNCORQX.js} +2 -2
  26. package/build/cloudflare-runtime/entry.js +6 -6
  27. package/build/cloudflare-runtime/getRegisteredExtensions.js +6 -6
  28. package/build/index.js +22 -22
  29. package/build/platform-sdk/chunk-76CE5VVR.js +2 -0
  30. package/build/platform-sdk/chunk-76CE5VVR.js.map +1 -0
  31. package/build/platform-sdk/chunk-NQK6RWZM.js +2 -0
  32. package/build/platform-sdk/chunk-NQK6RWZM.js.map +1 -0
  33. package/build/platform-sdk/dashboard.js +1 -1
  34. package/build/platform-sdk/editor.js +1 -1
  35. package/build/platform-sdk/sdk-context.js +1 -1
  36. package/build/platform-sdk/site.js +1 -1
  37. package/build/platform-sdk/site.js.map +1 -1
  38. package/build/{preview-VCGACSPZ.js → preview-NGDPBUSE.js} +11 -11
  39. package/build/{release-DWXEQVTD.js → release-LGTZQILP.js} +13 -13
  40. package/build/{render-command-7DSOTQB4.js → render-command-HI7PBF4O.js} +4 -4
  41. package/package.json +2 -2
  42. package/build/PreviewCommand-NNCTBO3Q.js +0 -19
  43. package/build/ReleaseCommand-BRNBSJGY.js +0 -23
  44. package/build/platform-sdk/chunk-S46ZF4YM.js +0 -2
  45. package/build/platform-sdk/chunk-S46ZF4YM.js.map +0 -1
  46. package/build/platform-sdk/chunk-TONDB6MX.js +0 -2
  47. package/build/platform-sdk/chunk-TONDB6MX.js.map +0 -1
  48. /package/build/{AddPermissionCommand-347LFAL3.js.map → AddPermissionCommand-TLDPXP4D.js.map} +0 -0
  49. /package/build/{DevCommand-EISXSSTW.js.map → DevCommand-IRSZVWRL.js.map} +0 -0
  50. /package/build/{GenerateCommand-VILDH5NQ.js.map → GenerateCommand-SC7ZL5SO.js.map} +0 -0
  51. /package/build/{LogsCommand-CRFRO55W.js.map → LogsCommand-3ONV75BA.js.map} +0 -0
  52. /package/build/{PreviewCommand-NNCTBO3Q.js.map → PreviewCommand-4FKLXEWE.js.map} +0 -0
  53. /package/build/{ReleaseCommand-BRNBSJGY.js.map → ReleaseCommand-4HJRK7AV.js.map} +0 -0
  54. /package/build/{ServeCommand-DXFGEJ3K.js.map → ServeCommand-H6TH7CRK.js.map} +0 -0
  55. /package/build/{build-YQZQ7SMU.js.map → build-OJNU7ICY.js.map} +0 -0
  56. /package/build/{chunk-YHGHDWK5.js.map → chunk-4GXQXEW4.js.map} +0 -0
  57. /package/build/{chunk-YCGOB4QU.js.map → chunk-7E5V7HHX.js.map} +0 -0
  58. /package/build/{chunk-AAANSDKD.js.map → chunk-AVYULRPM.js.map} +0 -0
  59. /package/build/{chunk-XQBYQJPN.js.map → chunk-AWP3CDXI.js.map} +0 -0
  60. /package/build/{chunk-YLNNZOHS.js.map → chunk-CLLZZDW7.js.map} +0 -0
  61. /package/build/{chunk-KI24RBW7.js.map → chunk-EMV4XQIK.js.map} +0 -0
  62. /package/build/{chunk-4GFT3TZH.js.map → chunk-ITICXCXZ.js.map} +0 -0
  63. /package/build/{chunk-CV2YH6WC.js.map → chunk-IZSFWB5B.js.map} +0 -0
  64. /package/build/{chunk-AOBQCPZV.js.map → chunk-JFVQ7UL6.js.map} +0 -0
  65. /package/build/{chunk-SOW5IOMO.js.map → chunk-KRH3PPZ4.js.map} +0 -0
  66. /package/build/{chunk-3NYPWXF3.js.map → chunk-PUROMSKB.js.map} +0 -0
  67. /package/build/{chunk-IZYUQZ6Q.js.map → chunk-U3QFJ7TY.js.map} +0 -0
  68. /package/build/{chunk-S5FDRMOH.js.map → chunk-XDRFTXAJ.js.map} +0 -0
  69. /package/build/{chunk-XCC3NDMG.js.map → chunk-ZHILMSEM.js.map} +0 -0
  70. /package/build/{chunk-J5CH6TCN.js.map → chunk-ZNNCORQX.js.map} +0 -0
  71. /package/build/{preview-VCGACSPZ.js.map → preview-NGDPBUSE.js.map} +0 -0
  72. /package/build/{release-DWXEQVTD.js.map → release-LGTZQILP.js.map} +0 -0
  73. /package/build/{render-command-7DSOTQB4.js.map → render-command-HI7PBF4O.js.map} +0 -0
@@ -3,7 +3,7 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  getBackendEventSlug,
5
5
  require_baseUniq
6
- } from "./chunk-XCC3NDMG.js";
6
+ } from "./chunk-ZHILMSEM.js";
7
7
  import {
8
8
  API_BASEURL_PLACEHOLDER,
9
9
  AlgorithmType,
@@ -93,7 +93,7 @@ import {
93
93
  virtualSiteComponentPreviewScriptAssets,
94
94
  virtualSiteComponentScriptAssets,
95
95
  virtualSiteComponentSdkScriptAssets
96
- } from "./chunk-7NUDUC7M.js";
96
+ } from "./chunk-WMMOJP4L.js";
97
97
  import {
98
98
  __commonJS,
99
99
  __esm,
@@ -42830,4 +42830,4 @@ export {
42830
42830
  he/he.js:
42831
42831
  (*! https://mths.be/he v1.2.0 by @mathias | MIT license *)
42832
42832
  */
42833
- //# sourceMappingURL=chunk-S5FDRMOH.js.map
42833
+ //# sourceMappingURL=chunk-XDRFTXAJ.js.map
@@ -15,7 +15,7 @@ import {
15
15
  toURLSearchParams,
16
16
  useHttpClient,
17
17
  usePanoramaMethodLogger
18
- } from "./chunk-7NUDUC7M.js";
18
+ } from "./chunk-WMMOJP4L.js";
19
19
  import {
20
20
  __commonJS,
21
21
  __toESM,
@@ -4806,4 +4806,4 @@ export {
4806
4806
  getBackendEventSlug,
4807
4807
  useExtensionDataClient
4808
4808
  };
4809
- //# sourceMappingURL=chunk-XCC3NDMG.js.map
4809
+ //# sourceMappingURL=chunk-ZHILMSEM.js.map
@@ -4,7 +4,7 @@ import {
4
4
  extractHttpError,
5
5
  require_react,
6
6
  require_verror
7
- } from "./chunk-7NUDUC7M.js";
7
+ } from "./chunk-WMMOJP4L.js";
8
8
  import {
9
9
  __toESM,
10
10
  init_esm_shims
@@ -87,4 +87,4 @@ export {
87
87
  DebugLogProvider,
88
88
  useDebugLog
89
89
  };
90
- //# sourceMappingURL=chunk-J5CH6TCN.js.map
90
+ //# sourceMappingURL=chunk-ZNNCORQX.js.map
@@ -4604,7 +4604,7 @@ function objectToKeyValue(input) {
4604
4604
  return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
4605
4605
  }
4606
4606
 
4607
- // ../../node_modules/@wix/sdk-runtime/build/context.js
4607
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
4608
4608
  function runWithoutContext(fn) {
4609
4609
  const globalContext = globalThis.__wix_context__;
4610
4610
  const moduleContext = {
@@ -4636,14 +4636,14 @@ function runWithoutContext(fn) {
4636
4636
  }
4637
4637
  }
4638
4638
 
4639
- // ../../node_modules/@wix/sdk-runtime/build/constants.js
4639
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/constants.js
4640
4640
  var RESTResponseToSDKResponseRenameMap = {
4641
4641
  id: "_id",
4642
4642
  createdDate: "_createdDate",
4643
4643
  updatedDate: "_updatedDate"
4644
4644
  };
4645
4645
 
4646
- // ../../node_modules/@wix/sdk-runtime/build/utils.js
4646
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/utils.js
4647
4647
  function constantCase(input) {
4648
4648
  return split(input).map((part) => part.toLocaleUpperCase()).join("_");
4649
4649
  }
@@ -4669,7 +4669,7 @@ function split(value) {
4669
4669
  return result.slice(start, end).split(/\0/g);
4670
4670
  }
4671
4671
 
4672
- // ../../node_modules/@wix/sdk-runtime/build/transform-error.js
4672
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/transform-error.js
4673
4673
  var isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
4674
4674
  var isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
4675
4675
  var isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
@@ -4930,7 +4930,7 @@ var errorBuilder2 = (code, description, details, data) => {
4930
4930
  });
4931
4931
  };
4932
4932
 
4933
- // ../../node_modules/@wix/sdk-runtime/build/rest-modules.js
4933
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js
4934
4934
  var DOMAINS = ["wix.com", "editorx.com"];
4935
4935
  var REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
4936
4936
  var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
@@ -5163,7 +5163,7 @@ function camelCase(str) {
5163
5163
  return str.replace(/[-_\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").replace(/^./, (c) => c.toLowerCase());
5164
5164
  }
5165
5165
 
5166
- // ../../node_modules/@wix/sdk-runtime/build/nanoevents.js
5166
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/nanoevents.js
5167
5167
  function createNanoEvents() {
5168
5168
  return {
5169
5169
  emit(event, ...args) {
@@ -4447,7 +4447,7 @@ function objectToKeyValue(input) {
4447
4447
  return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
4448
4448
  }
4449
4449
 
4450
- // ../../node_modules/@wix/sdk-runtime/build/context.js
4450
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
4451
4451
  function runWithoutContext(fn) {
4452
4452
  const globalContext = globalThis.__wix_context__;
4453
4453
  const moduleContext = {
@@ -4479,14 +4479,14 @@ function runWithoutContext(fn) {
4479
4479
  }
4480
4480
  }
4481
4481
 
4482
- // ../../node_modules/@wix/sdk-runtime/build/constants.js
4482
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/constants.js
4483
4483
  var RESTResponseToSDKResponseRenameMap = {
4484
4484
  id: "_id",
4485
4485
  createdDate: "_createdDate",
4486
4486
  updatedDate: "_updatedDate"
4487
4487
  };
4488
4488
 
4489
- // ../../node_modules/@wix/sdk-runtime/build/utils.js
4489
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/utils.js
4490
4490
  function constantCase(input) {
4491
4491
  return split(input).map((part) => part.toLocaleUpperCase()).join("_");
4492
4492
  }
@@ -4512,7 +4512,7 @@ function split(value) {
4512
4512
  return result.slice(start, end).split(/\0/g);
4513
4513
  }
4514
4514
 
4515
- // ../../node_modules/@wix/sdk-runtime/build/transform-error.js
4515
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/transform-error.js
4516
4516
  var isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
4517
4517
  var isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
4518
4518
  var isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
@@ -4773,7 +4773,7 @@ var errorBuilder2 = (code, description, details, data) => {
4773
4773
  });
4774
4774
  };
4775
4775
 
4776
- // ../../node_modules/@wix/sdk-runtime/build/rest-modules.js
4776
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js
4777
4777
  var DOMAINS = ["wix.com", "editorx.com"];
4778
4778
  var REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
4779
4779
  var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
@@ -5006,7 +5006,7 @@ function camelCase(str) {
5006
5006
  return str.replace(/[-_\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").replace(/^./, (c) => c.toLowerCase());
5007
5007
  }
5008
5008
 
5009
- // ../../node_modules/@wix/sdk-runtime/build/nanoevents.js
5009
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/nanoevents.js
5010
5010
  function createNanoEvents() {
5011
5011
  return {
5012
5012
  emit(event, ...args) {
package/build/index.js CHANGED
@@ -3,17 +3,17 @@ const require = _createRequire(import.meta.url);
3
3
  import {
4
4
  createI18nT,
5
5
  docsExtensionTypeSchema
6
- } from "./chunk-YHGHDWK5.js";
6
+ } from "./chunk-4GXQXEW4.js";
7
7
  import {
8
8
  runCommand
9
- } from "./chunk-YCGOB4QU.js";
9
+ } from "./chunk-7E5V7HHX.js";
10
10
  import "./chunk-QBRIDBYB.js";
11
- import "./chunk-J5CH6TCN.js";
11
+ import "./chunk-ZNNCORQX.js";
12
12
  import {
13
13
  external_exports,
14
14
  package_default,
15
15
  require_react
16
- } from "./chunk-7NUDUC7M.js";
16
+ } from "./chunk-WMMOJP4L.js";
17
17
  import {
18
18
  __commonJS,
19
19
  __require,
@@ -3376,8 +3376,8 @@ var {
3376
3376
  // src/commands/build.ts
3377
3377
  init_esm_shims();
3378
3378
  var buildCommand = (services) => createCommand("build").action(async (_, command) => {
3379
- const { runCommand: runCommand2 } = await import("./render-command-7DSOTQB4.js");
3380
- const { build } = await import("./build-YQZQ7SMU.js");
3379
+ const { runCommand: runCommand2 } = await import("./render-command-HI7PBF4O.js");
3380
+ const { build } = await import("./build-OJNU7ICY.js");
3381
3381
  await runCommand2(command, services, build);
3382
3382
  });
3383
3383
 
@@ -3442,8 +3442,8 @@ var devCommand = (services) => {
3442
3442
  return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).option("--port <port>", t("dev_command_def.option.port"), validatePort).addOption(
3443
3443
  new Option("--origin <url>", t("dev_command_def.option.origin")).argParser(validateBase).hideHelp()
3444
3444
  ).action(async (options, command) => {
3445
- const { DevCommand } = await import("./DevCommand-EISXSSTW.js");
3446
- const { renderCommand } = await import("./render-command-7DSOTQB4.js");
3445
+ const { DevCommand } = await import("./DevCommand-IRSZVWRL.js");
3446
+ const { renderCommand } = await import("./render-command-HI7PBF4O.js");
3447
3447
  const { https = false, origin, port } = options;
3448
3448
  await renderCommand(
3449
3449
  command,
@@ -3482,17 +3482,17 @@ var previewCommand = (services) => {
3482
3482
  ).hideHelp()
3483
3483
  ).action(async (options, command) => {
3484
3484
  const { site, baseUrl, json } = options;
3485
- const { renderCommand, runCommand: runCommand2 } = await import("./render-command-7DSOTQB4.js");
3485
+ const { renderCommand, runCommand: runCommand2 } = await import("./render-command-HI7PBF4O.js");
3486
3486
  if (json) {
3487
3487
  return runCommand2(command, services, async (model) => {
3488
- const { nonInteractivePreview } = await import("./preview-VCGACSPZ.js");
3488
+ const { nonInteractivePreview } = await import("./preview-NGDPBUSE.js");
3489
3489
  return nonInteractivePreview(services, model, {
3490
3490
  baseUrl,
3491
3491
  siteId: site
3492
3492
  });
3493
3493
  });
3494
3494
  }
3495
- const { PreviewCommand } = await import("./PreviewCommand-NNCTBO3Q.js");
3495
+ const { PreviewCommand } = await import("./PreviewCommand-4FKLXEWE.js");
3496
3496
  await renderCommand(
3497
3497
  command,
3498
3498
  services,
@@ -3509,8 +3509,8 @@ var addPermissionCommand = (services) => {
3509
3509
  return createCommand("add-permission").description("adding a permission to the app").addOption(
3510
3510
  new Option("-p, --permission-id <id>", t("the permission id to add"))
3511
3511
  ).action(async (options, command) => {
3512
- const { renderCommand } = await import("./render-command-7DSOTQB4.js");
3513
- const { AddPermissionCommand } = await import("./AddPermissionCommand-347LFAL3.js");
3512
+ const { renderCommand } = await import("./render-command-HI7PBF4O.js");
3513
+ const { AddPermissionCommand } = await import("./AddPermissionCommand-TLDPXP4D.js");
3514
3514
  const { permissionId = "" } = options;
3515
3515
  await renderCommand(
3516
3516
  command,
@@ -3526,8 +3526,8 @@ var import_react4 = __toESM(require_react(), 1);
3526
3526
  var serveCommand = (services) => {
3527
3527
  const t = createI18nT();
3528
3528
  return createCommand("serve").description(t("serve_command_def.description")).action(async (_, command) => {
3529
- const { renderCommand } = await import("./render-command-7DSOTQB4.js");
3530
- const { ServeCommandDeprecated } = await import("./ServeCommand-DXFGEJ3K.js");
3529
+ const { renderCommand } = await import("./render-command-HI7PBF4O.js");
3530
+ const { ServeCommandDeprecated } = await import("./ServeCommand-H6TH7CRK.js");
3531
3531
  await renderCommand(command, services, /* @__PURE__ */ import_react4.default.createElement(ServeCommandDeprecated, null));
3532
3532
  });
3533
3533
  };
@@ -3542,8 +3542,8 @@ var generateCommand = (services) => {
3542
3542
  t("generate_command.type_flag"),
3543
3543
  validateDocsExtensionType
3544
3544
  ).description(t("generate_command.description")).action(async (options, command) => {
3545
- const { GenerateCommand } = await import("./GenerateCommand-VILDH5NQ.js");
3546
- const { renderCommand } = await import("./render-command-7DSOTQB4.js");
3545
+ const { GenerateCommand } = await import("./GenerateCommand-SC7ZL5SO.js");
3546
+ const { renderCommand } = await import("./render-command-HI7PBF4O.js");
3547
3547
  const { type } = options;
3548
3548
  await renderCommand(
3549
3549
  command,
@@ -3567,8 +3567,8 @@ var logsCommand = (services) => {
3567
3567
  validateVersion
3568
3568
  ).action(async (options, command) => {
3569
3569
  const { version } = options;
3570
- const { renderCommand } = await import("./render-command-7DSOTQB4.js");
3571
- const { LogsCommand } = await import("./LogsCommand-CRFRO55W.js");
3570
+ const { renderCommand } = await import("./render-command-HI7PBF4O.js");
3571
+ const { LogsCommand } = await import("./LogsCommand-3ONV75BA.js");
3572
3572
  await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(LogsCommand, { version }));
3573
3573
  });
3574
3574
  };
@@ -3601,8 +3601,8 @@ var releaseCommand = (services) => {
3601
3601
  t("app_preview_command_def.option.json")
3602
3602
  ).hideHelp()
3603
3603
  ).action(async (options, command) => {
3604
- const { renderCommand } = await import("./render-command-7DSOTQB4.js");
3605
- const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-BRNBSJGY.js");
3604
+ const { renderCommand } = await import("./render-command-HI7PBF4O.js");
3605
+ const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-4HJRK7AV.js");
3606
3606
  const { baseUrl, site, comment, json } = options;
3607
3607
  const versionType = options.versionType ? {
3608
3608
  major: ReleaseVersionType.MAJOR,
@@ -3616,7 +3616,7 @@ var releaseCommand = (services) => {
3616
3616
  };
3617
3617
  if (json) {
3618
3618
  return runCommand(command, services, async (model) => {
3619
- const { nonInteractiveRelease } = await import("./release-DWXEQVTD.js");
3619
+ const { nonInteractiveRelease } = await import("./release-LGTZQILP.js");
3620
3620
  return nonInteractiveRelease(services, model, props);
3621
3621
  });
3622
3622
  }
@@ -0,0 +1,2 @@
1
+ function p(n,e=!1,i=t=>t){return()=>({__type:"event-definition",type:n,isDomainEvent:e,transformations:i})}var h="wix_spi_error",u={ASC:"ASC",DESC:"DESC"},E={...u,BOTH:"BOTH",NONE:"NONE"};import{wixContext as o}from"@wix/sdk-context";function s(n,e){return(...i)=>{let t=l();return t?t.initWixModules(n,e).apply(void 0,i):n.apply(void 0,i)}}function l(){let n=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(n)return{initWixModules(t,r){return a(()=>n(t,r))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let e=typeof $wixContext<"u"?$wixContext.client:typeof o.client<"u"?o.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof o.elevatedClient<"u"?o.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!e&&!i))return{initWixModules(t,r){if(r){if(!i)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return a(()=>i.use(t))}if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return a(()=>e.use(t))},fetchWithAuth:(t,r)=>{if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.fetchWithAuth(t,r)},getAuth(){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.auth},async graphql(t,r,c){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.graphql(t,r,c)}}}function a(n){let e=globalThis.__wix_context__,i={client:o.client,elevatedClient:o.elevatedClient},t;globalThis.__wix_context__=void 0,o.client=void 0,o.elevatedClient=void 0,typeof $wixContext<"u"&&(t={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return n()}finally{globalThis.__wix_context__=e,o.client=i.client,o.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=t.client,$wixContext.elevatedClient=t.elevatedClient)}}var x={id:"_id",createdDate:"_createdDate",updatedDate:"_updatedDate"};function R(n,e=!1){return s(n,e)}var d=["wix.com","editorx.com"];var g=new RegExp(`\\.(${d.join("|")})$`),f=["42.wixprod.net","uw2-edt-1.wixprod.net"],_="dev.wix-code.com";var T=new RegExp(`\\.(${f.join("|")})$`),W=new RegExp(`.*\\.${_}$`);export{p as a,h as b,a as c,x as d,R as e};
2
+ //# sourceMappingURL=chunk-76CE5VVR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-types/build/browser/index.mjs","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context-v2.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/constants.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js"],"sourcesContent":["// src/event-handlers-modules.ts\nfunction EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {\n return () => ({\n __type: \"event-definition\",\n type,\n isDomainEvent,\n transformations\n });\n}\n\n// src/service-plugins.ts\nfunction ServicePluginDefinition(componentType, methods) {\n return {\n __type: \"service-plugin-definition\",\n componentType,\n methods\n };\n}\nvar SERVICE_PLUGIN_ERROR_TYPE = \"wix_spi_error\";\n\n// src/common/sort.ts\nvar SORT_DIRECTIONS = {\n ASC: \"ASC\",\n DESC: \"DESC\"\n};\nvar SORT_CAPABILITIES = {\n ...SORT_DIRECTIONS,\n BOTH: \"BOTH\",\n NONE: \"NONE\"\n};\nexport {\n EventDefinition,\n SERVICE_PLUGIN_ERROR_TYPE,\n SORT_CAPABILITIES,\n SORT_DIRECTIONS,\n ServicePluginDefinition\n};\n","import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n getAuth() {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.auth;\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function getContextualAuth() {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.getAuth();\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => {\n // used by the CLI for webhook registration on build time\n return {\n slug: eventDefinition.type,\n };\n };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.methods = servicePlugin.methods;\n return contextualMethod;\n}\n","export const WIX_PROTOCOL = 'wix:';\nexport const SDKRequestToRESTRequestRenameMap = {\n _id: 'id',\n _createdDate: 'createdDate',\n _updatedDate: 'updatedDate',\n};\nexport const RESTResponseToSDKResponseRenameMap = {\n id: '_id',\n createdDate: '_createdDate',\n updatedDate: '_updatedDate',\n};\nexport const ITEMS_RESULT_PROPERTY_NAME = 'items';\nexport const PAGING_METADATA_RESULT_PROPERTY_NAME = 'pagingMetadata';\nexport const DEFAULT_LIMIT = 50;\n","import { contextualizeRESTModuleV2 } from './context-v2.js';\nexport { RESTResponseToSDKResponseRenameMap } from './constants.js';\nexport function createRESTModule(descriptor, elevated = false) {\n return contextualizeRESTModuleV2(descriptor, elevated);\n}\nexport function toURLSearchParams(params, isComplexRequest) {\n const flatten = flattenParams(params);\n // payloads with deep arrays or complex arrays are not serializable as URLSearchParams\n const isPayloadNonSerializableAsUrlSearchParams = Object.entries(flatten).some(([key, value]) => key.includes('.') ||\n (Array.isArray(value) && value.some((v) => typeof v === 'object')));\n const shouldSerializeToRParam = isComplexRequest && isPayloadNonSerializableAsUrlSearchParams;\n if (shouldSerializeToRParam) {\n return new URLSearchParams({ '.r': base64Encode(JSON.stringify(params)) });\n }\n else {\n return Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {\n // inorder to make `foo: [1,2]` turn into `foo=1&foo=2` and not `foo[]=1&foo[]=2`\n const keyParams = Array.isArray(value) ? value : [value];\n keyParams.forEach((param) => {\n if (param === undefined ||\n param === null ||\n (Array.isArray(value) && typeof param === 'object')) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n }\n}\nexport function resolveUrl(opts) {\n const domain = resolveDomain(opts.host);\n const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);\n const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});\n return resolvePathFromMappings(path, mappings);\n}\nfunction flattenParams(data, path = '') {\n const params = {};\n Object.entries(data).forEach(([key, value]) => {\n const isObject = value !== null && typeof value === 'object' && !Array.isArray(value);\n const fieldPath = resolvePath(path, key);\n if (isObject) {\n const serializedObject = flattenParams(value, fieldPath);\n Object.assign(params, serializedObject);\n }\n else {\n params[fieldPath] = value;\n }\n });\n return params;\n}\nfunction resolvePath(path, key) {\n return `${path}${path ? '.' : ''}${key}`;\n}\nconst base64Encode = (value) => {\n const bytes = new TextEncoder().encode(value);\n const base64 = typeof btoa !== 'undefined'\n ? btoa(String.fromCodePoint(...bytes))\n : Buffer.from(value, 'utf-8').toString('base64');\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst DOMAINS = ['wix.com', 'editorx.com'];\nconst USER_DOMAIN = '_';\nconst REGEX_CAPTURE_DOMAINS = new RegExp(`\\\\.(${DOMAINS.join('|')})$`);\nconst WIX_API_DOMAINS = ['42.wixprod.net', 'uw2-edt-1.wixprod.net'];\nconst DEV_WIX_CODE_DOMAIN = 'dev.wix-code.com';\nconst REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;\nconst REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\\\.(${WIX_API_DOMAINS.join('|')})$`);\nconst REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\\\.${DEV_WIX_CODE_DOMAIN}$`);\nfunction resolveDomain(host) {\n const resolvedHost = fixHostExceptions(host);\n return resolvedHost\n .replace(REGEX_CAPTURE_DOMAINS, '._base_domain_')\n .replace(REGEX_CAPTURE_API_DOMAINS, '._api_base_domain_')\n .replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, '*.dev.wix-code.com');\n}\n// hosts which standard string replacing doesn't apply to them, will be fixed here.\nfunction fixHostExceptions(host) {\n // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom\n return host.replace('create.editorx.com', 'editor.editorx.com');\n}\nfunction resolveMappingsByDomain(domain, domainToMappings) {\n const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];\n if (mappings) {\n return mappings;\n }\n const rootDomainMappings = resolveRootDomain(domain, domainToMappings);\n if (!rootDomainMappings) {\n if (isBaseDomain(domain)) {\n // fallback <lang>.wix.com sub domains to www.wix.com\n // since all of the languages subdomain are not mapped automatically in FP and we want to support those kind of calls\n // for example: fr.wix.com\n return domainToMappings[wwwBaseDomain];\n }\n }\n return rootDomainMappings ?? [];\n}\nfunction resolveRootDomain(domain, domainToMappings) {\n return Object.entries(domainToMappings).find(([entryDomain]) => {\n const [, ...rooDomainSegments] = domain.split('.');\n return rooDomainSegments.join('.') === entryDomain;\n })?.[1];\n}\nfunction isBaseDomain(domain) {\n return !!domain.match(/\\._base_domain_$/);\n}\nconst wwwBaseDomain = 'www._base_domain_';\nfunction injectDataIntoProtoPath(protoPath, data) {\n return protoPath\n .split('/')\n .map((path) => maybeProtoPathToData(path, data))\n .join('/');\n}\nfunction maybeProtoPathToData(protoPath, data) {\n const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];\n const field = protoRegExpMatch[1];\n if (field) {\n const suffix = protoPath.replace(protoRegExpMatch[0], '');\n return findByPath(data, field, protoPath, suffix);\n }\n return protoPath;\n}\nfunction findByPath(obj, path, defaultValue, suffix) {\n let result = obj;\n for (const field of path.split('.')) {\n if (!result) {\n return defaultValue;\n }\n result = result[field];\n }\n return `${result}${suffix}`;\n}\nfunction resolvePathFromMappings(protoPath, mappings) {\n const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));\n if (!mapping) {\n // todo: should we return the path? if no - what should we do in case of testings?\n return protoPath;\n }\n return mapping.srcPath + protoPath.slice(mapping.destPath.length);\n}\n"],"mappings":"AACA,SAASA,EAAgBC,EAAMC,EAAgB,GAAOC,EAAmBC,GAAMA,EAAG,CAChF,MAAO,KAAO,CACZ,OAAQ,mBACR,KAAAH,EACA,cAAAC,EACA,gBAAAC,CACF,EACF,CAUA,IAAIE,EAA4B,gBAG5BC,EAAkB,CACpB,IAAK,MACL,KAAM,MACR,EACIC,EAAoB,CACtB,GAAGD,EACH,KAAM,OACN,KAAM,MACR,EC7BA,OAAS,cAAAE,MAAkB,mBCmBpB,SAASC,EAA0BC,EAAYC,EAAU,CAC5D,MAAQ,IAAIC,IAAS,CACjB,IAAMC,EAAUC,EAAe,EAC/B,OAAKD,EAIGA,EACH,eAAeH,EAAYC,CAAQ,EAEnC,MAAM,OAAWC,CAAI,EALfF,EAAW,MAAM,OAAWE,CAAI,CAM/C,CACJ,CD9BO,SAASG,GAAiB,CAC7B,IAAMC,EAAa,OAAO,YAAgB,KAAe,YAAY,eAC/D,YAAY,eACZ,OAAO,WAAW,gBAAoB,KACpC,WAAW,gBAAgB,eACzB,WAAW,gBAAgB,eAC3B,OACV,GAAIA,EACA,MAAO,CAEH,eAAeC,EAASC,EAAU,CAC9B,OAAOC,EAAkB,IAAMH,EAAWC,EAASC,CAAQ,CAAC,CAChE,EACA,eAAgB,CACZ,MAAM,IAAI,MAAM,gDAAgD,CACpE,EACA,SAAU,CACN,MAAM,IAAI,MAAM,0CAA0C,CAC9D,CACJ,EAEJ,IAAME,EAAmB,OAAO,YAAgB,IAC1C,YAAY,OACZ,OAAOC,EAAW,OAAW,IACzBA,EAAW,OACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,OAC3B,OACRC,EAAiB,OAAO,YAAgB,IACxC,YAAY,eACZ,OAAOD,EAAW,eAAmB,IACjCA,EAAW,eACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,eAC3B,OACd,GAAI,GAACD,GAAoB,C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iBC,EAAYC,EAAW,GAAO,CAC3D,OAAOC,EAA0BF,EAAYC,CAAQ,CACzD,CAyDA,IAAME,EAAU,CAAC,UAAW,aAAa,EAEzC,IAAMC,EAAwB,IAAI,OAAO,OAAOC,EAAQ,KAAK,GAAG,CAAC,IAAI,EAC/DC,EAAkB,CAAC,iBAAkB,uBAAuB,EAC5DC,EAAsB,mBAE5B,IAAMC,EAA4B,IAAI,OAAO,OAAOC,EAAgB,KAAK,GAAG,CAAC,IAAI,EAC3EC,EAAoC,IAAI,OAAO,QAAQC,CAAmB,GAAG","names":["EventDefinition","type","isDomainEvent","transformations","x","SERVICE_PLUGIN_ERROR_TYPE","SORT_DIRECTIONS","SORT_CAPABILITIES","wixContext","contextualizeRESTModuleV2","restModule","elevated","args","context","resolveContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext","RESTResponseToSDKResponseRenameMap","createRESTModule","descriptor","elevated","contextualizeRESTModuleV2","DOMAINS","REGEX_CAPTURE_DOMAINS","DOMAINS","WIX_API_DOMAINS","DEV_WIX_CODE_DOMAIN","REGEX_CAPTURE_API_DOMAINS","WIX_API_DOMAINS","REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN","DEV_WIX_CODE_DOMAIN"]}
@@ -0,0 +1,2 @@
1
+ import{a as C,b as j,c as I,d as O}from"./chunk-76CE5VVR.js";import{f as y}from"./chunk-SBZEOPXX.js";import{wixContext as ce}from"@wix/sdk-context";var de=e=>{switch(e){case"get":case"GET":return"GET";case"post":case"POST":return"POST";case"put":case"PUT":return"PUT";case"delete":case"DELETE":return"DELETE";case"patch":case"PATCH":return"PATCH";case"head":case"HEAD":return"HEAD";case"options":case"OPTIONS":return"OPTIONS";default:throw new Error(`Unknown method: ${e}`)}},q=e=>t=>async r=>{let n,s=o=>{if(n=e(r)(o),n.url===void 0)throw new Error("Url was not successfully created for this request, please reach out to support channels for assistance.");let{method:a,url:i,params:c}=n;return{...n,method:de(a),url:i,data:n.data,params:c}};try{let o=await t.request(s);if(n===void 0)throw new Error("Request options were not created for this request, please reach out to support channels for assistance.");let a=Array.isArray(n.transformResponse)?n.transformResponse:[n.transformResponse],i=o.data;return a.forEach(c=>{c&&(i=c(o.data,o.headers))}),i}catch(o){throw typeof o=="object"&&o!==null&&"response"in o&&typeof o.response=="object"&&o.response!==null&&"data"in o.response?o.response.data:o}},W=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var B="__metadata",R="www.wixapis.com",K="edge.wixapis.com";var S=class extends Error{constructor(r,n){super(r);y(this,"message");y(this,"response");this.message=r,this.response=n}async details(){let r=await this.response.json();return ue(this.response.status,r?.message,r?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:r})}},ue=(e,t,r,n)=>({details:{...!r?.validationError&&{applicationError:{description:t,code:e,data:n}},...r},message:t,requestId:n?.requestId});var J=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},k=e=>e&&typeof e=="object"&&!Array.isArray(e);var G=e=>e.__type==="host";function X(e,t){return e.create(t)}var le="x-wix-bi-gateway";function Y(e,t,r){return{[le]:pe({environment:`js-sdk${r?`-${r}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function pe(e){return Object.entries(e).filter(([t,r])=>!!r).map(([t,r])=>`${t}=${r}`).join(",")}function v(e){return Ee(e).map(t=>t.toLocaleUpperCase()).join("_")}var fe=/([\p{Ll}\d])(\p{Lu})/gu,he=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,z="$1\0$2",me=/[^\p{L}\d]+/giu;function Ee(e){let t=e.trim();t=t.replace(fe,z).replace(he,z),t=t.replace(me,"\0");let r=0,n=t.length;for(;t.charAt(r)==="\0";)r++;if(r===n)return[];for(;t.charAt(n-1)==="\0";)n--;return t.slice(r,n).split(/\0/g)}var Te=e=>"validationError"in(e.response?.data?.details??{}),ye=e=>"applicationError"in(e.response?.data?.details??{}),_e=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function V(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},r=[]){if(typeof e!="object"||e===null)throw e;if(Te(e))return ge(e,t,r);if(ye(e))return Ae(e);if(_e(e)){let n=e.response?.status,s=e.response?.statusText??"UNKNOWN",o=e.response?.data?.message??s,a={applicationError:{description:s,code:v(s),data:{}},requestId:e.requestId};return L(e,{message:JSON.stringify({message:o,details:a},null,2),extraProperties:{details:a,status:n}})}return Pe(e)}var ge=(e,t,r)=>{let n=e.response?.data,s=e.requestId,{fieldViolations:o}=n.details.validationError,a=we(t,o,r)?.sort((u,p)=>u.field<p.field?-1:1),i=`INVALID_ARGUMENT: ${a?.map(({field:u,description:p})=>`"${u}" ${p}`)?.join(", ")}`,c={validationError:{fieldViolations:a},requestId:s};return L(e,{message:JSON.stringify({message:i,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:s}})},L=(e,{message:t,extraProperties:r})=>Object.assign(e,{...r,message:t}),Ae=e=>{let t=e.response?.status,r=e.response?.statusText??"UNKNOWN",n=e.response?.data?.message??r,s=e.response?.data?.details?.applicationError?.description??r,o=e.response?.data?.details?.applicationError?.code??v(r),a=e.response?.data?.details?.applicationError?.data??{},i=n===s?n:`${n}: ${s}`,c={applicationError:{description:s,code:o,data:a},requestId:e.requestId};return L(e,{message:JSON.stringify({message:i,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},Pe=e=>{let t=e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`;return L(e,{message:t,extraProperties:{requestId:e.requestId,status:e.response?.status,code:v(e.response?.statusText??"UNKNOWN"),...!e.response&&{runtimeError:e}}})},we=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:r},n,s)=>{let o={...e,...t},a=Object.keys(o);return n?.filter(i=>!n.some(u=>u.field.length>i.field.length&&u.field.startsWith(i.field)&&a.includes(u.field))).map(i=>{let c=t[i.field];if(c)return{...i,field:Q(c,s)};let u=a?.sort((p,E)=>E.length-p.length)?.find(p=>i.field.startsWith(p));if(u){let p=o[u];if(p)return{...i,field:i.field.replace(u,Q(p,s))}}return r?{...i,field:`${s[0]}.${i.field}`}:i})},Q=(e,t)=>{let r=xe(e);return r!==null&&typeof r<"u"?e.replace(`$[${r}]`,t[r]):e},xe=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function Z(e,t,r,n,s,o,a,i,c,u,p){return I(()=>e({request:async E=>{let T=E({host:i?.HTTPHost||R}),l=T;l.method==="GET"&&l.fallback?.length&&(l.params?.toString().length??0)>4e3&&(l=T.fallback[0]);let P=i?.HTTPHost??R,H=`https://${u?K:P}${l.url}`;l.params&&l.params.toString()&&(H+=`?${l.params.toString()}`);try{let d=Y(T,t,c),f={method:l.method,...l.data&&{body:JSON.stringify(l.data)},headers:{...d}},h=await r(H,f);if(h.status!==200){let g=null;try{g=await h.json()}catch{}let m=Re(h.status,g?.message??h.statusText,g?.details,{requestId:h.headers.get("X-Wix-Request-Id"),details:g}),x=V(m);throw n?.handleError(x,{requestOptions:{url:l.url,method:l.method,entityFqdn:T.entityFqdn,methodFqn:T.methodFqn}}),m}let _=await h.json();return{data:l.migrationOptions?.optInTransformResponse&&l.transformResponse?Array.isArray(l.transformResponse)?l.transformResponse[0](_):l.transformResponse(_):_,headers:h.headers,status:h.status,statusText:h.statusText}}catch(d){throw d.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),d}},fetchWithAuth:r,wixAPIFetch:s,getActiveToken:o,getAuthHeaders:a},{validateRequestSchema:p}))}var D=class extends Error{constructor(r){super();y(this,"response");y(this,"requestId");this.response=r.response,this.requestId=r.requestId}},Re=(e,t,r,n)=>new D({response:{data:{details:{...!r?.validationError&&{applicationError:{description:t,code:e,data:n}},...r},message:t},status:e},requestId:n?.requestId});var be=".";function ee(e,t,r){if(e==null)throw new Error("Cannot set value on null or undefined");let n=N(t),s=e;for(let o=0;o<n.length;o++){let a=n[o];if(o===n.length-1){s[a]=r;break}let i=n[o+1];!(a in s)||s[a]==null?s[a]=typeof i=="number"?[]:{}:(typeof s[a]!="object"||s[a]===null)&&(s[a]=typeof i=="number"?[]:{}),s=s[a]}return e}function N(e){return Array.isArray(e)?e:e.split(be).map(t=>Ie(t)?Number(t):t)}function Ie(e){return/^\d+$/.test(e)}function te(e){let t={};for(let[r,n]of Object.entries(e)){if(Se(r))continue;let s=N(r);ee(t,s,n)}return t}function Se(e){return e==="__proto__"||e==="constructor"||e==="prototype"}var U=class{constructor(t){y(this,"BRACKET_PATTERN",/\[(\d+)\]/g);y(this,"NUMERIC_PATTERN",/^\d+$/);y(this,"ESCAPED_DOT_PATTERN",/\\\./g);y(this,"ESCAPED_LEFT_BRACKET_PATTERN",/\\\[/g);y(this,"ESCAPED_RIGHT_BRACKET_PATTERN",/\\\]/g);y(this,"SPLIT_PATTERN",/\.|\[(\d+)\]/g);y(this,"DOT_BEFORE_BRACKET_PATTERN",/\.\[/g);y(this,"ESCAPED_DOT_PLACEHOLDER","__DOT__");y(this,"ESCAPED_RIGHT_BRACKET_PLACEHOLDER","__RB__");y(this,"ESCAPED_LEFT_BRACKET_PLACEHOLDER","__LB__");y(this,"modifiedFields");y(this,"cleanedModifiedFields");this.modifiedFields=t}replaceEscapedCharacters(t){return t.replace(this.ESCAPED_DOT_PATTERN,this.ESCAPED_DOT_PLACEHOLDER).replace(this.ESCAPED_LEFT_BRACKET_PATTERN,this.ESCAPED_LEFT_BRACKET_PLACEHOLDER).replace(this.ESCAPED_RIGHT_BRACKET_PATTERN,this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER)}restoreEscapedCharacters(t){return t.replace(this.ESCAPED_DOT_PLACEHOLDER,"\\.").replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER,"\\]").replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER,"\\[")}unflatten(){return this.cleanedModifiedFields=Object.fromEntries(Object.entries(this.modifiedFields).map(([t,r])=>[this.replaceEscapedCharacters(this.bracketToDotNotation(t)),r])),te(this.cleanedModifiedFields)}flatten(t){let r={};for(let n of Object.keys(this.cleanedModifiedFields)){let s=this.splitPath(n),o=this.navigatePath(t,s);r={...r,...o}}return Object.fromEntries(Object.entries(r).map(([n,s])=>[this.restoreEscapedCharacters(n),s]))}splitPath(t){let r=[],n=0,s=Array.from(t.matchAll(this.SPLIT_PATTERN));for(let o of s)o.index>n&&r.push(t.substring(n,o.index)),o[1]&&r.push(o[1]),n=o.index+o[0].length;return n<t.length&&r.push(t.substring(n)),r}navigatePath(t,r){let n=t,s=[],o=c=>{if(!Array.isArray(n))throw new Error(`Expected array at path ${this.buildPathString(s)}, but got ${typeof n}`);s.push(`[${c}]`),n=n[parseInt(c,10)]},a=(c,u)=>{let p=c in O?O[c]:void 0;if(p&&p in u){s.push(p),n=u[p];return}let E=He(c);if(E&&E in u){s.push(E),n=u[E];return}throw new Error(`Cannot find key '${c}' or its transformations at path ${this.buildPathString(s)}`)},i=(c,u)=>{s.push(c),n=u[c]};for(let c of r){if(this.NUMERIC_PATTERN.test(c)){o(c);continue}if(n===null||typeof n!="object")throw new Error(`Cannot access property '${c}' on ${typeof n} at path ${this.buildPathString(s)}`);let u=n;if(c in n){i(c,u);continue}a(c,u)}return{[this.buildPathString(s)]:n}}buildPathString(t){return t.join(".").replace(this.DOT_BEFORE_BRACKET_PATTERN,"[")}bracketToDotNotation(t){return t.replace(this.BRACKET_PATTERN,(r,n,s)=>s>0&&t[s-1]==="\\"?r:"."+n)}};function se(e,t){let r=e?.modifiedFields;if(!r)return null;let n=ve(r);if(!n)return null;let{unflattenedModifiedFields:s,modifiedFieldsManipulator:o}=n;e={...e,modifiedFields:s};let a=t(e),i=a?.modifiedFields;if(!i)return null;let c=Le(i,o);return c!==null?(a.modifiedFields=c,a):null}function ve(e){if(typeof e=="object"&&e!==null&&!Array.isArray(e))try{let t=new U(e);return{unflattenedModifiedFields:t.unflatten(),modifiedFieldsManipulator:t}}catch{return null}return null}function Le(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e))try{return t.flatten(e)}catch{return null}return null}function He(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^./,t=>t.toLowerCase())}function b(){return{emit(e,...t){for(let r=0,n=this.events[e]||[],s=n.length;r<s;r++)n[r](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(r=>t!==r)}}}}var ne=e=>e.__type==="event-definition";function re(e,t,r,n){let s;if(e.isDomainEvent){let c=r,{deletedEvent:u,actionEvent:p,createdEvent:E,updatedEvent:T,...l}=c,P={...n,...l};u?u?.deletedEntity?s={entity:u?.deletedEntity,metadata:P}:s={metadata:P}:p?s={data:p.body,metadata:P}:T?s={entity:T.currentEntity,metadata:P,...T.modifiedFields?{modifiedFields:T.modifiedFields}:{}}:s={entity:E?.entity,metadata:P}}else s={data:r,metadata:n};let o=e.transformations??(c=>c),a=s,i=s;if(i.modifiedFields){let c=i.modifiedFields;if(typeof c=="object"&&c!==null&&!Array.isArray(c)){a=structuredClone(s);let u=se(i,o);if(u)return t(u)}}return t(o(a))}function oe(e){let t=new Map,r=b(),n={...r,getRegisteredEvents:()=>t,async process(s,o={expectedEvents:[]}){let{eventType:a,identity:i,instanceId:c,payload:u,accountInfo:p}=await this.parseJWT(s),E=[...o.expectedEvents,...Array.from(t.keys()).map(l=>({type:l}))];if(E.length>0&&!E.some(({type:l})=>l===a))throw new Error(`Unexpected event type: ${a}. Expected one of: ${E.map(l=>l.type).join(", ")}`);let T=t.get(a)??[];return await Promise.all(T.map(({eventDefinition:l,handler:P})=>re(l,P,u,{instanceId:c,identity:i,accountInfo:p}))),{instanceId:c,eventType:a,payload:u,identity:i,accountInfo:p}},async processRequest(s,o){let a=await s.text();return this.process(a,o)},async parseJWT(s){let o=e();if(!o.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:a,valid:i}=await o.decodeJWT(s);if(!i)throw new Error("JWT is not valid");if(typeof a.data!="string")throw new Error(`Unexpected type of JWT data: expected string, got ${typeof a.data}`);let c=JSON.parse(a.data),u=c.eventType,p=c.accountInfo,E=c.instanceId,T=c.identity?JSON.parse(c.identity):void 0,l=JSON.parse(c.data);return{instanceId:E,eventType:u,payload:l,identity:T,accountInfo:p}},async parseRequest(s){let o=await s.text();return this.parseJWT(o)},async executeHandlers(s){let o=Array.from(t.keys()).map(i=>({type:i}));if(o.length>0&&!o.some(({type:i})=>i===s.eventType))throw new Error(`Unexpected event type: ${s.eventType}. Expected one of: ${o.map(i=>i.type).join(", ")}`);let a=t.get(s.eventType)??[];await Promise.all(a.map(({eventDefinition:i,handler:c})=>re(i,c,s.payload,{instanceId:s.instanceId,identity:s.identity})))},apps:{AppInstalled:C("AppInstalled")(),AppRemoved:C("AppRemoved")()}};return{initModule(s){return o=>{let a=t.get(s.type)??[];a.push({eventDefinition:s,handler:o}),t.set(s.type,a),r.emit("registered",s)}},client:n}}var ae=e=>e.__type==="service-plugin-definition";function ie(e){let t=new Map,r=b(),n={...r,getRegisteredServicePlugins:()=>t,async parseJWT(s){let o=e();if(!o.decodeJWT)throw new Error("decodeJWT is not supported by the authentication strategy");let{decoded:a,valid:i}=await o.decodeJWT(s,!0);if(!i)throw new Error("JWT is not valid");if(typeof a.data!="object"||a.data===null||!("metadata"in a.data)||typeof a.data.metadata!="object"||a.data.metadata===null||!("appExtensionType"in a.data.metadata)||typeof a.data.metadata.appExtensionType!="string")throw new Error("Unexpected JWT data: expected object with metadata.appExtensionType string");return a.data},async process(s){let o=await this.parseJWT(s.body);return this.executeHandler(o,s.url)},async parseRequest(s){let o=await s.text();return this.parseJWT(o)},async processRequest(s){let o=s.url,a=await s.text();try{let i=await this.process({url:o,body:a});return Response.json(i)}catch(i){if(i.errorType==="SPI"&&i.applicationCode&&i.httpCode)return Response.json({applicationError:{code:i.applicationCode,data:i.data}},{status:i.httpCode});throw i}},async executeHandler(s,o){let a=s.metadata.appExtensionType.toLowerCase(),i=t.get(a)??[];if(i.length===0)throw new Error(`No service plugin implementations found for component type ${a}`);if(i.length>1)throw new Error(`Multiple service plugin implementations found for component type ${a}. This is currently not supported`);let{implementation:c,servicePluginDefinition:u}=i[0],p=u.methods.find(T=>o.endsWith(T.primaryHttpMappingPath));if(!p)throw new Error("Unexpect request: request url did not match any method: "+o);let E=c[p.name];if(!E)throw new Error(`Got request for service plugin method ${p.name} but no implementation was provided. Available methods: ${Object.keys(c).join(", ")}`);return p.transformations.toREST(await E(p.transformations.fromREST(s)))}};return{initModule(s){return o=>{let a=t.get(s.componentType.toLowerCase())??[];a.push({servicePluginDefinition:s,implementation:o}),t.set(s.componentType.toLowerCase(),a),r.emit("registered",s)}},client:n}}var w="X-Wix-Consistent";function At(e){let t=e.headers||{Authorization:""},r={getAuthHeaders:d=>Promise.resolve({headers:{}})},n=e.auth,s=typeof n=="function"?n:()=>n??r,o=()=>s().getAuthHeaders(e.host),a=()=>e.fetch??fetch,i=async(d,f)=>{let h=a(),_=await o(),A={...f?.headers??{},..._.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}},g=e.host?.getErrorHandler?.();try{if(typeof d=="string"||d instanceof URL){let m=await h(d,{...f,headers:A});g?.handleError(m,{requestOptions:{url:d.toString(),method:f?.method}});let x=M(m);return x&&(t[w]=x),m}else{for(let[$,F]of Object.entries(A))typeof F=="string"&&d.headers.set($,F);let m=await h(d,f);g?.handleError(m,{requestOptions:{url:d.url,method:f?.method}});let x=M(m);return x&&(t[w]=x),m}}catch(m){throw g?.handleError(m,{requestOptions:{url:typeof d=="string"||d instanceof URL?d.toString():d.url,method:f?.method}}),m}},{client:c,initModule:u}=ie(s),{client:p,initModule:E}=oe(s),T=async(d,f)=>{let h=a(),_=await o(),A=J(f),g=await h(d,{...f,headers:{...A,...t,..._?.headers,...f?.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}}}),m=M(g);return m&&(t[w]=m),g},l=(d,f)=>{if(ne(d))return E(d);if(ae(d))return u(d);if(G(d)&&e.host)return X(d,e.host);if(typeof d=="function"){if("__type"in d&&d.__type===j)return d;let h=e.host?.apiBaseUrl??R,_=e.useCDN===void 0?s().shouldUseCDN:e.useCDN;return Z(I(()=>W(d))?q(d):d,f??{},T,e.host?.getErrorHandler?.(),(A,g)=>{let m=new URL(A,`https://${h}`);return m.host=h,m.protocol="https",T(m.toString(),g)},s().getActiveToken,async()=>o(),{HTTPHost:h},e.host?.name,_,e.validateRequestSchema)}else return k(d)?Object.fromEntries(Object.entries(d).map(([h,_])=>[h,l(_,d[B])])):d},P=d=>{for(let f in d)t[f]=d[f]};return{...e.modules?l(e.modules):{},get auth(){let d=s(),f=d.getAuthHeaders;return d.getAuthHeaders=f.bind(void 0,e.host),d},setHeaders:P,use:l,enableContext(d,f={elevated:!1}){d==="global"?globalThis.__wix_context__!=null?f.elevated?globalThis.__wix_context__.elevatedClient=this:globalThis.__wix_context__.client=this:f.elevated?globalThis.__wix_context__={elevatedClient:this}:globalThis.__wix_context__={client:this}:f.elevated?ce.elevatedClient=this:ce.client=this},fetch:(d,f)=>{let h=e.host?.apiBaseUrl??R,_=new URL(d,`https://${h}`);return _.host=h,_.protocol="https",T(_.toString(),f)},fetchWithAuth:i,async graphql(d,f,h={apiVersion:"alpha"}){let _=e?.host?.apiBaseUrl??R,A=await T(`https://${_}/graphql/${h.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d,variables:f})});if(A.status!==200)throw new S(`GraphQL request failed with status ${A.status}`,A);let{data:g,errors:m}=await A.json();return{data:g??{},errors:m}},webhooks:p,servicePlugins:c}}function M(e){return e.headers?.get(w)??e.headers?.get(w.toLowerCase())}export{At as a};
2
+ //# sourceMappingURL=chunk-NQK6RWZM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/@wix/sdk/build/wixClient.js","../../../node_modules/@wix/sdk/build/ambassador-modules.js","../../../node_modules/@wix/sdk/build/common.js","../../../node_modules/@wix/sdk/build/fetch-error.js","../../../node_modules/@wix/sdk/build/helpers.js","../../../node_modules/@wix/sdk/build/host-modules.js","../../../node_modules/@wix/sdk/build/bi/biHeaderGenerator.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/utils.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/transform-error.js","../../../node_modules/@wix/sdk/build/rest-modules.js","../../../node_modules/@wix/sdk/build/object-utils.js","../../../node_modules/@wix/sdk/build/flat-utils.js","../../../node_modules/@wix/sdk/build/modified-fields-manipulator.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/nanoevents.js","../../../node_modules/@wix/sdk/build/event-handlers-modules.js","../../../node_modules/@wix/sdk/build/service-plugin-modules.js"],"sourcesContent":["import { wixContext } from '@wix/sdk-context';\nimport { SERVICE_PLUGIN_ERROR_TYPE, } from '@wix/sdk-types';\nimport { isAmbassadorModule, toHTTPModule } from './ambassador-modules.js';\nimport { DEFAULT_API_URL, PUBLIC_METADATA_KEY } from './common.js';\nimport { FetchErrorResponse } from './fetch-error.js';\nimport { getDefaultContentHeader, isObject } from './helpers.js';\nimport { buildHostModule, isHostModule } from './host-modules.js';\nimport { buildRESTDescriptor } from './rest-modules.js';\nimport { eventHandlersModules, isEventHandlerModule, } from './event-handlers-modules.js';\nimport { isServicePluginModule, servicePluginsModules, } from './service-plugin-modules.js';\nimport { runWithoutContext } from '@wix/sdk-runtime/context';\nexport const X_WIX_CONSISTENT_HEADER = 'X-Wix-Consistent';\nexport function createClient(config) {\n const _headers = config.headers || { Authorization: '' };\n const defaultStrategy = {\n getAuthHeaders: (_) => Promise.resolve({ headers: {} }),\n };\n const auth = config.auth;\n const getAuthStrategy = typeof auth === 'function' ? auth : () => auth ?? defaultStrategy;\n const boundGetAuthHeaders = () => {\n return getAuthStrategy().getAuthHeaders(config.host);\n };\n const getFetchFn = () => config.fetch ?? fetch;\n const fetchWithAuth = async (urlOrRequest, requestInit) => {\n const fetch = getFetchFn();\n const authHeaders = await boundGetAuthHeaders();\n const headers = {\n ...(requestInit?.headers ?? {}),\n ...authHeaders.headers,\n ...config.host?.essentials?.passThroughHeaders,\n ...(_headers[X_WIX_CONSISTENT_HEADER]\n ? { [X_WIX_CONSISTENT_HEADER]: _headers[X_WIX_CONSISTENT_HEADER] }\n : {}),\n };\n const errorHandler = config.host?.getErrorHandler?.();\n try {\n if (typeof urlOrRequest === 'string' || urlOrRequest instanceof URL) {\n const response = await fetch(urlOrRequest, {\n ...requestInit,\n headers,\n });\n errorHandler?.handleError(response, {\n requestOptions: {\n url: urlOrRequest.toString(),\n method: requestInit?.method,\n },\n });\n const consistentHeader = findConsistentHeader(response);\n if (consistentHeader) {\n _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;\n }\n return response;\n }\n else {\n for (const [k, v] of Object.entries(headers)) {\n if (typeof v === 'string') {\n urlOrRequest.headers.set(k, v);\n }\n }\n const response = await fetch(urlOrRequest, requestInit);\n errorHandler?.handleError(response, {\n requestOptions: {\n url: urlOrRequest.url,\n method: requestInit?.method,\n },\n });\n const consistentHeader = findConsistentHeader(response);\n if (consistentHeader) {\n _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;\n }\n return response;\n }\n }\n catch (e) {\n errorHandler?.handleError(e, {\n requestOptions: {\n url: typeof urlOrRequest === 'string' || urlOrRequest instanceof URL\n ? urlOrRequest.toString()\n : urlOrRequest.url,\n method: requestInit?.method,\n },\n });\n throw e;\n }\n };\n const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(getAuthStrategy);\n const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(getAuthStrategy);\n const boundFetch = async (url, options) => {\n const fetch = getFetchFn();\n const authHeaders = await boundGetAuthHeaders();\n const defaultContentTypeHeader = getDefaultContentHeader(options);\n const response = await fetch(url, {\n ...options,\n headers: {\n ...defaultContentTypeHeader,\n ..._headers,\n ...authHeaders?.headers,\n ...options?.headers,\n ...config.host?.essentials?.passThroughHeaders,\n // Ensure consistent header always takes precedence\n ...(_headers[X_WIX_CONSISTENT_HEADER]\n ? { [X_WIX_CONSISTENT_HEADER]: _headers[X_WIX_CONSISTENT_HEADER] }\n : {}),\n },\n });\n const consistentHeader = findConsistentHeader(response);\n if (consistentHeader) {\n _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;\n }\n return response;\n };\n // This is typed as `any` because when trying to properly type it as defined\n // on the WixClient, typescript starts failing with `Type instantiation is\n // excessively deep and possibly infinite.`\n const use = (modules, metadata) => {\n if (isEventHandlerModule(modules)) {\n return initEventHandlerModule(modules);\n }\n else if (isServicePluginModule(modules)) {\n return initServicePluginModule(modules);\n }\n else if (isHostModule(modules) && config.host) {\n return buildHostModule(modules, config.host);\n }\n else if (typeof modules === 'function') {\n // The generated namespaces all have the error classes on them and\n // a class is also a function, so we need to explicitly ignore these\n // error classes using a static field that exists on them.\n if ('__type' in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {\n return modules;\n }\n const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const shouldUseCDN = config.useCDN === undefined\n ? getAuthStrategy().shouldUseCDN\n : config.useCDN;\n return buildRESTDescriptor(runWithoutContext(() => isAmbassadorModule(modules))\n ? toHTTPModule(modules)\n : modules, metadata ?? {}, boundFetch, config.host?.getErrorHandler?.(), (relativeUrl, fetchOptions) => {\n const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);\n finalUrl.host = apiBaseUrl;\n finalUrl.protocol = 'https';\n return boundFetch(finalUrl.toString(), fetchOptions);\n }, getAuthStrategy().getActiveToken, \n // async wrapper normalizes the sync/async union from AuthenticationStrategy.getAuthHeaders\n async () => boundGetAuthHeaders(), { HTTPHost: apiBaseUrl }, config.host?.name, shouldUseCDN, config.validateRequestSchema);\n }\n else if (isObject(modules)) {\n return Object.fromEntries(Object.entries(modules).map(([key, value]) => {\n return [key, use(value, modules[PUBLIC_METADATA_KEY])];\n }));\n }\n else {\n return modules;\n }\n };\n const setHeaders = (headers) => {\n for (const k in headers) {\n _headers[k] = headers[k];\n }\n };\n const wrappedModules = config.modules\n ? use(config.modules)\n : {};\n return {\n ...wrappedModules,\n get auth() {\n const authStrategy = getAuthStrategy();\n const originalGetAuthHeaders = authStrategy.getAuthHeaders;\n authStrategy.getAuthHeaders = originalGetAuthHeaders.bind(undefined, config.host);\n return authStrategy;\n },\n setHeaders,\n use,\n enableContext(contextType, opts = { elevated: false }) {\n if (contextType === 'global') {\n if (globalThis.__wix_context__ != null) {\n if (opts.elevated) {\n globalThis.__wix_context__.elevatedClient = this;\n }\n else {\n globalThis.__wix_context__.client = this;\n }\n }\n else {\n if (opts.elevated) {\n globalThis.__wix_context__ = { elevatedClient: this };\n }\n else {\n globalThis.__wix_context__ = { client: this };\n }\n }\n }\n else {\n if (opts.elevated) {\n wixContext.elevatedClient = this;\n }\n else {\n wixContext.client = this;\n }\n }\n },\n /**\n * @param relativeUrl The URL to fetch relative to the API base URL\n * @param options The fetch options\n * @returns The fetch Response object\n * @deprecated Use `fetchWithAuth` instead\n */\n fetch: (relativeUrl, options) => {\n const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);\n finalUrl.host = apiBaseUrl;\n finalUrl.protocol = 'https';\n return boundFetch(finalUrl.toString(), options);\n },\n fetchWithAuth,\n async graphql(query, variables, opts = {\n apiVersion: 'alpha',\n }) {\n const apiBaseUrl = config?.host?.apiBaseUrl ?? DEFAULT_API_URL;\n const res = await boundFetch(`https://${apiBaseUrl}/graphql/${opts.apiVersion}`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ query, variables }),\n });\n if (res.status !== 200) {\n throw new FetchErrorResponse(`GraphQL request failed with status ${res.status}`, res);\n }\n const { data, errors } = await res.json();\n return { data: data ?? {}, errors };\n },\n webhooks: eventHandlersClient,\n servicePlugins: servicePluginsClient,\n };\n}\nfunction findConsistentHeader(response) {\n return (response.headers?.get(X_WIX_CONSISTENT_HEADER) ??\n response.headers?.get(X_WIX_CONSISTENT_HEADER.toLowerCase()));\n}\n","const parseMethod = (method) => {\n switch (method) {\n case 'get':\n case 'GET':\n return 'GET';\n case 'post':\n case 'POST':\n return 'POST';\n case 'put':\n case 'PUT':\n return 'PUT';\n case 'delete':\n case 'DELETE':\n return 'DELETE';\n case 'patch':\n case 'PATCH':\n return 'PATCH';\n case 'head':\n case 'HEAD':\n return 'HEAD';\n case 'options':\n case 'OPTIONS':\n return 'OPTIONS';\n default:\n throw new Error(`Unknown method: ${method}`);\n }\n};\nexport const toHTTPModule = (factory) => (httpClient) => async (payload) => {\n let requestOptions;\n const HTTPFactory = (context) => {\n requestOptions = factory(payload)(context);\n if (requestOptions.url === undefined) {\n throw new Error('Url was not successfully created for this request, please reach out to support channels for assistance.');\n }\n const { method, url, params } = requestOptions;\n return {\n ...requestOptions,\n method: parseMethod(method),\n url,\n data: requestOptions.data,\n params,\n };\n };\n try {\n const response = await httpClient.request(HTTPFactory);\n if (requestOptions === undefined) {\n throw new Error('Request options were not created for this request, please reach out to support channels for assistance.');\n }\n const transformations = Array.isArray(requestOptions.transformResponse)\n ? requestOptions.transformResponse\n : [requestOptions.transformResponse];\n /**\n * Based on Axios implementation:\n * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/lib/core/transformData.js#L22\n */\n let data = response.data;\n transformations.forEach((transform) => {\n if (transform) {\n data = transform(response.data, response.headers);\n }\n });\n return data;\n }\n catch (e) {\n if (typeof e === 'object' &&\n e !== null &&\n 'response' in e &&\n typeof e.response === 'object' &&\n e.response !== null &&\n 'data' in e.response) {\n throw e.response.data;\n }\n throw e;\n }\n};\n/*\n * Because of issues with tree-shaking, we cant really put static parameter on module.\n * We still have check for __isAmbassador for backward compatibility\n */\nexport const isAmbassadorModule = (module) => {\n if (module.__isAmbassador) {\n return true;\n }\n const fn = module();\n return Boolean(fn.__isAmbassador);\n};\n","export const PUBLIC_METADATA_KEY = '__metadata';\nexport const DEFAULT_API_URL = 'www.wixapis.com';\nexport const DEFAULT_EDGE_API_URL = 'edge.wixapis.com';\nexport const FORCE_WRITE_API_URLS = ['/ecom/v1/carts/current'];\n","export class FetchErrorResponse extends Error {\n message;\n response;\n constructor(message, response) {\n super(message);\n this.message = message;\n this.response = response;\n }\n async details() {\n const dataError = await this.response.json();\n return errorBuilder(this.response.status, dataError?.message, dataError?.details, {\n requestId: this.response.headers.get('X-Wix-Request-Id'),\n details: dataError,\n });\n }\n}\nconst errorBuilder = (code, description, details, data) => {\n return {\n details: {\n ...(!details?.validationError && {\n applicationError: {\n description,\n code,\n data,\n },\n }),\n ...details,\n },\n message: description,\n requestId: data?.requestId,\n };\n};\n","// we follow a simplified version of the axios convention\n// https://github.com/axios/axios/blob/649d739288c8e2c55829ac60e2345a0f3439c730/lib/defaults/index.js#L65\nexport const getDefaultContentHeader = (options) => {\n if (options?.method &&\n ['post', 'put', 'patch'].includes(options.method.toLocaleLowerCase()) &&\n options.body) {\n return { 'Content-Type': 'application/json' };\n }\n return {};\n};\nexport const isObject = (val) => val && typeof val === 'object' && !Array.isArray(val);\nexport function parsePublicKeyIfEncoded(publicKey) {\n if (publicKey.includes('\\n') || publicKey.includes('\\r')) {\n // publicKey is multi-line string, can be used as is\n return publicKey.trim();\n }\n else {\n // publicKey is base64 encoded\n return typeof atob !== 'undefined'\n ? atob(publicKey)\n : Buffer.from(publicKey, 'base64').toString('utf-8');\n }\n}\n","export const isHostModule = (val) => val.__type === 'host';\nexport function buildHostModule(val, host) {\n return val.create(host);\n}\n","export const WixBIHeaderName = 'x-wix-bi-gateway';\nexport function biHeaderGenerator(apiMetadata, publicMetadata, environment) {\n return {\n [WixBIHeaderName]: objectToKeyValue({\n environment: `js-sdk${environment ? `-${environment}` : ``}`,\n 'package-name': apiMetadata.packageName ?? publicMetadata?.PACKAGE_NAME,\n 'method-fqn': apiMetadata.methodFqn,\n entity: apiMetadata.entityFqdn,\n }),\n };\n}\nfunction objectToKeyValue(input) {\n return Object.entries(input)\n .filter(([_, value]) => Boolean(value))\n .map(([key, value]) => `${key}=${value}`)\n .join(',');\n}\n","import { WIX_PROTOCOL } from './constants.js';\nexport function alignIfLegacy(url, type) {\n const { protocol } = new URL(url);\n return protocol === `${type}:` ? `${WIX_PROTOCOL}${url}` : url;\n}\nexport function removeUndefinedKeys(obj) {\n return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== undefined));\n}\nexport function constantCase(input) {\n return split(input)\n .map((part) => part.toLocaleUpperCase())\n .join('_');\n}\nconst SPLIT_LOWER_UPPER_RE = /([\\p{Ll}\\d])(\\p{Lu})/gu;\nconst SPLIT_UPPER_UPPER_RE = /(\\p{Lu})([\\p{Lu}][\\p{Ll}])/gu;\nconst SPLIT_REPLACE_VALUE = '$1\\0$2';\nconst DEFAULT_STRIP_REGEXP = /[^\\p{L}\\d]+/giu;\nexport function split(value) {\n let result = value.trim();\n result = result\n .replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);\n result = result.replace(DEFAULT_STRIP_REGEXP, '\\0');\n let start = 0;\n let end = result.length;\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === '\\0') {\n start++;\n }\n if (start === end) {\n return [];\n }\n while (result.charAt(end - 1) === '\\0') {\n end--;\n }\n return result.slice(start, end).split(/\\0/g);\n}\n","import { constantCase } from './utils.js';\nconst isValidationError = (httpClientError) => 'validationError' in (httpClientError.response?.data?.details ?? {});\nconst isApplicationError = (httpClientError) => 'applicationError' in\n (httpClientError.response?.data?.details ?? {});\nconst isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 &&\n (httpClientError.response?.status ?? -1) < 500;\nexport function transformError(httpClientError, pathsToArguments = {\n explicitPathsToArguments: {},\n spreadPathsToArguments: {},\n singleArgumentUnchanged: false,\n}, argumentNames = []) {\n if (typeof httpClientError !== 'object' || httpClientError === null) {\n throw httpClientError;\n }\n if (isValidationError(httpClientError)) {\n return buildValidationError(httpClientError, pathsToArguments, argumentNames);\n }\n if (isApplicationError(httpClientError)) {\n return buildApplicationError(httpClientError);\n }\n if (isClientError(httpClientError)) {\n const status = httpClientError.response?.status;\n const statusText = httpClientError.response?.statusText ?? 'UNKNOWN';\n const message = httpClientError.response?.data?.message ?? statusText;\n const details = {\n applicationError: {\n description: statusText,\n code: constantCase(statusText),\n data: {},\n },\n requestId: httpClientError.requestId,\n };\n return wrapError(httpClientError, {\n message: JSON.stringify({\n message,\n details,\n }, null, 2),\n extraProperties: {\n details,\n status,\n },\n });\n }\n return buildSystemError(httpClientError);\n}\nconst buildValidationError = (httpClientError, pathsToArguments, argumentNames) => {\n const validationErrorResponse = httpClientError.response\n ?.data;\n const requestId = httpClientError.requestId;\n const { fieldViolations } = validationErrorResponse.details.validationError;\n const transformedFieldViolations = violationsWithRenamedFields(pathsToArguments, fieldViolations, argumentNames)?.sort((a, b) => (a.field < b.field ? -1 : 1));\n const message = `INVALID_ARGUMENT: ${transformedFieldViolations\n ?.map(({ field, description }) => `\"${field}\" ${description}`)\n ?.join(', ')}`;\n const details = {\n validationError: { fieldViolations: transformedFieldViolations },\n requestId,\n };\n return wrapError(httpClientError, {\n message: JSON.stringify({ message, details }, null, 2),\n extraProperties: {\n details,\n status: httpClientError.response?.status,\n requestId,\n },\n });\n};\nconst wrapError = (baseError, { message, extraProperties, }) => {\n return Object.assign(baseError, {\n ...extraProperties,\n message,\n });\n};\nconst buildApplicationError = (httpClientError) => {\n const status = httpClientError.response?.status;\n const statusText = httpClientError.response?.statusText ?? 'UNKNOWN';\n const message = httpClientError.response?.data?.message ?? statusText;\n const description = httpClientError.response?.data?.details?.applicationError?.description ??\n statusText;\n const code = httpClientError.response?.data?.details?.applicationError?.code ??\n constantCase(statusText);\n const data = httpClientError.response?.data?.details?.applicationError?.data ?? {};\n const combinedMessage = message === description ? message : `${message}: ${description}`;\n const details = {\n applicationError: {\n description,\n code,\n data,\n },\n requestId: httpClientError.requestId,\n };\n return wrapError(httpClientError, {\n message: JSON.stringify({ message: combinedMessage, details }, null, 2),\n extraProperties: {\n details,\n status,\n requestId: httpClientError.requestId,\n },\n });\n};\nconst buildSystemError = (httpClientError) => {\n const message = httpClientError.requestId\n ? `System error occurred, request-id: ${httpClientError.requestId}`\n : `System error occurred: ${JSON.stringify(httpClientError)}`;\n return wrapError(httpClientError, {\n message,\n extraProperties: {\n requestId: httpClientError.requestId,\n status: httpClientError.response?.status,\n code: constantCase(httpClientError.response?.statusText ?? 'UNKNOWN'),\n ...(!httpClientError.response && {\n runtimeError: httpClientError,\n }),\n },\n });\n};\nconst violationsWithRenamedFields = ({ spreadPathsToArguments, explicitPathsToArguments, singleArgumentUnchanged, }, fieldViolations, argumentNames) => {\n const allPathsToArguments = {\n ...spreadPathsToArguments,\n ...explicitPathsToArguments,\n };\n const allPathsToArgumentsKeys = Object.keys(allPathsToArguments);\n return fieldViolations\n ?.filter((fieldViolation) => {\n // In some cases, the violations error will include both some.nested and some.nested.path,\n // so we'll pick the more specific one if it's covered by the paths in the transformation.\n const containedInAMoreSpecificViolationField = fieldViolations.some((anotherViolation) => anotherViolation.field.length > fieldViolation.field.length &&\n anotherViolation.field.startsWith(fieldViolation.field) &&\n allPathsToArgumentsKeys.includes(anotherViolation.field));\n return !containedInAMoreSpecificViolationField;\n })\n .map((fieldViolation) => {\n // This means we've got some.nested.field in the violation,\n // matched against { some: { nested: { field: $[0].a.b.c } } } in the transformation.\n // some.nested.field is replaced entirely with $[0].a.b.c, with $[0] replaced with the name of argument 0\n const exactMatchArgumentExpression = explicitPathsToArguments[fieldViolation.field];\n if (exactMatchArgumentExpression) {\n return {\n ...fieldViolation,\n field: withRenamedArgument(exactMatchArgumentExpression, argumentNames),\n };\n }\n const longestPartialPathMatch = allPathsToArgumentsKeys\n ?.sort((a, b) => b.length - a.length)\n ?.find((path) => fieldViolation.field.startsWith(path));\n if (longestPartialPathMatch) {\n // This means we've got some.nested.field in the violation,\n // matched against { some: { nested: { *: $[0].a.b.c } } } in the transformation.\n // Only the prefix some.nested is replaced with $[0].a.b.c, with $[0] replaced with the name of argument 0\n // This can also happen in the case where the #wrap function is used.\n const partialMatchArgumentExpression = allPathsToArguments[longestPartialPathMatch];\n if (partialMatchArgumentExpression) {\n return {\n ...fieldViolation,\n field: fieldViolation.field.replace(longestPartialPathMatch, withRenamedArgument(partialMatchArgumentExpression, argumentNames)),\n };\n }\n }\n if (singleArgumentUnchanged) {\n return {\n ...fieldViolation,\n field: `${argumentNames[0]}.${fieldViolation.field}`,\n };\n }\n return fieldViolation;\n });\n};\nconst withRenamedArgument = (fieldValue, argumentNames) => {\n const argIndex = getArgumentIndex(fieldValue);\n if (argIndex !== null && typeof argIndex !== 'undefined') {\n return fieldValue.replace(`$[${argIndex}]`, argumentNames[argIndex]);\n }\n return fieldValue;\n};\nconst getArgumentIndex = (s) => {\n const match = s.match(/\\$\\[(?<argIndex>\\d+)\\]/);\n return match && match.groups && Number(match.groups.argIndex);\n};\n","import { biHeaderGenerator } from './bi/biHeaderGenerator.js';\nimport { DEFAULT_API_URL, DEFAULT_EDGE_API_URL } from './common.js';\nimport { runWithoutContext } from '@wix/sdk-runtime/context';\nimport { transformError } from '@wix/sdk-runtime/transform-error';\nexport function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, errorHandler, wixAPIFetch, getActiveToken, getAuthHeaders, options, hostName, useCDN, validateRequestSchema) {\n return runWithoutContext(() => origFunc({\n request: async (factory) => {\n const requestOptions = factory({\n host: options?.HTTPHost || DEFAULT_API_URL,\n });\n let request = requestOptions;\n if (request.method === 'GET' &&\n request.fallback?.length &&\n (request.params?.toString().length ?? 0) > 4000) {\n request = requestOptions.fallback[0];\n }\n const domain = options?.HTTPHost ?? DEFAULT_API_URL;\n let url = `https://${useCDN ? DEFAULT_EDGE_API_URL : domain}${request.url}`;\n if (request.params && request.params.toString()) {\n url += `?${request.params.toString()}`;\n }\n try {\n const biHeader = biHeaderGenerator(requestOptions, publicMetadata, hostName);\n const requestOptionsInit = {\n method: request.method,\n ...(request.data && {\n body: JSON.stringify(request.data),\n }),\n headers: {\n ...biHeader,\n },\n };\n const res = await boundFetch(url, requestOptionsInit);\n if (res.status !== 200) {\n let dataError = null;\n try {\n dataError = await res.json();\n }\n catch (e) {\n //\n }\n const error = errorBuilder(res.status, dataError?.message ?? res.statusText, dataError?.details, {\n requestId: res.headers.get('X-Wix-Request-Id'),\n details: dataError,\n });\n const transformedError = transformError(error);\n errorHandler?.handleError(transformedError, {\n requestOptions: {\n url: request.url,\n method: request.method,\n entityFqdn: requestOptions.entityFqdn,\n methodFqn: requestOptions.methodFqn,\n },\n });\n throw error;\n }\n const rawData = await res.json();\n const data = \n // we only transform the response if the optInTransformResponse flag is set\n // this is for backwards compatibility as some users might rely on not transforming the response\n // in older modules. In that case the modules would not have the optInTransformResponse flag set\n request.migrationOptions?.optInTransformResponse &&\n request.transformResponse\n ? Array.isArray(request.transformResponse)\n ? request.transformResponse[0](rawData)\n : request.transformResponse(rawData)\n : rawData;\n return {\n data,\n headers: res.headers,\n status: res.status,\n statusText: res.statusText,\n };\n }\n catch (e) {\n if (e.message?.includes('fetch is not defined')) {\n console.error('Node.js v18+ is required');\n }\n throw e;\n }\n },\n fetchWithAuth: boundFetch,\n wixAPIFetch,\n getActiveToken,\n getAuthHeaders,\n }, { validateRequestSchema }));\n}\nclass SDKError extends Error {\n response;\n requestId;\n constructor(params) {\n super();\n this.response = params.response;\n this.requestId = params.requestId;\n }\n}\nconst errorBuilder = (code, description, details, data) => {\n return new SDKError({\n response: {\n data: {\n details: {\n ...(!details?.validationError && {\n applicationError: {\n description,\n code,\n data,\n },\n }),\n ...details,\n },\n message: description,\n },\n status: code,\n },\n requestId: data?.requestId,\n });\n};\n","const DELIMITER = '.';\nexport function set(obj, path, value) {\n if (obj == null) {\n throw new Error('Cannot set value on null or undefined');\n }\n const keys = toPathObject(path);\n let current = obj;\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n // Last key → assign value\n if (i === keys.length - 1) {\n current[key] = value;\n break;\n }\n // Create object or array if missing\n const nextKey = keys[i + 1];\n if (!(key in current) || current[key] == null) {\n current[key] = typeof nextKey === 'number' ? [] : {};\n }\n else if (typeof current[key] !== 'object' || current[key] === null) {\n // Overwrite non-object values\n current[key] = typeof nextKey === 'number' ? [] : {};\n }\n current = current[key];\n }\n return obj;\n}\nexport function toPathObject(path) {\n if (Array.isArray(path)) {\n return path;\n }\n return path\n .split(DELIMITER)\n .map((segment) => (isNumericSegment(segment) ? Number(segment) : segment));\n}\nfunction isNumericSegment(segment) {\n return /^\\d+$/.test(segment);\n}\n","import { set, toPathObject } from './object-utils.js';\nexport function unflatten(flatObject) {\n const result = {};\n for (const [flatKey, value] of Object.entries(flatObject)) {\n // Skip prototype pollution keys\n if (isPrototypePollutionKey(flatKey)) {\n continue;\n }\n const path = toPathObject(flatKey);\n set(result, path, value);\n }\n return result;\n}\nfunction isPrototypePollutionKey(key) {\n return key === '__proto__' || key === 'constructor' || key === 'prototype';\n}\n","import { RESTResponseToSDKResponseRenameMap } from '@wix/sdk-runtime/rest-modules';\nimport { unflatten } from './flat-utils.js';\nexport class ModifiedFieldsManipulator {\n BRACKET_PATTERN = /\\[(\\d+)\\]/g;\n NUMERIC_PATTERN = /^\\d+$/;\n ESCAPED_DOT_PATTERN = /\\\\\\./g;\n ESCAPED_LEFT_BRACKET_PATTERN = /\\\\\\[/g;\n ESCAPED_RIGHT_BRACKET_PATTERN = /\\\\\\]/g;\n SPLIT_PATTERN = /\\.|\\[(\\d+)\\]/g;\n DOT_BEFORE_BRACKET_PATTERN = /\\.\\[/g;\n ESCAPED_DOT_PLACEHOLDER = '__DOT__';\n ESCAPED_RIGHT_BRACKET_PLACEHOLDER = '__RB__';\n ESCAPED_LEFT_BRACKET_PLACEHOLDER = '__LB__';\n modifiedFields;\n cleanedModifiedFields;\n constructor(modifiedFields) {\n this.modifiedFields = modifiedFields;\n }\n replaceEscapedCharacters(key) {\n return key\n .replace(this.ESCAPED_DOT_PATTERN, this.ESCAPED_DOT_PLACEHOLDER)\n .replace(this.ESCAPED_LEFT_BRACKET_PATTERN, this.ESCAPED_LEFT_BRACKET_PLACEHOLDER)\n .replace(this.ESCAPED_RIGHT_BRACKET_PATTERN, this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER);\n }\n restoreEscapedCharacters(key) {\n return key\n .replace(this.ESCAPED_DOT_PLACEHOLDER, '\\\\.')\n .replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, '\\\\]')\n .replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, '\\\\[');\n }\n unflatten() {\n this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([key, value]) => [\n this.replaceEscapedCharacters(this.bracketToDotNotation(key)),\n value,\n ]));\n return unflatten(this.cleanedModifiedFields);\n }\n flatten(transformedModifiedFields) {\n let result = {};\n for (const originalKey of Object.keys(this.cleanedModifiedFields)) {\n const pathParts = this.splitPath(originalKey);\n const value = this.navigatePath(transformedModifiedFields, pathParts);\n result = { ...result, ...value };\n }\n return Object.fromEntries(Object.entries(result).map(([key, value]) => [\n this.restoreEscapedCharacters(key),\n value,\n ]));\n }\n splitPath(path) {\n const parts = [];\n let lastIndex = 0;\n const matches = Array.from(path.matchAll(this.SPLIT_PATTERN));\n for (const match of matches) {\n if (match.index > lastIndex) {\n parts.push(path.substring(lastIndex, match.index));\n }\n if (match[1]) {\n parts.push(match[1]);\n }\n lastIndex = match.index + match[0].length;\n }\n if (lastIndex < path.length) {\n parts.push(path.substring(lastIndex));\n }\n return parts;\n }\n navigatePath(obj, pathParts) {\n let current = obj;\n const transformedPath = [];\n const handleArray = (part) => {\n if (!Array.isArray(current)) {\n throw new Error(`Expected array at path ${this.buildPathString(transformedPath)}, but got ${typeof current}`);\n }\n transformedPath.push(`[${part}]`);\n current = current[parseInt(part, 10)];\n };\n const handleTransformedKeyName = (part, currentObj) => {\n const transformedKey = part in RESTResponseToSDKResponseRenameMap\n ? RESTResponseToSDKResponseRenameMap[part]\n : undefined;\n if (transformedKey && transformedKey in currentObj) {\n transformedPath.push(transformedKey);\n current = currentObj[transformedKey];\n return;\n }\n const camelCaseKey = camelCase(part);\n if (camelCaseKey && camelCaseKey in currentObj) {\n transformedPath.push(camelCaseKey);\n current = currentObj[camelCaseKey];\n return;\n }\n throw new Error(`Cannot find key '${part}' or its transformations at path ${this.buildPathString(transformedPath)}`);\n };\n const handleObject = (part, currentObj) => {\n transformedPath.push(part);\n current = currentObj[part];\n return;\n };\n for (const part of pathParts) {\n if (this.NUMERIC_PATTERN.test(part)) {\n handleArray(part);\n continue;\n }\n if (current === null || typeof current !== 'object') {\n throw new Error(`Cannot access property '${part}' on ${typeof current} at path ${this.buildPathString(transformedPath)}`);\n }\n const currentObj = current;\n if (part in current) {\n handleObject(part, currentObj);\n continue;\n }\n handleTransformedKeyName(part, currentObj);\n }\n return { [this.buildPathString(transformedPath)]: current };\n }\n buildPathString(pathParts) {\n return pathParts.join('.').replace(this.DOT_BEFORE_BRACKET_PATTERN, '[');\n }\n bracketToDotNotation(key) {\n return key.replace(this.BRACKET_PATTERN, (match, number, offset) => {\n if (offset > 0 && key[offset - 1] === '\\\\') {\n return match;\n }\n return '.' + number;\n });\n }\n}\n/**\n * Transforms an envelope while preserving the structure of modifiedFields.\n *\n * Modified fields come as flattened objects, while transformations are applied to the nested object (e.g. \"a.b.c\" -> { a: { b: { c: 'value' } } }).\n * This function handles the transformation of envelopes that contain flattened modifiedFields.\n * It unflattens the modifiedFields, applies the transformation function, and then flattens\n * the modifiedFields back to their original format while preserving the transformation.\n * @param envelope - The envelope object containing flattened modifiedFields\n * @param transformFromRESTFn - Function to transform the envelope from REST format to SDK format\n * @returns The transformed envelope with flattened modifiedFields, or null if transformation fails\n */\nexport function attemptTransformationWithModifiedFields(envelope, transformFromRESTFn) {\n const modifiedFields = envelope?.modifiedFields;\n if (!modifiedFields) {\n return null;\n }\n const unflattenedResult = attemptUnflatten(modifiedFields);\n if (!unflattenedResult) {\n return null;\n }\n const { unflattenedModifiedFields, modifiedFieldsManipulator } = unflattenedResult;\n envelope = {\n ...envelope,\n modifiedFields: unflattenedModifiedFields,\n };\n const transformedEnvelope = transformFromRESTFn(envelope);\n const transformedModifiedFields = transformedEnvelope\n ?.modifiedFields;\n if (!transformedModifiedFields) {\n return null;\n }\n const flattened = attemptFlatten(transformedModifiedFields, modifiedFieldsManipulator);\n if (flattened !== null) {\n transformedEnvelope.modifiedFields = flattened;\n return transformedEnvelope;\n }\n return null;\n}\nfunction attemptUnflatten(modifiedFields) {\n if (typeof modifiedFields === 'object' &&\n modifiedFields !== null &&\n !Array.isArray(modifiedFields)) {\n try {\n const modifiedFieldsManipulator = new ModifiedFieldsManipulator(modifiedFields);\n const unflattened = modifiedFieldsManipulator.unflatten();\n return {\n unflattenedModifiedFields: unflattened,\n modifiedFieldsManipulator,\n };\n }\n catch (error) {\n return null;\n }\n }\n return null;\n}\nfunction attemptFlatten(transformedModifiedFields, modifiedFieldsManipulator) {\n if (typeof transformedModifiedFields === 'object' &&\n transformedModifiedFields !== null &&\n !Array.isArray(transformedModifiedFields)) {\n try {\n const flattened = modifiedFieldsManipulator.flatten(transformedModifiedFields);\n return flattened;\n }\n catch (error) {\n return null;\n }\n }\n return null;\n}\n// Simple camelCase implementation to avoid lodash (which uses `new Function()` internally\n// and breaks Cloudflare Workers/Edge runtimes)\nfunction camelCase(str) {\n return str\n .replace(/[-_\\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\n .replace(/^./, (c) => c.toLowerCase());\n}\n","// Inlined from https://github.com/ai/nanoevents/blob/main/index.js\n/**\n * Create event emitter.\n *\n * ```js\n * import { createNanoEvents } from 'nanoevents'\n *\n * class Ticker {\n * constructor() {\n * this.emitter = createNanoEvents()\n * }\n * on(...args) {\n * return this.emitter.on(...args)\n * }\n * tick() {\n * this.emitter.emit('tick')\n * }\n * }\n * ```\n * @returns Event emitter.\n */\nexport function createNanoEvents() {\n return {\n emit(event, ...args) {\n for (let i = 0, callbacks = this.events[event] || [], length = callbacks.length; i < length; i++) {\n callbacks[i](...args);\n }\n },\n events: {},\n on(event, cb) {\n (this.events[event] ||= []).push(cb);\n return () => {\n this.events[event] = this.events[event]?.filter((i) => cb !== i);\n };\n },\n };\n}\n","import { EventDefinition, } from '@wix/sdk-types';\nimport { attemptTransformationWithModifiedFields } from './modified-fields-manipulator.js';\nimport { createNanoEvents } from './nanoevents.js';\nexport const isEventHandlerModule = (val) => val.__type === 'event-definition';\nexport function buildEventDefinition(eventDefinition, registerHandler) {\n return (handler) => {\n registerHandler(eventDefinition, handler);\n };\n}\nfunction runHandler(eventDefinition, handler, payload, baseEventMetadata) {\n let envelope;\n if (eventDefinition.isDomainEvent) {\n const domainEventPayload = payload;\n const { deletedEvent, actionEvent, createdEvent, updatedEvent, ...domainEventMetadata } = domainEventPayload;\n const metadata = {\n ...baseEventMetadata,\n ...domainEventMetadata,\n };\n if (deletedEvent) {\n if (deletedEvent?.deletedEntity) {\n envelope = {\n entity: deletedEvent?.deletedEntity,\n metadata,\n };\n }\n else {\n envelope = { metadata };\n }\n }\n else if (actionEvent) {\n envelope = {\n data: actionEvent.body,\n metadata,\n };\n }\n else if (updatedEvent) {\n envelope = {\n entity: updatedEvent.currentEntity,\n metadata,\n ...(updatedEvent.modifiedFields\n ? { modifiedFields: updatedEvent.modifiedFields }\n : {}),\n };\n }\n else {\n // createdEvent\n envelope = {\n entity: createdEvent?.entity,\n metadata,\n };\n }\n }\n else {\n envelope = {\n data: payload,\n metadata: baseEventMetadata,\n };\n }\n const transformFromRESTFn = eventDefinition.transformations ?? ((x) => x);\n let originalEnvelope = envelope;\n const envelopeAny = envelope;\n if (envelopeAny.modifiedFields) {\n const modifiedFieldsValue = envelopeAny.modifiedFields;\n if (typeof modifiedFieldsValue === 'object' &&\n modifiedFieldsValue !== null &&\n !Array.isArray(modifiedFieldsValue)) {\n originalEnvelope = structuredClone(envelope);\n const transformedEnvelope = attemptTransformationWithModifiedFields(envelopeAny, transformFromRESTFn);\n if (transformedEnvelope) {\n return handler(transformedEnvelope);\n }\n }\n }\n return handler(transformFromRESTFn(originalEnvelope));\n}\nexport function eventHandlersModules(getAuthStrategy) {\n const eventHandlers = new Map();\n const webhooksEmitter = createNanoEvents();\n const client = {\n ...webhooksEmitter,\n getRegisteredEvents: () => eventHandlers,\n async process(jwt, opts = {\n expectedEvents: [],\n }) {\n const { eventType, identity, instanceId, payload, accountInfo } = await this.parseJWT(jwt);\n const allExpectedEvents = [\n ...opts.expectedEvents,\n ...Array.from(eventHandlers.keys()).map((type) => ({ type })),\n ];\n if (allExpectedEvents.length > 0 &&\n !allExpectedEvents.some(({ type }) => type === eventType)) {\n throw new Error(`Unexpected event type: ${eventType}. Expected one of: ${allExpectedEvents\n .map((x) => x.type)\n .join(', ')}`);\n }\n const handlers = eventHandlers.get(eventType) ?? [];\n await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, payload, {\n instanceId,\n identity,\n accountInfo,\n })));\n return {\n instanceId,\n eventType,\n payload,\n identity,\n accountInfo,\n };\n },\n async processRequest(request, opts) {\n const body = await request.text();\n return this.process(body, opts);\n },\n async parseJWT(jwt) {\n const authStrategy = getAuthStrategy();\n if (!authStrategy.decodeJWT) {\n throw new Error('decodeJWT is not supported by the authentication strategy');\n }\n const { decoded, valid } = await authStrategy.decodeJWT(jwt);\n if (!valid) {\n throw new Error('JWT is not valid');\n }\n if (typeof decoded.data !== 'string') {\n throw new Error(`Unexpected type of JWT data: expected string, got ${typeof decoded.data}`);\n }\n const parsedDecoded = JSON.parse(decoded.data);\n const eventType = parsedDecoded.eventType;\n const accountInfo = parsedDecoded.accountInfo;\n const instanceId = parsedDecoded.instanceId;\n const identity = parsedDecoded.identity\n ? JSON.parse(parsedDecoded.identity)\n : undefined;\n const payload = JSON.parse(parsedDecoded.data);\n return {\n instanceId,\n eventType,\n payload,\n identity,\n accountInfo,\n };\n },\n async parseRequest(request) {\n const jwt = await request.text();\n return this.parseJWT(jwt);\n },\n async executeHandlers(event) {\n const allExpectedEvents = Array.from(eventHandlers.keys()).map((type) => ({ type }));\n if (allExpectedEvents.length > 0 &&\n !allExpectedEvents.some(({ type }) => type === event.eventType)) {\n throw new Error(`Unexpected event type: ${event.eventType}. Expected one of: ${allExpectedEvents\n .map((x) => x.type)\n .join(', ')}`);\n }\n const handlers = eventHandlers.get(event.eventType) ?? [];\n await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, event.payload, {\n instanceId: event.instanceId,\n identity: event.identity,\n })));\n },\n apps: {\n AppInstalled: EventDefinition('AppInstalled')(),\n AppRemoved: EventDefinition('AppRemoved')(),\n },\n };\n return {\n initModule(eventDefinition) {\n return (handler) => {\n const handlers = eventHandlers.get(eventDefinition.type) ?? [];\n handlers.push({ eventDefinition, handler });\n eventHandlers.set(eventDefinition.type, handlers);\n webhooksEmitter.emit('registered', eventDefinition);\n };\n },\n client,\n };\n}\n","import { createNanoEvents } from './nanoevents.js';\nexport const isServicePluginModule = (val) => val.__type === 'service-plugin-definition';\nexport function servicePluginsModules(getAuthStrategy) {\n const servicePluginsImplementations = new Map();\n const servicePluginsEmitter = createNanoEvents();\n const client = {\n ...servicePluginsEmitter,\n getRegisteredServicePlugins: () => servicePluginsImplementations,\n async parseJWT(jwt) {\n const authStrategy = getAuthStrategy();\n if (!authStrategy.decodeJWT) {\n throw new Error('decodeJWT is not supported by the authentication strategy');\n }\n const { decoded, valid } = await authStrategy.decodeJWT(jwt, true);\n if (!valid) {\n throw new Error('JWT is not valid');\n }\n if (typeof decoded.data !== 'object' ||\n decoded.data === null ||\n !('metadata' in decoded.data) ||\n typeof decoded.data.metadata !== 'object' ||\n decoded.data.metadata === null ||\n !('appExtensionType' in decoded.data.metadata) ||\n typeof decoded.data.metadata.appExtensionType !== 'string') {\n throw new Error('Unexpected JWT data: expected object with metadata.appExtensionType string');\n }\n return decoded.data;\n },\n async process(request) {\n const servicePluginRequest = await this.parseJWT(request.body);\n return this.executeHandler(servicePluginRequest, request.url);\n },\n async parseRequest(request) {\n const body = await request.text();\n return this.parseJWT(body);\n },\n async processRequest(request) {\n const url = request.url;\n const body = await request.text();\n try {\n const implMethodResult = await this.process({ url, body });\n return Response.json(implMethodResult);\n }\n catch (err) {\n if (err.errorType === 'SPI' && err.applicationCode && err.httpCode) {\n return Response.json({ applicationError: { code: err.applicationCode, data: err.data } }, { status: err.httpCode });\n }\n throw err;\n }\n },\n async executeHandler(servicePluginRequest, url) {\n const componentType = servicePluginRequest.metadata.appExtensionType.toLowerCase();\n const implementations = servicePluginsImplementations.get(componentType) ?? [];\n if (implementations.length === 0) {\n throw new Error(`No service plugin implementations found for component type ${componentType}`);\n }\n else if (implementations.length > 1) {\n throw new Error(`Multiple service plugin implementations found for component type ${componentType}. This is currently not supported`);\n }\n const { implementation: impl, servicePluginDefinition } = implementations[0];\n const method = servicePluginDefinition.methods.find((m) => url.endsWith(m.primaryHttpMappingPath));\n if (!method) {\n throw new Error('Unexpect request: request url did not match any method: ' + url);\n }\n const implMethod = impl[method.name];\n if (!implMethod) {\n throw new Error(`Got request for service plugin method ${method.name} but no implementation was provided. Available methods: ${Object.keys(impl).join(', ')}`);\n }\n return method.transformations.toREST(await implMethod(method.transformations.fromREST(servicePluginRequest)));\n },\n };\n return {\n initModule(servicePluginDefinition) {\n return (implementation) => {\n const implementations = servicePluginsImplementations.get(servicePluginDefinition.componentType.toLowerCase()) ?? [];\n implementations.push({ servicePluginDefinition, implementation });\n servicePluginsImplementations.set(servicePluginDefinition.componentType.toLowerCase(), implementations);\n servicePluginsEmitter.emit('registered', servicePluginDefinition);\n };\n },\n client,\n };\n}\n"],"mappings":"qGAAA,OAAS,cAAAA,OA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,OAAQ,OACR,QAAS,CACL,eAAgB,kBACpB,EACA,KAAM,KAAK,UAAU,CAAE,MAAAE,EAAO,UAAAC,CAAU,CAAC,CAC7C,CAAC,EACD,GAAIC,EAAI,SAAW,IACf,MAAM,IAAIC,EAAmB,sCAAsCD,EAAI,MAAM,GAAIA,CAAG,EAExF,GAAM,CAAE,KAAAE,EAAM,OAAAC,CAAO,EAAI,MAAMH,EAAI,KAAK,EACxC,MAAO,CAAE,KAAME,GAAQ,CAAC,EAAG,OAAAC,CAAO,CACtC,EACA,SAAUzC,EACV,eAAgBH,CACpB,CACJ,CACA,SAASJ,EAAqBF,EAAU,CACpC,OAAQA,EAAS,SAAS,IAAIjB,CAAuB,GACjDiB,EAAS,SAAS,IAAIjB,EAAwB,YAAY,CAAC,CACnE","names":["wixContext","parseMethod","method","toHTTPModule","factory","httpClient","payload","requestOptions","HTTPFactory","context","url","params","response","transformations","data","transform","e","isAmbassadorModule","module","PUBLIC_METADATA_KEY","DEFAULT_API_URL","DEFAULT_EDGE_API_URL","FetchErrorResponse","message","response","__publicField","dataError","errorBuilder","code","description","details","data","getDefaultContentHeader","options","isObject","val","isHostModule","val","buildHostModule","host","WixBIHeaderName","biHeaderGenerator","apiMetadata","publicMetadata","environment","objectToKeyValue","input","_","value","key","constantCase","input","split","part","SPLIT_LOWER_UPPER_RE","SPLIT_UPPER_UPPER_RE","SPLIT_REPLACE_VALUE","DEFAULT_STRIP_REGEXP","value","result","start","end","isValidationError","httpClientError","isApplicationError","isClientError","transformError","pathsToArguments","argumentNames","buildValidationError","buildApplicationError","status","statusText","message","details","constantCase","wrapError","buildSystemError","validationErrorResponse","requestId","fieldViolations","transformedFieldViolations","violationsWithRenamedFields","a","b","field","description","baseError","extraProperties","code","data","combinedMessage","spreadPathsToArguments","explicitPathsToArguments","singleArgumentUnchanged","allPathsToArguments","allPathsToArgumentsKeys","fieldViolation","anotherViolation","exactMatchArgumentExpression","withRenamedArgument","longestPartialPathMatch","path","partialMatchArgumentExpression","fieldValue","argIndex","getArgumentIndex","s","match","buildRESTDescriptor","origFunc","publicMetadata","boundFetch","errorHandler","wixAPIFetch","getActiveToken","getAuthHeaders","options","hostName","useCDN","validateRequestSchema","runWithoutContext","factory","requestOptions","DEFAULT_API_URL","request","domain","url","DEFAULT_EDGE_API_URL","biHeader","biHeaderGenerator","requestOptionsInit","res","dataError","error","errorBuilder","transformedError","transformError","rawData","e","SDKError","params","__publicField","code","description","details","data","DELIMITER","set","obj","path","value","keys","toPathObject","current","i","key","nextKey","segment","isNumericSegment","unflatten","flatObject","result","flatKey","value","isPrototypePollutionKey","path","toPathObject","set","key","ModifiedFieldsManipulator","modifiedFields","__publicField","key","value","unflatten","transformedModifiedFields","result","originalKey","pathParts","path","parts","lastIndex","matches","match","obj","current","transformedPath","handleArray","part","handleTransformedKeyName","currentObj","transformedKey","RESTResponseToSDKResponseRenameMap","camelCaseKey","camelCase","handleObject","number","offset","attemptTransformationWithModifiedFields","envelope","transformFromRESTFn","unflattenedResult","attemptUnflatten","unflattenedModifiedFields","modifiedFieldsManipulator","transformedEnvelope","flattened","attemptFlatten","str","_","c","createNanoEvents","event","args","i","callbacks","length","cb","isEventHandlerModule","val","runHandler","eventDefinition","handler","payload","baseEventMetadata","envelope","domainEventPayload","deletedEvent","actionEvent","createdEvent","updatedEvent","domainEventMetadata","metadata","transformFromRESTFn","x","originalEnvelope","envelopeAny","modifiedFieldsValue","transformedEnvelope","attemptTransformationWithModifiedFields","eventHandlersModules","getAuthStrategy","eventHandlers","webhooksEmitter","createNanoEvents","client","jwt","opts","eventType","identity","instanceId","accountInfo","allExpectedEvents","type","handlers","request","body","authStrategy","decoded","valid","parsedDecoded","event","EventDefinition","isServicePluginModule","val","servicePluginsModules","getAuthStrategy","servicePluginsImplementations","servicePluginsEmitter","createNanoEvents","client","jwt","authStrategy","decoded","valid","request","servicePluginRequest","body","url","implMethodResult","err","componentType","implementations","impl","servicePluginDefinition","method","m","implMethod","implementation","X_WIX_CONSISTENT_HEADER","createClient","config","_headers","defaultStrategy","_","auth","getAuthStrategy","boundGetAuthHeaders","getFetchFn","fetchWithAuth","urlOrRequest","requestInit","fetch","authHeaders","headers","errorHandler","response","consistentHeader","findConsistentHeader","k","v","e","servicePluginsClient","initServicePluginModule","servicePluginsModules","eventHandlersClient","initEventHandlerModule","eventHandlersModules","boundFetch","url","options","defaultContentTypeHeader","getDefaultContentHeader","use","modules","metadata","isEventHandlerModule","isServicePluginModule","isHostModule","buildHostModule","SERVICE_PLUGIN_ERROR_TYPE","apiBaseUrl","DEFAULT_API_URL","shouldUseCDN","buildRESTDescriptor","runWithoutContext","isAmbassadorModule","toHTTPModule","relativeUrl","fetchOptions","finalUrl","isObject","key","value","PUBLIC_METADATA_KEY","setHeaders","authStrategy","originalGetAuthHeaders","contextType","opts","wixContext","query","variables","res","FetchErrorResponse","data","errors"]}