pairit 0.3.8 → 0.3.10

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.
Files changed (2) hide show
  1. package/dist/index.js +365 -210
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1868,7 +1868,7 @@ var require_commander = __commonJS((exports) => {
1868
1868
  exports.InvalidOptionArgumentError = InvalidArgumentError;
1869
1869
  });
1870
1870
 
1871
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/identity.js
1871
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js
1872
1872
  var require_identity = __commonJS((exports) => {
1873
1873
  var ALIAS = Symbol.for("yaml.alias");
1874
1874
  var DOC = Symbol.for("yaml.document");
@@ -1922,7 +1922,7 @@ var require_identity = __commonJS((exports) => {
1922
1922
  exports.isSeq = isSeq;
1923
1923
  });
1924
1924
 
1925
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/visit.js
1925
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/visit.js
1926
1926
  var require_visit = __commonJS((exports) => {
1927
1927
  var identity = require_identity();
1928
1928
  var BREAK = Symbol("break visit");
@@ -2077,7 +2077,7 @@ var require_visit = __commonJS((exports) => {
2077
2077
  exports.visitAsync = visitAsync;
2078
2078
  });
2079
2079
 
2080
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/doc/directives.js
2080
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/doc/directives.js
2081
2081
  var require_directives = __commonJS((exports) => {
2082
2082
  var identity = require_identity();
2083
2083
  var visit = require_visit();
@@ -2229,7 +2229,7 @@ var require_directives = __commonJS((exports) => {
2229
2229
  exports.Directives = Directives;
2230
2230
  });
2231
2231
 
2232
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/doc/anchors.js
2232
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/doc/anchors.js
2233
2233
  var require_anchors = __commonJS((exports) => {
2234
2234
  var identity = require_identity();
2235
2235
  var visit = require_visit();
@@ -2291,7 +2291,7 @@ var require_anchors = __commonJS((exports) => {
2291
2291
  exports.findNewAnchor = findNewAnchor;
2292
2292
  });
2293
2293
 
2294
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/doc/applyReviver.js
2294
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/doc/applyReviver.js
2295
2295
  var require_applyReviver = __commonJS((exports) => {
2296
2296
  function applyReviver(reviver, obj, key, val) {
2297
2297
  if (val && typeof val === "object") {
@@ -2338,7 +2338,7 @@ var require_applyReviver = __commonJS((exports) => {
2338
2338
  exports.applyReviver = applyReviver;
2339
2339
  });
2340
2340
 
2341
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/toJS.js
2341
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/toJS.js
2342
2342
  var require_toJS = __commonJS((exports) => {
2343
2343
  var identity = require_identity();
2344
2344
  function toJS(value, arg, ctx) {
@@ -2365,7 +2365,7 @@ var require_toJS = __commonJS((exports) => {
2365
2365
  exports.toJS = toJS;
2366
2366
  });
2367
2367
 
2368
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/Node.js
2368
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/Node.js
2369
2369
  var require_Node = __commonJS((exports) => {
2370
2370
  var applyReviver = require_applyReviver();
2371
2371
  var identity = require_identity();
@@ -2402,7 +2402,7 @@ var require_Node = __commonJS((exports) => {
2402
2402
  exports.NodeBase = NodeBase;
2403
2403
  });
2404
2404
 
2405
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/Alias.js
2405
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/Alias.js
2406
2406
  var require_Alias = __commonJS((exports) => {
2407
2407
  var anchors = require_anchors();
2408
2408
  var visit = require_visit();
@@ -2421,8 +2421,6 @@ var require_Alias = __commonJS((exports) => {
2421
2421
  });
2422
2422
  }
2423
2423
  resolve(doc, ctx) {
2424
- if (ctx?.maxAliasCount === 0)
2425
- throw new ReferenceError("Alias resolution is disabled");
2426
2424
  let nodes;
2427
2425
  if (ctx?.aliasResolveCache) {
2428
2426
  nodes = ctx.aliasResolveCache;
@@ -2444,38 +2442,36 @@ var require_Alias = __commonJS((exports) => {
2444
2442
  if (node.anchor === this.source)
2445
2443
  found = node;
2446
2444
  }
2447
- if (found && ctx) {
2448
- const { anchors: anchors2, doc: doc2, maxAliasCount } = ctx;
2449
- let data = anchors2.get(found);
2450
- if (!data) {
2451
- toJS.toJS(found, null, ctx);
2452
- data = anchors2.get(found);
2453
- }
2454
- if (data?.res === undefined) {
2455
- const msg = "This should not happen: Alias anchor was not resolved?";
2456
- throw new ReferenceError(msg);
2457
- }
2458
- if (maxAliasCount >= 0) {
2459
- data.count += 1;
2460
- if (data.aliasCount === 0)
2461
- data.aliasCount = getAliasCount(doc2, found, anchors2);
2462
- if (data.count * data.aliasCount > maxAliasCount) {
2463
- const msg = "Excessive alias count indicates a resource exhaustion attack";
2464
- throw new ReferenceError(msg);
2465
- }
2466
- }
2467
- }
2468
2445
  return found;
2469
2446
  }
2470
2447
  toJSON(_arg, ctx) {
2471
2448
  if (!ctx)
2472
2449
  return { source: this.source };
2473
- const source = this.resolve(ctx.doc, ctx);
2450
+ const { anchors: anchors2, doc, maxAliasCount } = ctx;
2451
+ const source = this.resolve(doc, ctx);
2474
2452
  if (!source) {
2475
2453
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
2476
2454
  throw new ReferenceError(msg);
2477
2455
  }
2478
- return ctx.anchors.get(source).res;
2456
+ let data = anchors2.get(source);
2457
+ if (!data) {
2458
+ toJS.toJS(source, null, ctx);
2459
+ data = anchors2.get(source);
2460
+ }
2461
+ if (data?.res === undefined) {
2462
+ const msg = "This should not happen: Alias anchor was not resolved?";
2463
+ throw new ReferenceError(msg);
2464
+ }
2465
+ if (maxAliasCount >= 0) {
2466
+ data.count += 1;
2467
+ if (data.aliasCount === 0)
2468
+ data.aliasCount = getAliasCount(doc, source, anchors2);
2469
+ if (data.count * data.aliasCount > maxAliasCount) {
2470
+ const msg = "Excessive alias count indicates a resource exhaustion attack";
2471
+ throw new ReferenceError(msg);
2472
+ }
2473
+ }
2474
+ return data.res;
2479
2475
  }
2480
2476
  toString(ctx, _onComment, _onChompKeep) {
2481
2477
  const src = `*${this.source}`;
@@ -2514,7 +2510,7 @@ var require_Alias = __commonJS((exports) => {
2514
2510
  exports.Alias = Alias;
2515
2511
  });
2516
2512
 
2517
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/Scalar.js
2513
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/Scalar.js
2518
2514
  var require_Scalar = __commonJS((exports) => {
2519
2515
  var identity = require_identity();
2520
2516
  var Node = require_Node();
@@ -2542,7 +2538,7 @@ var require_Scalar = __commonJS((exports) => {
2542
2538
  exports.isScalarValue = isScalarValue;
2543
2539
  });
2544
2540
 
2545
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/doc/createNode.js
2541
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/doc/createNode.js
2546
2542
  var require_createNode = __commonJS((exports) => {
2547
2543
  var Alias = require_Alias();
2548
2544
  var identity = require_identity();
@@ -2614,7 +2610,7 @@ var require_createNode = __commonJS((exports) => {
2614
2610
  exports.createNode = createNode;
2615
2611
  });
2616
2612
 
2617
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/Collection.js
2613
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/Collection.js
2618
2614
  var require_Collection = __commonJS((exports) => {
2619
2615
  var createNode = require_createNode();
2620
2616
  var identity = require_identity();
@@ -2729,7 +2725,7 @@ var require_Collection = __commonJS((exports) => {
2729
2725
  exports.isEmptyPath = isEmptyPath;
2730
2726
  });
2731
2727
 
2732
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyComment.js
2728
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyComment.js
2733
2729
  var require_stringifyComment = __commonJS((exports) => {
2734
2730
  var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
2735
2731
  function indentComment(comment, indent) {
@@ -2746,7 +2742,7 @@ var require_stringifyComment = __commonJS((exports) => {
2746
2742
  exports.stringifyComment = stringifyComment;
2747
2743
  });
2748
2744
 
2749
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/foldFlowLines.js
2745
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/stringify/foldFlowLines.js
2750
2746
  var require_foldFlowLines = __commonJS((exports) => {
2751
2747
  var FOLD_FLOW = "flow";
2752
2748
  var FOLD_BLOCK = "block";
@@ -2883,7 +2879,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
2883
2879
  exports.foldFlowLines = foldFlowLines;
2884
2880
  });
2885
2881
 
2886
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyString.js
2882
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyString.js
2887
2883
  var require_stringifyString = __commonJS((exports) => {
2888
2884
  var Scalar = require_Scalar();
2889
2885
  var foldFlowLines = require_foldFlowLines();
@@ -3181,7 +3177,7 @@ ${indent}`);
3181
3177
  exports.stringifyString = stringifyString;
3182
3178
  });
3183
3179
 
3184
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringify.js
3180
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/stringify/stringify.js
3185
3181
  var require_stringify = __commonJS((exports) => {
3186
3182
  var anchors = require_anchors();
3187
3183
  var identity = require_identity();
@@ -3204,7 +3200,6 @@ var require_stringify = __commonJS((exports) => {
3204
3200
  nullStr: "null",
3205
3201
  simpleKeys: false,
3206
3202
  singleQuote: null,
3207
- trailingComma: false,
3208
3203
  trueStr: "true",
3209
3204
  verifyAliasOrder: true
3210
3205
  }, doc.schema.toStringOptions, options);
@@ -3302,7 +3297,7 @@ ${ctx.indent}${str}`;
3302
3297
  exports.stringify = stringify;
3303
3298
  });
3304
3299
 
3305
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyPair.js
3300
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyPair.js
3306
3301
  var require_stringifyPair = __commonJS((exports) => {
3307
3302
  var identity = require_identity();
3308
3303
  var Scalar = require_Scalar();
@@ -3438,7 +3433,7 @@ ${ctx.indent}`;
3438
3433
  exports.stringifyPair = stringifyPair;
3439
3434
  });
3440
3435
 
3441
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/log.js
3436
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/log.js
3442
3437
  var require_log = __commonJS((exports) => {
3443
3438
  var node_process = __require("process");
3444
3439
  function debug(logLevel, ...messages) {
@@ -3457,7 +3452,7 @@ var require_log = __commonJS((exports) => {
3457
3452
  exports.warn = warn;
3458
3453
  });
3459
3454
 
3460
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/merge.js
3455
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/merge.js
3461
3456
  var require_merge = __commonJS((exports) => {
3462
3457
  var identity = require_identity();
3463
3458
  var Scalar = require_Scalar();
@@ -3474,18 +3469,18 @@ var require_merge = __commonJS((exports) => {
3474
3469
  };
3475
3470
  var isMergeKey = (ctx, key) => (merge.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
3476
3471
  function addMergeToJSMap(ctx, map, value) {
3477
- const source = resolveAliasValue(ctx, value);
3478
- if (identity.isSeq(source))
3479
- for (const it of source.items)
3472
+ value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
3473
+ if (identity.isSeq(value))
3474
+ for (const it of value.items)
3480
3475
  mergeValue(ctx, map, it);
3481
- else if (Array.isArray(source))
3482
- for (const it of source)
3476
+ else if (Array.isArray(value))
3477
+ for (const it of value)
3483
3478
  mergeValue(ctx, map, it);
3484
3479
  else
3485
- mergeValue(ctx, map, source);
3480
+ mergeValue(ctx, map, value);
3486
3481
  }
3487
3482
  function mergeValue(ctx, map, value) {
3488
- const source = resolveAliasValue(ctx, value);
3483
+ const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;
3489
3484
  if (!identity.isMap(source))
3490
3485
  throw new Error("Merge sources must be maps or map aliases");
3491
3486
  const srcMap = source.toJSON(null, ctx, Map);
@@ -3506,15 +3501,12 @@ var require_merge = __commonJS((exports) => {
3506
3501
  }
3507
3502
  return map;
3508
3503
  }
3509
- function resolveAliasValue(ctx, value) {
3510
- return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
3511
- }
3512
3504
  exports.addMergeToJSMap = addMergeToJSMap;
3513
3505
  exports.isMergeKey = isMergeKey;
3514
3506
  exports.merge = merge;
3515
3507
  });
3516
3508
 
3517
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/addPairToJSMap.js
3509
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/addPairToJSMap.js
3518
3510
  var require_addPairToJSMap = __commonJS((exports) => {
3519
3511
  var log = require_log();
3520
3512
  var merge = require_merge();
@@ -3575,7 +3567,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
3575
3567
  exports.addPairToJSMap = addPairToJSMap;
3576
3568
  });
3577
3569
 
3578
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/Pair.js
3570
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/Pair.js
3579
3571
  var require_Pair = __commonJS((exports) => {
3580
3572
  var createNode = require_createNode();
3581
3573
  var stringifyPair = require_stringifyPair();
@@ -3613,7 +3605,7 @@ var require_Pair = __commonJS((exports) => {
3613
3605
  exports.createPair = createPair;
3614
3606
  });
3615
3607
 
3616
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyCollection.js
3608
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyCollection.js
3617
3609
  var require_stringifyCollection = __commonJS((exports) => {
3618
3610
  var identity = require_identity();
3619
3611
  var stringify = require_stringify();
@@ -3716,20 +3708,13 @@ ${indent}${line}` : `
3716
3708
  if (comment)
3717
3709
  reqNewline = true;
3718
3710
  let str = stringify.stringify(item, itemCtx, () => comment = null);
3719
- reqNewline || (reqNewline = lines.length > linesAtValue || str.includes(`
3720
- `));
3721
- if (i < items.length - 1) {
3711
+ if (i < items.length - 1)
3722
3712
  str += ",";
3723
- } else if (ctx.options.trailingComma) {
3724
- if (ctx.options.lineWidth > 0) {
3725
- reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str.length + 2) > ctx.options.lineWidth);
3726
- }
3727
- if (reqNewline) {
3728
- str += ",";
3729
- }
3730
- }
3731
3713
  if (comment)
3732
3714
  str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
3715
+ if (!reqNewline && (lines.length > linesAtValue || str.includes(`
3716
+ `)))
3717
+ reqNewline = true;
3733
3718
  lines.push(str);
3734
3719
  linesAtValue = lines.length;
3735
3720
  }
@@ -3765,7 +3750,7 @@ ${indent}${end}`;
3765
3750
  exports.stringifyCollection = stringifyCollection;
3766
3751
  });
3767
3752
 
3768
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/YAMLMap.js
3753
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLMap.js
3769
3754
  var require_YAMLMap = __commonJS((exports) => {
3770
3755
  var stringifyCollection = require_stringifyCollection();
3771
3756
  var addPairToJSMap = require_addPairToJSMap();
@@ -3892,7 +3877,7 @@ var require_YAMLMap = __commonJS((exports) => {
3892
3877
  exports.findPair = findPair;
3893
3878
  });
3894
3879
 
3895
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/common/map.js
3880
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/common/map.js
3896
3881
  var require_map = __commonJS((exports) => {
3897
3882
  var identity = require_identity();
3898
3883
  var YAMLMap = require_YAMLMap();
@@ -3911,7 +3896,7 @@ var require_map = __commonJS((exports) => {
3911
3896
  exports.map = map;
3912
3897
  });
3913
3898
 
3914
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/YAMLSeq.js
3899
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLSeq.js
3915
3900
  var require_YAMLSeq = __commonJS((exports) => {
3916
3901
  var createNode = require_createNode();
3917
3902
  var stringifyCollection = require_stringifyCollection();
@@ -4004,7 +3989,7 @@ var require_YAMLSeq = __commonJS((exports) => {
4004
3989
  exports.YAMLSeq = YAMLSeq;
4005
3990
  });
4006
3991
 
4007
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/common/seq.js
3992
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/common/seq.js
4008
3993
  var require_seq = __commonJS((exports) => {
4009
3994
  var identity = require_identity();
4010
3995
  var YAMLSeq = require_YAMLSeq();
@@ -4023,7 +4008,7 @@ var require_seq = __commonJS((exports) => {
4023
4008
  exports.seq = seq;
4024
4009
  });
4025
4010
 
4026
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/common/string.js
4011
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/common/string.js
4027
4012
  var require_string = __commonJS((exports) => {
4028
4013
  var stringifyString = require_stringifyString();
4029
4014
  var string = {
@@ -4039,7 +4024,7 @@ var require_string = __commonJS((exports) => {
4039
4024
  exports.string = string;
4040
4025
  });
4041
4026
 
4042
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/common/null.js
4027
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/common/null.js
4043
4028
  var require_null = __commonJS((exports) => {
4044
4029
  var Scalar = require_Scalar();
4045
4030
  var nullTag = {
@@ -4054,7 +4039,7 @@ var require_null = __commonJS((exports) => {
4054
4039
  exports.nullTag = nullTag;
4055
4040
  });
4056
4041
 
4057
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/core/bool.js
4042
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/core/bool.js
4058
4043
  var require_bool = __commonJS((exports) => {
4059
4044
  var Scalar = require_Scalar();
4060
4045
  var boolTag = {
@@ -4075,7 +4060,7 @@ var require_bool = __commonJS((exports) => {
4075
4060
  exports.boolTag = boolTag;
4076
4061
  });
4077
4062
 
4078
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyNumber.js
4063
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyNumber.js
4079
4064
  var require_stringifyNumber = __commonJS((exports) => {
4080
4065
  function stringifyNumber({ format, minFractionDigits, tag, value }) {
4081
4066
  if (typeof value === "bigint")
@@ -4084,7 +4069,7 @@ var require_stringifyNumber = __commonJS((exports) => {
4084
4069
  if (!isFinite(num))
4085
4070
  return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
4086
4071
  let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
4087
- if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
4072
+ if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
4088
4073
  let i = n.indexOf(".");
4089
4074
  if (i < 0) {
4090
4075
  i = n.length;
@@ -4099,7 +4084,7 @@ var require_stringifyNumber = __commonJS((exports) => {
4099
4084
  exports.stringifyNumber = stringifyNumber;
4100
4085
  });
4101
4086
 
4102
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/core/float.js
4087
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/core/float.js
4103
4088
  var require_float = __commonJS((exports) => {
4104
4089
  var Scalar = require_Scalar();
4105
4090
  var stringifyNumber = require_stringifyNumber();
@@ -4142,7 +4127,7 @@ var require_float = __commonJS((exports) => {
4142
4127
  exports.floatNaN = floatNaN;
4143
4128
  });
4144
4129
 
4145
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/core/int.js
4130
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/core/int.js
4146
4131
  var require_int = __commonJS((exports) => {
4147
4132
  var stringifyNumber = require_stringifyNumber();
4148
4133
  var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
@@ -4184,7 +4169,7 @@ var require_int = __commonJS((exports) => {
4184
4169
  exports.intOct = intOct;
4185
4170
  });
4186
4171
 
4187
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/core/schema.js
4172
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/core/schema.js
4188
4173
  var require_schema = __commonJS((exports) => {
4189
4174
  var map = require_map();
4190
4175
  var _null = require_null();
@@ -4209,7 +4194,7 @@ var require_schema = __commonJS((exports) => {
4209
4194
  exports.schema = schema;
4210
4195
  });
4211
4196
 
4212
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/json/schema.js
4197
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/json/schema.js
4213
4198
  var require_schema2 = __commonJS((exports) => {
4214
4199
  var Scalar = require_Scalar();
4215
4200
  var map = require_map();
@@ -4273,7 +4258,7 @@ var require_schema2 = __commonJS((exports) => {
4273
4258
  exports.schema = schema;
4274
4259
  });
4275
4260
 
4276
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/binary.js
4261
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js
4277
4262
  var require_binary = __commonJS((exports) => {
4278
4263
  var node_buffer = __require("buffer");
4279
4264
  var Scalar = require_Scalar();
@@ -4328,7 +4313,7 @@ var require_binary = __commonJS((exports) => {
4328
4313
  exports.binary = binary;
4329
4314
  });
4330
4315
 
4331
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
4316
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
4332
4317
  var require_pairs = __commonJS((exports) => {
4333
4318
  var identity = require_identity();
4334
4319
  var Pair = require_Pair();
@@ -4403,7 +4388,7 @@ ${cn.comment}` : item.comment;
4403
4388
  exports.resolvePairs = resolvePairs;
4404
4389
  });
4405
4390
 
4406
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/omap.js
4391
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js
4407
4392
  var require_omap = __commonJS((exports) => {
4408
4393
  var identity = require_identity();
4409
4394
  var toJS = require_toJS();
@@ -4475,7 +4460,7 @@ var require_omap = __commonJS((exports) => {
4475
4460
  exports.omap = omap;
4476
4461
  });
4477
4462
 
4478
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/bool.js
4463
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js
4479
4464
  var require_bool2 = __commonJS((exports) => {
4480
4465
  var Scalar = require_Scalar();
4481
4466
  function boolStringify({ value, source }, ctx) {
@@ -4504,7 +4489,7 @@ var require_bool2 = __commonJS((exports) => {
4504
4489
  exports.trueTag = trueTag;
4505
4490
  });
4506
4491
 
4507
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/float.js
4492
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/float.js
4508
4493
  var require_float2 = __commonJS((exports) => {
4509
4494
  var Scalar = require_Scalar();
4510
4495
  var stringifyNumber = require_stringifyNumber();
@@ -4550,7 +4535,7 @@ var require_float2 = __commonJS((exports) => {
4550
4535
  exports.floatNaN = floatNaN;
4551
4536
  });
4552
4537
 
4553
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/int.js
4538
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/int.js
4554
4539
  var require_int2 = __commonJS((exports) => {
4555
4540
  var stringifyNumber = require_stringifyNumber();
4556
4541
  var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
@@ -4626,7 +4611,7 @@ var require_int2 = __commonJS((exports) => {
4626
4611
  exports.intOct = intOct;
4627
4612
  });
4628
4613
 
4629
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/set.js
4614
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/set.js
4630
4615
  var require_set = __commonJS((exports) => {
4631
4616
  var identity = require_identity();
4632
4617
  var Pair = require_Pair();
@@ -4709,7 +4694,7 @@ var require_set = __commonJS((exports) => {
4709
4694
  exports.set = set;
4710
4695
  });
4711
4696
 
4712
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
4697
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
4713
4698
  var require_timestamp = __commonJS((exports) => {
4714
4699
  var stringifyNumber = require_stringifyNumber();
4715
4700
  function parseSexagesimal(str, asBigInt) {
@@ -4791,7 +4776,7 @@ var require_timestamp = __commonJS((exports) => {
4791
4776
  exports.timestamp = timestamp;
4792
4777
  });
4793
4778
 
4794
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/schema.js
4779
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js
4795
4780
  var require_schema3 = __commonJS((exports) => {
4796
4781
  var map = require_map();
4797
4782
  var _null = require_null();
@@ -4832,7 +4817,7 @@ var require_schema3 = __commonJS((exports) => {
4832
4817
  exports.schema = schema;
4833
4818
  });
4834
4819
 
4835
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/tags.js
4820
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/tags.js
4836
4821
  var require_tags = __commonJS((exports) => {
4837
4822
  var map = require_map();
4838
4823
  var _null = require_null();
@@ -4923,7 +4908,7 @@ var require_tags = __commonJS((exports) => {
4923
4908
  exports.getTags = getTags;
4924
4909
  });
4925
4910
 
4926
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/Schema.js
4911
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/schema/Schema.js
4927
4912
  var require_Schema = __commonJS((exports) => {
4928
4913
  var identity = require_identity();
4929
4914
  var map = require_map();
@@ -4953,7 +4938,7 @@ var require_Schema = __commonJS((exports) => {
4953
4938
  exports.Schema = Schema;
4954
4939
  });
4955
4940
 
4956
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyDocument.js
4941
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyDocument.js
4957
4942
  var require_stringifyDocument = __commonJS((exports) => {
4958
4943
  var identity = require_identity();
4959
4944
  var stringify = require_stringify();
@@ -5033,7 +5018,7 @@ var require_stringifyDocument = __commonJS((exports) => {
5033
5018
  exports.stringifyDocument = stringifyDocument;
5034
5019
  });
5035
5020
 
5036
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/doc/Document.js
5021
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/doc/Document.js
5037
5022
  var require_Document = __commonJS((exports) => {
5038
5023
  var Alias = require_Alias();
5039
5024
  var Collection = require_Collection();
@@ -5268,7 +5253,7 @@ var require_Document = __commonJS((exports) => {
5268
5253
  exports.Document = Document;
5269
5254
  });
5270
5255
 
5271
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/errors.js
5256
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/errors.js
5272
5257
  var require_errors = __commonJS((exports) => {
5273
5258
  class YAMLError extends Error {
5274
5259
  constructor(name, pos, code, message) {
@@ -5333,7 +5318,7 @@ ${pointer}
5333
5318
  exports.prettifyError = prettifyError;
5334
5319
  });
5335
5320
 
5336
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-props.js
5321
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-props.js
5337
5322
  var require_resolve_props = __commonJS((exports) => {
5338
5323
  function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
5339
5324
  let spaceBefore = false;
@@ -5463,7 +5448,7 @@ var require_resolve_props = __commonJS((exports) => {
5463
5448
  exports.resolveProps = resolveProps;
5464
5449
  });
5465
5450
 
5466
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/util-contains-newline.js
5451
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/util-contains-newline.js
5467
5452
  var require_util_contains_newline = __commonJS((exports) => {
5468
5453
  function containsNewline(key) {
5469
5454
  if (!key)
@@ -5503,7 +5488,7 @@ var require_util_contains_newline = __commonJS((exports) => {
5503
5488
  exports.containsNewline = containsNewline;
5504
5489
  });
5505
5490
 
5506
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/util-flow-indent-check.js
5491
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/util-flow-indent-check.js
5507
5492
  var require_util_flow_indent_check = __commonJS((exports) => {
5508
5493
  var utilContainsNewline = require_util_contains_newline();
5509
5494
  function flowIndentCheck(indent, fc, onError) {
@@ -5518,7 +5503,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
5518
5503
  exports.flowIndentCheck = flowIndentCheck;
5519
5504
  });
5520
5505
 
5521
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/util-map-includes.js
5506
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/util-map-includes.js
5522
5507
  var require_util_map_includes = __commonJS((exports) => {
5523
5508
  var identity = require_identity();
5524
5509
  function mapIncludes(ctx, items, search) {
@@ -5531,7 +5516,7 @@ var require_util_map_includes = __commonJS((exports) => {
5531
5516
  exports.mapIncludes = mapIncludes;
5532
5517
  });
5533
5518
 
5534
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-block-map.js
5519
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-map.js
5535
5520
  var require_resolve_block_map = __commonJS((exports) => {
5536
5521
  var Pair = require_Pair();
5537
5522
  var YAMLMap = require_YAMLMap();
@@ -5638,7 +5623,7 @@ var require_resolve_block_map = __commonJS((exports) => {
5638
5623
  exports.resolveBlockMap = resolveBlockMap;
5639
5624
  });
5640
5625
 
5641
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-block-seq.js
5626
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-seq.js
5642
5627
  var require_resolve_block_seq = __commonJS((exports) => {
5643
5628
  var YAMLSeq = require_YAMLSeq();
5644
5629
  var resolveProps = require_resolve_props();
@@ -5686,7 +5671,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
5686
5671
  exports.resolveBlockSeq = resolveBlockSeq;
5687
5672
  });
5688
5673
 
5689
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-end.js
5674
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-end.js
5690
5675
  var require_resolve_end = __commonJS((exports) => {
5691
5676
  function resolveEnd(end, offset, reqSpace, onError) {
5692
5677
  let comment = "";
@@ -5726,7 +5711,7 @@ var require_resolve_end = __commonJS((exports) => {
5726
5711
  exports.resolveEnd = resolveEnd;
5727
5712
  });
5728
5713
 
5729
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-flow-collection.js
5714
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-collection.js
5730
5715
  var require_resolve_flow_collection = __commonJS((exports) => {
5731
5716
  var identity = require_identity();
5732
5717
  var Pair = require_Pair();
@@ -5917,7 +5902,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
5917
5902
  exports.resolveFlowCollection = resolveFlowCollection;
5918
5903
  });
5919
5904
 
5920
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/compose-collection.js
5905
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/compose-collection.js
5921
5906
  var require_compose_collection = __commonJS((exports) => {
5922
5907
  var identity = require_identity();
5923
5908
  var Scalar = require_Scalar();
@@ -5979,7 +5964,7 @@ var require_compose_collection = __commonJS((exports) => {
5979
5964
  exports.composeCollection = composeCollection;
5980
5965
  });
5981
5966
 
5982
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-block-scalar.js
5967
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-scalar.js
5983
5968
  var require_resolve_block_scalar = __commonJS((exports) => {
5984
5969
  var Scalar = require_Scalar();
5985
5970
  function resolveBlockScalar(ctx, scalar, onError) {
@@ -6172,7 +6157,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
6172
6157
  exports.resolveBlockScalar = resolveBlockScalar;
6173
6158
  });
6174
6159
 
6175
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-flow-scalar.js
6160
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js
6176
6161
  var require_resolve_flow_scalar = __commonJS((exports) => {
6177
6162
  var Scalar = require_Scalar();
6178
6163
  var resolveEnd = require_resolve_end();
@@ -6237,32 +6222,33 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
6237
6222
  }
6238
6223
  if (badChar)
6239
6224
  onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`);
6240
- return unfoldLines(source);
6225
+ return foldLines(source);
6241
6226
  }
6242
6227
  function singleQuotedValue(source, onError) {
6243
6228
  if (source[source.length - 1] !== "'" || source.length === 1)
6244
6229
  onError(source.length, "MISSING_CHAR", "Missing closing 'quote");
6245
- return unfoldLines(source.slice(1, -1)).replace(/''/g, "'");
6230
+ return foldLines(source.slice(1, -1)).replace(/''/g, "'");
6246
6231
  }
6247
- function unfoldLines(source) {
6248
- const line = /(.*?)\r?\n/sy;
6249
- let match = line.exec(source);
6250
- if (!match)
6251
- return source;
6252
- let trimEnd, trimBoth;
6232
+ function foldLines(source) {
6233
+ let first, line;
6253
6234
  try {
6254
- trimEnd = new RegExp("(?<![ \t])[ \t]+$");
6255
- trimBoth = new RegExp("^[ \t]+|(?<![ \t])[ \t]+$", "g");
6235
+ first = new RegExp(`(.*?)(?<![ ])[ ]*\r?
6236
+ `, "sy");
6237
+ line = new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
6238
+ `, "sy");
6256
6239
  } catch {
6257
- trimEnd = /[ \t]+$/;
6258
- trimBoth = /^[ \t]+|[ \t]+$/g;
6240
+ first = /(.*?)[ \t]*\r?\n/sy;
6241
+ line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
6259
6242
  }
6260
- let res = match[1].replace(trimEnd, "");
6243
+ let match = first.exec(source);
6244
+ if (!match)
6245
+ return source;
6246
+ let res = match[1];
6261
6247
  let sep = " ";
6262
- let pos = line.lastIndex;
6248
+ let pos = first.lastIndex;
6249
+ line.lastIndex = pos;
6263
6250
  while (match = line.exec(source)) {
6264
- const lm = match[1].replace(trimBoth, "");
6265
- if (lm === "") {
6251
+ if (match[1] === "") {
6266
6252
  if (sep === `
6267
6253
  `)
6268
6254
  res += sep;
@@ -6270,7 +6256,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
6270
6256
  sep = `
6271
6257
  `;
6272
6258
  } else {
6273
- res += sep + lm;
6259
+ res += sep + match[1];
6274
6260
  sep = " ";
6275
6261
  }
6276
6262
  pos = line.lastIndex;
@@ -6308,7 +6294,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
6308
6294
  while (next === " " || next === "\t")
6309
6295
  next = source[++i + 1];
6310
6296
  } else if (next === "x" || next === "u" || next === "U") {
6311
- const length = next === "x" ? 2 : next === "u" ? 4 : 8;
6297
+ const length = { x: 2, u: 4, U: 8 }[next];
6312
6298
  res += parseCharCode(source, i + 1, length, onError);
6313
6299
  i += length;
6314
6300
  } else {
@@ -6377,18 +6363,17 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
6377
6363
  const cc = source.substr(offset, length);
6378
6364
  const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
6379
6365
  const code = ok ? parseInt(cc, 16) : NaN;
6380
- try {
6381
- return String.fromCodePoint(code);
6382
- } catch {
6366
+ if (isNaN(code)) {
6383
6367
  const raw = source.substr(offset - 2, length + 2);
6384
6368
  onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
6385
6369
  return raw;
6386
6370
  }
6371
+ return String.fromCodePoint(code);
6387
6372
  }
6388
6373
  exports.resolveFlowScalar = resolveFlowScalar;
6389
6374
  });
6390
6375
 
6391
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/compose-scalar.js
6376
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/compose-scalar.js
6392
6377
  var require_compose_scalar = __commonJS((exports) => {
6393
6378
  var identity = require_identity();
6394
6379
  var Scalar = require_Scalar();
@@ -6466,7 +6451,7 @@ var require_compose_scalar = __commonJS((exports) => {
6466
6451
  exports.composeScalar = composeScalar;
6467
6452
  });
6468
6453
 
6469
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/util-empty-scalar-position.js
6454
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js
6470
6455
  var require_util_empty_scalar_position = __commonJS((exports) => {
6471
6456
  function emptyScalarPosition(offset, before, pos) {
6472
6457
  if (before) {
@@ -6493,7 +6478,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
6493
6478
  exports.emptyScalarPosition = emptyScalarPosition;
6494
6479
  });
6495
6480
 
6496
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/compose-node.js
6481
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/compose-node.js
6497
6482
  var require_compose_node = __commonJS((exports) => {
6498
6483
  var Alias = require_Alias();
6499
6484
  var identity = require_identity();
@@ -6524,22 +6509,17 @@ var require_compose_node = __commonJS((exports) => {
6524
6509
  case "block-map":
6525
6510
  case "block-seq":
6526
6511
  case "flow-collection":
6527
- try {
6528
- node = composeCollection.composeCollection(CN, ctx, token, props, onError);
6529
- if (anchor)
6530
- node.anchor = anchor.source.substring(1);
6531
- } catch (error) {
6532
- const message = error instanceof Error ? error.message : String(error);
6533
- onError(token, "RESOURCE_EXHAUSTION", message);
6534
- }
6512
+ node = composeCollection.composeCollection(CN, ctx, token, props, onError);
6513
+ if (anchor)
6514
+ node.anchor = anchor.source.substring(1);
6535
6515
  break;
6536
6516
  default: {
6537
6517
  const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
6538
6518
  onError(token, "UNEXPECTED_TOKEN", message);
6519
+ node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
6539
6520
  isSrcToken = false;
6540
6521
  }
6541
6522
  }
6542
- node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
6543
6523
  if (anchor && node.anchor === "")
6544
6524
  onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
6545
6525
  if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
@@ -6596,7 +6576,7 @@ var require_compose_node = __commonJS((exports) => {
6596
6576
  exports.composeNode = composeNode;
6597
6577
  });
6598
6578
 
6599
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/compose-doc.js
6579
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/compose-doc.js
6600
6580
  var require_compose_doc = __commonJS((exports) => {
6601
6581
  var Document = require_Document();
6602
6582
  var composeNode = require_compose_node();
@@ -6636,7 +6616,7 @@ var require_compose_doc = __commonJS((exports) => {
6636
6616
  exports.composeDoc = composeDoc;
6637
6617
  });
6638
6618
 
6639
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/composer.js
6619
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/compose/composer.js
6640
6620
  var require_composer = __commonJS((exports) => {
6641
6621
  var node_process = __require("process");
6642
6622
  var directives = require_directives();
@@ -6722,10 +6702,8 @@ ${cb}` : comment;
6722
6702
  }
6723
6703
  }
6724
6704
  if (afterDoc) {
6725
- for (let i = 0;i < this.errors.length; ++i)
6726
- doc.errors.push(this.errors[i]);
6727
- for (let i = 0;i < this.warnings.length; ++i)
6728
- doc.warnings.push(this.warnings[i]);
6705
+ Array.prototype.push.apply(doc.errors, this.errors);
6706
+ Array.prototype.push.apply(doc.warnings, this.warnings);
6729
6707
  } else {
6730
6708
  doc.errors = this.errors;
6731
6709
  doc.warnings = this.warnings;
@@ -6827,7 +6805,7 @@ ${end.comment}` : end.comment;
6827
6805
  exports.Composer = Composer;
6828
6806
  });
6829
6807
 
6830
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/cst-scalar.js
6808
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/parse/cst-scalar.js
6831
6809
  var require_cst_scalar = __commonJS((exports) => {
6832
6810
  var resolveBlockScalar = require_resolve_block_scalar();
6833
6811
  var resolveFlowScalar = require_resolve_flow_scalar();
@@ -7017,7 +6995,7 @@ var require_cst_scalar = __commonJS((exports) => {
7017
6995
  exports.setScalarValue = setScalarValue;
7018
6996
  });
7019
6997
 
7020
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/cst-stringify.js
6998
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/parse/cst-stringify.js
7021
6999
  var require_cst_stringify = __commonJS((exports) => {
7022
7000
  var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
7023
7001
  function stringifyToken(token) {
@@ -7075,7 +7053,7 @@ var require_cst_stringify = __commonJS((exports) => {
7075
7053
  exports.stringify = stringify;
7076
7054
  });
7077
7055
 
7078
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/cst-visit.js
7056
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/parse/cst-visit.js
7079
7057
  var require_cst_visit = __commonJS((exports) => {
7080
7058
  var BREAK = Symbol("break visit");
7081
7059
  var SKIP = Symbol("skip children");
@@ -7134,7 +7112,7 @@ var require_cst_visit = __commonJS((exports) => {
7134
7112
  exports.visit = visit;
7135
7113
  });
7136
7114
 
7137
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/cst.js
7115
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/parse/cst.js
7138
7116
  var require_cst = __commonJS((exports) => {
7139
7117
  var cstScalar = require_cst_scalar();
7140
7118
  var cstStringify = require_cst_stringify();
@@ -7235,7 +7213,7 @@ var require_cst = __commonJS((exports) => {
7235
7213
  exports.tokenType = tokenType;
7236
7214
  });
7237
7215
 
7238
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/lexer.js
7216
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/parse/lexer.js
7239
7217
  var require_lexer = __commonJS((exports) => {
7240
7218
  var cst = require_cst();
7241
7219
  function isEmpty(ch) {
@@ -7437,7 +7415,7 @@ var require_lexer = __commonJS((exports) => {
7437
7415
  const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
7438
7416
  this.indentNext = this.indentValue + 1;
7439
7417
  this.indentValue += n;
7440
- return "block-start";
7418
+ return yield* this.parseBlockStart();
7441
7419
  }
7442
7420
  return "doc";
7443
7421
  }
@@ -7744,37 +7722,26 @@ var require_lexer = __commonJS((exports) => {
7744
7722
  return 0;
7745
7723
  }
7746
7724
  *pushIndicators() {
7747
- let n = 0;
7748
- loop:
7749
- while (true) {
7750
- switch (this.charAt(0)) {
7751
- case "!":
7752
- n += yield* this.pushTag();
7753
- n += yield* this.pushSpaces(true);
7754
- continue loop;
7755
- case "&":
7756
- n += yield* this.pushUntil(isNotAnchorChar);
7757
- n += yield* this.pushSpaces(true);
7758
- continue loop;
7759
- case "-":
7760
- case "?":
7761
- case ":": {
7762
- const inFlow = this.flowLevel > 0;
7763
- const ch1 = this.charAt(1);
7764
- if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
7765
- if (!inFlow)
7766
- this.indentNext = this.indentValue + 1;
7767
- else if (this.flowKey)
7768
- this.flowKey = false;
7769
- n += yield* this.pushCount(1);
7770
- n += yield* this.pushSpaces(true);
7771
- continue loop;
7772
- }
7773
- }
7725
+ switch (this.charAt(0)) {
7726
+ case "!":
7727
+ return (yield* this.pushTag()) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
7728
+ case "&":
7729
+ return (yield* this.pushUntil(isNotAnchorChar)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
7730
+ case "-":
7731
+ case "?":
7732
+ case ":": {
7733
+ const inFlow = this.flowLevel > 0;
7734
+ const ch1 = this.charAt(1);
7735
+ if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
7736
+ if (!inFlow)
7737
+ this.indentNext = this.indentValue + 1;
7738
+ else if (this.flowKey)
7739
+ this.flowKey = false;
7740
+ return (yield* this.pushCount(1)) + (yield* this.pushSpaces(true)) + (yield* this.pushIndicators());
7774
7741
  }
7775
- break loop;
7776
7742
  }
7777
- return n;
7743
+ }
7744
+ return 0;
7778
7745
  }
7779
7746
  *pushTag() {
7780
7747
  if (this.charAt(1) === "<") {
@@ -7832,7 +7799,7 @@ var require_lexer = __commonJS((exports) => {
7832
7799
  exports.Lexer = Lexer;
7833
7800
  });
7834
7801
 
7835
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/line-counter.js
7802
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/parse/line-counter.js
7836
7803
  var require_line_counter = __commonJS((exports) => {
7837
7804
  class LineCounter {
7838
7805
  constructor() {
@@ -7860,7 +7827,7 @@ var require_line_counter = __commonJS((exports) => {
7860
7827
  exports.LineCounter = LineCounter;
7861
7828
  });
7862
7829
 
7863
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/parser.js
7830
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/parse/parser.js
7864
7831
  var require_parser = __commonJS((exports) => {
7865
7832
  var node_process = __require("process");
7866
7833
  var cst = require_cst();
@@ -7928,13 +7895,6 @@ var require_parser = __commonJS((exports) => {
7928
7895
  while (prev[++i]?.type === "space") {}
7929
7896
  return prev.splice(i, prev.length);
7930
7897
  }
7931
- function arrayPushArray(target, source) {
7932
- if (source.length < 1e5)
7933
- Array.prototype.push.apply(target, source);
7934
- else
7935
- for (let i = 0;i < source.length; ++i)
7936
- target.push(source[i]);
7937
- }
7938
7898
  function fixFlowSeqItems(fc) {
7939
7899
  if (fc.start.type === "flow-seq-start") {
7940
7900
  for (const it of fc.items) {
@@ -7944,11 +7904,11 @@ var require_parser = __commonJS((exports) => {
7944
7904
  delete it.key;
7945
7905
  if (isFlowToken(it.value)) {
7946
7906
  if (it.value.end)
7947
- arrayPushArray(it.value.end, it.sep);
7907
+ Array.prototype.push.apply(it.value.end, it.sep);
7948
7908
  else
7949
7909
  it.value.end = it.sep;
7950
7910
  } else
7951
- arrayPushArray(it.start, it.sep);
7911
+ Array.prototype.push.apply(it.start, it.sep);
7952
7912
  delete it.sep;
7953
7913
  }
7954
7914
  }
@@ -8288,7 +8248,7 @@ var require_parser = __commonJS((exports) => {
8288
8248
  const prev = map.items[map.items.length - 2];
8289
8249
  const end = prev?.value?.end;
8290
8250
  if (Array.isArray(end)) {
8291
- arrayPushArray(end, it.start);
8251
+ Array.prototype.push.apply(end, it.start);
8292
8252
  end.push(this.sourceToken);
8293
8253
  map.items.pop();
8294
8254
  return;
@@ -8476,7 +8436,7 @@ var require_parser = __commonJS((exports) => {
8476
8436
  const prev = seq.items[seq.items.length - 2];
8477
8437
  const end = prev?.value?.end;
8478
8438
  if (Array.isArray(end)) {
8479
- arrayPushArray(end, it.start);
8439
+ Array.prototype.push.apply(end, it.start);
8480
8440
  end.push(this.sourceToken);
8481
8441
  seq.items.pop();
8482
8442
  return;
@@ -8716,7 +8676,7 @@ var require_parser = __commonJS((exports) => {
8716
8676
  exports.Parser = Parser;
8717
8677
  });
8718
8678
 
8719
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/public-api.js
8679
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/public-api.js
8720
8680
  var require_public_api = __commonJS((exports) => {
8721
8681
  var composer = require_composer();
8722
8682
  var Document = require_Document();
@@ -8810,7 +8770,7 @@ var require_public_api = __commonJS((exports) => {
8810
8770
  exports.stringify = stringify;
8811
8771
  });
8812
8772
 
8813
- // ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/index.js
8773
+ // ../../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/index.js
8814
8774
  var require_dist = __commonJS((exports) => {
8815
8775
  var composer = require_composer();
8816
8776
  var Document = require_Document();
@@ -9617,6 +9577,140 @@ function formatActivity(report, options = {}) {
9617
9577
  `);
9618
9578
  }
9619
9579
 
9580
+ // src/audit.ts
9581
+ function filterSessions(sessions, filter) {
9582
+ const since = filter.since ? Date.parse(filter.since) : null;
9583
+ return sessions.filter((session) => {
9584
+ if (filter.pidPrefix) {
9585
+ const pid = session.prolific?.prolificPid ?? "";
9586
+ if (!pid.startsWith(filter.pidPrefix))
9587
+ return false;
9588
+ }
9589
+ if (since !== null) {
9590
+ const created = session.createdAt ? Date.parse(session.createdAt) : NaN;
9591
+ if (!(created >= since))
9592
+ return false;
9593
+ }
9594
+ return true;
9595
+ });
9596
+ }
9597
+ function isRecord(value) {
9598
+ return typeof value === "object" && value !== null && !Array.isArray(value);
9599
+ }
9600
+ function isBlank(value) {
9601
+ if (value === undefined || value === null)
9602
+ return true;
9603
+ if (typeof value === "string")
9604
+ return value.trim() === "";
9605
+ if (Array.isArray(value))
9606
+ return value.length === 0;
9607
+ return false;
9608
+ }
9609
+ function requiredSurveyItems(config) {
9610
+ const byPage = new Map;
9611
+ for (const page of config.pages ?? []) {
9612
+ if (!page?.id)
9613
+ continue;
9614
+ const ids = [];
9615
+ for (const component of page.components ?? []) {
9616
+ if (!isRecord(component) || component.type !== "survey")
9617
+ continue;
9618
+ if (!isRecord(component.props))
9619
+ continue;
9620
+ const items = component.props.items;
9621
+ if (!Array.isArray(items))
9622
+ continue;
9623
+ for (const item of items) {
9624
+ if (!isRecord(item) || typeof item.id !== "string")
9625
+ continue;
9626
+ let required = item.required !== false;
9627
+ if (isRecord(item.answer) && typeof item.answer.required === "boolean") {
9628
+ required = item.answer.required;
9629
+ }
9630
+ if (required)
9631
+ ids.push(item.id);
9632
+ }
9633
+ }
9634
+ if (ids.length > 0)
9635
+ byPage.set(page.id, ids);
9636
+ }
9637
+ return byPage;
9638
+ }
9639
+ function label(session) {
9640
+ const pid = session.prolific?.prolificPid;
9641
+ return pid ? `${session.sessionId} (${pid})` : session.sessionId;
9642
+ }
9643
+ function auditData(input) {
9644
+ const errors = [];
9645
+ const warnings = [];
9646
+ const byId = new Map(input.sessions.map((s) => [s.sessionId, s]));
9647
+ for (const session of input.sessions) {
9648
+ if (session.status !== "completed") {
9649
+ errors.push(`${label(session)} did not finish: stopped on page "${session.currentPageId}" (last update ${session.updatedAt ?? "unknown"})`);
9650
+ }
9651
+ }
9652
+ if (input.config) {
9653
+ const required = requiredSurveyItems(input.config);
9654
+ const answered = new Map;
9655
+ for (const response of input.surveyResponses) {
9656
+ if (!byId.has(response.sessionId))
9657
+ continue;
9658
+ const key = `${response.sessionId}\x00${response.pageId}`;
9659
+ const list = answered.get(key) ?? [];
9660
+ list.push(response);
9661
+ answered.set(key, list);
9662
+ }
9663
+ for (const responses of answered.values()) {
9664
+ const { sessionId, pageId } = responses[0];
9665
+ const session = byId.get(sessionId);
9666
+ const missing = (required.get(pageId) ?? []).filter((id) => responses.every((r) => isBlank(r.data?.[id])));
9667
+ if (missing.length > 0) {
9668
+ errors.push(`${label(session)} page "${pageId}": required answers not saved: ${missing.join(", ")}`);
9669
+ }
9670
+ }
9671
+ }
9672
+ for (const key of input.requireState ?? []) {
9673
+ const lacking = input.sessions.filter((s) => s.status === "completed" && isBlank(getPath(s.session_state, key)));
9674
+ for (const session of lacking) {
9675
+ errors.push(`${label(session)} has no session_state.${key}`);
9676
+ }
9677
+ }
9678
+ const members = new Map;
9679
+ for (const group of input.groups) {
9680
+ const session = byId.get(group.sessionId);
9681
+ if (!session)
9682
+ continue;
9683
+ const list = members.get(group.groupId) ?? [];
9684
+ list.push(session);
9685
+ members.set(group.groupId, list);
9686
+ }
9687
+ for (const [groupId, list] of members) {
9688
+ const done = list.filter((s) => s.status === "completed").length;
9689
+ if (done > 0 && done < list.length) {
9690
+ warnings.push(`group ${groupId}: ${done} of ${list.length} members finished`);
9691
+ }
9692
+ }
9693
+ const revisions = new Set(input.sessions.map((s) => s.configRevision));
9694
+ if (revisions.size > 1) {
9695
+ warnings.push(`sessions span config revisions ${[...revisions].join(", ")}; narrow with --since`);
9696
+ }
9697
+ return {
9698
+ sessions: input.sessions.length,
9699
+ completed: input.sessions.filter((s) => s.status === "completed").length,
9700
+ errors,
9701
+ warnings
9702
+ };
9703
+ }
9704
+ function getPath(state, key) {
9705
+ let current = state;
9706
+ for (const part of key.split(".")) {
9707
+ if (!isRecord(current))
9708
+ return;
9709
+ current = current[part];
9710
+ }
9711
+ return current;
9712
+ }
9713
+
9620
9714
  // src/auth.ts
9621
9715
  import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
9622
9716
  import { homedir } from "node:os";
@@ -10016,7 +10110,7 @@ import { readFile as readFile2, realpath, stat } from "node:fs/promises";
10016
10110
  import path2 from "node:path";
10017
10111
  import process10 from "node:process";
10018
10112
  var HTML_MAX_BYTES = 1024 * 1024;
10019
- function isRecord(value) {
10113
+ function isRecord2(value) {
10020
10114
  return typeof value === "object" && value !== null && !Array.isArray(value);
10021
10115
  }
10022
10116
  function formatBytes(bytes) {
@@ -10028,16 +10122,16 @@ function formatBytes(bytes) {
10028
10122
  }
10029
10123
  function listHtmlComponents(config) {
10030
10124
  const pages = config.pages;
10031
- const pageList = Array.isArray(pages) ? pages.filter(isRecord) : isRecord(pages) ? Object.values(pages).filter(isRecord) : [];
10125
+ const pageList = Array.isArray(pages) ? pages.filter(isRecord2) : isRecord2(pages) ? Object.values(pages).filter(isRecord2) : [];
10032
10126
  const result = [];
10033
10127
  for (const page of pageList) {
10034
10128
  const components = page.components;
10035
10129
  if (!Array.isArray(components))
10036
10130
  continue;
10037
10131
  for (const comp of components) {
10038
- if (!isRecord(comp) || comp.type !== "html")
10132
+ if (!isRecord2(comp) || comp.type !== "html")
10039
10133
  continue;
10040
- const props = isRecord(comp.props) ? comp.props : {};
10134
+ const props = isRecord2(comp.props) ? comp.props : {};
10041
10135
  const id = typeof comp.id === "string" ? comp.id : "html";
10042
10136
  result.push({ id, props });
10043
10137
  }
@@ -10128,15 +10222,15 @@ async function attachHtmlToCompiledConfig(configPath, compiled) {
10128
10222
  }
10129
10223
  function listWorkspaceComponents(config) {
10130
10224
  const pages = config.pages;
10131
- const pageList = Array.isArray(pages) ? pages.filter(isRecord) : isRecord(pages) ? Object.values(pages).filter(isRecord) : [];
10225
+ const pageList = Array.isArray(pages) ? pages.filter(isRecord2) : isRecord2(pages) ? Object.values(pages).filter(isRecord2) : [];
10132
10226
  const result = [];
10133
10227
  for (const page of pageList) {
10134
10228
  if (!Array.isArray(page.components))
10135
10229
  continue;
10136
10230
  for (const comp of page.components) {
10137
- if (!isRecord(comp) || comp.type !== "live-workspace")
10231
+ if (!isRecord2(comp) || comp.type !== "live-workspace")
10138
10232
  continue;
10139
- const props = isRecord(comp.props) ? comp.props : {};
10233
+ const props = isRecord2(comp.props) ? comp.props : {};
10140
10234
  const id = typeof comp.id === "string" ? comp.id : "live-workspace";
10141
10235
  result.push({ id, props });
10142
10236
  }
@@ -10350,7 +10444,7 @@ function lintEndRedirectUrls(config) {
10350
10444
 
10351
10445
  // src/index.ts
10352
10446
  var program2 = new Command;
10353
- program2.name("pairit").description("CLI for Pairit experiment configs").version("0.3.8").option("--env <name>", "Target environment: staging or production", (value) => {
10447
+ program2.name("pairit").description("CLI for Pairit experiment configs").version("0.3.10").option("--env <name>", "Target environment: staging or production", (value) => {
10354
10448
  try {
10355
10449
  return parseEnvName(value);
10356
10450
  } catch (error) {
@@ -10410,13 +10504,13 @@ configCommand.command("upload").argument("<config>", "Path to YAML config").opti
10410
10504
  console.log(`✓ Attached ${path3.basename(file.src)} (${formatBytes(file.bytes)})`);
10411
10505
  }
10412
10506
  const result = response;
10413
- const label = result.name ? `${result.name} (${result.configId})` : result.configId;
10507
+ const label2 = result.name ? `${result.name} (${result.configId})` : result.configId;
10414
10508
  if (result.created) {
10415
- console.log(`✓ Created ${label}, revision ${result.revision}`);
10509
+ console.log(`✓ Created ${label2}, revision ${result.revision}`);
10416
10510
  } else if (result.previousRevision != null) {
10417
- console.log(`✓ Uploaded ${label}, revision ${result.previousRevision} → ${result.revision}`);
10511
+ console.log(`✓ Uploaded ${label2}, revision ${result.previousRevision} → ${result.revision}`);
10418
10512
  } else {
10419
- console.log(`✓ Uploaded ${label}, revision ${result.revision} (config unchanged)`);
10513
+ console.log(`✓ Uploaded ${label2}, revision ${result.revision} (config unchanged)`);
10420
10514
  }
10421
10515
  console.log(` checksum ${checksum}`);
10422
10516
  for (const provider of payload.clearLlmCredentials ?? []) {
@@ -10568,6 +10662,13 @@ dataCommand.command("export").argument("<configId>", "Config ID to export data f
10568
10662
  reportCliError("Export failed", error);
10569
10663
  }
10570
10664
  });
10665
+ dataCommand.command("audit").argument("<configId>", "Config ID to audit").option("--pid-prefix <prefix>", "Only sessions whose PROLIFIC_PID starts with this (e.g. bot_qa_)").option("--since <time>", "Only sessions created at or after this ISO time").option("--config <path>", "Config YAML, to check that required survey answers were saved").option("--require-state <keys>", "Comma-separated session_state keys every finished session must have").description("Check a test run: every session finished, required answers saved, groups complete").action(async (configId, options) => {
10666
+ try {
10667
+ await auditCommand(configId, options);
10668
+ } catch (error) {
10669
+ reportCliError("Audit failed", error);
10670
+ }
10671
+ });
10571
10672
  var adminCommand = program2.command("admin").description("Manage the manager allowlist and see activity (admin only)");
10572
10673
  adminCommand.command("add-user").argument("<email>", "Email to allow").option("--admin", "Grant admin privileges").description("Add a user to the manager allowlist").action(async (email, options) => {
10573
10674
  try {
@@ -10669,11 +10770,29 @@ async function lintConfig(configPath) {
10669
10770
  if (!page.id) {
10670
10771
  errors.push(`pages[${index}] is missing id`);
10671
10772
  }
10773
+ const width = page?.width;
10774
+ if (width !== undefined && width !== "default" && width !== "wide") {
10775
+ errors.push(`pages[${index}].width must be "default" or "wide"`);
10776
+ }
10777
+ const pageHeight = page?.height;
10778
+ if (pageHeight !== undefined && (typeof pageHeight !== "number" || !Number.isFinite(pageHeight) || pageHeight <= 0)) {
10779
+ errors.push(`pages[${index}].height must be a positive number`);
10780
+ }
10672
10781
  page.components?.forEach((component, componentIndex) => {
10673
- const column = component?.column;
10782
+ const comp = component;
10783
+ const column = comp?.column;
10674
10784
  if (column !== undefined && column !== "left" && column !== "right") {
10675
10785
  errors.push(`pages[${index}].components[${componentIndex}].column must be "left" or "right"`);
10676
10786
  }
10787
+ if (comp?.type === "html" && comp.props) {
10788
+ const { height, borderless } = comp.props;
10789
+ if (height !== undefined && height !== "auto" && (typeof height !== "number" || !Number.isFinite(height) || height <= 0)) {
10790
+ errors.push(`pages[${index}].components[${componentIndex}].props.height must be "auto" or a positive number`);
10791
+ }
10792
+ if (borderless !== undefined && typeof borderless !== "boolean") {
10793
+ errors.push(`pages[${index}].components[${componentIndex}].props.borderless must be a boolean`);
10794
+ }
10795
+ }
10677
10796
  });
10678
10797
  });
10679
10798
  }
@@ -10942,10 +11061,46 @@ async function exportData(configId, options) {
10942
11061
  console.log(`
10943
11062
  Files written to: ${outDir}`);
10944
11063
  }
10945
- async function fetchAndWriteExport(pathname, outBase, extract, format, flatten, label) {
11064
+ async function auditCommand(configId, options) {
11065
+ if (options.since && Number.isNaN(Date.parse(options.since))) {
11066
+ throw new Error(`--since is not a valid time: ${options.since}`);
11067
+ }
11068
+ const config = options.config ? await loadConfig(options.config) : undefined;
11069
+ const cfg = encodeURIComponent(configId);
11070
+ const allSessions = await fetchAllPages(`/data/${cfg}/sessions`, (r) => r.sessions ?? []);
11071
+ const sessions = filterSessions(allSessions, {
11072
+ pidPrefix: options.pidPrefix,
11073
+ since: options.since
11074
+ });
11075
+ if (sessions.length === 0) {
11076
+ throw new Error("no sessions match; check --pid-prefix and --since");
11077
+ }
11078
+ const groups = await fetchAllPages(`/data/${cfg}/groups`, (r) => r.groups ?? []);
11079
+ const surveyResponses = await fetchAllPages(`/data/${cfg}/survey-responses`, (r) => r.surveyResponses ?? []);
11080
+ const result = auditData({
11081
+ sessions,
11082
+ groups,
11083
+ surveyResponses,
11084
+ config,
11085
+ requireState: options.requireState?.split(",").map((key) => key.trim()).filter(Boolean)
11086
+ });
11087
+ console.log(`Audited ${result.sessions} sessions: ${result.completed} finished.`);
11088
+ for (const warning of result.warnings)
11089
+ console.log(`⚠ ${warning}`);
11090
+ for (const error of result.errors)
11091
+ console.log(`✗ ${error}`);
11092
+ if (result.errors.length > 0) {
11093
+ console.log(`
11094
+ ${result.errors.length} problem(s) found.`);
11095
+ process11.exitCode = 1;
11096
+ } else {
11097
+ console.log("✓ No problems found.");
11098
+ }
11099
+ }
11100
+ async function fetchAndWriteExport(pathname, outBase, extract, format, flatten, label2) {
10946
11101
  const data = await fetchAllPages(pathname, extract);
10947
11102
  await writeExportFile(outBase, data, format, flatten);
10948
- console.log(`✓ Exported ${data.length} ${label}`);
11103
+ console.log(`✓ Exported ${data.length} ${label2}`);
10949
11104
  }
10950
11105
  function flattenSession(session) {
10951
11106
  const { session_state, prolific, ...rest } = session;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pairit",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "description": "CLI for the Pairit behavioral science experiment platform",
5
5
  "type": "module",
6
6
  "bin": {