@testsmith/api-spector 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2076,7 +2076,7 @@ if (canUseDOM)
|
|
|
2076
2076
|
passiveBrowserEventsSupported = false;
|
|
2077
2077
|
}
|
|
2078
2078
|
var root = null, startText = null, fallbackText = null;
|
|
2079
|
-
function getData
|
|
2079
|
+
function getData() {
|
|
2080
2080
|
if (fallbackText) return fallbackText;
|
|
2081
2081
|
var start, startValue = startText, startLength = startValue.length, end, endValue = "value" in root ? root.value : root.textContent, endLength = endValue.length;
|
|
2082
2082
|
for (start = 0; start < startLength && startValue[start] === endValue[start]; start++) ;
|
|
@@ -2331,7 +2331,7 @@ function getNativeBeforeInputChars(domEventName, nativeEvent) {
|
|
|
2331
2331
|
}
|
|
2332
2332
|
function getFallbackBeforeInputChars(domEventName, nativeEvent) {
|
|
2333
2333
|
if (isComposing)
|
|
2334
|
-
return "compositionend" === domEventName || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent) ? (domEventName = getData
|
|
2334
|
+
return "compositionend" === domEventName || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent) ? (domEventName = getData(), fallbackText = startText = root = null, isComposing = false, domEventName) : null;
|
|
2335
2335
|
switch (domEventName) {
|
|
2336
2336
|
case "paste":
|
|
2337
2337
|
return null;
|
|
@@ -10063,7 +10063,7 @@ function dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativ
|
|
|
10063
10063
|
}
|
|
10064
10064
|
else
|
|
10065
10065
|
isComposing ? isFallbackCompositionEnd(domEventName, nativeEvent) && (eventType = "onCompositionEnd") : "keydown" === domEventName && 229 === nativeEvent.keyCode && (eventType = "onCompositionStart");
|
|
10066
|
-
eventType && (useFallbackCompositionData && "ko" !== nativeEvent.locale && (isComposing || "onCompositionStart" !== eventType ? "onCompositionEnd" === eventType && isComposing && (fallbackData = getData
|
|
10066
|
+
eventType && (useFallbackCompositionData && "ko" !== nativeEvent.locale && (isComposing || "onCompositionStart" !== eventType ? "onCompositionEnd" === eventType && isComposing && (fallbackData = getData()) : (root = nativeEventTarget, startText = "value" in root ? root.value : root.textContent, isComposing = true)), handleEventFunc = accumulateTwoPhaseListeners(targetInst, eventType), 0 < handleEventFunc.length && (eventType = new SyntheticCompositionEvent(
|
|
10067
10067
|
eventType,
|
|
10068
10068
|
domEventName,
|
|
10069
10069
|
null,
|
|
@@ -13395,6 +13395,7 @@ function makeTab(requestId, collectionId) {
|
|
|
13395
13395
|
lastResponse: null,
|
|
13396
13396
|
lastScriptResult: null,
|
|
13397
13397
|
lastSentRequest: null,
|
|
13398
|
+
lastHookResults: null,
|
|
13398
13399
|
isSending: false,
|
|
13399
13400
|
requestTab: "params",
|
|
13400
13401
|
scriptTab: "pre"
|
|
@@ -13509,6 +13510,10 @@ const useStore = create()(
|
|
|
13509
13510
|
if (sentRequest !== void 0) tab.lastSentRequest = sentRequest ?? null;
|
|
13510
13511
|
}
|
|
13511
13512
|
}),
|
|
13513
|
+
setTabHookResults: (tabId, results) => set2((s) => {
|
|
13514
|
+
const tab = s.tabs.find((t2) => t2.id === tabId);
|
|
13515
|
+
if (tab) tab.lastHookResults = results;
|
|
13516
|
+
}),
|
|
13512
13517
|
setTabSending: (tabId, sending) => set2((s) => {
|
|
13513
13518
|
const tab = s.tabs.find((t2) => t2.id === tabId);
|
|
13514
13519
|
if (tab) tab.isSending = sending;
|
|
@@ -35916,7 +35921,7 @@ function CollectionNode({
|
|
|
35916
35921
|
{ type: "item", label: "Collapse all", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(CollapseAllIcon, {}), onClick: collapseAll },
|
|
35917
35922
|
{ type: "separator" },
|
|
35918
35923
|
{ type: "item", label: "Collection data", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TableIcon, {}), onClick: onSelectCollection },
|
|
35919
|
-
{ type: "item", label: "Settings
|
|
35924
|
+
{ type: "item", label: "Settings", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(GearIcon, {}), onClick: () => setShowSettings(true) },
|
|
35920
35925
|
{ type: "item", label: "Rename", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(PencilIcon, {}), onClick: () => setRenaming(true) },
|
|
35921
35926
|
{ type: "item", label: "Duplicate", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, {}), onClick: onDuplicateCollection },
|
|
35922
35927
|
{ type: "separator" },
|
|
@@ -36029,7 +36034,7 @@ function FolderRow({
|
|
|
36029
36034
|
{ type: "item", label: "Add request", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {}), onClick: onAddRequest },
|
|
36030
36035
|
{ type: "item", label: "Add sub-folder", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(FolderIcon, {}), onClick: onAddFolder },
|
|
36031
36036
|
{ type: "separator" },
|
|
36032
|
-
{ type: "item", label: "
|
|
36037
|
+
{ type: "item", label: "Settings", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(KeyIcon, {}), onClick: () => setShowSettings(true) },
|
|
36033
36038
|
{ type: "item", label: "Add tag", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TagIcon, {}), onClick: () => setAddingTag(true) },
|
|
36034
36039
|
{ type: "item", label: "Rename", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(PencilIcon, {}), onClick: () => setRenaming(true) },
|
|
36035
36040
|
{ type: "item", label: "Duplicate", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, {}), onClick: onDuplicate },
|
|
@@ -36307,6 +36312,115 @@ function GearIcon() {
|
|
|
36307
36312
|
/* @__PURE__ */ jsxRuntimeExports.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" })
|
|
36308
36313
|
] });
|
|
36309
36314
|
}
|
|
36315
|
+
function findFolderById(root2, id2) {
|
|
36316
|
+
if (root2.id === id2) return root2;
|
|
36317
|
+
for (const sub of root2.folders) {
|
|
36318
|
+
const found = findFolderById(sub, id2);
|
|
36319
|
+
if (found) return found;
|
|
36320
|
+
}
|
|
36321
|
+
return null;
|
|
36322
|
+
}
|
|
36323
|
+
function makeHook(req, collectionVars, hookType, scopeId, scopeAncestors, mainRequestId) {
|
|
36324
|
+
return { request: req, collectionVars, isHook: true, hookType, scopeId, scopeAncestors, mainRequestId };
|
|
36325
|
+
}
|
|
36326
|
+
function buildFolderPlan(folder, requests, collectionVars, filterTags, scopeId, ancestorIds, wrappers) {
|
|
36327
|
+
const result = [];
|
|
36328
|
+
const folderReqs = folder.requestIds.map((id2) => requests[id2]).filter(Boolean);
|
|
36329
|
+
const beforeAllHooks = folderReqs.filter((r) => r.hookType === "beforeAll");
|
|
36330
|
+
const beforeHooks = folderReqs.filter((r) => r.hookType === "before");
|
|
36331
|
+
const afterHooks = folderReqs.filter((r) => r.hookType === "after");
|
|
36332
|
+
const afterAllHooks = folderReqs.filter((r) => r.hookType === "afterAll");
|
|
36333
|
+
const regularReqs = folderReqs.filter((r) => !r.hookType);
|
|
36334
|
+
const myWrapper = { scopeId, ancestors: ancestorIds, before: beforeHooks, after: afterHooks };
|
|
36335
|
+
const allWrappers = [...wrappers, myWrapper];
|
|
36336
|
+
for (const req of beforeAllHooks) {
|
|
36337
|
+
result.push(makeHook(req, collectionVars, "beforeAll", scopeId, ancestorIds));
|
|
36338
|
+
}
|
|
36339
|
+
for (const req of regularReqs) {
|
|
36340
|
+
const tags2 = req.meta?.tags ?? [];
|
|
36341
|
+
if (filterTags.length > 0 && !filterTags.some((t2) => tags2.includes(t2))) continue;
|
|
36342
|
+
for (const w of allWrappers) {
|
|
36343
|
+
for (const hookReq of w.before) {
|
|
36344
|
+
result.push(makeHook(hookReq, collectionVars, "before", w.scopeId, w.ancestors, req.id));
|
|
36345
|
+
}
|
|
36346
|
+
}
|
|
36347
|
+
result.push({ request: req, collectionVars, scopeId, scopeAncestors: ancestorIds });
|
|
36348
|
+
for (const w of [...allWrappers].reverse()) {
|
|
36349
|
+
for (const hookReq of w.after) {
|
|
36350
|
+
result.push(makeHook(hookReq, collectionVars, "after", w.scopeId, w.ancestors, req.id));
|
|
36351
|
+
}
|
|
36352
|
+
}
|
|
36353
|
+
}
|
|
36354
|
+
for (const sub of folder.folders) {
|
|
36355
|
+
const folderTags = sub.tags ?? [];
|
|
36356
|
+
const effectiveFilter = filterTags.length === 0 ? filterTags : folderTags.some((t2) => filterTags.includes(t2)) ? [] : filterTags;
|
|
36357
|
+
result.push(...buildFolderPlan(
|
|
36358
|
+
sub,
|
|
36359
|
+
requests,
|
|
36360
|
+
collectionVars,
|
|
36361
|
+
effectiveFilter,
|
|
36362
|
+
sub.id,
|
|
36363
|
+
[...ancestorIds, scopeId],
|
|
36364
|
+
allWrappers
|
|
36365
|
+
));
|
|
36366
|
+
}
|
|
36367
|
+
for (const req of afterAllHooks) {
|
|
36368
|
+
result.push(makeHook(req, collectionVars, "afterAll", scopeId, ancestorIds));
|
|
36369
|
+
}
|
|
36370
|
+
return result;
|
|
36371
|
+
}
|
|
36372
|
+
function collectAllTags(folder, requests) {
|
|
36373
|
+
const tags2 = /* @__PURE__ */ new Set();
|
|
36374
|
+
function walk(f) {
|
|
36375
|
+
(f.tags ?? []).forEach((t2) => tags2.add(t2));
|
|
36376
|
+
for (const reqId of f.requestIds) {
|
|
36377
|
+
(requests[reqId]?.meta?.tags ?? []).forEach((t2) => tags2.add(t2));
|
|
36378
|
+
}
|
|
36379
|
+
f.folders.forEach(walk);
|
|
36380
|
+
}
|
|
36381
|
+
walk(folder);
|
|
36382
|
+
return Array.from(tags2).sort();
|
|
36383
|
+
}
|
|
36384
|
+
function folderPathTo(root2, requestId) {
|
|
36385
|
+
if (root2.requestIds.includes(requestId)) return [root2];
|
|
36386
|
+
for (const sub of root2.folders) {
|
|
36387
|
+
const path = folderPathTo(sub, requestId);
|
|
36388
|
+
if (path.length > 0) return [root2, ...path];
|
|
36389
|
+
}
|
|
36390
|
+
return [];
|
|
36391
|
+
}
|
|
36392
|
+
function getHooksForRequest(requestId, collection) {
|
|
36393
|
+
const path = folderPathTo(collection.rootFolder, requestId);
|
|
36394
|
+
const before = [];
|
|
36395
|
+
const afterReversed = [];
|
|
36396
|
+
for (const folder of path) {
|
|
36397
|
+
const reqs = folder.requestIds.map((id2) => collection.requests[id2]).filter(Boolean);
|
|
36398
|
+
const bAll = reqs.filter((r) => r.hookType === "beforeAll");
|
|
36399
|
+
const bEach = reqs.filter((r) => r.hookType === "before");
|
|
36400
|
+
const aEach = reqs.filter((r) => r.hookType === "after");
|
|
36401
|
+
const aAll = reqs.filter((r) => r.hookType === "afterAll");
|
|
36402
|
+
before.push(...bAll, ...bEach);
|
|
36403
|
+
afterReversed.push(...aEach, ...aAll);
|
|
36404
|
+
}
|
|
36405
|
+
return { before, after: afterReversed.reverse() };
|
|
36406
|
+
}
|
|
36407
|
+
function buildRunPlan(collection, folderId, filterTags) {
|
|
36408
|
+
const collectionVars = collection.collectionVariables ?? {};
|
|
36409
|
+
if (folderId) {
|
|
36410
|
+
const folder = findFolderById(collection.rootFolder, folderId);
|
|
36411
|
+
if (!folder) return [];
|
|
36412
|
+
return buildFolderPlan(folder, collection.requests, collectionVars, filterTags, folder.id, [], []);
|
|
36413
|
+
}
|
|
36414
|
+
return buildFolderPlan(
|
|
36415
|
+
collection.rootFolder,
|
|
36416
|
+
collection.requests,
|
|
36417
|
+
collectionVars,
|
|
36418
|
+
filterTags,
|
|
36419
|
+
collection.rootFolder.id,
|
|
36420
|
+
[],
|
|
36421
|
+
[]
|
|
36422
|
+
);
|
|
36423
|
+
}
|
|
36310
36424
|
function ParamsTab({ request, onChange }) {
|
|
36311
36425
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
36312
36426
|
KVTable,
|
|
@@ -44781,8 +44895,8 @@ var scope = {};
|
|
|
44781
44895
|
var util = {};
|
|
44782
44896
|
Object.defineProperty(util, "__esModule", { value: true });
|
|
44783
44897
|
util.checkStrictMode = util.getErrorPath = util.Type = util.useFunc = util.setEvaluated = util.evaluatedPropsToName = util.mergeEvaluated = util.eachItem = util.unescapeJsonPointer = util.escapeJsonPointer = util.escapeFragment = util.unescapeFragment = util.schemaRefOrVal = util.schemaHasRulesButRef = util.schemaHasRules = util.checkUnknownRules = util.alwaysValidSchema = util.toHash = void 0;
|
|
44784
|
-
const codegen_1$
|
|
44785
|
-
const code_1$
|
|
44898
|
+
const codegen_1$q = codegen;
|
|
44899
|
+
const code_1$9 = code$1;
|
|
44786
44900
|
function toHash(arr) {
|
|
44787
44901
|
const hash = {};
|
|
44788
44902
|
for (const item of arr)
|
|
@@ -44835,9 +44949,9 @@ function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword2, $data) {
|
|
|
44835
44949
|
if (typeof schema == "number" || typeof schema == "boolean")
|
|
44836
44950
|
return schema;
|
|
44837
44951
|
if (typeof schema == "string")
|
|
44838
|
-
return (0, codegen_1$
|
|
44952
|
+
return (0, codegen_1$q._)`${schema}`;
|
|
44839
44953
|
}
|
|
44840
|
-
return (0, codegen_1$
|
|
44954
|
+
return (0, codegen_1$q._)`${topSchemaRef}${schemaPath}${(0, codegen_1$q.getProperty)(keyword2)}`;
|
|
44841
44955
|
}
|
|
44842
44956
|
util.schemaRefOrVal = schemaRefOrVal;
|
|
44843
44957
|
function unescapeFragment(str) {
|
|
@@ -44869,20 +44983,20 @@ function eachItem(xs, f) {
|
|
|
44869
44983
|
util.eachItem = eachItem;
|
|
44870
44984
|
function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName }) {
|
|
44871
44985
|
return (gen, from, to, toName) => {
|
|
44872
|
-
const res = to === void 0 ? from : to instanceof codegen_1$
|
|
44873
|
-
return toName === codegen_1$
|
|
44986
|
+
const res = to === void 0 ? from : to instanceof codegen_1$q.Name ? (from instanceof codegen_1$q.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1$q.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to);
|
|
44987
|
+
return toName === codegen_1$q.Name && !(res instanceof codegen_1$q.Name) ? resultToName(gen, res) : res;
|
|
44874
44988
|
};
|
|
44875
44989
|
}
|
|
44876
44990
|
util.mergeEvaluated = {
|
|
44877
44991
|
props: makeMergeEvaluated({
|
|
44878
|
-
mergeNames: (gen, from, to) => gen.if((0, codegen_1$
|
|
44879
|
-
gen.if((0, codegen_1$
|
|
44992
|
+
mergeNames: (gen, from, to) => gen.if((0, codegen_1$q._)`${to} !== true && ${from} !== undefined`, () => {
|
|
44993
|
+
gen.if((0, codegen_1$q._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1$q._)`${to} || {}`).code((0, codegen_1$q._)`Object.assign(${to}, ${from})`));
|
|
44880
44994
|
}),
|
|
44881
|
-
mergeToName: (gen, from, to) => gen.if((0, codegen_1$
|
|
44995
|
+
mergeToName: (gen, from, to) => gen.if((0, codegen_1$q._)`${to} !== true`, () => {
|
|
44882
44996
|
if (from === true) {
|
|
44883
44997
|
gen.assign(to, true);
|
|
44884
44998
|
} else {
|
|
44885
|
-
gen.assign(to, (0, codegen_1$
|
|
44999
|
+
gen.assign(to, (0, codegen_1$q._)`${to} || {}`);
|
|
44886
45000
|
setEvaluated(gen, to, from);
|
|
44887
45001
|
}
|
|
44888
45002
|
}),
|
|
@@ -44890,8 +45004,8 @@ util.mergeEvaluated = {
|
|
|
44890
45004
|
resultToName: evaluatedPropsToName
|
|
44891
45005
|
}),
|
|
44892
45006
|
items: makeMergeEvaluated({
|
|
44893
|
-
mergeNames: (gen, from, to) => gen.if((0, codegen_1$
|
|
44894
|
-
mergeToName: (gen, from, to) => gen.if((0, codegen_1$
|
|
45007
|
+
mergeNames: (gen, from, to) => gen.if((0, codegen_1$q._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1$q._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
|
|
45008
|
+
mergeToName: (gen, from, to) => gen.if((0, codegen_1$q._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1$q._)`${to} > ${from} ? ${to} : ${from}`)),
|
|
44895
45009
|
mergeValues: (from, to) => from === true ? true : Math.max(from, to),
|
|
44896
45010
|
resultToName: (gen, items2) => gen.var("items", items2)
|
|
44897
45011
|
})
|
|
@@ -44899,21 +45013,21 @@ util.mergeEvaluated = {
|
|
|
44899
45013
|
function evaluatedPropsToName(gen, ps) {
|
|
44900
45014
|
if (ps === true)
|
|
44901
45015
|
return gen.var("props", true);
|
|
44902
|
-
const props = gen.var("props", (0, codegen_1$
|
|
45016
|
+
const props = gen.var("props", (0, codegen_1$q._)`{}`);
|
|
44903
45017
|
if (ps !== void 0)
|
|
44904
45018
|
setEvaluated(gen, props, ps);
|
|
44905
45019
|
return props;
|
|
44906
45020
|
}
|
|
44907
45021
|
util.evaluatedPropsToName = evaluatedPropsToName;
|
|
44908
45022
|
function setEvaluated(gen, props, ps) {
|
|
44909
|
-
Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$
|
|
45023
|
+
Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$q._)`${props}${(0, codegen_1$q.getProperty)(p)}`, true));
|
|
44910
45024
|
}
|
|
44911
45025
|
util.setEvaluated = setEvaluated;
|
|
44912
45026
|
const snippets = {};
|
|
44913
45027
|
function useFunc(gen, f) {
|
|
44914
45028
|
return gen.scopeValue("func", {
|
|
44915
45029
|
ref: f,
|
|
44916
|
-
code: snippets[f.code] || (snippets[f.code] = new code_1$
|
|
45030
|
+
code: snippets[f.code] || (snippets[f.code] = new code_1$9._Code(f.code))
|
|
44917
45031
|
});
|
|
44918
45032
|
}
|
|
44919
45033
|
util.useFunc = useFunc;
|
|
@@ -44923,11 +45037,11 @@ var Type;
|
|
|
44923
45037
|
Type2[Type2["Str"] = 1] = "Str";
|
|
44924
45038
|
})(Type || (util.Type = Type = {}));
|
|
44925
45039
|
function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
|
|
44926
|
-
if (dataProp instanceof codegen_1$
|
|
45040
|
+
if (dataProp instanceof codegen_1$q.Name) {
|
|
44927
45041
|
const isNumber = dataPropType === Type.Num;
|
|
44928
|
-
return jsPropertySyntax ? isNumber ? (0, codegen_1$
|
|
45042
|
+
return jsPropertySyntax ? isNumber ? (0, codegen_1$q._)`"[" + ${dataProp} + "]"` : (0, codegen_1$q._)`"['" + ${dataProp} + "']"` : isNumber ? (0, codegen_1$q._)`"/" + ${dataProp}` : (0, codegen_1$q._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
|
|
44929
45043
|
}
|
|
44930
|
-
return jsPropertySyntax ? (0, codegen_1$
|
|
45044
|
+
return jsPropertySyntax ? (0, codegen_1$q.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
|
|
44931
45045
|
}
|
|
44932
45046
|
util.getErrorPath = getErrorPath;
|
|
44933
45047
|
function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
|
|
@@ -44941,35 +45055,35 @@ function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
|
|
|
44941
45055
|
util.checkStrictMode = checkStrictMode;
|
|
44942
45056
|
var names$1 = {};
|
|
44943
45057
|
Object.defineProperty(names$1, "__esModule", { value: true });
|
|
44944
|
-
const codegen_1$
|
|
45058
|
+
const codegen_1$p = codegen;
|
|
44945
45059
|
const names = {
|
|
44946
45060
|
// validation function arguments
|
|
44947
|
-
data: new codegen_1$
|
|
45061
|
+
data: new codegen_1$p.Name("data"),
|
|
44948
45062
|
// data passed to validation function
|
|
44949
45063
|
// args passed from referencing schema
|
|
44950
|
-
valCxt: new codegen_1$
|
|
45064
|
+
valCxt: new codegen_1$p.Name("valCxt"),
|
|
44951
45065
|
// validation/data context - should not be used directly, it is destructured to the names below
|
|
44952
|
-
instancePath: new codegen_1$
|
|
44953
|
-
parentData: new codegen_1$
|
|
44954
|
-
parentDataProperty: new codegen_1$
|
|
44955
|
-
rootData: new codegen_1$
|
|
45066
|
+
instancePath: new codegen_1$p.Name("instancePath"),
|
|
45067
|
+
parentData: new codegen_1$p.Name("parentData"),
|
|
45068
|
+
parentDataProperty: new codegen_1$p.Name("parentDataProperty"),
|
|
45069
|
+
rootData: new codegen_1$p.Name("rootData"),
|
|
44956
45070
|
// root data - same as the data passed to the first/top validation function
|
|
44957
|
-
dynamicAnchors: new codegen_1$
|
|
45071
|
+
dynamicAnchors: new codegen_1$p.Name("dynamicAnchors"),
|
|
44958
45072
|
// used to support recursiveRef and dynamicRef
|
|
44959
45073
|
// function scoped variables
|
|
44960
|
-
vErrors: new codegen_1$
|
|
45074
|
+
vErrors: new codegen_1$p.Name("vErrors"),
|
|
44961
45075
|
// null or array of validation errors
|
|
44962
|
-
errors: new codegen_1$
|
|
45076
|
+
errors: new codegen_1$p.Name("errors"),
|
|
44963
45077
|
// counter of validation errors
|
|
44964
|
-
this: new codegen_1$
|
|
45078
|
+
this: new codegen_1$p.Name("this"),
|
|
44965
45079
|
// "globals"
|
|
44966
|
-
self: new codegen_1$
|
|
44967
|
-
scope: new codegen_1$
|
|
45080
|
+
self: new codegen_1$p.Name("self"),
|
|
45081
|
+
scope: new codegen_1$p.Name("scope"),
|
|
44968
45082
|
// JTD serialize/parse name for JSON string and position
|
|
44969
|
-
json: new codegen_1$
|
|
44970
|
-
jsonPos: new codegen_1$
|
|
44971
|
-
jsonLen: new codegen_1$
|
|
44972
|
-
jsonPart: new codegen_1$
|
|
45083
|
+
json: new codegen_1$p.Name("json"),
|
|
45084
|
+
jsonPos: new codegen_1$p.Name("jsonPos"),
|
|
45085
|
+
jsonLen: new codegen_1$p.Name("jsonLen"),
|
|
45086
|
+
jsonPart: new codegen_1$p.Name("jsonPart")
|
|
44973
45087
|
};
|
|
44974
45088
|
names$1.default = names;
|
|
44975
45089
|
(function(exports$1) {
|
|
@@ -45089,49 +45203,55 @@ names$1.default = names;
|
|
|
45089
45203
|
keyValues.push([E.propertyName, propertyName2]);
|
|
45090
45204
|
}
|
|
45091
45205
|
})(errors);
|
|
45092
|
-
|
|
45093
|
-
|
|
45094
|
-
|
|
45095
|
-
|
|
45096
|
-
|
|
45097
|
-
|
|
45098
|
-
|
|
45099
|
-
|
|
45100
|
-
|
|
45101
|
-
const
|
|
45102
|
-
|
|
45103
|
-
|
|
45104
|
-
|
|
45105
|
-
gen
|
|
45106
|
-
|
|
45107
|
-
|
|
45108
|
-
|
|
45206
|
+
var hasRequiredBoolSchema;
|
|
45207
|
+
function requireBoolSchema() {
|
|
45208
|
+
if (hasRequiredBoolSchema) return boolSchema;
|
|
45209
|
+
hasRequiredBoolSchema = 1;
|
|
45210
|
+
Object.defineProperty(boolSchema, "__esModule", { value: true });
|
|
45211
|
+
boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
|
|
45212
|
+
const errors_12 = errors;
|
|
45213
|
+
const codegen_12 = codegen;
|
|
45214
|
+
const names_12 = names$1;
|
|
45215
|
+
const boolError = {
|
|
45216
|
+
message: "boolean schema is false"
|
|
45217
|
+
};
|
|
45218
|
+
function topBoolOrEmptySchema(it) {
|
|
45219
|
+
const { gen, schema, validateName } = it;
|
|
45220
|
+
if (schema === false) {
|
|
45221
|
+
falseSchemaError(it, false);
|
|
45222
|
+
} else if (typeof schema == "object" && schema.$async === true) {
|
|
45223
|
+
gen.return(names_12.default.data);
|
|
45224
|
+
} else {
|
|
45225
|
+
gen.assign((0, codegen_12._)`${validateName}.errors`, null);
|
|
45226
|
+
gen.return(true);
|
|
45227
|
+
}
|
|
45109
45228
|
}
|
|
45110
|
-
|
|
45111
|
-
|
|
45112
|
-
|
|
45113
|
-
|
|
45114
|
-
|
|
45115
|
-
|
|
45116
|
-
|
|
45117
|
-
|
|
45118
|
-
|
|
45229
|
+
boolSchema.topBoolOrEmptySchema = topBoolOrEmptySchema;
|
|
45230
|
+
function boolOrEmptySchema(it, valid) {
|
|
45231
|
+
const { gen, schema } = it;
|
|
45232
|
+
if (schema === false) {
|
|
45233
|
+
gen.var(valid, false);
|
|
45234
|
+
falseSchemaError(it);
|
|
45235
|
+
} else {
|
|
45236
|
+
gen.var(valid, true);
|
|
45237
|
+
}
|
|
45238
|
+
}
|
|
45239
|
+
boolSchema.boolOrEmptySchema = boolOrEmptySchema;
|
|
45240
|
+
function falseSchemaError(it, overrideAllErrors) {
|
|
45241
|
+
const { gen, data } = it;
|
|
45242
|
+
const cxt = {
|
|
45243
|
+
gen,
|
|
45244
|
+
keyword: "false schema",
|
|
45245
|
+
data,
|
|
45246
|
+
schema: false,
|
|
45247
|
+
schemaCode: false,
|
|
45248
|
+
schemaValue: false,
|
|
45249
|
+
params: {},
|
|
45250
|
+
it
|
|
45251
|
+
};
|
|
45252
|
+
(0, errors_12.reportError)(cxt, boolError, void 0, overrideAllErrors);
|
|
45119
45253
|
}
|
|
45120
|
-
|
|
45121
|
-
boolSchema.boolOrEmptySchema = boolOrEmptySchema;
|
|
45122
|
-
function falseSchemaError(it, overrideAllErrors) {
|
|
45123
|
-
const { gen, data } = it;
|
|
45124
|
-
const cxt = {
|
|
45125
|
-
gen,
|
|
45126
|
-
keyword: "false schema",
|
|
45127
|
-
data,
|
|
45128
|
-
schema: false,
|
|
45129
|
-
schemaCode: false,
|
|
45130
|
-
schemaValue: false,
|
|
45131
|
-
params: {},
|
|
45132
|
-
it
|
|
45133
|
-
};
|
|
45134
|
-
(0, errors_1$3.reportError)(cxt, boolError, void 0, overrideAllErrors);
|
|
45254
|
+
return boolSchema;
|
|
45135
45255
|
}
|
|
45136
45256
|
var dataType = {};
|
|
45137
45257
|
var rules = {};
|
|
@@ -45179,10 +45299,10 @@ applicability.shouldUseRule = shouldUseRule;
|
|
|
45179
45299
|
Object.defineProperty(dataType, "__esModule", { value: true });
|
|
45180
45300
|
dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
|
|
45181
45301
|
const rules_1 = rules;
|
|
45182
|
-
const applicability_1
|
|
45183
|
-
const errors_1
|
|
45184
|
-
const codegen_1$
|
|
45185
|
-
const util_1$
|
|
45302
|
+
const applicability_1 = applicability;
|
|
45303
|
+
const errors_1 = errors;
|
|
45304
|
+
const codegen_1$o = codegen;
|
|
45305
|
+
const util_1$o = util;
|
|
45186
45306
|
var DataType;
|
|
45187
45307
|
(function(DataType2) {
|
|
45188
45308
|
DataType2[DataType2["Correct"] = 0] = "Correct";
|
|
@@ -45214,7 +45334,7 @@ dataType.getJSONTypes = getJSONTypes;
|
|
|
45214
45334
|
function coerceAndCheckDataType(it, types2) {
|
|
45215
45335
|
const { gen, data, opts } = it;
|
|
45216
45336
|
const coerceTo = coerceToTypes(types2, opts.coerceTypes);
|
|
45217
|
-
const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1
|
|
45337
|
+
const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types2[0]));
|
|
45218
45338
|
if (checkTypes) {
|
|
45219
45339
|
const wrongType = checkDataTypes(types2, data, opts.strictNumbers, DataType.Wrong);
|
|
45220
45340
|
gen.if(wrongType, () => {
|
|
@@ -45233,12 +45353,12 @@ function coerceToTypes(types2, coerceTypes) {
|
|
|
45233
45353
|
}
|
|
45234
45354
|
function coerceData(it, types2, coerceTo) {
|
|
45235
45355
|
const { gen, data, opts } = it;
|
|
45236
|
-
const dataType2 = gen.let("dataType", (0, codegen_1$
|
|
45237
|
-
const coerced = gen.let("coerced", (0, codegen_1$
|
|
45356
|
+
const dataType2 = gen.let("dataType", (0, codegen_1$o._)`typeof ${data}`);
|
|
45357
|
+
const coerced = gen.let("coerced", (0, codegen_1$o._)`undefined`);
|
|
45238
45358
|
if (opts.coerceTypes === "array") {
|
|
45239
|
-
gen.if((0, codegen_1$
|
|
45359
|
+
gen.if((0, codegen_1$o._)`${dataType2} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1$o._)`${data}[0]`).assign(dataType2, (0, codegen_1$o._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
|
|
45240
45360
|
}
|
|
45241
|
-
gen.if((0, codegen_1$
|
|
45361
|
+
gen.if((0, codegen_1$o._)`${coerced} !== undefined`);
|
|
45242
45362
|
for (const t2 of coerceTo) {
|
|
45243
45363
|
if (COERCIBLE.has(t2) || t2 === "array" && opts.coerceTypes === "array") {
|
|
45244
45364
|
coerceSpecificType(t2);
|
|
@@ -45247,63 +45367,63 @@ function coerceData(it, types2, coerceTo) {
|
|
|
45247
45367
|
gen.else();
|
|
45248
45368
|
reportTypeError(it);
|
|
45249
45369
|
gen.endIf();
|
|
45250
|
-
gen.if((0, codegen_1$
|
|
45370
|
+
gen.if((0, codegen_1$o._)`${coerced} !== undefined`, () => {
|
|
45251
45371
|
gen.assign(data, coerced);
|
|
45252
45372
|
assignParentData(it, coerced);
|
|
45253
45373
|
});
|
|
45254
45374
|
function coerceSpecificType(t2) {
|
|
45255
45375
|
switch (t2) {
|
|
45256
45376
|
case "string":
|
|
45257
|
-
gen.elseIf((0, codegen_1$
|
|
45377
|
+
gen.elseIf((0, codegen_1$o._)`${dataType2} == "number" || ${dataType2} == "boolean"`).assign(coerced, (0, codegen_1$o._)`"" + ${data}`).elseIf((0, codegen_1$o._)`${data} === null`).assign(coerced, (0, codegen_1$o._)`""`);
|
|
45258
45378
|
return;
|
|
45259
45379
|
case "number":
|
|
45260
|
-
gen.elseIf((0, codegen_1$
|
|
45261
|
-
|| (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$
|
|
45380
|
+
gen.elseIf((0, codegen_1$o._)`${dataType2} == "boolean" || ${data} === null
|
|
45381
|
+
|| (${dataType2} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1$o._)`+${data}`);
|
|
45262
45382
|
return;
|
|
45263
45383
|
case "integer":
|
|
45264
|
-
gen.elseIf((0, codegen_1$
|
|
45265
|
-
|| (${dataType2} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1$
|
|
45384
|
+
gen.elseIf((0, codegen_1$o._)`${dataType2} === "boolean" || ${data} === null
|
|
45385
|
+
|| (${dataType2} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1$o._)`+${data}`);
|
|
45266
45386
|
return;
|
|
45267
45387
|
case "boolean":
|
|
45268
|
-
gen.elseIf((0, codegen_1$
|
|
45388
|
+
gen.elseIf((0, codegen_1$o._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1$o._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
|
|
45269
45389
|
return;
|
|
45270
45390
|
case "null":
|
|
45271
|
-
gen.elseIf((0, codegen_1$
|
|
45391
|
+
gen.elseIf((0, codegen_1$o._)`${data} === "" || ${data} === 0 || ${data} === false`);
|
|
45272
45392
|
gen.assign(coerced, null);
|
|
45273
45393
|
return;
|
|
45274
45394
|
case "array":
|
|
45275
|
-
gen.elseIf((0, codegen_1$
|
|
45276
|
-
|| ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$
|
|
45395
|
+
gen.elseIf((0, codegen_1$o._)`${dataType2} === "string" || ${dataType2} === "number"
|
|
45396
|
+
|| ${dataType2} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1$o._)`[${data}]`);
|
|
45277
45397
|
}
|
|
45278
45398
|
}
|
|
45279
45399
|
}
|
|
45280
45400
|
function assignParentData({ gen, parentData, parentDataProperty }, expr) {
|
|
45281
|
-
gen.if((0, codegen_1$
|
|
45401
|
+
gen.if((0, codegen_1$o._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1$o._)`${parentData}[${parentDataProperty}]`, expr));
|
|
45282
45402
|
}
|
|
45283
45403
|
function checkDataType(dataType2, data, strictNums, correct = DataType.Correct) {
|
|
45284
|
-
const EQ = correct === DataType.Correct ? codegen_1$
|
|
45404
|
+
const EQ = correct === DataType.Correct ? codegen_1$o.operators.EQ : codegen_1$o.operators.NEQ;
|
|
45285
45405
|
let cond;
|
|
45286
45406
|
switch (dataType2) {
|
|
45287
45407
|
case "null":
|
|
45288
|
-
return (0, codegen_1$
|
|
45408
|
+
return (0, codegen_1$o._)`${data} ${EQ} null`;
|
|
45289
45409
|
case "array":
|
|
45290
|
-
cond = (0, codegen_1$
|
|
45410
|
+
cond = (0, codegen_1$o._)`Array.isArray(${data})`;
|
|
45291
45411
|
break;
|
|
45292
45412
|
case "object":
|
|
45293
|
-
cond = (0, codegen_1$
|
|
45413
|
+
cond = (0, codegen_1$o._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
|
|
45294
45414
|
break;
|
|
45295
45415
|
case "integer":
|
|
45296
|
-
cond = numCond((0, codegen_1$
|
|
45416
|
+
cond = numCond((0, codegen_1$o._)`!(${data} % 1) && !isNaN(${data})`);
|
|
45297
45417
|
break;
|
|
45298
45418
|
case "number":
|
|
45299
45419
|
cond = numCond();
|
|
45300
45420
|
break;
|
|
45301
45421
|
default:
|
|
45302
|
-
return (0, codegen_1$
|
|
45422
|
+
return (0, codegen_1$o._)`typeof ${data} ${EQ} ${dataType2}`;
|
|
45303
45423
|
}
|
|
45304
|
-
return correct === DataType.Correct ? cond : (0, codegen_1$
|
|
45305
|
-
function numCond(_cond = codegen_1$
|
|
45306
|
-
return (0, codegen_1$
|
|
45424
|
+
return correct === DataType.Correct ? cond : (0, codegen_1$o.not)(cond);
|
|
45425
|
+
function numCond(_cond = codegen_1$o.nil) {
|
|
45426
|
+
return (0, codegen_1$o.and)((0, codegen_1$o._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1$o._)`isFinite(${data})` : codegen_1$o.nil);
|
|
45307
45427
|
}
|
|
45308
45428
|
}
|
|
45309
45429
|
dataType.checkDataType = checkDataType;
|
|
@@ -45312,35 +45432,35 @@ function checkDataTypes(dataTypes, data, strictNums, correct) {
|
|
|
45312
45432
|
return checkDataType(dataTypes[0], data, strictNums, correct);
|
|
45313
45433
|
}
|
|
45314
45434
|
let cond;
|
|
45315
|
-
const types2 = (0, util_1$
|
|
45435
|
+
const types2 = (0, util_1$o.toHash)(dataTypes);
|
|
45316
45436
|
if (types2.array && types2.object) {
|
|
45317
|
-
const notObj = (0, codegen_1$
|
|
45318
|
-
cond = types2.null ? notObj : (0, codegen_1$
|
|
45437
|
+
const notObj = (0, codegen_1$o._)`typeof ${data} != "object"`;
|
|
45438
|
+
cond = types2.null ? notObj : (0, codegen_1$o._)`!${data} || ${notObj}`;
|
|
45319
45439
|
delete types2.null;
|
|
45320
45440
|
delete types2.array;
|
|
45321
45441
|
delete types2.object;
|
|
45322
45442
|
} else {
|
|
45323
|
-
cond = codegen_1$
|
|
45443
|
+
cond = codegen_1$o.nil;
|
|
45324
45444
|
}
|
|
45325
45445
|
if (types2.number)
|
|
45326
45446
|
delete types2.integer;
|
|
45327
45447
|
for (const t2 in types2)
|
|
45328
|
-
cond = (0, codegen_1$
|
|
45448
|
+
cond = (0, codegen_1$o.and)(cond, checkDataType(t2, data, strictNums, correct));
|
|
45329
45449
|
return cond;
|
|
45330
45450
|
}
|
|
45331
45451
|
dataType.checkDataTypes = checkDataTypes;
|
|
45332
45452
|
const typeError = {
|
|
45333
45453
|
message: ({ schema }) => `must be ${schema}`,
|
|
45334
|
-
params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$
|
|
45454
|
+
params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$o._)`{type: ${schema}}` : (0, codegen_1$o._)`{type: ${schemaValue}}`
|
|
45335
45455
|
};
|
|
45336
45456
|
function reportTypeError(it) {
|
|
45337
45457
|
const cxt = getTypeErrorContext(it);
|
|
45338
|
-
(0, errors_1
|
|
45458
|
+
(0, errors_1.reportError)(cxt, typeError);
|
|
45339
45459
|
}
|
|
45340
45460
|
dataType.reportTypeError = reportTypeError;
|
|
45341
45461
|
function getTypeErrorContext(it) {
|
|
45342
45462
|
const { gen, data, schema } = it;
|
|
45343
|
-
const schemaCode = (0, util_1$
|
|
45463
|
+
const schemaCode = (0, util_1$o.schemaRefOrVal)(it, schema, "type");
|
|
45344
45464
|
return {
|
|
45345
45465
|
gen,
|
|
45346
45466
|
keyword: "type",
|
|
@@ -45354,54 +45474,60 @@ function getTypeErrorContext(it) {
|
|
|
45354
45474
|
};
|
|
45355
45475
|
}
|
|
45356
45476
|
var defaults = {};
|
|
45357
|
-
|
|
45358
|
-
|
|
45359
|
-
|
|
45360
|
-
|
|
45361
|
-
|
|
45362
|
-
|
|
45363
|
-
|
|
45364
|
-
|
|
45365
|
-
|
|
45366
|
-
}
|
|
45367
|
-
|
|
45368
|
-
|
|
45369
|
-
|
|
45370
|
-
}
|
|
45371
|
-
|
|
45372
|
-
|
|
45373
|
-
|
|
45374
|
-
if (defaultValue === void 0)
|
|
45375
|
-
return;
|
|
45376
|
-
const childData = (0, codegen_1$r._)`${data}${(0, codegen_1$r.getProperty)(prop)}`;
|
|
45377
|
-
if (compositeRule) {
|
|
45378
|
-
(0, util_1$q.checkStrictMode)(it, `default is ignored for: ${childData}`);
|
|
45379
|
-
return;
|
|
45477
|
+
var hasRequiredDefaults;
|
|
45478
|
+
function requireDefaults() {
|
|
45479
|
+
if (hasRequiredDefaults) return defaults;
|
|
45480
|
+
hasRequiredDefaults = 1;
|
|
45481
|
+
Object.defineProperty(defaults, "__esModule", { value: true });
|
|
45482
|
+
defaults.assignDefaults = void 0;
|
|
45483
|
+
const codegen_12 = codegen;
|
|
45484
|
+
const util_12 = util;
|
|
45485
|
+
function assignDefaults(it, ty) {
|
|
45486
|
+
const { properties: properties2, items: items2 } = it.schema;
|
|
45487
|
+
if (ty === "object" && properties2) {
|
|
45488
|
+
for (const key in properties2) {
|
|
45489
|
+
assignDefault(it, key, properties2[key].default);
|
|
45490
|
+
}
|
|
45491
|
+
} else if (ty === "array" && Array.isArray(items2)) {
|
|
45492
|
+
items2.forEach((sch, i) => assignDefault(it, i, sch.default));
|
|
45493
|
+
}
|
|
45380
45494
|
}
|
|
45381
|
-
|
|
45382
|
-
|
|
45383
|
-
|
|
45495
|
+
defaults.assignDefaults = assignDefaults;
|
|
45496
|
+
function assignDefault(it, prop, defaultValue) {
|
|
45497
|
+
const { gen, compositeRule, data, opts } = it;
|
|
45498
|
+
if (defaultValue === void 0)
|
|
45499
|
+
return;
|
|
45500
|
+
const childData = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)(prop)}`;
|
|
45501
|
+
if (compositeRule) {
|
|
45502
|
+
(0, util_12.checkStrictMode)(it, `default is ignored for: ${childData}`);
|
|
45503
|
+
return;
|
|
45504
|
+
}
|
|
45505
|
+
let condition = (0, codegen_12._)`${childData} === undefined`;
|
|
45506
|
+
if (opts.useDefaults === "empty") {
|
|
45507
|
+
condition = (0, codegen_12._)`${condition} || ${childData} === null || ${childData} === ""`;
|
|
45508
|
+
}
|
|
45509
|
+
gen.if(condition, (0, codegen_12._)`${childData} = ${(0, codegen_12.stringify)(defaultValue)}`);
|
|
45384
45510
|
}
|
|
45385
|
-
|
|
45511
|
+
return defaults;
|
|
45386
45512
|
}
|
|
45387
45513
|
var keyword = {};
|
|
45388
45514
|
var code = {};
|
|
45389
45515
|
Object.defineProperty(code, "__esModule", { value: true });
|
|
45390
45516
|
code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
|
|
45391
|
-
const codegen_1$
|
|
45392
|
-
const util_1$
|
|
45393
|
-
const names_1$
|
|
45517
|
+
const codegen_1$n = codegen;
|
|
45518
|
+
const util_1$n = util;
|
|
45519
|
+
const names_1$3 = names$1;
|
|
45394
45520
|
const util_2$1 = util;
|
|
45395
45521
|
function checkReportMissingProp(cxt, prop) {
|
|
45396
45522
|
const { gen, data, it } = cxt;
|
|
45397
45523
|
gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
|
|
45398
|
-
cxt.setParams({ missingProperty: (0, codegen_1$
|
|
45524
|
+
cxt.setParams({ missingProperty: (0, codegen_1$n._)`${prop}` }, true);
|
|
45399
45525
|
cxt.error();
|
|
45400
45526
|
});
|
|
45401
45527
|
}
|
|
45402
45528
|
code.checkReportMissingProp = checkReportMissingProp;
|
|
45403
45529
|
function checkMissingProp({ gen, data, it: { opts } }, properties2, missing) {
|
|
45404
|
-
return (0, codegen_1$
|
|
45530
|
+
return (0, codegen_1$n.or)(...properties2.map((prop) => (0, codegen_1$n.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1$n._)`${missing} = ${prop}`)));
|
|
45405
45531
|
}
|
|
45406
45532
|
code.checkMissingProp = checkMissingProp;
|
|
45407
45533
|
function reportMissingProp(cxt, missing) {
|
|
@@ -45413,22 +45539,22 @@ function hasPropFunc(gen) {
|
|
|
45413
45539
|
return gen.scopeValue("func", {
|
|
45414
45540
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
45415
45541
|
ref: Object.prototype.hasOwnProperty,
|
|
45416
|
-
code: (0, codegen_1$
|
|
45542
|
+
code: (0, codegen_1$n._)`Object.prototype.hasOwnProperty`
|
|
45417
45543
|
});
|
|
45418
45544
|
}
|
|
45419
45545
|
code.hasPropFunc = hasPropFunc;
|
|
45420
45546
|
function isOwnProperty(gen, data, property) {
|
|
45421
|
-
return (0, codegen_1$
|
|
45547
|
+
return (0, codegen_1$n._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
|
|
45422
45548
|
}
|
|
45423
45549
|
code.isOwnProperty = isOwnProperty;
|
|
45424
45550
|
function propertyInData(gen, data, property, ownProperties) {
|
|
45425
|
-
const cond = (0, codegen_1$
|
|
45426
|
-
return ownProperties ? (0, codegen_1$
|
|
45551
|
+
const cond = (0, codegen_1$n._)`${data}${(0, codegen_1$n.getProperty)(property)} !== undefined`;
|
|
45552
|
+
return ownProperties ? (0, codegen_1$n._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
|
|
45427
45553
|
}
|
|
45428
45554
|
code.propertyInData = propertyInData;
|
|
45429
45555
|
function noPropertyInData(gen, data, property, ownProperties) {
|
|
45430
|
-
const cond = (0, codegen_1$
|
|
45431
|
-
return ownProperties ? (0, codegen_1$
|
|
45556
|
+
const cond = (0, codegen_1$n._)`${data}${(0, codegen_1$n.getProperty)(property)} === undefined`;
|
|
45557
|
+
return ownProperties ? (0, codegen_1$n.or)(cond, (0, codegen_1$n.not)(isOwnProperty(gen, data, property))) : cond;
|
|
45432
45558
|
}
|
|
45433
45559
|
code.noPropertyInData = noPropertyInData;
|
|
45434
45560
|
function allSchemaProperties(schemaMap) {
|
|
@@ -45436,24 +45562,24 @@ function allSchemaProperties(schemaMap) {
|
|
|
45436
45562
|
}
|
|
45437
45563
|
code.allSchemaProperties = allSchemaProperties;
|
|
45438
45564
|
function schemaProperties(it, schemaMap) {
|
|
45439
|
-
return allSchemaProperties(schemaMap).filter((p) => !(0, util_1$
|
|
45565
|
+
return allSchemaProperties(schemaMap).filter((p) => !(0, util_1$n.alwaysValidSchema)(it, schemaMap[p]));
|
|
45440
45566
|
}
|
|
45441
45567
|
code.schemaProperties = schemaProperties;
|
|
45442
45568
|
function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
|
|
45443
|
-
const dataAndSchema = passSchema ? (0, codegen_1$
|
|
45569
|
+
const dataAndSchema = passSchema ? (0, codegen_1$n._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
|
|
45444
45570
|
const valCxt = [
|
|
45445
|
-
[names_1$
|
|
45446
|
-
[names_1$
|
|
45447
|
-
[names_1$
|
|
45448
|
-
[names_1$
|
|
45571
|
+
[names_1$3.default.instancePath, (0, codegen_1$n.strConcat)(names_1$3.default.instancePath, errorPath)],
|
|
45572
|
+
[names_1$3.default.parentData, it.parentData],
|
|
45573
|
+
[names_1$3.default.parentDataProperty, it.parentDataProperty],
|
|
45574
|
+
[names_1$3.default.rootData, names_1$3.default.rootData]
|
|
45449
45575
|
];
|
|
45450
45576
|
if (it.opts.dynamicRef)
|
|
45451
|
-
valCxt.push([names_1$
|
|
45452
|
-
const args = (0, codegen_1$
|
|
45453
|
-
return context !== codegen_1$
|
|
45577
|
+
valCxt.push([names_1$3.default.dynamicAnchors, names_1$3.default.dynamicAnchors]);
|
|
45578
|
+
const args = (0, codegen_1$n._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
|
|
45579
|
+
return context !== codegen_1$n.nil ? (0, codegen_1$n._)`${func}.call(${context}, ${args})` : (0, codegen_1$n._)`${func}(${args})`;
|
|
45454
45580
|
}
|
|
45455
45581
|
code.callValidateCode = callValidateCode;
|
|
45456
|
-
const newRegExp = (0, codegen_1$
|
|
45582
|
+
const newRegExp = (0, codegen_1$n._)`new RegExp`;
|
|
45457
45583
|
function usePattern({ gen, it: { opts } }, pattern2) {
|
|
45458
45584
|
const u = opts.unicodeRegExp ? "u" : "";
|
|
45459
45585
|
const { regExp } = opts.code;
|
|
@@ -45461,7 +45587,7 @@ function usePattern({ gen, it: { opts } }, pattern2) {
|
|
|
45461
45587
|
return gen.scopeValue("pattern", {
|
|
45462
45588
|
key: rx.toString(),
|
|
45463
45589
|
ref: rx,
|
|
45464
|
-
code: (0, codegen_1$
|
|
45590
|
+
code: (0, codegen_1$n._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2$1.useFunc)(gen, regExp)}(${pattern2}, ${u})`
|
|
45465
45591
|
});
|
|
45466
45592
|
}
|
|
45467
45593
|
code.usePattern = usePattern;
|
|
@@ -45477,14 +45603,14 @@ function validateArray(cxt) {
|
|
|
45477
45603
|
validateItems(() => gen.break());
|
|
45478
45604
|
return valid;
|
|
45479
45605
|
function validateItems(notValid) {
|
|
45480
|
-
const len = gen.const("len", (0, codegen_1$
|
|
45606
|
+
const len = gen.const("len", (0, codegen_1$n._)`${data}.length`);
|
|
45481
45607
|
gen.forRange("i", 0, len, (i) => {
|
|
45482
45608
|
cxt.subschema({
|
|
45483
45609
|
keyword: keyword2,
|
|
45484
45610
|
dataProp: i,
|
|
45485
|
-
dataPropType: util_1$
|
|
45611
|
+
dataPropType: util_1$n.Type.Num
|
|
45486
45612
|
}, valid);
|
|
45487
|
-
gen.if((0, codegen_1$
|
|
45613
|
+
gen.if((0, codegen_1$n.not)(valid), notValid);
|
|
45488
45614
|
});
|
|
45489
45615
|
}
|
|
45490
45616
|
}
|
|
@@ -45493,7 +45619,7 @@ function validateUnion(cxt) {
|
|
|
45493
45619
|
const { gen, schema, keyword: keyword2, it } = cxt;
|
|
45494
45620
|
if (!Array.isArray(schema))
|
|
45495
45621
|
throw new Error("ajv implementation error");
|
|
45496
|
-
const alwaysValid = schema.some((sch) => (0, util_1$
|
|
45622
|
+
const alwaysValid = schema.some((sch) => (0, util_1$n.alwaysValidSchema)(it, sch));
|
|
45497
45623
|
if (alwaysValid && !it.opts.unevaluated)
|
|
45498
45624
|
return;
|
|
45499
45625
|
const valid = gen.let("valid", false);
|
|
@@ -45504,202 +45630,214 @@ function validateUnion(cxt) {
|
|
|
45504
45630
|
schemaProp: i,
|
|
45505
45631
|
compositeRule: true
|
|
45506
45632
|
}, schValid);
|
|
45507
|
-
gen.assign(valid, (0, codegen_1$
|
|
45633
|
+
gen.assign(valid, (0, codegen_1$n._)`${valid} || ${schValid}`);
|
|
45508
45634
|
const merged = cxt.mergeValidEvaluated(schCxt, schValid);
|
|
45509
45635
|
if (!merged)
|
|
45510
|
-
gen.if((0, codegen_1$
|
|
45636
|
+
gen.if((0, codegen_1$n.not)(valid));
|
|
45511
45637
|
}));
|
|
45512
45638
|
cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
|
|
45513
45639
|
}
|
|
45514
45640
|
code.validateUnion = validateUnion;
|
|
45515
|
-
|
|
45516
|
-
|
|
45517
|
-
|
|
45518
|
-
|
|
45519
|
-
|
|
45520
|
-
|
|
45521
|
-
|
|
45522
|
-
const
|
|
45523
|
-
const
|
|
45524
|
-
const
|
|
45525
|
-
|
|
45526
|
-
|
|
45527
|
-
|
|
45528
|
-
|
|
45529
|
-
|
|
45530
|
-
|
|
45531
|
-
|
|
45532
|
-
|
|
45533
|
-
|
|
45534
|
-
|
|
45535
|
-
|
|
45536
|
-
|
|
45537
|
-
|
|
45538
|
-
|
|
45539
|
-
|
|
45540
|
-
const { gen, keyword: keyword2, schema, parentSchema, $data, it } = cxt;
|
|
45541
|
-
checkAsyncKeyword(it, def2);
|
|
45542
|
-
const validate2 = !$data && def2.compile ? def2.compile.call(it.self, schema, parentSchema, it) : def2.validate;
|
|
45543
|
-
const validateRef = useKeyword(gen, keyword2, validate2);
|
|
45544
|
-
const valid = gen.let("valid");
|
|
45545
|
-
cxt.block$data(valid, validateKeyword);
|
|
45546
|
-
cxt.ok((_a2 = def2.valid) !== null && _a2 !== void 0 ? _a2 : valid);
|
|
45547
|
-
function validateKeyword() {
|
|
45548
|
-
if (def2.errors === false) {
|
|
45549
|
-
assignValid();
|
|
45550
|
-
if (def2.modifying)
|
|
45551
|
-
modifyData(cxt);
|
|
45552
|
-
reportErrs(() => cxt.error());
|
|
45553
|
-
} else {
|
|
45554
|
-
const ruleErrs = def2.async ? validateAsync() : validateSync();
|
|
45555
|
-
if (def2.modifying)
|
|
45556
|
-
modifyData(cxt);
|
|
45557
|
-
reportErrs(() => addErrs(cxt, ruleErrs));
|
|
45558
|
-
}
|
|
45559
|
-
}
|
|
45560
|
-
function validateAsync() {
|
|
45561
|
-
const ruleErrs = gen.let("ruleErrs", null);
|
|
45562
|
-
gen.try(() => assignValid((0, codegen_1$p._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1$p._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1$p._)`${e}.errors`), () => gen.throw(e)));
|
|
45563
|
-
return ruleErrs;
|
|
45564
|
-
}
|
|
45565
|
-
function validateSync() {
|
|
45566
|
-
const validateErrs = (0, codegen_1$p._)`${validateRef}.errors`;
|
|
45567
|
-
gen.assign(validateErrs, null);
|
|
45568
|
-
assignValid(codegen_1$p.nil);
|
|
45569
|
-
return validateErrs;
|
|
45570
|
-
}
|
|
45571
|
-
function assignValid(_await = def2.async ? (0, codegen_1$p._)`await ` : codegen_1$p.nil) {
|
|
45572
|
-
const passCxt = it.opts.passContext ? names_1$4.default.this : names_1$4.default.self;
|
|
45573
|
-
const passSchema = !("compile" in def2 && !$data || def2.schema === false);
|
|
45574
|
-
gen.assign(valid, (0, codegen_1$p._)`${_await}${(0, code_1$9.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def2.modifying);
|
|
45575
|
-
}
|
|
45576
|
-
function reportErrs(errors2) {
|
|
45577
|
-
var _a3;
|
|
45578
|
-
gen.if((0, codegen_1$p.not)((_a3 = def2.valid) !== null && _a3 !== void 0 ? _a3 : valid), errors2);
|
|
45579
|
-
}
|
|
45580
|
-
}
|
|
45581
|
-
keyword.funcKeywordCode = funcKeywordCode;
|
|
45582
|
-
function modifyData(cxt) {
|
|
45583
|
-
const { gen, data, it } = cxt;
|
|
45584
|
-
gen.if(it.parentData, () => gen.assign(data, (0, codegen_1$p._)`${it.parentData}[${it.parentDataProperty}]`));
|
|
45585
|
-
}
|
|
45586
|
-
function addErrs(cxt, errs) {
|
|
45587
|
-
const { gen } = cxt;
|
|
45588
|
-
gen.if((0, codegen_1$p._)`Array.isArray(${errs})`, () => {
|
|
45589
|
-
gen.assign(names_1$4.default.vErrors, (0, codegen_1$p._)`${names_1$4.default.vErrors} === null ? ${errs} : ${names_1$4.default.vErrors}.concat(${errs})`).assign(names_1$4.default.errors, (0, codegen_1$p._)`${names_1$4.default.vErrors}.length`);
|
|
45590
|
-
(0, errors_1$1.extendErrors)(cxt);
|
|
45591
|
-
}, () => cxt.error());
|
|
45592
|
-
}
|
|
45593
|
-
function checkAsyncKeyword({ schemaEnv }, def2) {
|
|
45594
|
-
if (def2.async && !schemaEnv.$async)
|
|
45595
|
-
throw new Error("async keyword in sync schema");
|
|
45596
|
-
}
|
|
45597
|
-
function useKeyword(gen, keyword2, result) {
|
|
45598
|
-
if (result === void 0)
|
|
45599
|
-
throw new Error(`keyword "${keyword2}" failed to compile`);
|
|
45600
|
-
return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1$p.stringify)(result) });
|
|
45601
|
-
}
|
|
45602
|
-
function validSchemaType(schema, schemaType, allowUndefined = false) {
|
|
45603
|
-
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined");
|
|
45604
|
-
}
|
|
45605
|
-
keyword.validSchemaType = validSchemaType;
|
|
45606
|
-
function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def2, keyword2) {
|
|
45607
|
-
if (Array.isArray(def2.keyword) ? !def2.keyword.includes(keyword2) : def2.keyword !== keyword2) {
|
|
45608
|
-
throw new Error("ajv implementation error");
|
|
45641
|
+
var hasRequiredKeyword;
|
|
45642
|
+
function requireKeyword() {
|
|
45643
|
+
if (hasRequiredKeyword) return keyword;
|
|
45644
|
+
hasRequiredKeyword = 1;
|
|
45645
|
+
Object.defineProperty(keyword, "__esModule", { value: true });
|
|
45646
|
+
keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
|
|
45647
|
+
const codegen_12 = codegen;
|
|
45648
|
+
const names_12 = names$1;
|
|
45649
|
+
const code_12 = code;
|
|
45650
|
+
const errors_12 = errors;
|
|
45651
|
+
function macroKeywordCode(cxt, def2) {
|
|
45652
|
+
const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
|
|
45653
|
+
const macroSchema = def2.macro.call(it.self, schema, parentSchema, it);
|
|
45654
|
+
const schemaRef = useKeyword(gen, keyword2, macroSchema);
|
|
45655
|
+
if (it.opts.validateSchema !== false)
|
|
45656
|
+
it.self.validateSchema(macroSchema, true);
|
|
45657
|
+
const valid = gen.name("valid");
|
|
45658
|
+
cxt.subschema({
|
|
45659
|
+
schema: macroSchema,
|
|
45660
|
+
schemaPath: codegen_12.nil,
|
|
45661
|
+
errSchemaPath: `${it.errSchemaPath}/${keyword2}`,
|
|
45662
|
+
topSchemaRef: schemaRef,
|
|
45663
|
+
compositeRule: true
|
|
45664
|
+
}, valid);
|
|
45665
|
+
cxt.pass(valid, () => cxt.error(true));
|
|
45609
45666
|
}
|
|
45610
|
-
|
|
45611
|
-
|
|
45612
|
-
|
|
45667
|
+
keyword.macroKeywordCode = macroKeywordCode;
|
|
45668
|
+
function funcKeywordCode(cxt, def2) {
|
|
45669
|
+
var _a2;
|
|
45670
|
+
const { gen, keyword: keyword2, schema, parentSchema, $data, it } = cxt;
|
|
45671
|
+
checkAsyncKeyword(it, def2);
|
|
45672
|
+
const validate2 = !$data && def2.compile ? def2.compile.call(it.self, schema, parentSchema, it) : def2.validate;
|
|
45673
|
+
const validateRef = useKeyword(gen, keyword2, validate2);
|
|
45674
|
+
const valid = gen.let("valid");
|
|
45675
|
+
cxt.block$data(valid, validateKeyword);
|
|
45676
|
+
cxt.ok((_a2 = def2.valid) !== null && _a2 !== void 0 ? _a2 : valid);
|
|
45677
|
+
function validateKeyword() {
|
|
45678
|
+
if (def2.errors === false) {
|
|
45679
|
+
assignValid();
|
|
45680
|
+
if (def2.modifying)
|
|
45681
|
+
modifyData(cxt);
|
|
45682
|
+
reportErrs(() => cxt.error());
|
|
45683
|
+
} else {
|
|
45684
|
+
const ruleErrs = def2.async ? validateAsync() : validateSync();
|
|
45685
|
+
if (def2.modifying)
|
|
45686
|
+
modifyData(cxt);
|
|
45687
|
+
reportErrs(() => addErrs(cxt, ruleErrs));
|
|
45688
|
+
}
|
|
45689
|
+
}
|
|
45690
|
+
function validateAsync() {
|
|
45691
|
+
const ruleErrs = gen.let("ruleErrs", null);
|
|
45692
|
+
gen.try(() => assignValid((0, codegen_12._)`await `), (e) => gen.assign(valid, false).if((0, codegen_12._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_12._)`${e}.errors`), () => gen.throw(e)));
|
|
45693
|
+
return ruleErrs;
|
|
45694
|
+
}
|
|
45695
|
+
function validateSync() {
|
|
45696
|
+
const validateErrs = (0, codegen_12._)`${validateRef}.errors`;
|
|
45697
|
+
gen.assign(validateErrs, null);
|
|
45698
|
+
assignValid(codegen_12.nil);
|
|
45699
|
+
return validateErrs;
|
|
45700
|
+
}
|
|
45701
|
+
function assignValid(_await = def2.async ? (0, codegen_12._)`await ` : codegen_12.nil) {
|
|
45702
|
+
const passCxt = it.opts.passContext ? names_12.default.this : names_12.default.self;
|
|
45703
|
+
const passSchema = !("compile" in def2 && !$data || def2.schema === false);
|
|
45704
|
+
gen.assign(valid, (0, codegen_12._)`${_await}${(0, code_12.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def2.modifying);
|
|
45705
|
+
}
|
|
45706
|
+
function reportErrs(errors2) {
|
|
45707
|
+
var _a3;
|
|
45708
|
+
gen.if((0, codegen_12.not)((_a3 = def2.valid) !== null && _a3 !== void 0 ? _a3 : valid), errors2);
|
|
45709
|
+
}
|
|
45613
45710
|
}
|
|
45614
|
-
|
|
45615
|
-
|
|
45616
|
-
|
|
45617
|
-
|
|
45618
|
-
|
|
45619
|
-
|
|
45620
|
-
|
|
45621
|
-
|
|
45711
|
+
keyword.funcKeywordCode = funcKeywordCode;
|
|
45712
|
+
function modifyData(cxt) {
|
|
45713
|
+
const { gen, data, it } = cxt;
|
|
45714
|
+
gen.if(it.parentData, () => gen.assign(data, (0, codegen_12._)`${it.parentData}[${it.parentDataProperty}]`));
|
|
45715
|
+
}
|
|
45716
|
+
function addErrs(cxt, errs) {
|
|
45717
|
+
const { gen } = cxt;
|
|
45718
|
+
gen.if((0, codegen_12._)`Array.isArray(${errs})`, () => {
|
|
45719
|
+
gen.assign(names_12.default.vErrors, (0, codegen_12._)`${names_12.default.vErrors} === null ? ${errs} : ${names_12.default.vErrors}.concat(${errs})`).assign(names_12.default.errors, (0, codegen_12._)`${names_12.default.vErrors}.length`);
|
|
45720
|
+
(0, errors_12.extendErrors)(cxt);
|
|
45721
|
+
}, () => cxt.error());
|
|
45722
|
+
}
|
|
45723
|
+
function checkAsyncKeyword({ schemaEnv }, def2) {
|
|
45724
|
+
if (def2.async && !schemaEnv.$async)
|
|
45725
|
+
throw new Error("async keyword in sync schema");
|
|
45726
|
+
}
|
|
45727
|
+
function useKeyword(gen, keyword2, result) {
|
|
45728
|
+
if (result === void 0)
|
|
45729
|
+
throw new Error(`keyword "${keyword2}" failed to compile`);
|
|
45730
|
+
return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_12.stringify)(result) });
|
|
45731
|
+
}
|
|
45732
|
+
function validSchemaType(schema, schemaType, allowUndefined = false) {
|
|
45733
|
+
return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema) : st === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st || allowUndefined && typeof schema == "undefined");
|
|
45734
|
+
}
|
|
45735
|
+
keyword.validSchemaType = validSchemaType;
|
|
45736
|
+
function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def2, keyword2) {
|
|
45737
|
+
if (Array.isArray(def2.keyword) ? !def2.keyword.includes(keyword2) : def2.keyword !== keyword2) {
|
|
45738
|
+
throw new Error("ajv implementation error");
|
|
45739
|
+
}
|
|
45740
|
+
const deps = def2.dependencies;
|
|
45741
|
+
if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {
|
|
45742
|
+
throw new Error(`parent schema must have dependencies of ${keyword2}: ${deps.join(",")}`);
|
|
45743
|
+
}
|
|
45744
|
+
if (def2.validateSchema) {
|
|
45745
|
+
const valid = def2.validateSchema(schema[keyword2]);
|
|
45746
|
+
if (!valid) {
|
|
45747
|
+
const msg = `keyword "${keyword2}" value is invalid at path "${errSchemaPath}": ` + self.errorsText(def2.validateSchema.errors);
|
|
45748
|
+
if (opts.validateSchema === "log")
|
|
45749
|
+
self.logger.error(msg);
|
|
45750
|
+
else
|
|
45751
|
+
throw new Error(msg);
|
|
45752
|
+
}
|
|
45622
45753
|
}
|
|
45623
45754
|
}
|
|
45755
|
+
keyword.validateKeywordUsage = validateKeywordUsage;
|
|
45756
|
+
return keyword;
|
|
45624
45757
|
}
|
|
45625
|
-
keyword.validateKeywordUsage = validateKeywordUsage;
|
|
45626
45758
|
var subschema = {};
|
|
45627
|
-
|
|
45628
|
-
|
|
45629
|
-
|
|
45630
|
-
|
|
45631
|
-
|
|
45632
|
-
|
|
45633
|
-
|
|
45634
|
-
|
|
45635
|
-
|
|
45636
|
-
|
|
45637
|
-
|
|
45638
|
-
schema: sch,
|
|
45639
|
-
schemaPath: (0, codegen_1$o._)`${it.schemaPath}${(0, codegen_1$o.getProperty)(keyword2)}`,
|
|
45640
|
-
errSchemaPath: `${it.errSchemaPath}/${keyword2}`
|
|
45641
|
-
} : {
|
|
45642
|
-
schema: sch[schemaProp],
|
|
45643
|
-
schemaPath: (0, codegen_1$o._)`${it.schemaPath}${(0, codegen_1$o.getProperty)(keyword2)}${(0, codegen_1$o.getProperty)(schemaProp)}`,
|
|
45644
|
-
errSchemaPath: `${it.errSchemaPath}/${keyword2}/${(0, util_1$o.escapeFragment)(schemaProp)}`
|
|
45645
|
-
};
|
|
45646
|
-
}
|
|
45647
|
-
if (schema !== void 0) {
|
|
45648
|
-
if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
|
|
45649
|
-
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
|
45759
|
+
var hasRequiredSubschema;
|
|
45760
|
+
function requireSubschema() {
|
|
45761
|
+
if (hasRequiredSubschema) return subschema;
|
|
45762
|
+
hasRequiredSubschema = 1;
|
|
45763
|
+
Object.defineProperty(subschema, "__esModule", { value: true });
|
|
45764
|
+
subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
|
|
45765
|
+
const codegen_12 = codegen;
|
|
45766
|
+
const util_12 = util;
|
|
45767
|
+
function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
45768
|
+
if (keyword2 !== void 0 && schema !== void 0) {
|
|
45769
|
+
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
45650
45770
|
}
|
|
45651
|
-
|
|
45652
|
-
schema
|
|
45653
|
-
|
|
45654
|
-
|
|
45655
|
-
|
|
45656
|
-
|
|
45657
|
-
|
|
45658
|
-
|
|
45659
|
-
}
|
|
45660
|
-
|
|
45661
|
-
|
|
45662
|
-
|
|
45663
|
-
|
|
45664
|
-
|
|
45665
|
-
|
|
45666
|
-
|
|
45667
|
-
|
|
45668
|
-
|
|
45669
|
-
|
|
45670
|
-
|
|
45671
|
-
|
|
45672
|
-
|
|
45673
|
-
|
|
45674
|
-
|
|
45675
|
-
|
|
45676
|
-
|
|
45677
|
-
|
|
45678
|
-
|
|
45679
|
-
|
|
45680
|
-
|
|
45681
|
-
|
|
45682
|
-
|
|
45683
|
-
|
|
45684
|
-
|
|
45685
|
-
|
|
45686
|
-
|
|
45687
|
-
|
|
45688
|
-
|
|
45689
|
-
|
|
45690
|
-
|
|
45691
|
-
|
|
45692
|
-
|
|
45693
|
-
|
|
45694
|
-
|
|
45695
|
-
|
|
45696
|
-
|
|
45697
|
-
|
|
45698
|
-
|
|
45699
|
-
|
|
45700
|
-
|
|
45701
|
-
|
|
45702
|
-
|
|
45771
|
+
if (keyword2 !== void 0) {
|
|
45772
|
+
const sch = it.schema[keyword2];
|
|
45773
|
+
return schemaProp === void 0 ? {
|
|
45774
|
+
schema: sch,
|
|
45775
|
+
schemaPath: (0, codegen_12._)`${it.schemaPath}${(0, codegen_12.getProperty)(keyword2)}`,
|
|
45776
|
+
errSchemaPath: `${it.errSchemaPath}/${keyword2}`
|
|
45777
|
+
} : {
|
|
45778
|
+
schema: sch[schemaProp],
|
|
45779
|
+
schemaPath: (0, codegen_12._)`${it.schemaPath}${(0, codegen_12.getProperty)(keyword2)}${(0, codegen_12.getProperty)(schemaProp)}`,
|
|
45780
|
+
errSchemaPath: `${it.errSchemaPath}/${keyword2}/${(0, util_12.escapeFragment)(schemaProp)}`
|
|
45781
|
+
};
|
|
45782
|
+
}
|
|
45783
|
+
if (schema !== void 0) {
|
|
45784
|
+
if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
|
|
45785
|
+
throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
|
|
45786
|
+
}
|
|
45787
|
+
return {
|
|
45788
|
+
schema,
|
|
45789
|
+
schemaPath,
|
|
45790
|
+
topSchemaRef,
|
|
45791
|
+
errSchemaPath
|
|
45792
|
+
};
|
|
45793
|
+
}
|
|
45794
|
+
throw new Error('either "keyword" or "schema" must be passed');
|
|
45795
|
+
}
|
|
45796
|
+
subschema.getSubschema = getSubschema;
|
|
45797
|
+
function extendSubschemaData(subschema2, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName: propertyName2 }) {
|
|
45798
|
+
if (data !== void 0 && dataProp !== void 0) {
|
|
45799
|
+
throw new Error('both "data" and "dataProp" passed, only one allowed');
|
|
45800
|
+
}
|
|
45801
|
+
const { gen } = it;
|
|
45802
|
+
if (dataProp !== void 0) {
|
|
45803
|
+
const { errorPath, dataPathArr, opts } = it;
|
|
45804
|
+
const nextData = gen.let("data", (0, codegen_12._)`${it.data}${(0, codegen_12.getProperty)(dataProp)}`, true);
|
|
45805
|
+
dataContextProps(nextData);
|
|
45806
|
+
subschema2.errorPath = (0, codegen_12.str)`${errorPath}${(0, util_12.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
|
|
45807
|
+
subschema2.parentDataProperty = (0, codegen_12._)`${dataProp}`;
|
|
45808
|
+
subschema2.dataPathArr = [...dataPathArr, subschema2.parentDataProperty];
|
|
45809
|
+
}
|
|
45810
|
+
if (data !== void 0) {
|
|
45811
|
+
const nextData = data instanceof codegen_12.Name ? data : gen.let("data", data, true);
|
|
45812
|
+
dataContextProps(nextData);
|
|
45813
|
+
if (propertyName2 !== void 0)
|
|
45814
|
+
subschema2.propertyName = propertyName2;
|
|
45815
|
+
}
|
|
45816
|
+
if (dataTypes)
|
|
45817
|
+
subschema2.dataTypes = dataTypes;
|
|
45818
|
+
function dataContextProps(_nextData) {
|
|
45819
|
+
subschema2.data = _nextData;
|
|
45820
|
+
subschema2.dataLevel = it.dataLevel + 1;
|
|
45821
|
+
subschema2.dataTypes = [];
|
|
45822
|
+
it.definedProperties = /* @__PURE__ */ new Set();
|
|
45823
|
+
subschema2.parentData = it.data;
|
|
45824
|
+
subschema2.dataNames = [...it.dataNames, _nextData];
|
|
45825
|
+
}
|
|
45826
|
+
}
|
|
45827
|
+
subschema.extendSubschemaData = extendSubschemaData;
|
|
45828
|
+
function extendSubschemaMode(subschema2, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
|
|
45829
|
+
if (compositeRule !== void 0)
|
|
45830
|
+
subschema2.compositeRule = compositeRule;
|
|
45831
|
+
if (createErrors !== void 0)
|
|
45832
|
+
subschema2.createErrors = createErrors;
|
|
45833
|
+
if (allErrors !== void 0)
|
|
45834
|
+
subschema2.allErrors = allErrors;
|
|
45835
|
+
subschema2.jtdDiscriminator = jtdDiscriminator;
|
|
45836
|
+
subschema2.jtdMetadata = jtdMetadata;
|
|
45837
|
+
}
|
|
45838
|
+
subschema.extendSubschemaMode = extendSubschemaMode;
|
|
45839
|
+
return subschema;
|
|
45840
|
+
}
|
|
45703
45841
|
var resolve$2 = {};
|
|
45704
45842
|
var fastDeepEqual = function equal(a, b) {
|
|
45705
45843
|
if (a === b) return true;
|
|
@@ -45814,7 +45952,7 @@ function escapeJsonPtr(str) {
|
|
|
45814
45952
|
var jsonSchemaTraverseExports = jsonSchemaTraverse.exports;
|
|
45815
45953
|
Object.defineProperty(resolve$2, "__esModule", { value: true });
|
|
45816
45954
|
resolve$2.getSchemaRefs = resolve$2.resolveUrl = resolve$2.normalizeId = resolve$2._getFullPath = resolve$2.getFullPath = resolve$2.inlineRef = void 0;
|
|
45817
|
-
const util_1$
|
|
45955
|
+
const util_1$m = util;
|
|
45818
45956
|
const equal$3 = fastDeepEqual;
|
|
45819
45957
|
const traverse = jsonSchemaTraverseExports;
|
|
45820
45958
|
const SIMPLE_INLINED = /* @__PURE__ */ new Set([
|
|
@@ -45873,7 +46011,7 @@ function countKeys(schema) {
|
|
|
45873
46011
|
if (SIMPLE_INLINED.has(key))
|
|
45874
46012
|
continue;
|
|
45875
46013
|
if (typeof schema[key] == "object") {
|
|
45876
|
-
(0, util_1$
|
|
46014
|
+
(0, util_1$m.eachItem)(schema[key], (sch) => count += countKeys(sch));
|
|
45877
46015
|
}
|
|
45878
46016
|
if (count === Infinity)
|
|
45879
46017
|
return Infinity;
|
|
@@ -45961,516 +46099,528 @@ function getSchemaRefs(schema, baseId) {
|
|
|
45961
46099
|
}
|
|
45962
46100
|
}
|
|
45963
46101
|
resolve$2.getSchemaRefs = getSchemaRefs;
|
|
45964
|
-
|
|
45965
|
-
|
|
45966
|
-
|
|
45967
|
-
|
|
45968
|
-
|
|
45969
|
-
|
|
45970
|
-
const
|
|
45971
|
-
const
|
|
45972
|
-
const
|
|
45973
|
-
const
|
|
45974
|
-
const
|
|
45975
|
-
const
|
|
45976
|
-
const
|
|
45977
|
-
const
|
|
45978
|
-
|
|
45979
|
-
|
|
45980
|
-
|
|
45981
|
-
|
|
45982
|
-
|
|
45983
|
-
|
|
46102
|
+
var hasRequiredValidate;
|
|
46103
|
+
function requireValidate() {
|
|
46104
|
+
if (hasRequiredValidate) return validate;
|
|
46105
|
+
hasRequiredValidate = 1;
|
|
46106
|
+
Object.defineProperty(validate, "__esModule", { value: true });
|
|
46107
|
+
validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
|
|
46108
|
+
const boolSchema_1 = requireBoolSchema();
|
|
46109
|
+
const dataType_12 = dataType;
|
|
46110
|
+
const applicability_12 = applicability;
|
|
46111
|
+
const dataType_2 = dataType;
|
|
46112
|
+
const defaults_1 = requireDefaults();
|
|
46113
|
+
const keyword_1 = requireKeyword();
|
|
46114
|
+
const subschema_1 = requireSubschema();
|
|
46115
|
+
const codegen_12 = codegen;
|
|
46116
|
+
const names_12 = names$1;
|
|
46117
|
+
const resolve_12 = resolve$2;
|
|
46118
|
+
const util_12 = util;
|
|
46119
|
+
const errors_12 = errors;
|
|
46120
|
+
function validateFunctionCode(it) {
|
|
46121
|
+
if (isSchemaObj(it)) {
|
|
46122
|
+
checkKeywords(it);
|
|
46123
|
+
if (schemaCxtHasRules(it)) {
|
|
46124
|
+
topSchemaObjCode(it);
|
|
46125
|
+
return;
|
|
46126
|
+
}
|
|
45984
46127
|
}
|
|
46128
|
+
validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
|
|
45985
46129
|
}
|
|
45986
|
-
|
|
45987
|
-
}
|
|
45988
|
-
|
|
45989
|
-
|
|
45990
|
-
|
|
45991
|
-
|
|
45992
|
-
|
|
45993
|
-
|
|
45994
|
-
|
|
46130
|
+
validate.validateFunctionCode = validateFunctionCode;
|
|
46131
|
+
function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) {
|
|
46132
|
+
if (opts.code.es5) {
|
|
46133
|
+
gen.func(validateName, (0, codegen_12._)`${names_12.default.data}, ${names_12.default.valCxt}`, schemaEnv.$async, () => {
|
|
46134
|
+
gen.code((0, codegen_12._)`"use strict"; ${funcSourceUrl(schema, opts)}`);
|
|
46135
|
+
destructureValCxtES5(gen, opts);
|
|
46136
|
+
gen.code(body);
|
|
46137
|
+
});
|
|
46138
|
+
} else {
|
|
46139
|
+
gen.func(validateName, (0, codegen_12._)`${names_12.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body));
|
|
46140
|
+
}
|
|
46141
|
+
}
|
|
46142
|
+
function destructureValCxt(opts) {
|
|
46143
|
+
return (0, codegen_12._)`{${names_12.default.instancePath}="", ${names_12.default.parentData}, ${names_12.default.parentDataProperty}, ${names_12.default.rootData}=${names_12.default.data}${opts.dynamicRef ? (0, codegen_12._)`, ${names_12.default.dynamicAnchors}={}` : codegen_12.nil}}={}`;
|
|
46144
|
+
}
|
|
46145
|
+
function destructureValCxtES5(gen, opts) {
|
|
46146
|
+
gen.if(names_12.default.valCxt, () => {
|
|
46147
|
+
gen.var(names_12.default.instancePath, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.instancePath}`);
|
|
46148
|
+
gen.var(names_12.default.parentData, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.parentData}`);
|
|
46149
|
+
gen.var(names_12.default.parentDataProperty, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.parentDataProperty}`);
|
|
46150
|
+
gen.var(names_12.default.rootData, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.rootData}`);
|
|
46151
|
+
if (opts.dynamicRef)
|
|
46152
|
+
gen.var(names_12.default.dynamicAnchors, (0, codegen_12._)`${names_12.default.valCxt}.${names_12.default.dynamicAnchors}`);
|
|
46153
|
+
}, () => {
|
|
46154
|
+
gen.var(names_12.default.instancePath, (0, codegen_12._)`""`);
|
|
46155
|
+
gen.var(names_12.default.parentData, (0, codegen_12._)`undefined`);
|
|
46156
|
+
gen.var(names_12.default.parentDataProperty, (0, codegen_12._)`undefined`);
|
|
46157
|
+
gen.var(names_12.default.rootData, names_12.default.data);
|
|
46158
|
+
if (opts.dynamicRef)
|
|
46159
|
+
gen.var(names_12.default.dynamicAnchors, (0, codegen_12._)`{}`);
|
|
45995
46160
|
});
|
|
45996
|
-
}
|
|
45997
|
-
|
|
45998
|
-
|
|
45999
|
-
|
|
46000
|
-
|
|
46001
|
-
|
|
46002
|
-
|
|
46003
|
-
|
|
46004
|
-
|
|
46005
|
-
|
|
46006
|
-
|
|
46007
|
-
|
|
46008
|
-
|
|
46009
|
-
|
|
46010
|
-
|
|
46011
|
-
}
|
|
46012
|
-
|
|
46013
|
-
gen
|
|
46014
|
-
gen.
|
|
46015
|
-
gen.
|
|
46016
|
-
if (
|
|
46017
|
-
|
|
46018
|
-
|
|
46019
|
-
|
|
46020
|
-
|
|
46021
|
-
|
|
46022
|
-
|
|
46161
|
+
}
|
|
46162
|
+
function topSchemaObjCode(it) {
|
|
46163
|
+
const { schema, opts, gen } = it;
|
|
46164
|
+
validateFunction(it, () => {
|
|
46165
|
+
if (opts.$comment && schema.$comment)
|
|
46166
|
+
commentKeyword(it);
|
|
46167
|
+
checkNoDefault(it);
|
|
46168
|
+
gen.let(names_12.default.vErrors, null);
|
|
46169
|
+
gen.let(names_12.default.errors, 0);
|
|
46170
|
+
if (opts.unevaluated)
|
|
46171
|
+
resetEvaluated(it);
|
|
46172
|
+
typeAndKeywords(it);
|
|
46173
|
+
returnResults(it);
|
|
46174
|
+
});
|
|
46175
|
+
return;
|
|
46176
|
+
}
|
|
46177
|
+
function resetEvaluated(it) {
|
|
46178
|
+
const { gen, validateName } = it;
|
|
46179
|
+
it.evaluated = gen.const("evaluated", (0, codegen_12._)`${validateName}.evaluated`);
|
|
46180
|
+
gen.if((0, codegen_12._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_12._)`${it.evaluated}.props`, (0, codegen_12._)`undefined`));
|
|
46181
|
+
gen.if((0, codegen_12._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_12._)`${it.evaluated}.items`, (0, codegen_12._)`undefined`));
|
|
46182
|
+
}
|
|
46183
|
+
function funcSourceUrl(schema, opts) {
|
|
46184
|
+
const schId = typeof schema == "object" && schema[opts.schemaId];
|
|
46185
|
+
return schId && (opts.code.source || opts.code.process) ? (0, codegen_12._)`/*# sourceURL=${schId} */` : codegen_12.nil;
|
|
46186
|
+
}
|
|
46187
|
+
function subschemaCode(it, valid) {
|
|
46188
|
+
if (isSchemaObj(it)) {
|
|
46189
|
+
checkKeywords(it);
|
|
46190
|
+
if (schemaCxtHasRules(it)) {
|
|
46191
|
+
subSchemaObjCode(it, valid);
|
|
46192
|
+
return;
|
|
46193
|
+
}
|
|
46194
|
+
}
|
|
46195
|
+
(0, boolSchema_1.boolOrEmptySchema)(it, valid);
|
|
46196
|
+
}
|
|
46197
|
+
function schemaCxtHasRules({ schema, self }) {
|
|
46198
|
+
if (typeof schema == "boolean")
|
|
46199
|
+
return !schema;
|
|
46200
|
+
for (const key in schema)
|
|
46201
|
+
if (self.RULES.all[key])
|
|
46202
|
+
return true;
|
|
46203
|
+
return false;
|
|
46204
|
+
}
|
|
46205
|
+
function isSchemaObj(it) {
|
|
46206
|
+
return typeof it.schema != "boolean";
|
|
46207
|
+
}
|
|
46208
|
+
function subSchemaObjCode(it, valid) {
|
|
46209
|
+
const { schema, gen, opts } = it;
|
|
46023
46210
|
if (opts.$comment && schema.$comment)
|
|
46024
46211
|
commentKeyword(it);
|
|
46025
|
-
|
|
46026
|
-
|
|
46027
|
-
gen.
|
|
46028
|
-
|
|
46029
|
-
|
|
46030
|
-
|
|
46031
|
-
|
|
46032
|
-
|
|
46033
|
-
|
|
46034
|
-
}
|
|
46035
|
-
function
|
|
46036
|
-
|
|
46037
|
-
|
|
46038
|
-
|
|
46039
|
-
|
|
46040
|
-
|
|
46041
|
-
|
|
46042
|
-
|
|
46043
|
-
|
|
46044
|
-
|
|
46045
|
-
|
|
46046
|
-
if (isSchemaObj(it)) {
|
|
46047
|
-
checkKeywords(it);
|
|
46048
|
-
if (schemaCxtHasRules(it)) {
|
|
46049
|
-
subSchemaObjCode(it, valid);
|
|
46050
|
-
return;
|
|
46212
|
+
updateContext(it);
|
|
46213
|
+
checkAsyncSchema(it);
|
|
46214
|
+
const errsCount = gen.const("_errs", names_12.default.errors);
|
|
46215
|
+
typeAndKeywords(it, errsCount);
|
|
46216
|
+
gen.var(valid, (0, codegen_12._)`${errsCount} === ${names_12.default.errors}`);
|
|
46217
|
+
}
|
|
46218
|
+
function checkKeywords(it) {
|
|
46219
|
+
(0, util_12.checkUnknownRules)(it);
|
|
46220
|
+
checkRefsAndKeywords(it);
|
|
46221
|
+
}
|
|
46222
|
+
function typeAndKeywords(it, errsCount) {
|
|
46223
|
+
if (it.opts.jtd)
|
|
46224
|
+
return schemaKeywords(it, [], false, errsCount);
|
|
46225
|
+
const types2 = (0, dataType_12.getSchemaTypes)(it.schema);
|
|
46226
|
+
const checkedTypes = (0, dataType_12.coerceAndCheckDataType)(it, types2);
|
|
46227
|
+
schemaKeywords(it, types2, !checkedTypes, errsCount);
|
|
46228
|
+
}
|
|
46229
|
+
function checkRefsAndKeywords(it) {
|
|
46230
|
+
const { schema, errSchemaPath, opts, self } = it;
|
|
46231
|
+
if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_12.schemaHasRulesButRef)(schema, self.RULES)) {
|
|
46232
|
+
self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
|
|
46051
46233
|
}
|
|
46052
46234
|
}
|
|
46053
|
-
|
|
46054
|
-
}
|
|
46055
|
-
|
|
46056
|
-
|
|
46057
|
-
|
|
46058
|
-
for (const key in schema)
|
|
46059
|
-
if (self.RULES.all[key])
|
|
46060
|
-
return true;
|
|
46061
|
-
return false;
|
|
46062
|
-
}
|
|
46063
|
-
function isSchemaObj(it) {
|
|
46064
|
-
return typeof it.schema != "boolean";
|
|
46065
|
-
}
|
|
46066
|
-
function subSchemaObjCode(it, valid) {
|
|
46067
|
-
const { schema, gen, opts } = it;
|
|
46068
|
-
if (opts.$comment && schema.$comment)
|
|
46069
|
-
commentKeyword(it);
|
|
46070
|
-
updateContext(it);
|
|
46071
|
-
checkAsyncSchema(it);
|
|
46072
|
-
const errsCount = gen.const("_errs", names_1$3.default.errors);
|
|
46073
|
-
typeAndKeywords(it, errsCount);
|
|
46074
|
-
gen.var(valid, (0, codegen_1$n._)`${errsCount} === ${names_1$3.default.errors}`);
|
|
46075
|
-
}
|
|
46076
|
-
function checkKeywords(it) {
|
|
46077
|
-
(0, util_1$m.checkUnknownRules)(it);
|
|
46078
|
-
checkRefsAndKeywords(it);
|
|
46079
|
-
}
|
|
46080
|
-
function typeAndKeywords(it, errsCount) {
|
|
46081
|
-
if (it.opts.jtd)
|
|
46082
|
-
return schemaKeywords(it, [], false, errsCount);
|
|
46083
|
-
const types2 = (0, dataType_1$1.getSchemaTypes)(it.schema);
|
|
46084
|
-
const checkedTypes = (0, dataType_1$1.coerceAndCheckDataType)(it, types2);
|
|
46085
|
-
schemaKeywords(it, types2, !checkedTypes, errsCount);
|
|
46086
|
-
}
|
|
46087
|
-
function checkRefsAndKeywords(it) {
|
|
46088
|
-
const { schema, errSchemaPath, opts, self } = it;
|
|
46089
|
-
if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1$m.schemaHasRulesButRef)(schema, self.RULES)) {
|
|
46090
|
-
self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
|
|
46091
|
-
}
|
|
46092
|
-
}
|
|
46093
|
-
function checkNoDefault(it) {
|
|
46094
|
-
const { schema, opts } = it;
|
|
46095
|
-
if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) {
|
|
46096
|
-
(0, util_1$m.checkStrictMode)(it, "default is ignored in the schema root");
|
|
46097
|
-
}
|
|
46098
|
-
}
|
|
46099
|
-
function updateContext(it) {
|
|
46100
|
-
const schId = it.schema[it.opts.schemaId];
|
|
46101
|
-
if (schId)
|
|
46102
|
-
it.baseId = (0, resolve_1$2.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
|
|
46103
|
-
}
|
|
46104
|
-
function checkAsyncSchema(it) {
|
|
46105
|
-
if (it.schema.$async && !it.schemaEnv.$async)
|
|
46106
|
-
throw new Error("async schema in sync schema");
|
|
46107
|
-
}
|
|
46108
|
-
function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
|
|
46109
|
-
const msg = schema.$comment;
|
|
46110
|
-
if (opts.$comment === true) {
|
|
46111
|
-
gen.code((0, codegen_1$n._)`${names_1$3.default.self}.logger.log(${msg})`);
|
|
46112
|
-
} else if (typeof opts.$comment == "function") {
|
|
46113
|
-
const schemaPath = (0, codegen_1$n.str)`${errSchemaPath}/$comment`;
|
|
46114
|
-
const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
|
|
46115
|
-
gen.code((0, codegen_1$n._)`${names_1$3.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
|
|
46116
|
-
}
|
|
46117
|
-
}
|
|
46118
|
-
function returnResults(it) {
|
|
46119
|
-
const { gen, schemaEnv, validateName, ValidationError: ValidationError2, opts } = it;
|
|
46120
|
-
if (schemaEnv.$async) {
|
|
46121
|
-
gen.if((0, codegen_1$n._)`${names_1$3.default.errors} === 0`, () => gen.return(names_1$3.default.data), () => gen.throw((0, codegen_1$n._)`new ${ValidationError2}(${names_1$3.default.vErrors})`));
|
|
46122
|
-
} else {
|
|
46123
|
-
gen.assign((0, codegen_1$n._)`${validateName}.errors`, names_1$3.default.vErrors);
|
|
46124
|
-
if (opts.unevaluated)
|
|
46125
|
-
assignEvaluated(it);
|
|
46126
|
-
gen.return((0, codegen_1$n._)`${names_1$3.default.errors} === 0`);
|
|
46127
|
-
}
|
|
46128
|
-
}
|
|
46129
|
-
function assignEvaluated({ gen, evaluated, props, items: items2 }) {
|
|
46130
|
-
if (props instanceof codegen_1$n.Name)
|
|
46131
|
-
gen.assign((0, codegen_1$n._)`${evaluated}.props`, props);
|
|
46132
|
-
if (items2 instanceof codegen_1$n.Name)
|
|
46133
|
-
gen.assign((0, codegen_1$n._)`${evaluated}.items`, items2);
|
|
46134
|
-
}
|
|
46135
|
-
function schemaKeywords(it, types2, typeErrors, errsCount) {
|
|
46136
|
-
const { gen, schema, data, allErrors, opts, self } = it;
|
|
46137
|
-
const { RULES } = self;
|
|
46138
|
-
if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1$m.schemaHasRulesButRef)(schema, RULES))) {
|
|
46139
|
-
gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
|
|
46140
|
-
return;
|
|
46235
|
+
function checkNoDefault(it) {
|
|
46236
|
+
const { schema, opts } = it;
|
|
46237
|
+
if (schema.default !== void 0 && opts.useDefaults && opts.strictSchema) {
|
|
46238
|
+
(0, util_12.checkStrictMode)(it, "default is ignored in the schema root");
|
|
46239
|
+
}
|
|
46141
46240
|
}
|
|
46142
|
-
|
|
46143
|
-
|
|
46144
|
-
|
|
46145
|
-
|
|
46146
|
-
|
|
46147
|
-
|
|
46148
|
-
|
|
46149
|
-
|
|
46150
|
-
|
|
46241
|
+
function updateContext(it) {
|
|
46242
|
+
const schId = it.schema[it.opts.schemaId];
|
|
46243
|
+
if (schId)
|
|
46244
|
+
it.baseId = (0, resolve_12.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
|
|
46245
|
+
}
|
|
46246
|
+
function checkAsyncSchema(it) {
|
|
46247
|
+
if (it.schema.$async && !it.schemaEnv.$async)
|
|
46248
|
+
throw new Error("async schema in sync schema");
|
|
46249
|
+
}
|
|
46250
|
+
function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) {
|
|
46251
|
+
const msg = schema.$comment;
|
|
46252
|
+
if (opts.$comment === true) {
|
|
46253
|
+
gen.code((0, codegen_12._)`${names_12.default.self}.logger.log(${msg})`);
|
|
46254
|
+
} else if (typeof opts.$comment == "function") {
|
|
46255
|
+
const schemaPath = (0, codegen_12.str)`${errSchemaPath}/$comment`;
|
|
46256
|
+
const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
|
|
46257
|
+
gen.code((0, codegen_12._)`${names_12.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
|
|
46258
|
+
}
|
|
46259
|
+
}
|
|
46260
|
+
function returnResults(it) {
|
|
46261
|
+
const { gen, schemaEnv, validateName, ValidationError, opts } = it;
|
|
46262
|
+
if (schemaEnv.$async) {
|
|
46263
|
+
gen.if((0, codegen_12._)`${names_12.default.errors} === 0`, () => gen.return(names_12.default.data), () => gen.throw((0, codegen_12._)`new ${ValidationError}(${names_12.default.vErrors})`));
|
|
46264
|
+
} else {
|
|
46265
|
+
gen.assign((0, codegen_12._)`${validateName}.errors`, names_12.default.vErrors);
|
|
46266
|
+
if (opts.unevaluated)
|
|
46267
|
+
assignEvaluated(it);
|
|
46268
|
+
gen.return((0, codegen_12._)`${names_12.default.errors} === 0`);
|
|
46269
|
+
}
|
|
46270
|
+
}
|
|
46271
|
+
function assignEvaluated({ gen, evaluated, props, items: items2 }) {
|
|
46272
|
+
if (props instanceof codegen_12.Name)
|
|
46273
|
+
gen.assign((0, codegen_12._)`${evaluated}.props`, props);
|
|
46274
|
+
if (items2 instanceof codegen_12.Name)
|
|
46275
|
+
gen.assign((0, codegen_12._)`${evaluated}.items`, items2);
|
|
46276
|
+
}
|
|
46277
|
+
function schemaKeywords(it, types2, typeErrors, errsCount) {
|
|
46278
|
+
const { gen, schema, data, allErrors, opts, self } = it;
|
|
46279
|
+
const { RULES } = self;
|
|
46280
|
+
if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_12.schemaHasRulesButRef)(schema, RULES))) {
|
|
46281
|
+
gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
|
|
46151
46282
|
return;
|
|
46152
|
-
|
|
46153
|
-
|
|
46154
|
-
|
|
46155
|
-
|
|
46156
|
-
|
|
46157
|
-
(
|
|
46283
|
+
}
|
|
46284
|
+
if (!opts.jtd)
|
|
46285
|
+
checkStrictTypes(it, types2);
|
|
46286
|
+
gen.block(() => {
|
|
46287
|
+
for (const group of RULES.rules)
|
|
46288
|
+
groupKeywords(group);
|
|
46289
|
+
groupKeywords(RULES.post);
|
|
46290
|
+
});
|
|
46291
|
+
function groupKeywords(group) {
|
|
46292
|
+
if (!(0, applicability_12.shouldUseGroup)(schema, group))
|
|
46293
|
+
return;
|
|
46294
|
+
if (group.type) {
|
|
46295
|
+
gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
|
|
46296
|
+
iterateKeywords(it, group);
|
|
46297
|
+
if (types2.length === 1 && types2[0] === group.type && typeErrors) {
|
|
46298
|
+
gen.else();
|
|
46299
|
+
(0, dataType_2.reportTypeError)(it);
|
|
46300
|
+
}
|
|
46301
|
+
gen.endIf();
|
|
46302
|
+
} else {
|
|
46303
|
+
iterateKeywords(it, group);
|
|
46158
46304
|
}
|
|
46159
|
-
|
|
46160
|
-
|
|
46161
|
-
iterateKeywords(it, group);
|
|
46305
|
+
if (!allErrors)
|
|
46306
|
+
gen.if((0, codegen_12._)`${names_12.default.errors} === ${errsCount || 0}`);
|
|
46162
46307
|
}
|
|
46163
|
-
if (!allErrors)
|
|
46164
|
-
gen.if((0, codegen_1$n._)`${names_1$3.default.errors} === ${errsCount || 0}`);
|
|
46165
46308
|
}
|
|
46166
|
-
|
|
46167
|
-
|
|
46168
|
-
|
|
46169
|
-
|
|
46170
|
-
(
|
|
46171
|
-
|
|
46172
|
-
|
|
46173
|
-
|
|
46174
|
-
|
|
46309
|
+
function iterateKeywords(it, group) {
|
|
46310
|
+
const { gen, schema, opts: { useDefaults } } = it;
|
|
46311
|
+
if (useDefaults)
|
|
46312
|
+
(0, defaults_1.assignDefaults)(it, group.type);
|
|
46313
|
+
gen.block(() => {
|
|
46314
|
+
for (const rule of group.rules) {
|
|
46315
|
+
if ((0, applicability_12.shouldUseRule)(schema, rule)) {
|
|
46316
|
+
keywordCode(it, rule.keyword, rule.definition, group.type);
|
|
46317
|
+
}
|
|
46175
46318
|
}
|
|
46176
|
-
}
|
|
46177
|
-
}
|
|
46178
|
-
|
|
46179
|
-
|
|
46180
|
-
|
|
46181
|
-
|
|
46182
|
-
|
|
46183
|
-
|
|
46184
|
-
|
|
46185
|
-
checkKeywordTypes(it, it.dataTypes);
|
|
46186
|
-
}
|
|
46187
|
-
function checkContextTypes(it, types2) {
|
|
46188
|
-
if (!types2.length)
|
|
46189
|
-
return;
|
|
46190
|
-
if (!it.dataTypes.length) {
|
|
46191
|
-
it.dataTypes = types2;
|
|
46192
|
-
return;
|
|
46319
|
+
});
|
|
46320
|
+
}
|
|
46321
|
+
function checkStrictTypes(it, types2) {
|
|
46322
|
+
if (it.schemaEnv.meta || !it.opts.strictTypes)
|
|
46323
|
+
return;
|
|
46324
|
+
checkContextTypes(it, types2);
|
|
46325
|
+
if (!it.opts.allowUnionTypes)
|
|
46326
|
+
checkMultipleTypes(it, types2);
|
|
46327
|
+
checkKeywordTypes(it, it.dataTypes);
|
|
46193
46328
|
}
|
|
46194
|
-
types2
|
|
46195
|
-
if (!
|
|
46196
|
-
|
|
46329
|
+
function checkContextTypes(it, types2) {
|
|
46330
|
+
if (!types2.length)
|
|
46331
|
+
return;
|
|
46332
|
+
if (!it.dataTypes.length) {
|
|
46333
|
+
it.dataTypes = types2;
|
|
46334
|
+
return;
|
|
46197
46335
|
}
|
|
46198
|
-
|
|
46199
|
-
|
|
46200
|
-
}
|
|
46201
|
-
|
|
46202
|
-
|
|
46203
|
-
|
|
46204
|
-
}
|
|
46205
|
-
|
|
46206
|
-
|
|
46207
|
-
|
|
46208
|
-
|
|
46209
|
-
|
|
46210
|
-
|
|
46211
|
-
|
|
46212
|
-
|
|
46213
|
-
|
|
46214
|
-
|
|
46215
|
-
|
|
46216
|
-
|
|
46217
|
-
}
|
|
46218
|
-
|
|
46219
|
-
|
|
46220
|
-
}
|
|
46221
|
-
|
|
46222
|
-
|
|
46223
|
-
|
|
46224
|
-
|
|
46225
|
-
|
|
46226
|
-
|
|
46227
|
-
|
|
46228
|
-
|
|
46229
|
-
|
|
46230
|
-
|
|
46231
|
-
|
|
46232
|
-
|
|
46233
|
-
|
|
46234
|
-
|
|
46235
|
-
|
|
46236
|
-
|
|
46237
|
-
|
|
46238
|
-
|
|
46239
|
-
|
|
46240
|
-
|
|
46241
|
-
(0,
|
|
46242
|
-
|
|
46243
|
-
|
|
46244
|
-
|
|
46245
|
-
|
|
46246
|
-
|
|
46247
|
-
|
|
46248
|
-
|
|
46249
|
-
|
|
46250
|
-
|
|
46251
|
-
|
|
46252
|
-
|
|
46253
|
-
|
|
46254
|
-
|
|
46255
|
-
this.
|
|
46256
|
-
|
|
46257
|
-
this.
|
|
46258
|
-
if (
|
|
46259
|
-
|
|
46336
|
+
types2.forEach((t2) => {
|
|
46337
|
+
if (!includesType(it.dataTypes, t2)) {
|
|
46338
|
+
strictTypesError(it, `type "${t2}" not allowed by context "${it.dataTypes.join(",")}"`);
|
|
46339
|
+
}
|
|
46340
|
+
});
|
|
46341
|
+
narrowSchemaTypes(it, types2);
|
|
46342
|
+
}
|
|
46343
|
+
function checkMultipleTypes(it, ts) {
|
|
46344
|
+
if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
|
|
46345
|
+
strictTypesError(it, "use allowUnionTypes to allow union type keyword");
|
|
46346
|
+
}
|
|
46347
|
+
}
|
|
46348
|
+
function checkKeywordTypes(it, ts) {
|
|
46349
|
+
const rules2 = it.self.RULES.all;
|
|
46350
|
+
for (const keyword2 in rules2) {
|
|
46351
|
+
const rule = rules2[keyword2];
|
|
46352
|
+
if (typeof rule == "object" && (0, applicability_12.shouldUseRule)(it.schema, rule)) {
|
|
46353
|
+
const { type: type2 } = rule.definition;
|
|
46354
|
+
if (type2.length && !type2.some((t2) => hasApplicableType(ts, t2))) {
|
|
46355
|
+
strictTypesError(it, `missing type "${type2.join(",")}" for keyword "${keyword2}"`);
|
|
46356
|
+
}
|
|
46357
|
+
}
|
|
46358
|
+
}
|
|
46359
|
+
}
|
|
46360
|
+
function hasApplicableType(schTs, kwdT) {
|
|
46361
|
+
return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
|
|
46362
|
+
}
|
|
46363
|
+
function includesType(ts, t2) {
|
|
46364
|
+
return ts.includes(t2) || t2 === "integer" && ts.includes("number");
|
|
46365
|
+
}
|
|
46366
|
+
function narrowSchemaTypes(it, withTypes) {
|
|
46367
|
+
const ts = [];
|
|
46368
|
+
for (const t2 of it.dataTypes) {
|
|
46369
|
+
if (includesType(withTypes, t2))
|
|
46370
|
+
ts.push(t2);
|
|
46371
|
+
else if (withTypes.includes("integer") && t2 === "number")
|
|
46372
|
+
ts.push("integer");
|
|
46373
|
+
}
|
|
46374
|
+
it.dataTypes = ts;
|
|
46375
|
+
}
|
|
46376
|
+
function strictTypesError(it, msg) {
|
|
46377
|
+
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
46378
|
+
msg += ` at "${schemaPath}" (strictTypes)`;
|
|
46379
|
+
(0, util_12.checkStrictMode)(it, msg, it.opts.strictTypes);
|
|
46380
|
+
}
|
|
46381
|
+
class KeywordCxt {
|
|
46382
|
+
constructor(it, def2, keyword2) {
|
|
46383
|
+
(0, keyword_1.validateKeywordUsage)(it, def2, keyword2);
|
|
46384
|
+
this.gen = it.gen;
|
|
46385
|
+
this.allErrors = it.allErrors;
|
|
46386
|
+
this.keyword = keyword2;
|
|
46387
|
+
this.data = it.data;
|
|
46388
|
+
this.schema = it.schema[keyword2];
|
|
46389
|
+
this.$data = def2.$data && it.opts.$data && this.schema && this.schema.$data;
|
|
46390
|
+
this.schemaValue = (0, util_12.schemaRefOrVal)(it, this.schema, keyword2, this.$data);
|
|
46391
|
+
this.schemaType = def2.schemaType;
|
|
46392
|
+
this.parentSchema = it.schema;
|
|
46393
|
+
this.params = {};
|
|
46394
|
+
this.it = it;
|
|
46395
|
+
this.def = def2;
|
|
46396
|
+
if (this.$data) {
|
|
46397
|
+
this.schemaCode = it.gen.const("vSchema", getData2(this.$data, it));
|
|
46398
|
+
} else {
|
|
46399
|
+
this.schemaCode = this.schemaValue;
|
|
46400
|
+
if (!(0, keyword_1.validSchemaType)(this.schema, def2.schemaType, def2.allowUndefined)) {
|
|
46401
|
+
throw new Error(`${keyword2} value must be ${JSON.stringify(def2.schemaType)}`);
|
|
46402
|
+
}
|
|
46403
|
+
}
|
|
46404
|
+
if ("code" in def2 ? def2.trackErrors : def2.errors !== false) {
|
|
46405
|
+
this.errsCount = it.gen.const("_errs", names_12.default.errors);
|
|
46260
46406
|
}
|
|
46261
46407
|
}
|
|
46262
|
-
|
|
46263
|
-
this.
|
|
46408
|
+
result(condition, successAction, failAction) {
|
|
46409
|
+
this.failResult((0, codegen_12.not)(condition), successAction, failAction);
|
|
46264
46410
|
}
|
|
46265
|
-
|
|
46266
|
-
|
|
46267
|
-
|
|
46268
|
-
|
|
46269
|
-
|
|
46270
|
-
|
|
46271
|
-
|
|
46272
|
-
|
|
46273
|
-
|
|
46411
|
+
failResult(condition, successAction, failAction) {
|
|
46412
|
+
this.gen.if(condition);
|
|
46413
|
+
if (failAction)
|
|
46414
|
+
failAction();
|
|
46415
|
+
else
|
|
46416
|
+
this.error();
|
|
46417
|
+
if (successAction) {
|
|
46418
|
+
this.gen.else();
|
|
46419
|
+
successAction();
|
|
46420
|
+
if (this.allErrors)
|
|
46421
|
+
this.gen.endIf();
|
|
46422
|
+
} else {
|
|
46423
|
+
if (this.allErrors)
|
|
46424
|
+
this.gen.endIf();
|
|
46425
|
+
else
|
|
46426
|
+
this.gen.else();
|
|
46427
|
+
}
|
|
46428
|
+
}
|
|
46429
|
+
pass(condition, failAction) {
|
|
46430
|
+
this.failResult((0, codegen_12.not)(condition), void 0, failAction);
|
|
46431
|
+
}
|
|
46432
|
+
fail(condition) {
|
|
46433
|
+
if (condition === void 0) {
|
|
46434
|
+
this.error();
|
|
46435
|
+
if (!this.allErrors)
|
|
46436
|
+
this.gen.if(false);
|
|
46437
|
+
return;
|
|
46438
|
+
}
|
|
46439
|
+
this.gen.if(condition);
|
|
46274
46440
|
this.error();
|
|
46275
|
-
if (successAction) {
|
|
46276
|
-
this.gen.else();
|
|
46277
|
-
successAction();
|
|
46278
|
-
if (this.allErrors)
|
|
46279
|
-
this.gen.endIf();
|
|
46280
|
-
} else {
|
|
46281
46441
|
if (this.allErrors)
|
|
46282
46442
|
this.gen.endIf();
|
|
46283
46443
|
else
|
|
46284
46444
|
this.gen.else();
|
|
46285
46445
|
}
|
|
46286
|
-
|
|
46287
|
-
|
|
46288
|
-
|
|
46289
|
-
|
|
46290
|
-
|
|
46291
|
-
|
|
46292
|
-
|
|
46446
|
+
fail$data(condition) {
|
|
46447
|
+
if (!this.$data)
|
|
46448
|
+
return this.fail(condition);
|
|
46449
|
+
const { schemaCode } = this;
|
|
46450
|
+
this.fail((0, codegen_12._)`${schemaCode} !== undefined && (${(0, codegen_12.or)(this.invalid$data(), condition)})`);
|
|
46451
|
+
}
|
|
46452
|
+
error(append, errorParams, errorPaths) {
|
|
46453
|
+
if (errorParams) {
|
|
46454
|
+
this.setParams(errorParams);
|
|
46455
|
+
this._error(append, errorPaths);
|
|
46456
|
+
this.setParams({});
|
|
46457
|
+
return;
|
|
46458
|
+
}
|
|
46459
|
+
this._error(append, errorPaths);
|
|
46460
|
+
}
|
|
46461
|
+
_error(append, errorPaths) {
|
|
46462
|
+
(append ? errors_12.reportExtraError : errors_12.reportError)(this, this.def.error, errorPaths);
|
|
46463
|
+
}
|
|
46464
|
+
$dataError() {
|
|
46465
|
+
(0, errors_12.reportError)(this, this.def.$dataError || errors_12.keyword$DataError);
|
|
46466
|
+
}
|
|
46467
|
+
reset() {
|
|
46468
|
+
if (this.errsCount === void 0)
|
|
46469
|
+
throw new Error('add "trackErrors" to keyword definition');
|
|
46470
|
+
(0, errors_12.resetErrorsCount)(this.gen, this.errsCount);
|
|
46471
|
+
}
|
|
46472
|
+
ok(cond) {
|
|
46293
46473
|
if (!this.allErrors)
|
|
46294
|
-
this.gen.if(
|
|
46295
|
-
return;
|
|
46474
|
+
this.gen.if(cond);
|
|
46296
46475
|
}
|
|
46297
|
-
|
|
46298
|
-
|
|
46299
|
-
|
|
46300
|
-
|
|
46301
|
-
|
|
46302
|
-
this.gen.else();
|
|
46303
|
-
}
|
|
46304
|
-
fail$data(condition) {
|
|
46305
|
-
if (!this.$data)
|
|
46306
|
-
return this.fail(condition);
|
|
46307
|
-
const { schemaCode } = this;
|
|
46308
|
-
this.fail((0, codegen_1$n._)`${schemaCode} !== undefined && (${(0, codegen_1$n.or)(this.invalid$data(), condition)})`);
|
|
46309
|
-
}
|
|
46310
|
-
error(append, errorParams, errorPaths) {
|
|
46311
|
-
if (errorParams) {
|
|
46312
|
-
this.setParams(errorParams);
|
|
46313
|
-
this._error(append, errorPaths);
|
|
46314
|
-
this.setParams({});
|
|
46315
|
-
return;
|
|
46476
|
+
setParams(obj, assign2) {
|
|
46477
|
+
if (assign2)
|
|
46478
|
+
Object.assign(this.params, obj);
|
|
46479
|
+
else
|
|
46480
|
+
this.params = obj;
|
|
46316
46481
|
}
|
|
46317
|
-
|
|
46318
|
-
|
|
46319
|
-
|
|
46320
|
-
|
|
46321
|
-
|
|
46322
|
-
$dataError() {
|
|
46323
|
-
(0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);
|
|
46324
|
-
}
|
|
46325
|
-
reset() {
|
|
46326
|
-
if (this.errsCount === void 0)
|
|
46327
|
-
throw new Error('add "trackErrors" to keyword definition');
|
|
46328
|
-
(0, errors_1.resetErrorsCount)(this.gen, this.errsCount);
|
|
46329
|
-
}
|
|
46330
|
-
ok(cond) {
|
|
46331
|
-
if (!this.allErrors)
|
|
46332
|
-
this.gen.if(cond);
|
|
46333
|
-
}
|
|
46334
|
-
setParams(obj, assign2) {
|
|
46335
|
-
if (assign2)
|
|
46336
|
-
Object.assign(this.params, obj);
|
|
46337
|
-
else
|
|
46338
|
-
this.params = obj;
|
|
46339
|
-
}
|
|
46340
|
-
block$data(valid, codeBlock, $dataValid = codegen_1$n.nil) {
|
|
46341
|
-
this.gen.block(() => {
|
|
46342
|
-
this.check$data(valid, $dataValid);
|
|
46343
|
-
codeBlock();
|
|
46344
|
-
});
|
|
46345
|
-
}
|
|
46346
|
-
check$data(valid = codegen_1$n.nil, $dataValid = codegen_1$n.nil) {
|
|
46347
|
-
if (!this.$data)
|
|
46348
|
-
return;
|
|
46349
|
-
const { gen, schemaCode, schemaType, def: def2 } = this;
|
|
46350
|
-
gen.if((0, codegen_1$n.or)((0, codegen_1$n._)`${schemaCode} === undefined`, $dataValid));
|
|
46351
|
-
if (valid !== codegen_1$n.nil)
|
|
46352
|
-
gen.assign(valid, true);
|
|
46353
|
-
if (schemaType.length || def2.validateSchema) {
|
|
46354
|
-
gen.elseIf(this.invalid$data());
|
|
46355
|
-
this.$dataError();
|
|
46356
|
-
if (valid !== codegen_1$n.nil)
|
|
46357
|
-
gen.assign(valid, false);
|
|
46482
|
+
block$data(valid, codeBlock, $dataValid = codegen_12.nil) {
|
|
46483
|
+
this.gen.block(() => {
|
|
46484
|
+
this.check$data(valid, $dataValid);
|
|
46485
|
+
codeBlock();
|
|
46486
|
+
});
|
|
46358
46487
|
}
|
|
46359
|
-
|
|
46360
|
-
|
|
46361
|
-
|
|
46362
|
-
|
|
46363
|
-
|
|
46364
|
-
|
|
46365
|
-
|
|
46366
|
-
|
|
46367
|
-
|
|
46368
|
-
|
|
46369
|
-
|
|
46488
|
+
check$data(valid = codegen_12.nil, $dataValid = codegen_12.nil) {
|
|
46489
|
+
if (!this.$data)
|
|
46490
|
+
return;
|
|
46491
|
+
const { gen, schemaCode, schemaType, def: def2 } = this;
|
|
46492
|
+
gen.if((0, codegen_12.or)((0, codegen_12._)`${schemaCode} === undefined`, $dataValid));
|
|
46493
|
+
if (valid !== codegen_12.nil)
|
|
46494
|
+
gen.assign(valid, true);
|
|
46495
|
+
if (schemaType.length || def2.validateSchema) {
|
|
46496
|
+
gen.elseIf(this.invalid$data());
|
|
46497
|
+
this.$dataError();
|
|
46498
|
+
if (valid !== codegen_12.nil)
|
|
46499
|
+
gen.assign(valid, false);
|
|
46370
46500
|
}
|
|
46371
|
-
|
|
46501
|
+
gen.else();
|
|
46372
46502
|
}
|
|
46373
|
-
|
|
46374
|
-
|
|
46375
|
-
|
|
46376
|
-
|
|
46503
|
+
invalid$data() {
|
|
46504
|
+
const { gen, schemaCode, schemaType, def: def2, it } = this;
|
|
46505
|
+
return (0, codegen_12.or)(wrong$DataType(), invalid$DataSchema());
|
|
46506
|
+
function wrong$DataType() {
|
|
46507
|
+
if (schemaType.length) {
|
|
46508
|
+
if (!(schemaCode instanceof codegen_12.Name))
|
|
46509
|
+
throw new Error("ajv implementation error");
|
|
46510
|
+
const st = Array.isArray(schemaType) ? schemaType : [schemaType];
|
|
46511
|
+
return (0, codegen_12._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
|
|
46512
|
+
}
|
|
46513
|
+
return codegen_12.nil;
|
|
46514
|
+
}
|
|
46515
|
+
function invalid$DataSchema() {
|
|
46516
|
+
if (def2.validateSchema) {
|
|
46517
|
+
const validateSchemaRef = gen.scopeValue("validate$data", { ref: def2.validateSchema });
|
|
46518
|
+
return (0, codegen_12._)`!${validateSchemaRef}(${schemaCode})`;
|
|
46519
|
+
}
|
|
46520
|
+
return codegen_12.nil;
|
|
46521
|
+
}
|
|
46522
|
+
}
|
|
46523
|
+
subschema(appl, valid) {
|
|
46524
|
+
const subschema2 = (0, subschema_1.getSubschema)(this.it, appl);
|
|
46525
|
+
(0, subschema_1.extendSubschemaData)(subschema2, this.it, appl);
|
|
46526
|
+
(0, subschema_1.extendSubschemaMode)(subschema2, appl);
|
|
46527
|
+
const nextContext = { ...this.it, ...subschema2, items: void 0, props: void 0 };
|
|
46528
|
+
subschemaCode(nextContext, valid);
|
|
46529
|
+
return nextContext;
|
|
46530
|
+
}
|
|
46531
|
+
mergeEvaluated(schemaCxt, toName) {
|
|
46532
|
+
const { it, gen } = this;
|
|
46533
|
+
if (!it.opts.unevaluated)
|
|
46534
|
+
return;
|
|
46535
|
+
if (it.props !== true && schemaCxt.props !== void 0) {
|
|
46536
|
+
it.props = util_12.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
|
|
46537
|
+
}
|
|
46538
|
+
if (it.items !== true && schemaCxt.items !== void 0) {
|
|
46539
|
+
it.items = util_12.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
|
|
46377
46540
|
}
|
|
46378
|
-
return codegen_1$n.nil;
|
|
46379
|
-
}
|
|
46380
|
-
}
|
|
46381
|
-
subschema(appl, valid) {
|
|
46382
|
-
const subschema2 = (0, subschema_1.getSubschema)(this.it, appl);
|
|
46383
|
-
(0, subschema_1.extendSubschemaData)(subschema2, this.it, appl);
|
|
46384
|
-
(0, subschema_1.extendSubschemaMode)(subschema2, appl);
|
|
46385
|
-
const nextContext = { ...this.it, ...subschema2, items: void 0, props: void 0 };
|
|
46386
|
-
subschemaCode(nextContext, valid);
|
|
46387
|
-
return nextContext;
|
|
46388
|
-
}
|
|
46389
|
-
mergeEvaluated(schemaCxt, toName) {
|
|
46390
|
-
const { it, gen } = this;
|
|
46391
|
-
if (!it.opts.unevaluated)
|
|
46392
|
-
return;
|
|
46393
|
-
if (it.props !== true && schemaCxt.props !== void 0) {
|
|
46394
|
-
it.props = util_1$m.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
|
|
46395
46541
|
}
|
|
46396
|
-
|
|
46397
|
-
|
|
46542
|
+
mergeValidEvaluated(schemaCxt, valid) {
|
|
46543
|
+
const { it, gen } = this;
|
|
46544
|
+
if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
|
|
46545
|
+
gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_12.Name));
|
|
46546
|
+
return true;
|
|
46547
|
+
}
|
|
46398
46548
|
}
|
|
46399
46549
|
}
|
|
46400
|
-
|
|
46401
|
-
|
|
46402
|
-
|
|
46403
|
-
|
|
46404
|
-
|
|
46550
|
+
validate.KeywordCxt = KeywordCxt;
|
|
46551
|
+
function keywordCode(it, keyword2, def2, ruleType) {
|
|
46552
|
+
const cxt = new KeywordCxt(it, def2, keyword2);
|
|
46553
|
+
if ("code" in def2) {
|
|
46554
|
+
def2.code(cxt, ruleType);
|
|
46555
|
+
} else if (cxt.$data && def2.validate) {
|
|
46556
|
+
(0, keyword_1.funcKeywordCode)(cxt, def2);
|
|
46557
|
+
} else if ("macro" in def2) {
|
|
46558
|
+
(0, keyword_1.macroKeywordCode)(cxt, def2);
|
|
46559
|
+
} else if (def2.compile || def2.validate) {
|
|
46560
|
+
(0, keyword_1.funcKeywordCode)(cxt, def2);
|
|
46405
46561
|
}
|
|
46406
46562
|
}
|
|
46407
|
-
|
|
46408
|
-
|
|
46409
|
-
function
|
|
46410
|
-
|
|
46411
|
-
|
|
46412
|
-
|
|
46413
|
-
|
|
46414
|
-
(0
|
|
46415
|
-
|
|
46416
|
-
|
|
46417
|
-
|
|
46418
|
-
|
|
46419
|
-
|
|
46420
|
-
|
|
46421
|
-
|
|
46422
|
-
|
|
46423
|
-
|
|
46424
|
-
|
|
46425
|
-
|
|
46426
|
-
|
|
46427
|
-
|
|
46428
|
-
|
|
46429
|
-
|
|
46430
|
-
|
|
46431
|
-
|
|
46432
|
-
|
|
46433
|
-
|
|
46434
|
-
|
|
46435
|
-
|
|
46436
|
-
|
|
46437
|
-
const
|
|
46438
|
-
|
|
46439
|
-
|
|
46440
|
-
|
|
46441
|
-
|
|
46442
|
-
|
|
46443
|
-
}
|
|
46444
|
-
|
|
46445
|
-
|
|
46446
|
-
|
|
46447
|
-
if (!jsonPointer)
|
|
46448
|
-
return data;
|
|
46449
|
-
}
|
|
46450
|
-
let expr = data;
|
|
46451
|
-
const segments = jsonPointer.split("/");
|
|
46452
|
-
for (const segment of segments) {
|
|
46453
|
-
if (segment) {
|
|
46454
|
-
data = (0, codegen_1$n._)`${data}${(0, codegen_1$n.getProperty)((0, util_1$m.unescapeJsonPointer)(segment))}`;
|
|
46455
|
-
expr = (0, codegen_1$n._)`${expr} && ${data}`;
|
|
46563
|
+
const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
|
46564
|
+
const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
|
46565
|
+
function getData2($data, { dataLevel, dataNames, dataPathArr }) {
|
|
46566
|
+
let jsonPointer;
|
|
46567
|
+
let data;
|
|
46568
|
+
if ($data === "")
|
|
46569
|
+
return names_12.default.rootData;
|
|
46570
|
+
if ($data[0] === "/") {
|
|
46571
|
+
if (!JSON_POINTER.test($data))
|
|
46572
|
+
throw new Error(`Invalid JSON-pointer: ${$data}`);
|
|
46573
|
+
jsonPointer = $data;
|
|
46574
|
+
data = names_12.default.rootData;
|
|
46575
|
+
} else {
|
|
46576
|
+
const matches = RELATIVE_JSON_POINTER.exec($data);
|
|
46577
|
+
if (!matches)
|
|
46578
|
+
throw new Error(`Invalid JSON-pointer: ${$data}`);
|
|
46579
|
+
const up = +matches[1];
|
|
46580
|
+
jsonPointer = matches[2];
|
|
46581
|
+
if (jsonPointer === "#") {
|
|
46582
|
+
if (up >= dataLevel)
|
|
46583
|
+
throw new Error(errorMsg("property/index", up));
|
|
46584
|
+
return dataPathArr[dataLevel - up];
|
|
46585
|
+
}
|
|
46586
|
+
if (up > dataLevel)
|
|
46587
|
+
throw new Error(errorMsg("data", up));
|
|
46588
|
+
data = dataNames[dataLevel - up];
|
|
46589
|
+
if (!jsonPointer)
|
|
46590
|
+
return data;
|
|
46591
|
+
}
|
|
46592
|
+
let expr = data;
|
|
46593
|
+
const segments = jsonPointer.split("/");
|
|
46594
|
+
for (const segment of segments) {
|
|
46595
|
+
if (segment) {
|
|
46596
|
+
data = (0, codegen_12._)`${data}${(0, codegen_12.getProperty)((0, util_12.unescapeJsonPointer)(segment))}`;
|
|
46597
|
+
expr = (0, codegen_12._)`${expr} && ${data}`;
|
|
46598
|
+
}
|
|
46599
|
+
}
|
|
46600
|
+
return expr;
|
|
46601
|
+
function errorMsg(pointerType, up) {
|
|
46602
|
+
return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
|
|
46456
46603
|
}
|
|
46457
46604
|
}
|
|
46458
|
-
|
|
46459
|
-
|
|
46460
|
-
return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
|
|
46461
|
-
}
|
|
46605
|
+
validate.getData = getData2;
|
|
46606
|
+
return validate;
|
|
46462
46607
|
}
|
|
46463
|
-
validate.getData = getData;
|
|
46464
46608
|
var validation_error = {};
|
|
46465
|
-
|
|
46466
|
-
|
|
46467
|
-
|
|
46468
|
-
|
|
46469
|
-
|
|
46470
|
-
|
|
46609
|
+
var hasRequiredValidation_error;
|
|
46610
|
+
function requireValidation_error() {
|
|
46611
|
+
if (hasRequiredValidation_error) return validation_error;
|
|
46612
|
+
hasRequiredValidation_error = 1;
|
|
46613
|
+
Object.defineProperty(validation_error, "__esModule", { value: true });
|
|
46614
|
+
class ValidationError extends Error {
|
|
46615
|
+
constructor(errors2) {
|
|
46616
|
+
super("validation failed");
|
|
46617
|
+
this.errors = errors2;
|
|
46618
|
+
this.ajv = this.validation = true;
|
|
46619
|
+
}
|
|
46471
46620
|
}
|
|
46621
|
+
validation_error.default = ValidationError;
|
|
46622
|
+
return validation_error;
|
|
46472
46623
|
}
|
|
46473
|
-
validation_error.default = ValidationError;
|
|
46474
46624
|
var ref_error = {};
|
|
46475
46625
|
Object.defineProperty(ref_error, "__esModule", { value: true });
|
|
46476
46626
|
const resolve_1$1 = resolve$2;
|
|
@@ -46486,11 +46636,11 @@ var compile = {};
|
|
|
46486
46636
|
Object.defineProperty(compile, "__esModule", { value: true });
|
|
46487
46637
|
compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
|
|
46488
46638
|
const codegen_1$m = codegen;
|
|
46489
|
-
const validation_error_1 =
|
|
46639
|
+
const validation_error_1 = requireValidation_error();
|
|
46490
46640
|
const names_1$2 = names$1;
|
|
46491
46641
|
const resolve_1 = resolve$2;
|
|
46492
46642
|
const util_1$l = util;
|
|
46493
|
-
const validate_1$1 =
|
|
46643
|
+
const validate_1$1 = requireValidate();
|
|
46494
46644
|
class SchemaEnv {
|
|
46495
46645
|
constructor(env) {
|
|
46496
46646
|
var _a2;
|
|
@@ -47419,7 +47569,7 @@ uri$1.default = uri;
|
|
|
47419
47569
|
(function(exports$1) {
|
|
47420
47570
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
47421
47571
|
exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = void 0;
|
|
47422
|
-
var validate_12 =
|
|
47572
|
+
var validate_12 = requireValidate();
|
|
47423
47573
|
Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function() {
|
|
47424
47574
|
return validate_12.KeywordCxt;
|
|
47425
47575
|
} });
|
|
@@ -47442,7 +47592,7 @@ uri$1.default = uri;
|
|
|
47442
47592
|
Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function() {
|
|
47443
47593
|
return codegen_12.CodeGen;
|
|
47444
47594
|
} });
|
|
47445
|
-
const validation_error_12 =
|
|
47595
|
+
const validation_error_12 = requireValidation_error();
|
|
47446
47596
|
const ref_error_12 = ref_error;
|
|
47447
47597
|
const rules_12 = rules;
|
|
47448
47598
|
const compile_12 = compile;
|
|
@@ -49030,7 +49180,7 @@ const def$a = {
|
|
|
49030
49180
|
additionalProperties.default = def$a;
|
|
49031
49181
|
var properties$1 = {};
|
|
49032
49182
|
Object.defineProperty(properties$1, "__esModule", { value: true });
|
|
49033
|
-
const validate_1 =
|
|
49183
|
+
const validate_1 = requireValidate();
|
|
49034
49184
|
const code_1$2 = code;
|
|
49035
49185
|
const util_1$7 = util;
|
|
49036
49186
|
const additionalProperties_1$1 = additionalProperties;
|
|
@@ -49881,7 +50031,7 @@ const require$$3 = {
|
|
|
49881
50031
|
module.exports.Ajv = Ajv2;
|
|
49882
50032
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
49883
50033
|
exports$1.default = Ajv2;
|
|
49884
|
-
var validate_12 =
|
|
50034
|
+
var validate_12 = requireValidate();
|
|
49885
50035
|
Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function() {
|
|
49886
50036
|
return validate_12.KeywordCxt;
|
|
49887
50037
|
} });
|
|
@@ -49904,7 +50054,7 @@ const require$$3 = {
|
|
|
49904
50054
|
Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function() {
|
|
49905
50055
|
return codegen_12.CodeGen;
|
|
49906
50056
|
} });
|
|
49907
|
-
var validation_error_12 =
|
|
50057
|
+
var validation_error_12 = requireValidation_error();
|
|
49908
50058
|
Object.defineProperty(exports$1, "ValidationError", { enumerable: true, get: function() {
|
|
49909
50059
|
return validation_error_12.default;
|
|
49910
50060
|
} });
|
|
@@ -50296,6 +50446,7 @@ function RequestBuilder({ request }) {
|
|
|
50296
50446
|
const globals = useStore((s) => s.globals);
|
|
50297
50447
|
const activeTabId = useStore((s) => s.activeTabId);
|
|
50298
50448
|
const setTabResponse = useStore((s) => s.setTabResponse);
|
|
50449
|
+
const setTabHookResults = useStore((s) => s.setTabHookResults);
|
|
50299
50450
|
const setTabSending = useStore((s) => s.setTabSending);
|
|
50300
50451
|
const setTabRequestTab = useStore((s) => s.setTabRequestTab);
|
|
50301
50452
|
const addHistoryEntry = useStore((s) => s.addHistoryEntry);
|
|
@@ -50309,6 +50460,14 @@ function RequestBuilder({ request }) {
|
|
|
50309
50460
|
if (activeTabId) setTabRequestTab(activeTabId, t2);
|
|
50310
50461
|
}
|
|
50311
50462
|
const [editingName, setEditingName] = reactExports.useState(false);
|
|
50463
|
+
const [runHooks, setRunHooks] = reactExports.useState(() => localStorage.getItem("runHooks") !== "false");
|
|
50464
|
+
function toggleRunHooks() {
|
|
50465
|
+
setRunHooks((prev) => {
|
|
50466
|
+
const next = !prev;
|
|
50467
|
+
localStorage.setItem("runHooks", String(next));
|
|
50468
|
+
return next;
|
|
50469
|
+
});
|
|
50470
|
+
}
|
|
50312
50471
|
function update(patch) {
|
|
50313
50472
|
updateRequest(request.id, patch);
|
|
50314
50473
|
}
|
|
@@ -50316,35 +50475,79 @@ function RequestBuilder({ request }) {
|
|
|
50316
50475
|
if (!activeTabId) return;
|
|
50317
50476
|
setTabSending(activeTabId, true);
|
|
50318
50477
|
setTabResponse(activeTabId, null, null);
|
|
50478
|
+
setTabHookResults(activeTabId, null);
|
|
50479
|
+
const collectedHookResults = [];
|
|
50319
50480
|
try {
|
|
50320
50481
|
const activeEnv = activeEnvironmentId ? environments[activeEnvironmentId]?.data ?? null : null;
|
|
50321
50482
|
const sessionVars = useStore.getState().sessionVars;
|
|
50322
|
-
const
|
|
50483
|
+
const tls = collectionTls ? { ...workspaceSettings?.tls, ...collectionTls } : workspaceSettings?.tls;
|
|
50484
|
+
const basePayload = {
|
|
50485
|
+
environment: activeEnv,
|
|
50486
|
+
proxy: workspaceSettings?.proxy,
|
|
50487
|
+
tls,
|
|
50488
|
+
piiMaskPatterns: workspaceSettings?.piiMaskPatterns
|
|
50489
|
+
};
|
|
50490
|
+
let collectionVars = {
|
|
50323
50491
|
...activeCollectionId ? collections[activeCollectionId]?.data.collectionVariables ?? {} : {},
|
|
50324
50492
|
...sessionVars
|
|
50325
50493
|
};
|
|
50494
|
+
let liveGlobals = { ...globals };
|
|
50326
50495
|
const inherited = useStore.getState().getInheritedAuthAndHeaders(request.id);
|
|
50327
50496
|
const mergedAuth = request.auth.type !== "none" ? request.auth : inherited.auth ?? request.auth;
|
|
50328
50497
|
const mergedHeaders = [
|
|
50329
50498
|
...inherited.headers.filter((h) => h.enabled),
|
|
50330
50499
|
...request.headers
|
|
50331
50500
|
];
|
|
50332
|
-
const mergedRequest = {
|
|
50333
|
-
|
|
50334
|
-
|
|
50335
|
-
|
|
50336
|
-
|
|
50501
|
+
const mergedRequest = { ...request, auth: mergedAuth, headers: mergedHeaders };
|
|
50502
|
+
const collection = activeCollectionId ? collections[activeCollectionId]?.data : null;
|
|
50503
|
+
const hooks = runHooks && collection ? getHooksForRequest(request.id, collection) : { before: [], after: [] };
|
|
50504
|
+
for (const hook of hooks.before) {
|
|
50505
|
+
const start = Date.now();
|
|
50506
|
+
try {
|
|
50507
|
+
const r = await electron$h.sendRequest({ ...basePayload, request: hook, collectionVars, globals: liveGlobals });
|
|
50508
|
+
applyScriptUpdates(r.scriptResult);
|
|
50509
|
+
collectionVars = { ...collectionVars, ...r.scriptResult.updatedCollectionVars };
|
|
50510
|
+
liveGlobals = { ...liveGlobals, ...r.scriptResult.updatedGlobals };
|
|
50511
|
+
const allPassed = r.scriptResult.testResults.every((t2) => t2.passed);
|
|
50512
|
+
collectedHookResults.push({
|
|
50513
|
+
requestId: hook.id,
|
|
50514
|
+
name: hook.name,
|
|
50515
|
+
method: hook.method,
|
|
50516
|
+
resolvedUrl: r.scriptResult.resolvedUrl,
|
|
50517
|
+
status: r.scriptResult.postScriptError ? "error" : r.scriptResult.testResults.length > 0 ? allPassed ? "passed" : "failed" : "passed",
|
|
50518
|
+
httpStatus: r.response.status,
|
|
50519
|
+
durationMs: Date.now() - start,
|
|
50520
|
+
isHook: true,
|
|
50521
|
+
hookType: hook.hookType,
|
|
50522
|
+
testResults: r.scriptResult.testResults,
|
|
50523
|
+
consoleOutput: r.scriptResult.consoleOutput,
|
|
50524
|
+
preScriptError: r.scriptResult.preScriptError,
|
|
50525
|
+
postScriptError: r.scriptResult.postScriptError
|
|
50526
|
+
});
|
|
50527
|
+
} catch (err) {
|
|
50528
|
+
collectedHookResults.push({
|
|
50529
|
+
requestId: hook.id,
|
|
50530
|
+
name: hook.name,
|
|
50531
|
+
method: hook.method,
|
|
50532
|
+
resolvedUrl: hook.url,
|
|
50533
|
+
status: "error",
|
|
50534
|
+
durationMs: Date.now() - start,
|
|
50535
|
+
isHook: true,
|
|
50536
|
+
hookType: hook.hookType,
|
|
50537
|
+
error: err instanceof Error ? err.message : String(err)
|
|
50538
|
+
});
|
|
50539
|
+
}
|
|
50540
|
+
}
|
|
50337
50541
|
const result = await electron$h.sendRequest({
|
|
50542
|
+
...basePayload,
|
|
50338
50543
|
request: mergedRequest,
|
|
50339
|
-
environment: activeEnv,
|
|
50340
50544
|
collectionVars,
|
|
50341
|
-
globals
|
|
50342
|
-
proxy: workspaceSettings?.proxy,
|
|
50343
|
-
tls: collectionTls ? { ...workspaceSettings?.tls, ...collectionTls } : workspaceSettings?.tls,
|
|
50344
|
-
piiMaskPatterns: workspaceSettings?.piiMaskPatterns
|
|
50545
|
+
globals: liveGlobals
|
|
50345
50546
|
});
|
|
50346
50547
|
setTabResponse(activeTabId, result.response, result.scriptResult, result.sentRequest);
|
|
50347
50548
|
applyScriptUpdates(result.scriptResult);
|
|
50549
|
+
collectionVars = { ...collectionVars, ...result.scriptResult.updatedCollectionVars };
|
|
50550
|
+
liveGlobals = { ...liveGlobals, ...result.scriptResult.updatedGlobals };
|
|
50348
50551
|
addHistoryEntry({
|
|
50349
50552
|
id: crypto.randomUUID(),
|
|
50350
50553
|
timestamp: Date.now(),
|
|
@@ -50354,6 +50557,46 @@ function RequestBuilder({ request }) {
|
|
|
50354
50557
|
environmentName: activeEnv?.name ?? null,
|
|
50355
50558
|
scriptResult: result.scriptResult
|
|
50356
50559
|
});
|
|
50560
|
+
for (const hook of hooks.after) {
|
|
50561
|
+
const start = Date.now();
|
|
50562
|
+
try {
|
|
50563
|
+
const r = await electron$h.sendRequest({ ...basePayload, request: hook, collectionVars, globals: liveGlobals });
|
|
50564
|
+
applyScriptUpdates(r.scriptResult);
|
|
50565
|
+
collectionVars = { ...collectionVars, ...r.scriptResult.updatedCollectionVars };
|
|
50566
|
+
liveGlobals = { ...liveGlobals, ...r.scriptResult.updatedGlobals };
|
|
50567
|
+
const allPassed = r.scriptResult.testResults.every((t2) => t2.passed);
|
|
50568
|
+
collectedHookResults.push({
|
|
50569
|
+
requestId: hook.id,
|
|
50570
|
+
name: hook.name,
|
|
50571
|
+
method: hook.method,
|
|
50572
|
+
resolvedUrl: r.scriptResult.resolvedUrl,
|
|
50573
|
+
status: r.scriptResult.postScriptError ? "error" : r.scriptResult.testResults.length > 0 ? allPassed ? "passed" : "failed" : "passed",
|
|
50574
|
+
httpStatus: r.response.status,
|
|
50575
|
+
durationMs: Date.now() - start,
|
|
50576
|
+
isHook: true,
|
|
50577
|
+
hookType: hook.hookType,
|
|
50578
|
+
testResults: r.scriptResult.testResults,
|
|
50579
|
+
consoleOutput: r.scriptResult.consoleOutput,
|
|
50580
|
+
preScriptError: r.scriptResult.preScriptError,
|
|
50581
|
+
postScriptError: r.scriptResult.postScriptError
|
|
50582
|
+
});
|
|
50583
|
+
} catch (err) {
|
|
50584
|
+
collectedHookResults.push({
|
|
50585
|
+
requestId: hook.id,
|
|
50586
|
+
name: hook.name,
|
|
50587
|
+
method: hook.method,
|
|
50588
|
+
resolvedUrl: hook.url,
|
|
50589
|
+
status: "error",
|
|
50590
|
+
durationMs: Date.now() - start,
|
|
50591
|
+
isHook: true,
|
|
50592
|
+
hookType: hook.hookType,
|
|
50593
|
+
error: err instanceof Error ? err.message : String(err)
|
|
50594
|
+
});
|
|
50595
|
+
}
|
|
50596
|
+
}
|
|
50597
|
+
if (collectedHookResults.length > 0) {
|
|
50598
|
+
setTabHookResults(activeTabId, collectedHookResults);
|
|
50599
|
+
}
|
|
50357
50600
|
} finally {
|
|
50358
50601
|
setTabSending(activeTabId, false);
|
|
50359
50602
|
}
|
|
@@ -50431,15 +50674,26 @@ function RequestBuilder({ request }) {
|
|
|
50431
50674
|
className: "bg-surface-800 border border-surface-700 rounded px-3 py-1.5 text-sm focus:outline-none focus:border-blue-500 font-mono placeholder-surface-700"
|
|
50432
50675
|
}
|
|
50433
50676
|
),
|
|
50434
|
-
!isWs && /* @__PURE__ */ jsxRuntimeExports.
|
|
50435
|
-
|
|
50436
|
-
|
|
50437
|
-
|
|
50438
|
-
|
|
50439
|
-
|
|
50440
|
-
|
|
50441
|
-
|
|
50442
|
-
|
|
50677
|
+
!isWs && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
50678
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
50679
|
+
"button",
|
|
50680
|
+
{
|
|
50681
|
+
onClick: toggleRunHooks,
|
|
50682
|
+
title: runHooks ? "Hooks enabled — click to disable" : "Hooks disabled — click to enable",
|
|
50683
|
+
className: `px-2 py-1.5 rounded text-xs font-medium transition-colors border ${runHooks ? "border-violet-500 text-violet-400 hover:bg-violet-500/10" : "border-surface-700 text-surface-500 hover:text-surface-300"}`,
|
|
50684
|
+
children: "hooks"
|
|
50685
|
+
}
|
|
50686
|
+
),
|
|
50687
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
50688
|
+
"button",
|
|
50689
|
+
{
|
|
50690
|
+
onClick: sendRequest,
|
|
50691
|
+
disabled: isSending || !request.url,
|
|
50692
|
+
className: "px-4 py-1.5 bg-blue-600 hover:bg-blue-500 disabled:bg-surface-800 disabled:text-surface-400 rounded text-sm font-medium transition-colors min-w-[72px]",
|
|
50693
|
+
children: isSending ? "..." : "Send"
|
|
50694
|
+
}
|
|
50695
|
+
)
|
|
50696
|
+
] })
|
|
50443
50697
|
] }),
|
|
50444
50698
|
isWs ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(WebSocketPanel, { request }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
50445
50699
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex border-b border-surface-800 px-4 gap-0 flex-shrink-0", children: tabs.map((tab) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -51017,6 +51271,87 @@ function prettyXml(raw) {
|
|
|
51017
51271
|
return raw;
|
|
51018
51272
|
}
|
|
51019
51273
|
}
|
|
51274
|
+
const HOOK_BADGE$1 = {
|
|
51275
|
+
beforeAll: { label: "BEFORE ALL", cls: "bg-violet-700 text-white" },
|
|
51276
|
+
before: { label: "BEFORE", cls: "bg-violet-600 text-white" },
|
|
51277
|
+
after: { label: "AFTER", cls: "bg-cyan-700 text-white" },
|
|
51278
|
+
afterAll: { label: "AFTER ALL", cls: "bg-cyan-800 text-white" }
|
|
51279
|
+
};
|
|
51280
|
+
function HookResultsPanel({ results }) {
|
|
51281
|
+
const [open, setOpen] = reactExports.useState(true);
|
|
51282
|
+
const [expanded, setExpanded] = reactExports.useState(/* @__PURE__ */ new Set());
|
|
51283
|
+
const failed = results.filter((r) => r.status === "failed" || r.status === "error").length;
|
|
51284
|
+
function toggle(id2) {
|
|
51285
|
+
setExpanded((prev) => {
|
|
51286
|
+
const next = new Set(prev);
|
|
51287
|
+
if (next.has(id2)) {
|
|
51288
|
+
next.delete(id2);
|
|
51289
|
+
} else {
|
|
51290
|
+
next.add(id2);
|
|
51291
|
+
}
|
|
51292
|
+
return next;
|
|
51293
|
+
});
|
|
51294
|
+
}
|
|
51295
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-b border-surface-800 flex-shrink-0", children: [
|
|
51296
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
51297
|
+
"button",
|
|
51298
|
+
{
|
|
51299
|
+
onClick: () => setOpen((o) => !o),
|
|
51300
|
+
className: "w-full flex items-center gap-2 px-4 py-1.5 text-xs hover:bg-surface-800/30 transition-colors",
|
|
51301
|
+
children: [
|
|
51302
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-surface-400", children: open ? "▾" : "▸" }),
|
|
51303
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-surface-400", children: "Hooks" }),
|
|
51304
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-surface-500", children: [
|
|
51305
|
+
results.length,
|
|
51306
|
+
" ran"
|
|
51307
|
+
] }),
|
|
51308
|
+
failed > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ml-1 px-1.5 py-0.5 rounded text-[10px] bg-red-800/60 text-red-300", children: [
|
|
51309
|
+
failed,
|
|
51310
|
+
" failed"
|
|
51311
|
+
] })
|
|
51312
|
+
]
|
|
51313
|
+
}
|
|
51314
|
+
),
|
|
51315
|
+
open && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4 pb-2 flex flex-col gap-0.5", children: results.map((r, i) => {
|
|
51316
|
+
const badge = HOOK_BADGE$1[r.hookType ?? ""];
|
|
51317
|
+
const hasDetail = (r.consoleOutput?.length ?? 0) > 0 || (r.testResults?.length ?? 0) > 0 || r.error || r.preScriptError || r.postScriptError;
|
|
51318
|
+
const isExpanded = expanded.has(r.requestId + i);
|
|
51319
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs", children: [
|
|
51320
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
51321
|
+
"div",
|
|
51322
|
+
{
|
|
51323
|
+
className: `flex items-center gap-2 py-0.5 ${hasDetail ? "cursor-pointer hover:bg-surface-800/20 rounded px-1 -mx-1" : ""}`,
|
|
51324
|
+
onClick: () => hasDetail && toggle(r.requestId + i),
|
|
51325
|
+
children: [
|
|
51326
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `w-1.5 h-1.5 rounded-full shrink-0 ${r.status === "passed" ? "bg-emerald-500" : r.status === "failed" ? "bg-red-500" : "bg-orange-500"}` }),
|
|
51327
|
+
badge && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[9px] font-bold px-1 py-0.5 rounded uppercase tracking-wide shrink-0 ${badge.cls}`, children: badge.label }),
|
|
51328
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-surface-300 truncate", children: r.name }),
|
|
51329
|
+
r.httpStatus !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `ml-auto shrink-0 font-mono ${r.httpStatus < 400 ? "text-emerald-400" : "text-red-400"}`, children: r.httpStatus }),
|
|
51330
|
+
r.durationMs !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-surface-500 shrink-0", children: [
|
|
51331
|
+
r.durationMs,
|
|
51332
|
+
"ms"
|
|
51333
|
+
] }),
|
|
51334
|
+
hasDetail && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-surface-500 shrink-0", children: isExpanded ? "▾" : "▸" })
|
|
51335
|
+
]
|
|
51336
|
+
}
|
|
51337
|
+
),
|
|
51338
|
+
isExpanded && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "ml-5 mt-0.5 mb-1 flex flex-col gap-1", children: [
|
|
51339
|
+
r.error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-red-400 font-mono text-[10px] whitespace-pre-wrap", children: r.error }),
|
|
51340
|
+
(r.preScriptError || r.postScriptError) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-orange-400 font-mono text-[10px] whitespace-pre-wrap", children: r.preScriptError ?? r.postScriptError }),
|
|
51341
|
+
r.testResults?.map((t2, ti) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `flex items-center gap-1.5 ${t2.passed ? "text-emerald-400" : "text-red-400"}`, children: [
|
|
51342
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2.passed ? "✓" : "✗" }),
|
|
51343
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2.name }),
|
|
51344
|
+
t2.error && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-surface-500 text-[10px]", children: [
|
|
51345
|
+
"— ",
|
|
51346
|
+
t2.error
|
|
51347
|
+
] })
|
|
51348
|
+
] }, ti)),
|
|
51349
|
+
r.consoleOutput?.map((line, li) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-mono text-[10px] text-surface-400", children: line }, li))
|
|
51350
|
+
] })
|
|
51351
|
+
] }, r.requestId + i);
|
|
51352
|
+
}) })
|
|
51353
|
+
] });
|
|
51354
|
+
}
|
|
51020
51355
|
function SaveAsMockModal({ onClose }) {
|
|
51021
51356
|
const mocks = useStore((s) => s.mocks);
|
|
51022
51357
|
const addMock = useStore((s) => s.addMock);
|
|
@@ -51298,6 +51633,7 @@ function ResponseViewer() {
|
|
|
51298
51633
|
const response = activeTab?.lastResponse ?? null;
|
|
51299
51634
|
const scriptResult = activeTab?.lastScriptResult ?? null;
|
|
51300
51635
|
const sentRequest = activeTab?.lastSentRequest ?? null;
|
|
51636
|
+
const hookResults = activeTab?.lastHookResults ?? null;
|
|
51301
51637
|
const requestId = activeTab?.requestId ?? null;
|
|
51302
51638
|
const [tab, setTab] = reactExports.useState("body");
|
|
51303
51639
|
reactExports.useEffect(() => {
|
|
@@ -51370,6 +51706,7 @@ function ResponseViewer() {
|
|
|
51370
51706
|
{ id: "console", label: "Console", badge: hasScriptError ? "!" : consoleCount > 0 ? consoleCount : void 0, error: hasScriptError }
|
|
51371
51707
|
];
|
|
51372
51708
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col", children: [
|
|
51709
|
+
hookResults && hookResults.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(HookResultsPanel, { results: hookResults }),
|
|
51373
51710
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 px-4 py-1.5 border-b border-surface-800 flex-shrink-0 overflow-x-auto", children: [
|
|
51374
51711
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: `text-sm font-bold shrink-0 ${getStatusColor(response.status)}`, children: [
|
|
51375
51712
|
response.status,
|
|
@@ -53578,92 +53915,6 @@ ${failures.join("\n")}
|
|
|
53578
53915
|
];
|
|
53579
53916
|
return lines.join("\n") + "\n";
|
|
53580
53917
|
}
|
|
53581
|
-
function findFolderById(root2, id2) {
|
|
53582
|
-
if (root2.id === id2) return root2;
|
|
53583
|
-
for (const sub of root2.folders) {
|
|
53584
|
-
const found = findFolderById(sub, id2);
|
|
53585
|
-
if (found) return found;
|
|
53586
|
-
}
|
|
53587
|
-
return null;
|
|
53588
|
-
}
|
|
53589
|
-
function makeHook(req, collectionVars, hookType, scopeId, scopeAncestors, mainRequestId) {
|
|
53590
|
-
return { request: req, collectionVars, isHook: true, hookType, scopeId, scopeAncestors, mainRequestId };
|
|
53591
|
-
}
|
|
53592
|
-
function buildFolderPlan(folder, requests, collectionVars, filterTags, scopeId, ancestorIds, wrappers) {
|
|
53593
|
-
const result = [];
|
|
53594
|
-
const folderReqs = folder.requestIds.map((id2) => requests[id2]).filter(Boolean);
|
|
53595
|
-
const beforeAllHooks = folderReqs.filter((r) => r.hookType === "beforeAll");
|
|
53596
|
-
const beforeHooks = folderReqs.filter((r) => r.hookType === "before");
|
|
53597
|
-
const afterHooks = folderReqs.filter((r) => r.hookType === "after");
|
|
53598
|
-
const afterAllHooks = folderReqs.filter((r) => r.hookType === "afterAll");
|
|
53599
|
-
const regularReqs = folderReqs.filter((r) => !r.hookType);
|
|
53600
|
-
const myWrapper = { scopeId, ancestors: ancestorIds, before: beforeHooks, after: afterHooks };
|
|
53601
|
-
const allWrappers = [...wrappers, myWrapper];
|
|
53602
|
-
for (const req of beforeAllHooks) {
|
|
53603
|
-
result.push(makeHook(req, collectionVars, "beforeAll", scopeId, ancestorIds));
|
|
53604
|
-
}
|
|
53605
|
-
for (const req of regularReqs) {
|
|
53606
|
-
const tags2 = req.meta?.tags ?? [];
|
|
53607
|
-
if (filterTags.length > 0 && !filterTags.some((t2) => tags2.includes(t2))) continue;
|
|
53608
|
-
for (const w of allWrappers) {
|
|
53609
|
-
for (const hookReq of w.before) {
|
|
53610
|
-
result.push(makeHook(hookReq, collectionVars, "before", w.scopeId, w.ancestors, req.id));
|
|
53611
|
-
}
|
|
53612
|
-
}
|
|
53613
|
-
result.push({ request: req, collectionVars, scopeId, scopeAncestors: ancestorIds });
|
|
53614
|
-
for (const w of [...allWrappers].reverse()) {
|
|
53615
|
-
for (const hookReq of w.after) {
|
|
53616
|
-
result.push(makeHook(hookReq, collectionVars, "after", w.scopeId, w.ancestors, req.id));
|
|
53617
|
-
}
|
|
53618
|
-
}
|
|
53619
|
-
}
|
|
53620
|
-
for (const sub of folder.folders) {
|
|
53621
|
-
const folderTags = sub.tags ?? [];
|
|
53622
|
-
const effectiveFilter = filterTags.length === 0 ? filterTags : folderTags.some((t2) => filterTags.includes(t2)) ? [] : filterTags;
|
|
53623
|
-
result.push(...buildFolderPlan(
|
|
53624
|
-
sub,
|
|
53625
|
-
requests,
|
|
53626
|
-
collectionVars,
|
|
53627
|
-
effectiveFilter,
|
|
53628
|
-
sub.id,
|
|
53629
|
-
[...ancestorIds, scopeId],
|
|
53630
|
-
allWrappers
|
|
53631
|
-
));
|
|
53632
|
-
}
|
|
53633
|
-
for (const req of afterAllHooks) {
|
|
53634
|
-
result.push(makeHook(req, collectionVars, "afterAll", scopeId, ancestorIds));
|
|
53635
|
-
}
|
|
53636
|
-
return result;
|
|
53637
|
-
}
|
|
53638
|
-
function collectAllTags(folder, requests) {
|
|
53639
|
-
const tags2 = /* @__PURE__ */ new Set();
|
|
53640
|
-
function walk(f) {
|
|
53641
|
-
(f.tags ?? []).forEach((t2) => tags2.add(t2));
|
|
53642
|
-
for (const reqId of f.requestIds) {
|
|
53643
|
-
(requests[reqId]?.meta?.tags ?? []).forEach((t2) => tags2.add(t2));
|
|
53644
|
-
}
|
|
53645
|
-
f.folders.forEach(walk);
|
|
53646
|
-
}
|
|
53647
|
-
walk(folder);
|
|
53648
|
-
return Array.from(tags2).sort();
|
|
53649
|
-
}
|
|
53650
|
-
function buildRunPlan(collection, folderId, filterTags) {
|
|
53651
|
-
const collectionVars = collection.collectionVariables ?? {};
|
|
53652
|
-
if (folderId) {
|
|
53653
|
-
const folder = findFolderById(collection.rootFolder, folderId);
|
|
53654
|
-
if (!folder) return [];
|
|
53655
|
-
return buildFolderPlan(folder, collection.requests, collectionVars, filterTags, folder.id, [], []);
|
|
53656
|
-
}
|
|
53657
|
-
return buildFolderPlan(
|
|
53658
|
-
collection.rootFolder,
|
|
53659
|
-
collection.requests,
|
|
53660
|
-
collectionVars,
|
|
53661
|
-
filterTags,
|
|
53662
|
-
collection.rootFolder.id,
|
|
53663
|
-
[],
|
|
53664
|
-
[]
|
|
53665
|
-
);
|
|
53666
|
-
}
|
|
53667
53918
|
function buildCliArgs(wsPath, envName, tags2) {
|
|
53668
53919
|
const parts = [`node out/main/runner.js --workspace ${wsPath}`];
|
|
53669
53920
|
if (envName) parts.push(`--env "${envName}"`);
|
|
@@ -56742,7 +56993,7 @@ function App() {
|
|
|
56742
56993
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "#6aa3c8" }, children: "Spector" }),
|
|
56743
56994
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ml-2 text-[10px] font-normal opacity-50", children: [
|
|
56744
56995
|
"v",
|
|
56745
|
-
"0.1.
|
|
56996
|
+
"0.1.7"
|
|
56746
56997
|
] }),
|
|
56747
56998
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mx-2 opacity-30", children: "·" }),
|
|
56748
56999
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|