hostctl 0.1.61 → 0.1.62
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/hostctl.js +24 -9
- package/dist/bin/hostctl.js.map +1 -1
- package/dist/index.js +24 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/hostctl.js
CHANGED
|
@@ -4043,7 +4043,7 @@ var ParamMap = class _ParamMap {
|
|
|
4043
4043
|
import * as z from "zod";
|
|
4044
4044
|
|
|
4045
4045
|
// src/version.ts
|
|
4046
|
-
var version = "0.1.
|
|
4046
|
+
var version = "0.1.62";
|
|
4047
4047
|
|
|
4048
4048
|
// src/app.ts
|
|
4049
4049
|
import { retryUntilDefined } from "ts-retry";
|
|
@@ -34251,27 +34251,42 @@ function unwrapSchema(schema) {
|
|
|
34251
34251
|
}
|
|
34252
34252
|
return { schema: current, optional, nullable };
|
|
34253
34253
|
}
|
|
34254
|
-
function formatSchemaLines(schema) {
|
|
34254
|
+
function formatSchemaLines(schema, depth = 0) {
|
|
34255
34255
|
if (!schema) return ["none"];
|
|
34256
|
-
const
|
|
34256
|
+
const { schema: base } = unwrapSchema(schema);
|
|
34257
|
+
if (!base) return ["none"];
|
|
34258
|
+
const def = base._def ?? base.def;
|
|
34259
|
+
const typeName = def?.typeName || def?.type;
|
|
34260
|
+
const indent = " ".repeat(depth);
|
|
34261
|
+
if (typeName === "ZodUnion" || typeName === "union") {
|
|
34262
|
+
const options = def?.options ?? [];
|
|
34263
|
+
if (!options.length) return [];
|
|
34264
|
+
const lines = [];
|
|
34265
|
+
lines.push(`${indent}- anyOf:`);
|
|
34266
|
+
options.forEach((option, idx) => {
|
|
34267
|
+
lines.push(`${indent} - option ${idx + 1}:`);
|
|
34268
|
+
lines.push(...formatSchemaLines(option, depth + 2));
|
|
34269
|
+
});
|
|
34270
|
+
return lines;
|
|
34271
|
+
}
|
|
34257
34272
|
const shapeSource = def?.shape || def?.shape_;
|
|
34258
34273
|
const shape = shapeSource ? typeof shapeSource === "function" ? shapeSource.call(def) : shapeSource : void 0;
|
|
34259
34274
|
if (shape && typeof shape === "object") {
|
|
34260
34275
|
const lines = Object.entries(shape).map(([key, val]) => {
|
|
34261
|
-
const
|
|
34262
|
-
const
|
|
34276
|
+
const { schema: fieldSchema, optional } = unwrapSchema(val);
|
|
34277
|
+
const summary2 = summarizeType(fieldSchema);
|
|
34278
|
+
const anyVal = fieldSchema ?? val;
|
|
34263
34279
|
const tn = anyVal?._def?.typeName || anyVal?.def?.type;
|
|
34264
34280
|
const typeString = summary2.type || (tn ? String(tn).replace(/^Zod/, "").toLowerCase() : void 0);
|
|
34265
34281
|
const desc = summary2.desc;
|
|
34266
|
-
const optional = ["ZodOptional", "optional", "ZodNullable", "nullable", "ZodDefault", "default"].includes(tn);
|
|
34267
34282
|
const typePart = typeString ? `: ${typeString}` : "";
|
|
34268
34283
|
const descPart = desc ? ` - ${desc}` : "";
|
|
34269
|
-
return
|
|
34284
|
+
return `${indent}- ${key}${optional ? "?" : ""}${typePart}${descPart}`;
|
|
34270
34285
|
}).filter(Boolean);
|
|
34271
34286
|
return lines;
|
|
34272
34287
|
}
|
|
34273
|
-
const summary = summarizeType(
|
|
34274
|
-
return summary.type ? [
|
|
34288
|
+
const summary = summarizeType(base);
|
|
34289
|
+
return summary.type ? [`${indent}- ${summary.type}${summary.desc ? ` - ${summary.desc}` : ""}`] : [];
|
|
34275
34290
|
}
|
|
34276
34291
|
|
|
34277
34292
|
// src/bin/hostctl.ts
|