@wix/cli-app 1.1.57 → 1.1.59
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/{CreateVersionCommand-AIXBHCYB.js → CreateVersionCommand-6HJGN4WS.js} +16 -16
- package/build/{DevCommand-TOFPM7DZ.js → DevCommand-U7PV4HW6.js} +15 -15
- package/build/DevCommand-U7PV4HW6.js.map +1 -0
- package/build/{GenerateCommand-HB46FNMR.js → GenerateCommand-M3T6OD4B.js} +316 -194
- package/build/GenerateCommand-M3T6OD4B.js.map +1 -0
- package/build/{LogsCommand-Q2HRBR6G.js → LogsCommand-ECPZQ3LE.js} +4 -4
- package/build/PreviewCommand-ZQ3OUOKW.js +23 -0
- package/build/ReleaseCommand-KLZWNOVY.js +91 -0
- package/build/ReleaseCommand-KLZWNOVY.js.map +1 -0
- package/build/{ServeCommand-ZEXPLXTI.js → ServeCommand-I65XXTLM.js} +13 -13
- package/build/{build-3AJU7FWE.js → build-HZ5LVFAS.js} +10 -9
- package/build/build-HZ5LVFAS.js.map +1 -0
- package/build/{chunk-XQ2F7ZVH.js → chunk-4JDHJDA5.js} +3 -3
- package/build/{chunk-2BYVOUAH.js → chunk-ACN6EZGH.js} +3 -3
- package/build/{chunk-FOKCY5BR.js → chunk-AQKGIDJO.js} +1969 -342
- package/build/chunk-AQKGIDJO.js.map +1 -0
- package/build/{chunk-QG2TLAMS.js → chunk-BNROT2BN.js} +5 -5
- package/build/{chunk-MGPAOFO3.js → chunk-DXNFLVQP.js} +549 -538
- package/build/chunk-DXNFLVQP.js.map +1 -0
- package/build/{chunk-Y6SGP7TM.js → chunk-EZLVJJON.js} +3 -3
- package/build/{chunk-JZVNLHD3.js → chunk-FHMCCDCY.js} +3 -3
- package/build/{chunk-4JP2XRKG.js → chunk-FMM24YL4.js} +2044 -924
- package/build/chunk-FMM24YL4.js.map +1 -0
- package/build/{chunk-6A37LXDJ.js → chunk-IDWDZWLM.js} +2 -2
- package/build/{chunk-F2XRLYHS.js → chunk-OCC6MO6R.js} +5 -5
- package/build/{chunk-77XREOLU.js → chunk-PAWIUC26.js} +8 -8
- package/build/{chunk-IJVKSYIY.js → chunk-QVGYU6D4.js} +19 -8
- package/build/chunk-QVGYU6D4.js.map +1 -0
- package/build/{chunk-BMVZ7QCF.js → chunk-QW4WBWJK.js} +3 -3
- package/build/{chunk-2GIVAXZY.js → chunk-U72IPCQR.js} +3 -3
- package/build/{chunk-FTNALO4B.js → chunk-UQBZVJDQ.js} +6 -3
- package/build/chunk-UQBZVJDQ.js.map +1 -0
- package/build/{chunk-HL4K6RV3.js → chunk-W4HI7DI3.js} +2 -2
- package/build/{chunk-2CUJME55.js → chunk-ZJYRE4BT.js} +3 -3
- package/build/{chunk-N6O7J2WO.js → chunk-ZXHKA32C.js} +56 -12
- package/build/chunk-ZXHKA32C.js.map +1 -0
- package/build/cloudflare-runtime/entry.js +306 -252
- package/build/cloudflare-runtime/getRegisteredExtensions.js +21 -273
- package/build/index.js +444 -134
- package/build/index.js.map +1 -1
- package/build/platform-sdk/chunk-7EYXEF6M.js +2 -0
- package/build/platform-sdk/chunk-7EYXEF6M.js.map +1 -0
- package/build/platform-sdk/chunk-EVF6HSFE.js +2 -0
- package/build/platform-sdk/chunk-EVF6HSFE.js.map +1 -0
- package/build/platform-sdk/chunk-LO6MZPZE.js +2 -0
- package/build/platform-sdk/chunk-LO6MZPZE.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 +6 -6
- 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/platform-sdk/web-methods.js +2 -0
- package/build/platform-sdk/web-methods.js.map +1 -0
- package/build/{preview-C7XYH7BB.js → preview-FI6WYZUP.js} +13 -13
- package/build/preview-FI6WYZUP.js.map +1 -0
- package/build/{render-command-BMSK4YLL.js → render-command-UKYXN7C7.js} +6 -6
- package/package.json +13 -10
- package/schemas/site-plugin.json +1 -0
- package/templates/web-method/files/placeholder.ts.ejs +17 -0
- package/build/DevCommand-TOFPM7DZ.js.map +0 -1
- package/build/GenerateCommand-HB46FNMR.js.map +0 -1
- package/build/PreviewCommand-XBSTVGWT.js +0 -23
- package/build/build-3AJU7FWE.js.map +0 -1
- package/build/chunk-4JP2XRKG.js.map +0 -1
- package/build/chunk-FOKCY5BR.js.map +0 -1
- package/build/chunk-FTNALO4B.js.map +0 -1
- package/build/chunk-IJVKSYIY.js.map +0 -1
- package/build/chunk-MGPAOFO3.js.map +0 -1
- package/build/chunk-N6O7J2WO.js.map +0 -1
- package/build/platform-sdk/chunk-DGX4CFXG.js +0 -2
- package/build/platform-sdk/chunk-DGX4CFXG.js.map +0 -1
- package/build/platform-sdk/chunk-TN6HYRXL.js +0 -2
- package/build/platform-sdk/chunk-TN6HYRXL.js.map +0 -1
- package/build/preview-C7XYH7BB.js.map +0 -1
- /package/build/{CreateVersionCommand-AIXBHCYB.js.map → CreateVersionCommand-6HJGN4WS.js.map} +0 -0
- /package/build/{LogsCommand-Q2HRBR6G.js.map → LogsCommand-ECPZQ3LE.js.map} +0 -0
- /package/build/{PreviewCommand-XBSTVGWT.js.map → PreviewCommand-ZQ3OUOKW.js.map} +0 -0
- /package/build/{ServeCommand-ZEXPLXTI.js.map → ServeCommand-I65XXTLM.js.map} +0 -0
- /package/build/{chunk-XQ2F7ZVH.js.map → chunk-4JDHJDA5.js.map} +0 -0
- /package/build/{chunk-2BYVOUAH.js.map → chunk-ACN6EZGH.js.map} +0 -0
- /package/build/{chunk-QG2TLAMS.js.map → chunk-BNROT2BN.js.map} +0 -0
- /package/build/{chunk-Y6SGP7TM.js.map → chunk-EZLVJJON.js.map} +0 -0
- /package/build/{chunk-JZVNLHD3.js.map → chunk-FHMCCDCY.js.map} +0 -0
- /package/build/{chunk-6A37LXDJ.js.map → chunk-IDWDZWLM.js.map} +0 -0
- /package/build/{chunk-F2XRLYHS.js.map → chunk-OCC6MO6R.js.map} +0 -0
- /package/build/{chunk-77XREOLU.js.map → chunk-PAWIUC26.js.map} +0 -0
- /package/build/{chunk-BMVZ7QCF.js.map → chunk-QW4WBWJK.js.map} +0 -0
- /package/build/{chunk-2GIVAXZY.js.map → chunk-U72IPCQR.js.map} +0 -0
- /package/build/{chunk-HL4K6RV3.js.map → chunk-W4HI7DI3.js.map} +0 -0
- /package/build/{chunk-2CUJME55.js.map → chunk-ZJYRE4BT.js.map} +0 -0
- /package/build/{render-command-BMSK4YLL.js.map → render-command-UKYXN7C7.js.map} +0 -0
|
@@ -31,137 +31,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
mod
|
|
32
32
|
));
|
|
33
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
|
-
});
|
|
164
|
-
|
|
165
34
|
// ../../node_modules/jose/dist/browser/runtime/webcrypto.js
|
|
166
35
|
var webcrypto_default, isCryptoKey;
|
|
167
36
|
var init_webcrypto = __esm({
|
|
@@ -4407,6 +4276,137 @@ var init_browser = __esm({
|
|
|
4407
4276
|
}
|
|
4408
4277
|
});
|
|
4409
4278
|
|
|
4279
|
+
// ../../node_modules/serialize-error/index.js
|
|
4280
|
+
var require_serialize_error = __commonJS({
|
|
4281
|
+
"../../node_modules/serialize-error/index.js"(exports, module) {
|
|
4282
|
+
"use strict";
|
|
4283
|
+
var NonError = class _NonError extends Error {
|
|
4284
|
+
constructor(message2) {
|
|
4285
|
+
super(_NonError._prepareSuperMessage(message2));
|
|
4286
|
+
Object.defineProperty(this, "name", {
|
|
4287
|
+
value: "NonError",
|
|
4288
|
+
configurable: true,
|
|
4289
|
+
writable: true
|
|
4290
|
+
});
|
|
4291
|
+
if (Error.captureStackTrace) {
|
|
4292
|
+
Error.captureStackTrace(this, _NonError);
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
static _prepareSuperMessage(message2) {
|
|
4296
|
+
try {
|
|
4297
|
+
return JSON.stringify(message2);
|
|
4298
|
+
} catch {
|
|
4299
|
+
return String(message2);
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
};
|
|
4303
|
+
var commonProperties = [
|
|
4304
|
+
{ property: "name", enumerable: false },
|
|
4305
|
+
{ property: "message", enumerable: false },
|
|
4306
|
+
{ property: "stack", enumerable: false },
|
|
4307
|
+
{ property: "code", enumerable: true }
|
|
4308
|
+
];
|
|
4309
|
+
var isCalled = Symbol(".toJSON called");
|
|
4310
|
+
var toJSON = (from) => {
|
|
4311
|
+
from[isCalled] = true;
|
|
4312
|
+
const json = from.toJSON();
|
|
4313
|
+
delete from[isCalled];
|
|
4314
|
+
return json;
|
|
4315
|
+
};
|
|
4316
|
+
var destroyCircular = ({
|
|
4317
|
+
from,
|
|
4318
|
+
seen,
|
|
4319
|
+
to_,
|
|
4320
|
+
forceEnumerable,
|
|
4321
|
+
maxDepth,
|
|
4322
|
+
depth
|
|
4323
|
+
}) => {
|
|
4324
|
+
const to = to_ || (Array.isArray(from) ? [] : {});
|
|
4325
|
+
seen.push(from);
|
|
4326
|
+
if (depth >= maxDepth) {
|
|
4327
|
+
return to;
|
|
4328
|
+
}
|
|
4329
|
+
if (typeof from.toJSON === "function" && from[isCalled] !== true) {
|
|
4330
|
+
return toJSON(from);
|
|
4331
|
+
}
|
|
4332
|
+
for (const [key, value] of Object.entries(from)) {
|
|
4333
|
+
if (typeof Buffer === "function" && Buffer.isBuffer(value)) {
|
|
4334
|
+
to[key] = "[object Buffer]";
|
|
4335
|
+
continue;
|
|
4336
|
+
}
|
|
4337
|
+
if (typeof value === "function") {
|
|
4338
|
+
continue;
|
|
4339
|
+
}
|
|
4340
|
+
if (!value || typeof value !== "object") {
|
|
4341
|
+
to[key] = value;
|
|
4342
|
+
continue;
|
|
4343
|
+
}
|
|
4344
|
+
if (!seen.includes(from[key])) {
|
|
4345
|
+
depth++;
|
|
4346
|
+
to[key] = destroyCircular({
|
|
4347
|
+
from: from[key],
|
|
4348
|
+
seen: seen.slice(),
|
|
4349
|
+
forceEnumerable,
|
|
4350
|
+
maxDepth,
|
|
4351
|
+
depth
|
|
4352
|
+
});
|
|
4353
|
+
continue;
|
|
4354
|
+
}
|
|
4355
|
+
to[key] = "[Circular]";
|
|
4356
|
+
}
|
|
4357
|
+
for (const { property, enumerable } of commonProperties) {
|
|
4358
|
+
if (typeof from[property] === "string") {
|
|
4359
|
+
Object.defineProperty(to, property, {
|
|
4360
|
+
value: from[property],
|
|
4361
|
+
enumerable: forceEnumerable ? true : enumerable,
|
|
4362
|
+
configurable: true,
|
|
4363
|
+
writable: true
|
|
4364
|
+
});
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
return to;
|
|
4368
|
+
};
|
|
4369
|
+
var serializeError2 = (value, options = {}) => {
|
|
4370
|
+
const { maxDepth = Number.POSITIVE_INFINITY } = options;
|
|
4371
|
+
if (typeof value === "object" && value !== null) {
|
|
4372
|
+
return destroyCircular({
|
|
4373
|
+
from: value,
|
|
4374
|
+
seen: [],
|
|
4375
|
+
forceEnumerable: true,
|
|
4376
|
+
maxDepth,
|
|
4377
|
+
depth: 0
|
|
4378
|
+
});
|
|
4379
|
+
}
|
|
4380
|
+
if (typeof value === "function") {
|
|
4381
|
+
return `[Function: ${value.name || "anonymous"}]`;
|
|
4382
|
+
}
|
|
4383
|
+
return value;
|
|
4384
|
+
};
|
|
4385
|
+
var deserializeError = (value, options = {}) => {
|
|
4386
|
+
const { maxDepth = Number.POSITIVE_INFINITY } = options;
|
|
4387
|
+
if (value instanceof Error) {
|
|
4388
|
+
return value;
|
|
4389
|
+
}
|
|
4390
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
4391
|
+
const newError = new Error();
|
|
4392
|
+
destroyCircular({
|
|
4393
|
+
from: value,
|
|
4394
|
+
seen: [],
|
|
4395
|
+
to_: newError,
|
|
4396
|
+
maxDepth,
|
|
4397
|
+
depth: 0
|
|
4398
|
+
});
|
|
4399
|
+
return newError;
|
|
4400
|
+
}
|
|
4401
|
+
return new NonError(value);
|
|
4402
|
+
};
|
|
4403
|
+
module.exports = {
|
|
4404
|
+
serializeError: serializeError2,
|
|
4405
|
+
deserializeError
|
|
4406
|
+
};
|
|
4407
|
+
}
|
|
4408
|
+
});
|
|
4409
|
+
|
|
4410
4410
|
// src/utils.ts
|
|
4411
4411
|
import { dirname, sep } from "node:path";
|
|
4412
4412
|
|
|
@@ -4571,7 +4571,7 @@ function objectToKeyValue(input) {
|
|
|
4571
4571
|
return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
|
|
4572
4572
|
}
|
|
4573
4573
|
|
|
4574
|
-
// ../../node_modules/@wix/sdk
|
|
4574
|
+
// ../../node_modules/@wix/sdk-runtime/build/context.js
|
|
4575
4575
|
function runWithoutContext(fn) {
|
|
4576
4576
|
const globalContext = globalThis.__wix_context__;
|
|
4577
4577
|
const moduleContext = {
|
|
@@ -4903,120 +4903,6 @@ function servicePluginsModules(authStrategy) {
|
|
|
4903
4903
|
};
|
|
4904
4904
|
}
|
|
4905
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
|
-
|
|
5020
4906
|
// ../../node_modules/@wix/sdk/build/wixClient.js
|
|
5021
4907
|
function createClient(config) {
|
|
5022
4908
|
const _headers = config.headers || { Authorization: "" };
|
|
@@ -5043,7 +4929,6 @@ function createClient(config) {
|
|
|
5043
4929
|
};
|
|
5044
4930
|
const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(authStrategy);
|
|
5045
4931
|
const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(authStrategy);
|
|
5046
|
-
const { client: webMethodClient, initModule } = webMethodModules();
|
|
5047
4932
|
const boundFetch = async (url, options) => {
|
|
5048
4933
|
const authHeaders = await boundGetAuthHeaders();
|
|
5049
4934
|
const defaultContentTypeHeader = getDefaultContentHeader(options);
|
|
@@ -5065,8 +4950,6 @@ function createClient(config) {
|
|
|
5065
4950
|
return initServicePluginModule(modules);
|
|
5066
4951
|
} else if (isHostModule(modules) && config.host) {
|
|
5067
4952
|
return buildHostModule(modules, config.host);
|
|
5068
|
-
} else if (isWebMethodModules(modules)) {
|
|
5069
|
-
return initModule(modules);
|
|
5070
4953
|
} else if (typeof modules === "function") {
|
|
5071
4954
|
if ("__type" in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {
|
|
5072
4955
|
return modules;
|
|
@@ -5152,11 +5035,27 @@ function createClient(config) {
|
|
|
5152
5035
|
return { data: data ?? {}, errors };
|
|
5153
5036
|
},
|
|
5154
5037
|
webhooks: eventHandlersClient,
|
|
5155
|
-
webMethods: webMethodClient,
|
|
5156
5038
|
servicePlugins: servicePluginsClient
|
|
5157
5039
|
};
|
|
5158
5040
|
}
|
|
5159
5041
|
|
|
5042
|
+
// ../../node_modules/@wix/sdk/build/get-token-info.js
|
|
5043
|
+
async function getTokenInfo(token) {
|
|
5044
|
+
const tokenInfoRes = await fetch("https://www.wixapis.com/oauth2/token-info", {
|
|
5045
|
+
method: "POST",
|
|
5046
|
+
headers: {
|
|
5047
|
+
"Content-Type": "application/json"
|
|
5048
|
+
},
|
|
5049
|
+
body: JSON.stringify({
|
|
5050
|
+
token
|
|
5051
|
+
})
|
|
5052
|
+
});
|
|
5053
|
+
if (tokenInfoRes.status !== 200) {
|
|
5054
|
+
throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${tokenInfoRes.status}`);
|
|
5055
|
+
}
|
|
5056
|
+
return await tokenInfoRes.json();
|
|
5057
|
+
}
|
|
5058
|
+
|
|
5160
5059
|
// ../../node_modules/@wix/sdk/build/auth/AppStrategy.js
|
|
5161
5060
|
function AppStrategy(opts) {
|
|
5162
5061
|
let refreshToken = "refreshToken" in opts ? opts.refreshToken : void 0;
|
|
@@ -5599,6 +5498,135 @@ var CallsHandler = class {
|
|
|
5599
5498
|
}
|
|
5600
5499
|
};
|
|
5601
5500
|
|
|
5501
|
+
// ../../node_modules/@wix/web-methods-platform/build/server/index.js
|
|
5502
|
+
var import_serialize_error = __toESM(require_serialize_error(), 1);
|
|
5503
|
+
|
|
5504
|
+
// ../../node_modules/@wix/web-methods-platform/build/server/getTokenInfo.js
|
|
5505
|
+
async function getTokenInfo2(token) {
|
|
5506
|
+
const tokenInfoRes = await fetch("https://www.wixapis.com/oauth2/token-info", {
|
|
5507
|
+
method: "POST",
|
|
5508
|
+
headers: {
|
|
5509
|
+
"Content-Type": "application/json"
|
|
5510
|
+
},
|
|
5511
|
+
body: JSON.stringify({
|
|
5512
|
+
token
|
|
5513
|
+
})
|
|
5514
|
+
});
|
|
5515
|
+
if (tokenInfoRes.status !== 200) {
|
|
5516
|
+
throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${tokenInfoRes.status}`);
|
|
5517
|
+
}
|
|
5518
|
+
return await tokenInfoRes.json();
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5521
|
+
// ../../node_modules/@wix/web-methods-platform/build/server/types.js
|
|
5522
|
+
var Roles;
|
|
5523
|
+
(function(Roles2) {
|
|
5524
|
+
Roles2["SITE_OWNER"] = "siteOwner";
|
|
5525
|
+
Roles2["SITE_MEMBER"] = "siteMember";
|
|
5526
|
+
Roles2["ANONYMOUS"] = "anonymous";
|
|
5527
|
+
})(Roles || (Roles = {}));
|
|
5528
|
+
|
|
5529
|
+
// ../../node_modules/@wix/web-methods-platform/build/server/checkPermissions.js
|
|
5530
|
+
async function checkPermission(request, permission) {
|
|
5531
|
+
const accessToken = request.headers.get("Authorization");
|
|
5532
|
+
if (!accessToken) {
|
|
5533
|
+
throw new Error("Request is missing authentication data");
|
|
5534
|
+
}
|
|
5535
|
+
const { subjectType } = await getTokenInfo2(accessToken);
|
|
5536
|
+
const normalized = normalizedSubjectType(subjectType);
|
|
5537
|
+
if (!normalized || !permission.allowedRoles.includes(normalized)) {
|
|
5538
|
+
throw new Error("Insufficient permissions");
|
|
5539
|
+
}
|
|
5540
|
+
}
|
|
5541
|
+
function normalizedSubjectType(subjectType) {
|
|
5542
|
+
switch (subjectType) {
|
|
5543
|
+
case "USER":
|
|
5544
|
+
return Roles.SITE_OWNER;
|
|
5545
|
+
case "MEMBER":
|
|
5546
|
+
return Roles.SITE_MEMBER;
|
|
5547
|
+
case "VISITOR":
|
|
5548
|
+
return Roles.ANONYMOUS;
|
|
5549
|
+
}
|
|
5550
|
+
return null;
|
|
5551
|
+
}
|
|
5552
|
+
|
|
5553
|
+
// ../../node_modules/@wix/web-methods-platform/build/server/utils.js
|
|
5554
|
+
var urlRegex = /\/_webMethods\/(.+\..+)\/(.+\..+)/;
|
|
5555
|
+
function extractUrlParts(url) {
|
|
5556
|
+
const parts = url.match(urlRegex);
|
|
5557
|
+
if (parts) {
|
|
5558
|
+
return [parts[1], parts[2].replace(".ajax", "")];
|
|
5559
|
+
}
|
|
5560
|
+
}
|
|
5561
|
+
function isRequestBodyValid(body) {
|
|
5562
|
+
return !!body && typeof body === "object" && Array.isArray(body);
|
|
5563
|
+
}
|
|
5564
|
+
var productionErrorMessage = "Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information.";
|
|
5565
|
+
|
|
5566
|
+
// ../../node_modules/@wix/web-methods-platform/build/server/index.js
|
|
5567
|
+
function createClient2(webMethods2) {
|
|
5568
|
+
return {
|
|
5569
|
+
async processRequest(request, devMode = false) {
|
|
5570
|
+
const urlParts = extractUrlParts(request.url);
|
|
5571
|
+
if (!urlParts) {
|
|
5572
|
+
return new Response("invalid request", { status: 400 });
|
|
5573
|
+
}
|
|
5574
|
+
const [file, method] = urlParts;
|
|
5575
|
+
const body = await request.json();
|
|
5576
|
+
if (!isRequestBodyValid(body)) {
|
|
5577
|
+
return new Response("invalid request", { status: 400 });
|
|
5578
|
+
}
|
|
5579
|
+
const loadWebMethodFile = webMethods2[`/${file}`];
|
|
5580
|
+
try {
|
|
5581
|
+
if (!loadWebMethodFile) {
|
|
5582
|
+
throw new Error(`Error loading web module ${file}: Cannot find module '${file}'`);
|
|
5583
|
+
}
|
|
5584
|
+
const webMethodFile = await loadWebMethodFile();
|
|
5585
|
+
const webMethod = webMethodFile[method];
|
|
5586
|
+
if (!webMethod) {
|
|
5587
|
+
throw new Error(`Error loading function from web module ${file}: function '${method}' not found`);
|
|
5588
|
+
}
|
|
5589
|
+
await checkPermission(request, webMethod.permission);
|
|
5590
|
+
return Response.json({
|
|
5591
|
+
result: await webMethod(...body)
|
|
5592
|
+
});
|
|
5593
|
+
} catch (error) {
|
|
5594
|
+
const serializedError = (0, import_serialize_error.serializeError)(error, { maxDepth: 1 });
|
|
5595
|
+
return Response.json({
|
|
5596
|
+
result: devMode || !(error instanceof Error) ? serializedError : {
|
|
5597
|
+
...serializedError,
|
|
5598
|
+
message: productionErrorMessage,
|
|
5599
|
+
stack: productionErrorMessage
|
|
5600
|
+
},
|
|
5601
|
+
exception: true
|
|
5602
|
+
});
|
|
5603
|
+
}
|
|
5604
|
+
}
|
|
5605
|
+
};
|
|
5606
|
+
}
|
|
5607
|
+
|
|
5608
|
+
// src/webMethodHandler.ts
|
|
5609
|
+
var WebMethodHandler = class {
|
|
5610
|
+
constructor(webMethods2, callsHandler) {
|
|
5611
|
+
this.callsHandler = callsHandler;
|
|
5612
|
+
this.webMethodsClient = createClient2(webMethods2);
|
|
5613
|
+
}
|
|
5614
|
+
webMethodsClient;
|
|
5615
|
+
async handle(request) {
|
|
5616
|
+
if (!this.callsHandler) {
|
|
5617
|
+
throw new Error(
|
|
5618
|
+
"passing a `callsHandler` is required for running web methods"
|
|
5619
|
+
);
|
|
5620
|
+
}
|
|
5621
|
+
const accessToken = request.headers.get("Authorization");
|
|
5622
|
+
return this.callsHandler.run(
|
|
5623
|
+
accessToken,
|
|
5624
|
+
null,
|
|
5625
|
+
async () => this.webMethodsClient.processRequest(request, import.meta.env.DEV)
|
|
5626
|
+
);
|
|
5627
|
+
}
|
|
5628
|
+
};
|
|
5629
|
+
|
|
5602
5630
|
// src/initialize.ts
|
|
5603
5631
|
var logError = (error) => {
|
|
5604
5632
|
console.error(error instanceof Error ? error.stack : error);
|
|
@@ -5606,7 +5634,8 @@ var logError = (error) => {
|
|
|
5606
5634
|
async function initialize({
|
|
5607
5635
|
apis: apis2,
|
|
5608
5636
|
events: events2,
|
|
5609
|
-
servicePlugins: servicePlugins2
|
|
5637
|
+
servicePlugins: servicePlugins2,
|
|
5638
|
+
webMethods: webMethods2
|
|
5610
5639
|
}) {
|
|
5611
5640
|
const callsHandler = new CallsHandler();
|
|
5612
5641
|
const apiHandler = new ApiHandler(apis2, callsHandler);
|
|
@@ -5615,6 +5644,7 @@ async function initialize({
|
|
|
5615
5644
|
servicePlugins2,
|
|
5616
5645
|
callsHandler
|
|
5617
5646
|
);
|
|
5647
|
+
const webMethodHandler = new WebMethodHandler(webMethods2, callsHandler);
|
|
5618
5648
|
await eventsHandler.initialize();
|
|
5619
5649
|
await servicePluginHandler.initialize();
|
|
5620
5650
|
await callsHandler.initialize();
|
|
@@ -5672,6 +5702,22 @@ async function initialize({
|
|
|
5672
5702
|
return response;
|
|
5673
5703
|
}
|
|
5674
5704
|
}
|
|
5705
|
+
if (endpointName === "_webMethods") {
|
|
5706
|
+
const response = await webMethodHandler.handle(request).catch((error) => {
|
|
5707
|
+
logError(error);
|
|
5708
|
+
return new Response(formatError(error), { status: 500 });
|
|
5709
|
+
}).then((response2) => {
|
|
5710
|
+
if (response2) {
|
|
5711
|
+
response2.headers.append("Access-Control-Allow-Origin", "*");
|
|
5712
|
+
response2.headers.append("Access-Control-Allow-Methods", "*");
|
|
5713
|
+
response2.headers.append("Access-Control-Allow-Headers", "*");
|
|
5714
|
+
return response2;
|
|
5715
|
+
}
|
|
5716
|
+
});
|
|
5717
|
+
if (response) {
|
|
5718
|
+
return response;
|
|
5719
|
+
}
|
|
5720
|
+
}
|
|
5675
5721
|
return new Response("not found", { status: 404 });
|
|
5676
5722
|
}
|
|
5677
5723
|
};
|
|
@@ -5690,9 +5736,17 @@ var servicePlugins = import.meta.glob(
|
|
|
5690
5736
|
eager: false
|
|
5691
5737
|
}
|
|
5692
5738
|
);
|
|
5739
|
+
var webMethods = import.meta.glob("/src/**/*.web.ts", {
|
|
5740
|
+
eager: false
|
|
5741
|
+
});
|
|
5693
5742
|
|
|
5694
5743
|
// src/entry.ts
|
|
5695
|
-
var entry_default = await initialize({
|
|
5744
|
+
var entry_default = await initialize({
|
|
5745
|
+
apis,
|
|
5746
|
+
events,
|
|
5747
|
+
servicePlugins,
|
|
5748
|
+
webMethods
|
|
5749
|
+
});
|
|
5696
5750
|
if (import.meta.hot) {
|
|
5697
5751
|
import.meta.hot.accept();
|
|
5698
5752
|
}
|