@schwabyio/gta 0.10.0 → 0.11.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 +69 -26
- package/dist/chunks/{chunk-MZSHHPAQ.js → chunk-OM3ZR56O.js} +372 -270
- 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
|
}
|
|
@@ -54875,21 +54875,21 @@ async function canonical(target) {
|
|
|
54875
54875
|
return absolute;
|
|
54876
54876
|
}
|
|
54877
54877
|
}
|
|
54878
|
-
function isInside(parent, child,
|
|
54879
|
-
const relative =
|
|
54880
|
-
const leaves = relative === ".." || relative.startsWith(`..${
|
|
54881
|
-
return relative === "" || !leaves && !
|
|
54878
|
+
function isInside(parent, child, path11 = nodePath) {
|
|
54879
|
+
const relative = path11.relative(parent, child);
|
|
54880
|
+
const leaves = relative === ".." || relative.startsWith(`..${path11.sep}`);
|
|
54881
|
+
return relative === "" || !leaves && !path11.isAbsolute(relative);
|
|
54882
54882
|
}
|
|
54883
|
-
var samePath = (a, b,
|
|
54883
|
+
var samePath = (a, b, path11 = nodePath) => path11.relative(a, b) === "";
|
|
54884
54884
|
var toPosix = (relative) => relative.split(/[\\/]+/).join("/");
|
|
54885
54885
|
var isAbsoluteAnywhere = (target) => nodePath.posix.isAbsolute(target) || nodePath.win32.isAbsolute(target);
|
|
54886
|
-
function resolveRelative(root, relative,
|
|
54886
|
+
function resolveRelative(root, relative, path11 = nodePath) {
|
|
54887
54887
|
if (isAbsoluteAnywhere(relative)) {
|
|
54888
54888
|
throw new Error(`"${relative}" must be a relative path, so it works on every machine`);
|
|
54889
54889
|
}
|
|
54890
|
-
return
|
|
54890
|
+
return path11.resolve(root, ...relative.split(/[\\/]+/).filter(Boolean));
|
|
54891
54891
|
}
|
|
54892
|
-
var relativePosix = (from, to,
|
|
54892
|
+
var relativePosix = (from, to, path11 = nodePath) => toPosix(path11.relative(from, to)) || ".";
|
|
54893
54893
|
var RESERVED = /^(con|prn|aux|nul|conin\$|conout\$|com[0-9¹²³]|lpt[0-9¹²³])(\..*)?$/i;
|
|
54894
54894
|
var FORBIDDEN = /[<>:"/\\|?*\u0000-\u001f]/;
|
|
54895
54895
|
function nameProblem(name) {
|
|
@@ -55062,9 +55062,9 @@ var SEGMENT = (
|
|
|
55062
55062
|
// eslint-disable-next-line no-control-regex
|
|
55063
55063
|
/\[("(?:[^"\\\u0000-\u001f]|\\["\\/bfnrt]|\\u[0-9a-fA-F]{4})*")\]|([^.[\]]+)|\[(\d*)\]/g
|
|
55064
55064
|
);
|
|
55065
|
-
function parsePath(
|
|
55065
|
+
function parsePath(path11) {
|
|
55066
55066
|
const segments = [];
|
|
55067
|
-
for (const match of
|
|
55067
|
+
for (const match of path11.matchAll(SEGMENT)) {
|
|
55068
55068
|
if (match[1] !== void 0) segments.push({ kind: "key", key: JSON.parse(match[1]) });
|
|
55069
55069
|
else if (match[2] !== void 0) segments.push({ kind: "key", key: match[2] });
|
|
55070
55070
|
else if (match[3] === "") segments.push({ kind: "each" });
|
|
@@ -55089,16 +55089,16 @@ function resolvePath(root, pattern) {
|
|
|
55089
55089
|
let frontier = [{ path: [], value: root }];
|
|
55090
55090
|
for (const segment of pattern) {
|
|
55091
55091
|
const next = [];
|
|
55092
|
-
for (const { path:
|
|
55092
|
+
for (const { path: path11, value } of frontier) {
|
|
55093
55093
|
if (segment.kind === "each") {
|
|
55094
55094
|
if (!Array.isArray(value)) continue;
|
|
55095
55095
|
value.forEach(
|
|
55096
|
-
(item, index) => next.push({ path: [...
|
|
55096
|
+
(item, index) => next.push({ path: [...path11, { kind: "index", index }], value: item })
|
|
55097
55097
|
);
|
|
55098
55098
|
continue;
|
|
55099
55099
|
}
|
|
55100
55100
|
const step = childOf(value, segment);
|
|
55101
|
-
if (step) next.push({ path: [...
|
|
55101
|
+
if (step) next.push({ path: [...path11, step.segment], value: step.value });
|
|
55102
55102
|
}
|
|
55103
55103
|
frontier = next;
|
|
55104
55104
|
}
|
|
@@ -55116,17 +55116,17 @@ function childOf(value, segment) {
|
|
|
55116
55116
|
}
|
|
55117
55117
|
function sortArraysBy(value, properties) {
|
|
55118
55118
|
const paths = properties.map(parsePath);
|
|
55119
|
-
const sortValue = (item,
|
|
55119
|
+
const sortValue = (item, path11) => item !== null && typeof item === "object" && !Array.isArray(item) ? resolvePath(item, path11)[0]?.value : void 0;
|
|
55120
55120
|
const visit2 = (node2) => {
|
|
55121
55121
|
if (Array.isArray(node2)) {
|
|
55122
55122
|
const items = node2.map(visit2);
|
|
55123
55123
|
const sortable = paths.some(
|
|
55124
|
-
(
|
|
55124
|
+
(path11) => items.some((item) => sortValue(item, path11) !== void 0)
|
|
55125
55125
|
);
|
|
55126
55126
|
if (!sortable) return items;
|
|
55127
55127
|
return items.map((item, index) => ({ item, index })).sort((a, b) => {
|
|
55128
|
-
for (const
|
|
55129
|
-
const order = compareAlphanumerically(sortValue(a.item,
|
|
55128
|
+
for (const path11 of paths) {
|
|
55129
|
+
const order = compareAlphanumerically(sortValue(a.item, path11), sortValue(b.item, path11));
|
|
55130
55130
|
if (order !== 0) return order;
|
|
55131
55131
|
}
|
|
55132
55132
|
return a.index - b.index;
|
|
@@ -55627,8 +55627,8 @@ var FormatError = class extends Error {
|
|
|
55627
55627
|
};
|
|
55628
55628
|
function describeValidation(error62) {
|
|
55629
55629
|
return error62.issues.map((issue2) => {
|
|
55630
|
-
const
|
|
55631
|
-
return
|
|
55630
|
+
const path11 = issue2.path.join(".");
|
|
55631
|
+
return path11 ? `${path11}: ${issue2.message}` : issue2.message;
|
|
55632
55632
|
}).join("; ");
|
|
55633
55633
|
}
|
|
55634
55634
|
|
|
@@ -57219,7 +57219,8 @@ import fs8 from "node:fs/promises";
|
|
|
57219
57219
|
var BodyFileError = class extends Error {
|
|
57220
57220
|
name = "BodyFileError";
|
|
57221
57221
|
};
|
|
57222
|
-
|
|
57222
|
+
var GLOBAL_FILE = "global:";
|
|
57223
|
+
async function prepareRequest(written, body, scope, files) {
|
|
57223
57224
|
const resolve = (text) => interpolateToString(text, scope);
|
|
57224
57225
|
const headers = written.headers.map((header) => ({
|
|
57225
57226
|
name: resolve(header.name),
|
|
@@ -57240,14 +57241,14 @@ async function prepareRequest(written, body, scope, root) {
|
|
|
57240
57241
|
if (typeof part === "string") {
|
|
57241
57242
|
parts.push({ name, value: resolve(part) });
|
|
57242
57243
|
} else if ("file" in part) {
|
|
57243
|
-
const
|
|
57244
|
-
const bytes2 = await readBodyFile(
|
|
57244
|
+
const path11 = resolve(part.file);
|
|
57245
|
+
const { bytes: bytes2, shown } = await readBodyFile(files, path11, `multipart field ${name}`);
|
|
57245
57246
|
parts.push({
|
|
57246
57247
|
name,
|
|
57247
57248
|
value: bytes2,
|
|
57248
|
-
filename: part.filename !== void 0 ? resolve(part.filename) : baseName(
|
|
57249
|
-
contentType: part.contentType ? resolve(part.contentType) : contentTypeFor(
|
|
57250
|
-
shown: fileMarker(
|
|
57249
|
+
filename: part.filename !== void 0 ? resolve(part.filename) : baseName(path11),
|
|
57250
|
+
contentType: part.contentType ? resolve(part.contentType) : contentTypeFor(path11),
|
|
57251
|
+
shown: fileMarker(shown, bytes2.byteLength)
|
|
57251
57252
|
});
|
|
57252
57253
|
} else {
|
|
57253
57254
|
parts.push({
|
|
@@ -57262,14 +57263,14 @@ async function prepareRequest(written, body, scope, root) {
|
|
|
57262
57263
|
return { request: { ...request, headers: typed.headers, body: text }, payload: bytes };
|
|
57263
57264
|
}
|
|
57264
57265
|
if (body?.file !== void 0) {
|
|
57265
|
-
const
|
|
57266
|
-
const bytes = await readBodyFile(
|
|
57266
|
+
const path11 = resolve(body.file);
|
|
57267
|
+
const { bytes, shown } = await readBodyFile(files, path11, "body.file");
|
|
57267
57268
|
const declared = headers.some((header) => header.name.toLowerCase() === "content-type");
|
|
57268
57269
|
return {
|
|
57269
57270
|
request: {
|
|
57270
57271
|
...request,
|
|
57271
|
-
headers: declared ? headers : [...headers, { name: "Content-Type", value: contentTypeFor(
|
|
57272
|
-
body: fileMarker(
|
|
57272
|
+
headers: declared ? headers : [...headers, { name: "Content-Type", value: contentTypeFor(path11) }],
|
|
57273
|
+
body: fileMarker(shown, bytes.byteLength)
|
|
57273
57274
|
},
|
|
57274
57275
|
payload: bytes
|
|
57275
57276
|
};
|
|
@@ -57283,33 +57284,78 @@ async function prepareRequest(written, body, scope, root) {
|
|
|
57283
57284
|
payload: null
|
|
57284
57285
|
};
|
|
57285
57286
|
}
|
|
57286
|
-
var baseName = (
|
|
57287
|
-
|
|
57288
|
-
|
|
57289
|
-
|
|
57290
|
-
|
|
57287
|
+
var baseName = (path11) => withoutGlobal(path11).split(/[\\/]/).pop() ?? path11;
|
|
57288
|
+
var withoutGlobal = (path11) => path11.startsWith(GLOBAL_FILE) ? path11.slice(GLOBAL_FILE.length) : path11;
|
|
57289
|
+
function bodyFiles(body) {
|
|
57290
|
+
if (body?.file !== void 0) return [{ what: "body.file", written: body.file }];
|
|
57291
|
+
if (body?.multipart === void 0) return [];
|
|
57292
|
+
return partsOf(body.multipart).flatMap(
|
|
57293
|
+
([field, part]) => typeof part !== "string" && "file" in part ? [{ what: `multipart field ${field}`, written: part.file }] : []
|
|
57294
|
+
);
|
|
57295
|
+
}
|
|
57296
|
+
async function readBodyFile(roots, written, what) {
|
|
57297
|
+
const { file: file2, shown } = await findBodyFile(roots, written, what);
|
|
57298
|
+
try {
|
|
57299
|
+
return { bytes: await fs8.readFile(file2), shown };
|
|
57300
|
+
} catch (cause) {
|
|
57301
|
+
throw new BodyFileError(`${what}: ${written} \u2014 ${cause.message}`);
|
|
57302
|
+
}
|
|
57303
|
+
}
|
|
57304
|
+
async function findBodyFile(roots, written, what) {
|
|
57305
|
+
const missing = (reason) => new BodyFileError(`${what}: ${written} \u2014 ${reason}`);
|
|
57306
|
+
if (roots === null) {
|
|
57307
|
+
throw missing(
|
|
57308
|
+
"files are read from the project folder, so save the collection in a project first"
|
|
57291
57309
|
);
|
|
57292
57310
|
}
|
|
57311
|
+
const relative = withoutGlobal(written);
|
|
57312
|
+
if (relative !== written) {
|
|
57313
|
+
if (!roots.global) throw missing("this project does not use a global project");
|
|
57314
|
+
const file3 = await fileIn(roots.global, relative, written, what);
|
|
57315
|
+
if (file3) return { file: file3, shown: written };
|
|
57316
|
+
throw missing("no such file in the global project folder");
|
|
57317
|
+
}
|
|
57318
|
+
const file2 = await fileIn(roots.project, relative, written, what);
|
|
57319
|
+
if (file2) return { file: file2, shown: written };
|
|
57320
|
+
const global = roots.global && !samePath(roots.global, roots.project) ? roots.global : null;
|
|
57321
|
+
if (!global || !isInside(roots.project, resolveRelative(roots.project, relative))) {
|
|
57322
|
+
throw missing("no such file in the project folder");
|
|
57323
|
+
}
|
|
57324
|
+
const shared = await fileIn(global, relative, written, what);
|
|
57325
|
+
if (shared) return { file: shared, shown: `${GLOBAL_FILE}${toPosix(relative)}` };
|
|
57326
|
+
throw missing(
|
|
57327
|
+
`no such file in the project folder, or in its global project's (${relativePosix(roots.project, global)})`
|
|
57328
|
+
);
|
|
57329
|
+
}
|
|
57330
|
+
async function fileIn(root, relative, written, what) {
|
|
57293
57331
|
let file2;
|
|
57294
57332
|
try {
|
|
57295
|
-
file2 = resolveRelative(root,
|
|
57333
|
+
file2 = resolveRelative(root, relative);
|
|
57296
57334
|
} catch (cause) {
|
|
57297
57335
|
throw new BodyFileError(`${what}: ${cause.message}`);
|
|
57298
57336
|
}
|
|
57299
|
-
|
|
57337
|
+
if (written.startsWith(GLOBAL_FILE) && !isInside(root, file2)) {
|
|
57338
|
+
throw new BodyFileError(
|
|
57339
|
+
`${what}: ${written} \u2014 a global: path stays in the global project folder`
|
|
57340
|
+
);
|
|
57341
|
+
}
|
|
57342
|
+
const misspelled = await spellingProblem(root, relative);
|
|
57300
57343
|
if (misspelled) throw new BodyFileError(`${what}: ${misspelled}`);
|
|
57344
|
+
let stat;
|
|
57301
57345
|
try {
|
|
57302
|
-
|
|
57346
|
+
stat = await fs8.stat(file2);
|
|
57303
57347
|
} catch (cause) {
|
|
57304
57348
|
const code = cause.code;
|
|
57305
|
-
|
|
57306
|
-
throw new BodyFileError(`${what}: ${
|
|
57349
|
+
if (code === "ENOENT" || code === "ENOTDIR") return null;
|
|
57350
|
+
throw new BodyFileError(`${what}: ${written} \u2014 ${cause.message}`);
|
|
57307
57351
|
}
|
|
57352
|
+
if (stat.isDirectory())
|
|
57353
|
+
throw new BodyFileError(`${what}: ${written} \u2014 is a directory, not a file`);
|
|
57354
|
+
return file2;
|
|
57308
57355
|
}
|
|
57309
57356
|
|
|
57310
57357
|
// ../../packages/core/src/run/runRequest.ts
|
|
57311
57358
|
import assert3 from "node:assert/strict";
|
|
57312
|
-
import path9 from "node:path";
|
|
57313
57359
|
|
|
57314
57360
|
// ../../packages/core/src/assert/evaluate.ts
|
|
57315
57361
|
function locate(root, segments, nullAlong) {
|
|
@@ -57341,9 +57387,9 @@ function checkScalarTarget(target, label, wanted, found, context) {
|
|
|
57341
57387
|
capture(wanted, value, context.scope);
|
|
57342
57388
|
return failure2 ? { ...base2, ...actual, name, status: "fail", message: failure2 } : { ...base2, ...actual, name, status: "pass" };
|
|
57343
57389
|
}
|
|
57344
|
-
function checkBody(
|
|
57345
|
-
const base2 = { target: "body", path:
|
|
57346
|
-
const name = `${
|
|
57390
|
+
function checkBody(path11, segments, wanted, located, context) {
|
|
57391
|
+
const base2 = { target: "body", path: path11, expected: describe3(wanted) };
|
|
57392
|
+
const name = `${path11} ${describe3(wanted, { brief: true })}`;
|
|
57347
57393
|
const fanOut = segments.some((s) => s.kind === "each");
|
|
57348
57394
|
const actual = located.length === 0 ? {} : { actual: fanOut ? show(located.map((l) => l.value)) : show(located[0].value) };
|
|
57349
57395
|
if (wanted.absent) {
|
|
@@ -57643,19 +57689,19 @@ var REMOVED = /* @__PURE__ */ Symbol("removed");
|
|
|
57643
57689
|
function findUnasserted(body, covered) {
|
|
57644
57690
|
const root = { value: structuredClone(body) };
|
|
57645
57691
|
for (const coverage of covered) {
|
|
57646
|
-
for (const { path:
|
|
57692
|
+
for (const { path: path11 } of resolvePath(root.value, coverage.pattern)) remove(root, path11);
|
|
57647
57693
|
}
|
|
57648
57694
|
const leaves = [];
|
|
57649
57695
|
collectLeaves(prune(root.value), [], leaves);
|
|
57650
57696
|
return leaves;
|
|
57651
57697
|
}
|
|
57652
|
-
function remove(root,
|
|
57653
|
-
if (
|
|
57698
|
+
function remove(root, path11) {
|
|
57699
|
+
if (path11.length === 0) {
|
|
57654
57700
|
root.value = REMOVED;
|
|
57655
57701
|
return;
|
|
57656
57702
|
}
|
|
57657
|
-
const parent = resolvePath(root.value,
|
|
57658
|
-
const last =
|
|
57703
|
+
const parent = resolvePath(root.value, path11.slice(0, -1))[0]?.value;
|
|
57704
|
+
const last = path11[path11.length - 1];
|
|
57659
57705
|
if (Array.isArray(parent) && last.kind === "index") parent[last.index] = REMOVED;
|
|
57660
57706
|
else if (parent !== null && typeof parent === "object" && last.kind === "key") {
|
|
57661
57707
|
delete parent[last.key];
|
|
@@ -57674,16 +57720,16 @@ function prune(value) {
|
|
|
57674
57720
|
}
|
|
57675
57721
|
return value;
|
|
57676
57722
|
}
|
|
57677
|
-
function collectLeaves(value,
|
|
57723
|
+
function collectLeaves(value, path11, out) {
|
|
57678
57724
|
if (value === void 0) return;
|
|
57679
57725
|
if (Array.isArray(value)) {
|
|
57680
|
-
value.forEach((item, index) => collectLeaves(item, [...
|
|
57726
|
+
value.forEach((item, index) => collectLeaves(item, [...path11, { kind: "index", index }], out));
|
|
57681
57727
|
} else if (value !== null && typeof value === "object") {
|
|
57682
57728
|
for (const [key, child] of Object.entries(value)) {
|
|
57683
|
-
collectLeaves(child, [...
|
|
57729
|
+
collectLeaves(child, [...path11, { kind: "key", key }], out);
|
|
57684
57730
|
}
|
|
57685
57731
|
} else {
|
|
57686
|
-
out.push(formatPath(
|
|
57732
|
+
out.push(formatPath(path11));
|
|
57687
57733
|
}
|
|
57688
57734
|
}
|
|
57689
57735
|
|
|
@@ -57737,12 +57783,12 @@ var CheckSession = class {
|
|
|
57737
57783
|
path: name
|
|
57738
57784
|
});
|
|
57739
57785
|
}
|
|
57740
|
-
body(
|
|
57786
|
+
body(path11, matcher) {
|
|
57741
57787
|
const body = this.body_();
|
|
57742
57788
|
if (body === BODY_UNAVAILABLE) return null;
|
|
57743
|
-
const segments = parsePath(
|
|
57789
|
+
const segments = parsePath(path11);
|
|
57744
57790
|
const located = locate(body, segments, isNullCheck(matcher));
|
|
57745
|
-
const result = checkBody(
|
|
57791
|
+
const result = checkBody(path11, segments, matcher, located, {
|
|
57746
57792
|
...this.context,
|
|
57747
57793
|
claimed: (arrayPath) => this.claimsOn(arrayPath)
|
|
57748
57794
|
});
|
|
@@ -57755,13 +57801,13 @@ var CheckSession = class {
|
|
|
57755
57801
|
* Both are checked now, against the body as it is now, and `finish()` keeps
|
|
57756
57802
|
* the one the step's last word on strict validation asks for.
|
|
57757
57803
|
*/
|
|
57758
|
-
bodyByStrictness(
|
|
57804
|
+
bodyByStrictness(path11, matchers) {
|
|
57759
57805
|
const body = this.body_();
|
|
57760
57806
|
if (body === BODY_UNAVAILABLE) return null;
|
|
57761
|
-
const segments = parsePath(
|
|
57807
|
+
const segments = parsePath(path11);
|
|
57762
57808
|
const located = locate(body, segments, false);
|
|
57763
|
-
const strict = checkBody(
|
|
57764
|
-
const lenient = checkBody(
|
|
57809
|
+
const strict = checkBody(path11, segments, matchers.strict, located, this.context);
|
|
57810
|
+
const lenient = checkBody(path11, segments, matchers.lenient, located, this.context);
|
|
57765
57811
|
const assertion = this.record(lenient.assertion);
|
|
57766
57812
|
this.byStrictness.push({ assertion, strict });
|
|
57767
57813
|
return assertion;
|
|
@@ -57772,8 +57818,8 @@ var CheckSession = class {
|
|
|
57772
57818
|
return claimed;
|
|
57773
57819
|
}
|
|
57774
57820
|
/** Account for a path under strict validation without asserting anything. */
|
|
57775
|
-
ignore(
|
|
57776
|
-
this.covered.push({ pattern: parsePath(
|
|
57821
|
+
ignore(path11) {
|
|
57822
|
+
this.covered.push({ pattern: parsePath(path11) });
|
|
57777
57823
|
}
|
|
57778
57824
|
/** Add a result to the report — every check's, and a named check's from code. */
|
|
57779
57825
|
record(assertion) {
|
|
@@ -57985,16 +58031,16 @@ function variableName(value) {
|
|
|
57985
58031
|
}
|
|
57986
58032
|
return value;
|
|
57987
58033
|
}
|
|
57988
|
-
function pathOf2(
|
|
57989
|
-
if (typeof
|
|
57990
|
-
if (!Array.isArray(
|
|
58034
|
+
function pathOf2(path11, what) {
|
|
58035
|
+
if (typeof path11 === "string") return path11;
|
|
58036
|
+
if (!Array.isArray(path11)) {
|
|
57991
58037
|
throw new GtaUsageError(
|
|
57992
|
-
`${what} is a string, such as "user.name", or a list of keys, such as ["user", "name"]; got ${show(
|
|
58038
|
+
`${what} is a string, such as "user.name", or a list of keys, such as ["user", "name"]; got ${show(path11)}`
|
|
57993
58039
|
);
|
|
57994
58040
|
}
|
|
57995
|
-
if (
|
|
58041
|
+
if (path11.length === 0) throw new GtaUsageError(`${what} is an empty list; it needs a key`);
|
|
57996
58042
|
return formatPath(
|
|
57997
|
-
|
|
58043
|
+
path11.map((key) => {
|
|
57998
58044
|
if (typeof key === "string") return { kind: "key", key };
|
|
57999
58045
|
if (typeof key === "number") return { kind: "key", key: String(key) };
|
|
58000
58046
|
throw new GtaUsageError(`${what}'s keys are strings or numbers; got ${show(key)}`);
|
|
@@ -58005,14 +58051,14 @@ var isValidationEntry = (value) => value !== null && typeof value === "object" &
|
|
|
58005
58051
|
function itemFrom(list, valueKey) {
|
|
58006
58052
|
const item = {};
|
|
58007
58053
|
for (const entry of list) {
|
|
58008
|
-
const
|
|
58054
|
+
const path11 = pathOf2(entry.pathToProperty, "pathToProperty");
|
|
58009
58055
|
if (valueKey === "compareValue") {
|
|
58010
58056
|
const value = entry.compareValue;
|
|
58011
|
-
item[
|
|
58057
|
+
item[path11] = isRegExp(value) ? { matches: value } : value;
|
|
58012
58058
|
continue;
|
|
58013
58059
|
}
|
|
58014
58060
|
const matcher = xtestMatcher(valueKey in entry, entry[valueKey], entry.specialHandling);
|
|
58015
|
-
item[
|
|
58061
|
+
item[path11] = { ...item[path11], ...matcher };
|
|
58016
58062
|
}
|
|
58017
58063
|
return item;
|
|
58018
58064
|
}
|
|
@@ -58021,8 +58067,8 @@ function loneNotThisValue(list) {
|
|
|
58021
58067
|
if (list.length !== 1 || !isValidationEntry(entry)) return null;
|
|
58022
58068
|
if (entry.specialHandling !== "notThisExpectedValue" || !("expectedValue" in entry)) return null;
|
|
58023
58069
|
const value = entry.expectedValue;
|
|
58024
|
-
const
|
|
58025
|
-
return { unorderedNot: [{ [
|
|
58070
|
+
const path11 = pathOf2(entry.pathToProperty, "pathToProperty");
|
|
58071
|
+
return { unorderedNot: [{ [path11]: isRegExp(value) ? { matches: value } : value }] };
|
|
58026
58072
|
}
|
|
58027
58073
|
function toList(validationList) {
|
|
58028
58074
|
if (!Array.isArray(validationList)) {
|
|
@@ -58082,9 +58128,9 @@ function testsGta({
|
|
|
58082
58128
|
session,
|
|
58083
58129
|
"expectResponseBodyToHaveProperty",
|
|
58084
58130
|
(...args) => {
|
|
58085
|
-
const [
|
|
58131
|
+
const [path11, value, specialHandling] = args;
|
|
58086
58132
|
session.body(
|
|
58087
|
-
pathOf2(
|
|
58133
|
+
pathOf2(path11, "jsonPathToProperty"),
|
|
58088
58134
|
xtestMatcher(args.length > 1, value, specialHandling)
|
|
58089
58135
|
);
|
|
58090
58136
|
}
|
|
@@ -58093,22 +58139,22 @@ function testsGta({
|
|
|
58093
58139
|
session,
|
|
58094
58140
|
"expectResponseBodyToHaveUnorderedArray",
|
|
58095
58141
|
(jsonPathToArray, validationList) => {
|
|
58096
|
-
const
|
|
58142
|
+
const path11 = pathOf2(jsonPathToArray, "jsonPathToArray");
|
|
58097
58143
|
const list = toList(validationList);
|
|
58098
58144
|
const unordered = list.every(isValidationEntry) ? [itemFrom(list, "expectedValue")] : list;
|
|
58099
58145
|
const lone = loneNotThisValue(list);
|
|
58100
|
-
if (lone) session.bodyByStrictness(
|
|
58101
|
-
else session.body(
|
|
58146
|
+
if (lone) session.bodyByStrictness(path11, { strict: { unordered }, lenient: lone });
|
|
58147
|
+
else session.body(path11, { unordered });
|
|
58102
58148
|
}
|
|
58103
58149
|
),
|
|
58104
58150
|
expectResponseBodyToHaveUnorderedArrayNotThisItem: guarded(
|
|
58105
58151
|
session,
|
|
58106
58152
|
"expectResponseBodyToHaveUnorderedArrayNotThisItem",
|
|
58107
58153
|
(jsonPathToArray, validationList) => {
|
|
58108
|
-
const
|
|
58154
|
+
const path11 = pathOf2(jsonPathToArray, "jsonPathToArray");
|
|
58109
58155
|
const list = toList(validationList);
|
|
58110
58156
|
const unorderedNot = list.every(isValidationEntry) ? [itemFrom(list, "compareValue")] : list;
|
|
58111
|
-
session.body(
|
|
58157
|
+
session.body(path11, { unorderedNot });
|
|
58112
58158
|
}
|
|
58113
58159
|
),
|
|
58114
58160
|
ignoreResponseBodyProperty: guarded(
|
|
@@ -58268,6 +58314,7 @@ function uuidv72(now = Date.now()) {
|
|
|
58268
58314
|
}
|
|
58269
58315
|
var isThenable = (value) => value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
58270
58316
|
function toVarValue2(value) {
|
|
58317
|
+
if (value === void 0) return null;
|
|
58271
58318
|
if (value === null || ["string", "number", "boolean"].includes(typeof value)) {
|
|
58272
58319
|
return value;
|
|
58273
58320
|
}
|
|
@@ -58500,6 +58547,10 @@ async function projectOf(collectionPath) {
|
|
|
58500
58547
|
const { global } = await readProject(root);
|
|
58501
58548
|
return { root, global };
|
|
58502
58549
|
}
|
|
58550
|
+
async function fileRootsOf(file2, collectionPath) {
|
|
58551
|
+
const { global } = await projectOf(collectionPath);
|
|
58552
|
+
return { project: projectRootOf(file2) ?? path8.dirname(file2), global: global?.root ?? null };
|
|
58553
|
+
}
|
|
58503
58554
|
function checkWith(name, set2, given) {
|
|
58504
58555
|
const params = set2.params ?? {};
|
|
58505
58556
|
const unknown2 = Object.keys(given).filter((key) => !(key in params));
|
|
@@ -58566,14 +58617,34 @@ async function referenceProblems(collection, collectionPath) {
|
|
|
58566
58617
|
for (const list of STEP_LISTS) {
|
|
58567
58618
|
const steps = collection[list];
|
|
58568
58619
|
if (!steps) continue;
|
|
58620
|
+
const stage = list === "steps" ? {} : { stage: list };
|
|
58569
58621
|
for (const planned of await planSteps({ ...collection, steps }, collectionPath)) {
|
|
58570
|
-
if (planned.kind
|
|
58571
|
-
|
|
58572
|
-
|
|
58622
|
+
if (planned.kind === "broken") {
|
|
58623
|
+
problems.push({ step: planned.index, ...stage, message: planned.error.message });
|
|
58624
|
+
continue;
|
|
58625
|
+
}
|
|
58626
|
+
for (const message of await missingFiles(planned, collectionPath)) {
|
|
58627
|
+
problems.push({ step: planned.index, ...stage, message });
|
|
58628
|
+
}
|
|
58573
58629
|
}
|
|
58574
58630
|
}
|
|
58575
58631
|
return problems;
|
|
58576
58632
|
}
|
|
58633
|
+
async function missingFiles(planned, collectionPath) {
|
|
58634
|
+
const named = bodyFiles(planned.step.body).filter(({ written }) => !written.includes("{{"));
|
|
58635
|
+
if (named.length === 0) return [];
|
|
58636
|
+
const roots = await fileRootsOf(planned.set?.path ?? collectionPath, collectionPath);
|
|
58637
|
+
const messages = [];
|
|
58638
|
+
for (const { what, written } of named) {
|
|
58639
|
+
try {
|
|
58640
|
+
await findBodyFile(roots, written, what);
|
|
58641
|
+
} catch (cause) {
|
|
58642
|
+
if (!(cause instanceof BodyFileError)) throw cause;
|
|
58643
|
+
messages.push(planned.set ? `use: ${planned.set.name} \u2014 ${cause.message}` : cause.message);
|
|
58644
|
+
}
|
|
58645
|
+
}
|
|
58646
|
+
return messages;
|
|
58647
|
+
}
|
|
58577
58648
|
|
|
58578
58649
|
// ../../packages/core/src/run/runRequest.ts
|
|
58579
58650
|
var itemText = (value) => value === null || ["string", "number", "boolean"].includes(typeof value) ? value : JSON.stringify(value) ?? String(value);
|
|
@@ -58706,25 +58777,38 @@ async function runRequest(input2) {
|
|
|
58706
58777
|
...withLogs()
|
|
58707
58778
|
});
|
|
58708
58779
|
let spec;
|
|
58709
|
-
let
|
|
58780
|
+
let run;
|
|
58710
58781
|
let params;
|
|
58711
58782
|
try {
|
|
58712
|
-
|
|
58713
|
-
|
|
58714
|
-
|
|
58715
|
-
scope = each ? new OverlayScope(own2, /* @__PURE__ */ new Map([["item", itemText(each.value)]]), "forEach") : own2;
|
|
58783
|
+
run = provided ?? (context ? await buildScope(context) : new VariableScope());
|
|
58784
|
+
if (!set2)
|
|
58785
|
+
params = input2.params ?? (input2.collection?.params ? resolveParams(input2.collection.params, {}, run) : void 0);
|
|
58716
58786
|
} catch (cause) {
|
|
58717
58787
|
return failed(interpolateError(cause));
|
|
58718
58788
|
}
|
|
58719
|
-
const
|
|
58789
|
+
const scopeOf = (known) => {
|
|
58790
|
+
const own2 = known ? new ParamsScope(run, known) : run;
|
|
58791
|
+
return each ? new OverlayScope(own2, /* @__PURE__ */ new Map([["item", itemText(each.value)]]), "forEach") : own2;
|
|
58792
|
+
};
|
|
58793
|
+
let scope = scopeOf(params);
|
|
58794
|
+
const opens = set2 ? layers.findIndex((layer) => layer.script === "set") : 0;
|
|
58795
|
+
const shared = (adopt, index) => ({
|
|
58720
58796
|
assert: assert3,
|
|
58721
|
-
...params ? { params: adopt(params) } : {},
|
|
58797
|
+
...params && index >= opens ? { params: adopt(params) } : {},
|
|
58722
58798
|
...each ? { item: adopt(each.value) } : {},
|
|
58723
58799
|
...endpoint ? { endpoint: adopt(endpointValues(endpoint, step, scope)) } : {}
|
|
58724
58800
|
});
|
|
58725
58801
|
const filenameOf = (layer, kind) => layer.label === "" ? kind : `${layer.label} ${kind}`;
|
|
58726
58802
|
let edited = null;
|
|
58727
|
-
for (const layer of layers) {
|
|
58803
|
+
for (const [index, layer] of layers.entries()) {
|
|
58804
|
+
if (set2 && index === opens) {
|
|
58805
|
+
try {
|
|
58806
|
+
params = set2.params();
|
|
58807
|
+
} catch (cause) {
|
|
58808
|
+
return failed({ phase: "use", message: cause.message });
|
|
58809
|
+
}
|
|
58810
|
+
scope = scopeOf(params);
|
|
58811
|
+
}
|
|
58728
58812
|
const before = layer.before;
|
|
58729
58813
|
const script = layer.script;
|
|
58730
58814
|
if (before?.script) {
|
|
@@ -58737,7 +58821,7 @@ async function runRequest(input2) {
|
|
|
58737
58821
|
...checks ? { checks } : {},
|
|
58738
58822
|
globals: (adopt) => {
|
|
58739
58823
|
view = requestView(shown, adopt);
|
|
58740
|
-
return { ...shared(adopt), gta: preRequestGta(scope, control), req: view };
|
|
58824
|
+
return { ...shared(adopt, index), gta: preRequestGta(scope, control), req: view };
|
|
58741
58825
|
}
|
|
58742
58826
|
});
|
|
58743
58827
|
if (error62) return failed({ ...error62, script });
|
|
@@ -58767,7 +58851,11 @@ async function runRequest(input2) {
|
|
|
58767
58851
|
edited ?? toSentRequest(step, collection),
|
|
58768
58852
|
step.body,
|
|
58769
58853
|
scope,
|
|
58770
|
-
|
|
58854
|
+
await fileRoots(
|
|
58855
|
+
step,
|
|
58856
|
+
set2?.path ?? context?.collectionPath ?? itemPath,
|
|
58857
|
+
context?.collectionPath ?? itemPath
|
|
58858
|
+
)
|
|
58771
58859
|
);
|
|
58772
58860
|
spec = prepared.request;
|
|
58773
58861
|
payload = prepared.payload;
|
|
@@ -58803,18 +58891,18 @@ async function runRequest(input2) {
|
|
|
58803
58891
|
const session = new CheckSession({ response, scope });
|
|
58804
58892
|
let testsError = null;
|
|
58805
58893
|
try {
|
|
58806
|
-
for (const layer of layers) {
|
|
58894
|
+
for (const [index, layer] of layers.entries()) {
|
|
58807
58895
|
const code = layer.tests;
|
|
58808
58896
|
if (!code || testsError) continue;
|
|
58809
58897
|
const pending = [];
|
|
58810
|
-
const
|
|
58898
|
+
const run2 = () => runScript(code, {
|
|
58811
58899
|
phase: "tests",
|
|
58812
58900
|
filename: filenameOf(layer, "tests"),
|
|
58813
58901
|
logs,
|
|
58814
58902
|
...checks ? { checks } : {},
|
|
58815
58903
|
pending: () => pending,
|
|
58816
58904
|
globals: (adopt) => ({
|
|
58817
|
-
...shared(adopt),
|
|
58905
|
+
...shared(adopt, index),
|
|
58818
58906
|
gta: testsGta({
|
|
58819
58907
|
session,
|
|
58820
58908
|
scope,
|
|
@@ -58826,7 +58914,7 @@ async function runRequest(input2) {
|
|
|
58826
58914
|
res: responseView(response, adopt)
|
|
58827
58915
|
})
|
|
58828
58916
|
});
|
|
58829
|
-
const scriptError = layer.defaults ? await session.asDefaults(
|
|
58917
|
+
const scriptError = layer.defaults ? await session.asDefaults(run2) : await run2();
|
|
58830
58918
|
if (scriptError) testsError = { ...scriptError, script: layer.script };
|
|
58831
58919
|
}
|
|
58832
58920
|
} catch (cause) {
|
|
@@ -58877,8 +58965,9 @@ function changedRequest(shown, view, body) {
|
|
|
58877
58965
|
}
|
|
58878
58966
|
return next;
|
|
58879
58967
|
}
|
|
58880
|
-
function
|
|
58881
|
-
|
|
58968
|
+
async function fileRoots(step, file2, collection) {
|
|
58969
|
+
if (!file2 || bodyFiles(step.body).length === 0) return null;
|
|
58970
|
+
return fileRootsOf(file2, collection ?? file2);
|
|
58882
58971
|
}
|
|
58883
58972
|
function interpolateError(cause) {
|
|
58884
58973
|
return {
|
|
@@ -58908,7 +58997,7 @@ function toSentRequestSafely(step, collection) {
|
|
|
58908
58997
|
}
|
|
58909
58998
|
|
|
58910
58999
|
// ../../packages/core/src/run/runCollection.ts
|
|
58911
|
-
import
|
|
59000
|
+
import path9 from "node:path";
|
|
58912
59001
|
async function runCollection(options) {
|
|
58913
59002
|
const { collection, collectionPath = null, context, signal, onResult, bail = false } = options;
|
|
58914
59003
|
const stage = options.stage ?? "steps";
|
|
@@ -58936,8 +59025,20 @@ async function runCollection(options) {
|
|
|
58936
59025
|
const own2 = collection.params ? selfAsSet(collection, collectionPath) : void 0;
|
|
58937
59026
|
const plan = await planSteps(running, collectionPath);
|
|
58938
59027
|
const results = [];
|
|
58939
|
-
let params =
|
|
59028
|
+
let params = null;
|
|
58940
59029
|
let unstarted = null;
|
|
59030
|
+
const paramsOf = (using) => () => {
|
|
59031
|
+
if (unstarted) throw new Error(unstarted.message);
|
|
59032
|
+
if (!params) {
|
|
59033
|
+
try {
|
|
59034
|
+
params = resolveParams(using.doc.params, using.with, scope);
|
|
59035
|
+
} catch (cause) {
|
|
59036
|
+
unstarted = { phase: "use", message: `use: ${using.name} \u2014 ${cause.message}` };
|
|
59037
|
+
throw new Error(unstarted.message);
|
|
59038
|
+
}
|
|
59039
|
+
}
|
|
59040
|
+
return params;
|
|
59041
|
+
};
|
|
58941
59042
|
let rest = null;
|
|
58942
59043
|
let attempted = 0;
|
|
58943
59044
|
const emit = (index, result) => {
|
|
@@ -58969,12 +59070,13 @@ async function runCollection(options) {
|
|
|
58969
59070
|
const using = set2?.planned ?? own2;
|
|
58970
59071
|
const starting = set2 ? set2.child === 0 : planned.index === 0;
|
|
58971
59072
|
if (starting) {
|
|
58972
|
-
|
|
58973
|
-
|
|
58974
|
-
|
|
58975
|
-
|
|
58976
|
-
|
|
58977
|
-
|
|
59073
|
+
params = null;
|
|
59074
|
+
unstarted = null;
|
|
59075
|
+
if (!set2) {
|
|
59076
|
+
try {
|
|
59077
|
+
paramsOf(using)();
|
|
59078
|
+
} catch {
|
|
59079
|
+
}
|
|
58978
59080
|
}
|
|
58979
59081
|
}
|
|
58980
59082
|
}
|
|
@@ -59030,12 +59132,12 @@ async function runCollection(options) {
|
|
|
59030
59132
|
...set2.planned.useName ? { useName: set2.planned.useName } : {},
|
|
59031
59133
|
path: set2.planned.path,
|
|
59032
59134
|
doc: set2.planned.doc,
|
|
59033
|
-
params,
|
|
59135
|
+
params: paramsOf(set2.planned),
|
|
59034
59136
|
child: set2.child,
|
|
59035
59137
|
of: set2.of,
|
|
59036
59138
|
useTests: set2.planned.useTests
|
|
59037
59139
|
}
|
|
59038
|
-
} : own2 ? { params } : {},
|
|
59140
|
+
} : own2 ? { params: params ?? {} } : {},
|
|
59039
59141
|
...signal ? { signal } : {}
|
|
59040
59142
|
});
|
|
59041
59143
|
emit(planned.index, result);
|
|
@@ -59086,7 +59188,7 @@ var useOf = (set2) => ({
|
|
|
59086
59188
|
});
|
|
59087
59189
|
function selfAsSet(collection, collectionPath) {
|
|
59088
59190
|
return {
|
|
59089
|
-
name: collectionPath ?
|
|
59191
|
+
name: collectionPath ? path9.basename(collectionPath, ".yml") : collection.id ?? "set",
|
|
59090
59192
|
path: collectionPath ?? "",
|
|
59091
59193
|
// Its own before, tests, headers and settings already apply as the collection's.
|
|
59092
59194
|
doc: { params: collection.params, steps: collection.steps },
|
|
@@ -59395,7 +59497,7 @@ async function runJob(job) {
|
|
|
59395
59497
|
collectionPath: loaded.path,
|
|
59396
59498
|
context: { ...context, flags: job.flags, dataRow: null },
|
|
59397
59499
|
rows: data ? data.rows.map((row, i) => ({
|
|
59398
|
-
source: `${
|
|
59500
|
+
source: `${path10.basename(data.path)} row ${i + 1}`,
|
|
59399
59501
|
vars: row.values,
|
|
59400
59502
|
label: row.label
|
|
59401
59503
|
})) : null,
|