@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
|
@@ -3635,11 +3635,11 @@ async function importWithAlgCache(cache, jwk, alg) {
|
|
|
3635
3635
|
return cached[alg];
|
|
3636
3636
|
}
|
|
3637
3637
|
function createLocalJWKSet(jwks) {
|
|
3638
|
-
const
|
|
3639
|
-
const localJWKSet = async (protectedHeader, token) =>
|
|
3638
|
+
const set3 = new LocalJWKSet(jwks);
|
|
3639
|
+
const localJWKSet = async (protectedHeader, token) => set3.getKey(protectedHeader, token);
|
|
3640
3640
|
Object.defineProperties(localJWKSet, {
|
|
3641
3641
|
jwks: {
|
|
3642
|
-
value: () => clone(
|
|
3642
|
+
value: () => clone(set3._jwks),
|
|
3643
3643
|
enumerable: true,
|
|
3644
3644
|
configurable: false,
|
|
3645
3645
|
writable: false
|
|
@@ -3784,32 +3784,32 @@ function isFreshJwksCache(input, cacheMaxAge) {
|
|
|
3784
3784
|
return true;
|
|
3785
3785
|
}
|
|
3786
3786
|
function createRemoteJWKSet(url, options) {
|
|
3787
|
-
const
|
|
3788
|
-
const remoteJWKSet = async (protectedHeader, token) =>
|
|
3787
|
+
const set3 = new RemoteJWKSet(url, options);
|
|
3788
|
+
const remoteJWKSet = async (protectedHeader, token) => set3.getKey(protectedHeader, token);
|
|
3789
3789
|
Object.defineProperties(remoteJWKSet, {
|
|
3790
3790
|
coolingDown: {
|
|
3791
|
-
get: () =>
|
|
3791
|
+
get: () => set3.coolingDown(),
|
|
3792
3792
|
enumerable: true,
|
|
3793
3793
|
configurable: false
|
|
3794
3794
|
},
|
|
3795
3795
|
fresh: {
|
|
3796
|
-
get: () =>
|
|
3796
|
+
get: () => set3.fresh(),
|
|
3797
3797
|
enumerable: true,
|
|
3798
3798
|
configurable: false
|
|
3799
3799
|
},
|
|
3800
3800
|
reload: {
|
|
3801
|
-
value: () =>
|
|
3801
|
+
value: () => set3.reload(),
|
|
3802
3802
|
enumerable: true,
|
|
3803
3803
|
configurable: false,
|
|
3804
3804
|
writable: false
|
|
3805
3805
|
},
|
|
3806
3806
|
reloading: {
|
|
3807
|
-
get: () => !!
|
|
3807
|
+
get: () => !!set3._pendingFetch,
|
|
3808
3808
|
enumerable: true,
|
|
3809
3809
|
configurable: false
|
|
3810
3810
|
},
|
|
3811
3811
|
jwks: {
|
|
3812
|
-
value: () =>
|
|
3812
|
+
value: () => set3._local?.jwks(),
|
|
3813
3813
|
enumerable: true,
|
|
3814
3814
|
configurable: false,
|
|
3815
3815
|
writable: false
|
|
@@ -4445,6 +4445,15 @@ function EventDefinition(type, isDomainEvent = false, transformations = (x) => x
|
|
|
4445
4445
|
});
|
|
4446
4446
|
}
|
|
4447
4447
|
var SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
4448
|
+
var SORT_DIRECTIONS = {
|
|
4449
|
+
ASC: "ASC",
|
|
4450
|
+
DESC: "DESC"
|
|
4451
|
+
};
|
|
4452
|
+
var SORT_CAPABILITIES = {
|
|
4453
|
+
...SORT_DIRECTIONS,
|
|
4454
|
+
BOTH: "BOTH",
|
|
4455
|
+
NONE: "NONE"
|
|
4456
|
+
};
|
|
4448
4457
|
|
|
4449
4458
|
// ../../node_modules/@wix/sdk/build/ambassador-modules.js
|
|
4450
4459
|
var parseMethod = (method) => {
|
|
@@ -4627,6 +4636,13 @@ function runWithoutContext(fn) {
|
|
|
4627
4636
|
}
|
|
4628
4637
|
}
|
|
4629
4638
|
|
|
4639
|
+
// ../../node_modules/@wix/sdk-runtime/build/constants.js
|
|
4640
|
+
var RESTResponseToSDKResponseRenameMap = {
|
|
4641
|
+
id: "_id",
|
|
4642
|
+
createdDate: "_createdDate",
|
|
4643
|
+
updatedDate: "_updatedDate"
|
|
4644
|
+
};
|
|
4645
|
+
|
|
4630
4646
|
// ../../node_modules/@wix/sdk-runtime/build/utils.js
|
|
4631
4647
|
function constantCase(input) {
|
|
4632
4648
|
return split(input).map((part) => part.toLocaleUpperCase()).join("_");
|
|
@@ -4913,6 +4929,239 @@ var errorBuilder2 = (code, description, details, data) => {
|
|
|
4913
4929
|
});
|
|
4914
4930
|
};
|
|
4915
4931
|
|
|
4932
|
+
// ../../node_modules/@wix/sdk-runtime/build/rest-modules.js
|
|
4933
|
+
var DOMAINS = ["wix.com", "editorx.com"];
|
|
4934
|
+
var REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
|
|
4935
|
+
var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
|
|
4936
|
+
var DEV_WIX_CODE_DOMAIN = "dev.wix-code.com";
|
|
4937
|
+
var REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\.(${WIX_API_DOMAINS.join("|")})$`);
|
|
4938
|
+
var REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\.${DEV_WIX_CODE_DOMAIN}$`);
|
|
4939
|
+
|
|
4940
|
+
// ../../node_modules/@wix/sdk/build/object-utils.js
|
|
4941
|
+
var DELIMITER = ".";
|
|
4942
|
+
function set(obj, path, value) {
|
|
4943
|
+
if (obj == null) {
|
|
4944
|
+
throw new Error("Cannot set value on null or undefined");
|
|
4945
|
+
}
|
|
4946
|
+
const keys = toPathObject(path);
|
|
4947
|
+
let current = obj;
|
|
4948
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4949
|
+
const key = keys[i];
|
|
4950
|
+
if (i === keys.length - 1) {
|
|
4951
|
+
current[key] = value;
|
|
4952
|
+
break;
|
|
4953
|
+
}
|
|
4954
|
+
const nextKey = keys[i + 1];
|
|
4955
|
+
if (!(key in current) || current[key] == null) {
|
|
4956
|
+
current[key] = typeof nextKey === "number" ? [] : {};
|
|
4957
|
+
} else if (typeof current[key] !== "object" || current[key] === null) {
|
|
4958
|
+
current[key] = typeof nextKey === "number" ? [] : {};
|
|
4959
|
+
}
|
|
4960
|
+
current = current[key];
|
|
4961
|
+
}
|
|
4962
|
+
return obj;
|
|
4963
|
+
}
|
|
4964
|
+
function toPathObject(path) {
|
|
4965
|
+
if (Array.isArray(path)) {
|
|
4966
|
+
return path;
|
|
4967
|
+
}
|
|
4968
|
+
return path.split(DELIMITER).map((segment) => isNumericSegment(segment) ? Number(segment) : segment);
|
|
4969
|
+
}
|
|
4970
|
+
function isNumericSegment(segment) {
|
|
4971
|
+
return /^\d+$/.test(segment);
|
|
4972
|
+
}
|
|
4973
|
+
|
|
4974
|
+
// ../../node_modules/@wix/sdk/build/flat-utils.js
|
|
4975
|
+
function unflatten(flatObject) {
|
|
4976
|
+
const result = {};
|
|
4977
|
+
for (const [flatKey, value] of Object.entries(flatObject)) {
|
|
4978
|
+
if (isPrototypePollutionKey(flatKey)) {
|
|
4979
|
+
continue;
|
|
4980
|
+
}
|
|
4981
|
+
const path = toPathObject(flatKey);
|
|
4982
|
+
set(result, path, value);
|
|
4983
|
+
}
|
|
4984
|
+
return result;
|
|
4985
|
+
}
|
|
4986
|
+
function isPrototypePollutionKey(key) {
|
|
4987
|
+
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
4988
|
+
}
|
|
4989
|
+
|
|
4990
|
+
// ../../node_modules/@wix/sdk/build/modified-fields-manipulator.js
|
|
4991
|
+
var ModifiedFieldsManipulator = class {
|
|
4992
|
+
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
4993
|
+
NUMERIC_PATTERN = /^\d+$/;
|
|
4994
|
+
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
4995
|
+
ESCAPED_LEFT_BRACKET_PATTERN = /\\\[/g;
|
|
4996
|
+
ESCAPED_RIGHT_BRACKET_PATTERN = /\\\]/g;
|
|
4997
|
+
SPLIT_PATTERN = /\.|\[(\d+)\]/g;
|
|
4998
|
+
DOT_BEFORE_BRACKET_PATTERN = /\.\[/g;
|
|
4999
|
+
ESCAPED_DOT_PLACEHOLDER = "__DOT__";
|
|
5000
|
+
ESCAPED_RIGHT_BRACKET_PLACEHOLDER = "__RB__";
|
|
5001
|
+
ESCAPED_LEFT_BRACKET_PLACEHOLDER = "__LB__";
|
|
5002
|
+
modifiedFields;
|
|
5003
|
+
cleanedModifiedFields;
|
|
5004
|
+
constructor(modifiedFields) {
|
|
5005
|
+
this.modifiedFields = modifiedFields;
|
|
5006
|
+
}
|
|
5007
|
+
replaceEscapedCharacters(key) {
|
|
5008
|
+
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);
|
|
5009
|
+
}
|
|
5010
|
+
restoreEscapedCharacters(key) {
|
|
5011
|
+
return key.replace(this.ESCAPED_DOT_PLACEHOLDER, "\\.").replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, "\\]").replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, "\\[");
|
|
5012
|
+
}
|
|
5013
|
+
unflatten() {
|
|
5014
|
+
this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([key, value]) => [
|
|
5015
|
+
this.replaceEscapedCharacters(this.bracketToDotNotation(key)),
|
|
5016
|
+
value
|
|
5017
|
+
]));
|
|
5018
|
+
return unflatten(this.cleanedModifiedFields);
|
|
5019
|
+
}
|
|
5020
|
+
flatten(transformedModifiedFields) {
|
|
5021
|
+
let result = {};
|
|
5022
|
+
for (const originalKey of Object.keys(this.cleanedModifiedFields)) {
|
|
5023
|
+
const pathParts = this.splitPath(originalKey);
|
|
5024
|
+
const value = this.navigatePath(transformedModifiedFields, pathParts);
|
|
5025
|
+
result = { ...result, ...value };
|
|
5026
|
+
}
|
|
5027
|
+
return Object.fromEntries(Object.entries(result).map(([key, value]) => [
|
|
5028
|
+
this.restoreEscapedCharacters(key),
|
|
5029
|
+
value
|
|
5030
|
+
]));
|
|
5031
|
+
}
|
|
5032
|
+
splitPath(path) {
|
|
5033
|
+
const parts = [];
|
|
5034
|
+
let lastIndex = 0;
|
|
5035
|
+
const matches = Array.from(path.matchAll(this.SPLIT_PATTERN));
|
|
5036
|
+
for (const match of matches) {
|
|
5037
|
+
if (match.index > lastIndex) {
|
|
5038
|
+
parts.push(path.substring(lastIndex, match.index));
|
|
5039
|
+
}
|
|
5040
|
+
if (match[1]) {
|
|
5041
|
+
parts.push(match[1]);
|
|
5042
|
+
}
|
|
5043
|
+
lastIndex = match.index + match[0].length;
|
|
5044
|
+
}
|
|
5045
|
+
if (lastIndex < path.length) {
|
|
5046
|
+
parts.push(path.substring(lastIndex));
|
|
5047
|
+
}
|
|
5048
|
+
return parts;
|
|
5049
|
+
}
|
|
5050
|
+
navigatePath(obj, pathParts) {
|
|
5051
|
+
let current = obj;
|
|
5052
|
+
const transformedPath = [];
|
|
5053
|
+
const handleArray = (part) => {
|
|
5054
|
+
if (!Array.isArray(current)) {
|
|
5055
|
+
throw new Error(`Expected array at path ${this.buildPathString(transformedPath)}, but got ${typeof current}`);
|
|
5056
|
+
}
|
|
5057
|
+
transformedPath.push(`[${part}]`);
|
|
5058
|
+
current = current[parseInt(part, 10)];
|
|
5059
|
+
};
|
|
5060
|
+
const handleTransformedKeyName = (part, currentObj) => {
|
|
5061
|
+
const transformedKey = part in RESTResponseToSDKResponseRenameMap ? RESTResponseToSDKResponseRenameMap[part] : void 0;
|
|
5062
|
+
if (transformedKey && transformedKey in currentObj) {
|
|
5063
|
+
transformedPath.push(transformedKey);
|
|
5064
|
+
current = currentObj[transformedKey];
|
|
5065
|
+
return;
|
|
5066
|
+
}
|
|
5067
|
+
const camelCaseKey = camelCase(part);
|
|
5068
|
+
if (camelCaseKey && camelCaseKey in currentObj) {
|
|
5069
|
+
transformedPath.push(camelCaseKey);
|
|
5070
|
+
current = currentObj[camelCaseKey];
|
|
5071
|
+
return;
|
|
5072
|
+
}
|
|
5073
|
+
throw new Error(`Cannot find key '${part}' or its transformations at path ${this.buildPathString(transformedPath)}`);
|
|
5074
|
+
};
|
|
5075
|
+
const handleObject = (part, currentObj) => {
|
|
5076
|
+
transformedPath.push(part);
|
|
5077
|
+
current = currentObj[part];
|
|
5078
|
+
return;
|
|
5079
|
+
};
|
|
5080
|
+
for (const part of pathParts) {
|
|
5081
|
+
if (this.NUMERIC_PATTERN.test(part)) {
|
|
5082
|
+
handleArray(part);
|
|
5083
|
+
continue;
|
|
5084
|
+
}
|
|
5085
|
+
if (current === null || typeof current !== "object") {
|
|
5086
|
+
throw new Error(`Cannot access property '${part}' on ${typeof current} at path ${this.buildPathString(transformedPath)}`);
|
|
5087
|
+
}
|
|
5088
|
+
const currentObj = current;
|
|
5089
|
+
if (part in current) {
|
|
5090
|
+
handleObject(part, currentObj);
|
|
5091
|
+
continue;
|
|
5092
|
+
}
|
|
5093
|
+
handleTransformedKeyName(part, currentObj);
|
|
5094
|
+
}
|
|
5095
|
+
return { [this.buildPathString(transformedPath)]: current };
|
|
5096
|
+
}
|
|
5097
|
+
buildPathString(pathParts) {
|
|
5098
|
+
return pathParts.join(".").replace(this.DOT_BEFORE_BRACKET_PATTERN, "[");
|
|
5099
|
+
}
|
|
5100
|
+
bracketToDotNotation(key) {
|
|
5101
|
+
return key.replace(this.BRACKET_PATTERN, (match, number, offset) => {
|
|
5102
|
+
if (offset > 0 && key[offset - 1] === "\\") {
|
|
5103
|
+
return match;
|
|
5104
|
+
}
|
|
5105
|
+
return "." + number;
|
|
5106
|
+
});
|
|
5107
|
+
}
|
|
5108
|
+
};
|
|
5109
|
+
function attemptTransformationWithModifiedFields(envelope, transformFromRESTFn) {
|
|
5110
|
+
const modifiedFields = envelope?.modifiedFields;
|
|
5111
|
+
if (!modifiedFields) {
|
|
5112
|
+
return null;
|
|
5113
|
+
}
|
|
5114
|
+
const unflattenedResult = attemptUnflatten(modifiedFields);
|
|
5115
|
+
if (!unflattenedResult) {
|
|
5116
|
+
return null;
|
|
5117
|
+
}
|
|
5118
|
+
const { unflattenedModifiedFields, modifiedFieldsManipulator } = unflattenedResult;
|
|
5119
|
+
envelope = {
|
|
5120
|
+
...envelope,
|
|
5121
|
+
modifiedFields: unflattenedModifiedFields
|
|
5122
|
+
};
|
|
5123
|
+
const transformedEnvelope = transformFromRESTFn(envelope);
|
|
5124
|
+
const transformedModifiedFields = transformedEnvelope?.modifiedFields;
|
|
5125
|
+
if (!transformedModifiedFields) {
|
|
5126
|
+
return null;
|
|
5127
|
+
}
|
|
5128
|
+
const flattened = attemptFlatten(transformedModifiedFields, modifiedFieldsManipulator);
|
|
5129
|
+
if (flattened !== null) {
|
|
5130
|
+
transformedEnvelope.modifiedFields = flattened;
|
|
5131
|
+
return transformedEnvelope;
|
|
5132
|
+
}
|
|
5133
|
+
return null;
|
|
5134
|
+
}
|
|
5135
|
+
function attemptUnflatten(modifiedFields) {
|
|
5136
|
+
if (typeof modifiedFields === "object" && modifiedFields !== null && !Array.isArray(modifiedFields)) {
|
|
5137
|
+
try {
|
|
5138
|
+
const modifiedFieldsManipulator = new ModifiedFieldsManipulator(modifiedFields);
|
|
5139
|
+
const unflattened = modifiedFieldsManipulator.unflatten();
|
|
5140
|
+
return {
|
|
5141
|
+
unflattenedModifiedFields: unflattened,
|
|
5142
|
+
modifiedFieldsManipulator
|
|
5143
|
+
};
|
|
5144
|
+
} catch (error) {
|
|
5145
|
+
return null;
|
|
5146
|
+
}
|
|
5147
|
+
}
|
|
5148
|
+
return null;
|
|
5149
|
+
}
|
|
5150
|
+
function attemptFlatten(transformedModifiedFields, modifiedFieldsManipulator) {
|
|
5151
|
+
if (typeof transformedModifiedFields === "object" && transformedModifiedFields !== null && !Array.isArray(transformedModifiedFields)) {
|
|
5152
|
+
try {
|
|
5153
|
+
const flattened = modifiedFieldsManipulator.flatten(transformedModifiedFields);
|
|
5154
|
+
return flattened;
|
|
5155
|
+
} catch (error) {
|
|
5156
|
+
return null;
|
|
5157
|
+
}
|
|
5158
|
+
}
|
|
5159
|
+
return null;
|
|
5160
|
+
}
|
|
5161
|
+
function camelCase(str) {
|
|
5162
|
+
return str.replace(/[-_\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").replace(/^./, (c) => c.toLowerCase());
|
|
5163
|
+
}
|
|
5164
|
+
|
|
4916
5165
|
// ../../node_modules/@wix/sdk/build/nanoevents.js
|
|
4917
5166
|
function createNanoEvents() {
|
|
4918
5167
|
return {
|
|
@@ -4956,9 +5205,15 @@ function runHandler(eventDefinition, handler, payload, baseEventMetadata) {
|
|
|
4956
5205
|
data: actionEvent.body,
|
|
4957
5206
|
metadata
|
|
4958
5207
|
};
|
|
5208
|
+
} else if (updatedEvent) {
|
|
5209
|
+
envelope = {
|
|
5210
|
+
entity: updatedEvent.currentEntity,
|
|
5211
|
+
metadata,
|
|
5212
|
+
...updatedEvent.modifiedFields ? { modifiedFields: updatedEvent.modifiedFields } : {}
|
|
5213
|
+
};
|
|
4959
5214
|
} else {
|
|
4960
5215
|
envelope = {
|
|
4961
|
-
entity: createdEvent?.entity
|
|
5216
|
+
entity: createdEvent?.entity,
|
|
4962
5217
|
metadata
|
|
4963
5218
|
};
|
|
4964
5219
|
}
|
|
@@ -4969,9 +5224,21 @@ function runHandler(eventDefinition, handler, payload, baseEventMetadata) {
|
|
|
4969
5224
|
};
|
|
4970
5225
|
}
|
|
4971
5226
|
const transformFromRESTFn = eventDefinition.transformations ?? ((x) => x);
|
|
4972
|
-
|
|
5227
|
+
let originalEnvelope = envelope;
|
|
5228
|
+
const envelopeAny = envelope;
|
|
5229
|
+
if (envelopeAny.modifiedFields) {
|
|
5230
|
+
const modifiedFieldsValue = envelopeAny.modifiedFields;
|
|
5231
|
+
if (typeof modifiedFieldsValue === "object" && modifiedFieldsValue !== null && !Array.isArray(modifiedFieldsValue)) {
|
|
5232
|
+
originalEnvelope = structuredClone(envelope);
|
|
5233
|
+
const transformedEnvelope = attemptTransformationWithModifiedFields(envelopeAny, transformFromRESTFn);
|
|
5234
|
+
if (transformedEnvelope) {
|
|
5235
|
+
return handler(transformedEnvelope);
|
|
5236
|
+
}
|
|
5237
|
+
}
|
|
5238
|
+
}
|
|
5239
|
+
return handler(transformFromRESTFn(originalEnvelope));
|
|
4973
5240
|
}
|
|
4974
|
-
function eventHandlersModules(
|
|
5241
|
+
function eventHandlersModules(getAuthStrategy) {
|
|
4975
5242
|
const eventHandlers = /* @__PURE__ */ new Map();
|
|
4976
5243
|
const webhooksEmitter = createNanoEvents();
|
|
4977
5244
|
const client = {
|
|
@@ -4980,7 +5247,7 @@ function eventHandlersModules(authStrategy) {
|
|
|
4980
5247
|
async process(jwt, opts = {
|
|
4981
5248
|
expectedEvents: []
|
|
4982
5249
|
}) {
|
|
4983
|
-
const { eventType, identity, instanceId, payload } = await this.parseJWT(jwt);
|
|
5250
|
+
const { eventType, identity, instanceId, payload, accountInfo } = await this.parseJWT(jwt);
|
|
4984
5251
|
const allExpectedEvents = [
|
|
4985
5252
|
...opts.expectedEvents,
|
|
4986
5253
|
...Array.from(eventHandlers.keys()).map((type) => ({ type }))
|
|
@@ -4991,13 +5258,15 @@ function eventHandlersModules(authStrategy) {
|
|
|
4991
5258
|
const handlers2 = eventHandlers.get(eventType) ?? [];
|
|
4992
5259
|
await Promise.all(handlers2.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, payload, {
|
|
4993
5260
|
instanceId,
|
|
4994
|
-
identity
|
|
5261
|
+
identity,
|
|
5262
|
+
accountInfo
|
|
4995
5263
|
})));
|
|
4996
5264
|
return {
|
|
4997
5265
|
instanceId,
|
|
4998
5266
|
eventType,
|
|
4999
5267
|
payload,
|
|
5000
|
-
identity
|
|
5268
|
+
identity,
|
|
5269
|
+
accountInfo
|
|
5001
5270
|
};
|
|
5002
5271
|
},
|
|
5003
5272
|
async processRequest(request, opts) {
|
|
@@ -5005,6 +5274,7 @@ function eventHandlersModules(authStrategy) {
|
|
|
5005
5274
|
return this.process(body, opts);
|
|
5006
5275
|
},
|
|
5007
5276
|
async parseJWT(jwt) {
|
|
5277
|
+
const authStrategy = getAuthStrategy();
|
|
5008
5278
|
if (!authStrategy.decodeJWT) {
|
|
5009
5279
|
throw new Error("decodeJWT is not supported by the authentication strategy");
|
|
5010
5280
|
}
|
|
@@ -5017,6 +5287,7 @@ function eventHandlersModules(authStrategy) {
|
|
|
5017
5287
|
}
|
|
5018
5288
|
const parsedDecoded = JSON.parse(decoded.data);
|
|
5019
5289
|
const eventType = parsedDecoded.eventType;
|
|
5290
|
+
const accountInfo = parsedDecoded.accountInfo;
|
|
5020
5291
|
const instanceId = parsedDecoded.instanceId;
|
|
5021
5292
|
const identity = parsedDecoded.identity ? JSON.parse(parsedDecoded.identity) : void 0;
|
|
5022
5293
|
const payload = JSON.parse(parsedDecoded.data);
|
|
@@ -5024,7 +5295,8 @@ function eventHandlersModules(authStrategy) {
|
|
|
5024
5295
|
instanceId,
|
|
5025
5296
|
eventType,
|
|
5026
5297
|
payload,
|
|
5027
|
-
identity
|
|
5298
|
+
identity,
|
|
5299
|
+
accountInfo
|
|
5028
5300
|
};
|
|
5029
5301
|
},
|
|
5030
5302
|
async parseRequest(request) {
|
|
@@ -5062,13 +5334,14 @@ function eventHandlersModules(authStrategy) {
|
|
|
5062
5334
|
|
|
5063
5335
|
// ../../node_modules/@wix/sdk/build/service-plugin-modules.js
|
|
5064
5336
|
var isServicePluginModule = (val) => val.__type === "service-plugin-definition";
|
|
5065
|
-
function servicePluginsModules(
|
|
5337
|
+
function servicePluginsModules(getAuthStrategy) {
|
|
5066
5338
|
const servicePluginsImplementations = /* @__PURE__ */ new Map();
|
|
5067
5339
|
const servicePluginsEmitter = createNanoEvents();
|
|
5068
5340
|
const client = {
|
|
5069
5341
|
...servicePluginsEmitter,
|
|
5070
5342
|
getRegisteredServicePlugins: () => servicePluginsImplementations,
|
|
5071
5343
|
async parseJWT(jwt) {
|
|
5344
|
+
const authStrategy = getAuthStrategy();
|
|
5072
5345
|
if (!authStrategy.decodeJWT) {
|
|
5073
5346
|
throw new Error("decodeJWT is not supported by the authentication strategy");
|
|
5074
5347
|
}
|
|
@@ -5139,11 +5412,14 @@ function servicePluginsModules(authStrategy) {
|
|
|
5139
5412
|
var X_WIX_CONSISTENT_HEADER = "X-Wix-Consistent";
|
|
5140
5413
|
function createClient(config) {
|
|
5141
5414
|
const _headers = config.headers || { Authorization: "" };
|
|
5142
|
-
const
|
|
5415
|
+
const defaultStrategy = {
|
|
5143
5416
|
getAuthHeaders: (_) => Promise.resolve({ headers: {} })
|
|
5144
5417
|
};
|
|
5145
|
-
const
|
|
5146
|
-
|
|
5418
|
+
const auth = config.auth;
|
|
5419
|
+
const getAuthStrategy = typeof auth === "function" ? auth : () => auth ?? defaultStrategy;
|
|
5420
|
+
const boundGetAuthHeaders = () => {
|
|
5421
|
+
return getAuthStrategy().getAuthHeaders(config.host);
|
|
5422
|
+
};
|
|
5147
5423
|
const fetchWithAuth = async (urlOrRequest, requestInit) => {
|
|
5148
5424
|
const authHeaders = await boundGetAuthHeaders();
|
|
5149
5425
|
const headers = {
|
|
@@ -5199,8 +5475,8 @@ function createClient(config) {
|
|
|
5199
5475
|
throw e;
|
|
5200
5476
|
}
|
|
5201
5477
|
};
|
|
5202
|
-
const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(
|
|
5203
|
-
const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(
|
|
5478
|
+
const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(getAuthStrategy);
|
|
5479
|
+
const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(getAuthStrategy);
|
|
5204
5480
|
const boundFetch = async (url, options) => {
|
|
5205
5481
|
const authHeaders = await boundGetAuthHeaders();
|
|
5206
5482
|
const defaultContentTypeHeader = getDefaultContentHeader(options);
|
|
@@ -5234,13 +5510,13 @@ function createClient(config) {
|
|
|
5234
5510
|
return modules;
|
|
5235
5511
|
}
|
|
5236
5512
|
const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;
|
|
5237
|
-
const shouldUseCDN = config.useCDN === void 0 ?
|
|
5513
|
+
const shouldUseCDN = config.useCDN === void 0 ? getAuthStrategy().shouldUseCDN : config.useCDN;
|
|
5238
5514
|
return buildRESTDescriptor(runWithoutContext(() => isAmbassadorModule(modules)) ? toHTTPModule(modules) : modules, metadata ?? {}, boundFetch, config.host?.getErrorHandler?.(), (relativeUrl, fetchOptions) => {
|
|
5239
5515
|
const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
|
|
5240
5516
|
finalUrl.host = apiBaseUrl;
|
|
5241
5517
|
finalUrl.protocol = "https";
|
|
5242
5518
|
return boundFetch(finalUrl.toString(), fetchOptions);
|
|
5243
|
-
},
|
|
5519
|
+
}, getAuthStrategy().getActiveToken, { HTTPHost: apiBaseUrl }, config.host?.name, shouldUseCDN);
|
|
5244
5520
|
} else if (isObject(modules)) {
|
|
5245
5521
|
return Object.fromEntries(Object.entries(modules).map(([key, value]) => {
|
|
5246
5522
|
return [key, use(value, modules[PUBLIC_METADATA_KEY])];
|
|
@@ -5257,7 +5533,12 @@ function createClient(config) {
|
|
|
5257
5533
|
const wrappedModules = config.modules ? use(config.modules) : {};
|
|
5258
5534
|
return {
|
|
5259
5535
|
...wrappedModules,
|
|
5260
|
-
auth
|
|
5536
|
+
get auth() {
|
|
5537
|
+
const authStrategy = getAuthStrategy();
|
|
5538
|
+
const originalGetAuthHeaders = authStrategy.getAuthHeaders;
|
|
5539
|
+
authStrategy.getAuthHeaders = originalGetAuthHeaders.bind(void 0, config.host);
|
|
5540
|
+
return authStrategy;
|
|
5541
|
+
},
|
|
5261
5542
|
setHeaders,
|
|
5262
5543
|
use,
|
|
5263
5544
|
enableContext(contextType, opts = { elevated: false }) {
|
|
@@ -12647,7 +12928,7 @@ function timing(aggregator, name, value, unit = "second", data) {
|
|
|
12647
12928
|
}
|
|
12648
12929
|
distribution(aggregator, name, value, { ...data, unit });
|
|
12649
12930
|
}
|
|
12650
|
-
function
|
|
12931
|
+
function set2(aggregator, name, value, data) {
|
|
12651
12932
|
addToMetricsAggregator(aggregator, SET_METRIC_TYPE, name, value, data);
|
|
12652
12933
|
}
|
|
12653
12934
|
function gauge(aggregator, name, value, data) {
|
|
@@ -12656,7 +12937,7 @@ function gauge(aggregator, name, value, data) {
|
|
|
12656
12937
|
var metrics = {
|
|
12657
12938
|
increment,
|
|
12658
12939
|
distribution,
|
|
12659
|
-
set,
|
|
12940
|
+
set: set2,
|
|
12660
12941
|
gauge,
|
|
12661
12942
|
timing,
|
|
12662
12943
|
/**
|