pairit 0.3.5 → 0.3.7
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/index.js +523 -201
- package/package.json +3 -3
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.
|
|
1871
|
+
// ../../../node_modules/.bun/yaml@2.9.1/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.
|
|
1925
|
+
// ../../../node_modules/.bun/yaml@2.9.1/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.
|
|
2080
|
+
// ../../../node_modules/.bun/yaml@2.9.1/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.
|
|
2232
|
+
// ../../../node_modules/.bun/yaml@2.9.1/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.
|
|
2294
|
+
// ../../../node_modules/.bun/yaml@2.9.1/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.
|
|
2341
|
+
// ../../../node_modules/.bun/yaml@2.9.1/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.
|
|
2368
|
+
// ../../../node_modules/.bun/yaml@2.9.1/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.
|
|
2405
|
+
// ../../../node_modules/.bun/yaml@2.9.1/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,6 +2421,8 @@ 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");
|
|
2424
2426
|
let nodes;
|
|
2425
2427
|
if (ctx?.aliasResolveCache) {
|
|
2426
2428
|
nodes = ctx.aliasResolveCache;
|
|
@@ -2442,36 +2444,38 @@ var require_Alias = __commonJS((exports) => {
|
|
|
2442
2444
|
if (node.anchor === this.source)
|
|
2443
2445
|
found = node;
|
|
2444
2446
|
}
|
|
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
|
+
}
|
|
2445
2468
|
return found;
|
|
2446
2469
|
}
|
|
2447
2470
|
toJSON(_arg, ctx) {
|
|
2448
2471
|
if (!ctx)
|
|
2449
2472
|
return { source: this.source };
|
|
2450
|
-
const
|
|
2451
|
-
const source = this.resolve(doc, ctx);
|
|
2473
|
+
const source = this.resolve(ctx.doc, ctx);
|
|
2452
2474
|
if (!source) {
|
|
2453
2475
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
2454
2476
|
throw new ReferenceError(msg);
|
|
2455
2477
|
}
|
|
2456
|
-
|
|
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;
|
|
2478
|
+
return ctx.anchors.get(source).res;
|
|
2475
2479
|
}
|
|
2476
2480
|
toString(ctx, _onComment, _onChompKeep) {
|
|
2477
2481
|
const src = `*${this.source}`;
|
|
@@ -2510,7 +2514,7 @@ var require_Alias = __commonJS((exports) => {
|
|
|
2510
2514
|
exports.Alias = Alias;
|
|
2511
2515
|
});
|
|
2512
2516
|
|
|
2513
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
2517
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/Scalar.js
|
|
2514
2518
|
var require_Scalar = __commonJS((exports) => {
|
|
2515
2519
|
var identity = require_identity();
|
|
2516
2520
|
var Node = require_Node();
|
|
@@ -2538,7 +2542,7 @@ var require_Scalar = __commonJS((exports) => {
|
|
|
2538
2542
|
exports.isScalarValue = isScalarValue;
|
|
2539
2543
|
});
|
|
2540
2544
|
|
|
2541
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
2545
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/doc/createNode.js
|
|
2542
2546
|
var require_createNode = __commonJS((exports) => {
|
|
2543
2547
|
var Alias = require_Alias();
|
|
2544
2548
|
var identity = require_identity();
|
|
@@ -2610,7 +2614,7 @@ var require_createNode = __commonJS((exports) => {
|
|
|
2610
2614
|
exports.createNode = createNode;
|
|
2611
2615
|
});
|
|
2612
2616
|
|
|
2613
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
2617
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/Collection.js
|
|
2614
2618
|
var require_Collection = __commonJS((exports) => {
|
|
2615
2619
|
var createNode = require_createNode();
|
|
2616
2620
|
var identity = require_identity();
|
|
@@ -2725,7 +2729,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
2725
2729
|
exports.isEmptyPath = isEmptyPath;
|
|
2726
2730
|
});
|
|
2727
2731
|
|
|
2728
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
2732
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
2729
2733
|
var require_stringifyComment = __commonJS((exports) => {
|
|
2730
2734
|
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
|
|
2731
2735
|
function indentComment(comment, indent) {
|
|
@@ -2742,7 +2746,7 @@ var require_stringifyComment = __commonJS((exports) => {
|
|
|
2742
2746
|
exports.stringifyComment = stringifyComment;
|
|
2743
2747
|
});
|
|
2744
2748
|
|
|
2745
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
2749
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
2746
2750
|
var require_foldFlowLines = __commonJS((exports) => {
|
|
2747
2751
|
var FOLD_FLOW = "flow";
|
|
2748
2752
|
var FOLD_BLOCK = "block";
|
|
@@ -2879,7 +2883,7 @@ ${indent}${text.slice(fold + 1, end2)}`;
|
|
|
2879
2883
|
exports.foldFlowLines = foldFlowLines;
|
|
2880
2884
|
});
|
|
2881
2885
|
|
|
2882
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
2886
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyString.js
|
|
2883
2887
|
var require_stringifyString = __commonJS((exports) => {
|
|
2884
2888
|
var Scalar = require_Scalar();
|
|
2885
2889
|
var foldFlowLines = require_foldFlowLines();
|
|
@@ -3177,7 +3181,7 @@ ${indent}`);
|
|
|
3177
3181
|
exports.stringifyString = stringifyString;
|
|
3178
3182
|
});
|
|
3179
3183
|
|
|
3180
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3184
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringify.js
|
|
3181
3185
|
var require_stringify = __commonJS((exports) => {
|
|
3182
3186
|
var anchors = require_anchors();
|
|
3183
3187
|
var identity = require_identity();
|
|
@@ -3200,6 +3204,7 @@ var require_stringify = __commonJS((exports) => {
|
|
|
3200
3204
|
nullStr: "null",
|
|
3201
3205
|
simpleKeys: false,
|
|
3202
3206
|
singleQuote: null,
|
|
3207
|
+
trailingComma: false,
|
|
3203
3208
|
trueStr: "true",
|
|
3204
3209
|
verifyAliasOrder: true
|
|
3205
3210
|
}, doc.schema.toStringOptions, options);
|
|
@@ -3297,7 +3302,7 @@ ${ctx.indent}${str}`;
|
|
|
3297
3302
|
exports.stringify = stringify;
|
|
3298
3303
|
});
|
|
3299
3304
|
|
|
3300
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3305
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
3301
3306
|
var require_stringifyPair = __commonJS((exports) => {
|
|
3302
3307
|
var identity = require_identity();
|
|
3303
3308
|
var Scalar = require_Scalar();
|
|
@@ -3433,7 +3438,7 @@ ${ctx.indent}`;
|
|
|
3433
3438
|
exports.stringifyPair = stringifyPair;
|
|
3434
3439
|
});
|
|
3435
3440
|
|
|
3436
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3441
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/log.js
|
|
3437
3442
|
var require_log = __commonJS((exports) => {
|
|
3438
3443
|
var node_process = __require("process");
|
|
3439
3444
|
function debug(logLevel, ...messages) {
|
|
@@ -3452,7 +3457,7 @@ var require_log = __commonJS((exports) => {
|
|
|
3452
3457
|
exports.warn = warn;
|
|
3453
3458
|
});
|
|
3454
3459
|
|
|
3455
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3460
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
3456
3461
|
var require_merge = __commonJS((exports) => {
|
|
3457
3462
|
var identity = require_identity();
|
|
3458
3463
|
var Scalar = require_Scalar();
|
|
@@ -3469,18 +3474,18 @@ var require_merge = __commonJS((exports) => {
|
|
|
3469
3474
|
};
|
|
3470
3475
|
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);
|
|
3471
3476
|
function addMergeToJSMap(ctx, map, value) {
|
|
3472
|
-
|
|
3473
|
-
if (identity.isSeq(
|
|
3474
|
-
for (const it of
|
|
3477
|
+
const source = resolveAliasValue(ctx, value);
|
|
3478
|
+
if (identity.isSeq(source))
|
|
3479
|
+
for (const it of source.items)
|
|
3475
3480
|
mergeValue(ctx, map, it);
|
|
3476
|
-
else if (Array.isArray(
|
|
3477
|
-
for (const it of
|
|
3481
|
+
else if (Array.isArray(source))
|
|
3482
|
+
for (const it of source)
|
|
3478
3483
|
mergeValue(ctx, map, it);
|
|
3479
3484
|
else
|
|
3480
|
-
mergeValue(ctx, map,
|
|
3485
|
+
mergeValue(ctx, map, source);
|
|
3481
3486
|
}
|
|
3482
3487
|
function mergeValue(ctx, map, value) {
|
|
3483
|
-
const source = ctx
|
|
3488
|
+
const source = resolveAliasValue(ctx, value);
|
|
3484
3489
|
if (!identity.isMap(source))
|
|
3485
3490
|
throw new Error("Merge sources must be maps or map aliases");
|
|
3486
3491
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
@@ -3501,12 +3506,15 @@ var require_merge = __commonJS((exports) => {
|
|
|
3501
3506
|
}
|
|
3502
3507
|
return map;
|
|
3503
3508
|
}
|
|
3509
|
+
function resolveAliasValue(ctx, value) {
|
|
3510
|
+
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
3511
|
+
}
|
|
3504
3512
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
3505
3513
|
exports.isMergeKey = isMergeKey;
|
|
3506
3514
|
exports.merge = merge;
|
|
3507
3515
|
});
|
|
3508
3516
|
|
|
3509
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3517
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
3510
3518
|
var require_addPairToJSMap = __commonJS((exports) => {
|
|
3511
3519
|
var log = require_log();
|
|
3512
3520
|
var merge = require_merge();
|
|
@@ -3567,7 +3575,7 @@ var require_addPairToJSMap = __commonJS((exports) => {
|
|
|
3567
3575
|
exports.addPairToJSMap = addPairToJSMap;
|
|
3568
3576
|
});
|
|
3569
3577
|
|
|
3570
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3578
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/Pair.js
|
|
3571
3579
|
var require_Pair = __commonJS((exports) => {
|
|
3572
3580
|
var createNode = require_createNode();
|
|
3573
3581
|
var stringifyPair = require_stringifyPair();
|
|
@@ -3605,7 +3613,7 @@ var require_Pair = __commonJS((exports) => {
|
|
|
3605
3613
|
exports.createPair = createPair;
|
|
3606
3614
|
});
|
|
3607
3615
|
|
|
3608
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3616
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
3609
3617
|
var require_stringifyCollection = __commonJS((exports) => {
|
|
3610
3618
|
var identity = require_identity();
|
|
3611
3619
|
var stringify = require_stringify();
|
|
@@ -3708,13 +3716,20 @@ ${indent}${line}` : `
|
|
|
3708
3716
|
if (comment)
|
|
3709
3717
|
reqNewline = true;
|
|
3710
3718
|
let str = stringify.stringify(item, itemCtx, () => comment = null);
|
|
3711
|
-
|
|
3719
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str.includes(`
|
|
3720
|
+
`));
|
|
3721
|
+
if (i < items.length - 1) {
|
|
3712
3722
|
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
|
+
}
|
|
3713
3731
|
if (comment)
|
|
3714
3732
|
str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
|
|
3715
|
-
if (!reqNewline && (lines.length > linesAtValue || str.includes(`
|
|
3716
|
-
`)))
|
|
3717
|
-
reqNewline = true;
|
|
3718
3733
|
lines.push(str);
|
|
3719
3734
|
linesAtValue = lines.length;
|
|
3720
3735
|
}
|
|
@@ -3750,7 +3765,7 @@ ${indent}${end}`;
|
|
|
3750
3765
|
exports.stringifyCollection = stringifyCollection;
|
|
3751
3766
|
});
|
|
3752
3767
|
|
|
3753
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3768
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
3754
3769
|
var require_YAMLMap = __commonJS((exports) => {
|
|
3755
3770
|
var stringifyCollection = require_stringifyCollection();
|
|
3756
3771
|
var addPairToJSMap = require_addPairToJSMap();
|
|
@@ -3877,7 +3892,7 @@ var require_YAMLMap = __commonJS((exports) => {
|
|
|
3877
3892
|
exports.findPair = findPair;
|
|
3878
3893
|
});
|
|
3879
3894
|
|
|
3880
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3895
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/common/map.js
|
|
3881
3896
|
var require_map = __commonJS((exports) => {
|
|
3882
3897
|
var identity = require_identity();
|
|
3883
3898
|
var YAMLMap = require_YAMLMap();
|
|
@@ -3896,7 +3911,7 @@ var require_map = __commonJS((exports) => {
|
|
|
3896
3911
|
exports.map = map;
|
|
3897
3912
|
});
|
|
3898
3913
|
|
|
3899
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
3914
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
3900
3915
|
var require_YAMLSeq = __commonJS((exports) => {
|
|
3901
3916
|
var createNode = require_createNode();
|
|
3902
3917
|
var stringifyCollection = require_stringifyCollection();
|
|
@@ -3989,7 +4004,7 @@ var require_YAMLSeq = __commonJS((exports) => {
|
|
|
3989
4004
|
exports.YAMLSeq = YAMLSeq;
|
|
3990
4005
|
});
|
|
3991
4006
|
|
|
3992
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4007
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/common/seq.js
|
|
3993
4008
|
var require_seq = __commonJS((exports) => {
|
|
3994
4009
|
var identity = require_identity();
|
|
3995
4010
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -4008,7 +4023,7 @@ var require_seq = __commonJS((exports) => {
|
|
|
4008
4023
|
exports.seq = seq;
|
|
4009
4024
|
});
|
|
4010
4025
|
|
|
4011
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4026
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/common/string.js
|
|
4012
4027
|
var require_string = __commonJS((exports) => {
|
|
4013
4028
|
var stringifyString = require_stringifyString();
|
|
4014
4029
|
var string = {
|
|
@@ -4024,7 +4039,7 @@ var require_string = __commonJS((exports) => {
|
|
|
4024
4039
|
exports.string = string;
|
|
4025
4040
|
});
|
|
4026
4041
|
|
|
4027
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4042
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/common/null.js
|
|
4028
4043
|
var require_null = __commonJS((exports) => {
|
|
4029
4044
|
var Scalar = require_Scalar();
|
|
4030
4045
|
var nullTag = {
|
|
@@ -4039,7 +4054,7 @@ var require_null = __commonJS((exports) => {
|
|
|
4039
4054
|
exports.nullTag = nullTag;
|
|
4040
4055
|
});
|
|
4041
4056
|
|
|
4042
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4057
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/core/bool.js
|
|
4043
4058
|
var require_bool = __commonJS((exports) => {
|
|
4044
4059
|
var Scalar = require_Scalar();
|
|
4045
4060
|
var boolTag = {
|
|
@@ -4060,7 +4075,7 @@ var require_bool = __commonJS((exports) => {
|
|
|
4060
4075
|
exports.boolTag = boolTag;
|
|
4061
4076
|
});
|
|
4062
4077
|
|
|
4063
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4078
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
4064
4079
|
var require_stringifyNumber = __commonJS((exports) => {
|
|
4065
4080
|
function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
4066
4081
|
if (typeof value === "bigint")
|
|
@@ -4069,7 +4084,7 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
4069
4084
|
if (!isFinite(num))
|
|
4070
4085
|
return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
|
|
4071
4086
|
let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
4072
|
-
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") &&
|
|
4087
|
+
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
|
|
4073
4088
|
let i = n.indexOf(".");
|
|
4074
4089
|
if (i < 0) {
|
|
4075
4090
|
i = n.length;
|
|
@@ -4084,7 +4099,7 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
4084
4099
|
exports.stringifyNumber = stringifyNumber;
|
|
4085
4100
|
});
|
|
4086
4101
|
|
|
4087
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4102
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/core/float.js
|
|
4088
4103
|
var require_float = __commonJS((exports) => {
|
|
4089
4104
|
var Scalar = require_Scalar();
|
|
4090
4105
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -4127,7 +4142,7 @@ var require_float = __commonJS((exports) => {
|
|
|
4127
4142
|
exports.floatNaN = floatNaN;
|
|
4128
4143
|
});
|
|
4129
4144
|
|
|
4130
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4145
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/core/int.js
|
|
4131
4146
|
var require_int = __commonJS((exports) => {
|
|
4132
4147
|
var stringifyNumber = require_stringifyNumber();
|
|
4133
4148
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -4169,7 +4184,7 @@ var require_int = __commonJS((exports) => {
|
|
|
4169
4184
|
exports.intOct = intOct;
|
|
4170
4185
|
});
|
|
4171
4186
|
|
|
4172
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4187
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/core/schema.js
|
|
4173
4188
|
var require_schema = __commonJS((exports) => {
|
|
4174
4189
|
var map = require_map();
|
|
4175
4190
|
var _null = require_null();
|
|
@@ -4194,7 +4209,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
4194
4209
|
exports.schema = schema;
|
|
4195
4210
|
});
|
|
4196
4211
|
|
|
4197
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4212
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/json/schema.js
|
|
4198
4213
|
var require_schema2 = __commonJS((exports) => {
|
|
4199
4214
|
var Scalar = require_Scalar();
|
|
4200
4215
|
var map = require_map();
|
|
@@ -4258,7 +4273,7 @@ var require_schema2 = __commonJS((exports) => {
|
|
|
4258
4273
|
exports.schema = schema;
|
|
4259
4274
|
});
|
|
4260
4275
|
|
|
4261
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4276
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
4262
4277
|
var require_binary = __commonJS((exports) => {
|
|
4263
4278
|
var node_buffer = __require("buffer");
|
|
4264
4279
|
var Scalar = require_Scalar();
|
|
@@ -4313,7 +4328,7 @@ var require_binary = __commonJS((exports) => {
|
|
|
4313
4328
|
exports.binary = binary;
|
|
4314
4329
|
});
|
|
4315
4330
|
|
|
4316
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4331
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
4317
4332
|
var require_pairs = __commonJS((exports) => {
|
|
4318
4333
|
var identity = require_identity();
|
|
4319
4334
|
var Pair = require_Pair();
|
|
@@ -4388,7 +4403,7 @@ ${cn.comment}` : item.comment;
|
|
|
4388
4403
|
exports.resolvePairs = resolvePairs;
|
|
4389
4404
|
});
|
|
4390
4405
|
|
|
4391
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4406
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
4392
4407
|
var require_omap = __commonJS((exports) => {
|
|
4393
4408
|
var identity = require_identity();
|
|
4394
4409
|
var toJS = require_toJS();
|
|
@@ -4460,7 +4475,7 @@ var require_omap = __commonJS((exports) => {
|
|
|
4460
4475
|
exports.omap = omap;
|
|
4461
4476
|
});
|
|
4462
4477
|
|
|
4463
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4478
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
4464
4479
|
var require_bool2 = __commonJS((exports) => {
|
|
4465
4480
|
var Scalar = require_Scalar();
|
|
4466
4481
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -4489,7 +4504,7 @@ var require_bool2 = __commonJS((exports) => {
|
|
|
4489
4504
|
exports.trueTag = trueTag;
|
|
4490
4505
|
});
|
|
4491
4506
|
|
|
4492
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4507
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
4493
4508
|
var require_float2 = __commonJS((exports) => {
|
|
4494
4509
|
var Scalar = require_Scalar();
|
|
4495
4510
|
var stringifyNumber = require_stringifyNumber();
|
|
@@ -4535,7 +4550,7 @@ var require_float2 = __commonJS((exports) => {
|
|
|
4535
4550
|
exports.floatNaN = floatNaN;
|
|
4536
4551
|
});
|
|
4537
4552
|
|
|
4538
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4553
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
4539
4554
|
var require_int2 = __commonJS((exports) => {
|
|
4540
4555
|
var stringifyNumber = require_stringifyNumber();
|
|
4541
4556
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
@@ -4611,7 +4626,7 @@ var require_int2 = __commonJS((exports) => {
|
|
|
4611
4626
|
exports.intOct = intOct;
|
|
4612
4627
|
});
|
|
4613
4628
|
|
|
4614
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4629
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
4615
4630
|
var require_set = __commonJS((exports) => {
|
|
4616
4631
|
var identity = require_identity();
|
|
4617
4632
|
var Pair = require_Pair();
|
|
@@ -4694,7 +4709,7 @@ var require_set = __commonJS((exports) => {
|
|
|
4694
4709
|
exports.set = set;
|
|
4695
4710
|
});
|
|
4696
4711
|
|
|
4697
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4712
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
4698
4713
|
var require_timestamp = __commonJS((exports) => {
|
|
4699
4714
|
var stringifyNumber = require_stringifyNumber();
|
|
4700
4715
|
function parseSexagesimal(str, asBigInt) {
|
|
@@ -4776,7 +4791,7 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
4776
4791
|
exports.timestamp = timestamp;
|
|
4777
4792
|
});
|
|
4778
4793
|
|
|
4779
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4794
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
4780
4795
|
var require_schema3 = __commonJS((exports) => {
|
|
4781
4796
|
var map = require_map();
|
|
4782
4797
|
var _null = require_null();
|
|
@@ -4817,7 +4832,7 @@ var require_schema3 = __commonJS((exports) => {
|
|
|
4817
4832
|
exports.schema = schema;
|
|
4818
4833
|
});
|
|
4819
4834
|
|
|
4820
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4835
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/tags.js
|
|
4821
4836
|
var require_tags = __commonJS((exports) => {
|
|
4822
4837
|
var map = require_map();
|
|
4823
4838
|
var _null = require_null();
|
|
@@ -4908,7 +4923,7 @@ var require_tags = __commonJS((exports) => {
|
|
|
4908
4923
|
exports.getTags = getTags;
|
|
4909
4924
|
});
|
|
4910
4925
|
|
|
4911
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4926
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/schema/Schema.js
|
|
4912
4927
|
var require_Schema = __commonJS((exports) => {
|
|
4913
4928
|
var identity = require_identity();
|
|
4914
4929
|
var map = require_map();
|
|
@@ -4938,7 +4953,7 @@ var require_Schema = __commonJS((exports) => {
|
|
|
4938
4953
|
exports.Schema = Schema;
|
|
4939
4954
|
});
|
|
4940
4955
|
|
|
4941
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
4956
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
4942
4957
|
var require_stringifyDocument = __commonJS((exports) => {
|
|
4943
4958
|
var identity = require_identity();
|
|
4944
4959
|
var stringify = require_stringify();
|
|
@@ -5018,7 +5033,7 @@ var require_stringifyDocument = __commonJS((exports) => {
|
|
|
5018
5033
|
exports.stringifyDocument = stringifyDocument;
|
|
5019
5034
|
});
|
|
5020
5035
|
|
|
5021
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5036
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/doc/Document.js
|
|
5022
5037
|
var require_Document = __commonJS((exports) => {
|
|
5023
5038
|
var Alias = require_Alias();
|
|
5024
5039
|
var Collection = require_Collection();
|
|
@@ -5253,7 +5268,7 @@ var require_Document = __commonJS((exports) => {
|
|
|
5253
5268
|
exports.Document = Document;
|
|
5254
5269
|
});
|
|
5255
5270
|
|
|
5256
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5271
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/errors.js
|
|
5257
5272
|
var require_errors = __commonJS((exports) => {
|
|
5258
5273
|
class YAMLError extends Error {
|
|
5259
5274
|
constructor(name, pos, code, message) {
|
|
@@ -5318,7 +5333,7 @@ ${pointer}
|
|
|
5318
5333
|
exports.prettifyError = prettifyError;
|
|
5319
5334
|
});
|
|
5320
5335
|
|
|
5321
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5336
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-props.js
|
|
5322
5337
|
var require_resolve_props = __commonJS((exports) => {
|
|
5323
5338
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
5324
5339
|
let spaceBefore = false;
|
|
@@ -5448,7 +5463,7 @@ var require_resolve_props = __commonJS((exports) => {
|
|
|
5448
5463
|
exports.resolveProps = resolveProps;
|
|
5449
5464
|
});
|
|
5450
5465
|
|
|
5451
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5466
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
5452
5467
|
var require_util_contains_newline = __commonJS((exports) => {
|
|
5453
5468
|
function containsNewline(key) {
|
|
5454
5469
|
if (!key)
|
|
@@ -5488,7 +5503,7 @@ var require_util_contains_newline = __commonJS((exports) => {
|
|
|
5488
5503
|
exports.containsNewline = containsNewline;
|
|
5489
5504
|
});
|
|
5490
5505
|
|
|
5491
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5506
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
5492
5507
|
var require_util_flow_indent_check = __commonJS((exports) => {
|
|
5493
5508
|
var utilContainsNewline = require_util_contains_newline();
|
|
5494
5509
|
function flowIndentCheck(indent, fc, onError) {
|
|
@@ -5503,7 +5518,7 @@ var require_util_flow_indent_check = __commonJS((exports) => {
|
|
|
5503
5518
|
exports.flowIndentCheck = flowIndentCheck;
|
|
5504
5519
|
});
|
|
5505
5520
|
|
|
5506
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5521
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/util-map-includes.js
|
|
5507
5522
|
var require_util_map_includes = __commonJS((exports) => {
|
|
5508
5523
|
var identity = require_identity();
|
|
5509
5524
|
function mapIncludes(ctx, items, search) {
|
|
@@ -5516,7 +5531,7 @@ var require_util_map_includes = __commonJS((exports) => {
|
|
|
5516
5531
|
exports.mapIncludes = mapIncludes;
|
|
5517
5532
|
});
|
|
5518
5533
|
|
|
5519
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5534
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
5520
5535
|
var require_resolve_block_map = __commonJS((exports) => {
|
|
5521
5536
|
var Pair = require_Pair();
|
|
5522
5537
|
var YAMLMap = require_YAMLMap();
|
|
@@ -5623,7 +5638,7 @@ var require_resolve_block_map = __commonJS((exports) => {
|
|
|
5623
5638
|
exports.resolveBlockMap = resolveBlockMap;
|
|
5624
5639
|
});
|
|
5625
5640
|
|
|
5626
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5641
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
5627
5642
|
var require_resolve_block_seq = __commonJS((exports) => {
|
|
5628
5643
|
var YAMLSeq = require_YAMLSeq();
|
|
5629
5644
|
var resolveProps = require_resolve_props();
|
|
@@ -5671,7 +5686,7 @@ var require_resolve_block_seq = __commonJS((exports) => {
|
|
|
5671
5686
|
exports.resolveBlockSeq = resolveBlockSeq;
|
|
5672
5687
|
});
|
|
5673
5688
|
|
|
5674
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5689
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-end.js
|
|
5675
5690
|
var require_resolve_end = __commonJS((exports) => {
|
|
5676
5691
|
function resolveEnd(end, offset, reqSpace, onError) {
|
|
5677
5692
|
let comment = "";
|
|
@@ -5711,7 +5726,7 @@ var require_resolve_end = __commonJS((exports) => {
|
|
|
5711
5726
|
exports.resolveEnd = resolveEnd;
|
|
5712
5727
|
});
|
|
5713
5728
|
|
|
5714
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5729
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
5715
5730
|
var require_resolve_flow_collection = __commonJS((exports) => {
|
|
5716
5731
|
var identity = require_identity();
|
|
5717
5732
|
var Pair = require_Pair();
|
|
@@ -5902,7 +5917,7 @@ var require_resolve_flow_collection = __commonJS((exports) => {
|
|
|
5902
5917
|
exports.resolveFlowCollection = resolveFlowCollection;
|
|
5903
5918
|
});
|
|
5904
5919
|
|
|
5905
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5920
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/compose-collection.js
|
|
5906
5921
|
var require_compose_collection = __commonJS((exports) => {
|
|
5907
5922
|
var identity = require_identity();
|
|
5908
5923
|
var Scalar = require_Scalar();
|
|
@@ -5964,7 +5979,7 @@ var require_compose_collection = __commonJS((exports) => {
|
|
|
5964
5979
|
exports.composeCollection = composeCollection;
|
|
5965
5980
|
});
|
|
5966
5981
|
|
|
5967
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
5982
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
5968
5983
|
var require_resolve_block_scalar = __commonJS((exports) => {
|
|
5969
5984
|
var Scalar = require_Scalar();
|
|
5970
5985
|
function resolveBlockScalar(ctx, scalar, onError) {
|
|
@@ -6157,7 +6172,7 @@ var require_resolve_block_scalar = __commonJS((exports) => {
|
|
|
6157
6172
|
exports.resolveBlockScalar = resolveBlockScalar;
|
|
6158
6173
|
});
|
|
6159
6174
|
|
|
6160
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
6175
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
6161
6176
|
var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
6162
6177
|
var Scalar = require_Scalar();
|
|
6163
6178
|
var resolveEnd = require_resolve_end();
|
|
@@ -6222,33 +6237,32 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
6222
6237
|
}
|
|
6223
6238
|
if (badChar)
|
|
6224
6239
|
onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`);
|
|
6225
|
-
return
|
|
6240
|
+
return unfoldLines(source);
|
|
6226
6241
|
}
|
|
6227
6242
|
function singleQuotedValue(source, onError) {
|
|
6228
6243
|
if (source[source.length - 1] !== "'" || source.length === 1)
|
|
6229
6244
|
onError(source.length, "MISSING_CHAR", "Missing closing 'quote");
|
|
6230
|
-
return
|
|
6245
|
+
return unfoldLines(source.slice(1, -1)).replace(/''/g, "'");
|
|
6231
6246
|
}
|
|
6232
|
-
function
|
|
6233
|
-
|
|
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;
|
|
6234
6253
|
try {
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
line = new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
6238
|
-
`, "sy");
|
|
6254
|
+
trimEnd = new RegExp("(?<![ \t])[ \t]+$");
|
|
6255
|
+
trimBoth = new RegExp("^[ \t]+|(?<![ \t])[ \t]+$", "g");
|
|
6239
6256
|
} catch {
|
|
6240
|
-
|
|
6241
|
-
|
|
6257
|
+
trimEnd = /[ \t]+$/;
|
|
6258
|
+
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
6242
6259
|
}
|
|
6243
|
-
let
|
|
6244
|
-
if (!match)
|
|
6245
|
-
return source;
|
|
6246
|
-
let res = match[1];
|
|
6260
|
+
let res = match[1].replace(trimEnd, "");
|
|
6247
6261
|
let sep = " ";
|
|
6248
|
-
let pos =
|
|
6249
|
-
line.lastIndex = pos;
|
|
6262
|
+
let pos = line.lastIndex;
|
|
6250
6263
|
while (match = line.exec(source)) {
|
|
6251
|
-
|
|
6264
|
+
const lm = match[1].replace(trimBoth, "");
|
|
6265
|
+
if (lm === "") {
|
|
6252
6266
|
if (sep === `
|
|
6253
6267
|
`)
|
|
6254
6268
|
res += sep;
|
|
@@ -6256,7 +6270,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
6256
6270
|
sep = `
|
|
6257
6271
|
`;
|
|
6258
6272
|
} else {
|
|
6259
|
-
res += sep +
|
|
6273
|
+
res += sep + lm;
|
|
6260
6274
|
sep = " ";
|
|
6261
6275
|
}
|
|
6262
6276
|
pos = line.lastIndex;
|
|
@@ -6294,7 +6308,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
6294
6308
|
while (next === " " || next === "\t")
|
|
6295
6309
|
next = source[++i + 1];
|
|
6296
6310
|
} else if (next === "x" || next === "u" || next === "U") {
|
|
6297
|
-
const length =
|
|
6311
|
+
const length = next === "x" ? 2 : next === "u" ? 4 : 8;
|
|
6298
6312
|
res += parseCharCode(source, i + 1, length, onError);
|
|
6299
6313
|
i += length;
|
|
6300
6314
|
} else {
|
|
@@ -6363,17 +6377,18 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
6363
6377
|
const cc = source.substr(offset, length);
|
|
6364
6378
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
6365
6379
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
6366
|
-
|
|
6380
|
+
try {
|
|
6381
|
+
return String.fromCodePoint(code);
|
|
6382
|
+
} catch {
|
|
6367
6383
|
const raw = source.substr(offset - 2, length + 2);
|
|
6368
6384
|
onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
|
|
6369
6385
|
return raw;
|
|
6370
6386
|
}
|
|
6371
|
-
return String.fromCodePoint(code);
|
|
6372
6387
|
}
|
|
6373
6388
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
6374
6389
|
});
|
|
6375
6390
|
|
|
6376
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
6391
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/compose-scalar.js
|
|
6377
6392
|
var require_compose_scalar = __commonJS((exports) => {
|
|
6378
6393
|
var identity = require_identity();
|
|
6379
6394
|
var Scalar = require_Scalar();
|
|
@@ -6451,7 +6466,7 @@ var require_compose_scalar = __commonJS((exports) => {
|
|
|
6451
6466
|
exports.composeScalar = composeScalar;
|
|
6452
6467
|
});
|
|
6453
6468
|
|
|
6454
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
6469
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
6455
6470
|
var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
6456
6471
|
function emptyScalarPosition(offset, before, pos) {
|
|
6457
6472
|
if (before) {
|
|
@@ -6478,7 +6493,7 @@ var require_util_empty_scalar_position = __commonJS((exports) => {
|
|
|
6478
6493
|
exports.emptyScalarPosition = emptyScalarPosition;
|
|
6479
6494
|
});
|
|
6480
6495
|
|
|
6481
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
6496
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/compose-node.js
|
|
6482
6497
|
var require_compose_node = __commonJS((exports) => {
|
|
6483
6498
|
var Alias = require_Alias();
|
|
6484
6499
|
var identity = require_identity();
|
|
@@ -6509,17 +6524,22 @@ var require_compose_node = __commonJS((exports) => {
|
|
|
6509
6524
|
case "block-map":
|
|
6510
6525
|
case "block-seq":
|
|
6511
6526
|
case "flow-collection":
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
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
|
+
}
|
|
6515
6535
|
break;
|
|
6516
6536
|
default: {
|
|
6517
6537
|
const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
|
|
6518
6538
|
onError(token, "UNEXPECTED_TOKEN", message);
|
|
6519
|
-
node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
|
|
6520
6539
|
isSrcToken = false;
|
|
6521
6540
|
}
|
|
6522
6541
|
}
|
|
6542
|
+
node ?? (node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError));
|
|
6523
6543
|
if (anchor && node.anchor === "")
|
|
6524
6544
|
onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
|
|
6525
6545
|
if (atKey && ctx.options.stringKeys && (!identity.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
|
|
@@ -6576,7 +6596,7 @@ var require_compose_node = __commonJS((exports) => {
|
|
|
6576
6596
|
exports.composeNode = composeNode;
|
|
6577
6597
|
});
|
|
6578
6598
|
|
|
6579
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
6599
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/compose-doc.js
|
|
6580
6600
|
var require_compose_doc = __commonJS((exports) => {
|
|
6581
6601
|
var Document = require_Document();
|
|
6582
6602
|
var composeNode = require_compose_node();
|
|
@@ -6616,7 +6636,7 @@ var require_compose_doc = __commonJS((exports) => {
|
|
|
6616
6636
|
exports.composeDoc = composeDoc;
|
|
6617
6637
|
});
|
|
6618
6638
|
|
|
6619
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
6639
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/compose/composer.js
|
|
6620
6640
|
var require_composer = __commonJS((exports) => {
|
|
6621
6641
|
var node_process = __require("process");
|
|
6622
6642
|
var directives = require_directives();
|
|
@@ -6702,8 +6722,10 @@ ${cb}` : comment;
|
|
|
6702
6722
|
}
|
|
6703
6723
|
}
|
|
6704
6724
|
if (afterDoc) {
|
|
6705
|
-
|
|
6706
|
-
|
|
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]);
|
|
6707
6729
|
} else {
|
|
6708
6730
|
doc.errors = this.errors;
|
|
6709
6731
|
doc.warnings = this.warnings;
|
|
@@ -6805,7 +6827,7 @@ ${end.comment}` : end.comment;
|
|
|
6805
6827
|
exports.Composer = Composer;
|
|
6806
6828
|
});
|
|
6807
6829
|
|
|
6808
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
6830
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/cst-scalar.js
|
|
6809
6831
|
var require_cst_scalar = __commonJS((exports) => {
|
|
6810
6832
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
6811
6833
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -6995,7 +7017,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
6995
7017
|
exports.setScalarValue = setScalarValue;
|
|
6996
7018
|
});
|
|
6997
7019
|
|
|
6998
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
7020
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/cst-stringify.js
|
|
6999
7021
|
var require_cst_stringify = __commonJS((exports) => {
|
|
7000
7022
|
var stringify = (cst) => ("type" in cst) ? stringifyToken(cst) : stringifyItem(cst);
|
|
7001
7023
|
function stringifyToken(token) {
|
|
@@ -7053,7 +7075,7 @@ var require_cst_stringify = __commonJS((exports) => {
|
|
|
7053
7075
|
exports.stringify = stringify;
|
|
7054
7076
|
});
|
|
7055
7077
|
|
|
7056
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
7078
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/cst-visit.js
|
|
7057
7079
|
var require_cst_visit = __commonJS((exports) => {
|
|
7058
7080
|
var BREAK = Symbol("break visit");
|
|
7059
7081
|
var SKIP = Symbol("skip children");
|
|
@@ -7112,7 +7134,7 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
7112
7134
|
exports.visit = visit;
|
|
7113
7135
|
});
|
|
7114
7136
|
|
|
7115
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
7137
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/cst.js
|
|
7116
7138
|
var require_cst = __commonJS((exports) => {
|
|
7117
7139
|
var cstScalar = require_cst_scalar();
|
|
7118
7140
|
var cstStringify = require_cst_stringify();
|
|
@@ -7213,7 +7235,7 @@ var require_cst = __commonJS((exports) => {
|
|
|
7213
7235
|
exports.tokenType = tokenType;
|
|
7214
7236
|
});
|
|
7215
7237
|
|
|
7216
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
7238
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/lexer.js
|
|
7217
7239
|
var require_lexer = __commonJS((exports) => {
|
|
7218
7240
|
var cst = require_cst();
|
|
7219
7241
|
function isEmpty(ch) {
|
|
@@ -7415,7 +7437,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
7415
7437
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
7416
7438
|
this.indentNext = this.indentValue + 1;
|
|
7417
7439
|
this.indentValue += n;
|
|
7418
|
-
return
|
|
7440
|
+
return "block-start";
|
|
7419
7441
|
}
|
|
7420
7442
|
return "doc";
|
|
7421
7443
|
}
|
|
@@ -7722,26 +7744,37 @@ var require_lexer = __commonJS((exports) => {
|
|
|
7722
7744
|
return 0;
|
|
7723
7745
|
}
|
|
7724
7746
|
*pushIndicators() {
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
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
|
+
}
|
|
7741
7774
|
}
|
|
7775
|
+
break loop;
|
|
7742
7776
|
}
|
|
7743
|
-
|
|
7744
|
-
return 0;
|
|
7777
|
+
return n;
|
|
7745
7778
|
}
|
|
7746
7779
|
*pushTag() {
|
|
7747
7780
|
if (this.charAt(1) === "<") {
|
|
@@ -7799,7 +7832,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
7799
7832
|
exports.Lexer = Lexer;
|
|
7800
7833
|
});
|
|
7801
7834
|
|
|
7802
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
7835
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/line-counter.js
|
|
7803
7836
|
var require_line_counter = __commonJS((exports) => {
|
|
7804
7837
|
class LineCounter {
|
|
7805
7838
|
constructor() {
|
|
@@ -7827,7 +7860,7 @@ var require_line_counter = __commonJS((exports) => {
|
|
|
7827
7860
|
exports.LineCounter = LineCounter;
|
|
7828
7861
|
});
|
|
7829
7862
|
|
|
7830
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
7863
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/parse/parser.js
|
|
7831
7864
|
var require_parser = __commonJS((exports) => {
|
|
7832
7865
|
var node_process = __require("process");
|
|
7833
7866
|
var cst = require_cst();
|
|
@@ -7895,6 +7928,13 @@ var require_parser = __commonJS((exports) => {
|
|
|
7895
7928
|
while (prev[++i]?.type === "space") {}
|
|
7896
7929
|
return prev.splice(i, prev.length);
|
|
7897
7930
|
}
|
|
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
|
+
}
|
|
7898
7938
|
function fixFlowSeqItems(fc) {
|
|
7899
7939
|
if (fc.start.type === "flow-seq-start") {
|
|
7900
7940
|
for (const it of fc.items) {
|
|
@@ -7904,11 +7944,11 @@ var require_parser = __commonJS((exports) => {
|
|
|
7904
7944
|
delete it.key;
|
|
7905
7945
|
if (isFlowToken(it.value)) {
|
|
7906
7946
|
if (it.value.end)
|
|
7907
|
-
|
|
7947
|
+
arrayPushArray(it.value.end, it.sep);
|
|
7908
7948
|
else
|
|
7909
7949
|
it.value.end = it.sep;
|
|
7910
7950
|
} else
|
|
7911
|
-
|
|
7951
|
+
arrayPushArray(it.start, it.sep);
|
|
7912
7952
|
delete it.sep;
|
|
7913
7953
|
}
|
|
7914
7954
|
}
|
|
@@ -8248,7 +8288,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
8248
8288
|
const prev = map.items[map.items.length - 2];
|
|
8249
8289
|
const end = prev?.value?.end;
|
|
8250
8290
|
if (Array.isArray(end)) {
|
|
8251
|
-
|
|
8291
|
+
arrayPushArray(end, it.start);
|
|
8252
8292
|
end.push(this.sourceToken);
|
|
8253
8293
|
map.items.pop();
|
|
8254
8294
|
return;
|
|
@@ -8436,7 +8476,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
8436
8476
|
const prev = seq.items[seq.items.length - 2];
|
|
8437
8477
|
const end = prev?.value?.end;
|
|
8438
8478
|
if (Array.isArray(end)) {
|
|
8439
|
-
|
|
8479
|
+
arrayPushArray(end, it.start);
|
|
8440
8480
|
end.push(this.sourceToken);
|
|
8441
8481
|
seq.items.pop();
|
|
8442
8482
|
return;
|
|
@@ -8676,7 +8716,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
8676
8716
|
exports.Parser = Parser;
|
|
8677
8717
|
});
|
|
8678
8718
|
|
|
8679
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
8719
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/public-api.js
|
|
8680
8720
|
var require_public_api = __commonJS((exports) => {
|
|
8681
8721
|
var composer = require_composer();
|
|
8682
8722
|
var Document = require_Document();
|
|
@@ -8770,7 +8810,7 @@ var require_public_api = __commonJS((exports) => {
|
|
|
8770
8810
|
exports.stringify = stringify;
|
|
8771
8811
|
});
|
|
8772
8812
|
|
|
8773
|
-
// ../../../node_modules/.bun/yaml@2.
|
|
8813
|
+
// ../../../node_modules/.bun/yaml@2.9.1/node_modules/yaml/dist/index.js
|
|
8774
8814
|
var require_dist = __commonJS((exports) => {
|
|
8775
8815
|
var composer = require_composer();
|
|
8776
8816
|
var Document = require_Document();
|
|
@@ -9455,7 +9495,7 @@ var init_open = __esm(() => {
|
|
|
9455
9495
|
});
|
|
9456
9496
|
|
|
9457
9497
|
// src/index.ts
|
|
9458
|
-
import { createHash } from "node:crypto";
|
|
9498
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
9459
9499
|
import { mkdir as mkdir2, readFile as readFile3, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
|
|
9460
9500
|
import path3 from "node:path";
|
|
9461
9501
|
import process11 from "node:process";
|
|
@@ -9578,7 +9618,7 @@ function formatActivity(report, options = {}) {
|
|
|
9578
9618
|
}
|
|
9579
9619
|
|
|
9580
9620
|
// src/auth.ts
|
|
9581
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
9621
|
+
import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
9582
9622
|
import { homedir } from "node:os";
|
|
9583
9623
|
import { join } from "node:path";
|
|
9584
9624
|
|
|
@@ -9626,6 +9666,35 @@ function getCredentialKey() {
|
|
|
9626
9666
|
return new URL(api).host;
|
|
9627
9667
|
}
|
|
9628
9668
|
|
|
9669
|
+
// src/pkce.ts
|
|
9670
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
9671
|
+
function createLoginSecrets() {
|
|
9672
|
+
const codeVerifier = randomBytes(32).toString("base64url");
|
|
9673
|
+
return {
|
|
9674
|
+
state: randomBytes(24).toString("base64url"),
|
|
9675
|
+
codeVerifier,
|
|
9676
|
+
codeChallenge: createHash("sha256").update(codeVerifier).digest("base64url")
|
|
9677
|
+
};
|
|
9678
|
+
}
|
|
9679
|
+
function loginParams(secrets) {
|
|
9680
|
+
const params = new URLSearchParams;
|
|
9681
|
+
if (secrets) {
|
|
9682
|
+
params.set("state", secrets.state);
|
|
9683
|
+
params.set("code_challenge", secrets.codeChallenge);
|
|
9684
|
+
params.set("code_challenge_method", "S256");
|
|
9685
|
+
}
|
|
9686
|
+
return params;
|
|
9687
|
+
}
|
|
9688
|
+
function readLoopbackCallback(url, secrets) {
|
|
9689
|
+
const code = url.searchParams.get("code");
|
|
9690
|
+
if (!code)
|
|
9691
|
+
return { error: "Missing authorization code" };
|
|
9692
|
+
if (secrets && url.searchParams.get("state") !== secrets.state) {
|
|
9693
|
+
return { error: "State mismatch" };
|
|
9694
|
+
}
|
|
9695
|
+
return { code };
|
|
9696
|
+
}
|
|
9697
|
+
|
|
9629
9698
|
// src/auth.ts
|
|
9630
9699
|
var CONFIG_DIR = join(homedir(), ".pairit");
|
|
9631
9700
|
function getCredentialsFile() {
|
|
@@ -9635,11 +9704,27 @@ function getCredentialsFile() {
|
|
|
9635
9704
|
var CREDENTIALS_BACKEND = process.env.PAIRIT_CREDENTIALS_BACKEND || "keychain";
|
|
9636
9705
|
var KEYCHAIN_SERVICE = "pairit-cli";
|
|
9637
9706
|
var KEYTAR_MODULE_SPECIFIER = "keytar";
|
|
9638
|
-
async function
|
|
9707
|
+
async function serverSupportsPkce() {
|
|
9708
|
+
try {
|
|
9709
|
+
const response = await fetch(`${getApiUrl()}/api/cli/login-info`, {
|
|
9710
|
+
signal: AbortSignal.timeout(1e4)
|
|
9711
|
+
});
|
|
9712
|
+
if (!response.ok)
|
|
9713
|
+
return false;
|
|
9714
|
+
const info = await response.json();
|
|
9715
|
+
return Array.isArray(info.codeChallengeMethods) && info.codeChallengeMethods.includes("S256");
|
|
9716
|
+
} catch {
|
|
9717
|
+
return false;
|
|
9718
|
+
}
|
|
9719
|
+
}
|
|
9720
|
+
async function exchangeCodeForToken(code, secrets) {
|
|
9639
9721
|
const response = await fetch(`${getApiUrl()}/api/cli/exchange`, {
|
|
9640
9722
|
method: "POST",
|
|
9641
9723
|
headers: { "Content-Type": "application/json" },
|
|
9642
|
-
body: JSON.stringify({
|
|
9724
|
+
body: JSON.stringify({
|
|
9725
|
+
code,
|
|
9726
|
+
...secrets && { code_verifier: secrets.codeVerifier }
|
|
9727
|
+
})
|
|
9643
9728
|
});
|
|
9644
9729
|
if (!response.ok) {
|
|
9645
9730
|
const error = await response.json().catch(() => ({ message: "Unknown error" }));
|
|
@@ -9654,7 +9739,13 @@ async function exchangeCodeForToken(code) {
|
|
|
9654
9739
|
async function login() {
|
|
9655
9740
|
console.log(`Initiating login to ${getApiUrl()}...`);
|
|
9656
9741
|
const loginUrl = `${getApiUrl()}/login`;
|
|
9657
|
-
const
|
|
9742
|
+
const secrets = await serverSupportsPkce() ? createLoginSecrets() : null;
|
|
9743
|
+
if (!secrets) {
|
|
9744
|
+
console.warn("This server predates state/PKCE checks; using the older login handoff.");
|
|
9745
|
+
}
|
|
9746
|
+
const manualParams = loginParams(secrets);
|
|
9747
|
+
manualParams.set("manual", "1");
|
|
9748
|
+
const manualLoginUrl = `${loginUrl}?${manualParams}`;
|
|
9658
9749
|
if (canAttemptBrowserLogin()) {
|
|
9659
9750
|
try {
|
|
9660
9751
|
const { createServer } = await import("node:http");
|
|
@@ -9671,7 +9762,9 @@ async function login() {
|
|
|
9671
9762
|
});
|
|
9672
9763
|
});
|
|
9673
9764
|
const redirectUri = `http://127.0.0.1:${port}`;
|
|
9674
|
-
const
|
|
9765
|
+
const targetParams = loginParams(secrets);
|
|
9766
|
+
targetParams.set("cli_redirect_uri", redirectUri);
|
|
9767
|
+
const targetUrl = `${loginUrl}?${targetParams}`;
|
|
9675
9768
|
console.log(`Opening ${loginUrl} in your browser...`);
|
|
9676
9769
|
await open2(targetUrl);
|
|
9677
9770
|
console.log("Waiting for sign-in to complete...");
|
|
@@ -9682,9 +9775,10 @@ async function login() {
|
|
|
9682
9775
|
}, 120000);
|
|
9683
9776
|
server.on("request", (req, res) => {
|
|
9684
9777
|
try {
|
|
9685
|
-
const url = new URL(req.url || "/",
|
|
9686
|
-
const
|
|
9687
|
-
if (
|
|
9778
|
+
const url = new URL(req.url || "/", "http://127.0.0.1");
|
|
9779
|
+
const result = readLoopbackCallback(url, secrets);
|
|
9780
|
+
if ("code" in result) {
|
|
9781
|
+
const { code: code2 } = result;
|
|
9688
9782
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
9689
9783
|
res.end(`<!DOCTYPE html><html><head><title>Login Successful</title></head><body style="font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0"><div style="text-align:center"><h1>Authenticated!</h1><p>You can close this window and return to your CLI.</p></div><script>setTimeout(()=>window.close(),3000)</script></body></html>`);
|
|
9690
9784
|
clearTimeout(timeout);
|
|
@@ -9692,7 +9786,7 @@ async function login() {
|
|
|
9692
9786
|
resolve(code2);
|
|
9693
9787
|
} else {
|
|
9694
9788
|
res.writeHead(400);
|
|
9695
|
-
res.end(
|
|
9789
|
+
res.end(result.error);
|
|
9696
9790
|
}
|
|
9697
9791
|
} catch (_e) {
|
|
9698
9792
|
res.writeHead(500);
|
|
@@ -9701,7 +9795,7 @@ async function login() {
|
|
|
9701
9795
|
});
|
|
9702
9796
|
});
|
|
9703
9797
|
console.log("Exchanging authorization code for token...");
|
|
9704
|
-
const token2 = await exchangeCodeForToken(authCode);
|
|
9798
|
+
const token2 = await exchangeCodeForToken(authCode, secrets);
|
|
9705
9799
|
await saveCredentials({ token: token2 });
|
|
9706
9800
|
console.log("Successfully logged in!");
|
|
9707
9801
|
return;
|
|
@@ -9721,7 +9815,7 @@ Paste that code here to complete CLI login.
|
|
|
9721
9815
|
console.error("No authorization code provided");
|
|
9722
9816
|
process.exit(1);
|
|
9723
9817
|
}
|
|
9724
|
-
const token = await exchangeCodeForToken(code);
|
|
9818
|
+
const token = await exchangeCodeForToken(code, secrets);
|
|
9725
9819
|
await saveCredentials({ token });
|
|
9726
9820
|
console.log("Successfully logged in!");
|
|
9727
9821
|
}
|
|
@@ -9747,10 +9841,13 @@ async function saveCredentials(creds) {
|
|
|
9747
9841
|
return;
|
|
9748
9842
|
}
|
|
9749
9843
|
}
|
|
9750
|
-
await
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
});
|
|
9844
|
+
await writeCredentialsFile(CONFIG_DIR, getCredentialsFile(), JSON.stringify(creds, null, 2));
|
|
9845
|
+
}
|
|
9846
|
+
async function writeCredentialsFile(dir, file, contents) {
|
|
9847
|
+
await mkdir(dir, { recursive: true, mode: 448 });
|
|
9848
|
+
await chmod(dir, 448);
|
|
9849
|
+
await writeFile(file, contents, { mode: 384 });
|
|
9850
|
+
await chmod(file, 384);
|
|
9754
9851
|
}
|
|
9755
9852
|
async function getCredentials() {
|
|
9756
9853
|
if (CREDENTIALS_BACKEND !== "file") {
|
|
@@ -9767,7 +9864,9 @@ async function getCredentials() {
|
|
|
9767
9864
|
}
|
|
9768
9865
|
}
|
|
9769
9866
|
try {
|
|
9770
|
-
const
|
|
9867
|
+
const file = getCredentialsFile();
|
|
9868
|
+
const data = await readFile(file, "utf8");
|
|
9869
|
+
await chmod(file, 384).catch(() => {});
|
|
9771
9870
|
return JSON.parse(data);
|
|
9772
9871
|
} catch {
|
|
9773
9872
|
return null;
|
|
@@ -9808,8 +9907,112 @@ async function loadKeytar() {
|
|
|
9808
9907
|
}
|
|
9809
9908
|
}
|
|
9810
9909
|
|
|
9910
|
+
// src/csv.ts
|
|
9911
|
+
var FORMULA_PREFIX = /^[=+\-@\t\r]/;
|
|
9912
|
+
var PLAIN_NUMBER = /^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;
|
|
9913
|
+
function escapeCsvValue(value) {
|
|
9914
|
+
if (value === null || value === undefined)
|
|
9915
|
+
return "";
|
|
9916
|
+
let str = String(value);
|
|
9917
|
+
if (typeof value === "string" && FORMULA_PREFIX.test(str) && !PLAIN_NUMBER.test(str)) {
|
|
9918
|
+
str = `'${str}`;
|
|
9919
|
+
}
|
|
9920
|
+
if (/[",\r\n]/.test(str)) {
|
|
9921
|
+
return `"${str.replace(/"/g, '""')}"`;
|
|
9922
|
+
}
|
|
9923
|
+
return str;
|
|
9924
|
+
}
|
|
9925
|
+
|
|
9926
|
+
// src/group-lint.ts
|
|
9927
|
+
var GROUP_PATH = /^group(?:\.[A-Za-z0-9_]+)*/;
|
|
9928
|
+
var TEMPLATE = /\{\{\s*(group\.[A-Za-z0-9_.]+)\s*\}\}/g;
|
|
9929
|
+
function lintGroupView(config) {
|
|
9930
|
+
const errors = [];
|
|
9931
|
+
const shared = new Set;
|
|
9932
|
+
if (Array.isArray(config.matchmaking)) {
|
|
9933
|
+
config.matchmaking.forEach((pool, index) => {
|
|
9934
|
+
const share = pool?.share;
|
|
9935
|
+
if (share === undefined)
|
|
9936
|
+
return;
|
|
9937
|
+
if (!Array.isArray(share) || !share.every((key) => typeof key === "string" && /^\w+$/.test(key))) {
|
|
9938
|
+
errors.push(`matchmaking[${index}].share must be a list of session_state keys`);
|
|
9939
|
+
return;
|
|
9940
|
+
}
|
|
9941
|
+
for (const key of share)
|
|
9942
|
+
shared.add(key);
|
|
9943
|
+
});
|
|
9944
|
+
}
|
|
9945
|
+
const fields = new Map;
|
|
9946
|
+
for (const page of config.pages ?? []) {
|
|
9947
|
+
for (const component of page.components ?? []) {
|
|
9948
|
+
const c = component;
|
|
9949
|
+
if (c?.type !== "live-workspace" || c.props?.scope !== "group" || c.props?.mode !== "structured" || !Array.isArray(c.props.fields))
|
|
9950
|
+
continue;
|
|
9951
|
+
for (const field of c.props.fields) {
|
|
9952
|
+
const id = field?.id;
|
|
9953
|
+
if (typeof id !== "string")
|
|
9954
|
+
continue;
|
|
9955
|
+
const other = fields.get(id);
|
|
9956
|
+
if (other && other !== page.id) {
|
|
9957
|
+
errors.push(`group workspace field ${id} is on both ${other} and ${page.id}; group.ws needs unique field ids`);
|
|
9958
|
+
}
|
|
9959
|
+
fields.set(id, page.id ?? "");
|
|
9960
|
+
}
|
|
9961
|
+
}
|
|
9962
|
+
}
|
|
9963
|
+
const checkPath = (where, path2) => {
|
|
9964
|
+
const [, part, ...rest] = path2.split(".");
|
|
9965
|
+
if (part === "ws") {
|
|
9966
|
+
const field = rest[0];
|
|
9967
|
+
if (field && !fields.has(field)) {
|
|
9968
|
+
errors.push(`${where}: ${path2} is not a field of a structured group workspace`);
|
|
9969
|
+
}
|
|
9970
|
+
return;
|
|
9971
|
+
}
|
|
9972
|
+
if (part === "others") {
|
|
9973
|
+
const [index, key] = rest;
|
|
9974
|
+
if (index !== undefined && !/^\d+$/.test(index)) {
|
|
9975
|
+
errors.push(`${where}: ${path2} needs a member number, like group.others.0`);
|
|
9976
|
+
} else if (key && !shared.has(key)) {
|
|
9977
|
+
errors.push(`${where}: ${path2} reads ${key}, which no matchmaking pool lists in share`);
|
|
9978
|
+
}
|
|
9979
|
+
return;
|
|
9980
|
+
}
|
|
9981
|
+
errors.push(`${where}: ${path2} should start with group.ws or group.others`);
|
|
9982
|
+
};
|
|
9983
|
+
const walk = (where, value, key) => {
|
|
9984
|
+
if (typeof value === "string") {
|
|
9985
|
+
if (key === "when") {
|
|
9986
|
+
const path2 = value.trim().match(GROUP_PATH)?.[0];
|
|
9987
|
+
if (path2 && path2 !== "group")
|
|
9988
|
+
checkPath(where, path2);
|
|
9989
|
+
}
|
|
9990
|
+
for (const match of value.matchAll(TEMPLATE))
|
|
9991
|
+
checkPath(where, match[1]);
|
|
9992
|
+
return;
|
|
9993
|
+
}
|
|
9994
|
+
if (Array.isArray(value)) {
|
|
9995
|
+
for (const item of value)
|
|
9996
|
+
walk(where, item);
|
|
9997
|
+
return;
|
|
9998
|
+
}
|
|
9999
|
+
if (value && typeof value === "object") {
|
|
10000
|
+
for (const [k, v] of Object.entries(value))
|
|
10001
|
+
walk(where, v, k);
|
|
10002
|
+
}
|
|
10003
|
+
};
|
|
10004
|
+
config.pages?.forEach((page, index) => {
|
|
10005
|
+
walk(page.id ?? `pages[${index}]`, page);
|
|
10006
|
+
});
|
|
10007
|
+
config.agents?.forEach((agent, index) => {
|
|
10008
|
+
const id = agent?.id;
|
|
10009
|
+
walk(typeof id === "string" ? `agent ${id}` : `agents[${index}]`, agent);
|
|
10010
|
+
});
|
|
10011
|
+
return errors;
|
|
10012
|
+
}
|
|
10013
|
+
|
|
9811
10014
|
// src/html-assets.ts
|
|
9812
|
-
import { readFile as readFile2, stat } from "node:fs/promises";
|
|
10015
|
+
import { readFile as readFile2, realpath, stat } from "node:fs/promises";
|
|
9813
10016
|
import path2 from "node:path";
|
|
9814
10017
|
import process10 from "node:process";
|
|
9815
10018
|
var HTML_MAX_BYTES = 1024 * 1024;
|
|
@@ -9841,6 +10044,26 @@ function listHtmlComponents(config) {
|
|
|
9841
10044
|
}
|
|
9842
10045
|
return result;
|
|
9843
10046
|
}
|
|
10047
|
+
function isInside(dir, target) {
|
|
10048
|
+
const rel = path2.relative(dir, target);
|
|
10049
|
+
return rel !== ".." && !rel.startsWith(`..${path2.sep}`) && !path2.isAbsolute(rel);
|
|
10050
|
+
}
|
|
10051
|
+
async function resolveInsideConfigDir(configDir, relative) {
|
|
10052
|
+
const lexical = path2.resolve(configDir, relative);
|
|
10053
|
+
if (!isInside(configDir, lexical))
|
|
10054
|
+
return { error: "outside" };
|
|
10055
|
+
let real;
|
|
10056
|
+
let realDir;
|
|
10057
|
+
try {
|
|
10058
|
+
real = await realpath(lexical);
|
|
10059
|
+
realDir = await realpath(configDir);
|
|
10060
|
+
} catch {
|
|
10061
|
+
return { error: "missing" };
|
|
10062
|
+
}
|
|
10063
|
+
if (!isInside(realDir, real))
|
|
10064
|
+
return { error: "outside" };
|
|
10065
|
+
return { path: real };
|
|
10066
|
+
}
|
|
9844
10067
|
async function resolveHtmlSource(src, componentId, configDir) {
|
|
9845
10068
|
if (typeof src !== "string" || src.trim() === "") {
|
|
9846
10069
|
throw new Error(`html ${componentId}: missing src`);
|
|
@@ -9852,11 +10075,11 @@ async function resolveHtmlSource(src, componentId, configDir) {
|
|
|
9852
10075
|
if (path2.extname(trimmed).toLowerCase() !== ".html") {
|
|
9853
10076
|
throw new Error(`html ${componentId}: src must be a .html file`);
|
|
9854
10077
|
}
|
|
9855
|
-
const
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
throw new Error(`html ${componentId}: src must stay inside the config directory`);
|
|
10078
|
+
const resolved = await resolveInsideConfigDir(configDir, trimmed);
|
|
10079
|
+
if ("error" in resolved) {
|
|
10080
|
+
throw new Error(resolved.error === "outside" ? `html ${componentId}: src must stay inside the config directory` : `html ${componentId}: file not found: ${trimmed}`);
|
|
9859
10081
|
}
|
|
10082
|
+
const absolutePath = resolved.path;
|
|
9860
10083
|
let info;
|
|
9861
10084
|
try {
|
|
9862
10085
|
info = await stat(absolutePath);
|
|
@@ -9924,11 +10147,11 @@ async function resolveWorkspaceSchema(schema, componentId, configDir) {
|
|
|
9924
10147
|
if (typeof schema !== "string" || !schema.trim().endsWith(".json")) {
|
|
9925
10148
|
throw new Error(`live-workspace ${componentId}: schema must be a .json file`);
|
|
9926
10149
|
}
|
|
9927
|
-
const
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
throw new Error(`live-workspace ${componentId}: schema must stay inside the config directory`);
|
|
10150
|
+
const resolved = await resolveInsideConfigDir(configDir, schema.trim());
|
|
10151
|
+
if ("error" in resolved) {
|
|
10152
|
+
throw new Error(resolved.error === "outside" ? `live-workspace ${componentId}: schema must stay inside the config directory` : `live-workspace ${componentId}: can't read schema ${schema}: file not found`);
|
|
9931
10153
|
}
|
|
10154
|
+
const absolutePath = resolved.path;
|
|
9932
10155
|
try {
|
|
9933
10156
|
JSON.parse(await readFile2(absolutePath, "utf8"));
|
|
9934
10157
|
} catch (error) {
|
|
@@ -9969,6 +10192,81 @@ async function attachWorkspaceFilesToCompiledConfig(configPath, compiled) {
|
|
|
9969
10192
|
}
|
|
9970
10193
|
}
|
|
9971
10194
|
|
|
10195
|
+
// src/llm-keys.ts
|
|
10196
|
+
var PROVIDERS = [
|
|
10197
|
+
{
|
|
10198
|
+
provider: "openai",
|
|
10199
|
+
flag: "openai-api-key",
|
|
10200
|
+
field: "openaiApiKey",
|
|
10201
|
+
value: (o) => o.openaiApiKey,
|
|
10202
|
+
env: (o) => o.openaiApiKeyEnv,
|
|
10203
|
+
stdin: (o) => o.openaiApiKeyStdin,
|
|
10204
|
+
clear: (o) => o.clearOpenaiApiKey
|
|
10205
|
+
},
|
|
10206
|
+
{
|
|
10207
|
+
provider: "anthropic",
|
|
10208
|
+
flag: "anthropic-api-key",
|
|
10209
|
+
field: "anthropicApiKey",
|
|
10210
|
+
value: (o) => o.anthropicApiKey,
|
|
10211
|
+
env: (o) => o.anthropicApiKeyEnv,
|
|
10212
|
+
stdin: (o) => o.anthropicApiKeyStdin,
|
|
10213
|
+
clear: (o) => o.clearAnthropicApiKey
|
|
10214
|
+
}
|
|
10215
|
+
];
|
|
10216
|
+
async function resolveLlmKeys(options, io) {
|
|
10217
|
+
const stdinUsers = PROVIDERS.filter((p) => p.stdin(options));
|
|
10218
|
+
if (stdinUsers.length > 1) {
|
|
10219
|
+
throw new Error("Only one key can come from stdin. Use --<provider>-api-key-env for the other.");
|
|
10220
|
+
}
|
|
10221
|
+
const result = {
|
|
10222
|
+
llmCredentials: {},
|
|
10223
|
+
clearLlmCredentials: []
|
|
10224
|
+
};
|
|
10225
|
+
for (const p of PROVIDERS) {
|
|
10226
|
+
const sources = [
|
|
10227
|
+
p.value(options) !== undefined,
|
|
10228
|
+
p.env(options) !== undefined,
|
|
10229
|
+
Boolean(p.stdin(options))
|
|
10230
|
+
].filter(Boolean).length;
|
|
10231
|
+
if (sources > 1) {
|
|
10232
|
+
throw new Error(`Pass the ${p.provider} key one way: --${p.flag}, --${p.flag}-env or --${p.flag}-stdin.`);
|
|
10233
|
+
}
|
|
10234
|
+
if (sources > 0 && p.clear(options)) {
|
|
10235
|
+
throw new Error(`--clear-${p.flag} can't be combined with a new key.`);
|
|
10236
|
+
}
|
|
10237
|
+
let key;
|
|
10238
|
+
const envName = p.env(options);
|
|
10239
|
+
if (p.value(options) !== undefined) {
|
|
10240
|
+
key = p.value(options);
|
|
10241
|
+
} else if (envName !== undefined) {
|
|
10242
|
+
key = io.env[envName];
|
|
10243
|
+
if (!key?.trim()) {
|
|
10244
|
+
throw new Error(`Environment variable ${envName} is empty or unset.`);
|
|
10245
|
+
}
|
|
10246
|
+
} else if (p.stdin(options)) {
|
|
10247
|
+
key = await io.readStdin();
|
|
10248
|
+
if (!key.trim())
|
|
10249
|
+
throw new Error(`No ${p.provider} key on stdin.`);
|
|
10250
|
+
}
|
|
10251
|
+
if (key !== undefined) {
|
|
10252
|
+
const trimmed = key.trim();
|
|
10253
|
+
if (!trimmed)
|
|
10254
|
+
throw new Error(`--${p.flag} is empty.`);
|
|
10255
|
+
result.llmCredentials[p.field] = trimmed;
|
|
10256
|
+
} else if (p.clear(options)) {
|
|
10257
|
+
result.clearLlmCredentials.push(p.provider);
|
|
10258
|
+
}
|
|
10259
|
+
}
|
|
10260
|
+
return result;
|
|
10261
|
+
}
|
|
10262
|
+
async function readAllStdin() {
|
|
10263
|
+
const chunks = [];
|
|
10264
|
+
for await (const chunk of process.stdin) {
|
|
10265
|
+
chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
|
|
10266
|
+
}
|
|
10267
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
10268
|
+
}
|
|
10269
|
+
|
|
9972
10270
|
// src/randomize-lint.ts
|
|
9973
10271
|
function lintRandomization(config) {
|
|
9974
10272
|
const errors = [];
|
|
@@ -10025,9 +10323,34 @@ function singleGroupSize(config) {
|
|
|
10025
10323
|
return sizes.size === 1 ? [...sizes][0] : undefined;
|
|
10026
10324
|
}
|
|
10027
10325
|
|
|
10326
|
+
// src/redirect-lint.ts
|
|
10327
|
+
function isHttpUrl(value) {
|
|
10328
|
+
try {
|
|
10329
|
+
const url = new URL(value);
|
|
10330
|
+
return url.protocol === "https:" || url.protocol === "http:";
|
|
10331
|
+
} catch {
|
|
10332
|
+
return false;
|
|
10333
|
+
}
|
|
10334
|
+
}
|
|
10335
|
+
function lintEndRedirectUrls(config) {
|
|
10336
|
+
if (!Array.isArray(config.pages))
|
|
10337
|
+
return [];
|
|
10338
|
+
const errors = [];
|
|
10339
|
+
config.pages.forEach((page, index) => {
|
|
10340
|
+
const url = page?.endRedirectUrl;
|
|
10341
|
+
if (url === undefined || url === null)
|
|
10342
|
+
return;
|
|
10343
|
+
if (typeof url !== "string" || !isHttpUrl(url.trim())) {
|
|
10344
|
+
const where = page.id ? `page "${page.id}"` : `pages[${index}]`;
|
|
10345
|
+
errors.push(`${where}: endRedirectUrl must be an http:// or https:// URL`);
|
|
10346
|
+
}
|
|
10347
|
+
});
|
|
10348
|
+
return errors;
|
|
10349
|
+
}
|
|
10350
|
+
|
|
10028
10351
|
// src/index.ts
|
|
10029
10352
|
var program2 = new Command;
|
|
10030
|
-
program2.name("pairit").description("CLI for Pairit experiment configs").version("0.3.
|
|
10353
|
+
program2.name("pairit").description("CLI for Pairit experiment configs").version("0.3.7").option("--env <name>", "Target environment: staging or production", (value) => {
|
|
10031
10354
|
try {
|
|
10032
10355
|
return parseEnvName(value);
|
|
10033
10356
|
} catch (error) {
|
|
@@ -10075,7 +10398,7 @@ configCommand.command("compile").argument("<config>", "Path to YAML config").des
|
|
|
10075
10398
|
process11.exitCode = 1;
|
|
10076
10399
|
}
|
|
10077
10400
|
});
|
|
10078
|
-
configCommand.command("upload").argument("<config>", "Path to YAML config").option("--name <name>", "Config name (defaults to the YAML name field, then the file name)").option("--config-id <configId>", "Update an existing config by id (configs created before names)").option("--metadata <json>", "Optional metadata JSON string").option("--openai-api-key <key>", "OpenAI API key for this experiment").option("--anthropic-api-key <key>", "Anthropic API key for this experiment").description("Compile and upload config via Pairit Functions").action(async (configPath, options) => {
|
|
10401
|
+
configCommand.command("upload").argument("<config>", "Path to YAML config").option("--name <name>", "Config name (defaults to the YAML name field, then the file name)").option("--config-id <configId>", "Update an existing config by id (configs created before names)").option("--metadata <json>", "Optional metadata JSON string").option("--openai-api-key <key>", "OpenAI API key for this experiment (visible in ps and shell history; prefer --openai-api-key-env)").option("--openai-api-key-env <var>", "Read the OpenAI API key from this environment variable").option("--openai-api-key-stdin", "Read the OpenAI API key from stdin").option("--clear-openai-api-key", "Remove the stored OpenAI API key").option("--anthropic-api-key <key>", "Anthropic API key for this experiment (visible in ps and shell history; prefer --anthropic-api-key-env)").option("--anthropic-api-key-env <var>", "Read the Anthropic API key from this environment variable").option("--anthropic-api-key-stdin", "Read the Anthropic API key from stdin").option("--clear-anthropic-api-key", "Remove the stored Anthropic API key").description("Compile and upload config via Pairit Functions").action(async (configPath, options) => {
|
|
10079
10402
|
try {
|
|
10080
10403
|
const { payload, checksum, attachments } = await buildUploadPayload(configPath, options);
|
|
10081
10404
|
const response = await callFunctions("/configs/upload", {
|
|
@@ -10096,6 +10419,13 @@ configCommand.command("upload").argument("<config>", "Path to YAML config").opti
|
|
|
10096
10419
|
console.log(`✓ Uploaded ${label}, revision ${result.revision} (config unchanged)`);
|
|
10097
10420
|
}
|
|
10098
10421
|
console.log(` checksum ${checksum}`);
|
|
10422
|
+
for (const provider of payload.clearLlmCredentials ?? []) {
|
|
10423
|
+
if (result.llmCredentials?.[provider]) {
|
|
10424
|
+
console.warn(`⚠ The server kept the ${provider} key: it doesn't support clearing keys yet.`);
|
|
10425
|
+
} else {
|
|
10426
|
+
console.log(`✓ Cleared the ${provider} key`);
|
|
10427
|
+
}
|
|
10428
|
+
}
|
|
10099
10429
|
if (result.previousRevision != null && result.previousRevisionSessionCount > 0) {
|
|
10100
10430
|
const n = result.previousRevisionSessionCount;
|
|
10101
10431
|
console.warn(`⚠ ${n} participant${n === 1 ? "" : "s"} ran revision ${result.previousRevision}. New participants will get revision ${result.revision}.`);
|
|
@@ -10346,6 +10676,8 @@ async function lintConfig(configPath) {
|
|
|
10346
10676
|
});
|
|
10347
10677
|
}
|
|
10348
10678
|
errors.push(...lintRandomization(config));
|
|
10679
|
+
errors.push(...lintGroupView(config));
|
|
10680
|
+
errors.push(...lintEndRedirectUrls(config));
|
|
10349
10681
|
if (errors.length) {
|
|
10350
10682
|
throw new Error(errors.join(", "));
|
|
10351
10683
|
}
|
|
@@ -10354,6 +10686,10 @@ async function lintConfig(configPath) {
|
|
|
10354
10686
|
}
|
|
10355
10687
|
async function compileConfig(configPath) {
|
|
10356
10688
|
const config = await loadConfig(configPath);
|
|
10689
|
+
const redirectErrors = lintEndRedirectUrls(config);
|
|
10690
|
+
if (redirectErrors.length) {
|
|
10691
|
+
throw new Error(redirectErrors.join(", "));
|
|
10692
|
+
}
|
|
10357
10693
|
const poolConfigs = new Map;
|
|
10358
10694
|
if (Array.isArray(config.matchmaking)) {
|
|
10359
10695
|
for (const pool of config.matchmaking) {
|
|
@@ -10419,7 +10755,7 @@ async function buildUploadPayload(configPath, options) {
|
|
|
10419
10755
|
const parsed = JSON.parse(compiledContent);
|
|
10420
10756
|
const attachments = await attachHtmlToCompiledConfig(configPath, parsed);
|
|
10421
10757
|
await attachWorkspaceFilesToCompiledConfig(configPath, parsed);
|
|
10422
|
-
const hashBuffer =
|
|
10758
|
+
const hashBuffer = createHash2("sha256").update(JSON.stringify(parsed)).digest();
|
|
10423
10759
|
const checksum = hashBuffer.toString("hex");
|
|
10424
10760
|
const explicitName = options.name ?? sourceConfig.name;
|
|
10425
10761
|
const name = options.configId ? explicitName : explicitName ?? path3.basename(configPath, path3.extname(configPath));
|
|
@@ -10427,12 +10763,7 @@ async function buildUploadPayload(configPath, options) {
|
|
|
10427
10763
|
if (!metadata.originalFilename) {
|
|
10428
10764
|
metadata.originalFilename = path3.basename(configPath);
|
|
10429
10765
|
}
|
|
10430
|
-
const llmCredentials = {
|
|
10431
|
-
...options.openaiApiKey && { openaiApiKey: options.openaiApiKey },
|
|
10432
|
-
...options.anthropicApiKey && {
|
|
10433
|
-
anthropicApiKey: options.anthropicApiKey
|
|
10434
|
-
}
|
|
10435
|
-
};
|
|
10766
|
+
const { llmCredentials, clearLlmCredentials } = await resolveLlmKeys(options, { env: process11.env, readStdin: readAllStdin });
|
|
10436
10767
|
return {
|
|
10437
10768
|
payload: {
|
|
10438
10769
|
...name && { name },
|
|
@@ -10441,6 +10772,7 @@ async function buildUploadPayload(configPath, options) {
|
|
|
10441
10772
|
metadata: metadata ?? null,
|
|
10442
10773
|
config: parsed,
|
|
10443
10774
|
...Object.keys(llmCredentials).length > 0 && { llmCredentials },
|
|
10775
|
+
...clearLlmCredentials.length > 0 && { clearLlmCredentials },
|
|
10444
10776
|
allowRetake,
|
|
10445
10777
|
...requireAuth !== undefined && { requireAuth }
|
|
10446
10778
|
},
|
|
@@ -10451,7 +10783,7 @@ async function buildUploadPayload(configPath, options) {
|
|
|
10451
10783
|
async function uploadMedia(filePath, options) {
|
|
10452
10784
|
const resolved = await resolvePath(filePath);
|
|
10453
10785
|
const fileBuffer = await readFile3(resolved);
|
|
10454
|
-
const hashBuffer =
|
|
10786
|
+
const hashBuffer = createHash2("sha256").update(fileBuffer).digest();
|
|
10455
10787
|
const checksum = hashBuffer.toString("hex");
|
|
10456
10788
|
const defaultObject = `${toBase64Url(hashBuffer.subarray(0, 12))}${path3.extname(resolved)}`;
|
|
10457
10789
|
const object = options.object ?? defaultObject;
|
|
@@ -10727,16 +11059,6 @@ async function writeExportFile(basePath, data, format, flatten) {
|
|
|
10727
11059
|
await writeFile2(filePath, rows.join(`
|
|
10728
11060
|
`), "utf8");
|
|
10729
11061
|
}
|
|
10730
|
-
function escapeCsvValue(value) {
|
|
10731
|
-
if (value === null || value === undefined)
|
|
10732
|
-
return "";
|
|
10733
|
-
const str = String(value);
|
|
10734
|
-
if (str.includes(",") || str.includes('"') || str.includes(`
|
|
10735
|
-
`)) {
|
|
10736
|
-
return `"${str.replace(/"/g, '""')}"`;
|
|
10737
|
-
}
|
|
10738
|
-
return str;
|
|
10739
|
-
}
|
|
10740
11062
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
10741
11063
|
var __dirname3 = path3.dirname(__filename2);
|
|
10742
11064
|
export {
|