@wix/cli-app 1.1.53 → 1.1.56
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/README.md +45 -0
- package/build/CreateVersionCommand-LU6LUBNT.js +269 -0
- package/build/{CreateVersionCommand-2W37YQW4.js.map → CreateVersionCommand-LU6LUBNT.js.map} +1 -1
- package/build/DevCommand-G2BIT4FY.js +1168 -0
- package/build/DevCommand-G2BIT4FY.js.map +1 -0
- package/build/GenerateCommand-XKWJ2FEG.js +12392 -0
- package/build/GenerateCommand-XKWJ2FEG.js.map +1 -0
- package/build/LogsCommand-HYGDI5KW.js +284 -0
- package/build/LogsCommand-HYGDI5KW.js.map +1 -0
- package/build/PreviewCommand-6EMIKGQN.js +23 -0
- package/build/ServeCommand-YJ5RHQZ4.js +165 -0
- package/build/ServeCommand-YJ5RHQZ4.js.map +1 -0
- package/build/build-EC7LZLAY.js +3596 -0
- package/build/{build-D3GVJS75.js.map → build-EC7LZLAY.js.map} +1 -1
- package/build/build-Q5P6MZLW.js +97 -0
- package/build/build-Q5P6MZLW.js.map +1 -0
- package/build/chunk-3KMSVIRS.js +1323 -0
- package/build/chunk-3KMSVIRS.js.map +1 -0
- package/build/chunk-FH6U3Y37.js +19 -0
- package/build/chunk-FH6U3Y37.js.map +1 -0
- package/build/chunk-GIUEJUXG.js +151 -0
- package/build/{chunk-PSQ4AQFG.js.map → chunk-GIUEJUXG.js.map} +1 -1
- package/build/chunk-IJVKSYIY.js +222 -0
- package/build/chunk-IJVKSYIY.js.map +1 -0
- package/build/chunk-IMNXLCE5.js +51 -0
- package/build/{chunk-SZ5JWJ4Q.js.map → chunk-IMNXLCE5.js.map} +1 -1
- package/build/chunk-IWDISZ2R.js +96 -0
- package/build/chunk-IWDISZ2R.js.map +1 -0
- package/build/chunk-JKI4MP27.js +32 -0
- package/build/{chunk-AXAJ7DJ4.js.map → chunk-JKI4MP27.js.map} +1 -1
- package/build/chunk-JOVPQ7BW.js +183 -0
- package/build/chunk-JOVPQ7BW.js.map +1 -0
- package/build/chunk-KCMEJP7H.js +897 -0
- package/build/{chunk-QXIKCJLU.js.map → chunk-KCMEJP7H.js.map} +1 -1
- package/build/chunk-NDFUPX6I.js +635 -0
- package/build/chunk-NDFUPX6I.js.map +1 -0
- package/build/chunk-NUUM6HPA.js +195 -0
- package/build/{chunk-DLQYJEV6.js.map → chunk-NUUM6HPA.js.map} +1 -1
- package/build/chunk-PYIAC2GK.js +66 -0
- package/build/{chunk-V4TR6DCM.js.map → chunk-PYIAC2GK.js.map} +1 -1
- package/build/chunk-QICLTOEP.js +46 -0
- package/build/{chunk-TSAKYUDG.js.map → chunk-QICLTOEP.js.map} +1 -1
- package/build/chunk-QLZPVGJV.js +29 -0
- package/build/{chunk-C3O7WWDR.js.map → chunk-QLZPVGJV.js.map} +1 -1
- package/build/chunk-QZOQAFHK.js +2197 -0
- package/build/chunk-QZOQAFHK.js.map +1 -0
- package/build/chunk-SP37PQ3I.js +38035 -0
- package/build/chunk-SP37PQ3I.js.map +1 -0
- package/build/chunk-TSFNDZPX.js +39101 -0
- package/build/chunk-TSFNDZPX.js.map +1 -0
- package/build/chunk-TTW4MEC3.js +104 -0
- package/build/chunk-TTW4MEC3.js.map +1 -0
- package/build/chunk-U4QPSXJP.js +45 -0
- package/build/{chunk-WXOIL7LC.js.map → chunk-U4QPSXJP.js.map} +1 -1
- package/build/chunk-WG365AHZ.js +23 -0
- package/build/{chunk-FVG3T57Z.js.map → chunk-WG365AHZ.js.map} +1 -1
- package/build/chunk-XU5JBKO6.js +29230 -0
- package/build/chunk-XU5JBKO6.js.map +1 -0
- package/build/cloudflare-runtime/entry.js +299 -47
- package/build/cloudflare-runtime/getRegisteredExtensions.js +298 -46
- package/build/devtools-YPSDP32D.js +3702 -0
- package/build/{devtools-4JFNYU2B.js.map → devtools-YPSDP32D.js.map} +1 -1
- package/build/esm-YQVNLOAI.js +22083 -0
- package/build/{esm-HBMYQBEO.js.map → esm-YQVNLOAI.js.map} +1 -1
- package/build/index.js +3252 -21
- package/build/index.js.map +1 -1
- package/build/platform-sdk/chunk-TN6HYRXL.js +2 -0
- package/build/platform-sdk/chunk-TN6HYRXL.js.map +1 -0
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/dashboard.js.map +1 -1
- package/build/platform-sdk/editor.js +5 -5
- package/build/platform-sdk/editor.js.map +1 -1
- package/build/platform-sdk/site.js +1 -1
- package/build/platform-sdk/site.js.map +1 -1
- package/build/preview-HPJCC5SU.js +138 -0
- package/build/preview-HPJCC5SU.js.map +1 -0
- package/build/render-command-BJTVLIM5.js +117 -0
- package/build/render-command-BJTVLIM5.js.map +1 -0
- package/build/types.impl-CD4WWRUK.js +10 -0
- package/package.json +15 -9
- package/templates/custom-element/dependencies.json +1 -1
- package/templates/dashboard-modal/dependencies.json +1 -1
- package/templates/dashboard-plugin/files/plugin.tsx.ejs +8 -18
- package/templates/site-plugin/dependencies.json +1 -1
- package/build/CreateVersionCommand-2W37YQW4.js +0 -4
- package/build/DevCommand-JDHE7RQB.js +0 -4
- package/build/DevCommand-JDHE7RQB.js.map +0 -1
- package/build/GenerateCommand-3PPXF4B6.js +0 -128
- package/build/GenerateCommand-3PPXF4B6.js.map +0 -1
- package/build/LogsCommand-LQKTBY6D.js +0 -4
- package/build/LogsCommand-LQKTBY6D.js.map +0 -1
- package/build/PreviewCommand-H3HVD7DH.js +0 -4
- package/build/ServeCommand-RHONEHTF.js +0 -4
- package/build/ServeCommand-RHONEHTF.js.map +0 -1
- package/build/build-D3GVJS75.js +0 -5
- package/build/build-QN6TGE3Q.js +0 -4
- package/build/build-QN6TGE3Q.js.map +0 -1
- package/build/chunk-2W2YJZP5.js +0 -100
- package/build/chunk-2W2YJZP5.js.map +0 -1
- package/build/chunk-4CCKO52Z.js +0 -11
- package/build/chunk-4CCKO52Z.js.map +0 -1
- package/build/chunk-5OZZ7R6I.js +0 -11
- package/build/chunk-5OZZ7R6I.js.map +0 -1
- package/build/chunk-AXAJ7DJ4.js +0 -4
- package/build/chunk-B5P4JHUW.js +0 -278
- package/build/chunk-B5P4JHUW.js.map +0 -1
- package/build/chunk-C3O7WWDR.js +0 -4
- package/build/chunk-DLQYJEV6.js +0 -4
- package/build/chunk-F6MVNSX2.js +0 -4
- package/build/chunk-F6MVNSX2.js.map +0 -1
- package/build/chunk-FVG3T57Z.js +0 -4
- package/build/chunk-HILXNAWZ.js +0 -4
- package/build/chunk-HILXNAWZ.js.map +0 -1
- package/build/chunk-LDGXTJLC.js +0 -4
- package/build/chunk-LDGXTJLC.js.map +0 -1
- package/build/chunk-PCBMS46R.js +0 -4
- package/build/chunk-PCBMS46R.js.map +0 -1
- package/build/chunk-PSQ4AQFG.js +0 -4
- package/build/chunk-QXIKCJLU.js +0 -5
- package/build/chunk-SZ5JWJ4Q.js +0 -4
- package/build/chunk-TSAKYUDG.js +0 -4
- package/build/chunk-V4TR6DCM.js +0 -4
- package/build/chunk-WJTPY35F.js +0 -9
- package/build/chunk-WJTPY35F.js.map +0 -1
- package/build/chunk-WXOIL7LC.js +0 -4
- package/build/chunk-YIGHU6O6.js +0 -4
- package/build/chunk-YIGHU6O6.js.map +0 -1
- package/build/chunk-YMRYABCG.js +0 -115
- package/build/chunk-YMRYABCG.js.map +0 -1
- package/build/devtools-4JFNYU2B.js +0 -10
- package/build/esm-HBMYQBEO.js +0 -466
- package/build/platform-sdk/chunk-32RIHE6N.js +0 -2
- package/build/platform-sdk/chunk-32RIHE6N.js.map +0 -1
- package/build/preview-457BTAHF.js +0 -4
- package/build/preview-457BTAHF.js.map +0 -1
- package/build/render-command-W6CY3R4Q.js +0 -4
- package/build/render-command-W6CY3R4Q.js.map +0 -1
- package/build/types.impl-L2DPGJ77.js +0 -4
- /package/build/{PreviewCommand-H3HVD7DH.js.map → PreviewCommand-6EMIKGQN.js.map} +0 -0
- /package/build/{types.impl-L2DPGJ77.js.map → types.impl-CD4WWRUK.js.map} +0 -0
|
@@ -1,12 +1,166 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
2
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
3
7
|
var __esm = (fn, res) => function __init() {
|
|
4
8
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
9
|
};
|
|
10
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
+
};
|
|
6
13
|
var __export = (target, all) => {
|
|
7
14
|
for (var name in all)
|
|
8
15
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
16
|
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
33
|
+
|
|
34
|
+
// ../../node_modules/serialize-error/index.js
|
|
35
|
+
var require_serialize_error = __commonJS({
|
|
36
|
+
"../../node_modules/serialize-error/index.js"(exports, module) {
|
|
37
|
+
"use strict";
|
|
38
|
+
var NonError = class _NonError extends Error {
|
|
39
|
+
constructor(message2) {
|
|
40
|
+
super(_NonError._prepareSuperMessage(message2));
|
|
41
|
+
Object.defineProperty(this, "name", {
|
|
42
|
+
value: "NonError",
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true
|
|
45
|
+
});
|
|
46
|
+
if (Error.captureStackTrace) {
|
|
47
|
+
Error.captureStackTrace(this, _NonError);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static _prepareSuperMessage(message2) {
|
|
51
|
+
try {
|
|
52
|
+
return JSON.stringify(message2);
|
|
53
|
+
} catch {
|
|
54
|
+
return String(message2);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var commonProperties = [
|
|
59
|
+
{ property: "name", enumerable: false },
|
|
60
|
+
{ property: "message", enumerable: false },
|
|
61
|
+
{ property: "stack", enumerable: false },
|
|
62
|
+
{ property: "code", enumerable: true }
|
|
63
|
+
];
|
|
64
|
+
var isCalled = Symbol(".toJSON called");
|
|
65
|
+
var toJSON = (from) => {
|
|
66
|
+
from[isCalled] = true;
|
|
67
|
+
const json = from.toJSON();
|
|
68
|
+
delete from[isCalled];
|
|
69
|
+
return json;
|
|
70
|
+
};
|
|
71
|
+
var destroyCircular = ({
|
|
72
|
+
from,
|
|
73
|
+
seen,
|
|
74
|
+
to_,
|
|
75
|
+
forceEnumerable,
|
|
76
|
+
maxDepth,
|
|
77
|
+
depth
|
|
78
|
+
}) => {
|
|
79
|
+
const to = to_ || (Array.isArray(from) ? [] : {});
|
|
80
|
+
seen.push(from);
|
|
81
|
+
if (depth >= maxDepth) {
|
|
82
|
+
return to;
|
|
83
|
+
}
|
|
84
|
+
if (typeof from.toJSON === "function" && from[isCalled] !== true) {
|
|
85
|
+
return toJSON(from);
|
|
86
|
+
}
|
|
87
|
+
for (const [key, value] of Object.entries(from)) {
|
|
88
|
+
if (typeof Buffer === "function" && Buffer.isBuffer(value)) {
|
|
89
|
+
to[key] = "[object Buffer]";
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (typeof value === "function") {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (!value || typeof value !== "object") {
|
|
96
|
+
to[key] = value;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (!seen.includes(from[key])) {
|
|
100
|
+
depth++;
|
|
101
|
+
to[key] = destroyCircular({
|
|
102
|
+
from: from[key],
|
|
103
|
+
seen: seen.slice(),
|
|
104
|
+
forceEnumerable,
|
|
105
|
+
maxDepth,
|
|
106
|
+
depth
|
|
107
|
+
});
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
to[key] = "[Circular]";
|
|
111
|
+
}
|
|
112
|
+
for (const { property, enumerable } of commonProperties) {
|
|
113
|
+
if (typeof from[property] === "string") {
|
|
114
|
+
Object.defineProperty(to, property, {
|
|
115
|
+
value: from[property],
|
|
116
|
+
enumerable: forceEnumerable ? true : enumerable,
|
|
117
|
+
configurable: true,
|
|
118
|
+
writable: true
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return to;
|
|
123
|
+
};
|
|
124
|
+
var serializeError2 = (value, options = {}) => {
|
|
125
|
+
const { maxDepth = Number.POSITIVE_INFINITY } = options;
|
|
126
|
+
if (typeof value === "object" && value !== null) {
|
|
127
|
+
return destroyCircular({
|
|
128
|
+
from: value,
|
|
129
|
+
seen: [],
|
|
130
|
+
forceEnumerable: true,
|
|
131
|
+
maxDepth,
|
|
132
|
+
depth: 0
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
if (typeof value === "function") {
|
|
136
|
+
return `[Function: ${value.name || "anonymous"}]`;
|
|
137
|
+
}
|
|
138
|
+
return value;
|
|
139
|
+
};
|
|
140
|
+
var deserializeError = (value, options = {}) => {
|
|
141
|
+
const { maxDepth = Number.POSITIVE_INFINITY } = options;
|
|
142
|
+
if (value instanceof Error) {
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
146
|
+
const newError = new Error();
|
|
147
|
+
destroyCircular({
|
|
148
|
+
from: value,
|
|
149
|
+
seen: [],
|
|
150
|
+
to_: newError,
|
|
151
|
+
maxDepth,
|
|
152
|
+
depth: 0
|
|
153
|
+
});
|
|
154
|
+
return newError;
|
|
155
|
+
}
|
|
156
|
+
return new NonError(value);
|
|
157
|
+
};
|
|
158
|
+
module.exports = {
|
|
159
|
+
serializeError: serializeError2,
|
|
160
|
+
deserializeError
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
});
|
|
10
164
|
|
|
11
165
|
// ../../node_modules/jose/dist/browser/runtime/webcrypto.js
|
|
12
166
|
var webcrypto_default, isCryptoKey;
|
|
@@ -4746,6 +4900,120 @@ function servicePluginsModules(authStrategy) {
|
|
|
4746
4900
|
};
|
|
4747
4901
|
}
|
|
4748
4902
|
|
|
4903
|
+
// ../../node_modules/@wix/sdk/build/web-method-modules.js
|
|
4904
|
+
var import_serialize_error = __toESM(require_serialize_error(), 1);
|
|
4905
|
+
|
|
4906
|
+
// ../../node_modules/@wix/sdk/build/get-token-info.js
|
|
4907
|
+
async function getTokenInfo(token) {
|
|
4908
|
+
const tokenInfoRes = await fetch("https://www.wixapis.com/oauth2/token-info", {
|
|
4909
|
+
method: "POST",
|
|
4910
|
+
headers: {
|
|
4911
|
+
"Content-Type": "application/json"
|
|
4912
|
+
},
|
|
4913
|
+
body: JSON.stringify({
|
|
4914
|
+
token
|
|
4915
|
+
})
|
|
4916
|
+
});
|
|
4917
|
+
if (tokenInfoRes.status !== 200) {
|
|
4918
|
+
throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${tokenInfoRes.status}`);
|
|
4919
|
+
}
|
|
4920
|
+
return await tokenInfoRes.json();
|
|
4921
|
+
}
|
|
4922
|
+
|
|
4923
|
+
// ../../node_modules/@wix/sdk/build/web-method-modules.js
|
|
4924
|
+
var isWebMethodModules = (val) => val.__type === "web-method-module";
|
|
4925
|
+
var Permissions;
|
|
4926
|
+
(function(Permissions2) {
|
|
4927
|
+
Permissions2["Anyone"] = "anyone";
|
|
4928
|
+
Permissions2["Admin"] = "admin";
|
|
4929
|
+
Permissions2["SiteMember"] = "site-member";
|
|
4930
|
+
})(Permissions || (Permissions = {}));
|
|
4931
|
+
async function checkPermission(request, permission) {
|
|
4932
|
+
const accessToken = request.headers.get("Authorization");
|
|
4933
|
+
if (!accessToken) {
|
|
4934
|
+
throw new Error("Request is missing authentication data");
|
|
4935
|
+
}
|
|
4936
|
+
const { subjectType } = await getTokenInfo(accessToken);
|
|
4937
|
+
switch (permission) {
|
|
4938
|
+
case Permissions.Anyone: {
|
|
4939
|
+
if (subjectType !== "VISITOR" && subjectType !== "MEMBER" && subjectType !== "USER") {
|
|
4940
|
+
throw new Error("Insufficient permissions");
|
|
4941
|
+
}
|
|
4942
|
+
break;
|
|
4943
|
+
}
|
|
4944
|
+
case Permissions.SiteMember: {
|
|
4945
|
+
if (subjectType !== "MEMBER" && subjectType !== "USER") {
|
|
4946
|
+
throw new Error("Insufficient permissions");
|
|
4947
|
+
}
|
|
4948
|
+
break;
|
|
4949
|
+
}
|
|
4950
|
+
case Permissions.Admin: {
|
|
4951
|
+
if (subjectType !== "USER") {
|
|
4952
|
+
throw new Error("Insufficient permissions");
|
|
4953
|
+
}
|
|
4954
|
+
break;
|
|
4955
|
+
}
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4958
|
+
var urlRegex = /\/_webMethods\/(.+\..+)\/(.+\..+)/;
|
|
4959
|
+
function extractUrlParts(url) {
|
|
4960
|
+
const parts = url.match(urlRegex);
|
|
4961
|
+
if (parts) {
|
|
4962
|
+
return [parts[1], parts[2].replace(".ajax", "")];
|
|
4963
|
+
}
|
|
4964
|
+
}
|
|
4965
|
+
function isRequestBodyValid(body) {
|
|
4966
|
+
return !!body && typeof body === "object" && Array.isArray(body);
|
|
4967
|
+
}
|
|
4968
|
+
var productionErrorMessage = "Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.";
|
|
4969
|
+
function webMethodModules() {
|
|
4970
|
+
const webMethods = {};
|
|
4971
|
+
const client = {
|
|
4972
|
+
async processRequest(request, devMode = false) {
|
|
4973
|
+
const urlParts = extractUrlParts(request.url);
|
|
4974
|
+
if (!urlParts) {
|
|
4975
|
+
return new Response("invalid request", { status: 400 });
|
|
4976
|
+
}
|
|
4977
|
+
const [file, method] = urlParts;
|
|
4978
|
+
const body = await request.json();
|
|
4979
|
+
if (!isRequestBodyValid(body)) {
|
|
4980
|
+
return new Response("invalid request", { status: 400 });
|
|
4981
|
+
}
|
|
4982
|
+
const loadWebMethodFile = webMethods[`/${file}`];
|
|
4983
|
+
try {
|
|
4984
|
+
if (!loadWebMethodFile) {
|
|
4985
|
+
throw new Error(`Error loading web module ${file}: Cannot find module '${file}'`);
|
|
4986
|
+
}
|
|
4987
|
+
const webMethodFile = await loadWebMethodFile();
|
|
4988
|
+
const webMethod = webMethodFile[method];
|
|
4989
|
+
if (!webMethod) {
|
|
4990
|
+
throw new Error(`Error loading function from web module ${file}: function '${method}' not found`);
|
|
4991
|
+
}
|
|
4992
|
+
await checkPermission(request, webMethod.permission);
|
|
4993
|
+
return Response.json({
|
|
4994
|
+
result: await webMethod.handler(...body)
|
|
4995
|
+
});
|
|
4996
|
+
} catch (error) {
|
|
4997
|
+
const serializedError = (0, import_serialize_error.serializeError)(error, { maxDepth: 1 });
|
|
4998
|
+
return Response.json({
|
|
4999
|
+
result: devMode || !(error instanceof Error) ? serializedError : {
|
|
5000
|
+
...serializedError,
|
|
5001
|
+
message: productionErrorMessage,
|
|
5002
|
+
stack: productionErrorMessage
|
|
5003
|
+
},
|
|
5004
|
+
exception: true
|
|
5005
|
+
});
|
|
5006
|
+
}
|
|
5007
|
+
}
|
|
5008
|
+
};
|
|
5009
|
+
return {
|
|
5010
|
+
initModule(webMethodModule) {
|
|
5011
|
+
Object.assign(webMethods, webMethodModule);
|
|
5012
|
+
},
|
|
5013
|
+
client
|
|
5014
|
+
};
|
|
5015
|
+
}
|
|
5016
|
+
|
|
4749
5017
|
// ../../node_modules/@wix/sdk/build/wixClient.js
|
|
4750
5018
|
function createClient(config) {
|
|
4751
5019
|
const _headers = config.headers || { Authorization: "" };
|
|
@@ -4754,8 +5022,25 @@ function createClient(config) {
|
|
|
4754
5022
|
};
|
|
4755
5023
|
const boundGetAuthHeaders = authStrategy.getAuthHeaders.bind(void 0, config.host);
|
|
4756
5024
|
authStrategy.getAuthHeaders = boundGetAuthHeaders;
|
|
5025
|
+
const fetchWithAuth = async (urlOrRequest, requestInit) => {
|
|
5026
|
+
if (typeof urlOrRequest === "string" || urlOrRequest instanceof URL) {
|
|
5027
|
+
return fetch(urlOrRequest, {
|
|
5028
|
+
...requestInit,
|
|
5029
|
+
headers: {
|
|
5030
|
+
...requestInit?.headers,
|
|
5031
|
+
...(await boundGetAuthHeaders()).headers
|
|
5032
|
+
}
|
|
5033
|
+
});
|
|
5034
|
+
} else {
|
|
5035
|
+
for (const [k, v] of Object.entries((await boundGetAuthHeaders()).headers)) {
|
|
5036
|
+
urlOrRequest.headers.set(k, v);
|
|
5037
|
+
}
|
|
5038
|
+
return fetch(urlOrRequest, requestInit);
|
|
5039
|
+
}
|
|
5040
|
+
};
|
|
4757
5041
|
const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(authStrategy);
|
|
4758
5042
|
const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(authStrategy);
|
|
5043
|
+
const { client: webMethodClient, initModule } = webMethodModules();
|
|
4759
5044
|
const boundFetch = async (url, options) => {
|
|
4760
5045
|
const authHeaders = await boundGetAuthHeaders();
|
|
4761
5046
|
const defaultContentTypeHeader = getDefaultContentHeader(options);
|
|
@@ -4777,6 +5062,8 @@ function createClient(config) {
|
|
|
4777
5062
|
return initServicePluginModule(modules);
|
|
4778
5063
|
} else if (isHostModule(modules) && config.host) {
|
|
4779
5064
|
return buildHostModule(modules, config.host);
|
|
5065
|
+
} else if (isWebMethodModules(modules)) {
|
|
5066
|
+
return initModule(modules);
|
|
4780
5067
|
} else if (typeof modules === "function") {
|
|
4781
5068
|
if ("__type" in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {
|
|
4782
5069
|
return modules;
|
|
@@ -4843,22 +5130,7 @@ function createClient(config) {
|
|
|
4843
5130
|
finalUrl.protocol = "https";
|
|
4844
5131
|
return boundFetch(finalUrl.toString(), options);
|
|
4845
5132
|
},
|
|
4846
|
-
fetchWithAuth
|
|
4847
|
-
if (typeof urlOrRequest === "string" || urlOrRequest instanceof URL) {
|
|
4848
|
-
return fetch(urlOrRequest, {
|
|
4849
|
-
...requestInit,
|
|
4850
|
-
headers: {
|
|
4851
|
-
...requestInit?.headers,
|
|
4852
|
-
...(await boundGetAuthHeaders()).headers
|
|
4853
|
-
}
|
|
4854
|
-
});
|
|
4855
|
-
} else {
|
|
4856
|
-
for (const [k, v] of Object.entries((await boundGetAuthHeaders()).headers)) {
|
|
4857
|
-
urlOrRequest.headers.set(k, v);
|
|
4858
|
-
}
|
|
4859
|
-
return fetch(urlOrRequest, requestInit);
|
|
4860
|
-
}
|
|
4861
|
-
},
|
|
5133
|
+
fetchWithAuth,
|
|
4862
5134
|
async graphql(query, variables, opts = {
|
|
4863
5135
|
apiVersion: "alpha"
|
|
4864
5136
|
}) {
|
|
@@ -4877,13 +5149,13 @@ function createClient(config) {
|
|
|
4877
5149
|
return { data: data ?? {}, errors };
|
|
4878
5150
|
},
|
|
4879
5151
|
webhooks: eventHandlersClient,
|
|
5152
|
+
webMethods: webMethodClient,
|
|
4880
5153
|
servicePlugins: servicePluginsClient
|
|
4881
5154
|
};
|
|
4882
5155
|
}
|
|
4883
5156
|
|
|
4884
5157
|
// ../../node_modules/@wix/sdk/build/auth/AppStrategy.js
|
|
4885
5158
|
function AppStrategy(opts) {
|
|
4886
|
-
const authServerBaseUrl = opts.authServerBaseUrl ?? "https://www.wixapis.com";
|
|
4887
5159
|
let refreshToken = "refreshToken" in opts ? opts.refreshToken : void 0;
|
|
4888
5160
|
let cachedToken;
|
|
4889
5161
|
return {
|
|
@@ -4913,8 +5185,7 @@ function AppStrategy(opts) {
|
|
|
4913
5185
|
if (!code || !instanceId) {
|
|
4914
5186
|
throw new Error("Invalid OAuth callback URL. Make sure you pass the url including the code and instanceId query params.");
|
|
4915
5187
|
}
|
|
4916
|
-
const
|
|
4917
|
-
const tokensRes = await fetch(tokenUrl.href, {
|
|
5188
|
+
const tokensRes = await fetch("https://www.wixapis.com/oauth/access", {
|
|
4918
5189
|
method: "POST",
|
|
4919
5190
|
headers: {
|
|
4920
5191
|
"Content-Type": "application/json"
|
|
@@ -4947,10 +5218,9 @@ function AppStrategy(opts) {
|
|
|
4947
5218
|
}
|
|
4948
5219
|
if ("refreshToken" in opts || refreshToken) {
|
|
4949
5220
|
if (!opts.appSecret) {
|
|
4950
|
-
throw new Error("App secret is required for
|
|
5221
|
+
throw new Error("App secret is required for retrieving app-level access tokens. Make sure to pass it to the AppStrategy");
|
|
4951
5222
|
}
|
|
4952
|
-
const
|
|
4953
|
-
const tokensRes = await fetch(tokenUrl.href, {
|
|
5223
|
+
const tokensRes = await fetch("https://www.wixapis.com/oauth/access", {
|
|
4954
5224
|
method: "POST",
|
|
4955
5225
|
headers: {
|
|
4956
5226
|
"Content-Type": "application/json"
|
|
@@ -4974,10 +5244,9 @@ function AppStrategy(opts) {
|
|
|
4974
5244
|
};
|
|
4975
5245
|
} else if ("instanceId" in opts) {
|
|
4976
5246
|
if (!opts.appSecret) {
|
|
4977
|
-
throw new Error("App secret is required for
|
|
5247
|
+
throw new Error("App secret is required for retrieving app-level access tokens. Make sure to pass it to the AppStrategy");
|
|
4978
5248
|
}
|
|
4979
|
-
const
|
|
4980
|
-
const tokensRes = await fetch(tokenUrl.href, {
|
|
5249
|
+
const tokensRes = await fetch("https://www.wixapis.com/oauth2/token", {
|
|
4981
5250
|
method: "POST",
|
|
4982
5251
|
headers: {
|
|
4983
5252
|
"Content-Type": "application/json"
|
|
@@ -5003,7 +5272,7 @@ function AppStrategy(opts) {
|
|
|
5003
5272
|
}
|
|
5004
5273
|
};
|
|
5005
5274
|
} else if ("accessToken" in opts && opts.accessToken) {
|
|
5006
|
-
const tokenRes = await fetch(
|
|
5275
|
+
const tokenRes = await fetch("https://www.wixapis.com/oauth2/token", {
|
|
5007
5276
|
method: "POST",
|
|
5008
5277
|
headers: {
|
|
5009
5278
|
"Content-Type": "application/json"
|
|
@@ -5033,7 +5302,7 @@ function AppStrategy(opts) {
|
|
|
5033
5302
|
},
|
|
5034
5303
|
async elevated() {
|
|
5035
5304
|
if ("accessToken" in opts && opts.accessToken) {
|
|
5036
|
-
const tokenInfo = await getTokenInfo(opts.accessToken
|
|
5305
|
+
const tokenInfo = await getTokenInfo(opts.accessToken);
|
|
5037
5306
|
if (tokenInfo.clientId !== opts.appId) {
|
|
5038
5307
|
throw new Error(`Invalid access token. The token is not issued for the app with ID "${opts.appId}"`);
|
|
5039
5308
|
}
|
|
@@ -5044,8 +5313,7 @@ function AppStrategy(opts) {
|
|
|
5044
5313
|
appId: opts.appId,
|
|
5045
5314
|
appSecret: opts.appSecret,
|
|
5046
5315
|
publicKey: opts.publicKey,
|
|
5047
|
-
instanceId: tokenInfo.instanceId
|
|
5048
|
-
authServerBaseUrl: opts.authServerBaseUrl
|
|
5316
|
+
instanceId: tokenInfo.instanceId
|
|
5049
5317
|
});
|
|
5050
5318
|
} else {
|
|
5051
5319
|
throw new Error("Providing an access token is required to perform elevation. Make sure to pass it to the AppStrategy");
|
|
@@ -5073,29 +5341,13 @@ function AppStrategy(opts) {
|
|
|
5073
5341
|
if (!tokenToCheck) {
|
|
5074
5342
|
throw new Error("Missing token to get info for. Either pass the token as an argument or provide it when initializing the AppStrategy");
|
|
5075
5343
|
}
|
|
5076
|
-
return getTokenInfo(tokenToCheck
|
|
5344
|
+
return getTokenInfo(tokenToCheck);
|
|
5077
5345
|
},
|
|
5078
5346
|
getActiveToken() {
|
|
5079
5347
|
return "accessToken" in opts ? opts.accessToken : refreshToken;
|
|
5080
5348
|
}
|
|
5081
5349
|
};
|
|
5082
5350
|
}
|
|
5083
|
-
async function getTokenInfo(token, authServerBaseUrl) {
|
|
5084
|
-
const tokenInfoUrl = new URL("/oauth2/token-info", authServerBaseUrl);
|
|
5085
|
-
const tokenInfoRes = await fetch(tokenInfoUrl.href, {
|
|
5086
|
-
method: "POST",
|
|
5087
|
-
headers: {
|
|
5088
|
-
"Content-Type": "application/json"
|
|
5089
|
-
},
|
|
5090
|
-
body: JSON.stringify({
|
|
5091
|
-
token
|
|
5092
|
-
})
|
|
5093
|
-
});
|
|
5094
|
-
if (tokenInfoRes.status !== 200) {
|
|
5095
|
-
throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${tokenInfoRes.status}`);
|
|
5096
|
-
}
|
|
5097
|
-
return await tokenInfoRes.json();
|
|
5098
|
-
}
|
|
5099
5351
|
|
|
5100
5352
|
// src/utils.ts
|
|
5101
5353
|
import { dirname, sep } from "node:path";
|