@wix/cli-app 1.1.52 → 1.1.55
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-HVC5JTAL.js → CreateVersionCommand-XTZT5DED.js} +2 -2
- package/build/{DevCommand-RTZ66W3P.js → DevCommand-Q5XLAGMG.js} +2 -2
- package/build/DevCommand-Q5XLAGMG.js.map +1 -0
- package/build/GenerateCommand-HNFICZJA.js +128 -0
- package/build/{GenerateCommand-J4FYPLSB.js.map → GenerateCommand-HNFICZJA.js.map} +1 -1
- package/build/LogsCommand-XJHE75L2.js +4 -0
- package/build/LogsCommand-XJHE75L2.js.map +1 -0
- package/build/PreviewCommand-JKPFMGWV.js +4 -0
- package/build/ServeCommand-CPZOI7DC.js +4 -0
- package/build/ServeCommand-CPZOI7DC.js.map +1 -0
- package/build/build-3RXHADZD.js +4 -0
- package/build/build-3RXHADZD.js.map +1 -0
- package/build/chunk-2FB5F5QF.js +4 -0
- package/build/{chunk-2R6WOCA4.js → chunk-4BHNJVL2.js} +2 -2
- package/build/{chunk-KNH7RNAZ.js → chunk-5OZZ7R6I.js} +2 -2
- package/build/chunk-5OZZ7R6I.js.map +1 -0
- package/build/{chunk-6ZJVIMV7.js → chunk-6HSUK2A2.js} +2 -2
- package/build/{chunk-EWA6OFAF.js → chunk-7VOKCPZP.js} +3 -3
- package/build/{chunk-EWA6OFAF.js.map → chunk-7VOKCPZP.js.map} +1 -1
- package/build/{chunk-2LPICRGU.js → chunk-B4SDDVMV.js} +2 -2
- package/build/{chunk-UKELYG5A.js → chunk-C4SXZWXS.js} +2 -2
- package/build/{chunk-NEWE3FX5.js → chunk-FKBCPMYK.js} +3 -3
- package/build/chunk-FKBCPMYK.js.map +1 -0
- package/build/chunk-FMIXY6J5.js +115 -0
- package/build/chunk-FMIXY6J5.js.map +1 -0
- package/build/chunk-GWU77DPO.js +4 -0
- package/build/chunk-GWU77DPO.js.map +1 -0
- package/build/{chunk-CMBEPCWL.js → chunk-HDXLQ34N.js} +2 -2
- package/build/chunk-JXE3LQ2S.js +100 -0
- package/build/chunk-JXE3LQ2S.js.map +1 -0
- package/build/chunk-K2A77MMN.js +4 -0
- package/build/chunk-K2A77MMN.js.map +1 -0
- package/build/{chunk-WRYRVOZP.js → chunk-KG7BHEJG.js} +2 -2
- package/build/chunk-LJEYXY4V.js +4 -0
- package/build/chunk-LJEYXY4V.js.map +1 -0
- package/build/{chunk-ATQCL6AZ.js → chunk-N5D4TFKX.js} +177 -126
- package/build/chunk-N5D4TFKX.js.map +1 -0
- package/build/{chunk-2YXY5Y3Z.js → chunk-QOUZ6J7N.js} +2 -2
- package/build/{chunk-FMTROGFZ.js → chunk-X4BLMM2K.js} +2 -2
- package/build/chunk-X4BLMM2K.js.map +1 -0
- package/build/cloudflare-runtime/entry.js +308 -49
- package/build/cloudflare-runtime/getRegisteredExtensions.js +307 -48
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/platform-sdk/{chunk-RE2R2PA6.js → chunk-GZP4Z76C.js} +2 -2
- package/build/platform-sdk/chunk-KGLNBMRO.js +2 -0
- package/build/platform-sdk/chunk-KGLNBMRO.js.map +1 -0
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/editor.js +2 -2
- 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-TM7JAWFS.js +4 -0
- package/build/preview-TM7JAWFS.js.map +1 -0
- package/build/render-command-QEQ3L7OX.js +4 -0
- package/build/render-command-QEQ3L7OX.js.map +1 -0
- package/internal/component-hmr-wrapper.tsx +9 -9
- package/package.json +8 -7
- package/templates/dashboard-plugin/files/plugin.tsx.ejs +8 -18
- package/templates/site-plugin/files/plugin.tsx.ejs +1 -1
- package/build/DevCommand-RTZ66W3P.js.map +0 -1
- package/build/GenerateCommand-J4FYPLSB.js +0 -128
- package/build/LogsCommand-J3PHRUGE.js +0 -4
- package/build/LogsCommand-J3PHRUGE.js.map +0 -1
- package/build/PreviewCommand-JYIGS25E.js +0 -4
- package/build/ServeCommand-LEJRJ2CR.js +0 -4
- package/build/ServeCommand-LEJRJ2CR.js.map +0 -1
- package/build/build-YPC7VLOB.js +0 -4
- package/build/build-YPC7VLOB.js.map +0 -1
- package/build/chunk-522ULCVX.js +0 -100
- package/build/chunk-522ULCVX.js.map +0 -1
- package/build/chunk-ATQCL6AZ.js.map +0 -1
- package/build/chunk-FMTROGFZ.js.map +0 -1
- package/build/chunk-KNH7RNAZ.js.map +0 -1
- package/build/chunk-MXLCRTVZ.js +0 -4
- package/build/chunk-NEWE3FX5.js.map +0 -1
- package/build/chunk-RWTMPGYF.js +0 -4
- package/build/chunk-RWTMPGYF.js.map +0 -1
- package/build/chunk-WLHVYK7Z.js +0 -4
- package/build/chunk-WLHVYK7Z.js.map +0 -1
- package/build/chunk-X3ZYER2U.js +0 -115
- package/build/chunk-X3ZYER2U.js.map +0 -1
- package/build/chunk-ZCIEKIRM.js +0 -4
- package/build/chunk-ZCIEKIRM.js.map +0 -1
- package/build/platform-sdk/chunk-3TJ2D6DS.js +0 -2
- package/build/platform-sdk/chunk-3TJ2D6DS.js.map +0 -1
- package/build/preview-VAP5AF4W.js +0 -4
- package/build/preview-VAP5AF4W.js.map +0 -1
- package/build/render-command-NE2QILSS.js +0 -4
- package/build/render-command-NE2QILSS.js.map +0 -1
- /package/build/{CreateVersionCommand-HVC5JTAL.js.map → CreateVersionCommand-XTZT5DED.js.map} +0 -0
- /package/build/{PreviewCommand-JYIGS25E.js.map → PreviewCommand-JKPFMGWV.js.map} +0 -0
- /package/build/{chunk-MXLCRTVZ.js.map → chunk-2FB5F5QF.js.map} +0 -0
- /package/build/{chunk-2R6WOCA4.js.map → chunk-4BHNJVL2.js.map} +0 -0
- /package/build/{chunk-6ZJVIMV7.js.map → chunk-6HSUK2A2.js.map} +0 -0
- /package/build/{chunk-2LPICRGU.js.map → chunk-B4SDDVMV.js.map} +0 -0
- /package/build/{chunk-UKELYG5A.js.map → chunk-C4SXZWXS.js.map} +0 -0
- /package/build/{chunk-CMBEPCWL.js.map → chunk-HDXLQ34N.js.map} +0 -0
- /package/build/{chunk-WRYRVOZP.js.map → chunk-KG7BHEJG.js.map} +0 -0
- /package/build/{chunk-2YXY5Y3Z.js.map → chunk-QOUZ6J7N.js.map} +0 -0
- /package/build/platform-sdk/{chunk-RE2R2PA6.js.map → chunk-GZP4Z76C.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;
|
|
@@ -4703,8 +4857,15 @@ function servicePluginsModules(authStrategy) {
|
|
|
4703
4857
|
async processRequest(request) {
|
|
4704
4858
|
const url = request.url;
|
|
4705
4859
|
const body = await request.text();
|
|
4706
|
-
|
|
4707
|
-
|
|
4860
|
+
try {
|
|
4861
|
+
const implMethodResult = await this.process({ url, body });
|
|
4862
|
+
return Response.json(implMethodResult);
|
|
4863
|
+
} catch (err) {
|
|
4864
|
+
if (err.errorType === "SPI" && err.applicationCode && err.httpCode) {
|
|
4865
|
+
return Response.json({ applicationError: { code: err.applicationCode, data: err.data } }, { status: err.httpCode });
|
|
4866
|
+
}
|
|
4867
|
+
throw err;
|
|
4868
|
+
}
|
|
4708
4869
|
},
|
|
4709
4870
|
async executeHandler(servicePluginRequest, url) {
|
|
4710
4871
|
const componentType = servicePluginRequest.metadata.appExtensionType.toLowerCase();
|
|
@@ -4739,6 +4900,120 @@ function servicePluginsModules(authStrategy) {
|
|
|
4739
4900
|
};
|
|
4740
4901
|
}
|
|
4741
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
|
+
|
|
4742
5017
|
// ../../node_modules/@wix/sdk/build/wixClient.js
|
|
4743
5018
|
function createClient(config) {
|
|
4744
5019
|
const _headers = config.headers || { Authorization: "" };
|
|
@@ -4747,8 +5022,25 @@ function createClient(config) {
|
|
|
4747
5022
|
};
|
|
4748
5023
|
const boundGetAuthHeaders = authStrategy.getAuthHeaders.bind(void 0, config.host);
|
|
4749
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
|
+
};
|
|
4750
5041
|
const { client: servicePluginsClient, initModule: initServicePluginModule } = servicePluginsModules(authStrategy);
|
|
4751
5042
|
const { client: eventHandlersClient, initModule: initEventHandlerModule } = eventHandlersModules(authStrategy);
|
|
5043
|
+
const { client: webMethodClient, initModule } = webMethodModules();
|
|
4752
5044
|
const boundFetch = async (url, options) => {
|
|
4753
5045
|
const authHeaders = await boundGetAuthHeaders();
|
|
4754
5046
|
const defaultContentTypeHeader = getDefaultContentHeader(options);
|
|
@@ -4770,6 +5062,8 @@ function createClient(config) {
|
|
|
4770
5062
|
return initServicePluginModule(modules);
|
|
4771
5063
|
} else if (isHostModule(modules) && config.host) {
|
|
4772
5064
|
return buildHostModule(modules, config.host);
|
|
5065
|
+
} else if (isWebMethodModules(modules)) {
|
|
5066
|
+
return initModule(modules);
|
|
4773
5067
|
} else if (typeof modules === "function") {
|
|
4774
5068
|
if ("__type" in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {
|
|
4775
5069
|
return modules;
|
|
@@ -4836,22 +5130,7 @@ function createClient(config) {
|
|
|
4836
5130
|
finalUrl.protocol = "https";
|
|
4837
5131
|
return boundFetch(finalUrl.toString(), options);
|
|
4838
5132
|
},
|
|
4839
|
-
fetchWithAuth
|
|
4840
|
-
if (typeof urlOrRequest === "string" || urlOrRequest instanceof URL) {
|
|
4841
|
-
return fetch(urlOrRequest, {
|
|
4842
|
-
...requestInit,
|
|
4843
|
-
headers: {
|
|
4844
|
-
...requestInit?.headers,
|
|
4845
|
-
...(await boundGetAuthHeaders()).headers
|
|
4846
|
-
}
|
|
4847
|
-
});
|
|
4848
|
-
} else {
|
|
4849
|
-
for (const [k, v] of Object.entries((await boundGetAuthHeaders()).headers)) {
|
|
4850
|
-
urlOrRequest.headers.set(k, v);
|
|
4851
|
-
}
|
|
4852
|
-
return fetch(urlOrRequest, requestInit);
|
|
4853
|
-
}
|
|
4854
|
-
},
|
|
5133
|
+
fetchWithAuth,
|
|
4855
5134
|
async graphql(query, variables, opts = {
|
|
4856
5135
|
apiVersion: "alpha"
|
|
4857
5136
|
}) {
|
|
@@ -4870,13 +5149,13 @@ function createClient(config) {
|
|
|
4870
5149
|
return { data: data ?? {}, errors };
|
|
4871
5150
|
},
|
|
4872
5151
|
webhooks: eventHandlersClient,
|
|
5152
|
+
webMethods: webMethodClient,
|
|
4873
5153
|
servicePlugins: servicePluginsClient
|
|
4874
5154
|
};
|
|
4875
5155
|
}
|
|
4876
5156
|
|
|
4877
5157
|
// ../../node_modules/@wix/sdk/build/auth/AppStrategy.js
|
|
4878
5158
|
function AppStrategy(opts) {
|
|
4879
|
-
const authServerBaseUrl = opts.authServerBaseUrl ?? "https://www.wixapis.com";
|
|
4880
5159
|
let refreshToken = "refreshToken" in opts ? opts.refreshToken : void 0;
|
|
4881
5160
|
let cachedToken;
|
|
4882
5161
|
return {
|
|
@@ -4906,8 +5185,7 @@ function AppStrategy(opts) {
|
|
|
4906
5185
|
if (!code || !instanceId) {
|
|
4907
5186
|
throw new Error("Invalid OAuth callback URL. Make sure you pass the url including the code and instanceId query params.");
|
|
4908
5187
|
}
|
|
4909
|
-
const
|
|
4910
|
-
const tokensRes = await fetch(tokenUrl.href, {
|
|
5188
|
+
const tokensRes = await fetch("https://www.wixapis.com/oauth/access", {
|
|
4911
5189
|
method: "POST",
|
|
4912
5190
|
headers: {
|
|
4913
5191
|
"Content-Type": "application/json"
|
|
@@ -4940,10 +5218,9 @@ function AppStrategy(opts) {
|
|
|
4940
5218
|
}
|
|
4941
5219
|
if ("refreshToken" in opts || refreshToken) {
|
|
4942
5220
|
if (!opts.appSecret) {
|
|
4943
|
-
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");
|
|
4944
5222
|
}
|
|
4945
|
-
const
|
|
4946
|
-
const tokensRes = await fetch(tokenUrl.href, {
|
|
5223
|
+
const tokensRes = await fetch("https://www.wixapis.com/oauth/access", {
|
|
4947
5224
|
method: "POST",
|
|
4948
5225
|
headers: {
|
|
4949
5226
|
"Content-Type": "application/json"
|
|
@@ -4967,10 +5244,9 @@ function AppStrategy(opts) {
|
|
|
4967
5244
|
};
|
|
4968
5245
|
} else if ("instanceId" in opts) {
|
|
4969
5246
|
if (!opts.appSecret) {
|
|
4970
|
-
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");
|
|
4971
5248
|
}
|
|
4972
|
-
const
|
|
4973
|
-
const tokensRes = await fetch(tokenUrl.href, {
|
|
5249
|
+
const tokensRes = await fetch("https://www.wixapis.com/oauth2/token", {
|
|
4974
5250
|
method: "POST",
|
|
4975
5251
|
headers: {
|
|
4976
5252
|
"Content-Type": "application/json"
|
|
@@ -4996,7 +5272,7 @@ function AppStrategy(opts) {
|
|
|
4996
5272
|
}
|
|
4997
5273
|
};
|
|
4998
5274
|
} else if ("accessToken" in opts && opts.accessToken) {
|
|
4999
|
-
const tokenRes = await fetch(
|
|
5275
|
+
const tokenRes = await fetch("https://www.wixapis.com/oauth2/token", {
|
|
5000
5276
|
method: "POST",
|
|
5001
5277
|
headers: {
|
|
5002
5278
|
"Content-Type": "application/json"
|
|
@@ -5026,7 +5302,7 @@ function AppStrategy(opts) {
|
|
|
5026
5302
|
},
|
|
5027
5303
|
async elevated() {
|
|
5028
5304
|
if ("accessToken" in opts && opts.accessToken) {
|
|
5029
|
-
const tokenInfo = await getTokenInfo(opts.accessToken
|
|
5305
|
+
const tokenInfo = await getTokenInfo(opts.accessToken);
|
|
5030
5306
|
if (tokenInfo.clientId !== opts.appId) {
|
|
5031
5307
|
throw new Error(`Invalid access token. The token is not issued for the app with ID "${opts.appId}"`);
|
|
5032
5308
|
}
|
|
@@ -5037,8 +5313,7 @@ function AppStrategy(opts) {
|
|
|
5037
5313
|
appId: opts.appId,
|
|
5038
5314
|
appSecret: opts.appSecret,
|
|
5039
5315
|
publicKey: opts.publicKey,
|
|
5040
|
-
instanceId: tokenInfo.instanceId
|
|
5041
|
-
authServerBaseUrl: opts.authServerBaseUrl
|
|
5316
|
+
instanceId: tokenInfo.instanceId
|
|
5042
5317
|
});
|
|
5043
5318
|
} else {
|
|
5044
5319
|
throw new Error("Providing an access token is required to perform elevation. Make sure to pass it to the AppStrategy");
|
|
@@ -5066,29 +5341,13 @@ function AppStrategy(opts) {
|
|
|
5066
5341
|
if (!tokenToCheck) {
|
|
5067
5342
|
throw new Error("Missing token to get info for. Either pass the token as an argument or provide it when initializing the AppStrategy");
|
|
5068
5343
|
}
|
|
5069
|
-
return getTokenInfo(tokenToCheck
|
|
5344
|
+
return getTokenInfo(tokenToCheck);
|
|
5070
5345
|
},
|
|
5071
5346
|
getActiveToken() {
|
|
5072
5347
|
return "accessToken" in opts ? opts.accessToken : refreshToken;
|
|
5073
5348
|
}
|
|
5074
5349
|
};
|
|
5075
5350
|
}
|
|
5076
|
-
async function getTokenInfo(token, authServerBaseUrl) {
|
|
5077
|
-
const tokenInfoUrl = new URL("/oauth2/token-info", authServerBaseUrl);
|
|
5078
|
-
const tokenInfoRes = await fetch(tokenInfoUrl.href, {
|
|
5079
|
-
method: "POST",
|
|
5080
|
-
headers: {
|
|
5081
|
-
"Content-Type": "application/json"
|
|
5082
|
-
},
|
|
5083
|
-
body: JSON.stringify({
|
|
5084
|
-
token
|
|
5085
|
-
})
|
|
5086
|
-
});
|
|
5087
|
-
if (tokenInfoRes.status !== 200) {
|
|
5088
|
-
throw new Error(`Failed to get token info. Unexpected status code from Wix OAuth API: ${tokenInfoRes.status}`);
|
|
5089
|
-
}
|
|
5090
|
-
return await tokenInfoRes.json();
|
|
5091
|
-
}
|
|
5092
5351
|
|
|
5093
5352
|
// src/utils.ts
|
|
5094
5353
|
import { dirname, sep } from "node:path";
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{a as A}from"./chunk-
|
|
3
|
+
import{a as A}from"./chunk-2FB5F5QF.js";import"./chunk-5OZZ7R6I.js";import{a as Z,b as V,m as S}from"./chunk-JXE3LQ2S.js";import{a as H,c as E,e as $,h as m}from"./chunk-V4TR6DCM.js";var k=E(W=>{"use strict";m();var P=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},N=class extends P{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};W.CommanderError=P;W.InvalidArgumentError=N});var T=E(j=>{"use strict";m();var{InvalidArgumentError:He}=k(),M=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new He(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ke(o){let e=o.name()+(o.variadic===!0?"...":"");return o.required?"<"+e+">":"["+e+"]"}j.Argument=M;j.humanReadableArgName=ke});var R=E(ee=>{"use strict";m();var{humanReadableArgName:Pe}=T(),U=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((n,r)=>n.name().localeCompare(r.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),i=e._getHelpOption();if(i&&!i.hidden){let n=i.short&&e._findOption(i.short),r=i.long&&e._findOption(i.long);!n&&!r?t.push(i):i.long&&!r?t.push(e.createOption(i.long,i.description)):i.short&&!n&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(r=>!r.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>Pe(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,r=2,s=2;function u(p,x){if(x){let D=`${p.padEnd(i+s)}${x}`;return t.wrap(D,n-r,i+s)}return p}function a(p){return p.join(`
|
|
4
4
|
`).replace(/^/gm," ".repeat(r))}let l=[`Usage: ${t.commandUsage(e)}`,""],h=t.commandDescription(e);h.length>0&&(l=l.concat([t.wrap(h,n,0),""]));let c=t.visibleArguments(e).map(p=>u(t.argumentTerm(p),t.argumentDescription(p)));c.length>0&&(l=l.concat(["Arguments:",a(c),""]));let C=t.visibleOptions(e).map(p=>u(t.optionTerm(p),t.optionDescription(p)));if(C.length>0&&(l=l.concat(["Options:",a(C),""])),this.showGlobalOptions){let p=t.visibleGlobalOptions(e).map(x=>u(t.optionTerm(x),t.optionDescription(x)));p.length>0&&(l=l.concat(["Global Options:",a(p),""]))}let y=t.visibleCommands(e).map(p=>u(t.subcommandTerm(p),t.subcommandDescription(p)));return y.length>0&&(l=l.concat(["Commands:",a(y),""])),l.join(`
|
|
5
5
|
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,n=40){let r=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",s=new RegExp(`[\\n][${r}]+`);if(e.match(s))return e;let u=t-i;if(u<n)return e;let a=e.slice(0,i),l=e.slice(i).replace(`\r
|
|
6
6
|
`,`
|
|
@@ -21,5 +21,5 @@ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
21
21
|
`),this.outputHelp({error:!0}));let i=t||{},n=i.exitCode||1,r=i.code||"commander.error";this._exit(n,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in d.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,d.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ue(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=s=>{let u=s.attributeName(),a=this.getOptionValue(u),l=this.options.find(c=>c.negate&&u===c.attributeName()),h=this.options.find(c=>!c.negate&&u===c.attributeName());return l&&(l.presetArg===void 0&&a===!1||l.presetArg!==void 0&&a===l.presetArg)?l:h||s},n=s=>{let u=i(s),a=u.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${u.envVar}'`:`option '${u.flags}'`},r=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],r=this;do{let s=r.createHelp().visibleOptions(r).filter(u=>u.long).map(u=>u.long);n=n.concat(s),r=r.parent}while(r&&!r._enablePositionalOptions);t=re(e,n)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(r=>{n.push(r.name()),r.alias()&&n.push(r.alias())}),t=re(e,n)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let n=this.createOption(t,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
22
22
|
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(e);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>Me(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=v.basename(e,v.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},i;return t.error?i=n=>this._outputConfiguration.writeErr(n):i=n=>this._outputConfiguration.writeOut(n),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let n=this.helpInformation(i);if(t&&(n=t(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=d.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
23
23
|
Expecting one of '${i.join("', '")}'`);let n=`${e}Help`;return this.on(n,r=>{let s;typeof t=="function"?s=t({error:r.error,command:r.command}):s=t,s&&r.write(`${s}
|
|
24
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function se(o){return o.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?n=r[3]:i=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],i=r[3],n=r[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}oe.Command=Q});var me=E(w=>{"use strict";m();var{Argument:ue}=T(),{Command:X}=ae(),{CommanderError:Re,InvalidArgumentError:le}=k(),{Help:Ge}=R(),{Option:he}=J();w.program=new X;w.createCommand=o=>new X(o);w.createOption=(o,e)=>new he(o,e);w.createArgument=(o,e)=>new ue(o,e);w.Command=X;w.Option=he;w.Argument=ue;w.Help=Ge;w.CommanderError=Re;w.InvalidArgumentError=le;w.InvalidOptionArgumentError=le});var de=E((O,ce)=>{"use strict";m();var b=me();O=ce.exports={};O.program=new b.Command;O.Argument=b.Argument;O.Command=b.Command;O.CommanderError=b.CommanderError;O.Help=b.Help;O.InvalidArgumentError=b.InvalidArgumentError;O.InvalidOptionArgumentError=b.InvalidArgumentError;O.Option=b.Option;O.createCommand=o=>new b.Command(o);O.createOption=(o,e)=>new b.Option(o,e);O.createArgument=(o,e)=>new b.Argument(o,e)});m();m();m();var pe=$(de(),1),{program:at,createCommand:_,createArgument:ut,createOption:lt,CommanderError:ht,InvalidArgumentError:I,InvalidOptionArgumentError:mt,Command:ct,Argument:dt,Option:fe,Help:pt}=pe.default;m();var ge=o=>_("build").action(async(e,t)=>{let{runCommand:i}=await import("./render-command-
|
|
24
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function se(o){return o.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?n=r[3]:i=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],i=r[3],n=r[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}oe.Command=Q});var me=E(w=>{"use strict";m();var{Argument:ue}=T(),{Command:X}=ae(),{CommanderError:Re,InvalidArgumentError:le}=k(),{Help:Ge}=R(),{Option:he}=J();w.program=new X;w.createCommand=o=>new X(o);w.createOption=(o,e)=>new he(o,e);w.createArgument=(o,e)=>new ue(o,e);w.Command=X;w.Option=he;w.Argument=ue;w.Help=Ge;w.CommanderError=Re;w.InvalidArgumentError=le;w.InvalidOptionArgumentError=le});var de=E((O,ce)=>{"use strict";m();var b=me();O=ce.exports={};O.program=new b.Command;O.Argument=b.Argument;O.Command=b.Command;O.CommanderError=b.CommanderError;O.Help=b.Help;O.InvalidArgumentError=b.InvalidArgumentError;O.InvalidOptionArgumentError=b.InvalidArgumentError;O.Option=b.Option;O.createCommand=o=>new b.Command(o);O.createOption=(o,e)=>new b.Option(o,e);O.createArgument=(o,e)=>new b.Argument(o,e)});m();m();m();var pe=$(de(),1),{program:at,createCommand:_,createArgument:ut,createOption:lt,CommanderError:ht,InvalidArgumentError:I,InvalidOptionArgumentError:mt,Command:ct,Argument:dt,Option:fe,Help:pt}=pe.default;m();var ge=o=>_("build").action(async(e,t)=>{let{runCommand:i}=await import("./render-command-QEQ3L7OX.js"),{build:n}=await import("./build-3RXHADZD.js");await i(t,o,n)});m();var _e=$(V(),1);var Ce=o=>{let e=A();return _("dev").option("-s, --https",e("dev_command_def.option.https")).action(async(t,i)=>{let{DevCommand:n}=await import("./DevCommand-Q5XLAGMG.js"),{renderCommand:r}=await import("./render-command-QEQ3L7OX.js"),{https:s=!1}=t;await r(i,o,_e.default.createElement(n,{https:s}),{watchForModelChanges:!0})})};m();var we=$(V(),1);m();function F(o){let e=S.union([S.string().uuid(),S.literal("current")]).transform(t=>t==="current"?void 0:t).safeParse(o);if(e.success)return e.data;throw new I('Value must be a valid GUID or "current"')}function q(o){let e=S.string().url().safeParse(o);if(e.success)return e.data;throw new I("Value must be a valid URL")}function Oe(o){let e=S.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?$/).safeParse(o);if(e.success)return e.data;throw new I("Version value should be in semver format `x.x.x`")}var be=o=>{let e=A();return _("preview").option("-s, --site <site-id>",e("app_preview_command_def.option.site"),F).option("--base-url <url>",e("app_preview_command_def.option.base_url"),q).option("--no-input",e("app_preview_command_def.option.no_input")).action(async(t,i)=>{let{site:n,baseUrl:r,input:s}=t,{renderCommand:u,runCommand:a}=await import("./render-command-QEQ3L7OX.js");if(!s)return a(i,o,async h=>{let{nonInteractivePreview:c}=await import("./preview-TM7JAWFS.js");return c({siteId:n,baseUrl:r},h,o)});let{PreviewCommand:l}=await import("./PreviewCommand-JKPFMGWV.js");await u(i,o,we.default.createElement(l,{baseUrl:r,siteIdOverride:n}))})};m();var Ae=$(V(),1);var ve=o=>{let e=A();return _("create-version").addOption(new fe("-t, --version-type <type>",e("create_version_command_def.option.version_type")).choices(["major","minor"])).option("-s, --site <site-id>",e("create_version_command_def.option.site"),F).option("-y, --approve-preview",e("create_version_command_def.option.approve_preview")).option("--base-url <url>",e("create_version_command_def.option.base_url"),q).action(async(t,i)=>{let{VersionType:n}=await import("./types.impl-L2DPGJ77.js"),{renderCommand:r}=await import("./render-command-QEQ3L7OX.js"),{CreateVersionCommand:s}=await import("./CreateVersionCommand-XTZT5DED.js"),{approvePreview:u=!1,versionType:a,baseUrl:l,site:h}=t,c={major:n.MAJOR,minor:n.MINOR},C=a?c[a]:void 0;await r(i,o,Ae.default.createElement(s,{baseUrl:l,siteIdOverride:h,preApprovePreview:u,versionType:C}))})};m();var xe=$(V(),1);var Ee=o=>_("serve").action(async(e,t)=>{let{renderCommand:i}=await import("./render-command-QEQ3L7OX.js"),{ServeCommand:n}=await import("./ServeCommand-CPZOI7DC.js");await i(t,o,xe.default.createElement(n,null))});m();var ye=$(V(),1);var $e=o=>{let e=A();return _("generate").description(e("generate_command.description")).action(async(t,i)=>{let{GenerateCommand:n}=await import("./GenerateCommand-HNFICZJA.js"),{renderCommand:r}=await import("./render-command-QEQ3L7OX.js");await r(i,o,ye.default.createElement(n,null),{skipProjectValidation:!0})})};m();var Ve=$(V(),1);var Se=o=>{let e=A();return _("logs").requiredOption("--version <version>",e("logs_command_def.option.version"),Oe).action(async(t,i)=>{let{version:n}=t,{renderCommand:r}=await import("./render-command-QEQ3L7OX.js"),{LogsCommand:s}=await import("./LogsCommand-XJHE75L2.js");await r(i,o,Ve.default.createElement(s,{version:n}))})};var Le=async o=>_("app").version(Z,"-v, --version","Output the version number").enablePositionalOptions(!0).helpOption("-h, --help","Display help for command").helpCommand(!1).addCommand(Ce(o)).addCommand(ge(o)).addCommand(Ee(o)).addCommand(be(o)).addCommand(ve(o)).addCommand($e(o)).addCommand(Se(o));export{Le as getRootCommand};
|
|
25
25
|
//# sourceMappingURL=index.js.map
|