@cavelon/cli 0.2.9 → 0.2.11

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.
@@ -15683,6 +15683,7 @@ __export(util_exports, {
15683
15683
  required: () => required,
15684
15684
  safeExtend: () => safeExtend,
15685
15685
  shallowClone: () => shallowClone,
15686
+ sizeCaps: () => sizeCaps,
15686
15687
  slugify: () => slugify,
15687
15688
  stringifyPrimitive: () => stringifyPrimitive,
15688
15689
  toZod: () => toZod,
@@ -16202,6 +16203,18 @@ function prefixIssues(path4, issues) {
16202
16203
  function unwrapMessage(message) {
16203
16204
  return typeof message === "string" ? message : message?.message;
16204
16205
  }
16206
+ function sizeCaps(defChecks) {
16207
+ const caps = [];
16208
+ for (const ch of defChecks ?? []) {
16209
+ const d = ch._zod.def;
16210
+ if (!/_(length|size)$|_equals$/.test(d.check))
16211
+ break;
16212
+ const max = d.maximum ?? d.length ?? d.size;
16213
+ if (max >= 0)
16214
+ caps.push([max, ch]);
16215
+ }
16216
+ return caps;
16217
+ }
16205
16218
  function attachSchema(issues, start, inst) {
16206
16219
  var _a3;
16207
16220
  for (let i = start; i < issues.length; i++) {
@@ -17622,7 +17635,7 @@ ${content.join("\n")}
17622
17635
  var version = {
17623
17636
  major: 4,
17624
17637
  minor: 6,
17625
- patch: 5
17638
+ patch: 7
17626
17639
  };
17627
17640
 
17628
17641
  // node_modules/zod/v4/core/schemas.js
@@ -18378,6 +18391,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
18378
18391
  return payload;
18379
18392
  };
18380
18393
  });
18394
+ function capSize(inst, size) {
18395
+ const caps = sizeCaps(inst._zod.def.checks);
18396
+ if (!caps.length)
18397
+ return;
18398
+ const cap = Math.min(...caps.map((c) => c[0]));
18399
+ const parse5 = inst._zod.parse;
18400
+ inst._zod.parse = (payload, ctx) => {
18401
+ const n = size(payload.value);
18402
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
18403
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
18404
+ if (n > max && ch._zod.def.when(payload)) {
18405
+ const start = payload.issues.length;
18406
+ ch._zod.check(payload);
18407
+ payload.issues[start].continue = false;
18408
+ attachSchema(payload.issues, start, inst);
18409
+ return payload;
18410
+ }
18411
+ }
18412
+ }
18413
+ return parse5(payload, ctx);
18414
+ };
18415
+ }
18416
+ var arraySize = (input2) => Array.isArray(input2) ? input2.length : -1;
18417
+ var mapSize = (input2) => input2 instanceof Map ? input2.size : -1;
18418
+ var setSize = (input2) => input2 instanceof Set ? input2.size : -1;
18381
18419
  function handleArrayResult(result, final, index) {
18382
18420
  if (result.issues.length) {
18383
18421
  final.issues.push(...prefixIssues(index, result.issues));
@@ -18421,6 +18459,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
18421
18459
  }
18422
18460
  return payload;
18423
18461
  };
18462
+ capSize(inst, arraySize);
18424
18463
  });
18425
18464
  function handlePropertyResult(result, final, key, input2, optin, optout) {
18426
18465
  const isPresent = key in input2;
@@ -19377,6 +19416,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
19377
19416
  return Promise.all(proms).then(() => payload);
19378
19417
  return payload;
19379
19418
  };
19419
+ capSize(inst, mapSize);
19380
19420
  });
19381
19421
  function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
19382
19422
  if (keyResult.issues.length) {
@@ -19443,6 +19483,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
19443
19483
  return Promise.all(proms).then(() => payload);
19444
19484
  return payload;
19445
19485
  };
19486
+ capSize(inst, setSize);
19446
19487
  });
19447
19488
  function handleSetResult(result, final) {
19448
19489
  if (result.issues.length) {
@@ -28973,9 +29014,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
28973
29014
  doc.write(`}`);
28974
29015
  return outputVar;
28975
29016
  }
29017
+ function generateSizeGate(doc, schema, size) {
29018
+ for (const [max, check2] of sizeCaps(schema._zod.def.checks)) {
29019
+ doc.write(`if (${size} > ${numericOperand(max, check2._zod.def.check)}) return INVALID;`);
29020
+ }
29021
+ }
28976
29022
  function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
28977
29023
  const def = schema._zod.def;
28978
29024
  doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
29025
+ generateSizeGate(doc, schema, `${accessor}.length`);
28979
29026
  const outputVar = buildsValue ? newVar(ctx) : null;
28980
29027
  const iVar = newVar(ctx);
28981
29028
  const elemVar = newVar(ctx);
@@ -29375,6 +29422,7 @@ function literalPropertyKey(ctx, key) {
29375
29422
  function generateMapCheck(doc, ctx, schema, accessor) {
29376
29423
  const def = schema._zod.def;
29377
29424
  doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
29425
+ generateSizeGate(doc, schema, `${accessor}.size`);
29378
29426
  const outputVar = newVar(ctx);
29379
29427
  const kVar = newVar(ctx);
29380
29428
  const valVar = newVar(ctx);
@@ -29391,6 +29439,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
29391
29439
  function generateSetCheck(doc, ctx, schema, accessor) {
29392
29440
  const def = schema._zod.def;
29393
29441
  doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
29442
+ generateSizeGate(doc, schema, `${accessor}.size`);
29394
29443
  const outputVar = newVar(ctx);
29395
29444
  const valVar = newVar(ctx);
29396
29445
  doc.write(`const ${outputVar} = new Set();`);
@@ -15103,6 +15103,7 @@ __export(util_exports, {
15103
15103
  required: () => required,
15104
15104
  safeExtend: () => safeExtend,
15105
15105
  shallowClone: () => shallowClone,
15106
+ sizeCaps: () => sizeCaps,
15106
15107
  slugify: () => slugify,
15107
15108
  stringifyPrimitive: () => stringifyPrimitive,
15108
15109
  toZod: () => toZod,
@@ -15622,6 +15623,18 @@ function prefixIssues(path4, issues) {
15622
15623
  function unwrapMessage(message) {
15623
15624
  return typeof message === "string" ? message : message?.message;
15624
15625
  }
15626
+ function sizeCaps(defChecks) {
15627
+ const caps = [];
15628
+ for (const ch of defChecks ?? []) {
15629
+ const d = ch._zod.def;
15630
+ if (!/_(length|size)$|_equals$/.test(d.check))
15631
+ break;
15632
+ const max = d.maximum ?? d.length ?? d.size;
15633
+ if (max >= 0)
15634
+ caps.push([max, ch]);
15635
+ }
15636
+ return caps;
15637
+ }
15625
15638
  function attachSchema(issues, start, inst) {
15626
15639
  var _a3;
15627
15640
  for (let i = start; i < issues.length; i++) {
@@ -16681,7 +16694,7 @@ ${content.join("\n")}
16681
16694
  var version = {
16682
16695
  major: 4,
16683
16696
  minor: 6,
16684
- patch: 5
16697
+ patch: 7
16685
16698
  };
16686
16699
 
16687
16700
  // node_modules/zod/v4/core/schemas.js
@@ -17255,6 +17268,29 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
17255
17268
  return payload;
17256
17269
  };
17257
17270
  });
17271
+ function capSize(inst, size) {
17272
+ const caps = sizeCaps(inst._zod.def.checks);
17273
+ if (!caps.length)
17274
+ return;
17275
+ const cap = Math.min(...caps.map((c) => c[0]));
17276
+ const parse5 = inst._zod.parse;
17277
+ inst._zod.parse = (payload, ctx) => {
17278
+ const n = size(payload.value);
17279
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
17280
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
17281
+ if (n > max && ch._zod.def.when(payload)) {
17282
+ const start = payload.issues.length;
17283
+ ch._zod.check(payload);
17284
+ payload.issues[start].continue = false;
17285
+ attachSchema(payload.issues, start, inst);
17286
+ return payload;
17287
+ }
17288
+ }
17289
+ }
17290
+ return parse5(payload, ctx);
17291
+ };
17292
+ }
17293
+ var arraySize = (input) => Array.isArray(input) ? input.length : -1;
17258
17294
  function handleArrayResult(result, final, index) {
17259
17295
  if (result.issues.length) {
17260
17296
  final.issues.push(...prefixIssues(index, result.issues));
@@ -17298,6 +17334,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
17298
17334
  }
17299
17335
  return payload;
17300
17336
  };
17337
+ capSize(inst, arraySize);
17301
17338
  });
17302
17339
  function handlePropertyResult(result, final, key, input, optin, optout) {
17303
17340
  const isPresent = key in input;