@wix/cli-app 1.1.106 → 1.1.108

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 (86) hide show
  1. package/build/{AddPermissionCommand-QEKDCRQW.js → AddPermissionCommand-W3TQTL3X.js} +2 -2
  2. package/build/{DevCommand-736A5TG3.js → DevCommand-3HZJQQIQ.js} +10 -10
  3. package/build/{DevCommand-736A5TG3.js.map → DevCommand-3HZJQQIQ.js.map} +1 -1
  4. package/build/{GenerateCommand-F6WNIVZH.js → GenerateCommand-UQ3JHQTJ.js} +47 -8
  5. package/build/GenerateCommand-UQ3JHQTJ.js.map +1 -0
  6. package/build/{LogsCommand-POFQ7L7U.js → LogsCommand-JHADSYUE.js} +3 -3
  7. package/build/PreviewCommand-WBQRDP7K.js +19 -0
  8. package/build/ReleaseCommand-3KDJB3KZ.js +23 -0
  9. package/build/{ServeCommand-LLCIQQ4X.js → ServeCommand-IPKP6PJ2.js} +3 -3
  10. package/build/{build-HZ5SXQHP.js → build-LZ3CJXNM.js} +6 -6
  11. package/build/{chunk-2X5STX6V.js → chunk-6OQZW27N.js} +8 -2
  12. package/build/{chunk-2X5STX6V.js.map → chunk-6OQZW27N.js.map} +1 -1
  13. package/build/{chunk-VDPMGGS6.js → chunk-7KESMWRI.js} +13 -7
  14. package/build/{chunk-VDPMGGS6.js.map → chunk-7KESMWRI.js.map} +1 -1
  15. package/build/{chunk-NWQVBGCX.js → chunk-BER5YRAG.js} +2 -2
  16. package/build/{chunk-XPAQVBEL.js → chunk-FO7ABKNR.js} +3 -3
  17. package/build/{chunk-BINOF7AQ.js → chunk-HAUIN5OS.js} +36 -60
  18. package/build/chunk-HAUIN5OS.js.map +1 -0
  19. package/build/{chunk-FWWBKP43.js → chunk-IGC7QYU5.js} +2 -2
  20. package/build/{chunk-BFLRYBN2.js → chunk-LOVLYP4H.js} +5 -5
  21. package/build/{chunk-VMKXYUIA.js → chunk-LWOWN5OI.js} +5 -5
  22. package/build/{chunk-7QAX4LBK.js → chunk-MAZMH6ES.js} +6 -6
  23. package/build/{chunk-G32WRBNI.js → chunk-OKHXUGGH.js} +2 -2
  24. package/build/{chunk-T5HHDBBR.js → chunk-PBROWK34.js} +8 -2
  25. package/build/{chunk-T5HHDBBR.js.map → chunk-PBROWK34.js.map} +1 -1
  26. package/build/{chunk-7JLHWVDX.js → chunk-PFAJ5ETM.js} +2 -2
  27. package/build/{chunk-XW5CZ6RF.js → chunk-RDXTHRJ4.js} +14 -2
  28. package/build/{chunk-XW5CZ6RF.js.map → chunk-RDXTHRJ4.js.map} +1 -1
  29. package/build/{chunk-4TQGXVYE.js → chunk-UEUJOHB4.js} +3 -3
  30. package/build/{chunk-4IYY6ZGZ.js → chunk-UN2TQTOP.js} +375 -200
  31. package/build/chunk-UN2TQTOP.js.map +1 -0
  32. package/build/{chunk-5Y7LGHZ6.js → chunk-UPQ6AZFY.js} +2 -2
  33. package/build/{chunk-E6VEU7TV.js → chunk-W5SE5OVE.js} +210 -334
  34. package/build/{chunk-E6VEU7TV.js.map → chunk-W5SE5OVE.js.map} +1 -1
  35. package/build/{chunk-PEMPZ5MM.js → chunk-Z4NG6X6T.js} +2 -2
  36. package/build/cloudflare-runtime/entry.js +256 -32
  37. package/build/cloudflare-runtime/getRegisteredExtensions.js +252 -28
  38. package/build/index.js +24 -24
  39. package/build/platform-sdk/chunk-J3SVE4GM.js +2 -0
  40. package/build/platform-sdk/chunk-J3SVE4GM.js.map +1 -0
  41. package/build/platform-sdk/chunk-J7RIIVO6.js +2 -0
  42. package/build/platform-sdk/chunk-J7RIIVO6.js.map +1 -0
  43. package/build/platform-sdk/chunk-RHDUKNAJ.js +2 -0
  44. package/build/platform-sdk/chunk-RHDUKNAJ.js.map +1 -0
  45. package/build/platform-sdk/dashboard.js +1 -1
  46. package/build/platform-sdk/dashboard.js.map +1 -1
  47. package/build/platform-sdk/editor.js +2 -2
  48. package/build/platform-sdk/editor.js.map +1 -1
  49. package/build/platform-sdk/sdk-context.js +1 -1
  50. package/build/platform-sdk/sdk-context.js.map +1 -1
  51. package/build/platform-sdk/site.js +1 -1
  52. package/build/{preview-R6YTZ7DV.js → preview-OVNN2RP4.js} +13 -13
  53. package/build/{release-IJJ3EB2C.js → release-OMLRH2VC.js} +15 -15
  54. package/build/{render-command-FJOPHPRO.js → render-command-DIMIKL4B.js} +6 -6
  55. package/package.json +6 -6
  56. package/build/GenerateCommand-F6WNIVZH.js.map +0 -1
  57. package/build/PreviewCommand-DGVLJIC5.js +0 -19
  58. package/build/ReleaseCommand-BK665XSD.js +0 -23
  59. package/build/chunk-4IYY6ZGZ.js.map +0 -1
  60. package/build/chunk-BINOF7AQ.js.map +0 -1
  61. package/build/platform-sdk/chunk-BBFFXVJD.js +0 -2
  62. package/build/platform-sdk/chunk-BBFFXVJD.js.map +0 -1
  63. package/build/platform-sdk/chunk-MAZR75DI.js +0 -2
  64. package/build/platform-sdk/chunk-MAZR75DI.js.map +0 -1
  65. package/build/platform-sdk/chunk-NHYZDMR5.js +0 -2
  66. package/build/platform-sdk/chunk-NHYZDMR5.js.map +0 -1
  67. /package/build/{AddPermissionCommand-QEKDCRQW.js.map → AddPermissionCommand-W3TQTL3X.js.map} +0 -0
  68. /package/build/{LogsCommand-POFQ7L7U.js.map → LogsCommand-JHADSYUE.js.map} +0 -0
  69. /package/build/{PreviewCommand-DGVLJIC5.js.map → PreviewCommand-WBQRDP7K.js.map} +0 -0
  70. /package/build/{ReleaseCommand-BK665XSD.js.map → ReleaseCommand-3KDJB3KZ.js.map} +0 -0
  71. /package/build/{ServeCommand-LLCIQQ4X.js.map → ServeCommand-IPKP6PJ2.js.map} +0 -0
  72. /package/build/{build-HZ5SXQHP.js.map → build-LZ3CJXNM.js.map} +0 -0
  73. /package/build/{chunk-NWQVBGCX.js.map → chunk-BER5YRAG.js.map} +0 -0
  74. /package/build/{chunk-XPAQVBEL.js.map → chunk-FO7ABKNR.js.map} +0 -0
  75. /package/build/{chunk-FWWBKP43.js.map → chunk-IGC7QYU5.js.map} +0 -0
  76. /package/build/{chunk-BFLRYBN2.js.map → chunk-LOVLYP4H.js.map} +0 -0
  77. /package/build/{chunk-VMKXYUIA.js.map → chunk-LWOWN5OI.js.map} +0 -0
  78. /package/build/{chunk-7QAX4LBK.js.map → chunk-MAZMH6ES.js.map} +0 -0
  79. /package/build/{chunk-G32WRBNI.js.map → chunk-OKHXUGGH.js.map} +0 -0
  80. /package/build/{chunk-7JLHWVDX.js.map → chunk-PFAJ5ETM.js.map} +0 -0
  81. /package/build/{chunk-4TQGXVYE.js.map → chunk-UEUJOHB4.js.map} +0 -0
  82. /package/build/{chunk-5Y7LGHZ6.js.map → chunk-UPQ6AZFY.js.map} +0 -0
  83. /package/build/{chunk-PEMPZ5MM.js.map → chunk-Z4NG6X6T.js.map} +0 -0
  84. /package/build/{preview-R6YTZ7DV.js.map → preview-OVNN2RP4.js.map} +0 -0
  85. /package/build/{release-IJJ3EB2C.js.map → release-OMLRH2VC.js.map} +0 -0
  86. /package/build/{render-command-FJOPHPRO.js.map → render-command-DIMIKL4B.js.map} +0 -0
@@ -15,7 +15,7 @@ import {
15
15
  useProjectModel,
16
16
  writePackageJson,
17
17
  z
18
- } from "./chunk-E6VEU7TV.js";
18
+ } from "./chunk-W5SE5OVE.js";
19
19
  import {
20
20
  __commonJS,
21
21
  __require,
@@ -9385,4 +9385,4 @@ ejs/lib/ejs.js:
9385
9385
  * @license {@link http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0}
9386
9386
  *)
9387
9387
  */
9388
- //# sourceMappingURL=chunk-PEMPZ5MM.js.map
9388
+ //# sourceMappingURL=chunk-Z4NG6X6T.js.map
@@ -4595,7 +4595,7 @@ function objectToKeyValue(input) {
4595
4595
  return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
4596
4596
  }
4597
4597
 
4598
- // ../../node_modules/@wix/sdk-runtime/build/context.js
4598
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
4599
4599
  function runWithoutContext(fn) {
4600
4600
  const globalContext = globalThis.__wix_context__;
4601
4601
  const moduleContext = {
@@ -4627,8 +4627,189 @@ function runWithoutContext(fn) {
4627
4627
  }
4628
4628
  }
4629
4629
 
4630
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/utils.js
4631
+ function constantCase(input) {
4632
+ return split(input).map((part) => part.toLocaleUpperCase()).join("_");
4633
+ }
4634
+ var SPLIT_LOWER_UPPER_RE = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu");
4635
+ var SPLIT_UPPER_UPPER_RE = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu");
4636
+ var SPLIT_REPLACE_VALUE = "$1\0$2";
4637
+ var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
4638
+ function split(value) {
4639
+ let result = value.trim();
4640
+ result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
4641
+ result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
4642
+ let start = 0;
4643
+ let end = result.length;
4644
+ while (result.charAt(start) === "\0") {
4645
+ start++;
4646
+ }
4647
+ if (start === end) {
4648
+ return [];
4649
+ }
4650
+ while (result.charAt(end - 1) === "\0") {
4651
+ end--;
4652
+ }
4653
+ return result.slice(start, end).split(/\0/g);
4654
+ }
4655
+
4656
+ // ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/transform-error.js
4657
+ var isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
4658
+ var isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
4659
+ var isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
4660
+ function transformError(httpClientError, pathsToArguments = {
4661
+ explicitPathsToArguments: {},
4662
+ spreadPathsToArguments: {},
4663
+ singleArgumentUnchanged: false
4664
+ }, argumentNames = []) {
4665
+ if (typeof httpClientError !== "object" || httpClientError === null) {
4666
+ throw httpClientError;
4667
+ }
4668
+ if (isValidationError(httpClientError)) {
4669
+ return buildValidationError(httpClientError, pathsToArguments, argumentNames);
4670
+ }
4671
+ if (isApplicationError(httpClientError)) {
4672
+ return buildApplicationError(httpClientError);
4673
+ }
4674
+ if (isClientError(httpClientError)) {
4675
+ const status = httpClientError.response?.status;
4676
+ const statusText = httpClientError.response?.statusText ?? "UNKNOWN";
4677
+ const message2 = httpClientError.response?.data?.message ?? statusText;
4678
+ const details = {
4679
+ applicationError: {
4680
+ description: statusText,
4681
+ code: constantCase(statusText),
4682
+ data: {}
4683
+ },
4684
+ requestId: httpClientError.requestId
4685
+ };
4686
+ return wrapError(httpClientError, {
4687
+ message: JSON.stringify({
4688
+ message: message2,
4689
+ details
4690
+ }, null, 2),
4691
+ extraProperties: {
4692
+ details,
4693
+ status
4694
+ }
4695
+ });
4696
+ }
4697
+ return buildSystemError(httpClientError);
4698
+ }
4699
+ var buildValidationError = (httpClientError, pathsToArguments, argumentNames) => {
4700
+ const validationErrorResponse = httpClientError.response?.data;
4701
+ const requestId = httpClientError.requestId;
4702
+ const { fieldViolations } = validationErrorResponse.details.validationError;
4703
+ const transformedFieldViolations = violationsWithRenamedFields(pathsToArguments, fieldViolations, argumentNames)?.sort((a, b) => a.field < b.field ? -1 : 1);
4704
+ const message2 = `INVALID_ARGUMENT: ${transformedFieldViolations?.map(({ field, description }) => `"${field}" ${description}`)?.join(", ")}`;
4705
+ const details = {
4706
+ validationError: { fieldViolations: transformedFieldViolations },
4707
+ requestId
4708
+ };
4709
+ return wrapError(httpClientError, {
4710
+ message: JSON.stringify({ message: message2, details }, null, 2),
4711
+ extraProperties: {
4712
+ details,
4713
+ status: httpClientError.response?.status,
4714
+ requestId
4715
+ }
4716
+ });
4717
+ };
4718
+ var wrapError = (baseError, { message: message2, extraProperties }) => {
4719
+ return Object.assign(baseError, {
4720
+ ...extraProperties,
4721
+ message: message2
4722
+ });
4723
+ };
4724
+ var buildApplicationError = (httpClientError) => {
4725
+ const status = httpClientError.response?.status;
4726
+ const statusText = httpClientError.response?.statusText ?? "UNKNOWN";
4727
+ const message2 = httpClientError.response?.data?.message ?? statusText;
4728
+ const description = httpClientError.response?.data?.details?.applicationError?.description ?? statusText;
4729
+ const code = httpClientError.response?.data?.details?.applicationError?.code ?? constantCase(statusText);
4730
+ const data = httpClientError.response?.data?.details?.applicationError?.data ?? {};
4731
+ const combinedMessage = message2 === description ? message2 : `${message2}: ${description}`;
4732
+ const details = {
4733
+ applicationError: {
4734
+ description,
4735
+ code,
4736
+ data
4737
+ },
4738
+ requestId: httpClientError.requestId
4739
+ };
4740
+ return wrapError(httpClientError, {
4741
+ message: JSON.stringify({ message: combinedMessage, details }, null, 2),
4742
+ extraProperties: {
4743
+ details,
4744
+ status,
4745
+ requestId: httpClientError.requestId
4746
+ }
4747
+ });
4748
+ };
4749
+ var buildSystemError = (httpClientError) => {
4750
+ const message2 = httpClientError.requestId ? `System error occurred, request-id: ${httpClientError.requestId}` : `System error occurred: ${JSON.stringify(httpClientError)}`;
4751
+ return wrapError(httpClientError, {
4752
+ message: message2,
4753
+ extraProperties: {
4754
+ requestId: httpClientError.requestId,
4755
+ status: httpClientError.response?.status,
4756
+ code: constantCase(httpClientError.response?.statusText ?? "UNKNOWN"),
4757
+ ...!httpClientError.response && {
4758
+ runtimeError: httpClientError
4759
+ }
4760
+ }
4761
+ });
4762
+ };
4763
+ var violationsWithRenamedFields = ({ spreadPathsToArguments, explicitPathsToArguments, singleArgumentUnchanged }, fieldViolations, argumentNames) => {
4764
+ const allPathsToArguments = {
4765
+ ...spreadPathsToArguments,
4766
+ ...explicitPathsToArguments
4767
+ };
4768
+ const allPathsToArgumentsKeys = Object.keys(allPathsToArguments);
4769
+ return fieldViolations?.filter((fieldViolation) => {
4770
+ const containedInAMoreSpecificViolationField = fieldViolations.some((anotherViolation) => anotherViolation.field.length > fieldViolation.field.length && anotherViolation.field.startsWith(fieldViolation.field) && allPathsToArgumentsKeys.includes(anotherViolation.field));
4771
+ return !containedInAMoreSpecificViolationField;
4772
+ }).map((fieldViolation) => {
4773
+ const exactMatchArgumentExpression = explicitPathsToArguments[fieldViolation.field];
4774
+ if (exactMatchArgumentExpression) {
4775
+ return {
4776
+ ...fieldViolation,
4777
+ field: withRenamedArgument(exactMatchArgumentExpression, argumentNames)
4778
+ };
4779
+ }
4780
+ const longestPartialPathMatch = allPathsToArgumentsKeys?.sort((a, b) => b.length - a.length)?.find((path) => fieldViolation.field.startsWith(path));
4781
+ if (longestPartialPathMatch) {
4782
+ const partialMatchArgumentExpression = allPathsToArguments[longestPartialPathMatch];
4783
+ if (partialMatchArgumentExpression) {
4784
+ return {
4785
+ ...fieldViolation,
4786
+ field: fieldViolation.field.replace(longestPartialPathMatch, withRenamedArgument(partialMatchArgumentExpression, argumentNames))
4787
+ };
4788
+ }
4789
+ }
4790
+ if (singleArgumentUnchanged) {
4791
+ return {
4792
+ ...fieldViolation,
4793
+ field: `${argumentNames[0]}.${fieldViolation.field}`
4794
+ };
4795
+ }
4796
+ return fieldViolation;
4797
+ });
4798
+ };
4799
+ var withRenamedArgument = (fieldValue, argumentNames) => {
4800
+ const argIndex = getArgumentIndex(fieldValue);
4801
+ if (argIndex !== null && typeof argIndex !== "undefined") {
4802
+ return fieldValue.replace(`$[${argIndex}]`, argumentNames[argIndex]);
4803
+ }
4804
+ return fieldValue;
4805
+ };
4806
+ var getArgumentIndex = (s) => {
4807
+ const match = s.match(/\$\[(?<argIndex>\d+)\]/);
4808
+ return match && match.groups && Number(match.groups.argIndex);
4809
+ };
4810
+
4630
4811
  // ../../node_modules/@wix/sdk/build/rest-modules.js
4631
- function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, getActiveToken, options, hostName, useCDN) {
4812
+ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, errorHandler, wixAPIFetch, getActiveToken, options, hostName, useCDN) {
4632
4813
  return runWithoutContext(() => origFunc({
4633
4814
  request: async (factory) => {
4634
4815
  const requestOptions = factory({
@@ -4645,7 +4826,7 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch,
4645
4826
  }
4646
4827
  try {
4647
4828
  const biHeader = biHeaderGenerator(requestOptions, publicMetadata, hostName);
4648
- const res = await boundFetch(url, {
4829
+ const requestOptionsInit = {
4649
4830
  method: request.method,
4650
4831
  ...request.data && {
4651
4832
  body: JSON.stringify(request.data)
@@ -4653,17 +4834,28 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch,
4653
4834
  headers: {
4654
4835
  ...biHeader
4655
4836
  }
4656
- });
4837
+ };
4838
+ const res = await boundFetch(url, requestOptionsInit);
4657
4839
  if (res.status !== 200) {
4658
4840
  let dataError = null;
4659
4841
  try {
4660
4842
  dataError = await res.json();
4661
4843
  } catch (e) {
4662
4844
  }
4663
- throw errorBuilder2(res.status, dataError?.message, dataError?.details, {
4845
+ const error = errorBuilder2(res.status, dataError?.message, dataError?.details, {
4664
4846
  requestId: res.headers.get("X-Wix-Request-Id"),
4665
4847
  details: dataError
4666
4848
  });
4849
+ const transformedError = transformError(error);
4850
+ errorHandler?.handleError(transformedError, {
4851
+ requestOptions: {
4852
+ url: request.url,
4853
+ method: request.method,
4854
+ entityFqdn: requestOptions.entityFqdn,
4855
+ methodFqn: requestOptions.methodFqn
4856
+ }
4857
+ });
4858
+ throw error;
4667
4859
  }
4668
4860
  const data = await res.json();
4669
4861
  return {
@@ -4684,8 +4876,17 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch,
4684
4876
  getActiveToken
4685
4877
  }));
4686
4878
  }
4879
+ var SDKError = class extends Error {
4880
+ response;
4881
+ requestId;
4882
+ constructor(params) {
4883
+ super();
4884
+ this.response = params.response;
4885
+ this.requestId = params.requestId;
4886
+ }
4887
+ };
4687
4888
  var errorBuilder2 = (code, description, details, data) => {
4688
- return {
4889
+ return new SDKError({
4689
4890
  response: {
4690
4891
  data: {
4691
4892
  details: {
@@ -4703,7 +4904,7 @@ var errorBuilder2 = (code, description, details, data) => {
4703
4904
  status: code
4704
4905
  },
4705
4906
  requestId: data?.requestId
4706
- };
4907
+ });
4707
4908
  };
4708
4909
 
4709
4910
  // ../../node_modules/@wix/sdk/build/nanoevents.js
@@ -4945,28 +5146,51 @@ function createClient(config) {
4945
5146
  ...config.host?.essentials?.passThroughHeaders,
4946
5147
  ..._headers[X_WIX_CONSISTENT_HEADER] ? { [X_WIX_CONSISTENT_HEADER]: _headers[X_WIX_CONSISTENT_HEADER] } : {}
4947
5148
  };
4948
- if (typeof urlOrRequest === "string" || urlOrRequest instanceof URL) {
4949
- const response = await fetch(urlOrRequest, {
4950
- ...requestInit,
4951
- headers
4952
- });
4953
- const consistentHeader = findConsistentHeader(response);
4954
- if (consistentHeader) {
4955
- _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;
4956
- }
4957
- return response;
4958
- } else {
4959
- for (const [k, v] of Object.entries(headers)) {
4960
- if (typeof v === "string") {
4961
- urlOrRequest.headers.set(k, v);
5149
+ const errorHandler = config.host?.getErrorHandler?.();
5150
+ try {
5151
+ if (typeof urlOrRequest === "string" || urlOrRequest instanceof URL) {
5152
+ const response = await fetch(urlOrRequest, {
5153
+ ...requestInit,
5154
+ headers
5155
+ });
5156
+ errorHandler?.handleError(response, {
5157
+ requestOptions: {
5158
+ url: urlOrRequest.toString(),
5159
+ method: requestInit?.method
5160
+ }
5161
+ });
5162
+ const consistentHeader = findConsistentHeader(response);
5163
+ if (consistentHeader) {
5164
+ _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;
4962
5165
  }
5166
+ return response;
5167
+ } else {
5168
+ for (const [k, v] of Object.entries(headers)) {
5169
+ if (typeof v === "string") {
5170
+ urlOrRequest.headers.set(k, v);
5171
+ }
5172
+ }
5173
+ const response = await fetch(urlOrRequest, requestInit);
5174
+ errorHandler?.handleError(response, {
5175
+ requestOptions: {
5176
+ url: urlOrRequest.url,
5177
+ method: requestInit?.method
5178
+ }
5179
+ });
5180
+ const consistentHeader = findConsistentHeader(response);
5181
+ if (consistentHeader) {
5182
+ _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;
5183
+ }
5184
+ return response;
4963
5185
  }
4964
- const response = await fetch(urlOrRequest, requestInit);
4965
- const consistentHeader = findConsistentHeader(response);
4966
- if (consistentHeader) {
4967
- _headers[X_WIX_CONSISTENT_HEADER] = consistentHeader;
4968
- }
4969
- return response;
5186
+ } catch (e) {
5187
+ errorHandler?.handleError(e, {
5188
+ requestOptions: {
5189
+ url: typeof urlOrRequest === "string" || urlOrRequest instanceof URL ? urlOrRequest.toString() : urlOrRequest.url,
5190
+ method: requestInit?.method
5191
+ }
5192
+ });
5193
+ throw e;
4970
5194
  }
4971
5195
  };
4972
5196
  const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(authStrategy);
@@ -5005,7 +5229,7 @@ function createClient(config) {
5005
5229
  }
5006
5230
  const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;
5007
5231
  const shouldUseCDN = config.useCDN === void 0 ? config.auth?.shouldUseCDN : config.useCDN;
5008
- return buildRESTDescriptor(runWithoutContext(() => isAmbassadorModule(modules)) ? toHTTPModule(modules) : modules, metadata ?? {}, boundFetch, (relativeUrl, fetchOptions) => {
5232
+ return buildRESTDescriptor(runWithoutContext(() => isAmbassadorModule(modules)) ? toHTTPModule(modules) : modules, metadata ?? {}, boundFetch, config.host?.getErrorHandler?.(), (relativeUrl, fetchOptions) => {
5009
5233
  const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
5010
5234
  finalUrl.host = apiBaseUrl;
5011
5235
  finalUrl.protocol = "https";
@@ -8014,10 +8238,10 @@ function dsnFromString(str) {
8014
8238
  const [protocol, publicKey, pass = "", host = "", port = "", lastPath = ""] = match.slice(1);
8015
8239
  let path = "";
8016
8240
  let projectId = lastPath;
8017
- const split = projectId.split("/");
8018
- if (split.length > 1) {
8019
- path = split.slice(0, -1).join("/");
8020
- projectId = split.pop();
8241
+ const split2 = projectId.split("/");
8242
+ if (split2.length > 1) {
8243
+ path = split2.slice(0, -1).join("/");
8244
+ projectId = split2.pop();
8021
8245
  }
8022
8246
  if (projectId) {
8023
8247
  const projectMatch = projectId.match(/^\d+/);