@powerformer/refly-cli 0.1.12 → 0.1.14
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/bin/refly.js +419 -377
- package/dist/bin/refly.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/refly.js
CHANGED
|
@@ -521,10 +521,10 @@ var require_help = __commonJS({
|
|
|
521
521
|
function formatList(textArray) {
|
|
522
522
|
return textArray.join("\n").replace(/^/gm, " ".repeat(itemIndentWidth));
|
|
523
523
|
}
|
|
524
|
-
let
|
|
524
|
+
let output2 = [`Usage: ${helper.commandUsage(cmd)}`, ""];
|
|
525
525
|
const commandDescription = helper.commandDescription(cmd);
|
|
526
526
|
if (commandDescription.length > 0) {
|
|
527
|
-
|
|
527
|
+
output2 = output2.concat([
|
|
528
528
|
helper.wrap(commandDescription, helpWidth, 0),
|
|
529
529
|
""
|
|
530
530
|
]);
|
|
@@ -536,7 +536,7 @@ var require_help = __commonJS({
|
|
|
536
536
|
);
|
|
537
537
|
});
|
|
538
538
|
if (argumentList.length > 0) {
|
|
539
|
-
|
|
539
|
+
output2 = output2.concat(["Arguments:", formatList(argumentList), ""]);
|
|
540
540
|
}
|
|
541
541
|
const optionList = helper.visibleOptions(cmd).map((option) => {
|
|
542
542
|
return formatItem(
|
|
@@ -545,7 +545,7 @@ var require_help = __commonJS({
|
|
|
545
545
|
);
|
|
546
546
|
});
|
|
547
547
|
if (optionList.length > 0) {
|
|
548
|
-
|
|
548
|
+
output2 = output2.concat(["Options:", formatList(optionList), ""]);
|
|
549
549
|
}
|
|
550
550
|
if (this.showGlobalOptions) {
|
|
551
551
|
const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
|
|
@@ -555,7 +555,7 @@ var require_help = __commonJS({
|
|
|
555
555
|
);
|
|
556
556
|
});
|
|
557
557
|
if (globalOptionList.length > 0) {
|
|
558
|
-
|
|
558
|
+
output2 = output2.concat([
|
|
559
559
|
"Global Options:",
|
|
560
560
|
formatList(globalOptionList),
|
|
561
561
|
""
|
|
@@ -569,9 +569,9 @@ var require_help = __commonJS({
|
|
|
569
569
|
);
|
|
570
570
|
});
|
|
571
571
|
if (commandList.length > 0) {
|
|
572
|
-
|
|
572
|
+
output2 = output2.concat(["Commands:", formatList(commandList), ""]);
|
|
573
573
|
}
|
|
574
|
-
return
|
|
574
|
+
return output2.join("\n");
|
|
575
575
|
}
|
|
576
576
|
/**
|
|
577
577
|
* Calculate the pad width from the maximum term length.
|
|
@@ -3060,21 +3060,11 @@ __export(paths_exports, {
|
|
|
3060
3060
|
getCacheDir: () => getCacheDir,
|
|
3061
3061
|
getClaudeCommandsDir: () => getClaudeCommandsDir,
|
|
3062
3062
|
getClaudeSkillDir: () => getClaudeSkillDir,
|
|
3063
|
-
getCliVersion: () => getCliVersion,
|
|
3064
3063
|
getConfigPath: () => getConfigPath,
|
|
3065
3064
|
getCurrentSessionPath: () => getCurrentSessionPath,
|
|
3066
3065
|
getReflyDir: () => getReflyDir,
|
|
3067
3066
|
getSessionPath: () => getSessionPath
|
|
3068
3067
|
});
|
|
3069
|
-
function getCliVersion() {
|
|
3070
|
-
try {
|
|
3071
|
-
const pkgPath = path.join(__dirname, "..", "..", "package.json");
|
|
3072
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
3073
|
-
return pkg.version || "0.1.0";
|
|
3074
|
-
} catch {
|
|
3075
|
-
return "0.1.0";
|
|
3076
|
-
}
|
|
3077
|
-
}
|
|
3078
3068
|
function getReflyDir() {
|
|
3079
3069
|
const dir = path.join(os.homedir(), ".refly");
|
|
3080
3070
|
ensureDir(dir);
|
|
@@ -4050,42 +4040,55 @@ var OutputFormatter = class {
|
|
|
4050
4040
|
}
|
|
4051
4041
|
// === CLI Status Format (Phase 1: Charm-style cards) ===
|
|
4052
4042
|
outputStatusPretty(payload) {
|
|
4053
|
-
const { cli_version, auth_status, user, skill } = payload;
|
|
4043
|
+
const { cli_version, api_endpoint, auth_status, user, skill } = payload;
|
|
4054
4044
|
const sym = this.useUnicode ? Symbols : AsciiSymbol;
|
|
4055
4045
|
console.log(`${sym.DIAMOND} ${UI.bold("Refly CLI")} v${cli_version || "?"}`);
|
|
4056
4046
|
console.log();
|
|
4057
4047
|
const authOk = auth_status === "valid";
|
|
4058
4048
|
const userObj = user;
|
|
4059
|
-
|
|
4049
|
+
const authLines = [];
|
|
4060
4050
|
if (authOk && userObj?.email) {
|
|
4061
|
-
|
|
4051
|
+
authLines.push({ text: String(userObj.email) });
|
|
4062
4052
|
} else if (auth_status === "expired") {
|
|
4063
|
-
|
|
4053
|
+
authLines.push({ text: "Token expired", muted: true });
|
|
4064
4054
|
} else {
|
|
4065
|
-
|
|
4055
|
+
authLines.push({ text: "Not authenticated", muted: true });
|
|
4066
4056
|
}
|
|
4057
|
+
console.log(
|
|
4058
|
+
UI.card({
|
|
4059
|
+
title: "Auth",
|
|
4060
|
+
status: authOk ? "success" : "error",
|
|
4061
|
+
lines: authLines,
|
|
4062
|
+
width: 45
|
|
4063
|
+
})
|
|
4064
|
+
);
|
|
4065
|
+
console.log();
|
|
4066
|
+
const endpoint = String(api_endpoint || "\u2014");
|
|
4067
|
+
console.log(
|
|
4068
|
+
UI.card({
|
|
4069
|
+
title: "Connection",
|
|
4070
|
+
status: authOk ? "success" : "pending",
|
|
4071
|
+
lines: [{ text: endpoint }],
|
|
4072
|
+
width: 45
|
|
4073
|
+
})
|
|
4074
|
+
);
|
|
4075
|
+
console.log();
|
|
4067
4076
|
const skillObj = skill;
|
|
4068
4077
|
const skillInstalled = skillObj?.installed === true;
|
|
4069
4078
|
const skillVersion = skillObj?.version ? `v${skillObj.version}` : "";
|
|
4070
4079
|
const skillUpToDate = skillObj?.up_to_date === true;
|
|
4071
|
-
|
|
4080
|
+
const skillLines = [];
|
|
4072
4081
|
if (skillInstalled) {
|
|
4073
|
-
|
|
4082
|
+
const versionText = skillVersion + (skillUpToDate ? " (up to date)" : " (update available)");
|
|
4083
|
+
skillLines.push({ text: versionText });
|
|
4074
4084
|
} else {
|
|
4075
|
-
|
|
4085
|
+
skillLines.push({ text: "Not installed", muted: true });
|
|
4076
4086
|
}
|
|
4077
|
-
const authIcon = authOk ? styled(sym.SUCCESS, Style.TEXT_SUCCESS) : styled(sym.FAILURE, Style.TEXT_DANGER);
|
|
4078
|
-
const connIcon = authOk ? styled(sym.SUCCESS, Style.TEXT_SUCCESS) : styled(sym.PENDING, Style.TEXT_DIM);
|
|
4079
|
-
const skillIcon = skillInstalled ? styled(sym.SUCCESS, Style.TEXT_SUCCESS) : styled(sym.PENDING, Style.TEXT_DIM);
|
|
4080
|
-
const lines = [
|
|
4081
|
-
{ text: `${authIcon} Account ${authOk ? authText : authText}`, muted: !authOk },
|
|
4082
|
-
{ text: `${connIcon} Link https://refly.ai/` },
|
|
4083
|
-
{ text: `${skillIcon} Version ${skillText}`, muted: !skillInstalled }
|
|
4084
|
-
];
|
|
4085
4087
|
console.log(
|
|
4086
4088
|
UI.card({
|
|
4087
|
-
title: "
|
|
4088
|
-
|
|
4089
|
+
title: "Skill",
|
|
4090
|
+
status: skillInstalled ? "success" : "pending",
|
|
4091
|
+
lines: skillLines,
|
|
4089
4092
|
width: 45
|
|
4090
4093
|
})
|
|
4091
4094
|
);
|
|
@@ -5132,41 +5135,41 @@ var ZodType = class {
|
|
|
5132
5135
|
get description() {
|
|
5133
5136
|
return this._def.description;
|
|
5134
5137
|
}
|
|
5135
|
-
_getType(
|
|
5136
|
-
return getParsedType(
|
|
5138
|
+
_getType(input2) {
|
|
5139
|
+
return getParsedType(input2.data);
|
|
5137
5140
|
}
|
|
5138
|
-
_getOrReturnCtx(
|
|
5141
|
+
_getOrReturnCtx(input2, ctx) {
|
|
5139
5142
|
return ctx || {
|
|
5140
|
-
common:
|
|
5141
|
-
data:
|
|
5142
|
-
parsedType: getParsedType(
|
|
5143
|
+
common: input2.parent.common,
|
|
5144
|
+
data: input2.data,
|
|
5145
|
+
parsedType: getParsedType(input2.data),
|
|
5143
5146
|
schemaErrorMap: this._def.errorMap,
|
|
5144
|
-
path:
|
|
5145
|
-
parent:
|
|
5147
|
+
path: input2.path,
|
|
5148
|
+
parent: input2.parent
|
|
5146
5149
|
};
|
|
5147
5150
|
}
|
|
5148
|
-
_processInputParams(
|
|
5151
|
+
_processInputParams(input2) {
|
|
5149
5152
|
return {
|
|
5150
5153
|
status: new ParseStatus(),
|
|
5151
5154
|
ctx: {
|
|
5152
|
-
common:
|
|
5153
|
-
data:
|
|
5154
|
-
parsedType: getParsedType(
|
|
5155
|
+
common: input2.parent.common,
|
|
5156
|
+
data: input2.data,
|
|
5157
|
+
parsedType: getParsedType(input2.data),
|
|
5155
5158
|
schemaErrorMap: this._def.errorMap,
|
|
5156
|
-
path:
|
|
5157
|
-
parent:
|
|
5159
|
+
path: input2.path,
|
|
5160
|
+
parent: input2.parent
|
|
5158
5161
|
}
|
|
5159
5162
|
};
|
|
5160
5163
|
}
|
|
5161
|
-
_parseSync(
|
|
5162
|
-
const result = this._parse(
|
|
5164
|
+
_parseSync(input2) {
|
|
5165
|
+
const result = this._parse(input2);
|
|
5163
5166
|
if (isAsync(result)) {
|
|
5164
5167
|
throw new Error("Synchronous parse encountered promise.");
|
|
5165
5168
|
}
|
|
5166
5169
|
return result;
|
|
5167
5170
|
}
|
|
5168
|
-
_parseAsync(
|
|
5169
|
-
const result = this._parse(
|
|
5171
|
+
_parseAsync(input2) {
|
|
5172
|
+
const result = this._parse(input2);
|
|
5170
5173
|
return Promise.resolve(result);
|
|
5171
5174
|
}
|
|
5172
5175
|
parse(data, params) {
|
|
@@ -5492,13 +5495,13 @@ function isValidCidr(ip, version) {
|
|
|
5492
5495
|
return false;
|
|
5493
5496
|
}
|
|
5494
5497
|
var ZodString = class _ZodString extends ZodType {
|
|
5495
|
-
_parse(
|
|
5498
|
+
_parse(input2) {
|
|
5496
5499
|
if (this._def.coerce) {
|
|
5497
|
-
|
|
5500
|
+
input2.data = String(input2.data);
|
|
5498
5501
|
}
|
|
5499
|
-
const parsedType = this._getType(
|
|
5502
|
+
const parsedType = this._getType(input2);
|
|
5500
5503
|
if (parsedType !== ZodParsedType.string) {
|
|
5501
|
-
const ctx2 = this._getOrReturnCtx(
|
|
5504
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
5502
5505
|
addIssueToContext(ctx2, {
|
|
5503
5506
|
code: ZodIssueCode.invalid_type,
|
|
5504
5507
|
expected: ZodParsedType.string,
|
|
@@ -5510,8 +5513,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5510
5513
|
let ctx = void 0;
|
|
5511
5514
|
for (const check of this._def.checks) {
|
|
5512
5515
|
if (check.kind === "min") {
|
|
5513
|
-
if (
|
|
5514
|
-
ctx = this._getOrReturnCtx(
|
|
5516
|
+
if (input2.data.length < check.value) {
|
|
5517
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5515
5518
|
addIssueToContext(ctx, {
|
|
5516
5519
|
code: ZodIssueCode.too_small,
|
|
5517
5520
|
minimum: check.value,
|
|
@@ -5523,8 +5526,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5523
5526
|
status.dirty();
|
|
5524
5527
|
}
|
|
5525
5528
|
} else if (check.kind === "max") {
|
|
5526
|
-
if (
|
|
5527
|
-
ctx = this._getOrReturnCtx(
|
|
5529
|
+
if (input2.data.length > check.value) {
|
|
5530
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5528
5531
|
addIssueToContext(ctx, {
|
|
5529
5532
|
code: ZodIssueCode.too_big,
|
|
5530
5533
|
maximum: check.value,
|
|
@@ -5536,10 +5539,10 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5536
5539
|
status.dirty();
|
|
5537
5540
|
}
|
|
5538
5541
|
} else if (check.kind === "length") {
|
|
5539
|
-
const tooBig =
|
|
5540
|
-
const tooSmall =
|
|
5542
|
+
const tooBig = input2.data.length > check.value;
|
|
5543
|
+
const tooSmall = input2.data.length < check.value;
|
|
5541
5544
|
if (tooBig || tooSmall) {
|
|
5542
|
-
ctx = this._getOrReturnCtx(
|
|
5545
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5543
5546
|
if (tooBig) {
|
|
5544
5547
|
addIssueToContext(ctx, {
|
|
5545
5548
|
code: ZodIssueCode.too_big,
|
|
@@ -5562,8 +5565,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5562
5565
|
status.dirty();
|
|
5563
5566
|
}
|
|
5564
5567
|
} else if (check.kind === "email") {
|
|
5565
|
-
if (!emailRegex.test(
|
|
5566
|
-
ctx = this._getOrReturnCtx(
|
|
5568
|
+
if (!emailRegex.test(input2.data)) {
|
|
5569
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5567
5570
|
addIssueToContext(ctx, {
|
|
5568
5571
|
validation: "email",
|
|
5569
5572
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5575,8 +5578,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5575
5578
|
if (!emojiRegex) {
|
|
5576
5579
|
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
5577
5580
|
}
|
|
5578
|
-
if (!emojiRegex.test(
|
|
5579
|
-
ctx = this._getOrReturnCtx(
|
|
5581
|
+
if (!emojiRegex.test(input2.data)) {
|
|
5582
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5580
5583
|
addIssueToContext(ctx, {
|
|
5581
5584
|
validation: "emoji",
|
|
5582
5585
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5585,8 +5588,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5585
5588
|
status.dirty();
|
|
5586
5589
|
}
|
|
5587
5590
|
} else if (check.kind === "uuid") {
|
|
5588
|
-
if (!uuidRegex.test(
|
|
5589
|
-
ctx = this._getOrReturnCtx(
|
|
5591
|
+
if (!uuidRegex.test(input2.data)) {
|
|
5592
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5590
5593
|
addIssueToContext(ctx, {
|
|
5591
5594
|
validation: "uuid",
|
|
5592
5595
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5595,8 +5598,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5595
5598
|
status.dirty();
|
|
5596
5599
|
}
|
|
5597
5600
|
} else if (check.kind === "nanoid") {
|
|
5598
|
-
if (!nanoidRegex.test(
|
|
5599
|
-
ctx = this._getOrReturnCtx(
|
|
5601
|
+
if (!nanoidRegex.test(input2.data)) {
|
|
5602
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5600
5603
|
addIssueToContext(ctx, {
|
|
5601
5604
|
validation: "nanoid",
|
|
5602
5605
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5605,8 +5608,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5605
5608
|
status.dirty();
|
|
5606
5609
|
}
|
|
5607
5610
|
} else if (check.kind === "cuid") {
|
|
5608
|
-
if (!cuidRegex.test(
|
|
5609
|
-
ctx = this._getOrReturnCtx(
|
|
5611
|
+
if (!cuidRegex.test(input2.data)) {
|
|
5612
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5610
5613
|
addIssueToContext(ctx, {
|
|
5611
5614
|
validation: "cuid",
|
|
5612
5615
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5615,8 +5618,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5615
5618
|
status.dirty();
|
|
5616
5619
|
}
|
|
5617
5620
|
} else if (check.kind === "cuid2") {
|
|
5618
|
-
if (!cuid2Regex.test(
|
|
5619
|
-
ctx = this._getOrReturnCtx(
|
|
5621
|
+
if (!cuid2Regex.test(input2.data)) {
|
|
5622
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5620
5623
|
addIssueToContext(ctx, {
|
|
5621
5624
|
validation: "cuid2",
|
|
5622
5625
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5625,8 +5628,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5625
5628
|
status.dirty();
|
|
5626
5629
|
}
|
|
5627
5630
|
} else if (check.kind === "ulid") {
|
|
5628
|
-
if (!ulidRegex.test(
|
|
5629
|
-
ctx = this._getOrReturnCtx(
|
|
5631
|
+
if (!ulidRegex.test(input2.data)) {
|
|
5632
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5630
5633
|
addIssueToContext(ctx, {
|
|
5631
5634
|
validation: "ulid",
|
|
5632
5635
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5636,9 +5639,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5636
5639
|
}
|
|
5637
5640
|
} else if (check.kind === "url") {
|
|
5638
5641
|
try {
|
|
5639
|
-
new URL(
|
|
5642
|
+
new URL(input2.data);
|
|
5640
5643
|
} catch {
|
|
5641
|
-
ctx = this._getOrReturnCtx(
|
|
5644
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5642
5645
|
addIssueToContext(ctx, {
|
|
5643
5646
|
validation: "url",
|
|
5644
5647
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5648,9 +5651,9 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5648
5651
|
}
|
|
5649
5652
|
} else if (check.kind === "regex") {
|
|
5650
5653
|
check.regex.lastIndex = 0;
|
|
5651
|
-
const testResult = check.regex.test(
|
|
5654
|
+
const testResult = check.regex.test(input2.data);
|
|
5652
5655
|
if (!testResult) {
|
|
5653
|
-
ctx = this._getOrReturnCtx(
|
|
5656
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5654
5657
|
addIssueToContext(ctx, {
|
|
5655
5658
|
validation: "regex",
|
|
5656
5659
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5659,10 +5662,10 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5659
5662
|
status.dirty();
|
|
5660
5663
|
}
|
|
5661
5664
|
} else if (check.kind === "trim") {
|
|
5662
|
-
|
|
5665
|
+
input2.data = input2.data.trim();
|
|
5663
5666
|
} else if (check.kind === "includes") {
|
|
5664
|
-
if (!
|
|
5665
|
-
ctx = this._getOrReturnCtx(
|
|
5667
|
+
if (!input2.data.includes(check.value, check.position)) {
|
|
5668
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5666
5669
|
addIssueToContext(ctx, {
|
|
5667
5670
|
code: ZodIssueCode.invalid_string,
|
|
5668
5671
|
validation: { includes: check.value, position: check.position },
|
|
@@ -5671,12 +5674,12 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5671
5674
|
status.dirty();
|
|
5672
5675
|
}
|
|
5673
5676
|
} else if (check.kind === "toLowerCase") {
|
|
5674
|
-
|
|
5677
|
+
input2.data = input2.data.toLowerCase();
|
|
5675
5678
|
} else if (check.kind === "toUpperCase") {
|
|
5676
|
-
|
|
5679
|
+
input2.data = input2.data.toUpperCase();
|
|
5677
5680
|
} else if (check.kind === "startsWith") {
|
|
5678
|
-
if (!
|
|
5679
|
-
ctx = this._getOrReturnCtx(
|
|
5681
|
+
if (!input2.data.startsWith(check.value)) {
|
|
5682
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5680
5683
|
addIssueToContext(ctx, {
|
|
5681
5684
|
code: ZodIssueCode.invalid_string,
|
|
5682
5685
|
validation: { startsWith: check.value },
|
|
@@ -5685,8 +5688,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5685
5688
|
status.dirty();
|
|
5686
5689
|
}
|
|
5687
5690
|
} else if (check.kind === "endsWith") {
|
|
5688
|
-
if (!
|
|
5689
|
-
ctx = this._getOrReturnCtx(
|
|
5691
|
+
if (!input2.data.endsWith(check.value)) {
|
|
5692
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5690
5693
|
addIssueToContext(ctx, {
|
|
5691
5694
|
code: ZodIssueCode.invalid_string,
|
|
5692
5695
|
validation: { endsWith: check.value },
|
|
@@ -5696,8 +5699,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5696
5699
|
}
|
|
5697
5700
|
} else if (check.kind === "datetime") {
|
|
5698
5701
|
const regex = datetimeRegex(check);
|
|
5699
|
-
if (!regex.test(
|
|
5700
|
-
ctx = this._getOrReturnCtx(
|
|
5702
|
+
if (!regex.test(input2.data)) {
|
|
5703
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5701
5704
|
addIssueToContext(ctx, {
|
|
5702
5705
|
code: ZodIssueCode.invalid_string,
|
|
5703
5706
|
validation: "datetime",
|
|
@@ -5707,8 +5710,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5707
5710
|
}
|
|
5708
5711
|
} else if (check.kind === "date") {
|
|
5709
5712
|
const regex = dateRegex;
|
|
5710
|
-
if (!regex.test(
|
|
5711
|
-
ctx = this._getOrReturnCtx(
|
|
5713
|
+
if (!regex.test(input2.data)) {
|
|
5714
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5712
5715
|
addIssueToContext(ctx, {
|
|
5713
5716
|
code: ZodIssueCode.invalid_string,
|
|
5714
5717
|
validation: "date",
|
|
@@ -5718,8 +5721,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5718
5721
|
}
|
|
5719
5722
|
} else if (check.kind === "time") {
|
|
5720
5723
|
const regex = timeRegex(check);
|
|
5721
|
-
if (!regex.test(
|
|
5722
|
-
ctx = this._getOrReturnCtx(
|
|
5724
|
+
if (!regex.test(input2.data)) {
|
|
5725
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5723
5726
|
addIssueToContext(ctx, {
|
|
5724
5727
|
code: ZodIssueCode.invalid_string,
|
|
5725
5728
|
validation: "time",
|
|
@@ -5728,8 +5731,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5728
5731
|
status.dirty();
|
|
5729
5732
|
}
|
|
5730
5733
|
} else if (check.kind === "duration") {
|
|
5731
|
-
if (!durationRegex.test(
|
|
5732
|
-
ctx = this._getOrReturnCtx(
|
|
5734
|
+
if (!durationRegex.test(input2.data)) {
|
|
5735
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5733
5736
|
addIssueToContext(ctx, {
|
|
5734
5737
|
validation: "duration",
|
|
5735
5738
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5738,8 +5741,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5738
5741
|
status.dirty();
|
|
5739
5742
|
}
|
|
5740
5743
|
} else if (check.kind === "ip") {
|
|
5741
|
-
if (!isValidIP(
|
|
5742
|
-
ctx = this._getOrReturnCtx(
|
|
5744
|
+
if (!isValidIP(input2.data, check.version)) {
|
|
5745
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5743
5746
|
addIssueToContext(ctx, {
|
|
5744
5747
|
validation: "ip",
|
|
5745
5748
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5748,8 +5751,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5748
5751
|
status.dirty();
|
|
5749
5752
|
}
|
|
5750
5753
|
} else if (check.kind === "jwt") {
|
|
5751
|
-
if (!isValidJWT(
|
|
5752
|
-
ctx = this._getOrReturnCtx(
|
|
5754
|
+
if (!isValidJWT(input2.data, check.alg)) {
|
|
5755
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5753
5756
|
addIssueToContext(ctx, {
|
|
5754
5757
|
validation: "jwt",
|
|
5755
5758
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5758,8 +5761,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5758
5761
|
status.dirty();
|
|
5759
5762
|
}
|
|
5760
5763
|
} else if (check.kind === "cidr") {
|
|
5761
|
-
if (!isValidCidr(
|
|
5762
|
-
ctx = this._getOrReturnCtx(
|
|
5764
|
+
if (!isValidCidr(input2.data, check.version)) {
|
|
5765
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5763
5766
|
addIssueToContext(ctx, {
|
|
5764
5767
|
validation: "cidr",
|
|
5765
5768
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5768,8 +5771,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5768
5771
|
status.dirty();
|
|
5769
5772
|
}
|
|
5770
5773
|
} else if (check.kind === "base64") {
|
|
5771
|
-
if (!base64Regex.test(
|
|
5772
|
-
ctx = this._getOrReturnCtx(
|
|
5774
|
+
if (!base64Regex.test(input2.data)) {
|
|
5775
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5773
5776
|
addIssueToContext(ctx, {
|
|
5774
5777
|
validation: "base64",
|
|
5775
5778
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5778,8 +5781,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5778
5781
|
status.dirty();
|
|
5779
5782
|
}
|
|
5780
5783
|
} else if (check.kind === "base64url") {
|
|
5781
|
-
if (!base64urlRegex.test(
|
|
5782
|
-
ctx = this._getOrReturnCtx(
|
|
5784
|
+
if (!base64urlRegex.test(input2.data)) {
|
|
5785
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
5783
5786
|
addIssueToContext(ctx, {
|
|
5784
5787
|
validation: "base64url",
|
|
5785
5788
|
code: ZodIssueCode.invalid_string,
|
|
@@ -5791,7 +5794,7 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
5791
5794
|
util.assertNever(check);
|
|
5792
5795
|
}
|
|
5793
5796
|
}
|
|
5794
|
-
return { status: status.value, value:
|
|
5797
|
+
return { status: status.value, value: input2.data };
|
|
5795
5798
|
}
|
|
5796
5799
|
_regex(regex, validation, message) {
|
|
5797
5800
|
return this.refinement((data) => regex.test(data), {
|
|
@@ -6052,13 +6055,13 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
6052
6055
|
this.max = this.lte;
|
|
6053
6056
|
this.step = this.multipleOf;
|
|
6054
6057
|
}
|
|
6055
|
-
_parse(
|
|
6058
|
+
_parse(input2) {
|
|
6056
6059
|
if (this._def.coerce) {
|
|
6057
|
-
|
|
6060
|
+
input2.data = Number(input2.data);
|
|
6058
6061
|
}
|
|
6059
|
-
const parsedType = this._getType(
|
|
6062
|
+
const parsedType = this._getType(input2);
|
|
6060
6063
|
if (parsedType !== ZodParsedType.number) {
|
|
6061
|
-
const ctx2 = this._getOrReturnCtx(
|
|
6064
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
6062
6065
|
addIssueToContext(ctx2, {
|
|
6063
6066
|
code: ZodIssueCode.invalid_type,
|
|
6064
6067
|
expected: ZodParsedType.number,
|
|
@@ -6070,8 +6073,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
6070
6073
|
const status = new ParseStatus();
|
|
6071
6074
|
for (const check of this._def.checks) {
|
|
6072
6075
|
if (check.kind === "int") {
|
|
6073
|
-
if (!util.isInteger(
|
|
6074
|
-
ctx = this._getOrReturnCtx(
|
|
6076
|
+
if (!util.isInteger(input2.data)) {
|
|
6077
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6075
6078
|
addIssueToContext(ctx, {
|
|
6076
6079
|
code: ZodIssueCode.invalid_type,
|
|
6077
6080
|
expected: "integer",
|
|
@@ -6081,9 +6084,9 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
6081
6084
|
status.dirty();
|
|
6082
6085
|
}
|
|
6083
6086
|
} else if (check.kind === "min") {
|
|
6084
|
-
const tooSmall = check.inclusive ?
|
|
6087
|
+
const tooSmall = check.inclusive ? input2.data < check.value : input2.data <= check.value;
|
|
6085
6088
|
if (tooSmall) {
|
|
6086
|
-
ctx = this._getOrReturnCtx(
|
|
6089
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6087
6090
|
addIssueToContext(ctx, {
|
|
6088
6091
|
code: ZodIssueCode.too_small,
|
|
6089
6092
|
minimum: check.value,
|
|
@@ -6095,9 +6098,9 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
6095
6098
|
status.dirty();
|
|
6096
6099
|
}
|
|
6097
6100
|
} else if (check.kind === "max") {
|
|
6098
|
-
const tooBig = check.inclusive ?
|
|
6101
|
+
const tooBig = check.inclusive ? input2.data > check.value : input2.data >= check.value;
|
|
6099
6102
|
if (tooBig) {
|
|
6100
|
-
ctx = this._getOrReturnCtx(
|
|
6103
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6101
6104
|
addIssueToContext(ctx, {
|
|
6102
6105
|
code: ZodIssueCode.too_big,
|
|
6103
6106
|
maximum: check.value,
|
|
@@ -6109,8 +6112,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
6109
6112
|
status.dirty();
|
|
6110
6113
|
}
|
|
6111
6114
|
} else if (check.kind === "multipleOf") {
|
|
6112
|
-
if (floatSafeRemainder(
|
|
6113
|
-
ctx = this._getOrReturnCtx(
|
|
6115
|
+
if (floatSafeRemainder(input2.data, check.value) !== 0) {
|
|
6116
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6114
6117
|
addIssueToContext(ctx, {
|
|
6115
6118
|
code: ZodIssueCode.not_multiple_of,
|
|
6116
6119
|
multipleOf: check.value,
|
|
@@ -6119,8 +6122,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
6119
6122
|
status.dirty();
|
|
6120
6123
|
}
|
|
6121
6124
|
} else if (check.kind === "finite") {
|
|
6122
|
-
if (!Number.isFinite(
|
|
6123
|
-
ctx = this._getOrReturnCtx(
|
|
6125
|
+
if (!Number.isFinite(input2.data)) {
|
|
6126
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6124
6127
|
addIssueToContext(ctx, {
|
|
6125
6128
|
code: ZodIssueCode.not_finite,
|
|
6126
6129
|
message: check.message
|
|
@@ -6131,7 +6134,7 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
6131
6134
|
util.assertNever(check);
|
|
6132
6135
|
}
|
|
6133
6136
|
}
|
|
6134
|
-
return { status: status.value, value:
|
|
6137
|
+
return { status: status.value, value: input2.data };
|
|
6135
6138
|
}
|
|
6136
6139
|
gte(value, message) {
|
|
6137
6140
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
@@ -6283,25 +6286,25 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
6283
6286
|
this.min = this.gte;
|
|
6284
6287
|
this.max = this.lte;
|
|
6285
6288
|
}
|
|
6286
|
-
_parse(
|
|
6289
|
+
_parse(input2) {
|
|
6287
6290
|
if (this._def.coerce) {
|
|
6288
6291
|
try {
|
|
6289
|
-
|
|
6292
|
+
input2.data = BigInt(input2.data);
|
|
6290
6293
|
} catch {
|
|
6291
|
-
return this._getInvalidInput(
|
|
6294
|
+
return this._getInvalidInput(input2);
|
|
6292
6295
|
}
|
|
6293
6296
|
}
|
|
6294
|
-
const parsedType = this._getType(
|
|
6297
|
+
const parsedType = this._getType(input2);
|
|
6295
6298
|
if (parsedType !== ZodParsedType.bigint) {
|
|
6296
|
-
return this._getInvalidInput(
|
|
6299
|
+
return this._getInvalidInput(input2);
|
|
6297
6300
|
}
|
|
6298
6301
|
let ctx = void 0;
|
|
6299
6302
|
const status = new ParseStatus();
|
|
6300
6303
|
for (const check of this._def.checks) {
|
|
6301
6304
|
if (check.kind === "min") {
|
|
6302
|
-
const tooSmall = check.inclusive ?
|
|
6305
|
+
const tooSmall = check.inclusive ? input2.data < check.value : input2.data <= check.value;
|
|
6303
6306
|
if (tooSmall) {
|
|
6304
|
-
ctx = this._getOrReturnCtx(
|
|
6307
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6305
6308
|
addIssueToContext(ctx, {
|
|
6306
6309
|
code: ZodIssueCode.too_small,
|
|
6307
6310
|
type: "bigint",
|
|
@@ -6312,9 +6315,9 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
6312
6315
|
status.dirty();
|
|
6313
6316
|
}
|
|
6314
6317
|
} else if (check.kind === "max") {
|
|
6315
|
-
const tooBig = check.inclusive ?
|
|
6318
|
+
const tooBig = check.inclusive ? input2.data > check.value : input2.data >= check.value;
|
|
6316
6319
|
if (tooBig) {
|
|
6317
|
-
ctx = this._getOrReturnCtx(
|
|
6320
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6318
6321
|
addIssueToContext(ctx, {
|
|
6319
6322
|
code: ZodIssueCode.too_big,
|
|
6320
6323
|
type: "bigint",
|
|
@@ -6325,8 +6328,8 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
6325
6328
|
status.dirty();
|
|
6326
6329
|
}
|
|
6327
6330
|
} else if (check.kind === "multipleOf") {
|
|
6328
|
-
if (
|
|
6329
|
-
ctx = this._getOrReturnCtx(
|
|
6331
|
+
if (input2.data % check.value !== BigInt(0)) {
|
|
6332
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6330
6333
|
addIssueToContext(ctx, {
|
|
6331
6334
|
code: ZodIssueCode.not_multiple_of,
|
|
6332
6335
|
multipleOf: check.value,
|
|
@@ -6338,10 +6341,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
6338
6341
|
util.assertNever(check);
|
|
6339
6342
|
}
|
|
6340
6343
|
}
|
|
6341
|
-
return { status: status.value, value:
|
|
6344
|
+
return { status: status.value, value: input2.data };
|
|
6342
6345
|
}
|
|
6343
|
-
_getInvalidInput(
|
|
6344
|
-
const ctx = this._getOrReturnCtx(
|
|
6346
|
+
_getInvalidInput(input2) {
|
|
6347
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
6345
6348
|
addIssueToContext(ctx, {
|
|
6346
6349
|
code: ZodIssueCode.invalid_type,
|
|
6347
6350
|
expected: ZodParsedType.bigint,
|
|
@@ -6450,13 +6453,13 @@ ZodBigInt.create = (params) => {
|
|
|
6450
6453
|
});
|
|
6451
6454
|
};
|
|
6452
6455
|
var ZodBoolean = class extends ZodType {
|
|
6453
|
-
_parse(
|
|
6456
|
+
_parse(input2) {
|
|
6454
6457
|
if (this._def.coerce) {
|
|
6455
|
-
|
|
6458
|
+
input2.data = Boolean(input2.data);
|
|
6456
6459
|
}
|
|
6457
|
-
const parsedType = this._getType(
|
|
6460
|
+
const parsedType = this._getType(input2);
|
|
6458
6461
|
if (parsedType !== ZodParsedType.boolean) {
|
|
6459
|
-
const ctx = this._getOrReturnCtx(
|
|
6462
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
6460
6463
|
addIssueToContext(ctx, {
|
|
6461
6464
|
code: ZodIssueCode.invalid_type,
|
|
6462
6465
|
expected: ZodParsedType.boolean,
|
|
@@ -6464,7 +6467,7 @@ var ZodBoolean = class extends ZodType {
|
|
|
6464
6467
|
});
|
|
6465
6468
|
return INVALID;
|
|
6466
6469
|
}
|
|
6467
|
-
return OK(
|
|
6470
|
+
return OK(input2.data);
|
|
6468
6471
|
}
|
|
6469
6472
|
};
|
|
6470
6473
|
ZodBoolean.create = (params) => {
|
|
@@ -6475,13 +6478,13 @@ ZodBoolean.create = (params) => {
|
|
|
6475
6478
|
});
|
|
6476
6479
|
};
|
|
6477
6480
|
var ZodDate = class _ZodDate extends ZodType {
|
|
6478
|
-
_parse(
|
|
6481
|
+
_parse(input2) {
|
|
6479
6482
|
if (this._def.coerce) {
|
|
6480
|
-
|
|
6483
|
+
input2.data = new Date(input2.data);
|
|
6481
6484
|
}
|
|
6482
|
-
const parsedType = this._getType(
|
|
6485
|
+
const parsedType = this._getType(input2);
|
|
6483
6486
|
if (parsedType !== ZodParsedType.date) {
|
|
6484
|
-
const ctx2 = this._getOrReturnCtx(
|
|
6487
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
6485
6488
|
addIssueToContext(ctx2, {
|
|
6486
6489
|
code: ZodIssueCode.invalid_type,
|
|
6487
6490
|
expected: ZodParsedType.date,
|
|
@@ -6489,8 +6492,8 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
6489
6492
|
});
|
|
6490
6493
|
return INVALID;
|
|
6491
6494
|
}
|
|
6492
|
-
if (Number.isNaN(
|
|
6493
|
-
const ctx2 = this._getOrReturnCtx(
|
|
6495
|
+
if (Number.isNaN(input2.data.getTime())) {
|
|
6496
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
6494
6497
|
addIssueToContext(ctx2, {
|
|
6495
6498
|
code: ZodIssueCode.invalid_date
|
|
6496
6499
|
});
|
|
@@ -6500,8 +6503,8 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
6500
6503
|
let ctx = void 0;
|
|
6501
6504
|
for (const check of this._def.checks) {
|
|
6502
6505
|
if (check.kind === "min") {
|
|
6503
|
-
if (
|
|
6504
|
-
ctx = this._getOrReturnCtx(
|
|
6506
|
+
if (input2.data.getTime() < check.value) {
|
|
6507
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6505
6508
|
addIssueToContext(ctx, {
|
|
6506
6509
|
code: ZodIssueCode.too_small,
|
|
6507
6510
|
message: check.message,
|
|
@@ -6513,8 +6516,8 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
6513
6516
|
status.dirty();
|
|
6514
6517
|
}
|
|
6515
6518
|
} else if (check.kind === "max") {
|
|
6516
|
-
if (
|
|
6517
|
-
ctx = this._getOrReturnCtx(
|
|
6519
|
+
if (input2.data.getTime() > check.value) {
|
|
6520
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
6518
6521
|
addIssueToContext(ctx, {
|
|
6519
6522
|
code: ZodIssueCode.too_big,
|
|
6520
6523
|
message: check.message,
|
|
@@ -6531,7 +6534,7 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
6531
6534
|
}
|
|
6532
6535
|
return {
|
|
6533
6536
|
status: status.value,
|
|
6534
|
-
value: new Date(
|
|
6537
|
+
value: new Date(input2.data.getTime())
|
|
6535
6538
|
};
|
|
6536
6539
|
}
|
|
6537
6540
|
_addCheck(check) {
|
|
@@ -6584,10 +6587,10 @@ ZodDate.create = (params) => {
|
|
|
6584
6587
|
});
|
|
6585
6588
|
};
|
|
6586
6589
|
var ZodSymbol = class extends ZodType {
|
|
6587
|
-
_parse(
|
|
6588
|
-
const parsedType = this._getType(
|
|
6590
|
+
_parse(input2) {
|
|
6591
|
+
const parsedType = this._getType(input2);
|
|
6589
6592
|
if (parsedType !== ZodParsedType.symbol) {
|
|
6590
|
-
const ctx = this._getOrReturnCtx(
|
|
6593
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
6591
6594
|
addIssueToContext(ctx, {
|
|
6592
6595
|
code: ZodIssueCode.invalid_type,
|
|
6593
6596
|
expected: ZodParsedType.symbol,
|
|
@@ -6595,7 +6598,7 @@ var ZodSymbol = class extends ZodType {
|
|
|
6595
6598
|
});
|
|
6596
6599
|
return INVALID;
|
|
6597
6600
|
}
|
|
6598
|
-
return OK(
|
|
6601
|
+
return OK(input2.data);
|
|
6599
6602
|
}
|
|
6600
6603
|
};
|
|
6601
6604
|
ZodSymbol.create = (params) => {
|
|
@@ -6605,10 +6608,10 @@ ZodSymbol.create = (params) => {
|
|
|
6605
6608
|
});
|
|
6606
6609
|
};
|
|
6607
6610
|
var ZodUndefined = class extends ZodType {
|
|
6608
|
-
_parse(
|
|
6609
|
-
const parsedType = this._getType(
|
|
6611
|
+
_parse(input2) {
|
|
6612
|
+
const parsedType = this._getType(input2);
|
|
6610
6613
|
if (parsedType !== ZodParsedType.undefined) {
|
|
6611
|
-
const ctx = this._getOrReturnCtx(
|
|
6614
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
6612
6615
|
addIssueToContext(ctx, {
|
|
6613
6616
|
code: ZodIssueCode.invalid_type,
|
|
6614
6617
|
expected: ZodParsedType.undefined,
|
|
@@ -6616,7 +6619,7 @@ var ZodUndefined = class extends ZodType {
|
|
|
6616
6619
|
});
|
|
6617
6620
|
return INVALID;
|
|
6618
6621
|
}
|
|
6619
|
-
return OK(
|
|
6622
|
+
return OK(input2.data);
|
|
6620
6623
|
}
|
|
6621
6624
|
};
|
|
6622
6625
|
ZodUndefined.create = (params) => {
|
|
@@ -6626,10 +6629,10 @@ ZodUndefined.create = (params) => {
|
|
|
6626
6629
|
});
|
|
6627
6630
|
};
|
|
6628
6631
|
var ZodNull = class extends ZodType {
|
|
6629
|
-
_parse(
|
|
6630
|
-
const parsedType = this._getType(
|
|
6632
|
+
_parse(input2) {
|
|
6633
|
+
const parsedType = this._getType(input2);
|
|
6631
6634
|
if (parsedType !== ZodParsedType.null) {
|
|
6632
|
-
const ctx = this._getOrReturnCtx(
|
|
6635
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
6633
6636
|
addIssueToContext(ctx, {
|
|
6634
6637
|
code: ZodIssueCode.invalid_type,
|
|
6635
6638
|
expected: ZodParsedType.null,
|
|
@@ -6637,7 +6640,7 @@ var ZodNull = class extends ZodType {
|
|
|
6637
6640
|
});
|
|
6638
6641
|
return INVALID;
|
|
6639
6642
|
}
|
|
6640
|
-
return OK(
|
|
6643
|
+
return OK(input2.data);
|
|
6641
6644
|
}
|
|
6642
6645
|
};
|
|
6643
6646
|
ZodNull.create = (params) => {
|
|
@@ -6651,8 +6654,8 @@ var ZodAny = class extends ZodType {
|
|
|
6651
6654
|
super(...arguments);
|
|
6652
6655
|
this._any = true;
|
|
6653
6656
|
}
|
|
6654
|
-
_parse(
|
|
6655
|
-
return OK(
|
|
6657
|
+
_parse(input2) {
|
|
6658
|
+
return OK(input2.data);
|
|
6656
6659
|
}
|
|
6657
6660
|
};
|
|
6658
6661
|
ZodAny.create = (params) => {
|
|
@@ -6666,8 +6669,8 @@ var ZodUnknown = class extends ZodType {
|
|
|
6666
6669
|
super(...arguments);
|
|
6667
6670
|
this._unknown = true;
|
|
6668
6671
|
}
|
|
6669
|
-
_parse(
|
|
6670
|
-
return OK(
|
|
6672
|
+
_parse(input2) {
|
|
6673
|
+
return OK(input2.data);
|
|
6671
6674
|
}
|
|
6672
6675
|
};
|
|
6673
6676
|
ZodUnknown.create = (params) => {
|
|
@@ -6677,8 +6680,8 @@ ZodUnknown.create = (params) => {
|
|
|
6677
6680
|
});
|
|
6678
6681
|
};
|
|
6679
6682
|
var ZodNever = class extends ZodType {
|
|
6680
|
-
_parse(
|
|
6681
|
-
const ctx = this._getOrReturnCtx(
|
|
6683
|
+
_parse(input2) {
|
|
6684
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
6682
6685
|
addIssueToContext(ctx, {
|
|
6683
6686
|
code: ZodIssueCode.invalid_type,
|
|
6684
6687
|
expected: ZodParsedType.never,
|
|
@@ -6694,10 +6697,10 @@ ZodNever.create = (params) => {
|
|
|
6694
6697
|
});
|
|
6695
6698
|
};
|
|
6696
6699
|
var ZodVoid = class extends ZodType {
|
|
6697
|
-
_parse(
|
|
6698
|
-
const parsedType = this._getType(
|
|
6700
|
+
_parse(input2) {
|
|
6701
|
+
const parsedType = this._getType(input2);
|
|
6699
6702
|
if (parsedType !== ZodParsedType.undefined) {
|
|
6700
|
-
const ctx = this._getOrReturnCtx(
|
|
6703
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
6701
6704
|
addIssueToContext(ctx, {
|
|
6702
6705
|
code: ZodIssueCode.invalid_type,
|
|
6703
6706
|
expected: ZodParsedType.void,
|
|
@@ -6705,7 +6708,7 @@ var ZodVoid = class extends ZodType {
|
|
|
6705
6708
|
});
|
|
6706
6709
|
return INVALID;
|
|
6707
6710
|
}
|
|
6708
|
-
return OK(
|
|
6711
|
+
return OK(input2.data);
|
|
6709
6712
|
}
|
|
6710
6713
|
};
|
|
6711
6714
|
ZodVoid.create = (params) => {
|
|
@@ -6715,8 +6718,8 @@ ZodVoid.create = (params) => {
|
|
|
6715
6718
|
});
|
|
6716
6719
|
};
|
|
6717
6720
|
var ZodArray = class _ZodArray extends ZodType {
|
|
6718
|
-
_parse(
|
|
6719
|
-
const { ctx, status } = this._processInputParams(
|
|
6721
|
+
_parse(input2) {
|
|
6722
|
+
const { ctx, status } = this._processInputParams(input2);
|
|
6720
6723
|
const def = this._def;
|
|
6721
6724
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
6722
6725
|
addIssueToContext(ctx, {
|
|
@@ -6856,10 +6859,10 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
6856
6859
|
this._cached = { shape, keys };
|
|
6857
6860
|
return this._cached;
|
|
6858
6861
|
}
|
|
6859
|
-
_parse(
|
|
6860
|
-
const parsedType = this._getType(
|
|
6862
|
+
_parse(input2) {
|
|
6863
|
+
const parsedType = this._getType(input2);
|
|
6861
6864
|
if (parsedType !== ZodParsedType.object) {
|
|
6862
|
-
const ctx2 = this._getOrReturnCtx(
|
|
6865
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
6863
6866
|
addIssueToContext(ctx2, {
|
|
6864
6867
|
code: ZodIssueCode.invalid_type,
|
|
6865
6868
|
expected: ZodParsedType.object,
|
|
@@ -6867,7 +6870,7 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
6867
6870
|
});
|
|
6868
6871
|
return INVALID;
|
|
6869
6872
|
}
|
|
6870
|
-
const { status, ctx } = this._processInputParams(
|
|
6873
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
6871
6874
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
6872
6875
|
const extraKeys = [];
|
|
6873
6876
|
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
|
|
@@ -7180,8 +7183,8 @@ ZodObject.lazycreate = (shape, params) => {
|
|
|
7180
7183
|
});
|
|
7181
7184
|
};
|
|
7182
7185
|
var ZodUnion = class extends ZodType {
|
|
7183
|
-
_parse(
|
|
7184
|
-
const { ctx } = this._processInputParams(
|
|
7186
|
+
_parse(input2) {
|
|
7187
|
+
const { ctx } = this._processInputParams(input2);
|
|
7185
7188
|
const options = this._def.options;
|
|
7186
7189
|
function handleResults(results) {
|
|
7187
7190
|
for (const result of results) {
|
|
@@ -7302,8 +7305,8 @@ var getDiscriminator = (type) => {
|
|
|
7302
7305
|
}
|
|
7303
7306
|
};
|
|
7304
7307
|
var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
7305
|
-
_parse(
|
|
7306
|
-
const { ctx } = this._processInputParams(
|
|
7308
|
+
_parse(input2) {
|
|
7309
|
+
const { ctx } = this._processInputParams(input2);
|
|
7307
7310
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
7308
7311
|
addIssueToContext(ctx, {
|
|
7309
7312
|
code: ZodIssueCode.invalid_type,
|
|
@@ -7416,8 +7419,8 @@ function mergeValues(a, b) {
|
|
|
7416
7419
|
}
|
|
7417
7420
|
}
|
|
7418
7421
|
var ZodIntersection = class extends ZodType {
|
|
7419
|
-
_parse(
|
|
7420
|
-
const { status, ctx } = this._processInputParams(
|
|
7422
|
+
_parse(input2) {
|
|
7423
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
7421
7424
|
const handleParsed = (parsedLeft, parsedRight) => {
|
|
7422
7425
|
if (isAborted(parsedLeft) || isAborted(parsedRight)) {
|
|
7423
7426
|
return INVALID;
|
|
@@ -7469,8 +7472,8 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
7469
7472
|
});
|
|
7470
7473
|
};
|
|
7471
7474
|
var ZodTuple = class _ZodTuple extends ZodType {
|
|
7472
|
-
_parse(
|
|
7473
|
-
const { status, ctx } = this._processInputParams(
|
|
7475
|
+
_parse(input2) {
|
|
7476
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
7474
7477
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
7475
7478
|
addIssueToContext(ctx, {
|
|
7476
7479
|
code: ZodIssueCode.invalid_type,
|
|
@@ -7542,8 +7545,8 @@ var ZodRecord = class _ZodRecord extends ZodType {
|
|
|
7542
7545
|
get valueSchema() {
|
|
7543
7546
|
return this._def.valueType;
|
|
7544
7547
|
}
|
|
7545
|
-
_parse(
|
|
7546
|
-
const { status, ctx } = this._processInputParams(
|
|
7548
|
+
_parse(input2) {
|
|
7549
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
7547
7550
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
7548
7551
|
addIssueToContext(ctx, {
|
|
7549
7552
|
code: ZodIssueCode.invalid_type,
|
|
@@ -7595,8 +7598,8 @@ var ZodMap = class extends ZodType {
|
|
|
7595
7598
|
get valueSchema() {
|
|
7596
7599
|
return this._def.valueType;
|
|
7597
7600
|
}
|
|
7598
|
-
_parse(
|
|
7599
|
-
const { status, ctx } = this._processInputParams(
|
|
7601
|
+
_parse(input2) {
|
|
7602
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
7600
7603
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
7601
7604
|
addIssueToContext(ctx, {
|
|
7602
7605
|
code: ZodIssueCode.invalid_type,
|
|
@@ -7655,8 +7658,8 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
7655
7658
|
});
|
|
7656
7659
|
};
|
|
7657
7660
|
var ZodSet = class _ZodSet extends ZodType {
|
|
7658
|
-
_parse(
|
|
7659
|
-
const { status, ctx } = this._processInputParams(
|
|
7661
|
+
_parse(input2) {
|
|
7662
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
7660
7663
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
7661
7664
|
addIssueToContext(ctx, {
|
|
7662
7665
|
code: ZodIssueCode.invalid_type,
|
|
@@ -7744,8 +7747,8 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
7744
7747
|
super(...arguments);
|
|
7745
7748
|
this.validate = this.implement;
|
|
7746
7749
|
}
|
|
7747
|
-
_parse(
|
|
7748
|
-
const { ctx } = this._processInputParams(
|
|
7750
|
+
_parse(input2) {
|
|
7751
|
+
const { ctx } = this._processInputParams(input2);
|
|
7749
7752
|
if (ctx.parsedType !== ZodParsedType.function) {
|
|
7750
7753
|
addIssueToContext(ctx, {
|
|
7751
7754
|
code: ZodIssueCode.invalid_type,
|
|
@@ -7848,8 +7851,8 @@ var ZodLazy = class extends ZodType {
|
|
|
7848
7851
|
get schema() {
|
|
7849
7852
|
return this._def.getter();
|
|
7850
7853
|
}
|
|
7851
|
-
_parse(
|
|
7852
|
-
const { ctx } = this._processInputParams(
|
|
7854
|
+
_parse(input2) {
|
|
7855
|
+
const { ctx } = this._processInputParams(input2);
|
|
7853
7856
|
const lazySchema = this._def.getter();
|
|
7854
7857
|
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
7855
7858
|
}
|
|
@@ -7862,9 +7865,9 @@ ZodLazy.create = (getter, params) => {
|
|
|
7862
7865
|
});
|
|
7863
7866
|
};
|
|
7864
7867
|
var ZodLiteral = class extends ZodType {
|
|
7865
|
-
_parse(
|
|
7866
|
-
if (
|
|
7867
|
-
const ctx = this._getOrReturnCtx(
|
|
7868
|
+
_parse(input2) {
|
|
7869
|
+
if (input2.data !== this._def.value) {
|
|
7870
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
7868
7871
|
addIssueToContext(ctx, {
|
|
7869
7872
|
received: ctx.data,
|
|
7870
7873
|
code: ZodIssueCode.invalid_literal,
|
|
@@ -7872,7 +7875,7 @@ var ZodLiteral = class extends ZodType {
|
|
|
7872
7875
|
});
|
|
7873
7876
|
return INVALID;
|
|
7874
7877
|
}
|
|
7875
|
-
return { status: "valid", value:
|
|
7878
|
+
return { status: "valid", value: input2.data };
|
|
7876
7879
|
}
|
|
7877
7880
|
get value() {
|
|
7878
7881
|
return this._def.value;
|
|
@@ -7893,9 +7896,9 @@ function createZodEnum(values, params) {
|
|
|
7893
7896
|
});
|
|
7894
7897
|
}
|
|
7895
7898
|
var ZodEnum = class _ZodEnum extends ZodType {
|
|
7896
|
-
_parse(
|
|
7897
|
-
if (typeof
|
|
7898
|
-
const ctx = this._getOrReturnCtx(
|
|
7899
|
+
_parse(input2) {
|
|
7900
|
+
if (typeof input2.data !== "string") {
|
|
7901
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
7899
7902
|
const expectedValues = this._def.values;
|
|
7900
7903
|
addIssueToContext(ctx, {
|
|
7901
7904
|
expected: util.joinValues(expectedValues),
|
|
@@ -7907,8 +7910,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
7907
7910
|
if (!this._cache) {
|
|
7908
7911
|
this._cache = new Set(this._def.values);
|
|
7909
7912
|
}
|
|
7910
|
-
if (!this._cache.has(
|
|
7911
|
-
const ctx = this._getOrReturnCtx(
|
|
7913
|
+
if (!this._cache.has(input2.data)) {
|
|
7914
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
7912
7915
|
const expectedValues = this._def.values;
|
|
7913
7916
|
addIssueToContext(ctx, {
|
|
7914
7917
|
received: ctx.data,
|
|
@@ -7917,7 +7920,7 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
7917
7920
|
});
|
|
7918
7921
|
return INVALID;
|
|
7919
7922
|
}
|
|
7920
|
-
return OK(
|
|
7923
|
+
return OK(input2.data);
|
|
7921
7924
|
}
|
|
7922
7925
|
get options() {
|
|
7923
7926
|
return this._def.values;
|
|
@@ -7958,9 +7961,9 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
7958
7961
|
};
|
|
7959
7962
|
ZodEnum.create = createZodEnum;
|
|
7960
7963
|
var ZodNativeEnum = class extends ZodType {
|
|
7961
|
-
_parse(
|
|
7964
|
+
_parse(input2) {
|
|
7962
7965
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
7963
|
-
const ctx = this._getOrReturnCtx(
|
|
7966
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
7964
7967
|
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
7965
7968
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
7966
7969
|
addIssueToContext(ctx, {
|
|
@@ -7973,7 +7976,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
7973
7976
|
if (!this._cache) {
|
|
7974
7977
|
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
7975
7978
|
}
|
|
7976
|
-
if (!this._cache.has(
|
|
7979
|
+
if (!this._cache.has(input2.data)) {
|
|
7977
7980
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
7978
7981
|
addIssueToContext(ctx, {
|
|
7979
7982
|
received: ctx.data,
|
|
@@ -7982,7 +7985,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
7982
7985
|
});
|
|
7983
7986
|
return INVALID;
|
|
7984
7987
|
}
|
|
7985
|
-
return OK(
|
|
7988
|
+
return OK(input2.data);
|
|
7986
7989
|
}
|
|
7987
7990
|
get enum() {
|
|
7988
7991
|
return this._def.values;
|
|
@@ -7999,8 +8002,8 @@ var ZodPromise = class extends ZodType {
|
|
|
7999
8002
|
unwrap() {
|
|
8000
8003
|
return this._def.type;
|
|
8001
8004
|
}
|
|
8002
|
-
_parse(
|
|
8003
|
-
const { ctx } = this._processInputParams(
|
|
8005
|
+
_parse(input2) {
|
|
8006
|
+
const { ctx } = this._processInputParams(input2);
|
|
8004
8007
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
8005
8008
|
addIssueToContext(ctx, {
|
|
8006
8009
|
code: ZodIssueCode.invalid_type,
|
|
@@ -8032,8 +8035,8 @@ var ZodEffects = class extends ZodType {
|
|
|
8032
8035
|
sourceType() {
|
|
8033
8036
|
return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
8034
8037
|
}
|
|
8035
|
-
_parse(
|
|
8036
|
-
const { status, ctx } = this._processInputParams(
|
|
8038
|
+
_parse(input2) {
|
|
8039
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
8037
8040
|
const effect = this._def.effect || null;
|
|
8038
8041
|
const checkCtx = {
|
|
8039
8042
|
addIssue: (arg) => {
|
|
@@ -8165,12 +8168,12 @@ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
|
|
|
8165
8168
|
});
|
|
8166
8169
|
};
|
|
8167
8170
|
var ZodOptional = class extends ZodType {
|
|
8168
|
-
_parse(
|
|
8169
|
-
const parsedType = this._getType(
|
|
8171
|
+
_parse(input2) {
|
|
8172
|
+
const parsedType = this._getType(input2);
|
|
8170
8173
|
if (parsedType === ZodParsedType.undefined) {
|
|
8171
8174
|
return OK(void 0);
|
|
8172
8175
|
}
|
|
8173
|
-
return this._def.innerType._parse(
|
|
8176
|
+
return this._def.innerType._parse(input2);
|
|
8174
8177
|
}
|
|
8175
8178
|
unwrap() {
|
|
8176
8179
|
return this._def.innerType;
|
|
@@ -8184,12 +8187,12 @@ ZodOptional.create = (type, params) => {
|
|
|
8184
8187
|
});
|
|
8185
8188
|
};
|
|
8186
8189
|
var ZodNullable = class extends ZodType {
|
|
8187
|
-
_parse(
|
|
8188
|
-
const parsedType = this._getType(
|
|
8190
|
+
_parse(input2) {
|
|
8191
|
+
const parsedType = this._getType(input2);
|
|
8189
8192
|
if (parsedType === ZodParsedType.null) {
|
|
8190
8193
|
return OK(null);
|
|
8191
8194
|
}
|
|
8192
|
-
return this._def.innerType._parse(
|
|
8195
|
+
return this._def.innerType._parse(input2);
|
|
8193
8196
|
}
|
|
8194
8197
|
unwrap() {
|
|
8195
8198
|
return this._def.innerType;
|
|
@@ -8203,8 +8206,8 @@ ZodNullable.create = (type, params) => {
|
|
|
8203
8206
|
});
|
|
8204
8207
|
};
|
|
8205
8208
|
var ZodDefault = class extends ZodType {
|
|
8206
|
-
_parse(
|
|
8207
|
-
const { ctx } = this._processInputParams(
|
|
8209
|
+
_parse(input2) {
|
|
8210
|
+
const { ctx } = this._processInputParams(input2);
|
|
8208
8211
|
let data = ctx.data;
|
|
8209
8212
|
if (ctx.parsedType === ZodParsedType.undefined) {
|
|
8210
8213
|
data = this._def.defaultValue();
|
|
@@ -8228,8 +8231,8 @@ ZodDefault.create = (type, params) => {
|
|
|
8228
8231
|
});
|
|
8229
8232
|
};
|
|
8230
8233
|
var ZodCatch = class extends ZodType {
|
|
8231
|
-
_parse(
|
|
8232
|
-
const { ctx } = this._processInputParams(
|
|
8234
|
+
_parse(input2) {
|
|
8235
|
+
const { ctx } = this._processInputParams(input2);
|
|
8233
8236
|
const newCtx = {
|
|
8234
8237
|
...ctx,
|
|
8235
8238
|
common: {
|
|
@@ -8281,10 +8284,10 @@ ZodCatch.create = (type, params) => {
|
|
|
8281
8284
|
});
|
|
8282
8285
|
};
|
|
8283
8286
|
var ZodNaN = class extends ZodType {
|
|
8284
|
-
_parse(
|
|
8285
|
-
const parsedType = this._getType(
|
|
8287
|
+
_parse(input2) {
|
|
8288
|
+
const parsedType = this._getType(input2);
|
|
8286
8289
|
if (parsedType !== ZodParsedType.nan) {
|
|
8287
|
-
const ctx = this._getOrReturnCtx(
|
|
8290
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
8288
8291
|
addIssueToContext(ctx, {
|
|
8289
8292
|
code: ZodIssueCode.invalid_type,
|
|
8290
8293
|
expected: ZodParsedType.nan,
|
|
@@ -8292,7 +8295,7 @@ var ZodNaN = class extends ZodType {
|
|
|
8292
8295
|
});
|
|
8293
8296
|
return INVALID;
|
|
8294
8297
|
}
|
|
8295
|
-
return { status: "valid", value:
|
|
8298
|
+
return { status: "valid", value: input2.data };
|
|
8296
8299
|
}
|
|
8297
8300
|
};
|
|
8298
8301
|
ZodNaN.create = (params) => {
|
|
@@ -8303,8 +8306,8 @@ ZodNaN.create = (params) => {
|
|
|
8303
8306
|
};
|
|
8304
8307
|
var BRAND = /* @__PURE__ */ Symbol("zod_brand");
|
|
8305
8308
|
var ZodBranded = class extends ZodType {
|
|
8306
|
-
_parse(
|
|
8307
|
-
const { ctx } = this._processInputParams(
|
|
8309
|
+
_parse(input2) {
|
|
8310
|
+
const { ctx } = this._processInputParams(input2);
|
|
8308
8311
|
const data = ctx.data;
|
|
8309
8312
|
return this._def.type._parse({
|
|
8310
8313
|
data,
|
|
@@ -8317,8 +8320,8 @@ var ZodBranded = class extends ZodType {
|
|
|
8317
8320
|
}
|
|
8318
8321
|
};
|
|
8319
8322
|
var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
8320
|
-
_parse(
|
|
8321
|
-
const { status, ctx } = this._processInputParams(
|
|
8323
|
+
_parse(input2) {
|
|
8324
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
8322
8325
|
if (ctx.common.async) {
|
|
8323
8326
|
const handleAsync = async () => {
|
|
8324
8327
|
const inResult = await this._def.in._parseAsync({
|
|
@@ -8372,8 +8375,8 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
|
8372
8375
|
}
|
|
8373
8376
|
};
|
|
8374
8377
|
var ZodReadonly = class extends ZodType {
|
|
8375
|
-
_parse(
|
|
8376
|
-
const result = this._def.innerType._parse(
|
|
8378
|
+
_parse(input2) {
|
|
8379
|
+
const result = this._def.innerType._parse(input2);
|
|
8377
8380
|
const freeze = (data) => {
|
|
8378
8381
|
if (isValid(data)) {
|
|
8379
8382
|
data.value = Object.freeze(data.value);
|
|
@@ -8545,8 +8548,8 @@ var ConfigSchema = external_exports.object({
|
|
|
8545
8548
|
installedAt: external_exports.string().optional()
|
|
8546
8549
|
}).optional()
|
|
8547
8550
|
});
|
|
8548
|
-
var DEFAULT_API_ENDPOINT = "https://
|
|
8549
|
-
var DEFAULT_WEB_URL = "https://
|
|
8551
|
+
var DEFAULT_API_ENDPOINT = "https://refly-api.powerformer.net";
|
|
8552
|
+
var DEFAULT_WEB_URL = "https://refly.powerformer.net";
|
|
8550
8553
|
var DEFAULT_CONFIG = {
|
|
8551
8554
|
version: 1,
|
|
8552
8555
|
api: {
|
|
@@ -9580,7 +9583,7 @@ async function verifyConnection() {
|
|
|
9580
9583
|
|
|
9581
9584
|
// src/commands/login.ts
|
|
9582
9585
|
init_logger();
|
|
9583
|
-
|
|
9586
|
+
var CLI_VERSION = "0.1.0";
|
|
9584
9587
|
var loginCommand = new Command("login").description("Authenticate with Refly").option("-k, --api-key <key>", "Authenticate using an API key").action(async (options) => {
|
|
9585
9588
|
try {
|
|
9586
9589
|
if (options.apiKey) {
|
|
@@ -9636,7 +9639,7 @@ async function loginWithDeviceFlow() {
|
|
|
9636
9639
|
const initResponse = await apiRequest("/v1/auth/cli/device/init", {
|
|
9637
9640
|
method: "POST",
|
|
9638
9641
|
body: {
|
|
9639
|
-
cliVersion:
|
|
9642
|
+
cliVersion: CLI_VERSION,
|
|
9640
9643
|
host: hostname2
|
|
9641
9644
|
},
|
|
9642
9645
|
requireAuth: false
|
|
@@ -9676,7 +9679,7 @@ async function loginWithDeviceFlow() {
|
|
|
9676
9679
|
process.exit(1);
|
|
9677
9680
|
});
|
|
9678
9681
|
const webUrl = getWebUrl();
|
|
9679
|
-
const authUrl = `${webUrl}/cli/auth?device_id=${encodeURIComponent(deviceId)}&cli_version=${encodeURIComponent(
|
|
9682
|
+
const authUrl = `${webUrl}/cli/auth?device_id=${encodeURIComponent(deviceId)}&cli_version=${encodeURIComponent(CLI_VERSION)}&host=${encodeURIComponent(hostname2)}`;
|
|
9680
9683
|
process.stderr.write("\n");
|
|
9681
9684
|
process.stderr.write("To authorize this device, open the following URL in your browser:\n");
|
|
9682
9685
|
process.stderr.write("\n");
|
|
@@ -9831,7 +9834,7 @@ function println(message) {
|
|
|
9831
9834
|
}
|
|
9832
9835
|
|
|
9833
9836
|
// src/commands/init.ts
|
|
9834
|
-
var DEFAULT_API_ENDPOINT2 = "https://
|
|
9837
|
+
var DEFAULT_API_ENDPOINT2 = "https://refly-api.powerformer.net";
|
|
9835
9838
|
var initCommand = new Command("init").description("Initialize Refly CLI, install skill files, and authenticate").option("--force", "Force reinstall even if already installed").option("--host <url>", "API server URL", DEFAULT_API_ENDPOINT2).option("--skip-login", "Skip automatic login after initialization").action(async (options) => {
|
|
9836
9839
|
try {
|
|
9837
9840
|
const { force, host, skipLogin } = options;
|
|
@@ -9990,6 +9993,7 @@ var logoutCommand = new Command("logout").description("Logout and remove stored
|
|
|
9990
9993
|
// src/commands/status.ts
|
|
9991
9994
|
init_cjs_shims();
|
|
9992
9995
|
init_paths();
|
|
9996
|
+
var CLI_VERSION2 = "0.1.0";
|
|
9993
9997
|
var statusCommand = new Command("status").description("Check CLI configuration and authentication status").action(async () => {
|
|
9994
9998
|
try {
|
|
9995
9999
|
loadConfig();
|
|
@@ -10016,7 +10020,7 @@ var statusCommand = new Command("status").description("Check CLI configuration a
|
|
|
10016
10020
|
}
|
|
10017
10021
|
}
|
|
10018
10022
|
const payload = {
|
|
10019
|
-
cli_version:
|
|
10023
|
+
cli_version: CLI_VERSION2,
|
|
10020
10024
|
config_dir: getReflyDir(),
|
|
10021
10025
|
api_endpoint: getApiEndpoint(),
|
|
10022
10026
|
auth_status: authStatus,
|
|
@@ -11294,86 +11298,6 @@ init_cjs_shims();
|
|
|
11294
11298
|
|
|
11295
11299
|
// src/commands/workflow/create.ts
|
|
11296
11300
|
init_cjs_shims();
|
|
11297
|
-
var SUPPORTED_NODE_TYPES = ["skill", "agent"];
|
|
11298
|
-
var UNSUPPORTED_NODE_FIELDS = ["prompt", "instruction", "content", "input"];
|
|
11299
|
-
var VARIABLE_PATTERN = /\{\{[^}]+\}\}/;
|
|
11300
|
-
function validateSimplifiedSpec(spec) {
|
|
11301
|
-
if (spec.version !== void 0) {
|
|
11302
|
-
return 'Field "version" is not supported in simplified format';
|
|
11303
|
-
}
|
|
11304
|
-
if (spec.metadata !== void 0) {
|
|
11305
|
-
return 'Field "metadata" is not supported in simplified format';
|
|
11306
|
-
}
|
|
11307
|
-
const nodes = spec.nodes;
|
|
11308
|
-
if (!nodes || !Array.isArray(nodes)) {
|
|
11309
|
-
return 'Spec must contain a "nodes" array';
|
|
11310
|
-
}
|
|
11311
|
-
if (nodes.length === 0) {
|
|
11312
|
-
return "Spec must contain at least one node";
|
|
11313
|
-
}
|
|
11314
|
-
for (const node of nodes) {
|
|
11315
|
-
if (!node.id || typeof node.id !== "string") {
|
|
11316
|
-
return 'Each node must have a string "id" field';
|
|
11317
|
-
}
|
|
11318
|
-
if (!node.type || typeof node.type !== "string") {
|
|
11319
|
-
return `Node "${node.id}": must have a string "type" field`;
|
|
11320
|
-
}
|
|
11321
|
-
if (node.type.startsWith("tool:")) {
|
|
11322
|
-
return `Node "${node.id}": type "tool:xxx" is not supported. Use type "skill" with toolsetKeys instead. Example: {"type":"skill","toolsetKeys":["${node.type.replace("tool:", "")}"]}`;
|
|
11323
|
-
}
|
|
11324
|
-
if (node.type === "start") {
|
|
11325
|
-
return `Node "${node.id}": type "start" is not supported. Start node is automatically created`;
|
|
11326
|
-
}
|
|
11327
|
-
if (!SUPPORTED_NODE_TYPES.includes(node.type)) {
|
|
11328
|
-
return `Node "${node.id}": type "${node.type}" is not supported. Use one of: ${SUPPORTED_NODE_TYPES.join(", ")}`;
|
|
11329
|
-
}
|
|
11330
|
-
for (const field of UNSUPPORTED_NODE_FIELDS) {
|
|
11331
|
-
if (node[field] !== void 0) {
|
|
11332
|
-
if (field === "prompt") {
|
|
11333
|
-
return `Node "${node.id}": field "prompt" is not supported. Use "query" instead`;
|
|
11334
|
-
}
|
|
11335
|
-
if (field === "input") {
|
|
11336
|
-
return `Node "${node.id}": field "input" is not supported. Use top-level "query" and "toolsetKeys" instead`;
|
|
11337
|
-
}
|
|
11338
|
-
return `Node "${node.id}": field "${field}" is not supported in simplified format`;
|
|
11339
|
-
}
|
|
11340
|
-
}
|
|
11341
|
-
if (node.query && typeof node.query === "string" && VARIABLE_PATTERN.test(node.query)) {
|
|
11342
|
-
return `Node "${node.id}": variable syntax "{{...}}" is not supported in query field`;
|
|
11343
|
-
}
|
|
11344
|
-
if (node.toolsetKeys !== void 0) {
|
|
11345
|
-
if (!Array.isArray(node.toolsetKeys)) {
|
|
11346
|
-
return `Node "${node.id}": "toolsetKeys" must be an array`;
|
|
11347
|
-
}
|
|
11348
|
-
for (const key of node.toolsetKeys) {
|
|
11349
|
-
if (typeof key !== "string") {
|
|
11350
|
-
return `Node "${node.id}": each item in "toolsetKeys" must be a string`;
|
|
11351
|
-
}
|
|
11352
|
-
}
|
|
11353
|
-
}
|
|
11354
|
-
if (node.dependsOn !== void 0) {
|
|
11355
|
-
if (!Array.isArray(node.dependsOn)) {
|
|
11356
|
-
return `Node "${node.id}": "dependsOn" must be an array`;
|
|
11357
|
-
}
|
|
11358
|
-
for (const dep of node.dependsOn) {
|
|
11359
|
-
if (typeof dep !== "string") {
|
|
11360
|
-
return `Node "${node.id}": each item in "dependsOn" must be a string`;
|
|
11361
|
-
}
|
|
11362
|
-
}
|
|
11363
|
-
}
|
|
11364
|
-
}
|
|
11365
|
-
const nodeIds = new Set(nodes.map((n) => n.id));
|
|
11366
|
-
for (const node of nodes) {
|
|
11367
|
-
if (node.dependsOn) {
|
|
11368
|
-
for (const dep of node.dependsOn) {
|
|
11369
|
-
if (!nodeIds.has(dep)) {
|
|
11370
|
-
return `Node "${node.id}": dependsOn references unknown node "${dep}"`;
|
|
11371
|
-
}
|
|
11372
|
-
}
|
|
11373
|
-
}
|
|
11374
|
-
}
|
|
11375
|
-
return null;
|
|
11376
|
-
}
|
|
11377
11301
|
var workflowCreateCommand = new Command("create").description("Create a workflow from a spec").requiredOption("--name <name>", "Workflow name").requiredOption("--spec <json>", "Workflow spec as JSON").option("--description <description>", "Workflow description").action(async (options) => {
|
|
11378
11302
|
try {
|
|
11379
11303
|
let spec;
|
|
@@ -11384,14 +11308,6 @@ var workflowCreateCommand = new Command("create").description("Create a workflow
|
|
|
11384
11308
|
fail(ErrorCodes.INVALID_INPUT, "Invalid JSON in --spec", {
|
|
11385
11309
|
hint: "Ensure the spec is valid JSON"
|
|
11386
11310
|
});
|
|
11387
|
-
return;
|
|
11388
|
-
}
|
|
11389
|
-
const validationError = validateSimplifiedSpec(spec);
|
|
11390
|
-
if (validationError) {
|
|
11391
|
-
fail(ErrorCodes.INVALID_INPUT, validationError, {
|
|
11392
|
-
hint: 'Use simplified format: [{"id":"node1","type":"skill","query":"...","toolsetKeys":["tool_name"],"dependsOn":["other_node"]}]'
|
|
11393
|
-
});
|
|
11394
|
-
return;
|
|
11395
11311
|
}
|
|
11396
11312
|
const result = await apiRequest("/v1/cli/workflow", {
|
|
11397
11313
|
method: "POST",
|
|
@@ -11674,33 +11590,159 @@ var workflowDeleteCommand = new Command("delete").description("Delete a workflow
|
|
|
11674
11590
|
|
|
11675
11591
|
// src/commands/workflow/run.ts
|
|
11676
11592
|
init_cjs_shims();
|
|
11677
|
-
var
|
|
11593
|
+
var readline = __toESM(require("readline/promises"));
|
|
11594
|
+
var import_node_process7 = require("process");
|
|
11595
|
+
async function confirmAction(question) {
|
|
11596
|
+
const rl = readline.createInterface({ input: import_node_process7.stdin, output: import_node_process7.stdout });
|
|
11678
11597
|
try {
|
|
11679
|
-
|
|
11598
|
+
const answer = await rl.question(`${question} (y/N): `);
|
|
11599
|
+
return answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
|
|
11600
|
+
} finally {
|
|
11601
|
+
rl.close();
|
|
11602
|
+
}
|
|
11603
|
+
}
|
|
11604
|
+
async function pollToolsStatus(workflowId, maxWaitTime = 15 * 60 * 1e3, pollInterval = 2e3) {
|
|
11605
|
+
const startTime = Date.now();
|
|
11606
|
+
console.log("\nWaiting for tool authorization...");
|
|
11607
|
+
console.log("This may take a few minutes. You can complete the authorization in your browser.");
|
|
11608
|
+
let previousRemainingCount = -1;
|
|
11609
|
+
while (Date.now() - startTime < maxWaitTime) {
|
|
11680
11610
|
try {
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11611
|
+
const result = await apiRequest(
|
|
11612
|
+
`/v1/cli/workflow/${workflowId}/tools-status`
|
|
11613
|
+
);
|
|
11614
|
+
if (result.authorized) {
|
|
11615
|
+
console.log("\n\u2705 All required tools are now authorized!");
|
|
11616
|
+
return true;
|
|
11617
|
+
}
|
|
11618
|
+
const remainingCount = result.unauthorizedTools.length;
|
|
11619
|
+
if (remainingCount !== previousRemainingCount) {
|
|
11620
|
+
console.log(
|
|
11621
|
+
`\u23F3 Still waiting... ${remainingCount} tool${remainingCount > 1 ? "s" : ""} remaining to authorize.`
|
|
11622
|
+
);
|
|
11623
|
+
previousRemainingCount = remainingCount;
|
|
11624
|
+
}
|
|
11625
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
11626
|
+
} catch (error) {
|
|
11627
|
+
console.log(`
|
|
11628
|
+
\u26A0\uFE0F Failed to check authorization status: ${error.message}`);
|
|
11629
|
+
console.log("Continuing to wait...");
|
|
11630
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
11690
11631
|
}
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11632
|
+
}
|
|
11633
|
+
console.log("\n\u23F0 Timeout waiting for tool authorization.");
|
|
11634
|
+
return false;
|
|
11635
|
+
}
|
|
11636
|
+
var promptToOpenBrowser = async (installUrl) => {
|
|
11637
|
+
const isInteractive = process.stdin?.isTTY ?? false;
|
|
11638
|
+
if (!isInteractive) {
|
|
11639
|
+
return false;
|
|
11640
|
+
}
|
|
11641
|
+
const rl = readline.createInterface({ input: import_node_process7.stdin, output: import_node_process7.stdout });
|
|
11642
|
+
try {
|
|
11643
|
+
const answer = await rl.question(
|
|
11644
|
+
`${installUrl}
|
|
11645
|
+
Open browser to view workflow tools? (y/N) > `
|
|
11646
|
+
);
|
|
11647
|
+
const normalized = answer.trim().toLowerCase();
|
|
11648
|
+
return normalized === "y" || normalized === "yes";
|
|
11649
|
+
} finally {
|
|
11650
|
+
rl.close();
|
|
11651
|
+
}
|
|
11652
|
+
};
|
|
11653
|
+
var buildInstallUrl = (workflowId) => {
|
|
11654
|
+
const webUrl = getWebUrl();
|
|
11655
|
+
return `${webUrl}/workflow/${workflowId}/install-tools`;
|
|
11656
|
+
};
|
|
11657
|
+
async function runWorkflow(workflowId, options) {
|
|
11658
|
+
let input2;
|
|
11659
|
+
try {
|
|
11660
|
+
input2 = JSON.parse(options?.input ?? "{}");
|
|
11661
|
+
} catch {
|
|
11662
|
+
fail(ErrorCodes.INVALID_INPUT, "Invalid JSON in --input", {
|
|
11663
|
+
hint: "Ensure the input is valid JSON"
|
|
11694
11664
|
});
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11665
|
+
}
|
|
11666
|
+
const body = { input: input2 };
|
|
11667
|
+
if (options?.fromNode) {
|
|
11668
|
+
body.startNodes = [options?.fromNode];
|
|
11669
|
+
}
|
|
11670
|
+
const result = await apiRequest(`/v1/cli/workflow/${workflowId}/run`, {
|
|
11671
|
+
method: "POST",
|
|
11672
|
+
body
|
|
11673
|
+
});
|
|
11674
|
+
const unauthorizedTools = Array.isArray(result?.unauthorizedTools) ? result.unauthorizedTools : [];
|
|
11675
|
+
if (unauthorizedTools.length > 0) {
|
|
11676
|
+
const toolNames = unauthorizedTools.map((tool) => tool.toolset?.name ?? "Unknown tool").join(", ");
|
|
11677
|
+
const installUrl = buildInstallUrl(workflowId);
|
|
11678
|
+
const shouldOpenBrowser = await promptToOpenBrowser(installUrl);
|
|
11679
|
+
if (shouldOpenBrowser) {
|
|
11680
|
+
try {
|
|
11681
|
+
await open_default(installUrl);
|
|
11682
|
+
console.log("\u2705 Browser opened successfully!");
|
|
11683
|
+
console.log("");
|
|
11684
|
+
console.log("Please install any required tools in your browser.");
|
|
11685
|
+
console.log("You can close the browser tab and return here when done.");
|
|
11686
|
+
console.log("");
|
|
11687
|
+
const allAuthorized = await pollToolsStatus(workflowId);
|
|
11688
|
+
if (allAuthorized) {
|
|
11689
|
+
console.log("");
|
|
11690
|
+
const shouldRunNow = await confirmAction(
|
|
11691
|
+
"All required tools are authorized now. Run workflow now?"
|
|
11692
|
+
);
|
|
11693
|
+
if (shouldRunNow) {
|
|
11694
|
+
console.log("");
|
|
11695
|
+
console.log("Running workflow...");
|
|
11696
|
+
return await runWorkflow(workflowId, options);
|
|
11697
|
+
} else {
|
|
11698
|
+
console.log("");
|
|
11699
|
+
console.log("Workflow is ready to run. You can run it later with:");
|
|
11700
|
+
console.log(` refly workflow run ${workflowId}`);
|
|
11701
|
+
return;
|
|
11702
|
+
}
|
|
11703
|
+
} else {
|
|
11704
|
+
console.log("");
|
|
11705
|
+
console.log(
|
|
11706
|
+
"Authorization timed out. You can try again later or install tools manually:"
|
|
11707
|
+
);
|
|
11708
|
+
console.log(` ${installUrl}`);
|
|
11709
|
+
console.log("");
|
|
11710
|
+
console.log("Then run the workflow with:");
|
|
11711
|
+
console.log(` refly workflow run ${workflowId}`);
|
|
11712
|
+
process.exit(1);
|
|
11713
|
+
}
|
|
11714
|
+
} catch {
|
|
11715
|
+
console.log("\u274C Could not open browser automatically.");
|
|
11716
|
+
console.log("Please visit this URL manually:");
|
|
11717
|
+
console.log(` ${installUrl}`);
|
|
11718
|
+
process.exit(1);
|
|
11719
|
+
}
|
|
11720
|
+
}
|
|
11721
|
+
fail(ErrorCodes.EXECUTION_FAILED, `Workflow contains unauthorized tools: ${toolNames}`, {
|
|
11722
|
+
hint: "Open browser to view all workflow tools and install the ones you need",
|
|
11723
|
+
details: {
|
|
11724
|
+
installUrl,
|
|
11725
|
+
unauthorizedTools: unauthorizedTools.map((tool) => ({
|
|
11726
|
+
name: tool.toolset?.name ?? "Unknown tool",
|
|
11727
|
+
type: tool.toolset?.type ?? "unknown",
|
|
11728
|
+
referencedNodes: Array.isArray(tool.referencedNodes) ? tool.referencedNodes.length : 0
|
|
11729
|
+
}))
|
|
11730
|
+
}
|
|
11703
11731
|
});
|
|
11732
|
+
}
|
|
11733
|
+
ok("workflow.run", {
|
|
11734
|
+
message: options?.fromNode ? `Workflow run started from node ${options?.fromNode}` : "Workflow run started",
|
|
11735
|
+
runId: result.runId,
|
|
11736
|
+
workflowId: result.workflowId,
|
|
11737
|
+
status: result.status,
|
|
11738
|
+
startNode: options?.fromNode || void 0,
|
|
11739
|
+
startedAt: result.startedAt,
|
|
11740
|
+
nextStep: `Check status with \`refly workflow status ${workflowId}\``
|
|
11741
|
+
});
|
|
11742
|
+
}
|
|
11743
|
+
var workflowRunCommand = new Command("run").description("Start a workflow execution").argument("<workflowId>", "Workflow ID to run").option("--input <json>", "Input variables as JSON", "{}").option("--from-node <nodeId>", "Start workflow execution from a specific node (Run From Here)").action(async (workflowId, options) => {
|
|
11744
|
+
try {
|
|
11745
|
+
await runWorkflow(workflowId, options);
|
|
11704
11746
|
} catch (error) {
|
|
11705
11747
|
if (error instanceof CLIError) {
|
|
11706
11748
|
fail(error.code, error.message, { details: error.details, hint: error.hint });
|
|
@@ -12059,36 +12101,36 @@ var workflowNodesCommand = new Command("nodes").description("List all nodes in a
|
|
|
12059
12101
|
try {
|
|
12060
12102
|
const result = await apiRequest(`/v1/cli/workflow/${workflowId}`);
|
|
12061
12103
|
const nodes = result.nodes.map((node) => {
|
|
12062
|
-
const
|
|
12104
|
+
const output3 = {
|
|
12063
12105
|
id: node.id,
|
|
12064
12106
|
type: node.type,
|
|
12065
12107
|
title: node.data?.title || node.data?.metadata?.title || void 0
|
|
12066
12108
|
};
|
|
12067
12109
|
if (options.includePosition && node.position) {
|
|
12068
|
-
|
|
12110
|
+
output3.position = node.position;
|
|
12069
12111
|
}
|
|
12070
12112
|
if (options.includeMetadata && node.data?.metadata) {
|
|
12071
|
-
|
|
12113
|
+
output3.metadata = node.data.metadata;
|
|
12072
12114
|
}
|
|
12073
|
-
return
|
|
12115
|
+
return output3;
|
|
12074
12116
|
});
|
|
12075
|
-
const
|
|
12117
|
+
const output2 = {
|
|
12076
12118
|
workflowId: result.workflowId,
|
|
12077
12119
|
workflowName: result.name,
|
|
12078
12120
|
nodeCount: nodes.length,
|
|
12079
12121
|
nodes
|
|
12080
12122
|
};
|
|
12081
12123
|
if (options.includeEdges && result.edges?.length) {
|
|
12082
|
-
|
|
12124
|
+
output2.edges = result.edges.map((edge) => ({
|
|
12083
12125
|
id: edge.id,
|
|
12084
12126
|
source: edge.source,
|
|
12085
12127
|
target: edge.target,
|
|
12086
12128
|
sourceHandle: edge.sourceHandle,
|
|
12087
12129
|
targetHandle: edge.targetHandle
|
|
12088
12130
|
}));
|
|
12089
|
-
|
|
12131
|
+
output2.edgeCount = result.edges.length;
|
|
12090
12132
|
}
|
|
12091
|
-
ok("workflow.nodes",
|
|
12133
|
+
ok("workflow.nodes", output2);
|
|
12092
12134
|
} catch (error) {
|
|
12093
12135
|
if (error instanceof CLIError) {
|
|
12094
12136
|
fail(error.code, error.message, { details: error.details, hint: error.hint });
|
|
@@ -12111,7 +12153,7 @@ var workflowNodeGetCommand = new Command("node").description("Get single node in
|
|
|
12111
12153
|
hint: `Use 'refly workflow nodes ${workflowId}' to list all nodes`
|
|
12112
12154
|
});
|
|
12113
12155
|
}
|
|
12114
|
-
const
|
|
12156
|
+
const output2 = {
|
|
12115
12157
|
workflowId: result.workflowId,
|
|
12116
12158
|
workflowName: result.name,
|
|
12117
12159
|
node: {
|
|
@@ -12134,14 +12176,14 @@ var workflowNodeGetCommand = new Command("node").description("Get single node in
|
|
|
12134
12176
|
sourceHandle: e.sourceHandle,
|
|
12135
12177
|
targetHandle: e.targetHandle
|
|
12136
12178
|
}));
|
|
12137
|
-
|
|
12179
|
+
output2.connections = {
|
|
12138
12180
|
incoming,
|
|
12139
12181
|
outgoing,
|
|
12140
12182
|
incomingCount: incoming.length,
|
|
12141
12183
|
outgoingCount: outgoing.length
|
|
12142
12184
|
};
|
|
12143
12185
|
}
|
|
12144
|
-
ok("workflow.node",
|
|
12186
|
+
ok("workflow.node", output2);
|
|
12145
12187
|
} catch (error) {
|
|
12146
12188
|
if (error instanceof CLIError) {
|
|
12147
12189
|
fail(error.code, error.message, { details: error.details, hint: error.hint });
|
|
@@ -12234,12 +12276,12 @@ async function fetchAndCache() {
|
|
|
12234
12276
|
init_cjs_shims();
|
|
12235
12277
|
var nodeRunCommand = new Command("run").description("Run a single node for debugging (currently supports skillResponse only)").requiredOption("--type <nodeType>", 'Node type to run (e.g., "skillResponse")').option("--query <query>", "Query text for skillResponse node").option("--input <json>", "Full input data as JSON (alternative to --query)").option("--config <json>", 'Node configuration as JSON (e.g., {"modelItemId": "..."})').action(async (options) => {
|
|
12236
12278
|
try {
|
|
12237
|
-
let
|
|
12279
|
+
let input2 = {};
|
|
12238
12280
|
if (options.query) {
|
|
12239
|
-
|
|
12281
|
+
input2 = { query: options.query };
|
|
12240
12282
|
} else if (options.input) {
|
|
12241
12283
|
try {
|
|
12242
|
-
|
|
12284
|
+
input2 = JSON.parse(options.input);
|
|
12243
12285
|
} catch {
|
|
12244
12286
|
fail(ErrorCodes.INVALID_INPUT, "Invalid JSON in --input", {
|
|
12245
12287
|
hint: "Ensure the input is valid JSON"
|
|
@@ -12262,7 +12304,7 @@ var nodeRunCommand = new Command("run").description("Run a single node for debug
|
|
|
12262
12304
|
method: "POST",
|
|
12263
12305
|
body: {
|
|
12264
12306
|
nodeType: options.type,
|
|
12265
|
-
input,
|
|
12307
|
+
input: input2,
|
|
12266
12308
|
config
|
|
12267
12309
|
}
|
|
12268
12310
|
});
|
|
@@ -12313,7 +12355,7 @@ var nodeResultCommand = new Command("result").description("Get node execution re
|
|
|
12313
12355
|
}
|
|
12314
12356
|
const lastStep = result.steps?.[result.steps.length - 1];
|
|
12315
12357
|
const content = lastStep?.content;
|
|
12316
|
-
const
|
|
12358
|
+
const output2 = {
|
|
12317
12359
|
resultId: result.resultId,
|
|
12318
12360
|
version: result.version,
|
|
12319
12361
|
title: result.title,
|
|
@@ -12324,7 +12366,7 @@ var nodeResultCommand = new Command("result").description("Get node execution re
|
|
|
12324
12366
|
updatedAt: result.updatedAt
|
|
12325
12367
|
};
|
|
12326
12368
|
if (options.includeSteps && result.steps) {
|
|
12327
|
-
|
|
12369
|
+
output2.steps = result.steps.map((step, index) => ({
|
|
12328
12370
|
stepIndex: index,
|
|
12329
12371
|
name: step.name,
|
|
12330
12372
|
content: step.content,
|
|
@@ -12346,19 +12388,19 @@ var nodeResultCommand = new Command("result").description("Get node execution re
|
|
|
12346
12388
|
}
|
|
12347
12389
|
}
|
|
12348
12390
|
}
|
|
12349
|
-
|
|
12391
|
+
output2.toolCalls = allToolCalls;
|
|
12350
12392
|
}
|
|
12351
12393
|
if (options.includeMessages && result.messages) {
|
|
12352
|
-
|
|
12394
|
+
output2.messages = result.messages.map((msg) => ({
|
|
12353
12395
|
messageId: msg.messageId,
|
|
12354
12396
|
type: msg.type,
|
|
12355
12397
|
content: msg.content
|
|
12356
12398
|
}));
|
|
12357
12399
|
}
|
|
12358
12400
|
if (result.errors?.length) {
|
|
12359
|
-
|
|
12401
|
+
output2.errors = result.errors;
|
|
12360
12402
|
}
|
|
12361
|
-
ok("node.result",
|
|
12403
|
+
ok("node.result", output2);
|
|
12362
12404
|
} catch (error) {
|
|
12363
12405
|
if (error instanceof CLIError) {
|
|
12364
12406
|
fail(error.code, error.message, { details: error.details, hint: error.hint });
|