@lambdacurry/arbor 0.13.1 → 0.13.2
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/arbor.js +10 -2
- package/package.json +1 -1
package/dist/arbor.js
CHANGED
|
@@ -18332,18 +18332,21 @@ function zodType(node) {
|
|
|
18332
18332
|
function unwrapForCli(node) {
|
|
18333
18333
|
let inner = node;
|
|
18334
18334
|
let optional2 = false;
|
|
18335
|
+
let nullable2 = false;
|
|
18335
18336
|
for (;; ) {
|
|
18336
18337
|
const type = zodType(inner);
|
|
18337
18338
|
if (type !== "optional" && type !== "nullable")
|
|
18338
18339
|
break;
|
|
18339
18340
|
if (type === "optional")
|
|
18340
18341
|
optional2 = true;
|
|
18342
|
+
if (type === "nullable")
|
|
18343
|
+
nullable2 = true;
|
|
18341
18344
|
const unwrapped = inner.unwrap?.();
|
|
18342
18345
|
if (!unwrapped)
|
|
18343
18346
|
break;
|
|
18344
18347
|
inner = unwrapped;
|
|
18345
18348
|
}
|
|
18346
|
-
return { inner, optional: optional2 };
|
|
18349
|
+
return { inner, optional: optional2, nullable: nullable2 };
|
|
18347
18350
|
}
|
|
18348
18351
|
function description(node) {
|
|
18349
18352
|
return node.description;
|
|
@@ -18384,12 +18387,13 @@ function primaryPositionalField(inputSchema) {
|
|
|
18384
18387
|
}
|
|
18385
18388
|
function flagsForSchema(inputSchema) {
|
|
18386
18389
|
return Object.entries(inputSchema).map(([field, raw]) => {
|
|
18387
|
-
const { inner, optional: optional2 } = unwrapForCli(raw);
|
|
18390
|
+
const { inner, optional: optional2, nullable: nullable2 } = unwrapForCli(raw);
|
|
18388
18391
|
return {
|
|
18389
18392
|
field,
|
|
18390
18393
|
flag: kebab(field),
|
|
18391
18394
|
kind: kindOf(inner),
|
|
18392
18395
|
required: !optional2,
|
|
18396
|
+
nullable: nullable2,
|
|
18393
18397
|
description: description(inner) ?? description(raw),
|
|
18394
18398
|
literal: isProseList(inner)
|
|
18395
18399
|
};
|
|
@@ -18428,6 +18432,10 @@ function buildInput(inputSchema, flags, command) {
|
|
|
18428
18432
|
field: spec.field
|
|
18429
18433
|
});
|
|
18430
18434
|
}
|
|
18435
|
+
if (spec.nullable && lastValue(raw) === "null") {
|
|
18436
|
+
input[spec.field] = null;
|
|
18437
|
+
continue;
|
|
18438
|
+
}
|
|
18431
18439
|
switch (spec.kind) {
|
|
18432
18440
|
case "number": {
|
|
18433
18441
|
const n = Number(lastValue(raw));
|
package/package.json
CHANGED