@kevisual/cli 0.0.56 → 0.0.58
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/bin/envision.js +1 -1
- package/bun.config.mjs +1 -1
- package/dist/assistant-server.js +464 -439
- package/dist/assistant.js +373 -373
- package/dist/{envision.mjs → envision.js} +355 -216
- package/package.json +13 -14
|
@@ -22056,7 +22056,7 @@ var require_cjs = __commonJS((exports) => {
|
|
|
22056
22056
|
} });
|
|
22057
22057
|
});
|
|
22058
22058
|
|
|
22059
|
-
// node_modules/.pnpm/run-async@
|
|
22059
|
+
// node_modules/.pnpm/run-async@4.0.5/node_modules/run-async/index.js
|
|
22060
22060
|
var require_run_async = __commonJS((exports, module) => {
|
|
22061
22061
|
function isPromise(obj) {
|
|
22062
22062
|
return !!obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function";
|
|
@@ -41246,7 +41246,7 @@ var require_es_set_tostringtag = __commonJS((exports, module) => {
|
|
|
41246
41246
|
};
|
|
41247
41247
|
});
|
|
41248
41248
|
|
|
41249
|
-
// node_modules/.pnpm/form-data@4.0.
|
|
41249
|
+
// node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/populate.js
|
|
41250
41250
|
var require_populate = __commonJS((exports, module) => {
|
|
41251
41251
|
module.exports = function(dst, src) {
|
|
41252
41252
|
Object.keys(src).forEach(function(prop) {
|
|
@@ -41256,7 +41256,7 @@ var require_populate = __commonJS((exports, module) => {
|
|
|
41256
41256
|
};
|
|
41257
41257
|
});
|
|
41258
41258
|
|
|
41259
|
-
// node_modules/.pnpm/form-data@4.0.
|
|
41259
|
+
// node_modules/.pnpm/form-data@4.0.4/node_modules/form-data/lib/form_data.js
|
|
41260
41260
|
var require_form_data = __commonJS((exports, module) => {
|
|
41261
41261
|
var CombinedStream = require_combined_stream();
|
|
41262
41262
|
var util2 = __require("util");
|
|
@@ -41266,12 +41266,12 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41266
41266
|
var parseUrl = __require("url").parse;
|
|
41267
41267
|
var fs4 = __require("fs");
|
|
41268
41268
|
var Stream = __require("stream").Stream;
|
|
41269
|
+
var crypto = __require("crypto");
|
|
41269
41270
|
var mime = require_mime_types();
|
|
41270
41271
|
var asynckit = require_asynckit();
|
|
41271
41272
|
var setToStringTag = require_es_set_tostringtag();
|
|
41273
|
+
var hasOwn = require_hasown();
|
|
41272
41274
|
var populate = require_populate();
|
|
41273
|
-
module.exports = FormData;
|
|
41274
|
-
util2.inherits(FormData, CombinedStream);
|
|
41275
41275
|
function FormData(options) {
|
|
41276
41276
|
if (!(this instanceof FormData)) {
|
|
41277
41277
|
return new FormData(options);
|
|
@@ -41285,17 +41285,18 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41285
41285
|
this[option] = options[option];
|
|
41286
41286
|
}
|
|
41287
41287
|
}
|
|
41288
|
+
util2.inherits(FormData, CombinedStream);
|
|
41288
41289
|
FormData.LINE_BREAK = `\r
|
|
41289
41290
|
`;
|
|
41290
41291
|
FormData.DEFAULT_CONTENT_TYPE = "application/octet-stream";
|
|
41291
41292
|
FormData.prototype.append = function(field, value, options) {
|
|
41292
41293
|
options = options || {};
|
|
41293
|
-
if (typeof options
|
|
41294
|
+
if (typeof options === "string") {
|
|
41294
41295
|
options = { filename: options };
|
|
41295
41296
|
}
|
|
41296
41297
|
var append = CombinedStream.prototype.append.bind(this);
|
|
41297
|
-
if (typeof value
|
|
41298
|
-
value =
|
|
41298
|
+
if (typeof value === "number" || value == null) {
|
|
41299
|
+
value = String(value);
|
|
41299
41300
|
}
|
|
41300
41301
|
if (Array.isArray(value)) {
|
|
41301
41302
|
this._error(new Error("Arrays are not supported."));
|
|
@@ -41311,7 +41312,7 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41311
41312
|
FormData.prototype._trackLength = function(header, value, options) {
|
|
41312
41313
|
var valueLength = 0;
|
|
41313
41314
|
if (options.knownLength != null) {
|
|
41314
|
-
valueLength +=
|
|
41315
|
+
valueLength += Number(options.knownLength);
|
|
41315
41316
|
} else if (Buffer.isBuffer(value)) {
|
|
41316
41317
|
valueLength = value.length;
|
|
41317
41318
|
} else if (typeof value === "string") {
|
|
@@ -41319,7 +41320,7 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41319
41320
|
}
|
|
41320
41321
|
this._valueLength += valueLength;
|
|
41321
41322
|
this._overheadLength += Buffer.byteLength(header) + FormData.LINE_BREAK.length;
|
|
41322
|
-
if (!value || !value.path && !(value.readable &&
|
|
41323
|
+
if (!value || !value.path && !(value.readable && hasOwn(value, "httpVersion")) && !(value instanceof Stream)) {
|
|
41323
41324
|
return;
|
|
41324
41325
|
}
|
|
41325
41326
|
if (!options.knownLength) {
|
|
@@ -41327,26 +41328,25 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41327
41328
|
}
|
|
41328
41329
|
};
|
|
41329
41330
|
FormData.prototype._lengthRetriever = function(value, callback) {
|
|
41330
|
-
if (
|
|
41331
|
+
if (hasOwn(value, "fd")) {
|
|
41331
41332
|
if (value.end != null && value.end != Infinity && value.start != null) {
|
|
41332
41333
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
41333
41334
|
} else {
|
|
41334
41335
|
fs4.stat(value.path, function(err, stat) {
|
|
41335
|
-
var fileSize;
|
|
41336
41336
|
if (err) {
|
|
41337
41337
|
callback(err);
|
|
41338
41338
|
return;
|
|
41339
41339
|
}
|
|
41340
|
-
fileSize = stat.size - (value.start ? value.start : 0);
|
|
41340
|
+
var fileSize = stat.size - (value.start ? value.start : 0);
|
|
41341
41341
|
callback(null, fileSize);
|
|
41342
41342
|
});
|
|
41343
41343
|
}
|
|
41344
|
-
} else if (
|
|
41345
|
-
callback(null,
|
|
41346
|
-
} else if (
|
|
41344
|
+
} else if (hasOwn(value, "httpVersion")) {
|
|
41345
|
+
callback(null, Number(value.headers["content-length"]));
|
|
41346
|
+
} else if (hasOwn(value, "httpModule")) {
|
|
41347
41347
|
value.on("response", function(response) {
|
|
41348
41348
|
value.pause();
|
|
41349
|
-
callback(null,
|
|
41349
|
+
callback(null, Number(response.headers["content-length"]));
|
|
41350
41350
|
});
|
|
41351
41351
|
value.resume();
|
|
41352
41352
|
} else {
|
|
@@ -41354,7 +41354,7 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41354
41354
|
}
|
|
41355
41355
|
};
|
|
41356
41356
|
FormData.prototype._multiPartHeader = function(field, value, options) {
|
|
41357
|
-
if (typeof options.header
|
|
41357
|
+
if (typeof options.header === "string") {
|
|
41358
41358
|
return options.header;
|
|
41359
41359
|
}
|
|
41360
41360
|
var contentDisposition = this._getContentDisposition(value, options);
|
|
@@ -41364,12 +41364,12 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41364
41364
|
"Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
|
|
41365
41365
|
"Content-Type": [].concat(contentType || [])
|
|
41366
41366
|
};
|
|
41367
|
-
if (typeof options.header
|
|
41367
|
+
if (typeof options.header === "object") {
|
|
41368
41368
|
populate(headers, options.header);
|
|
41369
41369
|
}
|
|
41370
41370
|
var header;
|
|
41371
41371
|
for (var prop in headers) {
|
|
41372
|
-
if (
|
|
41372
|
+
if (hasOwn(headers, prop)) {
|
|
41373
41373
|
header = headers[prop];
|
|
41374
41374
|
if (header == null) {
|
|
41375
41375
|
continue;
|
|
@@ -41385,34 +41385,33 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41385
41385
|
return "--" + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
|
|
41386
41386
|
};
|
|
41387
41387
|
FormData.prototype._getContentDisposition = function(value, options) {
|
|
41388
|
-
var filename
|
|
41388
|
+
var filename;
|
|
41389
41389
|
if (typeof options.filepath === "string") {
|
|
41390
41390
|
filename = path2.normalize(options.filepath).replace(/\\/g, "/");
|
|
41391
|
-
} else if (options.filename || value.name || value.path) {
|
|
41392
|
-
filename = path2.basename(options.filename || value.name || value.path);
|
|
41393
|
-
} else if (value.readable &&
|
|
41391
|
+
} else if (options.filename || value && (value.name || value.path)) {
|
|
41392
|
+
filename = path2.basename(options.filename || value && (value.name || value.path));
|
|
41393
|
+
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
41394
41394
|
filename = path2.basename(value.client._httpMessage.path || "");
|
|
41395
41395
|
}
|
|
41396
41396
|
if (filename) {
|
|
41397
|
-
|
|
41397
|
+
return 'filename="' + filename + '"';
|
|
41398
41398
|
}
|
|
41399
|
-
return contentDisposition;
|
|
41400
41399
|
};
|
|
41401
41400
|
FormData.prototype._getContentType = function(value, options) {
|
|
41402
41401
|
var contentType = options.contentType;
|
|
41403
|
-
if (!contentType && value.name) {
|
|
41402
|
+
if (!contentType && value && value.name) {
|
|
41404
41403
|
contentType = mime.lookup(value.name);
|
|
41405
41404
|
}
|
|
41406
|
-
if (!contentType && value.path) {
|
|
41405
|
+
if (!contentType && value && value.path) {
|
|
41407
41406
|
contentType = mime.lookup(value.path);
|
|
41408
41407
|
}
|
|
41409
|
-
if (!contentType && value.readable &&
|
|
41408
|
+
if (!contentType && value && value.readable && hasOwn(value, "httpVersion")) {
|
|
41410
41409
|
contentType = value.headers["content-type"];
|
|
41411
41410
|
}
|
|
41412
41411
|
if (!contentType && (options.filepath || options.filename)) {
|
|
41413
41412
|
contentType = mime.lookup(options.filepath || options.filename);
|
|
41414
41413
|
}
|
|
41415
|
-
if (!contentType && typeof value
|
|
41414
|
+
if (!contentType && value && typeof value === "object") {
|
|
41416
41415
|
contentType = FormData.DEFAULT_CONTENT_TYPE;
|
|
41417
41416
|
}
|
|
41418
41417
|
return contentType;
|
|
@@ -41436,13 +41435,16 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41436
41435
|
"content-type": "multipart/form-data; boundary=" + this.getBoundary()
|
|
41437
41436
|
};
|
|
41438
41437
|
for (header in userHeaders) {
|
|
41439
|
-
if (
|
|
41438
|
+
if (hasOwn(userHeaders, header)) {
|
|
41440
41439
|
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
41441
41440
|
}
|
|
41442
41441
|
}
|
|
41443
41442
|
return formHeaders;
|
|
41444
41443
|
};
|
|
41445
41444
|
FormData.prototype.setBoundary = function(boundary) {
|
|
41445
|
+
if (typeof boundary !== "string") {
|
|
41446
|
+
throw new TypeError("FormData boundary must be a string");
|
|
41447
|
+
}
|
|
41446
41448
|
this._boundary = boundary;
|
|
41447
41449
|
};
|
|
41448
41450
|
FormData.prototype.getBoundary = function() {
|
|
@@ -41469,11 +41471,7 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41469
41471
|
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
41470
41472
|
};
|
|
41471
41473
|
FormData.prototype._generateBoundary = function() {
|
|
41472
|
-
|
|
41473
|
-
for (var i = 0;i < 24; i++) {
|
|
41474
|
-
boundary += Math.floor(Math.random() * 10).toString(16);
|
|
41475
|
-
}
|
|
41476
|
-
this._boundary = boundary;
|
|
41474
|
+
this._boundary = "--------------------------" + crypto.randomBytes(12).toString("hex");
|
|
41477
41475
|
};
|
|
41478
41476
|
FormData.prototype.getLengthSync = function() {
|
|
41479
41477
|
var knownLength = this._overheadLength + this._valueLength;
|
|
@@ -41513,8 +41511,10 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41513
41511
|
});
|
|
41514
41512
|
};
|
|
41515
41513
|
FormData.prototype.submit = function(params, cb) {
|
|
41516
|
-
var request
|
|
41517
|
-
|
|
41514
|
+
var request;
|
|
41515
|
+
var options;
|
|
41516
|
+
var defaults = { method: "post" };
|
|
41517
|
+
if (typeof params === "string") {
|
|
41518
41518
|
params = parseUrl(params);
|
|
41519
41519
|
options = populate({
|
|
41520
41520
|
port: params.port,
|
|
@@ -41525,11 +41525,11 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41525
41525
|
} else {
|
|
41526
41526
|
options = populate(params, defaults);
|
|
41527
41527
|
if (!options.port) {
|
|
41528
|
-
options.port = options.protocol
|
|
41528
|
+
options.port = options.protocol === "https:" ? 443 : 80;
|
|
41529
41529
|
}
|
|
41530
41530
|
}
|
|
41531
41531
|
options.headers = this.getHeaders(params.headers);
|
|
41532
|
-
if (options.protocol
|
|
41532
|
+
if (options.protocol === "https:") {
|
|
41533
41533
|
request = https.request(options);
|
|
41534
41534
|
} else {
|
|
41535
41535
|
request = http.request(options);
|
|
@@ -41568,6 +41568,7 @@ var require_form_data = __commonJS((exports, module) => {
|
|
|
41568
41568
|
return "[object FormData]";
|
|
41569
41569
|
};
|
|
41570
41570
|
setToStringTag(FormData, "FormData");
|
|
41571
|
+
module.exports = FormData;
|
|
41571
41572
|
});
|
|
41572
41573
|
|
|
41573
41574
|
// node_modules/.pnpm/ignore@7.0.5/node_modules/ignore/index.js
|
|
@@ -41917,8 +41918,8 @@ var {
|
|
|
41917
41918
|
import fs from "fs";
|
|
41918
41919
|
var version = "0.0.1";
|
|
41919
41920
|
try {
|
|
41920
|
-
if ("0.0.
|
|
41921
|
-
version = "0.0.
|
|
41921
|
+
if ("0.0.57")
|
|
41922
|
+
version = "0.0.57";
|
|
41922
41923
|
} catch (e) {}
|
|
41923
41924
|
program.name("app").description("A CLI tool with envison").version(version, "-V, --version");
|
|
41924
41925
|
var ls = new Command("ls").description("List files in the current directory").action(() => {
|
|
@@ -41963,14 +41964,14 @@ var writeConfig = (config) => {
|
|
|
41963
41964
|
return config;
|
|
41964
41965
|
};
|
|
41965
41966
|
|
|
41966
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
41967
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/key.js
|
|
41967
41968
|
var isUpKey = (key) => key.name === "up" || key.name === "k" || key.ctrl && key.name === "p";
|
|
41968
41969
|
var isDownKey = (key) => key.name === "down" || key.name === "j" || key.ctrl && key.name === "n";
|
|
41969
41970
|
var isSpaceKey = (key) => key.name === "space";
|
|
41970
41971
|
var isBackspaceKey = (key) => key.name === "backspace";
|
|
41971
41972
|
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
41972
41973
|
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
41973
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
41974
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/errors.js
|
|
41974
41975
|
class AbortPromptError extends Error {
|
|
41975
41976
|
name = "AbortPromptError";
|
|
41976
41977
|
message = "Prompt was aborted";
|
|
@@ -41996,10 +41997,10 @@ class HookError extends Error {
|
|
|
41996
41997
|
class ValidationError extends Error {
|
|
41997
41998
|
name = "ValidationError";
|
|
41998
41999
|
}
|
|
41999
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42000
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/use-state.js
|
|
42000
42001
|
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
42001
42002
|
|
|
42002
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42003
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/hook-engine.js
|
|
42003
42004
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
42004
42005
|
var hookStorage = new AsyncLocalStorage;
|
|
42005
42006
|
function createStore(rl) {
|
|
@@ -42104,7 +42105,7 @@ var effectScheduler = {
|
|
|
42104
42105
|
}
|
|
42105
42106
|
};
|
|
42106
42107
|
|
|
42107
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42108
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/use-state.js
|
|
42108
42109
|
function useState(defaultValue) {
|
|
42109
42110
|
return withPointer((pointer) => {
|
|
42110
42111
|
const setState = AsyncResource2.bind(function setState(newValue) {
|
|
@@ -42122,7 +42123,7 @@ function useState(defaultValue) {
|
|
|
42122
42123
|
});
|
|
42123
42124
|
}
|
|
42124
42125
|
|
|
42125
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42126
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/use-effect.js
|
|
42126
42127
|
function useEffect(cb, depArray) {
|
|
42127
42128
|
withPointer((pointer) => {
|
|
42128
42129
|
const oldDeps = pointer.get();
|
|
@@ -42134,10 +42135,10 @@ function useEffect(cb, depArray) {
|
|
|
42134
42135
|
});
|
|
42135
42136
|
}
|
|
42136
42137
|
|
|
42137
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42138
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/theme.js
|
|
42138
42139
|
var import_yoctocolors_cjs = __toESM(require_yoctocolors_cjs(), 1);
|
|
42139
42140
|
|
|
42140
|
-
// node_modules/.pnpm/@inquirer+figures@1.0.
|
|
42141
|
+
// node_modules/.pnpm/@inquirer+figures@1.0.13/node_modules/@inquirer/figures/dist/esm/index.js
|
|
42141
42142
|
import process2 from "node:process";
|
|
42142
42143
|
function isUnicodeSupported() {
|
|
42143
42144
|
if (process2.platform !== "win32") {
|
|
@@ -42423,7 +42424,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
|
42423
42424
|
var esm_default = figures;
|
|
42424
42425
|
var replacements = Object.entries(specialMainSymbols);
|
|
42425
42426
|
|
|
42426
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42427
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/theme.js
|
|
42427
42428
|
var defaultTheme = {
|
|
42428
42429
|
prefix: {
|
|
42429
42430
|
idle: import_yoctocolors_cjs.default.blue("?"),
|
|
@@ -42444,7 +42445,7 @@ var defaultTheme = {
|
|
|
42444
42445
|
}
|
|
42445
42446
|
};
|
|
42446
42447
|
|
|
42447
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42448
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/make-theme.js
|
|
42448
42449
|
function isPlainObject(value) {
|
|
42449
42450
|
if (typeof value !== "object" || value === null)
|
|
42450
42451
|
return false;
|
|
@@ -42472,7 +42473,7 @@ function makeTheme(...themes) {
|
|
|
42472
42473
|
return deepMerge(...themesToMerge);
|
|
42473
42474
|
}
|
|
42474
42475
|
|
|
42475
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42476
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/use-prefix.js
|
|
42476
42477
|
function usePrefix({ status = "idle", theme }) {
|
|
42477
42478
|
const [showLoader, setShowLoader] = useState(false);
|
|
42478
42479
|
const [tick, setTick] = useState(0);
|
|
@@ -42502,7 +42503,7 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
42502
42503
|
const iconName = status === "loading" ? "idle" : status;
|
|
42503
42504
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
42504
42505
|
}
|
|
42505
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42506
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/use-memo.js
|
|
42506
42507
|
function useMemo(fn, dependencies) {
|
|
42507
42508
|
return withPointer((pointer) => {
|
|
42508
42509
|
const prev = pointer.get();
|
|
@@ -42514,11 +42515,11 @@ function useMemo(fn, dependencies) {
|
|
|
42514
42515
|
return prev.value;
|
|
42515
42516
|
});
|
|
42516
42517
|
}
|
|
42517
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42518
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/use-ref.js
|
|
42518
42519
|
function useRef(val) {
|
|
42519
42520
|
return useState({ current: val })[0];
|
|
42520
42521
|
}
|
|
42521
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42522
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/use-keypress.js
|
|
42522
42523
|
function useKeypress(userHandler) {
|
|
42523
42524
|
const signal = useRef(userHandler);
|
|
42524
42525
|
signal.current = userHandler;
|
|
@@ -42536,7 +42537,7 @@ function useKeypress(userHandler) {
|
|
|
42536
42537
|
};
|
|
42537
42538
|
}, []);
|
|
42538
42539
|
}
|
|
42539
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42540
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/utils.js
|
|
42540
42541
|
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
42541
42542
|
var import_wrap_ansi = __toESM(require_wrap_ansi(), 1);
|
|
42542
42543
|
function breakLines(content, width) {
|
|
@@ -42549,7 +42550,7 @@ function readlineWidth() {
|
|
|
42549
42550
|
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
42550
42551
|
}
|
|
42551
42552
|
|
|
42552
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42553
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/pagination/use-pagination.js
|
|
42553
42554
|
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
42554
42555
|
const state = useRef({
|
|
42555
42556
|
lastPointer: active,
|
|
@@ -42615,7 +42616,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
|
42615
42616
|
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
42616
42617
|
`);
|
|
42617
42618
|
}
|
|
42618
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42619
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
|
|
42619
42620
|
var import_mute_stream = __toESM(require_lib(), 1);
|
|
42620
42621
|
import * as readline2 from "node:readline";
|
|
42621
42622
|
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
@@ -42828,7 +42829,7 @@ var {
|
|
|
42828
42829
|
unload
|
|
42829
42830
|
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
42830
42831
|
|
|
42831
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42832
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/screen-manager.js
|
|
42832
42833
|
var import_ansi_escapes = __toESM(require_ansi_escapes(), 1);
|
|
42833
42834
|
import { stripVTControlCharacters } from "node:util";
|
|
42834
42835
|
var height = (content) => content.split(`
|
|
@@ -42898,7 +42899,7 @@ class ScreenManager {
|
|
|
42898
42899
|
}
|
|
42899
42900
|
}
|
|
42900
42901
|
|
|
42901
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42902
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/promise-polyfill.js
|
|
42902
42903
|
class PromisePolyfill extends Promise {
|
|
42903
42904
|
static withResolver() {
|
|
42904
42905
|
let resolve;
|
|
@@ -42911,7 +42912,7 @@ class PromisePolyfill extends Promise {
|
|
|
42911
42912
|
}
|
|
42912
42913
|
}
|
|
42913
42914
|
|
|
42914
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
42915
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/create-prompt.js
|
|
42915
42916
|
function getCallSites() {
|
|
42916
42917
|
const _prepareStackTrace = Error.prepareStackTrace;
|
|
42917
42918
|
let result = [];
|
|
@@ -42997,7 +42998,7 @@ function createPrompt(view) {
|
|
|
42997
42998
|
};
|
|
42998
42999
|
return prompt;
|
|
42999
43000
|
}
|
|
43000
|
-
// node_modules/.pnpm/@inquirer+core@10.1.
|
|
43001
|
+
// node_modules/.pnpm/@inquirer+core@10.1.15_@types+node@24.2.0/node_modules/@inquirer/core/dist/esm/lib/Separator.js
|
|
43001
43002
|
var import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
|
|
43002
43003
|
class Separator {
|
|
43003
43004
|
separator = import_yoctocolors_cjs2.default.dim(Array.from({ length: 15 }).join(esm_default.line));
|
|
@@ -43011,7 +43012,7 @@ class Separator {
|
|
|
43011
43012
|
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
43012
43013
|
}
|
|
43013
43014
|
}
|
|
43014
|
-
// node_modules/.pnpm/@inquirer+checkbox@4.
|
|
43015
|
+
// node_modules/.pnpm/@inquirer+checkbox@4.2.0_@types+node@24.2.0/node_modules/@inquirer/checkbox/dist/esm/index.js
|
|
43015
43016
|
var import_yoctocolors_cjs3 = __toESM(require_yoctocolors_cjs(), 1);
|
|
43016
43017
|
var import_ansi_escapes2 = __toESM(require_ansi_escapes(), 1);
|
|
43017
43018
|
var checkboxTheme = {
|
|
@@ -43118,9 +43119,16 @@ var esm_default2 = createPrompt((config, done) => {
|
|
|
43118
43119
|
} else if (key2.name === shortcuts.invert) {
|
|
43119
43120
|
setItems(items.map(toggle));
|
|
43120
43121
|
} else if (isNumberKey(key2)) {
|
|
43121
|
-
const
|
|
43122
|
-
|
|
43123
|
-
|
|
43122
|
+
const selectedIndex = Number(key2.name) - 1;
|
|
43123
|
+
let selectableIndex = -1;
|
|
43124
|
+
const position = items.findIndex((item) => {
|
|
43125
|
+
if (Separator.isSeparator(item))
|
|
43126
|
+
return false;
|
|
43127
|
+
selectableIndex++;
|
|
43128
|
+
return selectableIndex === selectedIndex;
|
|
43129
|
+
});
|
|
43130
|
+
const selectedItem = items[position];
|
|
43131
|
+
if (selectedItem && isSelectable(selectedItem)) {
|
|
43124
43132
|
setActive(position);
|
|
43125
43133
|
setItems(items.map((choice, i) => i === position ? toggle(choice) : choice));
|
|
43126
43134
|
}
|
|
@@ -43185,7 +43193,7 @@ ${theme.style.error(errorMsg)}`;
|
|
|
43185
43193
|
return `${prefix} ${message}${helpTipTop}
|
|
43186
43194
|
${page}${helpTipBottom}${choiceDescription}${error}${import_ansi_escapes2.default.cursorHide}`;
|
|
43187
43195
|
});
|
|
43188
|
-
// node_modules/.pnpm/@inquirer+editor@4.2.
|
|
43196
|
+
// node_modules/.pnpm/@inquirer+editor@4.2.15_@types+node@24.2.0/node_modules/@inquirer/editor/dist/esm/index.js
|
|
43189
43197
|
var import_external_editor = __toESM(require_main(), 1);
|
|
43190
43198
|
var editorTheme = {
|
|
43191
43199
|
validationFailureMode: "keep"
|
|
@@ -43253,7 +43261,7 @@ var esm_default3 = createPrompt((config, done) => {
|
|
|
43253
43261
|
}
|
|
43254
43262
|
return [[prefix, message, helpTip].filter(Boolean).join(" "), error];
|
|
43255
43263
|
});
|
|
43256
|
-
// node_modules/.pnpm/@inquirer+confirm@5.1.
|
|
43264
|
+
// node_modules/.pnpm/@inquirer+confirm@5.1.14_@types+node@24.2.0/node_modules/@inquirer/confirm/dist/esm/index.js
|
|
43257
43265
|
function getBooleanValue(value, defaultValue) {
|
|
43258
43266
|
let answer = defaultValue !== false;
|
|
43259
43267
|
if (/^(y|yes)/i.test(value))
|
|
@@ -43296,12 +43304,12 @@ var esm_default4 = createPrompt((config, done) => {
|
|
|
43296
43304
|
const message = theme.style.message(config.message, status);
|
|
43297
43305
|
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
43298
43306
|
});
|
|
43299
|
-
// node_modules/.pnpm/@inquirer+input@4.
|
|
43307
|
+
// node_modules/.pnpm/@inquirer+input@4.2.1_@types+node@24.2.0/node_modules/@inquirer/input/dist/esm/index.js
|
|
43300
43308
|
var inputTheme = {
|
|
43301
43309
|
validationFailureMode: "keep"
|
|
43302
43310
|
};
|
|
43303
43311
|
var esm_default5 = createPrompt((config, done) => {
|
|
43304
|
-
const { required, validate = () => true } = config;
|
|
43312
|
+
const { required, validate = () => true, prefill = "tab" } = config;
|
|
43305
43313
|
const theme = makeTheme(inputTheme, config.theme);
|
|
43306
43314
|
const [status, setStatus] = useState("idle");
|
|
43307
43315
|
const [defaultValue = "", setDefaultValue] = useState(config.default);
|
|
@@ -43341,6 +43349,12 @@ var esm_default5 = createPrompt((config, done) => {
|
|
|
43341
43349
|
setError(undefined);
|
|
43342
43350
|
}
|
|
43343
43351
|
});
|
|
43352
|
+
useEffect((rl) => {
|
|
43353
|
+
if (prefill === "editable" && defaultValue) {
|
|
43354
|
+
rl.write(defaultValue);
|
|
43355
|
+
setValue(defaultValue);
|
|
43356
|
+
}
|
|
43357
|
+
}, []);
|
|
43344
43358
|
const message = theme.style.message(config.message, status);
|
|
43345
43359
|
let formattedValue = value;
|
|
43346
43360
|
if (typeof config.transformer === "function") {
|
|
@@ -43361,7 +43375,7 @@ var esm_default5 = createPrompt((config, done) => {
|
|
|
43361
43375
|
error
|
|
43362
43376
|
];
|
|
43363
43377
|
});
|
|
43364
|
-
// node_modules/.pnpm/@inquirer+number@3.0.
|
|
43378
|
+
// node_modules/.pnpm/@inquirer+number@3.0.17_@types+node@24.2.0/node_modules/@inquirer/number/dist/esm/index.js
|
|
43365
43379
|
function isStepOf(value, step, min) {
|
|
43366
43380
|
const valuePow = value * Math.pow(10, 6);
|
|
43367
43381
|
const stepPow = step * Math.pow(10, 6);
|
|
@@ -43441,7 +43455,7 @@ var esm_default6 = createPrompt((config, done) => {
|
|
|
43441
43455
|
error
|
|
43442
43456
|
];
|
|
43443
43457
|
});
|
|
43444
|
-
// node_modules/.pnpm/@inquirer+expand@4.0.
|
|
43458
|
+
// node_modules/.pnpm/@inquirer+expand@4.0.17_@types+node@24.2.0/node_modules/@inquirer/expand/dist/esm/index.js
|
|
43445
43459
|
var import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
|
|
43446
43460
|
function normalizeChoices2(choices) {
|
|
43447
43461
|
return choices.map((choice) => {
|
|
@@ -43538,7 +43552,7 @@ var esm_default7 = createPrompt((config, done) => {
|
|
|
43538
43552
|
`)
|
|
43539
43553
|
];
|
|
43540
43554
|
});
|
|
43541
|
-
// node_modules/.pnpm/@inquirer+rawlist@4.1.
|
|
43555
|
+
// node_modules/.pnpm/@inquirer+rawlist@4.1.5_@types+node@24.2.0/node_modules/@inquirer/rawlist/dist/esm/index.js
|
|
43542
43556
|
var import_yoctocolors_cjs5 = __toESM(require_yoctocolors_cjs(), 1);
|
|
43543
43557
|
var numberRegex = /\d+/;
|
|
43544
43558
|
function isSelectableChoice(choice) {
|
|
@@ -43650,7 +43664,7 @@ var esm_default8 = createPrompt((config, done) => {
|
|
|
43650
43664
|
`)
|
|
43651
43665
|
];
|
|
43652
43666
|
});
|
|
43653
|
-
// node_modules/.pnpm/@inquirer+password@4.0.
|
|
43667
|
+
// node_modules/.pnpm/@inquirer+password@4.0.17_@types+node@24.2.0/node_modules/@inquirer/password/dist/esm/index.js
|
|
43654
43668
|
var import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
|
|
43655
43669
|
var esm_default9 = createPrompt((config, done) => {
|
|
43656
43670
|
const { validate = () => true } = config;
|
|
@@ -43699,7 +43713,7 @@ var esm_default9 = createPrompt((config, done) => {
|
|
|
43699
43713
|
}
|
|
43700
43714
|
return [[prefix, message, config.mask ? formattedValue : helpTip].join(" "), error];
|
|
43701
43715
|
});
|
|
43702
|
-
// node_modules/.pnpm/@inquirer+search@3.
|
|
43716
|
+
// node_modules/.pnpm/@inquirer+search@3.1.0_@types+node@24.2.0/node_modules/@inquirer/search/dist/esm/index.js
|
|
43703
43717
|
var import_yoctocolors_cjs6 = __toESM(require_yoctocolors_cjs(), 1);
|
|
43704
43718
|
var searchTheme = {
|
|
43705
43719
|
icon: { cursor: esm_default.pointer },
|
|
@@ -43823,8 +43837,8 @@ var esm_default10 = createPrompt((config, done) => {
|
|
|
43823
43837
|
let helpTip = "";
|
|
43824
43838
|
if (searchResults.length > 1 && (theme.helpMode === "always" || theme.helpMode === "auto" && firstRender.current)) {
|
|
43825
43839
|
helpTip = searchResults.length > pageSize ? `
|
|
43826
|
-
${theme.style.help("
|
|
43827
|
-
${theme.style.help("
|
|
43840
|
+
${theme.style.help(`(${config.instructions?.pager ?? "Use arrow keys to reveal more choices"})`)}` : `
|
|
43841
|
+
${theme.style.help(`(${config.instructions?.navigation ?? "Use arrow keys"})`)}`;
|
|
43828
43842
|
}
|
|
43829
43843
|
const page = usePagination({
|
|
43830
43844
|
items: searchResults,
|
|
@@ -43864,7 +43878,7 @@ ${theme.style.description(selectedChoice.description)}` : ``;
|
|
|
43864
43878
|
`${error ?? page}${helpTip}${choiceDescription}`
|
|
43865
43879
|
];
|
|
43866
43880
|
});
|
|
43867
|
-
// node_modules/.pnpm/@inquirer+select@4.
|
|
43881
|
+
// node_modules/.pnpm/@inquirer+select@4.3.1_@types+node@24.2.0/node_modules/@inquirer/select/dist/esm/index.js
|
|
43868
43882
|
var import_yoctocolors_cjs7 = __toESM(require_yoctocolors_cjs(), 1);
|
|
43869
43883
|
var import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
|
|
43870
43884
|
var selectTheme = {
|
|
@@ -43943,7 +43957,14 @@ var esm_default11 = createPrompt((config, done) => {
|
|
|
43943
43957
|
setActive(next);
|
|
43944
43958
|
}
|
|
43945
43959
|
} else if (isNumberKey(key2) && !Number.isNaN(Number(rl.line))) {
|
|
43946
|
-
const
|
|
43960
|
+
const selectedIndex = Number(rl.line) - 1;
|
|
43961
|
+
let selectableIndex = -1;
|
|
43962
|
+
const position = items.findIndex((item2) => {
|
|
43963
|
+
if (Separator.isSeparator(item2))
|
|
43964
|
+
return false;
|
|
43965
|
+
selectableIndex++;
|
|
43966
|
+
return selectableIndex === selectedIndex;
|
|
43967
|
+
});
|
|
43947
43968
|
const item = items[position];
|
|
43948
43969
|
if (item != null && isSelectable3(item)) {
|
|
43949
43970
|
setActive(position);
|
|
@@ -43983,14 +44004,16 @@ ${theme.style.help(`(${config.instructions?.pager ?? "Use arrow keys to reveal m
|
|
|
43983
44004
|
helpTipTop = theme.style.help(`(${config.instructions?.navigation ?? "Use arrow keys"})`);
|
|
43984
44005
|
}
|
|
43985
44006
|
}
|
|
44007
|
+
let separatorCount = 0;
|
|
43986
44008
|
const page = usePagination({
|
|
43987
44009
|
items,
|
|
43988
44010
|
active,
|
|
43989
44011
|
renderItem({ item, isActive, index }) {
|
|
43990
44012
|
if (Separator.isSeparator(item)) {
|
|
44013
|
+
separatorCount++;
|
|
43991
44014
|
return ` ${item.separator}`;
|
|
43992
44015
|
}
|
|
43993
|
-
const indexLabel = theme.indexMode === "number" ? `${index + 1}. ` : "";
|
|
44016
|
+
const indexLabel = theme.indexMode === "number" ? `${index + 1 - separatorCount}. ` : "";
|
|
43994
44017
|
if (item.disabled) {
|
|
43995
44018
|
const disabledLabel = typeof item.disabled === "string" ? item.disabled : "(disabled)";
|
|
43996
44019
|
return theme.style.disabled(`${indexLabel}${item.name} ${disabledLabel}`);
|
|
@@ -44010,7 +44033,7 @@ ${theme.style.description(selectedChoice.description)}` : ``;
|
|
|
44010
44033
|
return `${[prefix, message, helpTipTop].filter(Boolean).join(" ")}
|
|
44011
44034
|
${page}${helpTipBottom}${choiceDescription}${import_ansi_escapes4.default.cursorHide}`;
|
|
44012
44035
|
});
|
|
44013
|
-
// node_modules/.pnpm/inquirer@12.
|
|
44036
|
+
// node_modules/.pnpm/inquirer@12.9.0_@types+node@24.2.0/node_modules/inquirer/dist/esm/ui/prompt.js
|
|
44014
44037
|
var import_rxjs = __toESM(require_cjs(), 1);
|
|
44015
44038
|
var import_run_async = __toESM(require_run_async(), 1);
|
|
44016
44039
|
var import_mute_stream2 = __toESM(require_lib(), 1);
|
|
@@ -44222,7 +44245,7 @@ class PromptsRunner {
|
|
|
44222
44245
|
};
|
|
44223
44246
|
}
|
|
44224
44247
|
|
|
44225
|
-
// node_modules/.pnpm/inquirer@12.
|
|
44248
|
+
// node_modules/.pnpm/inquirer@12.9.0_@types+node@24.2.0/node_modules/inquirer/dist/esm/index.js
|
|
44226
44249
|
var builtInPrompts = {
|
|
44227
44250
|
input: esm_default5,
|
|
44228
44251
|
select: esm_default11,
|
|
@@ -44274,15 +44297,25 @@ var esm_default12 = inquirer;
|
|
|
44274
44297
|
// src/module/login/login-by-web.ts
|
|
44275
44298
|
var import_md5 = __toESM(require_md5(), 1);
|
|
44276
44299
|
|
|
44277
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
44278
|
-
var
|
|
44300
|
+
// node_modules/.pnpm/@kevisual+query@0.0.29_ws@8.18.0/node_modules/@kevisual/query/dist/query.js
|
|
44301
|
+
var isTextForContentType = (contentType) => {
|
|
44302
|
+
if (!contentType)
|
|
44303
|
+
return false;
|
|
44304
|
+
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded"];
|
|
44305
|
+
return textTypes.some((type) => contentType.includes(type));
|
|
44306
|
+
};
|
|
44307
|
+
var adapter = async (opts = {}, overloadOpts) => {
|
|
44279
44308
|
const controller = new AbortController;
|
|
44280
44309
|
const signal = controller.signal;
|
|
44310
|
+
const isBlob = opts.isBlob || false;
|
|
44311
|
+
const isText = opts.isText || false;
|
|
44312
|
+
const isPostFile = opts.isPostFile || false;
|
|
44281
44313
|
const timeout = opts.timeout || 60000 * 3;
|
|
44282
44314
|
const timer = setTimeout(() => {
|
|
44283
44315
|
controller.abort();
|
|
44284
44316
|
}, timeout);
|
|
44285
|
-
let method = overloadOpts?.method || opts
|
|
44317
|
+
let method = overloadOpts?.method || opts?.method || "POST";
|
|
44318
|
+
let headers = { ...opts?.headers, ...overloadOpts?.headers };
|
|
44286
44319
|
let origin = "";
|
|
44287
44320
|
let url;
|
|
44288
44321
|
if (opts?.url?.startsWith("http")) {
|
|
@@ -44295,21 +44328,40 @@ var adapter = async (opts, overloadOpts) => {
|
|
|
44295
44328
|
if (isGet) {
|
|
44296
44329
|
url.search = new URLSearchParams(opts.body).toString();
|
|
44297
44330
|
}
|
|
44331
|
+
let body = undefined;
|
|
44332
|
+
if (isGet) {
|
|
44333
|
+
body = undefined;
|
|
44334
|
+
} else if (isPostFile) {
|
|
44335
|
+
body = opts.body;
|
|
44336
|
+
} else {
|
|
44337
|
+
headers = {
|
|
44338
|
+
"Content-Type": "application/json",
|
|
44339
|
+
...headers
|
|
44340
|
+
};
|
|
44341
|
+
body = JSON.stringify(opts.body);
|
|
44342
|
+
}
|
|
44298
44343
|
return fetch(url, {
|
|
44299
44344
|
method: method.toUpperCase(),
|
|
44300
|
-
headers: {
|
|
44301
|
-
"Content-Type": "application/json",
|
|
44302
|
-
...opts.headers
|
|
44303
|
-
},
|
|
44304
44345
|
signal,
|
|
44346
|
+
body,
|
|
44305
44347
|
...overloadOpts,
|
|
44306
|
-
|
|
44307
|
-
}).then((response) => {
|
|
44348
|
+
headers
|
|
44349
|
+
}).then(async (response) => {
|
|
44308
44350
|
const contentType = response.headers.get("Content-Type");
|
|
44309
|
-
if (
|
|
44310
|
-
return response.
|
|
44351
|
+
if (isBlob) {
|
|
44352
|
+
return await response.blob();
|
|
44353
|
+
}
|
|
44354
|
+
const isJson = contentType && contentType.includes("application/json");
|
|
44355
|
+
if (isJson && !isText) {
|
|
44356
|
+
return await response.json();
|
|
44357
|
+
} else if (isTextForContentType(contentType)) {
|
|
44358
|
+
return {
|
|
44359
|
+
code: 200,
|
|
44360
|
+
status: response.status,
|
|
44361
|
+
data: await response.text()
|
|
44362
|
+
};
|
|
44311
44363
|
} else {
|
|
44312
|
-
return response
|
|
44364
|
+
return response;
|
|
44313
44365
|
}
|
|
44314
44366
|
}).catch((err) => {
|
|
44315
44367
|
if (err.name === "AbortError") {
|
|
@@ -44330,6 +44382,7 @@ var setBaseResponse = (res) => {
|
|
|
44330
44382
|
fn?.();
|
|
44331
44383
|
}
|
|
44332
44384
|
};
|
|
44385
|
+
return res;
|
|
44333
44386
|
};
|
|
44334
44387
|
var wrapperError = ({ code, message }) => {
|
|
44335
44388
|
const result = {
|
|
@@ -44401,7 +44454,7 @@ class Query {
|
|
|
44401
44454
|
message: "api request beforeFn error"
|
|
44402
44455
|
});
|
|
44403
44456
|
}
|
|
44404
|
-
if (this.stop) {
|
|
44457
|
+
if (this.stop && !options?.noStop) {
|
|
44405
44458
|
const that = this;
|
|
44406
44459
|
await new Promise((resolve) => {
|
|
44407
44460
|
let timer = 0;
|
|
@@ -44443,17 +44496,45 @@ class Query {
|
|
|
44443
44496
|
after(fn) {
|
|
44444
44497
|
this.afterResponse = fn;
|
|
44445
44498
|
}
|
|
44499
|
+
async fetchText(urlOrOptions, options) {
|
|
44500
|
+
let _options = { ...options };
|
|
44501
|
+
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
44502
|
+
_options.url = urlOrOptions;
|
|
44503
|
+
}
|
|
44504
|
+
if (typeof urlOrOptions === "object") {
|
|
44505
|
+
_options = { ...urlOrOptions, ..._options };
|
|
44506
|
+
}
|
|
44507
|
+
const res = await adapter({
|
|
44508
|
+
method: "GET",
|
|
44509
|
+
..._options,
|
|
44510
|
+
headers: {
|
|
44511
|
+
...this.headers,
|
|
44512
|
+
..._options?.headers || {}
|
|
44513
|
+
}
|
|
44514
|
+
});
|
|
44515
|
+
return setBaseResponse(res);
|
|
44516
|
+
}
|
|
44446
44517
|
}
|
|
44447
44518
|
|
|
44448
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
44449
|
-
var
|
|
44519
|
+
// node_modules/.pnpm/@kevisual+query@0.0.29_ws@8.18.0/node_modules/@kevisual/query/dist/query-browser.js
|
|
44520
|
+
var isTextForContentType2 = (contentType) => {
|
|
44521
|
+
if (!contentType)
|
|
44522
|
+
return false;
|
|
44523
|
+
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded"];
|
|
44524
|
+
return textTypes.some((type) => contentType.includes(type));
|
|
44525
|
+
};
|
|
44526
|
+
var adapter2 = async (opts = {}, overloadOpts) => {
|
|
44450
44527
|
const controller = new AbortController;
|
|
44451
44528
|
const signal = controller.signal;
|
|
44529
|
+
const isBlob = opts.isBlob || false;
|
|
44530
|
+
const isText = opts.isText || false;
|
|
44531
|
+
const isPostFile = opts.isPostFile || false;
|
|
44452
44532
|
const timeout = opts.timeout || 60000 * 3;
|
|
44453
44533
|
const timer = setTimeout(() => {
|
|
44454
44534
|
controller.abort();
|
|
44455
44535
|
}, timeout);
|
|
44456
|
-
let method = overloadOpts?.method || opts
|
|
44536
|
+
let method = overloadOpts?.method || opts?.method || "POST";
|
|
44537
|
+
let headers = { ...opts?.headers, ...overloadOpts?.headers };
|
|
44457
44538
|
let origin = "";
|
|
44458
44539
|
let url;
|
|
44459
44540
|
if (opts?.url?.startsWith("http")) {
|
|
@@ -44466,21 +44547,40 @@ var adapter2 = async (opts, overloadOpts) => {
|
|
|
44466
44547
|
if (isGet) {
|
|
44467
44548
|
url.search = new URLSearchParams(opts.body).toString();
|
|
44468
44549
|
}
|
|
44550
|
+
let body = undefined;
|
|
44551
|
+
if (isGet) {
|
|
44552
|
+
body = undefined;
|
|
44553
|
+
} else if (isPostFile) {
|
|
44554
|
+
body = opts.body;
|
|
44555
|
+
} else {
|
|
44556
|
+
headers = {
|
|
44557
|
+
"Content-Type": "application/json",
|
|
44558
|
+
...headers
|
|
44559
|
+
};
|
|
44560
|
+
body = JSON.stringify(opts.body);
|
|
44561
|
+
}
|
|
44469
44562
|
return fetch(url, {
|
|
44470
44563
|
method: method.toUpperCase(),
|
|
44471
|
-
headers: {
|
|
44472
|
-
"Content-Type": "application/json",
|
|
44473
|
-
...opts.headers
|
|
44474
|
-
},
|
|
44475
44564
|
signal,
|
|
44565
|
+
body,
|
|
44476
44566
|
...overloadOpts,
|
|
44477
|
-
|
|
44478
|
-
}).then((response) => {
|
|
44567
|
+
headers
|
|
44568
|
+
}).then(async (response) => {
|
|
44479
44569
|
const contentType = response.headers.get("Content-Type");
|
|
44480
|
-
if (
|
|
44481
|
-
return response.
|
|
44570
|
+
if (isBlob) {
|
|
44571
|
+
return await response.blob();
|
|
44572
|
+
}
|
|
44573
|
+
const isJson = contentType && contentType.includes("application/json");
|
|
44574
|
+
if (isJson && !isText) {
|
|
44575
|
+
return await response.json();
|
|
44576
|
+
} else if (isTextForContentType2(contentType)) {
|
|
44577
|
+
return {
|
|
44578
|
+
code: 200,
|
|
44579
|
+
status: response.status,
|
|
44580
|
+
data: await response.text()
|
|
44581
|
+
};
|
|
44482
44582
|
} else {
|
|
44483
|
-
return response
|
|
44583
|
+
return response;
|
|
44484
44584
|
}
|
|
44485
44585
|
}).catch((err) => {
|
|
44486
44586
|
if (err.name === "AbortError") {
|
|
@@ -44501,6 +44601,7 @@ var setBaseResponse2 = (res) => {
|
|
|
44501
44601
|
fn?.();
|
|
44502
44602
|
}
|
|
44503
44603
|
};
|
|
44604
|
+
return res;
|
|
44504
44605
|
};
|
|
44505
44606
|
var wrapperError2 = ({ code, message }) => {
|
|
44506
44607
|
const result = {
|
|
@@ -44572,7 +44673,7 @@ class Query2 {
|
|
|
44572
44673
|
message: "api request beforeFn error"
|
|
44573
44674
|
});
|
|
44574
44675
|
}
|
|
44575
|
-
if (this.stop) {
|
|
44676
|
+
if (this.stop && !options?.noStop) {
|
|
44576
44677
|
const that = this;
|
|
44577
44678
|
await new Promise((resolve) => {
|
|
44578
44679
|
let timer = 0;
|
|
@@ -44614,6 +44715,24 @@ class Query2 {
|
|
|
44614
44715
|
after(fn) {
|
|
44615
44716
|
this.afterResponse = fn;
|
|
44616
44717
|
}
|
|
44718
|
+
async fetchText(urlOrOptions, options) {
|
|
44719
|
+
let _options = { ...options };
|
|
44720
|
+
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
44721
|
+
_options.url = urlOrOptions;
|
|
44722
|
+
}
|
|
44723
|
+
if (typeof urlOrOptions === "object") {
|
|
44724
|
+
_options = { ...urlOrOptions, ..._options };
|
|
44725
|
+
}
|
|
44726
|
+
const res = await adapter2({
|
|
44727
|
+
method: "GET",
|
|
44728
|
+
..._options,
|
|
44729
|
+
headers: {
|
|
44730
|
+
...this.headers,
|
|
44731
|
+
..._options?.headers || {}
|
|
44732
|
+
}
|
|
44733
|
+
});
|
|
44734
|
+
return setBaseResponse2(res);
|
|
44735
|
+
}
|
|
44617
44736
|
}
|
|
44618
44737
|
|
|
44619
44738
|
class BaseQuery {
|
|
@@ -44641,7 +44760,7 @@ class BaseQuery {
|
|
|
44641
44760
|
}
|
|
44642
44761
|
}
|
|
44643
44762
|
|
|
44644
|
-
// node_modules/.pnpm/@kevisual+query-login@0.0.6_@kevisual+query@0.0.
|
|
44763
|
+
// node_modules/.pnpm/@kevisual+query-login@0.0.6_@kevisual+query@0.0.29_ws@8.18.0__rollup@4.43.0_tslib@2.8.1_typescript@5.8.2/node_modules/@kevisual/query-login/dist/query-login-node.js
|
|
44645
44764
|
import { homedir } from "node:os";
|
|
44646
44765
|
import { join, dirname } from "node:path";
|
|
44647
44766
|
import fs3 from "node:fs";
|
|
@@ -45196,7 +45315,7 @@ var getUrl = (url) => {
|
|
|
45196
45315
|
return new URL("/api/router", url).href;
|
|
45197
45316
|
};
|
|
45198
45317
|
|
|
45199
|
-
// node_modules/.pnpm/chalk@5.
|
|
45318
|
+
// node_modules/.pnpm/chalk@5.5.0/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
45200
45319
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
45201
45320
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
45202
45321
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
@@ -45373,7 +45492,7 @@ function assembleStyles() {
|
|
|
45373
45492
|
var ansiStyles = assembleStyles();
|
|
45374
45493
|
var ansi_styles_default = ansiStyles;
|
|
45375
45494
|
|
|
45376
|
-
// node_modules/.pnpm/chalk@5.
|
|
45495
|
+
// node_modules/.pnpm/chalk@5.5.0/node_modules/chalk/source/vendor/supports-color/index.js
|
|
45377
45496
|
import process4 from "node:process";
|
|
45378
45497
|
import os2 from "node:os";
|
|
45379
45498
|
import tty from "node:tty";
|
|
@@ -45464,6 +45583,9 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
|
45464
45583
|
if (env.TERM === "xterm-kitty") {
|
|
45465
45584
|
return 3;
|
|
45466
45585
|
}
|
|
45586
|
+
if (env.TERM === "xterm-ghostty") {
|
|
45587
|
+
return 3;
|
|
45588
|
+
}
|
|
45467
45589
|
if ("TERM_PROGRAM" in env) {
|
|
45468
45590
|
const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
45469
45591
|
switch (env.TERM_PROGRAM) {
|
|
@@ -45499,7 +45621,7 @@ var supportsColor = {
|
|
|
45499
45621
|
};
|
|
45500
45622
|
var supports_color_default = supportsColor;
|
|
45501
45623
|
|
|
45502
|
-
// node_modules/.pnpm/chalk@5.
|
|
45624
|
+
// node_modules/.pnpm/chalk@5.5.0/node_modules/chalk/source/utilities.js
|
|
45503
45625
|
function stringReplaceAll(string, substring, replacer) {
|
|
45504
45626
|
let index = string.indexOf(substring);
|
|
45505
45627
|
if (index === -1) {
|
|
@@ -45532,7 +45654,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
|
45532
45654
|
return returnValue;
|
|
45533
45655
|
}
|
|
45534
45656
|
|
|
45535
|
-
// node_modules/.pnpm/chalk@5.
|
|
45657
|
+
// node_modules/.pnpm/chalk@5.5.0/node_modules/chalk/source/index.js
|
|
45536
45658
|
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
45537
45659
|
var GENERATOR = Symbol("GENERATOR");
|
|
45538
45660
|
var STYLER = Symbol("STYLER");
|
|
@@ -46488,7 +46610,7 @@ baseURL2.addCommand(kv);
|
|
|
46488
46610
|
|
|
46489
46611
|
// src/command/deploy.ts
|
|
46490
46612
|
var import_fast_glob2 = __toESM(require_out4(), 1);
|
|
46491
|
-
var
|
|
46613
|
+
var import_form_data = __toESM(require_form_data(), 1);
|
|
46492
46614
|
import path10 from "path";
|
|
46493
46615
|
import fs17 from "fs";
|
|
46494
46616
|
|
|
@@ -52750,8 +52872,25 @@ var getBufferHash = (buffer) => {
|
|
|
52750
52872
|
return import_md52.default(buffer.toString()).toString();
|
|
52751
52873
|
};
|
|
52752
52874
|
|
|
52753
|
-
// src/
|
|
52754
|
-
var
|
|
52875
|
+
// src/query/app-manager/query-app.ts
|
|
52876
|
+
var queryApp = async (params, opts) => {
|
|
52877
|
+
return await query.post({
|
|
52878
|
+
path: "app",
|
|
52879
|
+
key: "getApp",
|
|
52880
|
+
data: {
|
|
52881
|
+
...params
|
|
52882
|
+
}
|
|
52883
|
+
}, opts);
|
|
52884
|
+
};
|
|
52885
|
+
var queryAppVersion = async (params, opts) => {
|
|
52886
|
+
return await query.post({
|
|
52887
|
+
path: "app",
|
|
52888
|
+
key: "get",
|
|
52889
|
+
data: {
|
|
52890
|
+
...params
|
|
52891
|
+
}
|
|
52892
|
+
}, opts);
|
|
52893
|
+
};
|
|
52755
52894
|
|
|
52756
52895
|
// node_modules/.pnpm/@kevisual+logger@0.0.4/node_modules/@kevisual/logger/dist/logger-node.mjs
|
|
52757
52896
|
import process5 from "node:process";
|
|
@@ -53367,97 +53506,8 @@ var logger = new Logger2({
|
|
|
53367
53506
|
level
|
|
53368
53507
|
});
|
|
53369
53508
|
|
|
53370
|
-
// src/module/download/upload.ts
|
|
53371
|
-
var handleResponse = async (err, res) => {
|
|
53372
|
-
return new Promise((resolve2) => {
|
|
53373
|
-
if (err) {
|
|
53374
|
-
console.error("Upload failed:", err);
|
|
53375
|
-
resolve2({ code: 500, message: err });
|
|
53376
|
-
return;
|
|
53377
|
-
}
|
|
53378
|
-
let body = "";
|
|
53379
|
-
res.on("data", (chunk) => {
|
|
53380
|
-
body += chunk;
|
|
53381
|
-
});
|
|
53382
|
-
res.on("end", () => {
|
|
53383
|
-
try {
|
|
53384
|
-
const res2 = JSON.parse(body);
|
|
53385
|
-
resolve2(res2);
|
|
53386
|
-
} catch (e) {
|
|
53387
|
-
resolve2({ code: 500, message: body });
|
|
53388
|
-
}
|
|
53389
|
-
});
|
|
53390
|
-
});
|
|
53391
|
-
};
|
|
53392
|
-
var getFormParams = (opts, headers) => {
|
|
53393
|
-
const url = new URL(opts.url);
|
|
53394
|
-
if (opts.token) {}
|
|
53395
|
-
if (opts.meta) {
|
|
53396
|
-
url.searchParams.append("meta", encodeURIComponent(JSON.stringify(opts.meta)));
|
|
53397
|
-
}
|
|
53398
|
-
const value = {
|
|
53399
|
-
path: url.pathname + url.search,
|
|
53400
|
-
host: url.hostname,
|
|
53401
|
-
method: "POST",
|
|
53402
|
-
protocol: url.protocol === "https:" ? "https:" : "http:",
|
|
53403
|
-
port: url.port || (url.protocol === "https:" ? 443 : 80),
|
|
53404
|
-
headers: {
|
|
53405
|
-
Authorization: "Bearer " + opts.token,
|
|
53406
|
-
...headers
|
|
53407
|
-
}
|
|
53408
|
-
};
|
|
53409
|
-
logger.debug("getFormParams", value);
|
|
53410
|
-
return value;
|
|
53411
|
-
};
|
|
53412
|
-
var upload = (opts) => {
|
|
53413
|
-
const form = opts?.form || new import_form_data.default;
|
|
53414
|
-
if (!opts.form) {
|
|
53415
|
-
let hash = "";
|
|
53416
|
-
let value;
|
|
53417
|
-
let type = "string";
|
|
53418
|
-
if (typeof opts.file === "string") {
|
|
53419
|
-
value = Buffer.from(opts.file);
|
|
53420
|
-
} else {
|
|
53421
|
-
type = "buffer";
|
|
53422
|
-
value = opts.file;
|
|
53423
|
-
}
|
|
53424
|
-
form.append("file", value);
|
|
53425
|
-
if (opts.needHash) {
|
|
53426
|
-
hash = opts?.hash || getBufferHash(value);
|
|
53427
|
-
opts.url = new URL(opts.url.toString());
|
|
53428
|
-
opts.url.searchParams.append("hash", hash);
|
|
53429
|
-
}
|
|
53430
|
-
}
|
|
53431
|
-
const headers = form.getHeaders();
|
|
53432
|
-
return new Promise((resolve2) => {
|
|
53433
|
-
form.submit(getFormParams(opts, headers), (err, res) => {
|
|
53434
|
-
handleResponse(err, res).then(resolve2);
|
|
53435
|
-
});
|
|
53436
|
-
});
|
|
53437
|
-
};
|
|
53438
|
-
|
|
53439
|
-
// src/query/app-manager/query-app.ts
|
|
53440
|
-
var queryApp = async (params, opts) => {
|
|
53441
|
-
return await query.post({
|
|
53442
|
-
path: "app",
|
|
53443
|
-
key: "getApp",
|
|
53444
|
-
data: {
|
|
53445
|
-
...params
|
|
53446
|
-
}
|
|
53447
|
-
}, opts);
|
|
53448
|
-
};
|
|
53449
|
-
var queryAppVersion = async (params, opts) => {
|
|
53450
|
-
return await query.post({
|
|
53451
|
-
path: "app",
|
|
53452
|
-
key: "get",
|
|
53453
|
-
data: {
|
|
53454
|
-
...params
|
|
53455
|
-
}
|
|
53456
|
-
}, opts);
|
|
53457
|
-
};
|
|
53458
|
-
|
|
53459
53509
|
// src/command/deploy.ts
|
|
53460
|
-
var getPackageJson = () => {
|
|
53510
|
+
var getPackageJson = (opts) => {
|
|
53461
53511
|
const filePath = path10.join(process.cwd(), "package.json");
|
|
53462
53512
|
if (!fs17.existsSync(filePath)) {
|
|
53463
53513
|
return null;
|
|
@@ -53468,12 +53518,12 @@ var getPackageJson = () => {
|
|
|
53468
53518
|
const version3 = packageJson.version || "";
|
|
53469
53519
|
const app = packageJson.app;
|
|
53470
53520
|
const userAppArry = basename2.split("/");
|
|
53471
|
-
if (userAppArry.length <= 2) {
|
|
53521
|
+
if (userAppArry.length <= 2 && !opts?.appKey) {
|
|
53472
53522
|
console.error(source_default.red("basename is error, 请输入正确的路径, packages.json中basename例如 /root/appKey"));
|
|
53473
53523
|
return null;
|
|
53474
53524
|
}
|
|
53475
53525
|
const [user, appKey] = userAppArry;
|
|
53476
|
-
return { basename: basename2, version: version3, pkg: packageJson, user, appKey, app };
|
|
53526
|
+
return { basename: basename2, version: version3, pkg: packageJson, user, appKey: appKey || opts?.appKey, app };
|
|
53477
53527
|
} catch (error) {
|
|
53478
53528
|
return null;
|
|
53479
53529
|
}
|
|
@@ -53483,7 +53533,7 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
|
|
|
53483
53533
|
let { version: version3, key: key2, yes, update: update3, org, showBackend } = options;
|
|
53484
53534
|
const noCheck = !options.noCheck;
|
|
53485
53535
|
const dot = !!options.dot;
|
|
53486
|
-
const pkgInfo = getPackageJson();
|
|
53536
|
+
const pkgInfo = getPackageJson({ version: version3, appKey: key2 });
|
|
53487
53537
|
if (!version3 && pkgInfo?.version) {
|
|
53488
53538
|
version3 = pkgInfo?.version || "";
|
|
53489
53539
|
}
|
|
@@ -53516,9 +53566,21 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
|
|
|
53516
53566
|
let isDirectory = false;
|
|
53517
53567
|
if (stat2.isDirectory()) {
|
|
53518
53568
|
isDirectory = true;
|
|
53519
|
-
const
|
|
53520
|
-
|
|
53521
|
-
|
|
53569
|
+
const files = await import_fast_glob2.default("**/*", {
|
|
53570
|
+
cwd: directory,
|
|
53571
|
+
ignore: ["node_modules/**/*", ".git/**/*", ".DS_Store"],
|
|
53572
|
+
onlyFiles: true,
|
|
53573
|
+
dot,
|
|
53574
|
+
absolute: true
|
|
53575
|
+
});
|
|
53576
|
+
console.log("files", files);
|
|
53577
|
+
const normalizeFilePath = (filePath2) => {
|
|
53578
|
+
return filePath2.split(path10.sep).join("/");
|
|
53579
|
+
};
|
|
53580
|
+
_relativeFiles = files.map((file) => {
|
|
53581
|
+
const relativePath = path10.relative(directory, file);
|
|
53582
|
+
return normalizeFilePath(relativePath);
|
|
53583
|
+
});
|
|
53522
53584
|
} else if (stat2.isFile()) {
|
|
53523
53585
|
const filename = path10.basename(directory);
|
|
53524
53586
|
_relativeFiles = [filename];
|
|
@@ -53587,11 +53649,15 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
|
|
|
53587
53649
|
});
|
|
53588
53650
|
var uploadFiles = async (files, directory, opts) => {
|
|
53589
53651
|
const { key: key2, version: version3, username } = opts || {};
|
|
53590
|
-
const form = new
|
|
53652
|
+
const form = new import_form_data.default;
|
|
53591
53653
|
const data = { files: [] };
|
|
53592
53654
|
for (const file of files) {
|
|
53593
53655
|
const filePath = path10.join(directory, file);
|
|
53594
53656
|
const hash = getHash(filePath);
|
|
53657
|
+
if (!hash) {
|
|
53658
|
+
console.error("文件", filePath, "不存在");
|
|
53659
|
+
console.error("请检查文件是否存在");
|
|
53660
|
+
}
|
|
53595
53661
|
data.files.push({ path: file, hash });
|
|
53596
53662
|
}
|
|
53597
53663
|
data.appKey = key2;
|
|
@@ -53608,7 +53674,7 @@ var uploadFiles = async (files, directory, opts) => {
|
|
|
53608
53674
|
}
|
|
53609
53675
|
const token2 = await storage.getItem("token");
|
|
53610
53676
|
const checkUrl = new URL("/api/s1/resources/upload/check", getBaseURL());
|
|
53611
|
-
const res = await query.adapter({ url: checkUrl.toString(), method: "POST", body: data, headers: { Authorization: "Bearer " + token2
|
|
53677
|
+
const res = await query.adapter({ url: checkUrl.toString(), method: "POST", body: data, headers: { Authorization: "Bearer " + token2 } }).then((res2) => {
|
|
53612
53678
|
try {
|
|
53613
53679
|
if (typeof res2 === "string") {
|
|
53614
53680
|
return JSON.parse(res2);
|
|
@@ -53624,6 +53690,7 @@ var uploadFiles = async (files, directory, opts) => {
|
|
|
53624
53690
|
console.error("check failed", res);
|
|
53625
53691
|
return res;
|
|
53626
53692
|
}
|
|
53693
|
+
console.log("res", res);
|
|
53627
53694
|
let needUpload = false;
|
|
53628
53695
|
for (const file of files) {
|
|
53629
53696
|
const filePath = path10.join(directory, file);
|
|
@@ -53651,7 +53718,7 @@ var uploadFiles = async (files, directory, opts) => {
|
|
|
53651
53718
|
if (opts.noCheckAppFiles) {
|
|
53652
53719
|
url.searchParams.append("noCheckAppFiles", "true");
|
|
53653
53720
|
}
|
|
53654
|
-
return
|
|
53721
|
+
return { code: 200 };
|
|
53655
53722
|
};
|
|
53656
53723
|
program.addCommand(command2);
|
|
53657
53724
|
var deployLoadFn2 = async (id, org) => {
|
|
@@ -54819,6 +54886,78 @@ var fetchAiList = async (url, opts) => {
|
|
|
54819
54886
|
|
|
54820
54887
|
// src/command/sync/sync.ts
|
|
54821
54888
|
import fs23 from "node:fs";
|
|
54889
|
+
|
|
54890
|
+
// src/module/download/upload.ts
|
|
54891
|
+
var import_form_data2 = __toESM(require_form_data(), 1);
|
|
54892
|
+
var handleResponse = async (err, res) => {
|
|
54893
|
+
return new Promise((resolve2) => {
|
|
54894
|
+
if (err) {
|
|
54895
|
+
console.error("Upload failed:", err);
|
|
54896
|
+
resolve2({ code: 500, message: err });
|
|
54897
|
+
return;
|
|
54898
|
+
}
|
|
54899
|
+
let body = "";
|
|
54900
|
+
res.on("data", (chunk) => {
|
|
54901
|
+
body += chunk;
|
|
54902
|
+
});
|
|
54903
|
+
res.on("end", () => {
|
|
54904
|
+
try {
|
|
54905
|
+
const res2 = JSON.parse(body);
|
|
54906
|
+
resolve2(res2);
|
|
54907
|
+
} catch (e) {
|
|
54908
|
+
resolve2({ code: 500, message: body });
|
|
54909
|
+
}
|
|
54910
|
+
});
|
|
54911
|
+
});
|
|
54912
|
+
};
|
|
54913
|
+
var getFormParams = (opts, headers) => {
|
|
54914
|
+
const url = new URL(opts.url);
|
|
54915
|
+
if (opts.token) {}
|
|
54916
|
+
if (opts.meta) {
|
|
54917
|
+
url.searchParams.append("meta", encodeURIComponent(JSON.stringify(opts.meta)));
|
|
54918
|
+
}
|
|
54919
|
+
const value = {
|
|
54920
|
+
path: url.pathname + url.search,
|
|
54921
|
+
host: url.hostname,
|
|
54922
|
+
method: "POST",
|
|
54923
|
+
protocol: url.protocol === "https:" ? "https:" : "http:",
|
|
54924
|
+
port: url.port || (url.protocol === "https:" ? 443 : 80),
|
|
54925
|
+
headers: {
|
|
54926
|
+
Authorization: "Bearer " + opts.token,
|
|
54927
|
+
...headers
|
|
54928
|
+
}
|
|
54929
|
+
};
|
|
54930
|
+
logger.debug("getFormParams", value);
|
|
54931
|
+
return value;
|
|
54932
|
+
};
|
|
54933
|
+
var upload = (opts) => {
|
|
54934
|
+
const form = opts?.form || new import_form_data2.default;
|
|
54935
|
+
if (!opts.form) {
|
|
54936
|
+
let hash = "";
|
|
54937
|
+
let value;
|
|
54938
|
+
let type = "string";
|
|
54939
|
+
if (typeof opts.file === "string") {
|
|
54940
|
+
value = Buffer.from(opts.file);
|
|
54941
|
+
} else {
|
|
54942
|
+
type = "buffer";
|
|
54943
|
+
value = opts.file;
|
|
54944
|
+
}
|
|
54945
|
+
form.append("file", value);
|
|
54946
|
+
if (opts.needHash) {
|
|
54947
|
+
hash = opts?.hash || getBufferHash(value);
|
|
54948
|
+
opts.url = new URL(opts.url.toString());
|
|
54949
|
+
opts.url.searchParams.append("hash", hash);
|
|
54950
|
+
}
|
|
54951
|
+
}
|
|
54952
|
+
const headers = form.getHeaders();
|
|
54953
|
+
return new Promise((resolve2) => {
|
|
54954
|
+
form.submit(getFormParams(opts, headers), (err, res) => {
|
|
54955
|
+
handleResponse(err, res).then(resolve2);
|
|
54956
|
+
});
|
|
54957
|
+
});
|
|
54958
|
+
};
|
|
54959
|
+
|
|
54960
|
+
// src/command/sync/sync.ts
|
|
54822
54961
|
import path16 from "node:path";
|
|
54823
54962
|
var command8 = new Command("sync").option("-d --dir <dir>").description("同步项目").action(() => {
|
|
54824
54963
|
console.log("同步项目");
|