democut 1.0.62 → 1.0.64
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/dist/cli.js +46 -20
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6916,7 +6916,7 @@ import { realpathSync } from "fs";
|
|
|
6916
6916
|
import { fileURLToPath } from "url";
|
|
6917
6917
|
|
|
6918
6918
|
// src/version.ts
|
|
6919
|
-
var VERSION = "1.0.
|
|
6919
|
+
var VERSION = "1.0.64";
|
|
6920
6920
|
|
|
6921
6921
|
// src/device-flow.ts
|
|
6922
6922
|
var DeviceFlowError = class extends Error {
|
|
@@ -7306,13 +7306,14 @@ function parseDetail(status, body) {
|
|
|
7306
7306
|
const loc = e.loc;
|
|
7307
7307
|
return Array.isArray(loc) ? String(loc[loc.length - 1]) : "";
|
|
7308
7308
|
}).filter(Boolean);
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
"
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
unknownFields.length ? { unknownFields } : {}
|
|
7315
|
-
|
|
7309
|
+
const missingFields = detail.filter((e) => e.type === "missing").map((e) => {
|
|
7310
|
+
const loc = e.loc;
|
|
7311
|
+
return Array.isArray(loc) ? loc.filter((x) => x !== "body").join(".") : "";
|
|
7312
|
+
}).filter(Boolean);
|
|
7313
|
+
return new ApiError(status, "VALIDATION_ERROR", lines.join("\n"), true, {
|
|
7314
|
+
...unknownFields.length ? { unknownFields } : {},
|
|
7315
|
+
...missingFields.length ? { missingFields } : {}
|
|
7316
|
+
});
|
|
7316
7317
|
}
|
|
7317
7318
|
return new ApiError(status, `HTTP_${status}`, `\uC694\uCCAD\uC774 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4 (HTTP ${status}).`, null);
|
|
7318
7319
|
}
|
|
@@ -12986,6 +12987,9 @@ function callableStructured(value) {
|
|
|
12986
12987
|
}
|
|
12987
12988
|
return value;
|
|
12988
12989
|
}
|
|
12990
|
+
function asFields(v) {
|
|
12991
|
+
return Array.isArray(v) ? v.filter((x) => typeof x === "string" && x.length > 0) : [];
|
|
12992
|
+
}
|
|
12989
12993
|
function usd(v) {
|
|
12990
12994
|
return v < 0.01 ? `$${v.toFixed(4)}` : `$${v.toFixed(2)}`;
|
|
12991
12995
|
}
|
|
@@ -13049,16 +13053,19 @@ function classifyApiError(e, ctx) {
|
|
|
13049
13053
|
return { safety: "fixable", notCharged: true, lines };
|
|
13050
13054
|
}
|
|
13051
13055
|
if (e.status === 422) {
|
|
13052
|
-
const unknown2 = e.extra.unknownFields;
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
lines:
|
|
13058
|
-
|
|
13059
|
-
|
|
13060
|
-
|
|
13061
|
-
|
|
13056
|
+
const unknown2 = asFields(e.extra.unknownFields);
|
|
13057
|
+
const missing = asFields(e.extra.missingFields);
|
|
13058
|
+
if (unknown2.length || missing.length) {
|
|
13059
|
+
const lines = [];
|
|
13060
|
+
if (unknown2.length) {
|
|
13061
|
+
lines.push(`\uC11C\uBC84\uAC00 \uC544\uC9C1 \uBAA8\uB974\uB294 \uC778\uC790\uC785\uB2C8\uB2E4: ${unknown2.join(", ")} \u2014 \uBC30\uD3EC\uAC00 \uACB9\uCE58\uB294 \uC911\uC77C \uC218 \uC788\uC2B5\uB2C8\uB2E4.`);
|
|
13062
|
+
lines.push("\uADF8 \uC778\uC790\uB9CC \uBE7C\uACE0 \uB098\uBA38\uC9C0\uB294 \uADF8\uB300\uB85C \uB2E4\uC2DC \uBCF4\uB0B4\uC138\uC694.");
|
|
13063
|
+
}
|
|
13064
|
+
if (missing.length) {
|
|
13065
|
+
lines.push(`\uBE60\uC9C4 \uC778\uC790\uC785\uB2C8\uB2E4: ${missing.join(", ")} \u2014 \uADF8 \uAC12\uC744 \uC2E4\uC5B4 \uB2E4\uC2DC \uBCF4\uB0B4\uC138\uC694.`);
|
|
13066
|
+
}
|
|
13067
|
+
lines.push("\uC544\uC9C1 \uACFC\uAE08\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.");
|
|
13068
|
+
return { safety: "fixable", notCharged: true, lines };
|
|
13062
13069
|
}
|
|
13063
13070
|
return {
|
|
13064
13071
|
safety: "fixable",
|
|
@@ -24885,15 +24892,34 @@ var invokedDirectly = (() => {
|
|
|
24885
24892
|
return false;
|
|
24886
24893
|
}
|
|
24887
24894
|
})();
|
|
24895
|
+
var writtenOrReaderLeft = (e) => !e || e.code === "EPIPE";
|
|
24896
|
+
function flushed(stream) {
|
|
24897
|
+
return new Promise((resolve2) => {
|
|
24898
|
+
if (stream.errored) return resolve2(writtenOrReaderLeft(stream.errored));
|
|
24899
|
+
if (stream.destroyed || !stream.writable) return resolve2(true);
|
|
24900
|
+
stream.once("error", (e) => resolve2(writtenOrReaderLeft(e)));
|
|
24901
|
+
stream.write("", (e) => resolve2(writtenOrReaderLeft(e)));
|
|
24902
|
+
});
|
|
24903
|
+
}
|
|
24904
|
+
function exitCodeAfterFlush(code, stdoutComplete) {
|
|
24905
|
+
return !stdoutComplete && code === EXIT.OK ? EXIT.GENERAL : code;
|
|
24906
|
+
}
|
|
24907
|
+
async function exitAfterFlush(code) {
|
|
24908
|
+
const [stdoutComplete] = await Promise.all([flushed(process.stdout), flushed(process.stderr)]);
|
|
24909
|
+
if (!stdoutComplete) process.stderr.write("\uC624\uB958: \uCD9C\uB825\uC744 \uB05D\uAE4C\uC9C0 \uC4F0\uC9C0 \uBABB\uD588\uC5B4\uC694(\uB514\uC2A4\uD06C\xB7\uC785\uCD9C\uB825 \uC624\uB958). \uACB0\uACFC\uAC00 \uC798\uB838\uC744 \uC218 \uC788\uC5B4\uC694.\n");
|
|
24910
|
+
process.exit(exitCodeAfterFlush(code, stdoutComplete));
|
|
24911
|
+
}
|
|
24888
24912
|
if (invokedDirectly || process.env.DEMOCUT_CLI_RUN === "1") {
|
|
24889
|
-
run(process.argv.slice(2)).then((code) =>
|
|
24913
|
+
run(process.argv.slice(2)).then((code) => exitAfterFlush(code)).catch((e) => {
|
|
24890
24914
|
process.stderr.write(`\uC624\uB958: ${e?.message ?? String(e)}
|
|
24891
24915
|
`);
|
|
24892
|
-
|
|
24916
|
+
return exitAfterFlush(1);
|
|
24893
24917
|
});
|
|
24894
24918
|
}
|
|
24895
24919
|
export {
|
|
24896
24920
|
VERSION,
|
|
24921
|
+
exitCodeAfterFlush,
|
|
24922
|
+
flushed,
|
|
24897
24923
|
parseArgs,
|
|
24898
24924
|
run
|
|
24899
24925
|
};
|