@wix/cli-app 1.1.164 → 1.1.166
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-U46BMFVU.js → AddPermissionCommand-AGZ6TBT7.js} +2 -2
- package/build/{DevCommand-YWRIFOIF.js → DevCommand-7FMNSUHV.js} +10 -10
- package/build/{GenerateCommand-AMNZH5AF.js → GenerateCommand-PNSM4OY4.js} +7 -7
- package/build/{LogsCommand-GHZITJ4T.js → LogsCommand-DMLGI5DE.js} +3 -3
- package/build/PreviewCommand-JNYEKW25.js +19 -0
- package/build/ReleaseCommand-C3SVTJQB.js +23 -0
- package/build/{ServeCommand-M42EXOG3.js → ServeCommand-7NUORVP2.js} +3 -3
- package/build/{build-T7X7PL7N.js → build-MJDWPRFY.js} +6 -6
- package/build/{chunk-RE4ID4UP.js → chunk-2MY7QQCL.js} +6 -6
- package/build/{chunk-FYDEESUF.js → chunk-2PKUEXXE.js} +4 -4
- package/build/{chunk-3EDHMQIU.js → chunk-46IYET3Y.js} +2 -2
- package/build/{chunk-DZ3D5WMG.js → chunk-5T4ALNIO.js} +7 -7
- package/build/{chunk-JBUC4W66.js → chunk-653TJU7I.js} +3 -3
- package/build/{chunk-BAQZEH6V.js → chunk-A4D4RSPQ.js} +2 -2
- package/build/{chunk-QC6FGGW3.js → chunk-ESVDFA6B.js} +3 -3
- package/build/{chunk-POOMMHIZ.js → chunk-GDTQBVDL.js} +2 -2
- package/build/{chunk-LPI46C5I.js → chunk-H3SI2KY5.js} +2 -2
- package/build/{chunk-74DVKY3Z.js → chunk-HDCH2WCL.js} +2 -2
- package/build/{chunk-CNBEY6LV.js → chunk-JDIWNPSE.js} +2 -2
- package/build/{chunk-Z4GMJP35.js → chunk-JWIQGUSY.js} +2 -2
- package/build/{chunk-Z4GMJP35.js.map → chunk-JWIQGUSY.js.map} +1 -1
- package/build/{chunk-WLAFKHEE.js → chunk-LQ6IMZDZ.js} +4 -4
- package/build/{chunk-AIEBGTGL.js → chunk-S4PWCDXT.js} +2 -2
- package/build/{chunk-3MWABOBS.js → chunk-T7S3EJPZ.js} +6 -6
- package/build/{chunk-BDFKTWJO.js → chunk-Y527U3BQ.js} +2 -2
- package/build/{chunk-CWEKJNH7.js → chunk-ZWCD4IUF.js} +2 -2
- package/build/cloudflare-runtime/entry.js +6 -6
- package/build/cloudflare-runtime/getRegisteredExtensions.js +6 -6
- package/build/index.js +23 -23
- package/build/platform-sdk/chunk-42Y3PAPA.js +2 -0
- package/build/platform-sdk/chunk-42Y3PAPA.js.map +1 -0
- package/build/platform-sdk/chunk-7JKHQSWI.js +2 -0
- package/build/platform-sdk/chunk-7JKHQSWI.js.map +1 -0
- package/build/platform-sdk/{chunk-UTEFPCPF.js → chunk-KXCY2KWZ.js} +2 -2
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/dashboard.js.map +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/site.js.map +1 -1
- package/build/platform-sdk/web-methods.js +1 -1
- package/build/{preview-YD4LLEOM.js → preview-V3RY4EZ5.js} +12 -12
- package/build/{release-Z6JEE7OI.js → release-3PRSCSLJ.js} +14 -14
- package/build/{render-command-ZT6KET7F.js → render-command-NQNLWE3A.js} +5 -5
- package/package.json +2 -2
- package/templates/dashboard-modal/dependencies.json +1 -1
- package/build/PreviewCommand-5L5QJVQF.js +0 -19
- package/build/ReleaseCommand-4MUB6PNS.js +0 -23
- package/build/platform-sdk/chunk-QSTEFEOT.js +0 -2
- package/build/platform-sdk/chunk-QSTEFEOT.js.map +0 -1
- package/build/platform-sdk/chunk-RSZB4TBC.js +0 -2
- package/build/platform-sdk/chunk-RSZB4TBC.js.map +0 -1
- /package/build/{AddPermissionCommand-U46BMFVU.js.map → AddPermissionCommand-AGZ6TBT7.js.map} +0 -0
- /package/build/{DevCommand-YWRIFOIF.js.map → DevCommand-7FMNSUHV.js.map} +0 -0
- /package/build/{GenerateCommand-AMNZH5AF.js.map → GenerateCommand-PNSM4OY4.js.map} +0 -0
- /package/build/{LogsCommand-GHZITJ4T.js.map → LogsCommand-DMLGI5DE.js.map} +0 -0
- /package/build/{PreviewCommand-5L5QJVQF.js.map → PreviewCommand-JNYEKW25.js.map} +0 -0
- /package/build/{ReleaseCommand-4MUB6PNS.js.map → ReleaseCommand-C3SVTJQB.js.map} +0 -0
- /package/build/{ServeCommand-M42EXOG3.js.map → ServeCommand-7NUORVP2.js.map} +0 -0
- /package/build/{build-T7X7PL7N.js.map → build-MJDWPRFY.js.map} +0 -0
- /package/build/{chunk-RE4ID4UP.js.map → chunk-2MY7QQCL.js.map} +0 -0
- /package/build/{chunk-FYDEESUF.js.map → chunk-2PKUEXXE.js.map} +0 -0
- /package/build/{chunk-3EDHMQIU.js.map → chunk-46IYET3Y.js.map} +0 -0
- /package/build/{chunk-DZ3D5WMG.js.map → chunk-5T4ALNIO.js.map} +0 -0
- /package/build/{chunk-JBUC4W66.js.map → chunk-653TJU7I.js.map} +0 -0
- /package/build/{chunk-BAQZEH6V.js.map → chunk-A4D4RSPQ.js.map} +0 -0
- /package/build/{chunk-QC6FGGW3.js.map → chunk-ESVDFA6B.js.map} +0 -0
- /package/build/{chunk-POOMMHIZ.js.map → chunk-GDTQBVDL.js.map} +0 -0
- /package/build/{chunk-LPI46C5I.js.map → chunk-H3SI2KY5.js.map} +0 -0
- /package/build/{chunk-74DVKY3Z.js.map → chunk-HDCH2WCL.js.map} +0 -0
- /package/build/{chunk-CNBEY6LV.js.map → chunk-JDIWNPSE.js.map} +0 -0
- /package/build/{chunk-WLAFKHEE.js.map → chunk-LQ6IMZDZ.js.map} +0 -0
- /package/build/{chunk-AIEBGTGL.js.map → chunk-S4PWCDXT.js.map} +0 -0
- /package/build/{chunk-3MWABOBS.js.map → chunk-T7S3EJPZ.js.map} +0 -0
- /package/build/{chunk-BDFKTWJO.js.map → chunk-Y527U3BQ.js.map} +0 -0
- /package/build/{chunk-CWEKJNH7.js.map → chunk-ZWCD4IUF.js.map} +0 -0
- /package/build/platform-sdk/{chunk-UTEFPCPF.js.map → chunk-KXCY2KWZ.js.map} +0 -0
- /package/build/{preview-YD4LLEOM.js.map → preview-V3RY4EZ5.js.map} +0 -0
- /package/build/{release-Z6JEE7OI.js.map → release-3PRSCSLJ.js.map} +0 -0
- /package/build/{render-command-ZT6KET7F.js.map → render-command-NQNLWE3A.js.map} +0 -0
|
@@ -3,13 +3,13 @@ const require = _createRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
addUserFields,
|
|
5
5
|
reportCommandStartEvent
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-JDIWNPSE.js";
|
|
7
7
|
import {
|
|
8
8
|
messages_default
|
|
9
9
|
} from "./chunk-VJQHGLIW.js";
|
|
10
10
|
import {
|
|
11
11
|
DebugLogProvider
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-H3SI2KY5.js";
|
|
13
13
|
import {
|
|
14
14
|
AccountAuthProvider,
|
|
15
15
|
BiProvider,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
package_default,
|
|
27
27
|
render,
|
|
28
28
|
require_react
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-JWIQGUSY.js";
|
|
30
30
|
import {
|
|
31
31
|
__toESM,
|
|
32
32
|
init_esm_shims
|
|
@@ -120,4 +120,4 @@ export {
|
|
|
120
120
|
renderCommand,
|
|
121
121
|
runCommand
|
|
122
122
|
};
|
|
123
|
-
//# sourceMappingURL=chunk-
|
|
123
|
+
//# sourceMappingURL=chunk-LQ6IMZDZ.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
createRendererToString,
|
|
6
6
|
isCliError,
|
|
7
7
|
require_react
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JWIQGUSY.js";
|
|
9
9
|
import {
|
|
10
10
|
__toESM,
|
|
11
11
|
init_esm_shims
|
|
@@ -61,4 +61,4 @@ function createLogger({
|
|
|
61
61
|
export {
|
|
62
62
|
createLogger
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=chunk-
|
|
64
|
+
//# sourceMappingURL=chunk-S4PWCDXT.js.map
|
|
@@ -2,7 +2,7 @@ import { createRequire as _createRequire } from 'node:module';
|
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
readAppManifestFile
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-653TJU7I.js";
|
|
6
6
|
import {
|
|
7
7
|
ArmTagProvider,
|
|
8
8
|
ExtensionDataProvider,
|
|
@@ -16,16 +16,16 @@ import {
|
|
|
16
16
|
useResolvePlatformUrl,
|
|
17
17
|
useSite,
|
|
18
18
|
useSiteOverrideClient
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-5T4ALNIO.js";
|
|
20
20
|
import {
|
|
21
21
|
useBackendComponents
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-HDCH2WCL.js";
|
|
23
23
|
import {
|
|
24
24
|
getMonitoringProvider,
|
|
25
25
|
updateAppManifestComponents,
|
|
26
26
|
updateMonitoring,
|
|
27
27
|
updateTopology
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ESVDFA6B.js";
|
|
29
29
|
import {
|
|
30
30
|
Alert,
|
|
31
31
|
Box_default,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
useHttpClient,
|
|
55
55
|
useProjectModel,
|
|
56
56
|
useTranslation
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-JWIQGUSY.js";
|
|
58
58
|
import {
|
|
59
59
|
__toESM,
|
|
60
60
|
init_esm_shims
|
|
@@ -282,4 +282,4 @@ export {
|
|
|
282
282
|
assertBuildOutputExists,
|
|
283
283
|
PreviewCommand
|
|
284
284
|
};
|
|
285
|
-
//# sourceMappingURL=chunk-
|
|
285
|
+
//# sourceMappingURL=chunk-T7S3EJPZ.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
require_lib,
|
|
11
11
|
require_react,
|
|
12
12
|
useTranslation
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JWIQGUSY.js";
|
|
14
14
|
import {
|
|
15
15
|
__toESM,
|
|
16
16
|
init_esm_shims
|
|
@@ -179,4 +179,4 @@ export {
|
|
|
179
179
|
docsExtensionTypeSchema,
|
|
180
180
|
getGenerateFlowByDocsExtensionType
|
|
181
181
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
182
|
+
//# sourceMappingURL=chunk-Y527U3BQ.js.map
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
useHttpClient,
|
|
19
19
|
usePanoramaMethodLogger,
|
|
20
20
|
wixCliAppsFlowTunnelCreationStatusSrc11Evid5233
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-JWIQGUSY.js";
|
|
22
22
|
import {
|
|
23
23
|
__commonJS,
|
|
24
24
|
__dirname,
|
|
@@ -906,4 +906,4 @@ init_esm_shims();
|
|
|
906
906
|
export {
|
|
907
907
|
useTunnel
|
|
908
908
|
};
|
|
909
|
-
//# sourceMappingURL=chunk-
|
|
909
|
+
//# sourceMappingURL=chunk-ZWCD4IUF.js.map
|
|
@@ -4435,7 +4435,7 @@ import { dirname, sep } from "node:path";
|
|
|
4435
4435
|
// ../../node_modules/@wix/sdk-context/build/browser/index.mjs
|
|
4436
4436
|
var wixContext = {};
|
|
4437
4437
|
|
|
4438
|
-
// ../../node_modules/@wix/sdk-types/build/browser/index.mjs
|
|
4438
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-types/build/browser/index.mjs
|
|
4439
4439
|
function EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {
|
|
4440
4440
|
return () => ({
|
|
4441
4441
|
__type: "event-definition",
|
|
@@ -4604,7 +4604,7 @@ function objectToKeyValue(input) {
|
|
|
4604
4604
|
return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
|
|
4605
4605
|
}
|
|
4606
4606
|
|
|
4607
|
-
// ../../node_modules/@wix/sdk-runtime/build/context.js
|
|
4607
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
|
|
4608
4608
|
function runWithoutContext(fn) {
|
|
4609
4609
|
const globalContext = globalThis.__wix_context__;
|
|
4610
4610
|
const moduleContext = {
|
|
@@ -4636,14 +4636,14 @@ function runWithoutContext(fn) {
|
|
|
4636
4636
|
}
|
|
4637
4637
|
}
|
|
4638
4638
|
|
|
4639
|
-
// ../../node_modules/@wix/sdk-runtime/build/constants.js
|
|
4639
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/constants.js
|
|
4640
4640
|
var RESTResponseToSDKResponseRenameMap = {
|
|
4641
4641
|
id: "_id",
|
|
4642
4642
|
createdDate: "_createdDate",
|
|
4643
4643
|
updatedDate: "_updatedDate"
|
|
4644
4644
|
};
|
|
4645
4645
|
|
|
4646
|
-
// ../../node_modules/@wix/sdk-runtime/build/utils.js
|
|
4646
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/utils.js
|
|
4647
4647
|
function constantCase(input) {
|
|
4648
4648
|
return split(input).map((part) => part.toLocaleUpperCase()).join("_");
|
|
4649
4649
|
}
|
|
@@ -4669,7 +4669,7 @@ function split(value) {
|
|
|
4669
4669
|
return result.slice(start, end).split(/\0/g);
|
|
4670
4670
|
}
|
|
4671
4671
|
|
|
4672
|
-
// ../../node_modules/@wix/sdk-runtime/build/transform-error.js
|
|
4672
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/transform-error.js
|
|
4673
4673
|
var isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
|
|
4674
4674
|
var isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
|
|
4675
4675
|
var isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
|
|
@@ -4929,7 +4929,7 @@ var errorBuilder2 = (code, description, details, data) => {
|
|
|
4929
4929
|
});
|
|
4930
4930
|
};
|
|
4931
4931
|
|
|
4932
|
-
// ../../node_modules/@wix/sdk-runtime/build/rest-modules.js
|
|
4932
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js
|
|
4933
4933
|
var DOMAINS = ["wix.com", "editorx.com"];
|
|
4934
4934
|
var REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
|
|
4935
4935
|
var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
|
|
@@ -4278,7 +4278,7 @@ var init_browser = __esm({
|
|
|
4278
4278
|
// ../../node_modules/@wix/sdk-context/build/browser/index.mjs
|
|
4279
4279
|
var wixContext = {};
|
|
4280
4280
|
|
|
4281
|
-
// ../../node_modules/@wix/sdk-types/build/browser/index.mjs
|
|
4281
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-types/build/browser/index.mjs
|
|
4282
4282
|
function EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {
|
|
4283
4283
|
return () => ({
|
|
4284
4284
|
__type: "event-definition",
|
|
@@ -4447,7 +4447,7 @@ function objectToKeyValue(input) {
|
|
|
4447
4447
|
return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
|
|
4448
4448
|
}
|
|
4449
4449
|
|
|
4450
|
-
// ../../node_modules/@wix/sdk-runtime/build/context.js
|
|
4450
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
|
|
4451
4451
|
function runWithoutContext(fn) {
|
|
4452
4452
|
const globalContext = globalThis.__wix_context__;
|
|
4453
4453
|
const moduleContext = {
|
|
@@ -4479,14 +4479,14 @@ function runWithoutContext(fn) {
|
|
|
4479
4479
|
}
|
|
4480
4480
|
}
|
|
4481
4481
|
|
|
4482
|
-
// ../../node_modules/@wix/sdk-runtime/build/constants.js
|
|
4482
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/constants.js
|
|
4483
4483
|
var RESTResponseToSDKResponseRenameMap = {
|
|
4484
4484
|
id: "_id",
|
|
4485
4485
|
createdDate: "_createdDate",
|
|
4486
4486
|
updatedDate: "_updatedDate"
|
|
4487
4487
|
};
|
|
4488
4488
|
|
|
4489
|
-
// ../../node_modules/@wix/sdk-runtime/build/utils.js
|
|
4489
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/utils.js
|
|
4490
4490
|
function constantCase(input) {
|
|
4491
4491
|
return split(input).map((part) => part.toLocaleUpperCase()).join("_");
|
|
4492
4492
|
}
|
|
@@ -4512,7 +4512,7 @@ function split(value) {
|
|
|
4512
4512
|
return result.slice(start, end).split(/\0/g);
|
|
4513
4513
|
}
|
|
4514
4514
|
|
|
4515
|
-
// ../../node_modules/@wix/sdk-runtime/build/transform-error.js
|
|
4515
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/transform-error.js
|
|
4516
4516
|
var isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
|
|
4517
4517
|
var isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
|
|
4518
4518
|
var isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
|
|
@@ -4772,7 +4772,7 @@ var errorBuilder2 = (code, description, details, data) => {
|
|
|
4772
4772
|
});
|
|
4773
4773
|
};
|
|
4774
4774
|
|
|
4775
|
-
// ../../node_modules/@wix/sdk-runtime/build/rest-modules.js
|
|
4775
|
+
// ../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js
|
|
4776
4776
|
var DOMAINS = ["wix.com", "editorx.com"];
|
|
4777
4777
|
var REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
|
|
4778
4778
|
var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
|
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-Y527U3BQ.js";
|
|
7
7
|
import {
|
|
8
8
|
runCommand
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-LQ6IMZDZ.js";
|
|
10
|
+
import "./chunk-JDIWNPSE.js";
|
|
11
11
|
import "./chunk-VJQHGLIW.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-H3SI2KY5.js";
|
|
13
13
|
import {
|
|
14
14
|
external_exports,
|
|
15
15
|
package_default,
|
|
16
16
|
require_react
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-JWIQGUSY.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-NQNLWE3A.js");
|
|
3381
|
+
const { build } = await import("./build-MJDWPRFY.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-7FMNSUHV.js");
|
|
3447
|
+
const { renderCommand } = await import("./render-command-NQNLWE3A.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-NQNLWE3A.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-V3RY4EZ5.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-JNYEKW25.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-NQNLWE3A.js");
|
|
3514
|
+
const { AddPermissionCommand } = await import("./AddPermissionCommand-AGZ6TBT7.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-NQNLWE3A.js");
|
|
3531
|
+
const { ServeCommandDeprecated } = await import("./ServeCommand-7NUORVP2.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-PNSM4OY4.js");
|
|
3547
|
+
const { renderCommand } = await import("./render-command-NQNLWE3A.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-NQNLWE3A.js");
|
|
3572
|
+
const { LogsCommand } = await import("./LogsCommand-DMLGI5DE.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-NQNLWE3A.js");
|
|
3606
|
+
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-C3SVTJQB.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-3PRSCSLJ.js");
|
|
3621
3621
|
return nonInteractiveRelease(services, model, props);
|
|
3622
3622
|
});
|
|
3623
3623
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function p(n,e=!1,i=t=>t){return()=>({__type:"event-definition",type:n,isDomainEvent:e,transformations:i})}var h="wix_spi_error",u={ASC:"ASC",DESC:"DESC"},E={...u,BOTH:"BOTH",NONE:"NONE"};import{wixContext as o}from"@wix/sdk-context";function s(n,e){return(...i)=>{let t=l();return t?t.initWixModules(n,e).apply(void 0,i):n.apply(void 0,i)}}function l(){let n=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(n)return{initWixModules(t,r){return a(()=>n(t,r))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let e=typeof $wixContext<"u"?$wixContext.client:typeof o.client<"u"?o.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,i=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof o.elevatedClient<"u"?o.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!e&&!i))return{initWixModules(t,r){if(r){if(!i)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return a(()=>i.use(t))}if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return a(()=>e.use(t))},fetchWithAuth:(t,r)=>{if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.fetchWithAuth(t,r)},getAuth(){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.auth},async graphql(t,r,c){if(!e)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return e.graphql(t,r,c)}}}function a(n){let e=globalThis.__wix_context__,i={client:o.client,elevatedClient:o.elevatedClient},t;globalThis.__wix_context__=void 0,o.client=void 0,o.elevatedClient=void 0,typeof $wixContext<"u"&&(t={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return n()}finally{globalThis.__wix_context__=e,o.client=i.client,o.elevatedClient=i.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=t.client,$wixContext.elevatedClient=t.elevatedClient)}}var x={id:"_id",createdDate:"_createdDate",updatedDate:"_updatedDate"};function R(n,e=!1){return s(n,e)}var d=["wix.com","editorx.com"];var g=new RegExp(`\\.(${d.join("|")})$`),f=["42.wixprod.net","uw2-edt-1.wixprod.net"],_="dev.wix-code.com";var T=new RegExp(`\\.(${f.join("|")})$`),W=new RegExp(`.*\\.${_}$`);export{p as a,h as b,a as c,x as d,R as e};
|
|
2
|
+
//# sourceMappingURL=chunk-42Y3PAPA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/@wix/sdk/node_modules/@wix/sdk-types/build/browser/index.mjs","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context-v2.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/constants.js","../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/rest-modules.js"],"sourcesContent":["// src/event-handlers-modules.ts\nfunction EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {\n return () => ({\n __type: \"event-definition\",\n type,\n isDomainEvent,\n transformations\n });\n}\n\n// src/service-plugins.ts\nfunction ServicePluginDefinition(componentType, methods) {\n return {\n __type: \"service-plugin-definition\",\n componentType,\n methods\n };\n}\nvar SERVICE_PLUGIN_ERROR_TYPE = \"wix_spi_error\";\n\n// src/common/sort.ts\nvar SORT_DIRECTIONS = {\n ASC: \"ASC\",\n DESC: \"DESC\"\n};\nvar SORT_CAPABILITIES = {\n ...SORT_DIRECTIONS,\n BOTH: \"BOTH\",\n NONE: \"NONE\"\n};\nexport {\n EventDefinition,\n SERVICE_PLUGIN_ERROR_TYPE,\n SORT_CAPABILITIES,\n SORT_DIRECTIONS,\n ServicePluginDefinition\n};\n","import { wixContext } from '@wix/sdk-context';\nexport function resolveContext() {\n const oldContext = typeof $wixContext !== 'undefined' && $wixContext.initWixModules\n ? $wixContext.initWixModules\n : typeof globalThis.__wix_context__ !== 'undefined' &&\n globalThis.__wix_context__.initWixModules\n ? globalThis.__wix_context__.initWixModules\n : undefined;\n if (oldContext) {\n return {\n // @ts-expect-error\n initWixModules(modules, elevated) {\n return runWithoutContext(() => oldContext(modules, elevated));\n },\n fetchWithAuth() {\n throw new Error('fetchWithAuth is not available in this context');\n },\n graphql() {\n throw new Error('graphql is not available in this context');\n },\n };\n }\n const contextualClient = typeof $wixContext !== 'undefined'\n ? $wixContext.client\n : typeof wixContext.client !== 'undefined'\n ? wixContext.client\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.client\n : undefined;\n const elevatedClient = typeof $wixContext !== 'undefined'\n ? $wixContext.elevatedClient\n : typeof wixContext.elevatedClient !== 'undefined'\n ? wixContext.elevatedClient\n : typeof globalThis.__wix_context__ !== 'undefined'\n ? globalThis.__wix_context__.elevatedClient\n : undefined;\n if (!contextualClient && !elevatedClient) {\n return;\n }\n return {\n initWixModules(wixModules, elevated) {\n if (elevated) {\n if (!elevatedClient) {\n throw new Error('An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules');\n }\n return runWithoutContext(() => elevatedClient.use(wixModules));\n }\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return runWithoutContext(() => contextualClient.use(wixModules));\n },\n fetchWithAuth: (urlOrRequest, requestInit) => {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.fetchWithAuth(urlOrRequest, requestInit);\n },\n getAuth() {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.auth;\n },\n async graphql(query, variables, opts) {\n if (!contextualClient) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return contextualClient.graphql(query, variables, opts);\n },\n };\n}\nexport function contextualizeHostModule(hostModule, prop) {\n return (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(hostModule)[prop].apply(undefined, args);\n };\n}\nexport function getContextualAuth() {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.getAuth();\n}\nexport function contextualizeRESTModule(restModule, expectedArgsLength) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(restModule, args[expectedArgsLength]?.suppressAuth ? true : false)\n .apply(undefined, args);\n });\n}\nexport function contextualizeEventDefinitionModule(eventDefinition) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n}\nexport function contextualizeSerivcePluginModule(servicePlugin) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n}\nexport * from './context-v2.js';\nexport function runWithoutContext(fn) {\n const globalContext = globalThis.__wix_context__;\n const moduleContext = {\n client: wixContext.client,\n elevatedClient: wixContext.elevatedClient,\n };\n let closureContext;\n globalThis.__wix_context__ = undefined;\n wixContext.client = undefined;\n wixContext.elevatedClient = undefined;\n if (typeof $wixContext !== 'undefined') {\n closureContext = {\n client: $wixContext?.client,\n elevatedClient: $wixContext?.elevatedClient,\n };\n delete $wixContext.client;\n delete $wixContext.elevatedClient;\n }\n try {\n return fn();\n }\n finally {\n globalThis.__wix_context__ = globalContext;\n wixContext.client = moduleContext.client;\n wixContext.elevatedClient = moduleContext.elevatedClient;\n if (typeof $wixContext !== 'undefined') {\n $wixContext.client = closureContext.client;\n $wixContext.elevatedClient = closureContext.elevatedClient;\n }\n }\n}\n","import { EventDefinition, ServicePluginDefinition, } from '@wix/sdk-types';\nimport { resolveContext } from './context.js';\nexport { EventDefinition, ServicePluginDefinition, };\nexport function contextualizeHostModuleV2(hostModule, props) {\n return {\n ...hostModule,\n ...Object.fromEntries(props.map((prop) => [\n prop,\n (...args) => {\n const context = resolveContext();\n if (!context) {\n throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules');\n }\n return context\n .initWixModules(hostModule)[prop].apply(undefined, args);\n },\n ])),\n };\n}\nexport function contextualizeRESTModuleV2(restModule, elevated) {\n return ((...args) => {\n const context = resolveContext();\n if (!context) {\n // @ts-expect-error - if there is no context, we want to behave like the original module\n return restModule.apply(undefined, args);\n }\n return (context\n .initWixModules(restModule, elevated)\n // @ts-expect-error - we know the args here are meant to be passed to the initalized module\n .apply(undefined, args));\n });\n}\nexport function contextualizeEventDefinitionModuleV2(eventDefinition) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => {\n // used by the CLI for webhook registration on build time\n return {\n slug: eventDefinition.type,\n };\n };\n }\n return context.initWixModules(eventDefinition).apply(undefined, args);\n });\n contextualMethod.__type = eventDefinition.__type;\n contextualMethod.type = eventDefinition.type;\n contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;\n contextualMethod.transformations = eventDefinition.transformations;\n return contextualMethod;\n}\nexport function contextualizeSerivcePluginModuleV2(servicePlugin) {\n const contextualMethod = ((...args) => {\n const context = resolveContext();\n if (!context) {\n // this line should throw, but this would be a breaking change for older SDK versions\n // this is because in wixClient there's code that calls any function it detects and checks\n // if it's an ambassador module (see isAmbassadorModule)\n return () => { };\n }\n return context.initWixModules(servicePlugin).apply(undefined, args);\n });\n contextualMethod.__type = servicePlugin.__type;\n contextualMethod.componentType = servicePlugin.componentType;\n contextualMethod.methods = servicePlugin.methods;\n return contextualMethod;\n}\n","export const WIX_PROTOCOL = 'wix:';\nexport const SDKRequestToRESTRequestRenameMap = {\n _id: 'id',\n _createdDate: 'createdDate',\n _updatedDate: 'updatedDate',\n};\nexport const RESTResponseToSDKResponseRenameMap = {\n id: '_id',\n createdDate: '_createdDate',\n updatedDate: '_updatedDate',\n};\nexport const ITEMS_RESULT_PROPERTY_NAME = 'items';\nexport const PAGING_METADATA_RESULT_PROPERTY_NAME = 'pagingMetadata';\nexport const DEFAULT_LIMIT = 50;\n","import { contextualizeRESTModuleV2 } from './context-v2.js';\nexport { RESTResponseToSDKResponseRenameMap } from './constants.js';\nexport function createRESTModule(descriptor, elevated = false) {\n return contextualizeRESTModuleV2(descriptor, elevated);\n}\nexport function toURLSearchParams(params, isComplexRequest) {\n const flatten = flattenParams(params);\n // payloads with deep arrays or complex arrays are not serializable as URLSearchParams\n const isPayloadNonSerializableAsUrlSearchParams = Object.entries(flatten).some(([key, value]) => key.includes('.') ||\n (Array.isArray(value) && value.some((v) => typeof v === 'object')));\n const shouldSerializeToRParam = isComplexRequest && isPayloadNonSerializableAsUrlSearchParams;\n if (shouldSerializeToRParam) {\n return new URLSearchParams({ '.r': base64Encode(JSON.stringify(params)) });\n }\n else {\n return Object.entries(flatten).reduce((urlSearchParams, [key, value]) => {\n // inorder to make `foo: [1,2]` turn into `foo=1&foo=2` and not `foo[]=1&foo[]=2`\n const keyParams = Array.isArray(value) ? value : [value];\n keyParams.forEach((param) => {\n if (param === undefined ||\n param === null ||\n (Array.isArray(value) && typeof param === 'object')) {\n return;\n }\n urlSearchParams.append(key, param);\n });\n return urlSearchParams;\n }, new URLSearchParams());\n }\n}\nexport function resolveUrl(opts) {\n const domain = resolveDomain(opts.host);\n const mappings = resolveMappingsByDomain(domain, opts.domainToMappings);\n const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});\n return resolvePathFromMappings(path, mappings);\n}\nfunction flattenParams(data, path = '') {\n const params = {};\n Object.entries(data).forEach(([key, value]) => {\n const isObject = value !== null && typeof value === 'object' && !Array.isArray(value);\n const fieldPath = resolvePath(path, key);\n if (isObject) {\n const serializedObject = flattenParams(value, fieldPath);\n Object.assign(params, serializedObject);\n }\n else {\n params[fieldPath] = value;\n }\n });\n return params;\n}\nfunction resolvePath(path, key) {\n return `${path}${path ? '.' : ''}${key}`;\n}\nconst base64Encode = (value) => {\n const base64 = typeof btoa !== 'undefined'\n ? btoa(value)\n : Buffer.from(value, 'utf-8').toString('base64');\n return base64.replace(/=/g, '').replace(/\\+/g, '-').replace(/\\//g, '_');\n};\nconst DOMAINS = ['wix.com', 'editorx.com'];\nconst USER_DOMAIN = '_';\nconst REGEX_CAPTURE_DOMAINS = new RegExp(`\\\\.(${DOMAINS.join('|')})$`);\nconst WIX_API_DOMAINS = ['42.wixprod.net', 'uw2-edt-1.wixprod.net'];\nconst DEV_WIX_CODE_DOMAIN = 'dev.wix-code.com';\nconst REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;\nconst REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\\\.(${WIX_API_DOMAINS.join('|')})$`);\nconst REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN = new RegExp(`.*\\\\.${DEV_WIX_CODE_DOMAIN}$`);\nfunction resolveDomain(host) {\n const resolvedHost = fixHostExceptions(host);\n return resolvedHost\n .replace(REGEX_CAPTURE_DOMAINS, '._base_domain_')\n .replace(REGEX_CAPTURE_API_DOMAINS, '._api_base_domain_')\n .replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, '*.dev.wix-code.com');\n}\n// hosts which standard string replacing doesn't apply to them, will be fixed here.\nfunction fixHostExceptions(host) {\n // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom\n return host.replace('create.editorx.com', 'editor.editorx.com');\n}\nfunction resolveMappingsByDomain(domain, domainToMappings) {\n const mappings = domainToMappings[domain] || domainToMappings[USER_DOMAIN];\n if (mappings) {\n return mappings;\n }\n const rootDomainMappings = resolveRootDomain(domain, domainToMappings);\n if (!rootDomainMappings) {\n if (isBaseDomain(domain)) {\n // fallback <lang>.wix.com sub domains to www.wix.com\n // since all of the languages subdomain are not mapped automatically in FP and we want to support those kind of calls\n // for example: fr.wix.com\n return domainToMappings[wwwBaseDomain];\n }\n }\n return rootDomainMappings ?? [];\n}\nfunction resolveRootDomain(domain, domainToMappings) {\n return Object.entries(domainToMappings).find(([entryDomain]) => {\n const [, ...rooDomainSegments] = domain.split('.');\n return rooDomainSegments.join('.') === entryDomain;\n })?.[1];\n}\nfunction isBaseDomain(domain) {\n return !!domain.match(/\\._base_domain_$/);\n}\nconst wwwBaseDomain = 'www._base_domain_';\nfunction injectDataIntoProtoPath(protoPath, data) {\n return protoPath\n .split('/')\n .map((path) => maybeProtoPathToData(path, data))\n .join('/');\n}\nfunction maybeProtoPathToData(protoPath, data) {\n const protoRegExpMatch = protoPath.match(REGEX_CAPTURE_PROTO_FIELD) || [];\n const field = protoRegExpMatch[1];\n if (field) {\n const suffix = protoPath.replace(protoRegExpMatch[0], '');\n return findByPath(data, field, protoPath, suffix);\n }\n return protoPath;\n}\nfunction findByPath(obj, path, defaultValue, suffix) {\n let result = obj;\n for (const field of path.split('.')) {\n if (!result) {\n return defaultValue;\n }\n result = result[field];\n }\n return `${result}${suffix}`;\n}\nfunction resolvePathFromMappings(protoPath, mappings) {\n const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));\n if (!mapping) {\n // todo: should we return the path? if no - what should we do in case of testings?\n return protoPath;\n }\n return mapping.srcPath + protoPath.slice(mapping.destPath.length);\n}\n"],"mappings":"AACA,SAASA,EAAgBC,EAAMC,EAAgB,GAAOC,EAAmBC,GAAMA,EAAG,CAChF,MAAO,KAAO,CACZ,OAAQ,mBACR,KAAAH,EACA,cAAAC,EACA,gBAAAC,CACF,EACF,CAUA,IAAIE,EAA4B,gBAG5BC,EAAkB,CACpB,IAAK,MACL,KAAM,MACR,EACIC,EAAoB,CACtB,GAAGD,EACH,KAAM,OACN,KAAM,MACR,EC7BA,OAAS,cAAAE,MAAkB,mBCmBpB,SAASC,EAA0BC,EAAYC,EAAU,CAC5D,MAAQ,IAAIC,IAAS,CACjB,IAAMC,EAAUC,EAAe,EAC/B,OAAKD,EAIGA,EACH,eAAeH,EAAYC,CAAQ,EAEnC,MAAM,OAAWC,CAAI,EALfF,EAAW,MAAM,OAAWE,CAAI,CAM/C,CACJ,CD9BO,SAASG,GAAiB,CAC7B,IAAMC,EAAa,OAAO,YAAgB,KAAe,YAAY,eAC/D,YAAY,eACZ,OAAO,WAAW,gBAAoB,KACpC,WAAW,gBAAgB,eACzB,WAAW,gBAAgB,eAC3B,OACV,GAAIA,EACA,MAAO,CAEH,eAAeC,EAASC,EAAU,CAC9B,OAAOC,EAAkB,IAAMH,EAAWC,EAASC,CAAQ,CAAC,CAChE,EACA,eAAgB,CACZ,MAAM,IAAI,MAAM,gDAAgD,CACpE,EACA,SAAU,CACN,MAAM,IAAI,MAAM,0CAA0C,CAC9D,CACJ,EAEJ,IAAME,EAAmB,OAAO,YAAgB,IAC1C,YAAY,OACZ,OAAOC,EAAW,OAAW,IACzBA,EAAW,OACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,OAC3B,OACRC,EAAiB,OAAO,YAAgB,IACxC,YAAY,eACZ,OAAOD,EAAW,eAAmB,IACjCA,EAAW,eACX,OAAO,WAAW,gBAAoB,IAClC,WAAW,gBAAgB,eAC3B,OACd,GAAI,GAACD,GAAoB,CAACE,GAG1B,MAAO,CACH,eAAeC,EAAYL,EAAU,CACjC,GAAIA,EAAU,CACV,GAAI,CAACI,EACD,MAAM,IAAI,MAAM,2JAA2J,EAE/K,OAAOH,EAAkB,IAAMG,EAAe,IAAIC,CAAU,CAAC,CACjE,CACA,GAAI,CAACH,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOD,EAAkB,IAAMC,EAAiB,IAAIG,CAAU,CAAC,CACnE,EACA,cAAe,CAACC,EAAcC,IAAgB,CAC1C,GAAI,CAACL,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,cAAcI,EAAcC,CAAW,CACnE,EACA,SAAU,CACN,GAAI,CAACL,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,IAC5B,EACA,MAAM,QAAQM,EAAOC,EAAWC,EAAM,CAClC,GAAI,CAACR,EACD,MAAM,IAAI,MAAM,gGAAgG,EAEpH,OAAOA,EAAiB,QAAQM,EAAOC,EAAWC,CAAI,CAC1D,CACJ,CACJ,CA+CO,SAASC,EAAkBC,EAAI,CAClC,IAAMC,EAAgB,WAAW,gBAC3BC,EAAgB,CAClB,OAAQC,EAAW,OACnB,eAAgBA,EAAW,cAC/B,EACIC,EACJ,WAAW,gBAAkB,OAC7BD,EAAW,OAAS,OACpBA,EAAW,eAAiB,OACxB,OAAO,YAAgB,MACvBC,EAAiB,CACb,OAAQ,aAAa,OACrB,eAAgB,aAAa,cACjC,EACA,OAAO,YAAY,OACnB,OAAO,YAAY,gBAEvB,GAAI,CACA,OAAOJ,EAAG,CACd,QACA,CACI,WAAW,gBAAkBC,EAC7BE,EAAW,OAASD,EAAc,OAClCC,EAAW,eAAiBD,EAAc,eACtC,OAAO,YAAgB,MACvB,YAAY,OAASE,EAAe,OACpC,YAAY,eAAiBA,EAAe,eAEpD,CACJ,CE9IO,IAAMC,EAAqC,CAC9C,GAAI,MACJ,YAAa,eACb,YAAa,cACjB,ECRO,SAASC,EAAiBC,EAAYC,EAAW,GAAO,CAC3D,OAAOC,EAA0BF,EAAYC,CAAQ,CACzD,CAwDA,IAAME,EAAU,CAAC,UAAW,aAAa,EAEzC,IAAMC,EAAwB,IAAI,OAAO,OAAOC,EAAQ,KAAK,GAAG,CAAC,IAAI,EAC/DC,EAAkB,CAAC,iBAAkB,uBAAuB,EAC5DC,EAAsB,mBAE5B,IAAMC,EAA4B,IAAI,OAAO,OAAOC,EAAgB,KAAK,GAAG,CAAC,IAAI,EAC3EC,EAAoC,IAAI,OAAO,QAAQC,CAAmB,GAAG","names":["EventDefinition","type","isDomainEvent","transformations","x","SERVICE_PLUGIN_ERROR_TYPE","SORT_DIRECTIONS","SORT_CAPABILITIES","wixContext","contextualizeRESTModuleV2","restModule","elevated","args","context","resolveContext","resolveContext","oldContext","modules","elevated","runWithoutContext","contextualClient","wixContext","elevatedClient","wixModules","urlOrRequest","requestInit","query","variables","opts","runWithoutContext","fn","globalContext","moduleContext","wixContext","closureContext","RESTResponseToSDKResponseRenameMap","createRESTModule","descriptor","elevated","contextualizeRESTModuleV2","DOMAINS","REGEX_CAPTURE_DOMAINS","DOMAINS","WIX_API_DOMAINS","DEV_WIX_CODE_DOMAIN","REGEX_CAPTURE_API_DOMAINS","WIX_API_DOMAINS","REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN","DEV_WIX_CODE_DOMAIN"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as v,b as $,c as R,d as H}from"./chunk-42Y3PAPA.js";import{f as m}from"./chunk-SBZEOPXX.js";import{wixContext as ae}from"@wix/sdk-context";var ie=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}`)}},j=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:ie(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}},F=e=>e.__isAmbassador?!0:!!e().__isAmbassador;var q="__metadata",x="www.wixapis.com",W="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 ce(this.response.status,r?.message,r?.details,{requestId:this.response.headers.get("X-Wix-Request-Id"),details:r})}},ce=(e,t,r,n)=>({details:{...!r?.validationError&&{applicationError:{description:t,code:e,data:n}},...r},message:t,requestId:n?.requestId});var B=e=>e?.method&&["post","put","patch"].includes(e.method.toLocaleLowerCase())&&e.body?{"Content-Type":"application/json"}:{},K=e=>e&&typeof e=="object"&&!Array.isArray(e);var J=e=>e.__type==="host";function k(e,t){return e.create(t)}var de="x-wix-bi-gateway";function G(e,t,r){return{[de]:ue({environment:`js-sdk${r?`-${r}`:""}`,"package-name":e.packageName??t?.PACKAGE_NAME,"method-fqn":e.methodFqn,entity:e.entityFqdn})}}function ue(e){return Object.entries(e).filter(([t,r])=>!!r).map(([t,r])=>`${t}=${r}`).join(",")}function I(e){return he(e).map(t=>t.toLocaleUpperCase()).join("_")}var le=/([\p{Ll}\d])(\p{Lu})/gu,pe=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,X="$1\0$2",fe=/[^\p{L}\d]+/giu;function he(e){let t=e.trim();t=t.replace(le,X).replace(pe,X),t=t.replace(fe,"\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 me=e=>"validationError"in(e.response?.data?.details??{}),Ee=e=>"applicationError"in(e.response?.data?.details??{}),Te=e=>(e.response?.status??-1)>=400&&(e.response?.status??-1)<500;function z(e,t={explicitPathsToArguments:{},spreadPathsToArguments:{},singleArgumentUnchanged:!1},r=[]){if(typeof e!="object"||e===null)throw e;if(me(e))return ye(e,t,r);if(Ee(e))return _e(e);if(Te(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 ge(e)}var ye=(e,t,r)=>{let n=e.response?.data,s=e.requestId,{fieldViolations:o}=n.details.validationError,a=Ae(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}),_e=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}})},ge=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}}})},Ae=({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:Y(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,Y(p,s))}}return r?{...i,field:`${s[0]}.${i.field}`}:i})},Y=(e,t)=>{let r=Pe(e);return r!==null&&typeof r<"u"?e.replace(`$[${r}]`,t[r]):e},Pe=e=>{let t=e.match(/\$\[(?<argIndex>\d+)\]/);return t&&t.groups&&Number(t.groups.argIndex)};function Q(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?W:y}${u.url}`;u.params&&u.params.toString()&&(_+=`?${u.params.toString()}`);try{let A=G(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=we(f.status,T?.message,T?.details,{requestId:f.headers.get("X-Wix-Request-Id"),details:T}),P=z(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}},we=(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});var xe=".";function V(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(xe).map(t=>Re(t)?Number(t):t)}function Re(e){return/^\d+$/.test(e)}function Z(e){let t={};for(let[r,n]of Object.entries(e)){if(be(r))continue;let s=O(r);V(t,s,n)}return t}function be(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])),Z(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=Le(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 ee(e,t){let r=e?.modifiedFields;if(!r)return null;let n=Ie(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=Se(i,o);return c!==null?(a.modifiedFields=c,a):null}function Ie(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 Se(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e))try{return t.flatten(e)}catch{return null}return null}function Le(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 se=e=>e.__type==="event-definition";function te(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=ee(i,o);if(l)return t(l)}}return t(o(a))}function re(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})=>te(_,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})=>te(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 ne=e=>e.__type==="service-plugin-definition";function oe(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 Tt(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}=oe(s),{client:l,initModule:p}=re(s),u=async(d,f)=>{let E=await o(),g=B(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(se(d))return p(d);if(ne(d))return c(d);if(J(d)&&e.host)return k(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 Q(R(()=>F(d))?j(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 K(d)?Object.fromEntries(Object.entries(d).map(([E,g])=>[E,y(g,d[q])])):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?ae.elevatedClient=this:ae.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{Tt as a};
|
|
2
|
+
//# sourceMappingURL=chunk-7JKHQSWI.js.map
|