@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;
|
|
@@ -4749,6 +4903,120 @@ function servicePluginsModules(authStrategy) {
|
|
|
4749
4903
|
};
|
|
4750
4904
|
}
|
|
4751
4905
|
|
|
4906
|
+
// ../../node_modules/@wix/sdk/build/web-method-modules.js
|
|
4907
|
+
var import_serialize_error = __toESM(require_serialize_error(), 1);
|
|
4908
|
+
|
|
4909
|
+
// ../../node_modules/@wix/sdk/build/get-token-info.js
|
|
4910
|
+
async function getTokenInfo(token) {
|
|
4911
|
+
const tokenInfoRes = await fetch("https://www.wixapis.com/oauth2/token-info", {
|
|
4912
|
+
method: "POST",
|
|
4913
|
+
headers: {
|
|
4914
|
+
"Content-Type": "application/json"
|
|
4915
|
+
},
|
|
4916
|
+
body: JSON.stringify({
|
|
4917
|
+
token
|
|
4918
|
+
})
|
|
4919
|
+
});
|
|
4920
|
+
if (tokenInfoRes.status !== 200) {
|
|
4921
|
+
throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${tokenInfoRes.status}`);
|
|
4922
|
+
}
|
|
4923
|
+
return await tokenInfoRes.json();
|
|
4924
|
+
}
|
|
4925
|
+
|
|
4926
|
+
// ../../node_modules/@wix/sdk/build/web-method-modules.js
|
|
4927
|
+
var isWebMethodModules = (val) => val.__type === "web-method-module";
|
|
4928
|
+
var Permissions;
|
|
4929
|
+
(function(Permissions2) {
|
|
4930
|
+
Permissions2["Anyone"] = "anyone";
|
|
4931
|
+
Permissions2["Admin"] = "admin";
|
|
4932
|
+
Permissions2["SiteMember"] = "site-member";
|
|
4933
|
+
})(Permissions || (Permissions = {}));
|
|
4934
|
+
async function checkPermission(request, permission) {
|
|
4935
|
+
const accessToken = request.headers.get("Authorization");
|
|
4936
|
+
if (!accessToken) {
|
|
4937
|
+
throw new Error("Request is missing authentication data");
|
|
4938
|
+
}
|
|
4939
|
+
const { subjectType } = await getTokenInfo(accessToken);
|
|
4940
|
+
switch (permission) {
|
|
4941
|
+
case Permissions.Anyone: {
|
|
4942
|
+
if (subjectType !== "VISITOR" && subjectType !== "MEMBER" && subjectType !== "USER") {
|
|
4943
|
+
throw new Error("Insufficient permissions");
|
|
4944
|
+
}
|
|
4945
|
+
break;
|
|
4946
|
+
}
|
|
4947
|
+
case Permissions.SiteMember: {
|
|
4948
|
+
if (subjectType !== "MEMBER" && subjectType !== "USER") {
|
|
4949
|
+
throw new Error("Insufficient permissions");
|
|
4950
|
+
}
|
|
4951
|
+
break;
|
|
4952
|
+
}
|
|
4953
|
+
case Permissions.Admin: {
|
|
4954
|
+
if (subjectType !== "USER") {
|
|
4955
|
+
throw new Error("Insufficient permissions");
|
|
4956
|
+
}
|
|
4957
|
+
break;
|
|
4958
|
+
}
|
|
4959
|
+
}
|
|
4960
|
+
}
|
|
4961
|
+
var urlRegex = /\/_webMethods\/(.+\..+)\/(.+\..+)/;
|
|
4962
|
+
function extractUrlParts(url) {
|
|
4963
|
+
const parts = url.match(urlRegex);
|
|
4964
|
+
if (parts) {
|
|
4965
|
+
return [parts[1], parts[2].replace(".ajax", "")];
|
|
4966
|
+
}
|
|
4967
|
+
}
|
|
4968
|
+
function isRequestBodyValid(body) {
|
|
4969
|
+
return !!body && typeof body === "object" && Array.isArray(body);
|
|
4970
|
+
}
|
|
4971
|
+
var productionErrorMessage = "Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.";
|
|
4972
|
+
function webMethodModules() {
|
|
4973
|
+
const webMethods = {};
|
|
4974
|
+
const client = {
|
|
4975
|
+
async processRequest(request, devMode = false) {
|
|
4976
|
+
const urlParts = extractUrlParts(request.url);
|
|
4977
|
+
if (!urlParts) {
|
|
4978
|
+
return new Response("invalid request", { status: 400 });
|
|
4979
|
+
}
|
|
4980
|
+
const [file, method] = urlParts;
|
|
4981
|
+
const body = await request.json();
|
|
4982
|
+
if (!isRequestBodyValid(body)) {
|
|
4983
|
+
return new Response("invalid request", { status: 400 });
|
|
4984
|
+
}
|
|
4985
|
+
const loadWebMethodFile = webMethods[`/${file}`];
|
|
4986
|
+
try {
|
|
4987
|
+
if (!loadWebMethodFile) {
|
|
4988
|
+
throw new Error(`Error loading web module ${file}: Cannot find module '${file}'`);
|
|
4989
|
+
}
|
|
4990
|
+
const webMethodFile = await loadWebMethodFile();
|
|
4991
|
+
const webMethod = webMethodFile[method];
|
|
4992
|
+
if (!webMethod) {
|
|
4993
|
+
throw new Error(`Error loading function from web module ${file}: function '${method}' not found`);
|
|
4994
|
+
}
|
|
4995
|
+
await checkPermission(request, webMethod.permission);
|
|
4996
|
+
return Response.json({
|
|
4997
|
+
result: await webMethod.handler(...body)
|
|
4998
|
+
});
|
|
4999
|
+
} catch (error) {
|
|
5000
|
+
const serializedError = (0, import_serialize_error.serializeError)(error, { maxDepth: 1 });
|
|
5001
|
+
return Response.json({
|
|
5002
|
+
result: devMode || !(error instanceof Error) ? serializedError : {
|
|
5003
|
+
...serializedError,
|
|
5004
|
+
message: productionErrorMessage,
|
|
5005
|
+
stack: productionErrorMessage
|
|
5006
|
+
},
|
|
5007
|
+
exception: true
|
|
5008
|
+
});
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
5011
|
+
};
|
|
5012
|
+
return {
|
|
5013
|
+
initModule(webMethodModule) {
|
|
5014
|
+
Object.assign(webMethods, webMethodModule);
|
|
5015
|
+
},
|
|
5016
|
+
client
|
|
5017
|
+
};
|
|
5018
|
+
}
|
|
5019
|
+
|
|
4752
5020
|
// ../../node_modules/@wix/sdk/build/wixClient.js
|
|
4753
5021
|
function createClient(config) {
|
|
4754
5022
|
const _headers = config.headers || { Authorization: "" };
|
|
@@ -4757,8 +5025,25 @@ function createClient(config) {
|
|
|
4757
5025
|
};
|
|
4758
5026
|
const boundGetAuthHeaders = authStrategy.getAuthHeaders.bind(void 0, config.host);
|
|
4759
5027
|
authStrategy.getAuthHeaders = boundGetAuthHeaders;
|
|
5028
|
+
const fetchWithAuth = async (urlOrRequest, requestInit) => {
|
|
5029
|
+
if (typeof urlOrRequest === "string" || urlOrRequest instanceof URL) {
|
|
5030
|
+
return fetch(urlOrRequest, {
|
|
5031
|
+
...requestInit,
|
|
5032
|
+
headers: {
|
|
5033
|
+
...requestInit?.headers,
|
|
5034
|
+
...(await boundGetAuthHeaders()).headers
|
|
5035
|
+
}
|
|
5036
|
+
});
|
|
5037
|
+
} else {
|
|
5038
|
+
for (const [k, v] of Object.entries((await boundGetAuthHeaders()).headers)) {
|
|
5039
|
+
urlOrRequest.headers.set(k, v);
|
|
5040
|
+
}
|
|
5041
|
+
return fetch(urlOrRequest, requestInit);
|
|
5042
|
+
}
|
|
5043
|
+
};
|
|
4760
5044
|
const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(authStrategy);
|
|
4761
5045
|
const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(authStrategy);
|
|
5046
|
+
const { client: webMethodClient, initModule } = webMethodModules();
|
|
4762
5047
|
const boundFetch = async (url, options) => {
|
|
4763
5048
|
const authHeaders = await boundGetAuthHeaders();
|
|
4764
5049
|
const defaultContentTypeHeader = getDefaultContentHeader(options);
|
|
@@ -4780,6 +5065,8 @@ function createClient(config) {
|
|
|
4780
5065
|
return initServicePluginModule(modules);
|
|
4781
5066
|
} else if (isHostModule(modules) && config.host) {
|
|
4782
5067
|
return buildHostModule(modules, config.host);
|
|
5068
|
+
} else if (isWebMethodModules(modules)) {
|
|
5069
|
+
return initModule(modules);
|
|
4783
5070
|
} else if (typeof modules === "function") {
|
|
4784
5071
|
if ("__type" in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {
|
|
4785
5072
|
return modules;
|
|
@@ -4846,22 +5133,7 @@ function createClient(config) {
|
|
|
4846
5133
|
finalUrl.protocol = "https";
|
|
4847
5134
|
return boundFetch(finalUrl.toString(), options);
|
|
4848
5135
|
},
|
|
4849
|
-
fetchWithAuth
|
|
4850
|
-
if (typeof urlOrRequest === "string" || urlOrRequest instanceof URL) {
|
|
4851
|
-
return fetch(urlOrRequest, {
|
|
4852
|
-
...requestInit,
|
|
4853
|
-
headers: {
|
|
4854
|
-
...requestInit?.headers,
|
|
4855
|
-
...(await boundGetAuthHeaders()).headers
|
|
4856
|
-
}
|
|
4857
|
-
});
|
|
4858
|
-
} else {
|
|
4859
|
-
for (const [k, v] of Object.entries((await boundGetAuthHeaders()).headers)) {
|
|
4860
|
-
urlOrRequest.headers.set(k, v);
|
|
4861
|
-
}
|
|
4862
|
-
return fetch(urlOrRequest, requestInit);
|
|
4863
|
-
}
|
|
4864
|
-
},
|
|
5136
|
+
fetchWithAuth,
|
|
4865
5137
|
async graphql(query, variables, opts = {
|
|
4866
5138
|
apiVersion: "alpha"
|
|
4867
5139
|
}) {
|
|
@@ -4880,13 +5152,13 @@ function createClient(config) {
|
|
|
4880
5152
|
return { data: data ?? {}, errors };
|
|
4881
5153
|
},
|
|
4882
5154
|
webhooks: eventHandlersClient,
|
|
5155
|
+
webMethods: webMethodClient,
|
|
4883
5156
|
servicePlugins: servicePluginsClient
|
|
4884
5157
|
};
|
|
4885
5158
|
}
|
|
4886
5159
|
|
|
4887
5160
|
// ../../node_modules/@wix/sdk/build/auth/AppStrategy.js
|
|
4888
5161
|
function AppStrategy(opts) {
|
|
4889
|
-
const authServerBaseUrl = opts.authServerBaseUrl ?? "https://www.wixapis.com";
|
|
4890
5162
|
let refreshToken = "refreshToken" in opts ? opts.refreshToken : void 0;
|
|
4891
5163
|
let cachedToken;
|
|
4892
5164
|
return {
|
|
@@ -4916,8 +5188,7 @@ function AppStrategy(opts) {
|
|
|
4916
5188
|
if (!code || !instanceId) {
|
|
4917
5189
|
throw new Error("Invalid OAuth callback URL. Make sure you pass the url including the code and instanceId query params.");
|
|
4918
5190
|
}
|
|
4919
|
-
const
|
|
4920
|
-
const tokensRes = await fetch(tokenUrl.href, {
|
|
5191
|
+
const tokensRes = await fetch("https://www.wixapis.com/oauth/access", {
|
|
4921
5192
|
method: "POST",
|
|
4922
5193
|
headers: {
|
|
4923
5194
|
"Content-Type": "application/json"
|
|
@@ -4950,10 +5221,9 @@ function AppStrategy(opts) {
|
|
|
4950
5221
|
}
|
|
4951
5222
|
if ("refreshToken" in opts || refreshToken) {
|
|
4952
5223
|
if (!opts.appSecret) {
|
|
4953
|
-
throw new Error("App secret is required for
|
|
5224
|
+
throw new Error("App secret is required for retrieving app-level access tokens. Make sure to pass it to the AppStrategy");
|
|
4954
5225
|
}
|
|
4955
|
-
const
|
|
4956
|
-
const tokensRes = await fetch(tokenUrl.href, {
|
|
5226
|
+
const tokensRes = await fetch("https://www.wixapis.com/oauth/access", {
|
|
4957
5227
|
method: "POST",
|
|
4958
5228
|
headers: {
|
|
4959
5229
|
"Content-Type": "application/json"
|
|
@@ -4977,10 +5247,9 @@ function AppStrategy(opts) {
|
|
|
4977
5247
|
};
|
|
4978
5248
|
} else if ("instanceId" in opts) {
|
|
4979
5249
|
if (!opts.appSecret) {
|
|
4980
|
-
throw new Error("App secret is required for
|
|
5250
|
+
throw new Error("App secret is required for retrieving app-level access tokens. Make sure to pass it to the AppStrategy");
|
|
4981
5251
|
}
|
|
4982
|
-
const
|
|
4983
|
-
const tokensRes = await fetch(tokenUrl.href, {
|
|
5252
|
+
const tokensRes = await fetch("https://www.wixapis.com/oauth2/token", {
|
|
4984
5253
|
method: "POST",
|
|
4985
5254
|
headers: {
|
|
4986
5255
|
"Content-Type": "application/json"
|
|
@@ -5006,7 +5275,7 @@ function AppStrategy(opts) {
|
|
|
5006
5275
|
}
|
|
5007
5276
|
};
|
|
5008
5277
|
} else if ("accessToken" in opts && opts.accessToken) {
|
|
5009
|
-
const tokenRes = await fetch(
|
|
5278
|
+
const tokenRes = await fetch("https://www.wixapis.com/oauth2/token", {
|
|
5010
5279
|
method: "POST",
|
|
5011
5280
|
headers: {
|
|
5012
5281
|
"Content-Type": "application/json"
|
|
@@ -5036,7 +5305,7 @@ function AppStrategy(opts) {
|
|
|
5036
5305
|
},
|
|
5037
5306
|
async elevated() {
|
|
5038
5307
|
if ("accessToken" in opts && opts.accessToken) {
|
|
5039
|
-
const tokenInfo = await getTokenInfo(opts.accessToken
|
|
5308
|
+
const tokenInfo = await getTokenInfo(opts.accessToken);
|
|
5040
5309
|
if (tokenInfo.clientId !== opts.appId) {
|
|
5041
5310
|
throw new Error(`Invalid access token. The token is not issued for the app with ID "${opts.appId}"`);
|
|
5042
5311
|
}
|
|
@@ -5047,8 +5316,7 @@ function AppStrategy(opts) {
|
|
|
5047
5316
|
appId: opts.appId,
|
|
5048
5317
|
appSecret: opts.appSecret,
|
|
5049
5318
|
publicKey: opts.publicKey,
|
|
5050
|
-
instanceId: tokenInfo.instanceId
|
|
5051
|
-
authServerBaseUrl: opts.authServerBaseUrl
|
|
5319
|
+
instanceId: tokenInfo.instanceId
|
|
5052
5320
|
});
|
|
5053
5321
|
} else {
|
|
5054
5322
|
throw new Error("Providing an access token is required to perform elevation. Make sure to pass it to the AppStrategy");
|
|
@@ -5076,29 +5344,13 @@ function AppStrategy(opts) {
|
|
|
5076
5344
|
if (!tokenToCheck) {
|
|
5077
5345
|
throw new Error("Missing token to get info for. Either pass the token as an argument or provide it when initializing the AppStrategy");
|
|
5078
5346
|
}
|
|
5079
|
-
return getTokenInfo(tokenToCheck
|
|
5347
|
+
return getTokenInfo(tokenToCheck);
|
|
5080
5348
|
},
|
|
5081
5349
|
getActiveToken() {
|
|
5082
5350
|
return "accessToken" in opts ? opts.accessToken : refreshToken;
|
|
5083
5351
|
}
|
|
5084
5352
|
};
|
|
5085
5353
|
}
|
|
5086
|
-
async function getTokenInfo(token, authServerBaseUrl) {
|
|
5087
|
-
const tokenInfoUrl = new URL("/oauth2/token-info", authServerBaseUrl);
|
|
5088
|
-
const tokenInfoRes = await fetch(tokenInfoUrl.href, {
|
|
5089
|
-
method: "POST",
|
|
5090
|
-
headers: {
|
|
5091
|
-
"Content-Type": "application/json"
|
|
5092
|
-
},
|
|
5093
|
-
body: JSON.stringify({
|
|
5094
|
-
token
|
|
5095
|
-
})
|
|
5096
|
-
});
|
|
5097
|
-
if (tokenInfoRes.status !== 200) {
|
|
5098
|
-
throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${tokenInfoRes.status}`);
|
|
5099
|
-
}
|
|
5100
|
-
return await tokenInfoRes.json();
|
|
5101
|
-
}
|
|
5102
5354
|
|
|
5103
5355
|
// src/utils.ts
|
|
5104
5356
|
var supportedMethods = ["GET", "POST", "PUT", "DELETE"];
|
|
@@ -5117,7 +5369,7 @@ function isMethodSupported(method) {
|
|
|
5117
5369
|
return supportedMethods.includes(method);
|
|
5118
5370
|
}
|
|
5119
5371
|
function isAPI(value) {
|
|
5120
|
-
return typeof value === "object" &&
|
|
5372
|
+
return value != null && typeof value === "object" && supportedMethods.some((method) => method in value);
|
|
5121
5373
|
}
|
|
5122
5374
|
function formatError(error) {
|
|
5123
5375
|
if (import.meta.env.DEV && error instanceof Error) {
|