@wix/cli-app 1.1.157 → 1.1.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{AddPermissionCommand-VK5WK767.js → AddPermissionCommand-6YCO7XZS.js} +2 -2
- package/build/{DevCommand-SOKDRAVK.js → DevCommand-2DTYZRNT.js} +10 -10
- package/build/{GenerateCommand-H56OPDAI.js → GenerateCommand-WP2JJP2I.js} +7 -7
- package/build/{LogsCommand-RAKTYGMM.js → LogsCommand-LVBP6GRC.js} +3 -3
- package/build/PreviewCommand-GROC7JLD.js +19 -0
- package/build/ReleaseCommand-WDHPIXNE.js +23 -0
- package/build/{ServeCommand-LP6EQ7IQ.js → ServeCommand-ZDIUGN7C.js} +3 -3
- package/build/{build-GHT6RC7I.js → build-R2FRGGZN.js} +6 -6
- package/build/{chunk-5BZOEPZC.js → chunk-4BAGIC6U.js} +2 -2
- package/build/{chunk-ECF5KK5T.js → chunk-5KJ35HVT.js} +126 -5
- package/build/{chunk-ECF5KK5T.js.map → chunk-5KJ35HVT.js.map} +1 -1
- package/build/{chunk-OIHTTCK2.js → chunk-5URIFLHD.js} +2 -2
- package/build/{chunk-7VM3Q6CG.js → chunk-6SLIZJN6.js} +4 -4
- package/build/{chunk-OAQ3AXDV.js → chunk-D5U47UVS.js} +29 -25
- package/build/{chunk-OAQ3AXDV.js.map → chunk-D5U47UVS.js.map} +1 -1
- package/build/{chunk-STQW5YU2.js → chunk-D6KHRSVT.js} +7 -7
- package/build/{chunk-6PKUNHI5.js → chunk-DMKD7TJO.js} +2 -2
- package/build/{chunk-RTNMRYVU.js → chunk-E4YGBRAF.js} +3 -3
- package/build/{chunk-RTNMRYVU.js.map → chunk-E4YGBRAF.js.map} +1 -1
- package/build/{chunk-ZRQYGHTH.js → chunk-EEQSODFY.js} +2 -2
- package/build/chunk-EEQSODFY.js.map +1 -0
- package/build/{chunk-AEEYYZMC.js → chunk-F4GYD2F4.js} +6 -6
- package/build/{chunk-O7VPFW53.js → chunk-MNPZFRG5.js} +2 -2
- package/build/{chunk-G7YOAZ5K.js → chunk-NP4A5YC5.js} +2 -2
- package/build/{chunk-5FLMSKPK.js → chunk-NYMN5QX3.js} +2 -2
- package/build/{chunk-7ZX4ULUM.js → chunk-OSVOU52B.js} +3 -3
- package/build/{chunk-AUANCEHK.js → chunk-RYPEAWDM.js} +2 -2
- package/build/{chunk-6N5USJLA.js → chunk-UV4UPVAW.js} +4 -4
- package/build/{chunk-AFCGDJP6.js → chunk-Z5VDMRDW.js} +6 -6
- package/build/cloudflare-runtime/entry.js +309 -28
- package/build/cloudflare-runtime/getRegisteredExtensions.js +307 -26
- package/build/index.js +23 -23
- package/build/platform-sdk/chunk-QSTEFEOT.js +2 -0
- package/build/platform-sdk/chunk-QSTEFEOT.js.map +1 -0
- package/build/platform-sdk/chunk-RSZB4TBC.js +2 -0
- package/build/platform-sdk/chunk-RSZB4TBC.js.map +1 -0
- package/build/platform-sdk/chunk-UTEFPCPF.js +2 -0
- package/build/platform-sdk/chunk-UTEFPCPF.js.map +1 -0
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/editor.js +1 -1
- package/build/platform-sdk/sdk-context.js +1 -1
- package/build/platform-sdk/sdk-context.js.map +1 -1
- package/build/platform-sdk/site.js +1 -1
- package/build/platform-sdk/web-methods.js +1 -1
- package/build/{preview-GUOTPP5J.js → preview-ZX3JZGRP.js} +12 -12
- package/build/{release-2WECEOZF.js → release-S3XBCEHH.js} +14 -14
- package/build/{render-command-5GPBR6LI.js → render-command-G2FTP2RR.js} +5 -5
- package/package.json +2 -2
- package/build/PreviewCommand-442HYMRE.js +0 -19
- package/build/ReleaseCommand-MSUXBEPQ.js +0 -23
- package/build/chunk-ZRQYGHTH.js.map +0 -1
- package/build/platform-sdk/chunk-7EYXEF6M.js +0 -2
- package/build/platform-sdk/chunk-7EYXEF6M.js.map +0 -1
- package/build/platform-sdk/chunk-RJD2G2AE.js +0 -2
- package/build/platform-sdk/chunk-RJD2G2AE.js.map +0 -1
- package/build/platform-sdk/chunk-Y4HYNW3N.js +0 -2
- package/build/platform-sdk/chunk-Y4HYNW3N.js.map +0 -1
- /package/build/{AddPermissionCommand-VK5WK767.js.map → AddPermissionCommand-6YCO7XZS.js.map} +0 -0
- /package/build/{DevCommand-SOKDRAVK.js.map → DevCommand-2DTYZRNT.js.map} +0 -0
- /package/build/{GenerateCommand-H56OPDAI.js.map → GenerateCommand-WP2JJP2I.js.map} +0 -0
- /package/build/{LogsCommand-RAKTYGMM.js.map → LogsCommand-LVBP6GRC.js.map} +0 -0
- /package/build/{PreviewCommand-442HYMRE.js.map → PreviewCommand-GROC7JLD.js.map} +0 -0
- /package/build/{ReleaseCommand-MSUXBEPQ.js.map → ReleaseCommand-WDHPIXNE.js.map} +0 -0
- /package/build/{ServeCommand-LP6EQ7IQ.js.map → ServeCommand-ZDIUGN7C.js.map} +0 -0
- /package/build/{build-GHT6RC7I.js.map → build-R2FRGGZN.js.map} +0 -0
- /package/build/{chunk-5BZOEPZC.js.map → chunk-4BAGIC6U.js.map} +0 -0
- /package/build/{chunk-OIHTTCK2.js.map → chunk-5URIFLHD.js.map} +0 -0
- /package/build/{chunk-7VM3Q6CG.js.map → chunk-6SLIZJN6.js.map} +0 -0
- /package/build/{chunk-STQW5YU2.js.map → chunk-D6KHRSVT.js.map} +0 -0
- /package/build/{chunk-6PKUNHI5.js.map → chunk-DMKD7TJO.js.map} +0 -0
- /package/build/{chunk-AEEYYZMC.js.map → chunk-F4GYD2F4.js.map} +0 -0
- /package/build/{chunk-O7VPFW53.js.map → chunk-MNPZFRG5.js.map} +0 -0
- /package/build/{chunk-G7YOAZ5K.js.map → chunk-NP4A5YC5.js.map} +0 -0
- /package/build/{chunk-5FLMSKPK.js.map → chunk-NYMN5QX3.js.map} +0 -0
- /package/build/{chunk-7ZX4ULUM.js.map → chunk-OSVOU52B.js.map} +0 -0
- /package/build/{chunk-AUANCEHK.js.map → chunk-RYPEAWDM.js.map} +0 -0
- /package/build/{chunk-6N5USJLA.js.map → chunk-UV4UPVAW.js.map} +0 -0
- /package/build/{chunk-AFCGDJP6.js.map → chunk-Z5VDMRDW.js.map} +0 -0
- /package/build/{preview-GUOTPP5J.js.map → preview-ZX3JZGRP.js.map} +0 -0
- /package/build/{release-2WECEOZF.js.map → release-S3XBCEHH.js.map} +0 -0
- /package/build/{render-command-5GPBR6LI.js.map → render-command-G2FTP2RR.js.map} +0 -0
|
@@ -3612,11 +3612,11 @@ async function importWithAlgCache(cache, jwk, alg) {
|
|
|
3612
3612
|
return cached[alg];
|
|
3613
3613
|
}
|
|
3614
3614
|
function createLocalJWKSet(jwks) {
|
|
3615
|
-
const
|
|
3616
|
-
const localJWKSet = async (protectedHeader, token) =>
|
|
3615
|
+
const set2 = new LocalJWKSet(jwks);
|
|
3616
|
+
const localJWKSet = async (protectedHeader, token) => set2.getKey(protectedHeader, token);
|
|
3617
3617
|
Object.defineProperties(localJWKSet, {
|
|
3618
3618
|
jwks: {
|
|
3619
|
-
value: () => clone(
|
|
3619
|
+
value: () => clone(set2._jwks),
|
|
3620
3620
|
enumerable: true,
|
|
3621
3621
|
configurable: false,
|
|
3622
3622
|
writable: false
|
|
@@ -3761,32 +3761,32 @@ function isFreshJwksCache(input, cacheMaxAge) {
|
|
|
3761
3761
|
return true;
|
|
3762
3762
|
}
|
|
3763
3763
|
function createRemoteJWKSet(url, options) {
|
|
3764
|
-
const
|
|
3765
|
-
const remoteJWKSet = async (protectedHeader, token) =>
|
|
3764
|
+
const set2 = new RemoteJWKSet(url, options);
|
|
3765
|
+
const remoteJWKSet = async (protectedHeader, token) => set2.getKey(protectedHeader, token);
|
|
3766
3766
|
Object.defineProperties(remoteJWKSet, {
|
|
3767
3767
|
coolingDown: {
|
|
3768
|
-
get: () =>
|
|
3768
|
+
get: () => set2.coolingDown(),
|
|
3769
3769
|
enumerable: true,
|
|
3770
3770
|
configurable: false
|
|
3771
3771
|
},
|
|
3772
3772
|
fresh: {
|
|
3773
|
-
get: () =>
|
|
3773
|
+
get: () => set2.fresh(),
|
|
3774
3774
|
enumerable: true,
|
|
3775
3775
|
configurable: false
|
|
3776
3776
|
},
|
|
3777
3777
|
reload: {
|
|
3778
|
-
value: () =>
|
|
3778
|
+
value: () => set2.reload(),
|
|
3779
3779
|
enumerable: true,
|
|
3780
3780
|
configurable: false,
|
|
3781
3781
|
writable: false
|
|
3782
3782
|
},
|
|
3783
3783
|
reloading: {
|
|
3784
|
-
get: () => !!
|
|
3784
|
+
get: () => !!set2._pendingFetch,
|
|
3785
3785
|
enumerable: true,
|
|
3786
3786
|
configurable: false
|
|
3787
3787
|
},
|
|
3788
3788
|
jwks: {
|
|
3789
|
-
value: () =>
|
|
3789
|
+
value: () => set2._local?.jwks(),
|
|
3790
3790
|
enumerable: true,
|
|
3791
3791
|
configurable: false,
|
|
3792
3792
|
writable: false
|
|
@@ -4288,6 +4288,15 @@ function EventDefinition(type, isDomainEvent = false, transformations = (x) => x
|
|
|
4288
4288
|
});
|
|
4289
4289
|
}
|
|
4290
4290
|
var SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
4291
|
+
var SORT_DIRECTIONS = {
|
|
4292
|
+
ASC: "ASC",
|
|
4293
|
+
DESC: "DESC"
|
|
4294
|
+
};
|
|
4295
|
+
var SORT_CAPABILITIES = {
|
|
4296
|
+
...SORT_DIRECTIONS,
|
|
4297
|
+
BOTH: "BOTH",
|
|
4298
|
+
NONE: "NONE"
|
|
4299
|
+
};
|
|
4291
4300
|
|
|
4292
4301
|
// ../../node_modules/@wix/sdk/build/ambassador-modules.js
|
|
4293
4302
|
var parseMethod = (method) => {
|
|
@@ -4470,6 +4479,13 @@ function runWithoutContext(fn) {
|
|
|
4470
4479
|
}
|
|
4471
4480
|
}
|
|
4472
4481
|
|
|
4482
|
+
// ../../node_modules/@wix/sdk-runtime/build/constants.js
|
|
4483
|
+
var RESTResponseToSDKResponseRenameMap = {
|
|
4484
|
+
id: "_id",
|
|
4485
|
+
createdDate: "_createdDate",
|
|
4486
|
+
updatedDate: "_updatedDate"
|
|
4487
|
+
};
|
|
4488
|
+
|
|
4473
4489
|
// ../../node_modules/@wix/sdk-runtime/build/utils.js
|
|
4474
4490
|
function constantCase(input) {
|
|
4475
4491
|
return split(input).map((part) => part.toLocaleUpperCase()).join("_");
|
|
@@ -4756,6 +4772,239 @@ var errorBuilder2 = (code, description, details, data) => {
|
|
|
4756
4772
|
});
|
|
4757
4773
|
};
|
|
4758
4774
|
|
|
4775
|
+
// ../../node_modules/@wix/sdk-runtime/build/rest-modules.js
|
|
4776
|
+
var DOMAINS = ["wix.com", "editorx.com"];
|
|
4777
|
+
var REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
|
|
4778
|
+
var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
|
|
4779
|
+
var DEV_WIX_CODE_DOMAIN = "dev.wix-code.com";
|
|
4780
|
+
var REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\.(${WIX_API_DOMAINS.join("|")})$`);
|
|
4781
|
+
var REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\.${DEV_WIX_CODE_DOMAIN}$`);
|
|
4782
|
+
|
|
4783
|
+
// ../../node_modules/@wix/sdk/build/object-utils.js
|
|
4784
|
+
var DELIMITER = ".";
|
|
4785
|
+
function set(obj, path, value) {
|
|
4786
|
+
if (obj == null) {
|
|
4787
|
+
throw new Error("Cannot set value on null or undefined");
|
|
4788
|
+
}
|
|
4789
|
+
const keys = toPathObject(path);
|
|
4790
|
+
let current = obj;
|
|
4791
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4792
|
+
const key = keys[i];
|
|
4793
|
+
if (i === keys.length - 1) {
|
|
4794
|
+
current[key] = value;
|
|
4795
|
+
break;
|
|
4796
|
+
}
|
|
4797
|
+
const nextKey = keys[i + 1];
|
|
4798
|
+
if (!(key in current) || current[key] == null) {
|
|
4799
|
+
current[key] = typeof nextKey === "number" ? [] : {};
|
|
4800
|
+
} else if (typeof current[key] !== "object" || current[key] === null) {
|
|
4801
|
+
current[key] = typeof nextKey === "number" ? [] : {};
|
|
4802
|
+
}
|
|
4803
|
+
current = current[key];
|
|
4804
|
+
}
|
|
4805
|
+
return obj;
|
|
4806
|
+
}
|
|
4807
|
+
function toPathObject(path) {
|
|
4808
|
+
if (Array.isArray(path)) {
|
|
4809
|
+
return path;
|
|
4810
|
+
}
|
|
4811
|
+
return path.split(DELIMITER).map((segment) => isNumericSegment(segment) ? Number(segment) : segment);
|
|
4812
|
+
}
|
|
4813
|
+
function isNumericSegment(segment) {
|
|
4814
|
+
return /^\d+$/.test(segment);
|
|
4815
|
+
}
|
|
4816
|
+
|
|
4817
|
+
// ../../node_modules/@wix/sdk/build/flat-utils.js
|
|
4818
|
+
function unflatten(flatObject) {
|
|
4819
|
+
const result = {};
|
|
4820
|
+
for (const [flatKey, value] of Object.entries(flatObject)) {
|
|
4821
|
+
if (isPrototypePollutionKey(flatKey)) {
|
|
4822
|
+
continue;
|
|
4823
|
+
}
|
|
4824
|
+
const path = toPathObject(flatKey);
|
|
4825
|
+
set(result, path, value);
|
|
4826
|
+
}
|
|
4827
|
+
return result;
|
|
4828
|
+
}
|
|
4829
|
+
function isPrototypePollutionKey(key) {
|
|
4830
|
+
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
4831
|
+
}
|
|
4832
|
+
|
|
4833
|
+
// ../../node_modules/@wix/sdk/build/modified-fields-manipulator.js
|
|
4834
|
+
var ModifiedFieldsManipulator = class {
|
|
4835
|
+
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
4836
|
+
NUMERIC_PATTERN = /^\d+$/;
|
|
4837
|
+
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
4838
|
+
ESCAPED_LEFT_BRACKET_PATTERN = /\\\[/g;
|
|
4839
|
+
ESCAPED_RIGHT_BRACKET_PATTERN = /\\\]/g;
|
|
4840
|
+
SPLIT_PATTERN = /\.|\[(\d+)\]/g;
|
|
4841
|
+
DOT_BEFORE_BRACKET_PATTERN = /\.\[/g;
|
|
4842
|
+
ESCAPED_DOT_PLACEHOLDER = "__DOT__";
|
|
4843
|
+
ESCAPED_RIGHT_BRACKET_PLACEHOLDER = "__RB__";
|
|
4844
|
+
ESCAPED_LEFT_BRACKET_PLACEHOLDER = "__LB__";
|
|
4845
|
+
modifiedFields;
|
|
4846
|
+
cleanedModifiedFields;
|
|
4847
|
+
constructor(modifiedFields) {
|
|
4848
|
+
this.modifiedFields = modifiedFields;
|
|
4849
|
+
}
|
|
4850
|
+
replaceEscapedCharacters(key) {
|
|
4851
|
+
return key.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);
|
|
4852
|
+
}
|
|
4853
|
+
restoreEscapedCharacters(key) {
|
|
4854
|
+
return key.replace(this.ESCAPED_DOT_PLACEHOLDER, "\\.").replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, "\\]").replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, "\\[");
|
|
4855
|
+
}
|
|
4856
|
+
unflatten() {
|
|
4857
|
+
this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([key, value]) => [
|
|
4858
|
+
this.replaceEscapedCharacters(this.bracketToDotNotation(key)),
|
|
4859
|
+
value
|
|
4860
|
+
]));
|
|
4861
|
+
return unflatten(this.cleanedModifiedFields);
|
|
4862
|
+
}
|
|
4863
|
+
flatten(transformedModifiedFields) {
|
|
4864
|
+
let result = {};
|
|
4865
|
+
for (const originalKey of Object.keys(this.cleanedModifiedFields)) {
|
|
4866
|
+
const pathParts = this.splitPath(originalKey);
|
|
4867
|
+
const value = this.navigatePath(transformedModifiedFields, pathParts);
|
|
4868
|
+
result = { ...result, ...value };
|
|
4869
|
+
}
|
|
4870
|
+
return Object.fromEntries(Object.entries(result).map(([key, value]) => [
|
|
4871
|
+
this.restoreEscapedCharacters(key),
|
|
4872
|
+
value
|
|
4873
|
+
]));
|
|
4874
|
+
}
|
|
4875
|
+
splitPath(path) {
|
|
4876
|
+
const parts = [];
|
|
4877
|
+
let lastIndex = 0;
|
|
4878
|
+
const matches = Array.from(path.matchAll(this.SPLIT_PATTERN));
|
|
4879
|
+
for (const match of matches) {
|
|
4880
|
+
if (match.index > lastIndex) {
|
|
4881
|
+
parts.push(path.substring(lastIndex, match.index));
|
|
4882
|
+
}
|
|
4883
|
+
if (match[1]) {
|
|
4884
|
+
parts.push(match[1]);
|
|
4885
|
+
}
|
|
4886
|
+
lastIndex = match.index + match[0].length;
|
|
4887
|
+
}
|
|
4888
|
+
if (lastIndex < path.length) {
|
|
4889
|
+
parts.push(path.substring(lastIndex));
|
|
4890
|
+
}
|
|
4891
|
+
return parts;
|
|
4892
|
+
}
|
|
4893
|
+
navigatePath(obj, pathParts) {
|
|
4894
|
+
let current = obj;
|
|
4895
|
+
const transformedPath = [];
|
|
4896
|
+
const handleArray = (part) => {
|
|
4897
|
+
if (!Array.isArray(current)) {
|
|
4898
|
+
throw new Error(`Expected array at path ${this.buildPathString(transformedPath)}, but got ${typeof current}`);
|
|
4899
|
+
}
|
|
4900
|
+
transformedPath.push(`[${part}]`);
|
|
4901
|
+
current = current[parseInt(part, 10)];
|
|
4902
|
+
};
|
|
4903
|
+
const handleTransformedKeyName = (part, currentObj) => {
|
|
4904
|
+
const transformedKey = part in RESTResponseToSDKResponseRenameMap ? RESTResponseToSDKResponseRenameMap[part] : void 0;
|
|
4905
|
+
if (transformedKey && transformedKey in currentObj) {
|
|
4906
|
+
transformedPath.push(transformedKey);
|
|
4907
|
+
current = currentObj[transformedKey];
|
|
4908
|
+
return;
|
|
4909
|
+
}
|
|
4910
|
+
const camelCaseKey = camelCase(part);
|
|
4911
|
+
if (camelCaseKey && camelCaseKey in currentObj) {
|
|
4912
|
+
transformedPath.push(camelCaseKey);
|
|
4913
|
+
current = currentObj[camelCaseKey];
|
|
4914
|
+
return;
|
|
4915
|
+
}
|
|
4916
|
+
throw new Error(`Cannot find key '${part}' or its transformations at path ${this.buildPathString(transformedPath)}`);
|
|
4917
|
+
};
|
|
4918
|
+
const handleObject = (part, currentObj) => {
|
|
4919
|
+
transformedPath.push(part);
|
|
4920
|
+
current = currentObj[part];
|
|
4921
|
+
return;
|
|
4922
|
+
};
|
|
4923
|
+
for (const part of pathParts) {
|
|
4924
|
+
if (this.NUMERIC_PATTERN.test(part)) {
|
|
4925
|
+
handleArray(part);
|
|
4926
|
+
continue;
|
|
4927
|
+
}
|
|
4928
|
+
if (current === null || typeof current !== "object") {
|
|
4929
|
+
throw new Error(`Cannot access property '${part}' on ${typeof current} at path ${this.buildPathString(transformedPath)}`);
|
|
4930
|
+
}
|
|
4931
|
+
const currentObj = current;
|
|
4932
|
+
if (part in current) {
|
|
4933
|
+
handleObject(part, currentObj);
|
|
4934
|
+
continue;
|
|
4935
|
+
}
|
|
4936
|
+
handleTransformedKeyName(part, currentObj);
|
|
4937
|
+
}
|
|
4938
|
+
return { [this.buildPathString(transformedPath)]: current };
|
|
4939
|
+
}
|
|
4940
|
+
buildPathString(pathParts) {
|
|
4941
|
+
return pathParts.join(".").replace(this.DOT_BEFORE_BRACKET_PATTERN, "[");
|
|
4942
|
+
}
|
|
4943
|
+
bracketToDotNotation(key) {
|
|
4944
|
+
return key.replace(this.BRACKET_PATTERN, (match, number, offset) => {
|
|
4945
|
+
if (offset > 0 && key[offset - 1] === "\\") {
|
|
4946
|
+
return match;
|
|
4947
|
+
}
|
|
4948
|
+
return "." + number;
|
|
4949
|
+
});
|
|
4950
|
+
}
|
|
4951
|
+
};
|
|
4952
|
+
function attemptTransformationWithModifiedFields(envelope, transformFromRESTFn) {
|
|
4953
|
+
const modifiedFields = envelope?.modifiedFields;
|
|
4954
|
+
if (!modifiedFields) {
|
|
4955
|
+
return null;
|
|
4956
|
+
}
|
|
4957
|
+
const unflattenedResult = attemptUnflatten(modifiedFields);
|
|
4958
|
+
if (!unflattenedResult) {
|
|
4959
|
+
return null;
|
|
4960
|
+
}
|
|
4961
|
+
const { unflattenedModifiedFields, modifiedFieldsManipulator } = unflattenedResult;
|
|
4962
|
+
envelope = {
|
|
4963
|
+
...envelope,
|
|
4964
|
+
modifiedFields: unflattenedModifiedFields
|
|
4965
|
+
};
|
|
4966
|
+
const transformedEnvelope = transformFromRESTFn(envelope);
|
|
4967
|
+
const transformedModifiedFields = transformedEnvelope?.modifiedFields;
|
|
4968
|
+
if (!transformedModifiedFields) {
|
|
4969
|
+
return null;
|
|
4970
|
+
}
|
|
4971
|
+
const flattened = attemptFlatten(transformedModifiedFields, modifiedFieldsManipulator);
|
|
4972
|
+
if (flattened !== null) {
|
|
4973
|
+
transformedEnvelope.modifiedFields = flattened;
|
|
4974
|
+
return transformedEnvelope;
|
|
4975
|
+
}
|
|
4976
|
+
return null;
|
|
4977
|
+
}
|
|
4978
|
+
function attemptUnflatten(modifiedFields) {
|
|
4979
|
+
if (typeof modifiedFields === "object" && modifiedFields !== null && !Array.isArray(modifiedFields)) {
|
|
4980
|
+
try {
|
|
4981
|
+
const modifiedFieldsManipulator = new ModifiedFieldsManipulator(modifiedFields);
|
|
4982
|
+
const unflattened = modifiedFieldsManipulator.unflatten();
|
|
4983
|
+
return {
|
|
4984
|
+
unflattenedModifiedFields: unflattened,
|
|
4985
|
+
modifiedFieldsManipulator
|
|
4986
|
+
};
|
|
4987
|
+
} catch (error) {
|
|
4988
|
+
return null;
|
|
4989
|
+
}
|
|
4990
|
+
}
|
|
4991
|
+
return null;
|
|
4992
|
+
}
|
|
4993
|
+
function attemptFlatten(transformedModifiedFields, modifiedFieldsManipulator) {
|
|
4994
|
+
if (typeof transformedModifiedFields === "object" && transformedModifiedFields !== null && !Array.isArray(transformedModifiedFields)) {
|
|
4995
|
+
try {
|
|
4996
|
+
const flattened = modifiedFieldsManipulator.flatten(transformedModifiedFields);
|
|
4997
|
+
return flattened;
|
|
4998
|
+
} catch (error) {
|
|
4999
|
+
return null;
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
return null;
|
|
5003
|
+
}
|
|
5004
|
+
function camelCase(str) {
|
|
5005
|
+
return str.replace(/[-_\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").replace(/^./, (c) => c.toLowerCase());
|
|
5006
|
+
}
|
|
5007
|
+
|
|
4759
5008
|
// ../../node_modules/@wix/sdk/build/nanoevents.js
|
|
4760
5009
|
function createNanoEvents() {
|
|
4761
5010
|
return {
|
|
@@ -4799,9 +5048,15 @@ function runHandler(eventDefinition, handler, payload, baseEventMetadata) {
|
|
|
4799
5048
|
data: actionEvent.body,
|
|
4800
5049
|
metadata
|
|
4801
5050
|
};
|
|
5051
|
+
} else if (updatedEvent) {
|
|
5052
|
+
envelope = {
|
|
5053
|
+
entity: updatedEvent.currentEntity,
|
|
5054
|
+
metadata,
|
|
5055
|
+
...updatedEvent.modifiedFields ? { modifiedFields: updatedEvent.modifiedFields } : {}
|
|
5056
|
+
};
|
|
4802
5057
|
} else {
|
|
4803
5058
|
envelope = {
|
|
4804
|
-
entity: createdEvent?.entity
|
|
5059
|
+
entity: createdEvent?.entity,
|
|
4805
5060
|
metadata
|
|
4806
5061
|
};
|
|
4807
5062
|
}
|
|
@@ -4812,9 +5067,21 @@ function runHandler(eventDefinition, handler, payload, baseEventMetadata) {
|
|
|
4812
5067
|
};
|
|
4813
5068
|
}
|
|
4814
5069
|
const transformFromRESTFn = eventDefinition.transformations ?? ((x) => x);
|
|
4815
|
-
|
|
5070
|
+
let originalEnvelope = envelope;
|
|
5071
|
+
const envelopeAny = envelope;
|
|
5072
|
+
if (envelopeAny.modifiedFields) {
|
|
5073
|
+
const modifiedFieldsValue = envelopeAny.modifiedFields;
|
|
5074
|
+
if (typeof modifiedFieldsValue === "object" && modifiedFieldsValue !== null && !Array.isArray(modifiedFieldsValue)) {
|
|
5075
|
+
originalEnvelope = structuredClone(envelope);
|
|
5076
|
+
const transformedEnvelope = attemptTransformationWithModifiedFields(envelopeAny, transformFromRESTFn);
|
|
5077
|
+
if (transformedEnvelope) {
|
|
5078
|
+
return handler(transformedEnvelope);
|
|
5079
|
+
}
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
return handler(transformFromRESTFn(originalEnvelope));
|
|
4816
5083
|
}
|
|
4817
|
-
function eventHandlersModules(
|
|
5084
|
+
function eventHandlersModules(getAuthStrategy) {
|
|
4818
5085
|
const eventHandlers = /* @__PURE__ */ new Map();
|
|
4819
5086
|
const webhooksEmitter = createNanoEvents();
|
|
4820
5087
|
const client = {
|
|
@@ -4823,7 +5090,7 @@ function eventHandlersModules(authStrategy) {
|
|
|
4823
5090
|
async process(jwt, opts = {
|
|
4824
5091
|
expectedEvents: []
|
|
4825
5092
|
}) {
|
|
4826
|
-
const { eventType, identity, instanceId, payload } = await this.parseJWT(jwt);
|
|
5093
|
+
const { eventType, identity, instanceId, payload, accountInfo } = await this.parseJWT(jwt);
|
|
4827
5094
|
const allExpectedEvents = [
|
|
4828
5095
|
...opts.expectedEvents,
|
|
4829
5096
|
...Array.from(eventHandlers.keys()).map((type) => ({ type }))
|
|
@@ -4834,13 +5101,15 @@ function eventHandlersModules(authStrategy) {
|
|
|
4834
5101
|
const handlers = eventHandlers.get(eventType) ?? [];
|
|
4835
5102
|
await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, payload, {
|
|
4836
5103
|
instanceId,
|
|
4837
|
-
identity
|
|
5104
|
+
identity,
|
|
5105
|
+
accountInfo
|
|
4838
5106
|
})));
|
|
4839
5107
|
return {
|
|
4840
5108
|
instanceId,
|
|
4841
5109
|
eventType,
|
|
4842
5110
|
payload,
|
|
4843
|
-
identity
|
|
5111
|
+
identity,
|
|
5112
|
+
accountInfo
|
|
4844
5113
|
};
|
|
4845
5114
|
},
|
|
4846
5115
|
async processRequest(request, opts) {
|
|
@@ -4848,6 +5117,7 @@ function eventHandlersModules(authStrategy) {
|
|
|
4848
5117
|
return this.process(body, opts);
|
|
4849
5118
|
},
|
|
4850
5119
|
async parseJWT(jwt) {
|
|
5120
|
+
const authStrategy = getAuthStrategy();
|
|
4851
5121
|
if (!authStrategy.decodeJWT) {
|
|
4852
5122
|
throw new Error("decodeJWT is not supported by the authentication strategy");
|
|
4853
5123
|
}
|
|
@@ -4860,6 +5130,7 @@ function eventHandlersModules(authStrategy) {
|
|
|
4860
5130
|
}
|
|
4861
5131
|
const parsedDecoded = JSON.parse(decoded.data);
|
|
4862
5132
|
const eventType = parsedDecoded.eventType;
|
|
5133
|
+
const accountInfo = parsedDecoded.accountInfo;
|
|
4863
5134
|
const instanceId = parsedDecoded.instanceId;
|
|
4864
5135
|
const identity = parsedDecoded.identity ? JSON.parse(parsedDecoded.identity) : void 0;
|
|
4865
5136
|
const payload = JSON.parse(parsedDecoded.data);
|
|
@@ -4867,7 +5138,8 @@ function eventHandlersModules(authStrategy) {
|
|
|
4867
5138
|
instanceId,
|
|
4868
5139
|
eventType,
|
|
4869
5140
|
payload,
|
|
4870
|
-
identity
|
|
5141
|
+
identity,
|
|
5142
|
+
accountInfo
|
|
4871
5143
|
};
|
|
4872
5144
|
},
|
|
4873
5145
|
async parseRequest(request) {
|
|
@@ -4905,13 +5177,14 @@ function eventHandlersModules(authStrategy) {
|
|
|
4905
5177
|
|
|
4906
5178
|
// ../../node_modules/@wix/sdk/build/service-plugin-modules.js
|
|
4907
5179
|
var isServicePluginModule = (val) => val.__type === "service-plugin-definition";
|
|
4908
|
-
function servicePluginsModules(
|
|
5180
|
+
function servicePluginsModules(getAuthStrategy) {
|
|
4909
5181
|
const servicePluginsImplementations = /* @__PURE__ */ new Map();
|
|
4910
5182
|
const servicePluginsEmitter = createNanoEvents();
|
|
4911
5183
|
const client = {
|
|
4912
5184
|
...servicePluginsEmitter,
|
|
4913
5185
|
getRegisteredServicePlugins: () => servicePluginsImplementations,
|
|
4914
5186
|
async parseJWT(jwt) {
|
|
5187
|
+
const authStrategy = getAuthStrategy();
|
|
4915
5188
|
if (!authStrategy.decodeJWT) {
|
|
4916
5189
|
throw new Error("decodeJWT is not supported by the authentication strategy");
|
|
4917
5190
|
}
|
|
@@ -4982,11 +5255,14 @@ function servicePluginsModules(authStrategy) {
|
|
|
4982
5255
|
var X_WIX_CONSISTENT_HEADER = "X-Wix-Consistent";
|
|
4983
5256
|
function createClient(config) {
|
|
4984
5257
|
const _headers = config.headers || { Authorization: "" };
|
|
4985
|
-
const
|
|
5258
|
+
const defaultStrategy = {
|
|
4986
5259
|
getAuthHeaders: (_) => Promise.resolve({ headers: {} })
|
|
4987
5260
|
};
|
|
4988
|
-
const
|
|
4989
|
-
|
|
5261
|
+
const auth = config.auth;
|
|
5262
|
+
const getAuthStrategy = typeof auth === "function" ? auth : () => auth ?? defaultStrategy;
|
|
5263
|
+
const boundGetAuthHeaders = () => {
|
|
5264
|
+
return getAuthStrategy().getAuthHeaders(config.host);
|
|
5265
|
+
};
|
|
4990
5266
|
const fetchWithAuth = async (urlOrRequest, requestInit) => {
|
|
4991
5267
|
const authHeaders = await boundGetAuthHeaders();
|
|
4992
5268
|
const headers = {
|
|
@@ -5042,8 +5318,8 @@ function createClient(config) {
|
|
|
5042
5318
|
throw e;
|
|
5043
5319
|
}
|
|
5044
5320
|
};
|
|
5045
|
-
const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(
|
|
5046
|
-
const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(
|
|
5321
|
+
const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(getAuthStrategy);
|
|
5322
|
+
const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(getAuthStrategy);
|
|
5047
5323
|
const boundFetch = async (url, options) => {
|
|
5048
5324
|
const authHeaders = await boundGetAuthHeaders();
|
|
5049
5325
|
const defaultContentTypeHeader = getDefaultContentHeader(options);
|
|
@@ -5077,13 +5353,13 @@ function createClient(config) {
|
|
|
5077
5353
|
return modules;
|
|
5078
5354
|
}
|
|
5079
5355
|
const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;
|
|
5080
|
-
const shouldUseCDN = config.useCDN === void 0 ?
|
|
5356
|
+
const shouldUseCDN = config.useCDN === void 0 ? getAuthStrategy().shouldUseCDN : config.useCDN;
|
|
5081
5357
|
return buildRESTDescriptor(runWithoutContext(() => isAmbassadorModule(modules)) ? toHTTPModule(modules) : modules, metadata ?? {}, boundFetch, config.host?.getErrorHandler?.(), (relativeUrl, fetchOptions) => {
|
|
5082
5358
|
const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
|
|
5083
5359
|
finalUrl.host = apiBaseUrl;
|
|
5084
5360
|
finalUrl.protocol = "https";
|
|
5085
5361
|
return boundFetch(finalUrl.toString(), fetchOptions);
|
|
5086
|
-
},
|
|
5362
|
+
}, getAuthStrategy().getActiveToken, { HTTPHost: apiBaseUrl }, config.host?.name, shouldUseCDN);
|
|
5087
5363
|
} else if (isObject(modules)) {
|
|
5088
5364
|
return Object.fromEntries(Object.entries(modules).map(([key, value]) => {
|
|
5089
5365
|
return [key, use(value, modules[PUBLIC_METADATA_KEY])];
|
|
@@ -5100,7 +5376,12 @@ function createClient(config) {
|
|
|
5100
5376
|
const wrappedModules = config.modules ? use(config.modules) : {};
|
|
5101
5377
|
return {
|
|
5102
5378
|
...wrappedModules,
|
|
5103
|
-
auth
|
|
5379
|
+
get auth() {
|
|
5380
|
+
const authStrategy = getAuthStrategy();
|
|
5381
|
+
const originalGetAuthHeaders = authStrategy.getAuthHeaders;
|
|
5382
|
+
authStrategy.getAuthHeaders = originalGetAuthHeaders.bind(void 0, config.host);
|
|
5383
|
+
return authStrategy;
|
|
5384
|
+
},
|
|
5104
5385
|
setHeaders,
|
|
5105
5386
|
use,
|
|
5106
5387
|
enableContext(contextType, opts = { elevated: false }) {
|
package/build/index.js
CHANGED
|
@@ -3,18 +3,18 @@ const require = _createRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
createI18nT,
|
|
5
5
|
docsExtensionTypeSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DMKD7TJO.js";
|
|
7
7
|
import {
|
|
8
8
|
runCommand
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-UV4UPVAW.js";
|
|
10
|
+
import "./chunk-5URIFLHD.js";
|
|
11
11
|
import "./chunk-VJQHGLIW.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-NYMN5QX3.js";
|
|
13
13
|
import {
|
|
14
14
|
external_exports,
|
|
15
15
|
package_default,
|
|
16
16
|
require_react
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5KJ35HVT.js";
|
|
18
18
|
import {
|
|
19
19
|
__commonJS,
|
|
20
20
|
__require,
|
|
@@ -3377,8 +3377,8 @@ var {
|
|
|
3377
3377
|
// src/commands/build.ts
|
|
3378
3378
|
init_esm_shims();
|
|
3379
3379
|
var buildCommand = (services) => createCommand("build").action(async (_, command) => {
|
|
3380
|
-
const { runCommand: runCommand2 } = await import("./render-command-
|
|
3381
|
-
const { build } = await import("./build-
|
|
3380
|
+
const { runCommand: runCommand2 } = await import("./render-command-G2FTP2RR.js");
|
|
3381
|
+
const { build } = await import("./build-R2FRGGZN.js");
|
|
3382
3382
|
await runCommand2(command, services, build);
|
|
3383
3383
|
});
|
|
3384
3384
|
|
|
@@ -3443,8 +3443,8 @@ var devCommand = (services) => {
|
|
|
3443
3443
|
return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).option("--port <port>", t("dev_command_def.option.port"), validatePort).addOption(
|
|
3444
3444
|
new Option("--origin <url>", t("dev_command_def.option.origin")).argParser(validateBase).hideHelp()
|
|
3445
3445
|
).action(async (options, command) => {
|
|
3446
|
-
const { DevCommand } = await import("./DevCommand-
|
|
3447
|
-
const { renderCommand } = await import("./render-command-
|
|
3446
|
+
const { DevCommand } = await import("./DevCommand-2DTYZRNT.js");
|
|
3447
|
+
const { renderCommand } = await import("./render-command-G2FTP2RR.js");
|
|
3448
3448
|
const { https = false, origin, port } = options;
|
|
3449
3449
|
await renderCommand(
|
|
3450
3450
|
command,
|
|
@@ -3483,17 +3483,17 @@ var previewCommand = (services) => {
|
|
|
3483
3483
|
).hideHelp()
|
|
3484
3484
|
).action(async (options, command) => {
|
|
3485
3485
|
const { site, baseUrl, json } = options;
|
|
3486
|
-
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-
|
|
3486
|
+
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-G2FTP2RR.js");
|
|
3487
3487
|
if (json) {
|
|
3488
3488
|
return runCommand2(command, services, async (model) => {
|
|
3489
|
-
const { nonInteractivePreview } = await import("./preview-
|
|
3489
|
+
const { nonInteractivePreview } = await import("./preview-ZX3JZGRP.js");
|
|
3490
3490
|
return nonInteractivePreview(services, model, {
|
|
3491
3491
|
baseUrl,
|
|
3492
3492
|
siteId: site
|
|
3493
3493
|
});
|
|
3494
3494
|
});
|
|
3495
3495
|
}
|
|
3496
|
-
const { PreviewCommand } = await import("./PreviewCommand-
|
|
3496
|
+
const { PreviewCommand } = await import("./PreviewCommand-GROC7JLD.js");
|
|
3497
3497
|
await renderCommand(
|
|
3498
3498
|
command,
|
|
3499
3499
|
services,
|
|
@@ -3510,8 +3510,8 @@ var addPermissionCommand = (services) => {
|
|
|
3510
3510
|
return createCommand("add-permission").description("adding a permission to the app").addOption(
|
|
3511
3511
|
new Option("-p, --permission-id <id>", t("the permission id to add"))
|
|
3512
3512
|
).action(async (options, command) => {
|
|
3513
|
-
const { renderCommand } = await import("./render-command-
|
|
3514
|
-
const { AddPermissionCommand } = await import("./AddPermissionCommand-
|
|
3513
|
+
const { renderCommand } = await import("./render-command-G2FTP2RR.js");
|
|
3514
|
+
const { AddPermissionCommand } = await import("./AddPermissionCommand-6YCO7XZS.js");
|
|
3515
3515
|
const { permissionId = "" } = options;
|
|
3516
3516
|
await renderCommand(
|
|
3517
3517
|
command,
|
|
@@ -3527,8 +3527,8 @@ var import_react4 = __toESM(require_react(), 1);
|
|
|
3527
3527
|
var serveCommand = (services) => {
|
|
3528
3528
|
const t = createI18nT();
|
|
3529
3529
|
return createCommand("serve").description(t("serve_command_def.description")).action(async (_, command) => {
|
|
3530
|
-
const { renderCommand } = await import("./render-command-
|
|
3531
|
-
const { ServeCommandDeprecated } = await import("./ServeCommand-
|
|
3530
|
+
const { renderCommand } = await import("./render-command-G2FTP2RR.js");
|
|
3531
|
+
const { ServeCommandDeprecated } = await import("./ServeCommand-ZDIUGN7C.js");
|
|
3532
3532
|
await renderCommand(command, services, /* @__PURE__ */ import_react4.default.createElement(ServeCommandDeprecated, null));
|
|
3533
3533
|
});
|
|
3534
3534
|
};
|
|
@@ -3543,8 +3543,8 @@ var generateCommand = (services) => {
|
|
|
3543
3543
|
t("generate_command.type_flag"),
|
|
3544
3544
|
validateDocsExtensionType
|
|
3545
3545
|
).description(t("generate_command.description")).action(async (options, command) => {
|
|
3546
|
-
const { GenerateCommand } = await import("./GenerateCommand-
|
|
3547
|
-
const { renderCommand } = await import("./render-command-
|
|
3546
|
+
const { GenerateCommand } = await import("./GenerateCommand-WP2JJP2I.js");
|
|
3547
|
+
const { renderCommand } = await import("./render-command-G2FTP2RR.js");
|
|
3548
3548
|
const { type } = options;
|
|
3549
3549
|
await renderCommand(
|
|
3550
3550
|
command,
|
|
@@ -3568,8 +3568,8 @@ var logsCommand = (services) => {
|
|
|
3568
3568
|
validateVersion
|
|
3569
3569
|
).action(async (options, command) => {
|
|
3570
3570
|
const { version } = options;
|
|
3571
|
-
const { renderCommand } = await import("./render-command-
|
|
3572
|
-
const { LogsCommand } = await import("./LogsCommand-
|
|
3571
|
+
const { renderCommand } = await import("./render-command-G2FTP2RR.js");
|
|
3572
|
+
const { LogsCommand } = await import("./LogsCommand-LVBP6GRC.js");
|
|
3573
3573
|
await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(LogsCommand, { version }));
|
|
3574
3574
|
});
|
|
3575
3575
|
};
|
|
@@ -3602,8 +3602,8 @@ var releaseCommand = (services) => {
|
|
|
3602
3602
|
t("app_preview_command_def.option.json")
|
|
3603
3603
|
).hideHelp()
|
|
3604
3604
|
).action(async (options, command) => {
|
|
3605
|
-
const { renderCommand } = await import("./render-command-
|
|
3606
|
-
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-
|
|
3605
|
+
const { renderCommand } = await import("./render-command-G2FTP2RR.js");
|
|
3606
|
+
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-WDHPIXNE.js");
|
|
3607
3607
|
const { baseUrl, site, comment, json } = options;
|
|
3608
3608
|
const versionType = options.versionType ? {
|
|
3609
3609
|
major: ReleaseVersionType.MAJOR,
|
|
@@ -3617,7 +3617,7 @@ var releaseCommand = (services) => {
|
|
|
3617
3617
|
};
|
|
3618
3618
|
if (json) {
|
|
3619
3619
|
return runCommand(command, services, async (model) => {
|
|
3620
|
-
const { nonInteractiveRelease } = await import("./release-
|
|
3620
|
+
const { nonInteractiveRelease } = await import("./release-S3XBCEHH.js");
|
|
3621
3621
|
return nonInteractiveRelease(services, model, props);
|
|
3622
3622
|
});
|
|
3623
3623
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as R,b as H}from"./chunk-RSZB4TBC.js";import{a as v,b as $,d as j}from"./chunk-UTEFPCPF.js";import{f as m}from"./chunk-SBZEOPXX.js";j();import{wixContext as ie}from"@wix/sdk-context";var ce=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}`)}},F=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:ce(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}},q=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var W="__metadata",x="www.wixapis.com",B="edge.wixapis.com";var b=class extends Error{constructor(r,n){super(r);m(this,"message");m(this,"response");this.message=r,this.response=n}async details(){let r=await this.response.json();return de(this.response.status,r?.message,r?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:r})}},de=(e,t,r,n)=>({details:{...!r?.validationError&&{applicationError:{description:t,code:e,data:n}},...r},message:t,requestId:n?.requestId});var K=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},J=e=>e&&typeof e=="object"&&!Array.isArray(e);var k=e=>e.__type==="host";function G(e,t){return e.create(t)}var ue="x-wix-bi-gateway";function X(e,t,r){return{[ue]:le({environment:`js-sdk${r?`-${r}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function le(e){return Object.entries(e).filter(([t,r])=>!!r).map(([t,r])=>`${t}=${r}`).join(",")}function I(e){return me(e).map(t=>t.toLocaleUpperCase()).join("_")}var pe=/([\p{Ll}\d])(\p{Lu})/gu,fe=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,Y="$1\0$2",he=/[^\p{L}\d]+/giu;function me(e){let t=e.trim();t=t.replace(pe,Y).replace(fe,Y),t=t.replace(he,"\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 Ee=e=>"validationError"in(e.response?.data?.details??{}),Te=e=>"applicationError"in(e.response?.data?.details??{}),ye=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function Q(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},r=[]){if(typeof e!="object"||e===null)throw e;if(Ee(e))return _e(e,t,r);if(Te(e))return ge(e);if(ye(e)){let n=e.response?.status,s=e.response?.statusText??"UNKNOWN",o=e.response?.data?.message??s,a={applicationError:{description:s,code:I(s),data:{}},requestId:e.requestId};return S(e,{message:JSON.stringify({message:o,details:a},null,2),extraProperties:{details:a,status:n}})}return Ae(e)}var _e=(e,t,r)=>{let n=e.response?.data,s=e.requestId,{fieldViolations:o}=n.details.validationError,a=Pe(t,o,r)?.sort((l,p)=>l.field<p.field?-1:1),i=`INVALID_ARGUMENT: ${a?.map(({field:l,description:p})=>`"${l}" ${p}`)?.join(", ")}`,c={validationError:{fieldViolations:a},requestId:s};return S(e,{message:JSON.stringify({message:i,details:c},null,2),extraProperties:{details:c,status:e.response?.status,requestId:s}})},S=(e,{message:t,extraProperties:r})=>Object.assign(e,{...r,message:t}),ge=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??I(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 S(e,{message:JSON.stringify({message:i,details:c},null,2),extraProperties:{details:c,status:t,requestId:e.requestId}})},Ae=e=>{let t=e.requestId?`System error occurred, request-id: ${e.requestId}`:`System error occurred: ${JSON.stringify(e)}`;return S(e,{message:t,extraProperties:{requestId:e.requestId,status:e.response?.status,code:I(e.response?.statusText??"UNKNOWN"),...!e.response&&{runtimeError:e}}})},Pe=({spreadPathsToArguments:e,explicitPathsToArguments:t,singleArgumentUnchanged:r},n,s)=>{let o={...e,...t},a=Object.keys(o);return n?.filter(i=>!n.some(l=>l.field.length>i.field.length&&l.field.startsWith(i.field)&&a.includes(l.field))).map(i=>{let c=t[i.field];if(c)return{...i,field:z(c,s)};let l=a?.sort((p,u)=>u.length-p.length)?.find(p=>i.field.startsWith(p));if(l){let p=o[l];if(p)return{...i,field:i.field.replace(l,z(p,s))}}return r?{...i,field:`${s[0]}.${i.field}`}:i})},z=(e,t)=>{let r=we(e);return r!==null&&typeof r<"u"?e.replace(`$[${r}]`,t[r]):e},we=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function V(e,t,r,n,s,o,a,i,c){return R(()=>e({request:async l=>{let p=l({host:a?.HTTPHost||x}),u=p;u.method==="GET"&&u.fallback?.length&&(u.params?.toString().length??0)>4e3&&(u=p.fallback[0]);let y=a?.HTTPHost??x,_=`https://${c?B:y}${u.url}`;u.params&&u.params.toString()&&(_+=`?${u.params.toString()}`);try{let A=X(p,t,i),d={method:u.method,...u.data&&{body:JSON.stringify(u.data)},headers:{...A}},f=await r(_,d);if(f.status!==200){let T=null;try{T=await f.json()}catch{}let h=xe(f.status,T?.message,T?.details,{requestId:f.headers.get("X-Wix-Request-Id"),details:T}),P=Q(h);throw n?.handleError(P,{requestOptions:{url:u.url,method:u.method,entityFqdn:p.entityFqdn,methodFqn:p.methodFqn}}),h}let E=await f.json();return{data:u.migrationOptions?.optInTransformResponse&&u.transformResponse?Array.isArray(u.transformResponse)?u.transformResponse[0](E):u.transformResponse(E):E,headers:f.headers,status:f.status,statusText:f.statusText}}catch(A){throw A.message?.includes("fetch is not defined")&&console.error("Node.js v18+ is required"),A}},fetchWithAuth:r,wixAPIFetch:s,getActiveToken:o}))}var C=class extends Error{constructor(r){super();m(this,"response");m(this,"requestId");this.response=r.response,this.requestId=r.requestId}},xe=(e,t,r,n)=>new C({response:{data:{details:{...!r?.validationError&&{applicationError:{description:t,code:e,data:n}},...r},message:t},status:e},requestId:n?.requestId});j();var Re=".";function Z(e,t,r){if(e==null)throw new Error("Cannot set value on null or undefined");let n=O(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 O(e){return Array.isArray(e)?e:e.split(Re).map(t=>be(t)?Number(t):t)}function be(e){return/^\d+$/.test(e)}function ee(e){let t={};for(let[r,n]of Object.entries(e)){if(Ie(r))continue;let s=O(r);Z(t,s,n)}return t}function Ie(e){return e==="__proto__"||e==="constructor"||e==="prototype"}var D=class{constructor(t){m(this,"BRACKET_PATTERN",/\[(\d+)\]/g);m(this,"NUMERIC_PATTERN",/^\d+$/);m(this,"ESCAPED_DOT_PATTERN",/\\\./g);m(this,"ESCAPED_LEFT_BRACKET_PATTERN",/\\\[/g);m(this,"ESCAPED_RIGHT_BRACKET_PATTERN",/\\\]/g);m(this,"SPLIT_PATTERN",/\.|\[(\d+)\]/g);m(this,"DOT_BEFORE_BRACKET_PATTERN",/\.\[/g);m(this,"ESCAPED_DOT_PLACEHOLDER","__DOT__");m(this,"ESCAPED_RIGHT_BRACKET_PLACEHOLDER","__RB__");m(this,"ESCAPED_LEFT_BRACKET_PLACEHOLDER","__LB__");m(this,"modifiedFields");m(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])),ee(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,l)=>{let p=c in H?H[c]:void 0;if(p&&p in l){s.push(p),n=l[p];return}let u=ve(c);if(u&&u in l){s.push(u),n=l[u];return}throw new Error(`Cannot find key '${c}' or its transformations at path ${this.buildPathString(s)}`)},i=(c,l)=>{s.push(c),n=l[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 l=n;if(c in n){i(c,l);continue}a(c,l)}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 te(e,t){let r=e?.modifiedFields;if(!r)return null;let n=Se(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 Se(e){if(typeof e=="object"&&e!==null&&!Array.isArray(e))try{let t=new D(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 ve(e){return e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^./,t=>t.toLowerCase())}function L(){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 re=e=>e.__type==="event-definition";function se(e,t,r,n){let s;if(e.isDomainEvent){let c=r,{deletedEvent:l,actionEvent:p,createdEvent:u,updatedEvent:y,..._}=c,A={...n,..._};l?l?.deletedEntity?s={entity:l?.deletedEntity,metadata:A}:s={metadata:A}:p?s={data:p.body,metadata:A}:y?s={entity:y.currentEntity,metadata:A,...y.modifiedFields?{modifiedFields:y.modifiedFields}:{}}:s={entity:u?.entity,metadata:A}}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 l=te(i,o);if(l)return t(l)}}return t(o(a))}function ne(e){let t=new Map,r=L(),n={...r,getRegisteredEvents:()=>t,async process(s,o={expectedEvents:[]}){let{eventType:a,identity:i,instanceId:c,payload:l,accountInfo:p}=await this.parseJWT(s),u=[...o.expectedEvents,...Array.from(t.keys()).map(_=>({type:_}))];if(u.length>0&&!u.some(({type:_})=>_===a))throw new Error(`Unexpected event type: ${a}. Expected one of: ${u.map(_=>_.type).join(", ")}`);let y=t.get(a)??[];return await Promise.all(y.map(({eventDefinition:_,handler:A})=>se(_,A,l,{instanceId:c,identity:i,accountInfo:p}))),{instanceId:c,eventType:a,payload:l,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),l=c.eventType,p=c.accountInfo,u=c.instanceId,y=c.identity?JSON.parse(c.identity):void 0,_=JSON.parse(c.data);return{instanceId:u,eventType:l,payload:_,identity:y,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})=>se(i,c,s.payload,{instanceId:s.instanceId,identity:s.identity})))},apps:{AppInstalled:v("AppInstalled")(),AppRemoved:v("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 oe=e=>e.__type==="service-plugin-definition";function ae(e){let t=new Map,r=L(),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:l}=i[0],p=l.methods.find(y=>o.endsWith(y.primaryHttpMappingPath));if(!p)throw new Error("Unexpect request: request url did not match any method: "+o);let u=c[p.name];if(!u)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 u(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 yt(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=async(d,f)=>{let E=await o(),g={...f?.headers??{},...E.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}},T=e.host?.getErrorHandler?.();try{if(typeof d=="string"||d instanceof URL){let h=await fetch(d,{...f,headers:g});T?.handleError(h,{requestOptions:{url:d.toString(),method:f?.method}});let P=N(h);return P&&(t[w]=P),h}else{for(let[U,M]of Object.entries(g))typeof M=="string"&&d.headers.set(U,M);let h=await fetch(d,f);T?.handleError(h,{requestOptions:{url:d.url,method:f?.method}});let P=N(h);return P&&(t[w]=P),h}}catch(h){throw T?.handleError(h,{requestOptions:{url:typeof d=="string"||d instanceof URL?d.toString():d.url,method:f?.method}}),h}},{client:i,initModule:c}=ae(s),{client:l,initModule:p}=ne(s),u=async(d,f)=>{let E=await o(),g=K(f),T=await fetch(d,{...f,headers:{...g,...t,...E?.headers,...f?.headers,...e.host?.essentials?.passThroughHeaders,...t[w]?{[w]:t[w]}:{}}}),h=N(T);return h&&(t[w]=h),T},y=(d,f)=>{if(re(d))return p(d);if(oe(d))return c(d);if(k(d)&&e.host)return G(d,e.host);if(typeof d=="function"){if("__type"in d&&d.__type===$)return d;let E=e.host?.apiBaseUrl??x,g=e.useCDN===void 0?s().shouldUseCDN:e.useCDN;return V(R(()=>q(d))?F(d):d,f??{},u,e.host?.getErrorHandler?.(),(T,h)=>{let P=new URL(T,`https://${E}`);return P.host=E,P.protocol="https",u(P.toString(),h)},s().getActiveToken,{HTTPHost:E},e.host?.name,g)}else return J(d)?Object.fromEntries(Object.entries(d).map(([E,g])=>[E,y(g,d[W])])):d},_=d=>{for(let f in d)t[f]=d[f]};return{...e.modules?y(e.modules):{},get auth(){let d=s(),f=d.getAuthHeaders;return d.getAuthHeaders=f.bind(void 0,e.host),d},setHeaders:_,use:y,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?ie.elevatedClient=this:ie.client=this},fetch:(d,f)=>{let E=e.host?.apiBaseUrl??x,g=new URL(d,`https://${E}`);return g.host=E,g.protocol="https",u(g.toString(),f)},fetchWithAuth:a,async graphql(d,f,E={apiVersion:"alpha"}){let g=e?.host?.apiBaseUrl??x,T=await u(`https://${g}/graphql/${E.apiVersion}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:d,variables:f})});if(T.status!==200)throw new b(`GraphQL request failed with status ${T.status}`,T);let{data:h,errors:P}=await T.json();return{data:h??{},errors:P}},webhooks:l,servicePlugins:i}}function N(e){return e.headers?.get(w)??e.headers?.get(w.toLowerCase())}export{yt as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QSTEFEOT.js.map
|