@schwabyio/gta 0.10.0 → 0.12.0
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/README.md +8 -3
- package/dist/SPEC.md +71 -27
- package/dist/chunks/{chunk-MZSHHPAQ.js → chunk-3NSHWS24.js} +453 -335
- package/dist/gta.js +69 -31
- package/dist/worker.js +1 -1
- package/package.json +1 -1
|
@@ -118,17 +118,17 @@ var require_visit = __commonJS({
|
|
|
118
118
|
visit2.BREAK = BREAK;
|
|
119
119
|
visit2.SKIP = SKIP;
|
|
120
120
|
visit2.REMOVE = REMOVE;
|
|
121
|
-
function visit_(key, node2, visitor,
|
|
122
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
121
|
+
function visit_(key, node2, visitor, path11) {
|
|
122
|
+
const ctrl = callVisitor(key, node2, visitor, path11);
|
|
123
123
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
124
|
-
replaceNode(key,
|
|
125
|
-
return visit_(key, ctrl, visitor,
|
|
124
|
+
replaceNode(key, path11, ctrl);
|
|
125
|
+
return visit_(key, ctrl, visitor, path11);
|
|
126
126
|
}
|
|
127
127
|
if (typeof ctrl !== "symbol") {
|
|
128
128
|
if (identity.isCollection(node2)) {
|
|
129
|
-
|
|
129
|
+
path11 = Object.freeze(path11.concat(node2));
|
|
130
130
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
131
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
131
|
+
const ci = visit_(i, node2.items[i], visitor, path11);
|
|
132
132
|
if (typeof ci === "number")
|
|
133
133
|
i = ci - 1;
|
|
134
134
|
else if (ci === BREAK)
|
|
@@ -139,13 +139,13 @@ var require_visit = __commonJS({
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
} else if (identity.isPair(node2)) {
|
|
142
|
-
|
|
143
|
-
const ck = visit_("key", node2.key, visitor,
|
|
142
|
+
path11 = Object.freeze(path11.concat(node2));
|
|
143
|
+
const ck = visit_("key", node2.key, visitor, path11);
|
|
144
144
|
if (ck === BREAK)
|
|
145
145
|
return BREAK;
|
|
146
146
|
else if (ck === REMOVE)
|
|
147
147
|
node2.key = null;
|
|
148
|
-
const cv = visit_("value", node2.value, visitor,
|
|
148
|
+
const cv = visit_("value", node2.value, visitor, path11);
|
|
149
149
|
if (cv === BREAK)
|
|
150
150
|
return BREAK;
|
|
151
151
|
else if (cv === REMOVE)
|
|
@@ -166,17 +166,17 @@ var require_visit = __commonJS({
|
|
|
166
166
|
visitAsync.BREAK = BREAK;
|
|
167
167
|
visitAsync.SKIP = SKIP;
|
|
168
168
|
visitAsync.REMOVE = REMOVE;
|
|
169
|
-
async function visitAsync_(key, node2, visitor,
|
|
170
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
169
|
+
async function visitAsync_(key, node2, visitor, path11) {
|
|
170
|
+
const ctrl = await callVisitor(key, node2, visitor, path11);
|
|
171
171
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
172
|
-
replaceNode(key,
|
|
173
|
-
return visitAsync_(key, ctrl, visitor,
|
|
172
|
+
replaceNode(key, path11, ctrl);
|
|
173
|
+
return visitAsync_(key, ctrl, visitor, path11);
|
|
174
174
|
}
|
|
175
175
|
if (typeof ctrl !== "symbol") {
|
|
176
176
|
if (identity.isCollection(node2)) {
|
|
177
|
-
|
|
177
|
+
path11 = Object.freeze(path11.concat(node2));
|
|
178
178
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
179
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
179
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path11);
|
|
180
180
|
if (typeof ci === "number")
|
|
181
181
|
i = ci - 1;
|
|
182
182
|
else if (ci === BREAK)
|
|
@@ -187,13 +187,13 @@ var require_visit = __commonJS({
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
} else if (identity.isPair(node2)) {
|
|
190
|
-
|
|
191
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
190
|
+
path11 = Object.freeze(path11.concat(node2));
|
|
191
|
+
const ck = await visitAsync_("key", node2.key, visitor, path11);
|
|
192
192
|
if (ck === BREAK)
|
|
193
193
|
return BREAK;
|
|
194
194
|
else if (ck === REMOVE)
|
|
195
195
|
node2.key = null;
|
|
196
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
196
|
+
const cv = await visitAsync_("value", node2.value, visitor, path11);
|
|
197
197
|
if (cv === BREAK)
|
|
198
198
|
return BREAK;
|
|
199
199
|
else if (cv === REMOVE)
|
|
@@ -220,23 +220,23 @@ var require_visit = __commonJS({
|
|
|
220
220
|
}
|
|
221
221
|
return visitor;
|
|
222
222
|
}
|
|
223
|
-
function callVisitor(key, node2, visitor,
|
|
223
|
+
function callVisitor(key, node2, visitor, path11) {
|
|
224
224
|
if (typeof visitor === "function")
|
|
225
|
-
return visitor(key, node2,
|
|
225
|
+
return visitor(key, node2, path11);
|
|
226
226
|
if (identity.isMap(node2))
|
|
227
|
-
return visitor.Map?.(key, node2,
|
|
227
|
+
return visitor.Map?.(key, node2, path11);
|
|
228
228
|
if (identity.isSeq(node2))
|
|
229
|
-
return visitor.Seq?.(key, node2,
|
|
229
|
+
return visitor.Seq?.(key, node2, path11);
|
|
230
230
|
if (identity.isPair(node2))
|
|
231
|
-
return visitor.Pair?.(key, node2,
|
|
231
|
+
return visitor.Pair?.(key, node2, path11);
|
|
232
232
|
if (identity.isScalar(node2))
|
|
233
|
-
return visitor.Scalar?.(key, node2,
|
|
233
|
+
return visitor.Scalar?.(key, node2, path11);
|
|
234
234
|
if (identity.isAlias(node2))
|
|
235
|
-
return visitor.Alias?.(key, node2,
|
|
235
|
+
return visitor.Alias?.(key, node2, path11);
|
|
236
236
|
return void 0;
|
|
237
237
|
}
|
|
238
|
-
function replaceNode(key,
|
|
239
|
-
const parent =
|
|
238
|
+
function replaceNode(key, path11, node2) {
|
|
239
|
+
const parent = path11[path11.length - 1];
|
|
240
240
|
if (identity.isCollection(parent)) {
|
|
241
241
|
parent.items[key] = node2;
|
|
242
242
|
} else if (identity.isPair(parent)) {
|
|
@@ -848,10 +848,10 @@ var require_Collection = __commonJS({
|
|
|
848
848
|
var createNode = require_createNode();
|
|
849
849
|
var identity = require_identity();
|
|
850
850
|
var Node = require_Node();
|
|
851
|
-
function collectionFromPath(schema,
|
|
851
|
+
function collectionFromPath(schema, path11, value) {
|
|
852
852
|
let v = value;
|
|
853
|
-
for (let i =
|
|
854
|
-
const k =
|
|
853
|
+
for (let i = path11.length - 1; i >= 0; --i) {
|
|
854
|
+
const k = path11[i];
|
|
855
855
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
856
856
|
const a = [];
|
|
857
857
|
a[k] = v;
|
|
@@ -870,7 +870,7 @@ var require_Collection = __commonJS({
|
|
|
870
870
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
871
871
|
});
|
|
872
872
|
}
|
|
873
|
-
var isEmptyPath = (
|
|
873
|
+
var isEmptyPath = (path11) => path11 == null || typeof path11 === "object" && !!path11[Symbol.iterator]().next().done;
|
|
874
874
|
var Collection = class extends Node.NodeBase {
|
|
875
875
|
constructor(type, schema) {
|
|
876
876
|
super(type);
|
|
@@ -900,11 +900,11 @@ var require_Collection = __commonJS({
|
|
|
900
900
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
901
901
|
* that already exists in the map.
|
|
902
902
|
*/
|
|
903
|
-
addIn(
|
|
904
|
-
if (isEmptyPath(
|
|
903
|
+
addIn(path11, value) {
|
|
904
|
+
if (isEmptyPath(path11))
|
|
905
905
|
this.add(value);
|
|
906
906
|
else {
|
|
907
|
-
const [key, ...rest] =
|
|
907
|
+
const [key, ...rest] = path11;
|
|
908
908
|
const node2 = this.get(key, true);
|
|
909
909
|
if (identity.isCollection(node2))
|
|
910
910
|
node2.addIn(rest, value);
|
|
@@ -918,8 +918,8 @@ var require_Collection = __commonJS({
|
|
|
918
918
|
* Removes a value from the collection.
|
|
919
919
|
* @returns `true` if the item was found and removed.
|
|
920
920
|
*/
|
|
921
|
-
deleteIn(
|
|
922
|
-
const [key, ...rest] =
|
|
921
|
+
deleteIn(path11) {
|
|
922
|
+
const [key, ...rest] = path11;
|
|
923
923
|
if (rest.length === 0)
|
|
924
924
|
return this.delete(key);
|
|
925
925
|
const node2 = this.get(key, true);
|
|
@@ -933,8 +933,8 @@ var require_Collection = __commonJS({
|
|
|
933
933
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
934
934
|
* `true` (collections are always returned intact).
|
|
935
935
|
*/
|
|
936
|
-
getIn(
|
|
937
|
-
const [key, ...rest] =
|
|
936
|
+
getIn(path11, keepScalar) {
|
|
937
|
+
const [key, ...rest] = path11;
|
|
938
938
|
const node2 = this.get(key, true);
|
|
939
939
|
if (rest.length === 0)
|
|
940
940
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -952,8 +952,8 @@ var require_Collection = __commonJS({
|
|
|
952
952
|
/**
|
|
953
953
|
* Checks if the collection includes a value with the key `key`.
|
|
954
954
|
*/
|
|
955
|
-
hasIn(
|
|
956
|
-
const [key, ...rest] =
|
|
955
|
+
hasIn(path11) {
|
|
956
|
+
const [key, ...rest] = path11;
|
|
957
957
|
if (rest.length === 0)
|
|
958
958
|
return this.has(key);
|
|
959
959
|
const node2 = this.get(key, true);
|
|
@@ -963,8 +963,8 @@ var require_Collection = __commonJS({
|
|
|
963
963
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
964
964
|
* boolean to add/remove the item from the set.
|
|
965
965
|
*/
|
|
966
|
-
setIn(
|
|
967
|
-
const [key, ...rest] =
|
|
966
|
+
setIn(path11, value) {
|
|
967
|
+
const [key, ...rest] = path11;
|
|
968
968
|
if (rest.length === 0) {
|
|
969
969
|
this.set(key, value);
|
|
970
970
|
} else {
|
|
@@ -3479,9 +3479,9 @@ var require_Document = __commonJS({
|
|
|
3479
3479
|
this.contents.add(value);
|
|
3480
3480
|
}
|
|
3481
3481
|
/** Adds a value to the document. */
|
|
3482
|
-
addIn(
|
|
3482
|
+
addIn(path11, value) {
|
|
3483
3483
|
if (assertCollection(this.contents))
|
|
3484
|
-
this.contents.addIn(
|
|
3484
|
+
this.contents.addIn(path11, value);
|
|
3485
3485
|
}
|
|
3486
3486
|
/**
|
|
3487
3487
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3556,14 +3556,14 @@ var require_Document = __commonJS({
|
|
|
3556
3556
|
* Removes a value from the document.
|
|
3557
3557
|
* @returns `true` if the item was found and removed.
|
|
3558
3558
|
*/
|
|
3559
|
-
deleteIn(
|
|
3560
|
-
if (Collection.isEmptyPath(
|
|
3559
|
+
deleteIn(path11) {
|
|
3560
|
+
if (Collection.isEmptyPath(path11)) {
|
|
3561
3561
|
if (this.contents == null)
|
|
3562
3562
|
return false;
|
|
3563
3563
|
this.contents = null;
|
|
3564
3564
|
return true;
|
|
3565
3565
|
}
|
|
3566
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3566
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path11) : false;
|
|
3567
3567
|
}
|
|
3568
3568
|
/**
|
|
3569
3569
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3578,10 +3578,10 @@ var require_Document = __commonJS({
|
|
|
3578
3578
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3579
3579
|
* `true` (collections are always returned intact).
|
|
3580
3580
|
*/
|
|
3581
|
-
getIn(
|
|
3582
|
-
if (Collection.isEmptyPath(
|
|
3581
|
+
getIn(path11, keepScalar) {
|
|
3582
|
+
if (Collection.isEmptyPath(path11))
|
|
3583
3583
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3584
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3584
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path11, keepScalar) : void 0;
|
|
3585
3585
|
}
|
|
3586
3586
|
/**
|
|
3587
3587
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3592,10 +3592,10 @@ var require_Document = __commonJS({
|
|
|
3592
3592
|
/**
|
|
3593
3593
|
* Checks if the document includes a value at `path`.
|
|
3594
3594
|
*/
|
|
3595
|
-
hasIn(
|
|
3596
|
-
if (Collection.isEmptyPath(
|
|
3595
|
+
hasIn(path11) {
|
|
3596
|
+
if (Collection.isEmptyPath(path11))
|
|
3597
3597
|
return this.contents !== void 0;
|
|
3598
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3598
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path11) : false;
|
|
3599
3599
|
}
|
|
3600
3600
|
/**
|
|
3601
3601
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3612,13 +3612,13 @@ var require_Document = __commonJS({
|
|
|
3612
3612
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3613
3613
|
* boolean to add/remove the item from the set.
|
|
3614
3614
|
*/
|
|
3615
|
-
setIn(
|
|
3616
|
-
if (Collection.isEmptyPath(
|
|
3615
|
+
setIn(path11, value) {
|
|
3616
|
+
if (Collection.isEmptyPath(path11)) {
|
|
3617
3617
|
this.contents = value;
|
|
3618
3618
|
} else if (this.contents == null) {
|
|
3619
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3619
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path11), value);
|
|
3620
3620
|
} else if (assertCollection(this.contents)) {
|
|
3621
|
-
this.contents.setIn(
|
|
3621
|
+
this.contents.setIn(path11, value);
|
|
3622
3622
|
}
|
|
3623
3623
|
}
|
|
3624
3624
|
/**
|
|
@@ -5579,9 +5579,9 @@ var require_cst_visit = __commonJS({
|
|
|
5579
5579
|
visit2.BREAK = BREAK;
|
|
5580
5580
|
visit2.SKIP = SKIP;
|
|
5581
5581
|
visit2.REMOVE = REMOVE;
|
|
5582
|
-
visit2.itemAtPath = (cst,
|
|
5582
|
+
visit2.itemAtPath = (cst, path11) => {
|
|
5583
5583
|
let item = cst;
|
|
5584
|
-
for (const [field, index] of
|
|
5584
|
+
for (const [field, index] of path11) {
|
|
5585
5585
|
const tok = item?.[field];
|
|
5586
5586
|
if (tok && "items" in tok) {
|
|
5587
5587
|
item = tok.items[index];
|
|
@@ -5590,23 +5590,23 @@ var require_cst_visit = __commonJS({
|
|
|
5590
5590
|
}
|
|
5591
5591
|
return item;
|
|
5592
5592
|
};
|
|
5593
|
-
visit2.parentCollection = (cst,
|
|
5594
|
-
const parent = visit2.itemAtPath(cst,
|
|
5595
|
-
const field =
|
|
5593
|
+
visit2.parentCollection = (cst, path11) => {
|
|
5594
|
+
const parent = visit2.itemAtPath(cst, path11.slice(0, -1));
|
|
5595
|
+
const field = path11[path11.length - 1][0];
|
|
5596
5596
|
const coll = parent?.[field];
|
|
5597
5597
|
if (coll && "items" in coll)
|
|
5598
5598
|
return coll;
|
|
5599
5599
|
throw new Error("Parent collection not found");
|
|
5600
5600
|
};
|
|
5601
|
-
function _visit(
|
|
5602
|
-
let ctrl = visitor(item,
|
|
5601
|
+
function _visit(path11, item, visitor) {
|
|
5602
|
+
let ctrl = visitor(item, path11);
|
|
5603
5603
|
if (typeof ctrl === "symbol")
|
|
5604
5604
|
return ctrl;
|
|
5605
5605
|
for (const field of ["key", "value"]) {
|
|
5606
5606
|
const token = item[field];
|
|
5607
5607
|
if (token && "items" in token) {
|
|
5608
5608
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5609
|
-
const ci = _visit(Object.freeze(
|
|
5609
|
+
const ci = _visit(Object.freeze(path11.concat([[field, i]])), token.items[i], visitor);
|
|
5610
5610
|
if (typeof ci === "number")
|
|
5611
5611
|
i = ci - 1;
|
|
5612
5612
|
else if (ci === BREAK)
|
|
@@ -5617,10 +5617,10 @@ var require_cst_visit = __commonJS({
|
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
5619
|
if (typeof ctrl === "function" && field === "key")
|
|
5620
|
-
ctrl = ctrl(item,
|
|
5620
|
+
ctrl = ctrl(item, path11);
|
|
5621
5621
|
}
|
|
5622
5622
|
}
|
|
5623
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5623
|
+
return typeof ctrl === "function" ? ctrl(item, path11) : ctrl;
|
|
5624
5624
|
}
|
|
5625
5625
|
exports.visit = visit2;
|
|
5626
5626
|
}
|
|
@@ -8480,14 +8480,14 @@ var require_util = __commonJS({
|
|
|
8480
8480
|
}
|
|
8481
8481
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
8482
8482
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
8483
|
-
let
|
|
8483
|
+
let path11 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
8484
8484
|
if (origin[origin.length - 1] === "/") {
|
|
8485
8485
|
origin = origin.slice(0, origin.length - 1);
|
|
8486
8486
|
}
|
|
8487
|
-
if (
|
|
8488
|
-
|
|
8487
|
+
if (path11 && path11[0] !== "/") {
|
|
8488
|
+
path11 = `/${path11}`;
|
|
8489
8489
|
}
|
|
8490
|
-
return new URL(`${origin}${
|
|
8490
|
+
return new URL(`${origin}${path11}`);
|
|
8491
8491
|
}
|
|
8492
8492
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
8493
8493
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -9358,9 +9358,9 @@ var require_diagnostics = __commonJS({
|
|
|
9358
9358
|
"undici:client:sendHeaders",
|
|
9359
9359
|
(evt) => {
|
|
9360
9360
|
const {
|
|
9361
|
-
request: { method, path:
|
|
9361
|
+
request: { method, path: path11, origin }
|
|
9362
9362
|
} = evt;
|
|
9363
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
9363
|
+
debugLog("sending request to %s %s%s", method, origin, path11);
|
|
9364
9364
|
}
|
|
9365
9365
|
);
|
|
9366
9366
|
}
|
|
@@ -9378,14 +9378,14 @@ var require_diagnostics = __commonJS({
|
|
|
9378
9378
|
"undici:request:headers",
|
|
9379
9379
|
(evt) => {
|
|
9380
9380
|
const {
|
|
9381
|
-
request: { method, path:
|
|
9381
|
+
request: { method, path: path11, origin },
|
|
9382
9382
|
response: { statusCode }
|
|
9383
9383
|
} = evt;
|
|
9384
9384
|
debugLog(
|
|
9385
9385
|
"received response to %s %s%s - HTTP %d",
|
|
9386
9386
|
method,
|
|
9387
9387
|
origin,
|
|
9388
|
-
|
|
9388
|
+
path11,
|
|
9389
9389
|
statusCode
|
|
9390
9390
|
);
|
|
9391
9391
|
}
|
|
@@ -9394,23 +9394,23 @@ var require_diagnostics = __commonJS({
|
|
|
9394
9394
|
"undici:request:trailers",
|
|
9395
9395
|
(evt) => {
|
|
9396
9396
|
const {
|
|
9397
|
-
request: { method, path:
|
|
9397
|
+
request: { method, path: path11, origin }
|
|
9398
9398
|
} = evt;
|
|
9399
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
9399
|
+
debugLog("trailers received from %s %s%s", method, origin, path11);
|
|
9400
9400
|
}
|
|
9401
9401
|
);
|
|
9402
9402
|
diagnosticsChannel.subscribe(
|
|
9403
9403
|
"undici:request:error",
|
|
9404
9404
|
(evt) => {
|
|
9405
9405
|
const {
|
|
9406
|
-
request: { method, path:
|
|
9406
|
+
request: { method, path: path11, origin },
|
|
9407
9407
|
error: error62
|
|
9408
9408
|
} = evt;
|
|
9409
9409
|
debugLog(
|
|
9410
9410
|
"request to %s %s%s errored - %s",
|
|
9411
9411
|
method,
|
|
9412
9412
|
origin,
|
|
9413
|
-
|
|
9413
|
+
path11,
|
|
9414
9414
|
error62.message
|
|
9415
9415
|
);
|
|
9416
9416
|
}
|
|
@@ -9565,7 +9565,7 @@ var require_request = __commonJS({
|
|
|
9565
9565
|
};
|
|
9566
9566
|
var Request = class {
|
|
9567
9567
|
constructor(origin, {
|
|
9568
|
-
path:
|
|
9568
|
+
path: path11,
|
|
9569
9569
|
method,
|
|
9570
9570
|
body,
|
|
9571
9571
|
headers,
|
|
@@ -9582,11 +9582,11 @@ var require_request = __commonJS({
|
|
|
9582
9582
|
maxRedirections,
|
|
9583
9583
|
typeOfService
|
|
9584
9584
|
}, handler) {
|
|
9585
|
-
if (typeof
|
|
9585
|
+
if (typeof path11 !== "string") {
|
|
9586
9586
|
throw new InvalidArgumentError("path must be a string");
|
|
9587
|
-
} else if (
|
|
9587
|
+
} else if (path11[0] !== "/" && !(path11.startsWith("http://") || path11.startsWith("https://")) && method !== "CONNECT") {
|
|
9588
9588
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
9589
|
-
} else if (invalidPathRegex.test(
|
|
9589
|
+
} else if (invalidPathRegex.test(path11)) {
|
|
9590
9590
|
throw new InvalidArgumentError("invalid request path");
|
|
9591
9591
|
}
|
|
9592
9592
|
if (typeof method !== "string") {
|
|
@@ -9661,7 +9661,7 @@ var require_request = __commonJS({
|
|
|
9661
9661
|
this.completed = false;
|
|
9662
9662
|
this.aborted = false;
|
|
9663
9663
|
this.upgrade = upgrade || null;
|
|
9664
|
-
this.path = query ? serializePathWithQuery(
|
|
9664
|
+
this.path = query ? serializePathWithQuery(path11, query) : path11;
|
|
9665
9665
|
this.origin = origin;
|
|
9666
9666
|
this.protocol = getProtocolFromUrlString(origin);
|
|
9667
9667
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" || method === "QUERY" : idempotent;
|
|
@@ -14770,7 +14770,7 @@ var require_client_h1 = __commonJS({
|
|
|
14770
14770
|
}
|
|
14771
14771
|
}
|
|
14772
14772
|
function writeH1(client, request) {
|
|
14773
|
-
const { method, path:
|
|
14773
|
+
const { method, path: path11, host, upgrade, blocking, reset } = request;
|
|
14774
14774
|
let { body, headers, contentLength } = request;
|
|
14775
14775
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
14776
14776
|
if (util.isFormDataLike(body)) {
|
|
@@ -14846,7 +14846,7 @@ var require_client_h1 = __commonJS({
|
|
|
14846
14846
|
socket[kBlocking] = true;
|
|
14847
14847
|
}
|
|
14848
14848
|
setTypeOfService(socket, request);
|
|
14849
|
-
let header = `${method} ${
|
|
14849
|
+
let header = `${method} ${path11} HTTP/1.1\r
|
|
14850
14850
|
`;
|
|
14851
14851
|
if (typeof host === "string") {
|
|
14852
14852
|
header += `host: ${host}\r
|
|
@@ -15929,7 +15929,7 @@ var require_client_h2 = __commonJS({
|
|
|
15929
15929
|
const headersTimeout = request.headersTimeout ?? client[kHeadersTimeout];
|
|
15930
15930
|
const bodyTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
15931
15931
|
const session = client[kHTTP2Session];
|
|
15932
|
-
const { method, path:
|
|
15932
|
+
const { method, path: path11, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
|
|
15933
15933
|
if (upgrade != null && upgrade !== "websocket") {
|
|
15934
15934
|
util.errorRequest(client, request, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
15935
15935
|
return false;
|
|
@@ -15994,7 +15994,7 @@ var require_client_h2 = __commonJS({
|
|
|
15994
15994
|
}
|
|
15995
15995
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
15996
15996
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
15997
|
-
headers[HTTP2_HEADER_PATH] =
|
|
15997
|
+
headers[HTTP2_HEADER_PATH] = path11;
|
|
15998
15998
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
15999
15999
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
16000
16000
|
} else {
|
|
@@ -16016,7 +16016,7 @@ var require_client_h2 = __commonJS({
|
|
|
16016
16016
|
setupUpgradeStream(stream, state);
|
|
16017
16017
|
return true;
|
|
16018
16018
|
}
|
|
16019
|
-
headers[HTTP2_HEADER_PATH] =
|
|
16019
|
+
headers[HTTP2_HEADER_PATH] = path11;
|
|
16020
16020
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
16021
16021
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
16022
16022
|
let body = state.body;
|
|
@@ -18772,10 +18772,10 @@ var require_proxy_agent = __commonJS({
|
|
|
18772
18772
|
};
|
|
18773
18773
|
const {
|
|
18774
18774
|
origin,
|
|
18775
|
-
path:
|
|
18775
|
+
path: path11 = "/",
|
|
18776
18776
|
headers = {}
|
|
18777
18777
|
} = opts;
|
|
18778
|
-
opts.path = origin +
|
|
18778
|
+
opts.path = origin + path11;
|
|
18779
18779
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
18780
18780
|
const { host } = new URL(origin);
|
|
18781
18781
|
headers.host = host;
|
|
@@ -21128,20 +21128,20 @@ var require_mock_utils = __commonJS({
|
|
|
21128
21128
|
}
|
|
21129
21129
|
return normalizedQp;
|
|
21130
21130
|
}
|
|
21131
|
-
function safeUrl(
|
|
21132
|
-
if (typeof
|
|
21133
|
-
return
|
|
21131
|
+
function safeUrl(path11) {
|
|
21132
|
+
if (typeof path11 !== "string") {
|
|
21133
|
+
return path11;
|
|
21134
21134
|
}
|
|
21135
|
-
const pathSegments =
|
|
21135
|
+
const pathSegments = path11.split("?", 3);
|
|
21136
21136
|
if (pathSegments.length !== 2) {
|
|
21137
|
-
return
|
|
21137
|
+
return path11;
|
|
21138
21138
|
}
|
|
21139
21139
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
21140
21140
|
qp.sort();
|
|
21141
21141
|
return [...pathSegments, qp.toString()].join("?");
|
|
21142
21142
|
}
|
|
21143
|
-
function matchKey(mockDispatch2, { path:
|
|
21144
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
21143
|
+
function matchKey(mockDispatch2, { path: path11, method, body, headers }) {
|
|
21144
|
+
const pathMatch = matchValue(mockDispatch2.path, path11);
|
|
21145
21145
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
21146
21146
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
21147
21147
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -21168,8 +21168,8 @@ var require_mock_utils = __commonJS({
|
|
|
21168
21168
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
21169
21169
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
21170
21170
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
21171
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
21172
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
21171
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path11, ignoreTrailingSlash }) => {
|
|
21172
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path11)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path11), resolvedPath);
|
|
21173
21173
|
});
|
|
21174
21174
|
if (matchedMockDispatches.length === 0) {
|
|
21175
21175
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -21208,22 +21208,22 @@ var require_mock_utils = __commonJS({
|
|
|
21208
21208
|
mockDispatches.splice(index, 1);
|
|
21209
21209
|
}
|
|
21210
21210
|
}
|
|
21211
|
-
function removeTrailingSlash(
|
|
21212
|
-
if (typeof
|
|
21213
|
-
return
|
|
21211
|
+
function removeTrailingSlash(path11) {
|
|
21212
|
+
if (typeof path11 !== "string") {
|
|
21213
|
+
return path11;
|
|
21214
21214
|
}
|
|
21215
|
-
while (
|
|
21216
|
-
|
|
21215
|
+
while (path11.endsWith("/")) {
|
|
21216
|
+
path11 = path11.slice(0, -1);
|
|
21217
21217
|
}
|
|
21218
|
-
if (
|
|
21219
|
-
|
|
21218
|
+
if (path11.length === 0) {
|
|
21219
|
+
path11 = "/";
|
|
21220
21220
|
}
|
|
21221
|
-
return
|
|
21221
|
+
return path11;
|
|
21222
21222
|
}
|
|
21223
21223
|
function buildKey(opts) {
|
|
21224
|
-
const { path:
|
|
21224
|
+
const { path: path11, method, body, headers, query } = opts;
|
|
21225
21225
|
return {
|
|
21226
|
-
path:
|
|
21226
|
+
path: path11,
|
|
21227
21227
|
method,
|
|
21228
21228
|
body,
|
|
21229
21229
|
headers,
|
|
@@ -22092,10 +22092,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
22092
22092
|
}
|
|
22093
22093
|
format(pendingInterceptors) {
|
|
22094
22094
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
22095
|
-
({ method, path:
|
|
22095
|
+
({ method, path: path11, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
22096
22096
|
Method: method,
|
|
22097
22097
|
Origin: origin,
|
|
22098
|
-
Path:
|
|
22098
|
+
Path: path11,
|
|
22099
22099
|
"Status code": statusCode,
|
|
22100
22100
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
22101
22101
|
Invocations: timesInvoked,
|
|
@@ -22185,9 +22185,9 @@ var require_mock_agent = __commonJS({
|
|
|
22185
22185
|
}
|
|
22186
22186
|
}
|
|
22187
22187
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
22188
|
-
const [
|
|
22188
|
+
const [path11, searchParams] = dispatchOpts.path.split("?");
|
|
22189
22189
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
22190
|
-
dispatchOpts.path = `${
|
|
22190
|
+
dispatchOpts.path = `${path11}?${normalizedSearchParams}`;
|
|
22191
22191
|
}
|
|
22192
22192
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
22193
22193
|
}
|
|
@@ -22603,12 +22603,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
22603
22603
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
22604
22604
|
*/
|
|
22605
22605
|
async loadSnapshots(filePath) {
|
|
22606
|
-
const
|
|
22607
|
-
if (!
|
|
22606
|
+
const path11 = filePath || this.#snapshotPath;
|
|
22607
|
+
if (!path11) {
|
|
22608
22608
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
22609
22609
|
}
|
|
22610
22610
|
try {
|
|
22611
|
-
const data = await readFile(resolve(
|
|
22611
|
+
const data = await readFile(resolve(path11), "utf8");
|
|
22612
22612
|
const parsed = JSON.parse(data);
|
|
22613
22613
|
if (Array.isArray(parsed)) {
|
|
22614
22614
|
this.#snapshots.clear();
|
|
@@ -22622,7 +22622,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
22622
22622
|
if (error62.code === "ENOENT") {
|
|
22623
22623
|
this.#snapshots.clear();
|
|
22624
22624
|
} else {
|
|
22625
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
22625
|
+
throw new UndiciError(`Failed to load snapshots from ${path11}`, { cause: error62 });
|
|
22626
22626
|
}
|
|
22627
22627
|
}
|
|
22628
22628
|
}
|
|
@@ -22633,11 +22633,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
22633
22633
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
22634
22634
|
*/
|
|
22635
22635
|
async saveSnapshots(filePath) {
|
|
22636
|
-
const
|
|
22637
|
-
if (!
|
|
22636
|
+
const path11 = filePath || this.#snapshotPath;
|
|
22637
|
+
if (!path11) {
|
|
22638
22638
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
22639
22639
|
}
|
|
22640
|
-
const resolvedPath = resolve(
|
|
22640
|
+
const resolvedPath = resolve(path11);
|
|
22641
22641
|
await mkdir(dirname(resolvedPath), { recursive: true });
|
|
22642
22642
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
22643
22643
|
hash: hash2,
|
|
@@ -23287,15 +23287,15 @@ var require_redirect_handler = __commonJS({
|
|
|
23287
23287
|
}
|
|
23288
23288
|
const baseUrl = requestOrigin ? new URL(this.opts.path, requestOrigin) : void 0;
|
|
23289
23289
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, baseUrl));
|
|
23290
|
-
const
|
|
23291
|
-
const redirectUrlString = `${origin}${
|
|
23290
|
+
const path11 = search ? `${pathname}${search}` : pathname;
|
|
23291
|
+
const redirectUrlString = `${origin}${path11}`;
|
|
23292
23292
|
for (const historyUrl of this.history) {
|
|
23293
23293
|
if (historyUrl.toString() === redirectUrlString) {
|
|
23294
23294
|
throw new InvalidArgumentError(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
|
|
23295
23295
|
}
|
|
23296
23296
|
}
|
|
23297
23297
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, removeContentHeaders, requestOrigin !== origin, this.stripHeadersOnRedirect, this.stripHeadersOnCrossOriginRedirect);
|
|
23298
|
-
this.opts.path =
|
|
23298
|
+
this.opts.path = path11;
|
|
23299
23299
|
this.opts.origin = origin;
|
|
23300
23300
|
this.opts[kRequestOrigin] = origin;
|
|
23301
23301
|
this.opts.query = null;
|
|
@@ -25146,10 +25146,10 @@ var require_cache_handler = __commonJS({
|
|
|
25146
25146
|
}
|
|
25147
25147
|
return locationUrl.pathname + locationUrl.search;
|
|
25148
25148
|
}
|
|
25149
|
-
function deleteCachedUri(store, cacheKey,
|
|
25149
|
+
function deleteCachedUri(store, cacheKey, path11) {
|
|
25150
25150
|
deleteCachedValue(store, {
|
|
25151
25151
|
...cacheKey,
|
|
25152
|
-
path:
|
|
25152
|
+
path: path11
|
|
25153
25153
|
});
|
|
25154
25154
|
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
25155
25155
|
const method = util.safeHTTPMethods[i];
|
|
@@ -25157,7 +25157,7 @@ var require_cache_handler = __commonJS({
|
|
|
25157
25157
|
deleteCachedValue(store, {
|
|
25158
25158
|
...cacheKey,
|
|
25159
25159
|
method,
|
|
25160
|
-
path:
|
|
25160
|
+
path: path11
|
|
25161
25161
|
});
|
|
25162
25162
|
}
|
|
25163
25163
|
}
|
|
@@ -25168,9 +25168,9 @@ var require_cache_handler = __commonJS({
|
|
|
25168
25168
|
}
|
|
25169
25169
|
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
25170
25170
|
for (let i = 0; i < values.length; i++) {
|
|
25171
|
-
const
|
|
25172
|
-
if (
|
|
25173
|
-
deleteCachedUri(store, cacheKey,
|
|
25171
|
+
const path11 = getSameOriginPath(cacheKey, values[i]);
|
|
25172
|
+
if (path11 !== void 0) {
|
|
25173
|
+
deleteCachedUri(store, cacheKey, path11);
|
|
25174
25174
|
}
|
|
25175
25175
|
}
|
|
25176
25176
|
}
|
|
@@ -30297,13 +30297,13 @@ var require_fetch = __commonJS({
|
|
|
30297
30297
|
function dispatch({ body }) {
|
|
30298
30298
|
const url2 = requestCurrentURL(request);
|
|
30299
30299
|
const agent = fetchParams.controller.dispatcher;
|
|
30300
|
-
const
|
|
30300
|
+
const path11 = url2.pathname + url2.search;
|
|
30301
30301
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
30302
30302
|
return dispatchWithProtocolPreference(body);
|
|
30303
30303
|
function dispatchWithProtocolPreference(body2, allowH2) {
|
|
30304
30304
|
return new Promise((resolve, reject) => agent.dispatch(
|
|
30305
30305
|
{
|
|
30306
|
-
path: hasTrailingQuestionMark ? `${
|
|
30306
|
+
path: hasTrailingQuestionMark ? `${path11}?` : path11,
|
|
30307
30307
|
origin: url2.origin,
|
|
30308
30308
|
method: request.method,
|
|
30309
30309
|
body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body2,
|
|
@@ -31218,9 +31218,9 @@ var require_util4 = __commonJS({
|
|
|
31218
31218
|
}
|
|
31219
31219
|
}
|
|
31220
31220
|
}
|
|
31221
|
-
function validateCookiePath(
|
|
31222
|
-
for (let i = 0; i <
|
|
31223
|
-
const code =
|
|
31221
|
+
function validateCookiePath(path11) {
|
|
31222
|
+
for (let i = 0; i < path11.length; ++i) {
|
|
31223
|
+
const code = path11.charCodeAt(i);
|
|
31224
31224
|
if (code < 32 || // exclude CTLs (0-31)
|
|
31225
31225
|
code > 126 || // exclude non-ascii and DEL
|
|
31226
31226
|
code === 59) {
|
|
@@ -34628,11 +34628,11 @@ var require_undici = __commonJS({
|
|
|
34628
34628
|
if (typeof opts.path !== "string") {
|
|
34629
34629
|
throw new InvalidArgumentError("invalid opts.path");
|
|
34630
34630
|
}
|
|
34631
|
-
let
|
|
34631
|
+
let path11 = opts.path;
|
|
34632
34632
|
if (!opts.path.startsWith("/")) {
|
|
34633
|
-
|
|
34633
|
+
path11 = `/${path11}`;
|
|
34634
34634
|
}
|
|
34635
|
-
url2 = new URL(util.parseOrigin(url2).origin +
|
|
34635
|
+
url2 = new URL(util.parseOrigin(url2).origin + path11);
|
|
34636
34636
|
} else {
|
|
34637
34637
|
if (!opts) {
|
|
34638
34638
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -34744,7 +34744,7 @@ ${captureLines}` : capture2.stack;
|
|
|
34744
34744
|
// src/job.ts
|
|
34745
34745
|
var import_yaml7 = __toESM(require_dist(), 1);
|
|
34746
34746
|
import fs9 from "node:fs/promises";
|
|
34747
|
-
import
|
|
34747
|
+
import path10 from "node:path";
|
|
34748
34748
|
|
|
34749
34749
|
// ../../node_modules/zod/v4/classic/external.js
|
|
34750
34750
|
var external_exports = {};
|
|
@@ -35562,10 +35562,10 @@ function mergeDefs(...defs) {
|
|
|
35562
35562
|
function cloneDef(schema) {
|
|
35563
35563
|
return mergeDefs(schema._zod.def);
|
|
35564
35564
|
}
|
|
35565
|
-
function getElementAtPath(obj,
|
|
35566
|
-
if (!
|
|
35565
|
+
function getElementAtPath(obj, path11) {
|
|
35566
|
+
if (!path11)
|
|
35567
35567
|
return obj;
|
|
35568
|
-
return
|
|
35568
|
+
return path11.reduce((acc, key) => acc?.[key], obj);
|
|
35569
35569
|
}
|
|
35570
35570
|
function promiseAllObject(promisesObj) {
|
|
35571
35571
|
const keys = Object.keys(promisesObj);
|
|
@@ -35905,11 +35905,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
35905
35905
|
}
|
|
35906
35906
|
return false;
|
|
35907
35907
|
}
|
|
35908
|
-
function prefixIssues(
|
|
35908
|
+
function prefixIssues(path11, issues) {
|
|
35909
35909
|
return issues.map((iss) => {
|
|
35910
35910
|
var _a3;
|
|
35911
35911
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
35912
|
-
iss.path.unshift(
|
|
35912
|
+
iss.path.unshift(path11);
|
|
35913
35913
|
return iss;
|
|
35914
35914
|
});
|
|
35915
35915
|
}
|
|
@@ -36359,16 +36359,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
36359
36359
|
}
|
|
36360
36360
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
36361
36361
|
const fieldErrors = { _errors: [] };
|
|
36362
|
-
const processError = (error63,
|
|
36362
|
+
const processError = (error63, path11 = []) => {
|
|
36363
36363
|
for (const issue2 of error63.issues) {
|
|
36364
36364
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
36365
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
36365
|
+
issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
|
|
36366
36366
|
} else if (issue2.code === "invalid_key") {
|
|
36367
|
-
processError({ issues: issue2.issues }, [...
|
|
36367
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
36368
36368
|
} else if (issue2.code === "invalid_element") {
|
|
36369
|
-
processError({ issues: issue2.issues }, [...
|
|
36369
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
36370
36370
|
} else {
|
|
36371
|
-
const fullpath = [...
|
|
36371
|
+
const fullpath = [...path11, ...issue2.path];
|
|
36372
36372
|
if (fullpath.length === 0) {
|
|
36373
36373
|
fieldErrors._errors.push(mapper(issue2));
|
|
36374
36374
|
} else {
|
|
@@ -36407,17 +36407,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
36407
36407
|
}
|
|
36408
36408
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
36409
36409
|
const result = { errors: [] };
|
|
36410
|
-
const processError = (error63,
|
|
36410
|
+
const processError = (error63, path11 = []) => {
|
|
36411
36411
|
var _a3;
|
|
36412
36412
|
for (const issue2 of error63.issues) {
|
|
36413
36413
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
36414
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
36414
|
+
issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
|
|
36415
36415
|
} else if (issue2.code === "invalid_key") {
|
|
36416
|
-
processError({ issues: issue2.issues }, [...
|
|
36416
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
36417
36417
|
} else if (issue2.code === "invalid_element") {
|
|
36418
|
-
processError({ issues: issue2.issues }, [...
|
|
36418
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
36419
36419
|
} else {
|
|
36420
|
-
const fullpath = [...
|
|
36420
|
+
const fullpath = [...path11, ...issue2.path];
|
|
36421
36421
|
if (fullpath.length === 0) {
|
|
36422
36422
|
result.errors.push(mapper(issue2));
|
|
36423
36423
|
continue;
|
|
@@ -36456,8 +36456,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
36456
36456
|
}
|
|
36457
36457
|
function toDotPath(_path) {
|
|
36458
36458
|
const segs = [];
|
|
36459
|
-
const
|
|
36460
|
-
for (const seg of
|
|
36459
|
+
const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
36460
|
+
for (const seg of path11) {
|
|
36461
36461
|
if (typeof seg === "number")
|
|
36462
36462
|
segs.push(`[${seg}]`);
|
|
36463
36463
|
else if (typeof seg === "symbol")
|
|
@@ -53559,13 +53559,13 @@ function resolveRef(ref, ctx) {
|
|
|
53559
53559
|
if (!ref.startsWith("#")) {
|
|
53560
53560
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
53561
53561
|
}
|
|
53562
|
-
const
|
|
53563
|
-
if (
|
|
53562
|
+
const path11 = ref.slice(1).split("/").filter(Boolean);
|
|
53563
|
+
if (path11.length === 0) {
|
|
53564
53564
|
return ctx.rootSchema;
|
|
53565
53565
|
}
|
|
53566
53566
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
53567
|
-
if (
|
|
53568
|
-
const key =
|
|
53567
|
+
if (path11[0] === defsKey) {
|
|
53568
|
+
const key = path11[1] === void 0 ? void 0 : decodeJSONPointerSegment(path11[1]);
|
|
53569
53569
|
if (!key || !ctx.defs[key]) {
|
|
53570
53570
|
throw new Error(`Reference not found: ${ref}`);
|
|
53571
53571
|
}
|
|
@@ -54864,6 +54864,35 @@ function placeholdersOf(pattern, url2) {
|
|
|
54864
54864
|
return found;
|
|
54865
54865
|
}
|
|
54866
54866
|
|
|
54867
|
+
// ../../packages/core/src/model/layers.ts
|
|
54868
|
+
var partsOf = (doc) => ({
|
|
54869
|
+
headers: doc?.headers,
|
|
54870
|
+
settings: doc?.settings,
|
|
54871
|
+
before: doc?.before,
|
|
54872
|
+
tests: doc?.tests
|
|
54873
|
+
});
|
|
54874
|
+
function requestLayers(sources) {
|
|
54875
|
+
const layers = [];
|
|
54876
|
+
if (sources.endpoint) {
|
|
54877
|
+
layers.push({ kind: "endpoint-file", ...partsOf(sources.endpoint.file) });
|
|
54878
|
+
layers.push({ kind: "endpoint", ...partsOf(sources.endpoint.step) });
|
|
54879
|
+
}
|
|
54880
|
+
if (sources.base) layers.push({ kind: "base", ...partsOf(sources.base) });
|
|
54881
|
+
layers.push({ kind: "collection", ...partsOf(sources.collection) });
|
|
54882
|
+
if (sources.set) layers.push({ kind: "set", ...partsOf(sources.set) });
|
|
54883
|
+
layers.push({ kind: "step", before: sources.step.before, tests: sources.step.tests });
|
|
54884
|
+
return layers;
|
|
54885
|
+
}
|
|
54886
|
+
function foldLayers(layers) {
|
|
54887
|
+
let headers;
|
|
54888
|
+
let settings = {};
|
|
54889
|
+
for (const layer of layers) {
|
|
54890
|
+
if (layer.headers) headers = mergeHeaders(headers, layer.headers);
|
|
54891
|
+
settings = { ...settings, ...layer.settings };
|
|
54892
|
+
}
|
|
54893
|
+
return { headers, settings };
|
|
54894
|
+
}
|
|
54895
|
+
|
|
54867
54896
|
// ../../packages/core/src/paths.ts
|
|
54868
54897
|
import fs from "node:fs/promises";
|
|
54869
54898
|
import nodePath from "node:path";
|
|
@@ -54875,21 +54904,21 @@ async function canonical(target) {
|
|
|
54875
54904
|
return absolute;
|
|
54876
54905
|
}
|
|
54877
54906
|
}
|
|
54878
|
-
function isInside(parent, child,
|
|
54879
|
-
const relative =
|
|
54880
|
-
const leaves = relative === ".." || relative.startsWith(`..${
|
|
54881
|
-
return relative === "" || !leaves && !
|
|
54907
|
+
function isInside(parent, child, path11 = nodePath) {
|
|
54908
|
+
const relative = path11.relative(parent, child);
|
|
54909
|
+
const leaves = relative === ".." || relative.startsWith(`..${path11.sep}`);
|
|
54910
|
+
return relative === "" || !leaves && !path11.isAbsolute(relative);
|
|
54882
54911
|
}
|
|
54883
|
-
var samePath = (a, b,
|
|
54912
|
+
var samePath = (a, b, path11 = nodePath) => path11.relative(a, b) === "";
|
|
54884
54913
|
var toPosix = (relative) => relative.split(/[\\/]+/).join("/");
|
|
54885
54914
|
var isAbsoluteAnywhere = (target) => nodePath.posix.isAbsolute(target) || nodePath.win32.isAbsolute(target);
|
|
54886
|
-
function resolveRelative(root, relative,
|
|
54915
|
+
function resolveRelative(root, relative, path11 = nodePath) {
|
|
54887
54916
|
if (isAbsoluteAnywhere(relative)) {
|
|
54888
54917
|
throw new Error(`"${relative}" must be a relative path, so it works on every machine`);
|
|
54889
54918
|
}
|
|
54890
|
-
return
|
|
54919
|
+
return path11.resolve(root, ...relative.split(/[\\/]+/).filter(Boolean));
|
|
54891
54920
|
}
|
|
54892
|
-
var relativePosix = (from, to,
|
|
54921
|
+
var relativePosix = (from, to, path11 = nodePath) => toPosix(path11.relative(from, to)) || ".";
|
|
54893
54922
|
var RESERVED = /^(con|prn|aux|nul|conin\$|conout\$|com[0-9¹²³]|lpt[0-9¹²³])(\..*)?$/i;
|
|
54894
54923
|
var FORBIDDEN = /[<>:"/\\|?*\u0000-\u001f]/;
|
|
54895
54924
|
function nameProblem(name) {
|
|
@@ -55062,9 +55091,9 @@ var SEGMENT = (
|
|
|
55062
55091
|
// eslint-disable-next-line no-control-regex
|
|
55063
55092
|
/\[("(?:[^"\\\u0000-\u001f]|\\["\\/bfnrt]|\\u[0-9a-fA-F]{4})*")\]|([^.[\]]+)|\[(\d*)\]/g
|
|
55064
55093
|
);
|
|
55065
|
-
function parsePath(
|
|
55094
|
+
function parsePath(path11) {
|
|
55066
55095
|
const segments = [];
|
|
55067
|
-
for (const match of
|
|
55096
|
+
for (const match of path11.matchAll(SEGMENT)) {
|
|
55068
55097
|
if (match[1] !== void 0) segments.push({ kind: "key", key: JSON.parse(match[1]) });
|
|
55069
55098
|
else if (match[2] !== void 0) segments.push({ kind: "key", key: match[2] });
|
|
55070
55099
|
else if (match[3] === "") segments.push({ kind: "each" });
|
|
@@ -55089,16 +55118,16 @@ function resolvePath(root, pattern) {
|
|
|
55089
55118
|
let frontier = [{ path: [], value: root }];
|
|
55090
55119
|
for (const segment of pattern) {
|
|
55091
55120
|
const next = [];
|
|
55092
|
-
for (const { path:
|
|
55121
|
+
for (const { path: path11, value } of frontier) {
|
|
55093
55122
|
if (segment.kind === "each") {
|
|
55094
55123
|
if (!Array.isArray(value)) continue;
|
|
55095
55124
|
value.forEach(
|
|
55096
|
-
(item, index) => next.push({ path: [...
|
|
55125
|
+
(item, index) => next.push({ path: [...path11, { kind: "index", index }], value: item })
|
|
55097
55126
|
);
|
|
55098
55127
|
continue;
|
|
55099
55128
|
}
|
|
55100
55129
|
const step = childOf(value, segment);
|
|
55101
|
-
if (step) next.push({ path: [...
|
|
55130
|
+
if (step) next.push({ path: [...path11, step.segment], value: step.value });
|
|
55102
55131
|
}
|
|
55103
55132
|
frontier = next;
|
|
55104
55133
|
}
|
|
@@ -55116,17 +55145,17 @@ function childOf(value, segment) {
|
|
|
55116
55145
|
}
|
|
55117
55146
|
function sortArraysBy(value, properties) {
|
|
55118
55147
|
const paths = properties.map(parsePath);
|
|
55119
|
-
const sortValue = (item,
|
|
55148
|
+
const sortValue = (item, path11) => item !== null && typeof item === "object" && !Array.isArray(item) ? resolvePath(item, path11)[0]?.value : void 0;
|
|
55120
55149
|
const visit2 = (node2) => {
|
|
55121
55150
|
if (Array.isArray(node2)) {
|
|
55122
55151
|
const items = node2.map(visit2);
|
|
55123
55152
|
const sortable = paths.some(
|
|
55124
|
-
(
|
|
55153
|
+
(path11) => items.some((item) => sortValue(item, path11) !== void 0)
|
|
55125
55154
|
);
|
|
55126
55155
|
if (!sortable) return items;
|
|
55127
55156
|
return items.map((item, index) => ({ item, index })).sort((a, b) => {
|
|
55128
|
-
for (const
|
|
55129
|
-
const order = compareAlphanumerically(sortValue(a.item,
|
|
55157
|
+
for (const path11 of paths) {
|
|
55158
|
+
const order = compareAlphanumerically(sortValue(a.item, path11), sortValue(b.item, path11));
|
|
55130
55159
|
if (order !== 0) return order;
|
|
55131
55160
|
}
|
|
55132
55161
|
return a.index - b.index;
|
|
@@ -55627,8 +55656,8 @@ var FormatError = class extends Error {
|
|
|
55627
55656
|
};
|
|
55628
55657
|
function describeValidation(error62) {
|
|
55629
55658
|
return error62.issues.map((issue2) => {
|
|
55630
|
-
const
|
|
55631
|
-
return
|
|
55659
|
+
const path11 = issue2.path.join(".");
|
|
55660
|
+
return path11 ? `${path11}: ${issue2.message}` : issue2.message;
|
|
55632
55661
|
}).join("; ");
|
|
55633
55662
|
}
|
|
55634
55663
|
|
|
@@ -56901,6 +56930,37 @@ async function readDotEnv(near) {
|
|
|
56901
56930
|
}
|
|
56902
56931
|
}
|
|
56903
56932
|
|
|
56933
|
+
// ../../packages/core/src/vars/secrets.ts
|
|
56934
|
+
async function secretValues(context) {
|
|
56935
|
+
if (!context.environmentName) return [];
|
|
56936
|
+
try {
|
|
56937
|
+
const layer = await environmentLayer(context, context.environmentName);
|
|
56938
|
+
return (layer.secrets ?? []).flatMap((name) => {
|
|
56939
|
+
const value = layer.vars[name];
|
|
56940
|
+
return value === void 0 || value === null || String(value) === "" ? [] : [[name, String(value)]];
|
|
56941
|
+
}).sort((a, b) => b[1].length - a[1].length);
|
|
56942
|
+
} catch {
|
|
56943
|
+
return [];
|
|
56944
|
+
}
|
|
56945
|
+
}
|
|
56946
|
+
function redact(value, secrets) {
|
|
56947
|
+
if (secrets.length === 0) return value;
|
|
56948
|
+
const walk = (node2) => {
|
|
56949
|
+
if (typeof node2 === "string") {
|
|
56950
|
+
return secrets.reduce(
|
|
56951
|
+
(text, [name, secret]) => text.split(secret).join(`[secret: ${name}]`),
|
|
56952
|
+
node2
|
|
56953
|
+
);
|
|
56954
|
+
}
|
|
56955
|
+
if (Array.isArray(node2)) return node2.map(walk);
|
|
56956
|
+
if (node2 !== null && typeof node2 === "object") {
|
|
56957
|
+
return Object.fromEntries(Object.entries(node2).map(([key, inner]) => [key, walk(inner)]));
|
|
56958
|
+
}
|
|
56959
|
+
return node2;
|
|
56960
|
+
};
|
|
56961
|
+
return walk(value);
|
|
56962
|
+
}
|
|
56963
|
+
|
|
56904
56964
|
// ../../packages/core/src/http/client.ts
|
|
56905
56965
|
var import_undici = __toESM(require_undici(), 1);
|
|
56906
56966
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
@@ -57058,7 +57118,7 @@ function statusTextFor(status) {
|
|
|
57058
57118
|
// ../../packages/core/src/run/multipart.ts
|
|
57059
57119
|
import { Buffer as Buffer3 } from "node:buffer";
|
|
57060
57120
|
import { randomBytes } from "node:crypto";
|
|
57061
|
-
function
|
|
57121
|
+
function partsOf2(multipart) {
|
|
57062
57122
|
return Object.entries(multipart).flatMap(
|
|
57063
57123
|
([name, field]) => (Array.isArray(field) ? field : [field]).map((part) => [name, part])
|
|
57064
57124
|
);
|
|
@@ -57178,7 +57238,7 @@ function toBody(body) {
|
|
|
57178
57238
|
};
|
|
57179
57239
|
}
|
|
57180
57240
|
if (body.multipart !== void 0) {
|
|
57181
|
-
const parts =
|
|
57241
|
+
const parts = partsOf2(body.multipart).map(
|
|
57182
57242
|
([name, part]) => typeof part === "string" ? { name, value: part } : "file" in part ? {
|
|
57183
57243
|
name,
|
|
57184
57244
|
value: "",
|
|
@@ -57219,7 +57279,8 @@ import fs8 from "node:fs/promises";
|
|
|
57219
57279
|
var BodyFileError = class extends Error {
|
|
57220
57280
|
name = "BodyFileError";
|
|
57221
57281
|
};
|
|
57222
|
-
|
|
57282
|
+
var GLOBAL_FILE = "global:";
|
|
57283
|
+
async function prepareRequest(written, body, scope, files) {
|
|
57223
57284
|
const resolve = (text) => interpolateToString(text, scope);
|
|
57224
57285
|
const headers = written.headers.map((header) => ({
|
|
57225
57286
|
name: resolve(header.name),
|
|
@@ -57235,19 +57296,19 @@ async function prepareRequest(written, body, scope, root) {
|
|
|
57235
57296
|
}
|
|
57236
57297
|
if (body?.multipart !== void 0) {
|
|
57237
57298
|
const parts = [];
|
|
57238
|
-
for (const [field, part] of
|
|
57299
|
+
for (const [field, part] of partsOf2(body.multipart)) {
|
|
57239
57300
|
const name = resolve(field);
|
|
57240
57301
|
if (typeof part === "string") {
|
|
57241
57302
|
parts.push({ name, value: resolve(part) });
|
|
57242
57303
|
} else if ("file" in part) {
|
|
57243
|
-
const
|
|
57244
|
-
const bytes2 = await readBodyFile(
|
|
57304
|
+
const path11 = resolve(part.file);
|
|
57305
|
+
const { bytes: bytes2, shown } = await readBodyFile(files, path11, `multipart field ${name}`);
|
|
57245
57306
|
parts.push({
|
|
57246
57307
|
name,
|
|
57247
57308
|
value: bytes2,
|
|
57248
|
-
filename: part.filename !== void 0 ? resolve(part.filename) : baseName(
|
|
57249
|
-
contentType: part.contentType ? resolve(part.contentType) : contentTypeFor(
|
|
57250
|
-
shown: fileMarker(
|
|
57309
|
+
filename: part.filename !== void 0 ? resolve(part.filename) : baseName(path11),
|
|
57310
|
+
contentType: part.contentType ? resolve(part.contentType) : contentTypeFor(path11),
|
|
57311
|
+
shown: fileMarker(shown, bytes2.byteLength)
|
|
57251
57312
|
});
|
|
57252
57313
|
} else {
|
|
57253
57314
|
parts.push({
|
|
@@ -57262,14 +57323,14 @@ async function prepareRequest(written, body, scope, root) {
|
|
|
57262
57323
|
return { request: { ...request, headers: typed.headers, body: text }, payload: bytes };
|
|
57263
57324
|
}
|
|
57264
57325
|
if (body?.file !== void 0) {
|
|
57265
|
-
const
|
|
57266
|
-
const bytes = await readBodyFile(
|
|
57326
|
+
const path11 = resolve(body.file);
|
|
57327
|
+
const { bytes, shown } = await readBodyFile(files, path11, "body.file");
|
|
57267
57328
|
const declared = headers.some((header) => header.name.toLowerCase() === "content-type");
|
|
57268
57329
|
return {
|
|
57269
57330
|
request: {
|
|
57270
57331
|
...request,
|
|
57271
|
-
headers: declared ? headers : [...headers, { name: "Content-Type", value: contentTypeFor(
|
|
57272
|
-
body: fileMarker(
|
|
57332
|
+
headers: declared ? headers : [...headers, { name: "Content-Type", value: contentTypeFor(path11) }],
|
|
57333
|
+
body: fileMarker(shown, bytes.byteLength)
|
|
57273
57334
|
},
|
|
57274
57335
|
payload: bytes
|
|
57275
57336
|
};
|
|
@@ -57283,33 +57344,78 @@ async function prepareRequest(written, body, scope, root) {
|
|
|
57283
57344
|
payload: null
|
|
57284
57345
|
};
|
|
57285
57346
|
}
|
|
57286
|
-
var baseName = (
|
|
57287
|
-
|
|
57288
|
-
|
|
57289
|
-
|
|
57290
|
-
|
|
57347
|
+
var baseName = (path11) => withoutGlobal(path11).split(/[\\/]/).pop() ?? path11;
|
|
57348
|
+
var withoutGlobal = (path11) => path11.startsWith(GLOBAL_FILE) ? path11.slice(GLOBAL_FILE.length) : path11;
|
|
57349
|
+
function bodyFiles(body) {
|
|
57350
|
+
if (body?.file !== void 0) return [{ what: "body.file", written: body.file }];
|
|
57351
|
+
if (body?.multipart === void 0) return [];
|
|
57352
|
+
return partsOf2(body.multipart).flatMap(
|
|
57353
|
+
([field, part]) => typeof part !== "string" && "file" in part ? [{ what: `multipart field ${field}`, written: part.file }] : []
|
|
57354
|
+
);
|
|
57355
|
+
}
|
|
57356
|
+
async function readBodyFile(roots, written, what) {
|
|
57357
|
+
const { file: file2, shown } = await findBodyFile(roots, written, what);
|
|
57358
|
+
try {
|
|
57359
|
+
return { bytes: await fs8.readFile(file2), shown };
|
|
57360
|
+
} catch (cause) {
|
|
57361
|
+
throw new BodyFileError(`${what}: ${written} \u2014 ${cause.message}`);
|
|
57362
|
+
}
|
|
57363
|
+
}
|
|
57364
|
+
async function findBodyFile(roots, written, what) {
|
|
57365
|
+
const missing = (reason) => new BodyFileError(`${what}: ${written} \u2014 ${reason}`);
|
|
57366
|
+
if (roots === null) {
|
|
57367
|
+
throw missing(
|
|
57368
|
+
"files are read from the project folder, so save the collection in a project first"
|
|
57291
57369
|
);
|
|
57292
57370
|
}
|
|
57371
|
+
const relative = withoutGlobal(written);
|
|
57372
|
+
if (relative !== written) {
|
|
57373
|
+
if (!roots.global) throw missing("this project does not use a global project");
|
|
57374
|
+
const file3 = await fileIn(roots.global, relative, written, what);
|
|
57375
|
+
if (file3) return { file: file3, shown: written };
|
|
57376
|
+
throw missing("no such file in the global project folder");
|
|
57377
|
+
}
|
|
57378
|
+
const file2 = await fileIn(roots.project, relative, written, what);
|
|
57379
|
+
if (file2) return { file: file2, shown: written };
|
|
57380
|
+
const global = roots.global && !samePath(roots.global, roots.project) ? roots.global : null;
|
|
57381
|
+
if (!global || !isInside(roots.project, resolveRelative(roots.project, relative))) {
|
|
57382
|
+
throw missing("no such file in the project folder");
|
|
57383
|
+
}
|
|
57384
|
+
const shared = await fileIn(global, relative, written, what);
|
|
57385
|
+
if (shared) return { file: shared, shown: `${GLOBAL_FILE}${toPosix(relative)}` };
|
|
57386
|
+
throw missing(
|
|
57387
|
+
`no such file in the project folder, or in its global project's (${relativePosix(roots.project, global)})`
|
|
57388
|
+
);
|
|
57389
|
+
}
|
|
57390
|
+
async function fileIn(root, relative, written, what) {
|
|
57293
57391
|
let file2;
|
|
57294
57392
|
try {
|
|
57295
|
-
file2 = resolveRelative(root,
|
|
57393
|
+
file2 = resolveRelative(root, relative);
|
|
57296
57394
|
} catch (cause) {
|
|
57297
57395
|
throw new BodyFileError(`${what}: ${cause.message}`);
|
|
57298
57396
|
}
|
|
57299
|
-
|
|
57397
|
+
if (written.startsWith(GLOBAL_FILE) && !isInside(root, file2)) {
|
|
57398
|
+
throw new BodyFileError(
|
|
57399
|
+
`${what}: ${written} \u2014 a global: path stays in the global project folder`
|
|
57400
|
+
);
|
|
57401
|
+
}
|
|
57402
|
+
const misspelled = await spellingProblem(root, relative);
|
|
57300
57403
|
if (misspelled) throw new BodyFileError(`${what}: ${misspelled}`);
|
|
57404
|
+
let stat;
|
|
57301
57405
|
try {
|
|
57302
|
-
|
|
57406
|
+
stat = await fs8.stat(file2);
|
|
57303
57407
|
} catch (cause) {
|
|
57304
57408
|
const code = cause.code;
|
|
57305
|
-
|
|
57306
|
-
throw new BodyFileError(`${what}: ${
|
|
57409
|
+
if (code === "ENOENT" || code === "ENOTDIR") return null;
|
|
57410
|
+
throw new BodyFileError(`${what}: ${written} \u2014 ${cause.message}`);
|
|
57307
57411
|
}
|
|
57412
|
+
if (stat.isDirectory())
|
|
57413
|
+
throw new BodyFileError(`${what}: ${written} \u2014 is a directory, not a file`);
|
|
57414
|
+
return file2;
|
|
57308
57415
|
}
|
|
57309
57416
|
|
|
57310
57417
|
// ../../packages/core/src/run/runRequest.ts
|
|
57311
57418
|
import assert3 from "node:assert/strict";
|
|
57312
|
-
import path9 from "node:path";
|
|
57313
57419
|
|
|
57314
57420
|
// ../../packages/core/src/assert/evaluate.ts
|
|
57315
57421
|
function locate(root, segments, nullAlong) {
|
|
@@ -57341,9 +57447,9 @@ function checkScalarTarget(target, label, wanted, found, context) {
|
|
|
57341
57447
|
capture(wanted, value, context.scope);
|
|
57342
57448
|
return failure2 ? { ...base2, ...actual, name, status: "fail", message: failure2 } : { ...base2, ...actual, name, status: "pass" };
|
|
57343
57449
|
}
|
|
57344
|
-
function checkBody(
|
|
57345
|
-
const base2 = { target: "body", path:
|
|
57346
|
-
const name = `${
|
|
57450
|
+
function checkBody(path11, segments, wanted, located, context) {
|
|
57451
|
+
const base2 = { target: "body", path: path11, expected: describe3(wanted) };
|
|
57452
|
+
const name = `${path11} ${describe3(wanted, { brief: true })}`;
|
|
57347
57453
|
const fanOut = segments.some((s) => s.kind === "each");
|
|
57348
57454
|
const actual = located.length === 0 ? {} : { actual: fanOut ? show(located.map((l) => l.value)) : show(located[0].value) };
|
|
57349
57455
|
if (wanted.absent) {
|
|
@@ -57643,19 +57749,19 @@ var REMOVED = /* @__PURE__ */ Symbol("removed");
|
|
|
57643
57749
|
function findUnasserted(body, covered) {
|
|
57644
57750
|
const root = { value: structuredClone(body) };
|
|
57645
57751
|
for (const coverage of covered) {
|
|
57646
|
-
for (const { path:
|
|
57752
|
+
for (const { path: path11 } of resolvePath(root.value, coverage.pattern)) remove(root, path11);
|
|
57647
57753
|
}
|
|
57648
57754
|
const leaves = [];
|
|
57649
57755
|
collectLeaves(prune(root.value), [], leaves);
|
|
57650
57756
|
return leaves;
|
|
57651
57757
|
}
|
|
57652
|
-
function remove(root,
|
|
57653
|
-
if (
|
|
57758
|
+
function remove(root, path11) {
|
|
57759
|
+
if (path11.length === 0) {
|
|
57654
57760
|
root.value = REMOVED;
|
|
57655
57761
|
return;
|
|
57656
57762
|
}
|
|
57657
|
-
const parent = resolvePath(root.value,
|
|
57658
|
-
const last =
|
|
57763
|
+
const parent = resolvePath(root.value, path11.slice(0, -1))[0]?.value;
|
|
57764
|
+
const last = path11[path11.length - 1];
|
|
57659
57765
|
if (Array.isArray(parent) && last.kind === "index") parent[last.index] = REMOVED;
|
|
57660
57766
|
else if (parent !== null && typeof parent === "object" && last.kind === "key") {
|
|
57661
57767
|
delete parent[last.key];
|
|
@@ -57674,16 +57780,16 @@ function prune(value) {
|
|
|
57674
57780
|
}
|
|
57675
57781
|
return value;
|
|
57676
57782
|
}
|
|
57677
|
-
function collectLeaves(value,
|
|
57783
|
+
function collectLeaves(value, path11, out) {
|
|
57678
57784
|
if (value === void 0) return;
|
|
57679
57785
|
if (Array.isArray(value)) {
|
|
57680
|
-
value.forEach((item, index) => collectLeaves(item, [...
|
|
57786
|
+
value.forEach((item, index) => collectLeaves(item, [...path11, { kind: "index", index }], out));
|
|
57681
57787
|
} else if (value !== null && typeof value === "object") {
|
|
57682
57788
|
for (const [key, child] of Object.entries(value)) {
|
|
57683
|
-
collectLeaves(child, [...
|
|
57789
|
+
collectLeaves(child, [...path11, { kind: "key", key }], out);
|
|
57684
57790
|
}
|
|
57685
57791
|
} else {
|
|
57686
|
-
out.push(formatPath(
|
|
57792
|
+
out.push(formatPath(path11));
|
|
57687
57793
|
}
|
|
57688
57794
|
}
|
|
57689
57795
|
|
|
@@ -57737,12 +57843,12 @@ var CheckSession = class {
|
|
|
57737
57843
|
path: name
|
|
57738
57844
|
});
|
|
57739
57845
|
}
|
|
57740
|
-
body(
|
|
57846
|
+
body(path11, matcher) {
|
|
57741
57847
|
const body = this.body_();
|
|
57742
57848
|
if (body === BODY_UNAVAILABLE) return null;
|
|
57743
|
-
const segments = parsePath(
|
|
57849
|
+
const segments = parsePath(path11);
|
|
57744
57850
|
const located = locate(body, segments, isNullCheck(matcher));
|
|
57745
|
-
const result = checkBody(
|
|
57851
|
+
const result = checkBody(path11, segments, matcher, located, {
|
|
57746
57852
|
...this.context,
|
|
57747
57853
|
claimed: (arrayPath) => this.claimsOn(arrayPath)
|
|
57748
57854
|
});
|
|
@@ -57755,13 +57861,13 @@ var CheckSession = class {
|
|
|
57755
57861
|
* Both are checked now, against the body as it is now, and `finish()` keeps
|
|
57756
57862
|
* the one the step's last word on strict validation asks for.
|
|
57757
57863
|
*/
|
|
57758
|
-
bodyByStrictness(
|
|
57864
|
+
bodyByStrictness(path11, matchers) {
|
|
57759
57865
|
const body = this.body_();
|
|
57760
57866
|
if (body === BODY_UNAVAILABLE) return null;
|
|
57761
|
-
const segments = parsePath(
|
|
57867
|
+
const segments = parsePath(path11);
|
|
57762
57868
|
const located = locate(body, segments, false);
|
|
57763
|
-
const strict = checkBody(
|
|
57764
|
-
const lenient = checkBody(
|
|
57869
|
+
const strict = checkBody(path11, segments, matchers.strict, located, this.context);
|
|
57870
|
+
const lenient = checkBody(path11, segments, matchers.lenient, located, this.context);
|
|
57765
57871
|
const assertion = this.record(lenient.assertion);
|
|
57766
57872
|
this.byStrictness.push({ assertion, strict });
|
|
57767
57873
|
return assertion;
|
|
@@ -57772,8 +57878,8 @@ var CheckSession = class {
|
|
|
57772
57878
|
return claimed;
|
|
57773
57879
|
}
|
|
57774
57880
|
/** Account for a path under strict validation without asserting anything. */
|
|
57775
|
-
ignore(
|
|
57776
|
-
this.covered.push({ pattern: parsePath(
|
|
57881
|
+
ignore(path11) {
|
|
57882
|
+
this.covered.push({ pattern: parsePath(path11) });
|
|
57777
57883
|
}
|
|
57778
57884
|
/** Add a result to the report — every check's, and a named check's from code. */
|
|
57779
57885
|
record(assertion) {
|
|
@@ -57985,16 +58091,16 @@ function variableName(value) {
|
|
|
57985
58091
|
}
|
|
57986
58092
|
return value;
|
|
57987
58093
|
}
|
|
57988
|
-
function pathOf2(
|
|
57989
|
-
if (typeof
|
|
57990
|
-
if (!Array.isArray(
|
|
58094
|
+
function pathOf2(path11, what) {
|
|
58095
|
+
if (typeof path11 === "string") return path11;
|
|
58096
|
+
if (!Array.isArray(path11)) {
|
|
57991
58097
|
throw new GtaUsageError(
|
|
57992
|
-
`${what} is a string, such as "user.name", or a list of keys, such as ["user", "name"]; got ${show(
|
|
58098
|
+
`${what} is a string, such as "user.name", or a list of keys, such as ["user", "name"]; got ${show(path11)}`
|
|
57993
58099
|
);
|
|
57994
58100
|
}
|
|
57995
|
-
if (
|
|
58101
|
+
if (path11.length === 0) throw new GtaUsageError(`${what} is an empty list; it needs a key`);
|
|
57996
58102
|
return formatPath(
|
|
57997
|
-
|
|
58103
|
+
path11.map((key) => {
|
|
57998
58104
|
if (typeof key === "string") return { kind: "key", key };
|
|
57999
58105
|
if (typeof key === "number") return { kind: "key", key: String(key) };
|
|
58000
58106
|
throw new GtaUsageError(`${what}'s keys are strings or numbers; got ${show(key)}`);
|
|
@@ -58005,14 +58111,14 @@ var isValidationEntry = (value) => value !== null && typeof value === "object" &
|
|
|
58005
58111
|
function itemFrom(list, valueKey) {
|
|
58006
58112
|
const item = {};
|
|
58007
58113
|
for (const entry of list) {
|
|
58008
|
-
const
|
|
58114
|
+
const path11 = pathOf2(entry.pathToProperty, "pathToProperty");
|
|
58009
58115
|
if (valueKey === "compareValue") {
|
|
58010
58116
|
const value = entry.compareValue;
|
|
58011
|
-
item[
|
|
58117
|
+
item[path11] = isRegExp(value) ? { matches: value } : value;
|
|
58012
58118
|
continue;
|
|
58013
58119
|
}
|
|
58014
58120
|
const matcher = xtestMatcher(valueKey in entry, entry[valueKey], entry.specialHandling);
|
|
58015
|
-
item[
|
|
58121
|
+
item[path11] = { ...item[path11], ...matcher };
|
|
58016
58122
|
}
|
|
58017
58123
|
return item;
|
|
58018
58124
|
}
|
|
@@ -58021,8 +58127,8 @@ function loneNotThisValue(list) {
|
|
|
58021
58127
|
if (list.length !== 1 || !isValidationEntry(entry)) return null;
|
|
58022
58128
|
if (entry.specialHandling !== "notThisExpectedValue" || !("expectedValue" in entry)) return null;
|
|
58023
58129
|
const value = entry.expectedValue;
|
|
58024
|
-
const
|
|
58025
|
-
return { unorderedNot: [{ [
|
|
58130
|
+
const path11 = pathOf2(entry.pathToProperty, "pathToProperty");
|
|
58131
|
+
return { unorderedNot: [{ [path11]: isRegExp(value) ? { matches: value } : value }] };
|
|
58026
58132
|
}
|
|
58027
58133
|
function toList(validationList) {
|
|
58028
58134
|
if (!Array.isArray(validationList)) {
|
|
@@ -58082,9 +58188,9 @@ function testsGta({
|
|
|
58082
58188
|
session,
|
|
58083
58189
|
"expectResponseBodyToHaveProperty",
|
|
58084
58190
|
(...args) => {
|
|
58085
|
-
const [
|
|
58191
|
+
const [path11, value, specialHandling] = args;
|
|
58086
58192
|
session.body(
|
|
58087
|
-
pathOf2(
|
|
58193
|
+
pathOf2(path11, "jsonPathToProperty"),
|
|
58088
58194
|
xtestMatcher(args.length > 1, value, specialHandling)
|
|
58089
58195
|
);
|
|
58090
58196
|
}
|
|
@@ -58093,22 +58199,22 @@ function testsGta({
|
|
|
58093
58199
|
session,
|
|
58094
58200
|
"expectResponseBodyToHaveUnorderedArray",
|
|
58095
58201
|
(jsonPathToArray, validationList) => {
|
|
58096
|
-
const
|
|
58202
|
+
const path11 = pathOf2(jsonPathToArray, "jsonPathToArray");
|
|
58097
58203
|
const list = toList(validationList);
|
|
58098
58204
|
const unordered = list.every(isValidationEntry) ? [itemFrom(list, "expectedValue")] : list;
|
|
58099
58205
|
const lone = loneNotThisValue(list);
|
|
58100
|
-
if (lone) session.bodyByStrictness(
|
|
58101
|
-
else session.body(
|
|
58206
|
+
if (lone) session.bodyByStrictness(path11, { strict: { unordered }, lenient: lone });
|
|
58207
|
+
else session.body(path11, { unordered });
|
|
58102
58208
|
}
|
|
58103
58209
|
),
|
|
58104
58210
|
expectResponseBodyToHaveUnorderedArrayNotThisItem: guarded(
|
|
58105
58211
|
session,
|
|
58106
58212
|
"expectResponseBodyToHaveUnorderedArrayNotThisItem",
|
|
58107
58213
|
(jsonPathToArray, validationList) => {
|
|
58108
|
-
const
|
|
58214
|
+
const path11 = pathOf2(jsonPathToArray, "jsonPathToArray");
|
|
58109
58215
|
const list = toList(validationList);
|
|
58110
58216
|
const unorderedNot = list.every(isValidationEntry) ? [itemFrom(list, "compareValue")] : list;
|
|
58111
|
-
session.body(
|
|
58217
|
+
session.body(path11, { unorderedNot });
|
|
58112
58218
|
}
|
|
58113
58219
|
),
|
|
58114
58220
|
ignoreResponseBodyProperty: guarded(
|
|
@@ -58268,6 +58374,7 @@ function uuidv72(now = Date.now()) {
|
|
|
58268
58374
|
}
|
|
58269
58375
|
var isThenable = (value) => value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
58270
58376
|
function toVarValue2(value) {
|
|
58377
|
+
if (value === void 0) return null;
|
|
58271
58378
|
if (value === null || ["string", "number", "boolean"].includes(typeof value)) {
|
|
58272
58379
|
return value;
|
|
58273
58380
|
}
|
|
@@ -58500,6 +58607,10 @@ async function projectOf(collectionPath) {
|
|
|
58500
58607
|
const { global } = await readProject(root);
|
|
58501
58608
|
return { root, global };
|
|
58502
58609
|
}
|
|
58610
|
+
async function fileRootsOf(file2, collectionPath) {
|
|
58611
|
+
const { global } = await projectOf(collectionPath);
|
|
58612
|
+
return { project: projectRootOf(file2) ?? path8.dirname(file2), global: global?.root ?? null };
|
|
58613
|
+
}
|
|
58503
58614
|
function checkWith(name, set2, given) {
|
|
58504
58615
|
const params = set2.params ?? {};
|
|
58505
58616
|
const unknown2 = Object.keys(given).filter((key) => !(key in params));
|
|
@@ -58566,25 +58677,39 @@ async function referenceProblems(collection, collectionPath) {
|
|
|
58566
58677
|
for (const list of STEP_LISTS) {
|
|
58567
58678
|
const steps = collection[list];
|
|
58568
58679
|
if (!steps) continue;
|
|
58680
|
+
const stage = list === "steps" ? {} : { stage: list };
|
|
58569
58681
|
for (const planned of await planSteps({ ...collection, steps }, collectionPath)) {
|
|
58570
|
-
if (planned.kind
|
|
58571
|
-
|
|
58572
|
-
|
|
58682
|
+
if (planned.kind === "broken") {
|
|
58683
|
+
problems.push({ step: planned.index, ...stage, message: planned.error.message });
|
|
58684
|
+
continue;
|
|
58685
|
+
}
|
|
58686
|
+
for (const message of await missingFiles(planned, collectionPath)) {
|
|
58687
|
+
problems.push({ step: planned.index, ...stage, message });
|
|
58688
|
+
}
|
|
58573
58689
|
}
|
|
58574
58690
|
}
|
|
58575
58691
|
return problems;
|
|
58576
58692
|
}
|
|
58693
|
+
async function missingFiles(planned, collectionPath) {
|
|
58694
|
+
const named = bodyFiles(planned.step.body).filter(({ written }) => !written.includes("{{"));
|
|
58695
|
+
if (named.length === 0) return [];
|
|
58696
|
+
const roots = await fileRootsOf(planned.set?.path ?? collectionPath, collectionPath);
|
|
58697
|
+
const messages = [];
|
|
58698
|
+
for (const { what, written } of named) {
|
|
58699
|
+
try {
|
|
58700
|
+
await findBodyFile(roots, written, what);
|
|
58701
|
+
} catch (cause) {
|
|
58702
|
+
if (!(cause instanceof BodyFileError)) throw cause;
|
|
58703
|
+
messages.push(planned.set ? `use: ${planned.set.name} \u2014 ${cause.message}` : cause.message);
|
|
58704
|
+
}
|
|
58705
|
+
}
|
|
58706
|
+
return messages;
|
|
58707
|
+
}
|
|
58577
58708
|
|
|
58578
58709
|
// ../../packages/core/src/run/runRequest.ts
|
|
58579
58710
|
var itemText = (value) => value === null || ["string", "number", "boolean"].includes(typeof value) ? value : JSON.stringify(value) ?? String(value);
|
|
58580
58711
|
function folded(layers, collection) {
|
|
58581
|
-
|
|
58582
|
-
let settings = {};
|
|
58583
|
-
for (const layer of layers) {
|
|
58584
|
-
if (layer.script === "step" || layer.script === "use") continue;
|
|
58585
|
-
if (layer.headers) headers = mergeHeaders(headers, layer.headers);
|
|
58586
|
-
settings = { ...settings, ...layer.settings };
|
|
58587
|
-
}
|
|
58712
|
+
const { headers, settings } = foldLayers(layers);
|
|
58588
58713
|
return {
|
|
58589
58714
|
...collection,
|
|
58590
58715
|
steps: [],
|
|
@@ -58592,12 +58717,15 @@ function folded(layers, collection) {
|
|
|
58592
58717
|
...Object.keys(settings).length > 0 ? { settings } : {}
|
|
58593
58718
|
};
|
|
58594
58719
|
}
|
|
58595
|
-
var
|
|
58596
|
-
|
|
58597
|
-
|
|
58598
|
-
|
|
58599
|
-
|
|
58600
|
-
}
|
|
58720
|
+
var ROLES = {
|
|
58721
|
+
// An endpoint base's checks are defaults: the step's own of the same thing replace them.
|
|
58722
|
+
"endpoint-file": { script: "endpoint", label: "endpoint file", defaults: true },
|
|
58723
|
+
endpoint: { script: "endpoint", label: "endpoint", defaults: true },
|
|
58724
|
+
base: { script: "base", label: "base" },
|
|
58725
|
+
collection: { script: "collection", label: "collection" },
|
|
58726
|
+
set: { script: "set", label: "set" },
|
|
58727
|
+
step: { script: "step", label: "" }
|
|
58728
|
+
};
|
|
58601
58729
|
var needsLibrary = (input2) => input2.checks === void 0 || input2.endpoints === void 0 || input2.tls === void 0 || input2.base === void 0 && input2.collection?.extends !== void 0;
|
|
58602
58730
|
function endpointFor(step, endpoints) {
|
|
58603
58731
|
if (isUseStep(step) || endpoints.length === 0) return null;
|
|
@@ -58679,25 +58807,13 @@ async function runRequest(input2) {
|
|
|
58679
58807
|
});
|
|
58680
58808
|
const marked = set2 ? set2.doc.steps.findIndex((s) => s.useTests === true) : -1;
|
|
58681
58809
|
const useChecksThis = set2 ? set2.child === (marked >= 0 ? marked : set2.of - 1) : false;
|
|
58682
|
-
const layers =
|
|
58683
|
-
|
|
58684
|
-
|
|
58685
|
-
|
|
58686
|
-
|
|
58687
|
-
|
|
58688
|
-
|
|
58689
|
-
});
|
|
58690
|
-
layers.push({
|
|
58691
|
-
script: "endpoint",
|
|
58692
|
-
label: "endpoint",
|
|
58693
|
-
defaults: true,
|
|
58694
|
-
...partsOf2(endpoint.step)
|
|
58695
|
-
});
|
|
58696
|
-
}
|
|
58697
|
-
if (base2) layers.push({ script: "base", label: "base", ...partsOf2(base2) });
|
|
58698
|
-
layers.push({ script: "collection", label: "collection", ...partsOf2(input2.collection) });
|
|
58699
|
-
if (set2) layers.push({ script: "set", label: "set", ...partsOf2(set2.doc) });
|
|
58700
|
-
layers.push({ script: "step", label: "", before: step.before, tests: step.tests });
|
|
58810
|
+
const layers = requestLayers({
|
|
58811
|
+
endpoint,
|
|
58812
|
+
base: base2,
|
|
58813
|
+
collection: input2.collection,
|
|
58814
|
+
set: set2?.doc,
|
|
58815
|
+
step
|
|
58816
|
+
}).map(({ kind, ...parts }) => ({ ...ROLES[kind], ...parts }));
|
|
58701
58817
|
if (useChecksThis && set2?.useTests)
|
|
58702
58818
|
layers.push({ script: "use", label: "use", tests: set2.useTests });
|
|
58703
58819
|
const collection = folded(layers, input2.collection);
|
|
@@ -58706,25 +58822,38 @@ async function runRequest(input2) {
|
|
|
58706
58822
|
...withLogs()
|
|
58707
58823
|
});
|
|
58708
58824
|
let spec;
|
|
58709
|
-
let
|
|
58825
|
+
let run;
|
|
58710
58826
|
let params;
|
|
58711
58827
|
try {
|
|
58712
|
-
|
|
58713
|
-
|
|
58714
|
-
|
|
58715
|
-
scope = each ? new OverlayScope(own2, /* @__PURE__ */ new Map([["item", itemText(each.value)]]), "forEach") : own2;
|
|
58828
|
+
run = provided ?? (context ? await buildScope(context) : new VariableScope());
|
|
58829
|
+
if (!set2)
|
|
58830
|
+
params = input2.params ?? (input2.collection?.params ? resolveParams(input2.collection.params, {}, run) : void 0);
|
|
58716
58831
|
} catch (cause) {
|
|
58717
58832
|
return failed(interpolateError(cause));
|
|
58718
58833
|
}
|
|
58719
|
-
const
|
|
58834
|
+
const scopeOf = (known) => {
|
|
58835
|
+
const own2 = known ? new ParamsScope(run, known) : run;
|
|
58836
|
+
return each ? new OverlayScope(own2, /* @__PURE__ */ new Map([["item", itemText(each.value)]]), "forEach") : own2;
|
|
58837
|
+
};
|
|
58838
|
+
let scope = scopeOf(params);
|
|
58839
|
+
const opens = set2 ? layers.findIndex((layer) => layer.script === "set") : 0;
|
|
58840
|
+
const shared = (adopt, index) => ({
|
|
58720
58841
|
assert: assert3,
|
|
58721
|
-
...params ? { params: adopt(params) } : {},
|
|
58842
|
+
...params && index >= opens ? { params: adopt(params) } : {},
|
|
58722
58843
|
...each ? { item: adopt(each.value) } : {},
|
|
58723
58844
|
...endpoint ? { endpoint: adopt(endpointValues(endpoint, step, scope)) } : {}
|
|
58724
58845
|
});
|
|
58725
58846
|
const filenameOf = (layer, kind) => layer.label === "" ? kind : `${layer.label} ${kind}`;
|
|
58726
58847
|
let edited = null;
|
|
58727
|
-
for (const layer of layers) {
|
|
58848
|
+
for (const [index, layer] of layers.entries()) {
|
|
58849
|
+
if (set2 && index === opens) {
|
|
58850
|
+
try {
|
|
58851
|
+
params = set2.params();
|
|
58852
|
+
} catch (cause) {
|
|
58853
|
+
return failed({ phase: "use", message: cause.message });
|
|
58854
|
+
}
|
|
58855
|
+
scope = scopeOf(params);
|
|
58856
|
+
}
|
|
58728
58857
|
const before = layer.before;
|
|
58729
58858
|
const script = layer.script;
|
|
58730
58859
|
if (before?.script) {
|
|
@@ -58737,7 +58866,7 @@ async function runRequest(input2) {
|
|
|
58737
58866
|
...checks ? { checks } : {},
|
|
58738
58867
|
globals: (adopt) => {
|
|
58739
58868
|
view = requestView(shown, adopt);
|
|
58740
|
-
return { ...shared(adopt), gta: preRequestGta(scope, control), req: view };
|
|
58869
|
+
return { ...shared(adopt, index), gta: preRequestGta(scope, control), req: view };
|
|
58741
58870
|
}
|
|
58742
58871
|
});
|
|
58743
58872
|
if (error62) return failed({ ...error62, script });
|
|
@@ -58767,7 +58896,11 @@ async function runRequest(input2) {
|
|
|
58767
58896
|
edited ?? toSentRequest(step, collection),
|
|
58768
58897
|
step.body,
|
|
58769
58898
|
scope,
|
|
58770
|
-
|
|
58899
|
+
await fileRoots(
|
|
58900
|
+
step,
|
|
58901
|
+
set2?.path ?? context?.collectionPath ?? itemPath,
|
|
58902
|
+
context?.collectionPath ?? itemPath
|
|
58903
|
+
)
|
|
58771
58904
|
);
|
|
58772
58905
|
spec = prepared.request;
|
|
58773
58906
|
payload = prepared.payload;
|
|
@@ -58803,18 +58936,18 @@ async function runRequest(input2) {
|
|
|
58803
58936
|
const session = new CheckSession({ response, scope });
|
|
58804
58937
|
let testsError = null;
|
|
58805
58938
|
try {
|
|
58806
|
-
for (const layer of layers) {
|
|
58939
|
+
for (const [index, layer] of layers.entries()) {
|
|
58807
58940
|
const code = layer.tests;
|
|
58808
58941
|
if (!code || testsError) continue;
|
|
58809
58942
|
const pending = [];
|
|
58810
|
-
const
|
|
58943
|
+
const run2 = () => runScript(code, {
|
|
58811
58944
|
phase: "tests",
|
|
58812
58945
|
filename: filenameOf(layer, "tests"),
|
|
58813
58946
|
logs,
|
|
58814
58947
|
...checks ? { checks } : {},
|
|
58815
58948
|
pending: () => pending,
|
|
58816
58949
|
globals: (adopt) => ({
|
|
58817
|
-
...shared(adopt),
|
|
58950
|
+
...shared(adopt, index),
|
|
58818
58951
|
gta: testsGta({
|
|
58819
58952
|
session,
|
|
58820
58953
|
scope,
|
|
@@ -58826,7 +58959,7 @@ async function runRequest(input2) {
|
|
|
58826
58959
|
res: responseView(response, adopt)
|
|
58827
58960
|
})
|
|
58828
58961
|
});
|
|
58829
|
-
const scriptError = layer.defaults ? await session.asDefaults(
|
|
58962
|
+
const scriptError = layer.defaults ? await session.asDefaults(run2) : await run2();
|
|
58830
58963
|
if (scriptError) testsError = { ...scriptError, script: layer.script };
|
|
58831
58964
|
}
|
|
58832
58965
|
} catch (cause) {
|
|
@@ -58877,8 +59010,9 @@ function changedRequest(shown, view, body) {
|
|
|
58877
59010
|
}
|
|
58878
59011
|
return next;
|
|
58879
59012
|
}
|
|
58880
|
-
function
|
|
58881
|
-
|
|
59013
|
+
async function fileRoots(step, file2, collection) {
|
|
59014
|
+
if (!file2 || bodyFiles(step.body).length === 0) return null;
|
|
59015
|
+
return fileRootsOf(file2, collection ?? file2);
|
|
58882
59016
|
}
|
|
58883
59017
|
function interpolateError(cause) {
|
|
58884
59018
|
return {
|
|
@@ -58908,7 +59042,7 @@ function toSentRequestSafely(step, collection) {
|
|
|
58908
59042
|
}
|
|
58909
59043
|
|
|
58910
59044
|
// ../../packages/core/src/run/runCollection.ts
|
|
58911
|
-
import
|
|
59045
|
+
import path9 from "node:path";
|
|
58912
59046
|
async function runCollection(options) {
|
|
58913
59047
|
const { collection, collectionPath = null, context, signal, onResult, bail = false } = options;
|
|
58914
59048
|
const stage = options.stage ?? "steps";
|
|
@@ -58936,8 +59070,20 @@ async function runCollection(options) {
|
|
|
58936
59070
|
const own2 = collection.params ? selfAsSet(collection, collectionPath) : void 0;
|
|
58937
59071
|
const plan = await planSteps(running, collectionPath);
|
|
58938
59072
|
const results = [];
|
|
58939
|
-
let params =
|
|
59073
|
+
let params = null;
|
|
58940
59074
|
let unstarted = null;
|
|
59075
|
+
const paramsOf = (using) => () => {
|
|
59076
|
+
if (unstarted) throw new Error(unstarted.message);
|
|
59077
|
+
if (!params) {
|
|
59078
|
+
try {
|
|
59079
|
+
params = resolveParams(using.doc.params, using.with, scope);
|
|
59080
|
+
} catch (cause) {
|
|
59081
|
+
unstarted = { phase: "use", message: `use: ${using.name} \u2014 ${cause.message}` };
|
|
59082
|
+
throw new Error(unstarted.message);
|
|
59083
|
+
}
|
|
59084
|
+
}
|
|
59085
|
+
return params;
|
|
59086
|
+
};
|
|
58941
59087
|
let rest = null;
|
|
58942
59088
|
let attempted = 0;
|
|
58943
59089
|
const emit = (index, result) => {
|
|
@@ -58969,12 +59115,13 @@ async function runCollection(options) {
|
|
|
58969
59115
|
const using = set2?.planned ?? own2;
|
|
58970
59116
|
const starting = set2 ? set2.child === 0 : planned.index === 0;
|
|
58971
59117
|
if (starting) {
|
|
58972
|
-
|
|
58973
|
-
|
|
58974
|
-
|
|
58975
|
-
|
|
58976
|
-
|
|
58977
|
-
|
|
59118
|
+
params = null;
|
|
59119
|
+
unstarted = null;
|
|
59120
|
+
if (!set2) {
|
|
59121
|
+
try {
|
|
59122
|
+
paramsOf(using)();
|
|
59123
|
+
} catch {
|
|
59124
|
+
}
|
|
58978
59125
|
}
|
|
58979
59126
|
}
|
|
58980
59127
|
}
|
|
@@ -59030,12 +59177,12 @@ async function runCollection(options) {
|
|
|
59030
59177
|
...set2.planned.useName ? { useName: set2.planned.useName } : {},
|
|
59031
59178
|
path: set2.planned.path,
|
|
59032
59179
|
doc: set2.planned.doc,
|
|
59033
|
-
params,
|
|
59180
|
+
params: paramsOf(set2.planned),
|
|
59034
59181
|
child: set2.child,
|
|
59035
59182
|
of: set2.of,
|
|
59036
59183
|
useTests: set2.planned.useTests
|
|
59037
59184
|
}
|
|
59038
|
-
} : own2 ? { params } : {},
|
|
59185
|
+
} : own2 ? { params: params ?? {} } : {},
|
|
59039
59186
|
...signal ? { signal } : {}
|
|
59040
59187
|
});
|
|
59041
59188
|
emit(planned.index, result);
|
|
@@ -59086,7 +59233,7 @@ var useOf = (set2) => ({
|
|
|
59086
59233
|
});
|
|
59087
59234
|
function selfAsSet(collection, collectionPath) {
|
|
59088
59235
|
return {
|
|
59089
|
-
name: collectionPath ?
|
|
59236
|
+
name: collectionPath ? path9.basename(collectionPath, ".yml") : collection.id ?? "set",
|
|
59090
59237
|
path: collectionPath ?? "",
|
|
59091
59238
|
// Its own before, tests, headers and settings already apply as the collection's.
|
|
59092
59239
|
doc: { params: collection.params, steps: collection.steps },
|
|
@@ -59395,7 +59542,7 @@ async function runJob(job) {
|
|
|
59395
59542
|
collectionPath: loaded.path,
|
|
59396
59543
|
context: { ...context, flags: job.flags, dataRow: null },
|
|
59397
59544
|
rows: data ? data.rows.map((row, i) => ({
|
|
59398
|
-
source: `${
|
|
59545
|
+
source: `${path10.basename(data.path)} row ${i + 1}`,
|
|
59399
59546
|
vars: row.values,
|
|
59400
59547
|
label: row.label
|
|
59401
59548
|
})) : null,
|
|
@@ -59414,7 +59561,7 @@ async function runJob(job) {
|
|
|
59414
59561
|
});
|
|
59415
59562
|
return {
|
|
59416
59563
|
ok: true,
|
|
59417
|
-
summary: redact(summary, await
|
|
59564
|
+
summary: redact(summary, await secretValues(context)),
|
|
59418
59565
|
steps: refs,
|
|
59419
59566
|
data: loaded.dataFile ? { file: `${COLLECTIONS_DIR}/${loaded.dataFile.relativePath}`, rows: loaded.dataFile.rows } : null
|
|
59420
59567
|
};
|
|
@@ -59422,35 +59569,6 @@ async function runJob(job) {
|
|
|
59422
59569
|
return { ok: false, message: cause instanceof Error ? cause.message : String(cause) };
|
|
59423
59570
|
}
|
|
59424
59571
|
}
|
|
59425
|
-
async function secretsOf(context) {
|
|
59426
|
-
if (!context.environmentName) return [];
|
|
59427
|
-
try {
|
|
59428
|
-
const layer = await environmentLayer(context, context.environmentName);
|
|
59429
|
-
return (layer.secrets ?? []).flatMap((name) => {
|
|
59430
|
-
const value = layer.vars[name];
|
|
59431
|
-
return value === void 0 || value === null || String(value) === "" ? [] : [[name, String(value)]];
|
|
59432
|
-
}).sort((a, b) => b[1].length - a[1].length);
|
|
59433
|
-
} catch {
|
|
59434
|
-
return [];
|
|
59435
|
-
}
|
|
59436
|
-
}
|
|
59437
|
-
function redact(value, secrets) {
|
|
59438
|
-
if (secrets.length === 0) return value;
|
|
59439
|
-
const walk = (node2) => {
|
|
59440
|
-
if (typeof node2 === "string") {
|
|
59441
|
-
return secrets.reduce(
|
|
59442
|
-
(text, [name, secret]) => text.split(secret).join(`[secret: ${name}]`),
|
|
59443
|
-
node2
|
|
59444
|
-
);
|
|
59445
|
-
}
|
|
59446
|
-
if (Array.isArray(node2)) return node2.map(walk);
|
|
59447
|
-
if (node2 !== null && typeof node2 === "object") {
|
|
59448
|
-
return Object.fromEntries(Object.entries(node2).map(([key, inner]) => [key, walk(inner)]));
|
|
59449
|
-
}
|
|
59450
|
-
return node2;
|
|
59451
|
-
};
|
|
59452
|
-
return walk(value);
|
|
59453
|
-
}
|
|
59454
59572
|
async function stepLines(file2) {
|
|
59455
59573
|
const lines = { setup: [], steps: [], teardown: [] };
|
|
59456
59574
|
try {
|