@oomol-lab/open-flow 0.1.0-beta.53 → 0.1.0-beta.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/{createResourceDialog-BsaBMf7_.js → createResourceDialog-4H5_lZ6s.js} +3 -3
- package/dist/browser/{main-BPABKzwN.js → dist-BFmpkX4P.js} +9 -1
- package/dist/browser/flow-authoring-node.d.ts +5 -0
- package/dist/browser/flow-authoring.d.ts +1 -1
- package/dist/browser/flow-authoring.js +9434 -9187
- package/dist/browser/flow-change.d.ts +6 -1
- package/dist/browser/flow-change.js +3108 -141
- package/dist/browser/{flowChanges-CcscgZsW.js → flowChanges-ZzG-f9cg.js} +1978 -5437
- package/dist/browser/{flowWorkspace-CoT_ewLX.js → flowWorkspace-ChpRaTMX.js} +3197 -310
- package/dist/browser/{icons-0s-Q_3lp.js → icons-CdAB9wyS.js} +4294 -54
- package/dist/browser/{markdownContent-D3FFc-u_.js → markdownContent-frwDfQQU.js} +1 -2
- package/dist/browser/preview.css +375 -322
- package/dist/browser/preview.js +5458 -1888
- package/dist/browser/theme.css +1 -0
- package/dist/browser/ui.css +30 -0
- package/dist/browser/ui.js +4 -3
- package/dist/browser/workbench.css +375 -322
- package/dist/browser/workbench.js +28 -16
- package/dist/browser/{workbenchSelect-BqUPacsr.js → workbenchSelect-BRZN4ish.js} +1 -1
- package/dist/common/authoringExamples.d.ts +3 -2
- package/dist/common/control-api-conformance.js +3410 -3285
- package/dist/common/control-api.js +3680 -3531
- package/dist/common/control-requests.js +2132 -1860
- package/dist/common/decision.d.ts +47 -0
- package/dist/common/decision.js +10153 -0
- package/dist/common/flow-encoding.js +3105 -124
- package/dist/common/flow-semantics.js +276 -2
- package/dist/common/integration-trigger.js +202 -1
- package/dist/common/mcp.js +3748 -3623
- package/dist/common/openapi.js +202 -1
- package/dist/common/poll-trigger.js +226 -1
- package/dist/common/run-events.js +1 -0
- package/dist/common/runtime-contract.d.ts +8 -0
- package/dist/common/scheduler.d.ts +1 -1
- package/dist/common/scheduler.js +2137 -1936
- package/dist/common/webhook-trigger.js +202 -1
- package/package.json +5 -1
- package/dist/browser/dist-BDBTOgS5.js +0 -9
|
@@ -2251,6 +2251,70 @@ var $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
|
2251
2251
|
});
|
|
2252
2252
|
};
|
|
2253
2253
|
});
|
|
2254
|
+
function discriminatorMap(def) {
|
|
2255
|
+
const map = /* @__PURE__ */ new Map();
|
|
2256
|
+
for (const option of def.options) {
|
|
2257
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
2258
|
+
if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
2259
|
+
for (const value of values) if (map.has(value)) {
|
|
2260
|
+
if (value !== void 0) throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
2261
|
+
map.set(value, null);
|
|
2262
|
+
} else map.set(value, option);
|
|
2263
|
+
}
|
|
2264
|
+
return map;
|
|
2265
|
+
}
|
|
2266
|
+
var $ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
2267
|
+
def.inclusive = false;
|
|
2268
|
+
$ZodUnion.init(inst, def);
|
|
2269
|
+
const _super = inst._zod.parse;
|
|
2270
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
2271
|
+
const propValues = {};
|
|
2272
|
+
let undefinedCount = 0;
|
|
2273
|
+
for (const option of zod.def.options) {
|
|
2274
|
+
const pv = option._zod.propValues;
|
|
2275
|
+
if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
2276
|
+
if (pv[zod.def.discriminator]?.has(void 0)) undefinedCount++;
|
|
2277
|
+
for (const [k, v] of Object.entries(pv)) {
|
|
2278
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, k)) assignProp(propValues, k, /* @__PURE__ */ new Set());
|
|
2279
|
+
for (const val of v) propValues[k].add(val);
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
if (!zod.def.unionFallback && undefinedCount > 1) propValues[zod.def.discriminator]?.delete(void 0);
|
|
2283
|
+
return propValues;
|
|
2284
|
+
});
|
|
2285
|
+
def.options.forEach((option, i) => {
|
|
2286
|
+
const propShape = rawShape(option._zod.def);
|
|
2287
|
+
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
2288
|
+
});
|
|
2289
|
+
const disc = cached(() => discriminatorMap(def));
|
|
2290
|
+
inst._zod.parse = (payload, ctx) => {
|
|
2291
|
+
const input = payload.value;
|
|
2292
|
+
if (!isObject$1(input)) {
|
|
2293
|
+
payload.issues.push({
|
|
2294
|
+
code: "invalid_type",
|
|
2295
|
+
expected: "object",
|
|
2296
|
+
input,
|
|
2297
|
+
inst
|
|
2298
|
+
});
|
|
2299
|
+
return payload;
|
|
2300
|
+
}
|
|
2301
|
+
const value = input?.[def.discriminator];
|
|
2302
|
+
const opt = disc.value.get(value);
|
|
2303
|
+
if (opt && (value !== void 0 || ctx.direction !== "backward")) return opt._zod.run(payload, ctx);
|
|
2304
|
+
if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
|
|
2305
|
+
payload.issues.push({
|
|
2306
|
+
code: "invalid_union",
|
|
2307
|
+
errors: [],
|
|
2308
|
+
note: "No matching discriminator",
|
|
2309
|
+
discriminator: def.discriminator,
|
|
2310
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
2311
|
+
input,
|
|
2312
|
+
path: [def.discriminator],
|
|
2313
|
+
inst
|
|
2314
|
+
});
|
|
2315
|
+
return payload;
|
|
2316
|
+
};
|
|
2317
|
+
});
|
|
2254
2318
|
var $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def) => {
|
|
2255
2319
|
$ZodType.init(inst, def);
|
|
2256
2320
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -5485,6 +5549,18 @@ function union(options, params) {
|
|
|
5485
5549
|
...normalizeParams(params)
|
|
5486
5550
|
});
|
|
5487
5551
|
}
|
|
5552
|
+
var ZodDiscriminatedUnion = /*@__PURE__*/ $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
5553
|
+
ZodUnion.init(inst, def);
|
|
5554
|
+
$ZodDiscriminatedUnion.init(inst, def);
|
|
5555
|
+
});
|
|
5556
|
+
function discriminatedUnion(discriminator, options, params) {
|
|
5557
|
+
return new ZodDiscriminatedUnion({
|
|
5558
|
+
type: "union",
|
|
5559
|
+
options,
|
|
5560
|
+
discriminator,
|
|
5561
|
+
...normalizeParams(params)
|
|
5562
|
+
});
|
|
5563
|
+
}
|
|
5488
5564
|
var ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def) => {
|
|
5489
5565
|
$ZodIntersection.init(inst, def);
|
|
5490
5566
|
ZodType.init(inst, def);
|
|
@@ -5775,818 +5851,219 @@ function inputValues(values) {
|
|
|
5775
5851
|
value
|
|
5776
5852
|
}]));
|
|
5777
5853
|
}
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5854
|
+
//#endregion
|
|
5855
|
+
//#region ../../node_modules/.bun/dequal@2.0.3/node_modules/dequal/lite/index.mjs
|
|
5856
|
+
var has = Object.prototype.hasOwnProperty;
|
|
5857
|
+
function dequal(foo, bar) {
|
|
5858
|
+
var ctor, len;
|
|
5859
|
+
if (foo === bar) return true;
|
|
5860
|
+
if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
|
|
5861
|
+
if (ctor === Date) return foo.getTime() === bar.getTime();
|
|
5862
|
+
if (ctor === RegExp) return foo.toString() === bar.toString();
|
|
5863
|
+
if (ctor === Array) {
|
|
5864
|
+
if ((len = foo.length) === bar.length) while (len-- && dequal(foo[len], bar[len]));
|
|
5865
|
+
return len === -1;
|
|
5866
|
+
}
|
|
5867
|
+
if (!ctor || typeof foo === "object") {
|
|
5868
|
+
len = 0;
|
|
5869
|
+
for (ctor in foo) {
|
|
5870
|
+
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
|
|
5871
|
+
if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
|
|
5872
|
+
}
|
|
5873
|
+
return Object.keys(bar).length === len;
|
|
5874
|
+
}
|
|
5875
|
+
}
|
|
5876
|
+
return foo !== foo && bar !== bar;
|
|
5781
5877
|
}
|
|
5782
5878
|
//#endregion
|
|
5783
|
-
//#region
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5879
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
|
|
5880
|
+
function deepCompareStrict(a, b) {
|
|
5881
|
+
const typeofa = typeof a;
|
|
5882
|
+
if (typeofa !== typeof b) return false;
|
|
5883
|
+
if (Array.isArray(a)) {
|
|
5884
|
+
if (!Array.isArray(b)) return false;
|
|
5885
|
+
const length = a.length;
|
|
5886
|
+
if (length !== b.length) return false;
|
|
5887
|
+
for (let i = 0; i < length; i++) if (!deepCompareStrict(a[i], b[i])) return false;
|
|
5888
|
+
return true;
|
|
5889
|
+
}
|
|
5890
|
+
if (typeofa === "object") {
|
|
5891
|
+
if (!a || !b) return a === b;
|
|
5892
|
+
const aKeys = Object.keys(a);
|
|
5893
|
+
const bKeys = Object.keys(b);
|
|
5894
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
5895
|
+
for (const k of aKeys) if (!deepCompareStrict(a[k], b[k])) return false;
|
|
5896
|
+
return true;
|
|
5897
|
+
}
|
|
5898
|
+
return a === b;
|
|
5899
|
+
}
|
|
5799
5900
|
//#endregion
|
|
5800
|
-
//#region
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
"
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
var
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
handle: text$1
|
|
5816
|
-
});
|
|
5817
|
-
var input = port.extend({ value: json$2.optional() });
|
|
5818
|
-
var group = object$1({
|
|
5819
|
-
collapsed: boolean().optional(),
|
|
5820
|
-
group: text$1
|
|
5821
|
-
});
|
|
5822
|
-
var nodeSource = object$1({
|
|
5823
|
-
kind: literal("node"),
|
|
5824
|
-
nodeId: text$1,
|
|
5825
|
-
output: text$1,
|
|
5826
|
-
field: text$1.optional()
|
|
5827
|
-
});
|
|
5828
|
-
var flowSource = object$1({
|
|
5829
|
-
kind: literal("flow"),
|
|
5830
|
-
input: text$1
|
|
5831
|
-
});
|
|
5832
|
-
var source = union([
|
|
5833
|
-
nodeSource,
|
|
5834
|
-
flowSource,
|
|
5835
|
-
object$1({
|
|
5836
|
-
kind: literal("binding"),
|
|
5837
|
-
bindingId: text$1
|
|
5838
|
-
})
|
|
5839
|
-
]);
|
|
5840
|
-
var fixedInput = union([object$1({ kind: literal("unset") }), object$1({
|
|
5841
|
-
kind: literal("value"),
|
|
5842
|
-
value: json$2
|
|
5843
|
-
})]);
|
|
5844
|
-
var mapping = union([fixedInput, object$1({
|
|
5845
|
-
kind: literal("sources"),
|
|
5846
|
-
sources: array(source)
|
|
5847
|
-
})]);
|
|
5848
|
-
var inputs$1 = record(text$1, mapping);
|
|
5849
|
-
var ports = {
|
|
5850
|
-
inputs: array(union([input, group])),
|
|
5851
|
-
outputs: array(union([port, group]))
|
|
5901
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/pointer.js
|
|
5902
|
+
function encodePointer(p) {
|
|
5903
|
+
return encodeURI(escapePointer(p));
|
|
5904
|
+
}
|
|
5905
|
+
function escapePointer(p) {
|
|
5906
|
+
return p.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
5907
|
+
}
|
|
5908
|
+
//#endregion
|
|
5909
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/dereference.js
|
|
5910
|
+
var schemaArrayKeyword = {
|
|
5911
|
+
prefixItems: true,
|
|
5912
|
+
items: true,
|
|
5913
|
+
allOf: true,
|
|
5914
|
+
anyOf: true,
|
|
5915
|
+
oneOf: true
|
|
5852
5916
|
};
|
|
5853
|
-
var
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
connectionId: text$1,
|
|
5860
|
-
alias: text$1.optional()
|
|
5861
|
-
}))
|
|
5862
|
-
}),
|
|
5863
|
-
strictObject({
|
|
5864
|
-
kind: literal("connector"),
|
|
5865
|
-
mode: literal("shared")
|
|
5866
|
-
}),
|
|
5867
|
-
strictObject({
|
|
5868
|
-
kind: literal("connector"),
|
|
5869
|
-
mode: literal("independent"),
|
|
5870
|
-
actions: array(strictObject({
|
|
5871
|
-
action: text$1,
|
|
5872
|
-
connectionId: text$1.optional()
|
|
5873
|
-
}))
|
|
5874
|
-
}),
|
|
5875
|
-
strictObject({
|
|
5876
|
-
kind: literal("connector"),
|
|
5877
|
-
actionHints: array(text$1).optional(),
|
|
5878
|
-
connectionHints: array(strictObject({
|
|
5879
|
-
action: text$1,
|
|
5880
|
-
connectionId: text$1,
|
|
5881
|
-
alias: text$1.optional()
|
|
5882
|
-
})).optional()
|
|
5883
|
-
})
|
|
5884
|
-
]);
|
|
5885
|
-
var inline = object$1({
|
|
5886
|
-
...ports,
|
|
5887
|
-
name: text$1,
|
|
5888
|
-
moduleId: text$1,
|
|
5889
|
-
capabilities: array(capability).optional()
|
|
5890
|
-
});
|
|
5891
|
-
var agentValue = union([object$1({
|
|
5892
|
-
kind: literal("value"),
|
|
5893
|
-
value: json$2
|
|
5894
|
-
}), object$1({
|
|
5895
|
-
kind: literal("input"),
|
|
5896
|
-
input: text$1
|
|
5897
|
-
})]);
|
|
5898
|
-
var agentInput = union([agentValue, object$1({ kind: literal("model") })]);
|
|
5899
|
-
var managed = object$1({
|
|
5900
|
-
...ports,
|
|
5901
|
-
name: text$1,
|
|
5902
|
-
executor: union([
|
|
5903
|
-
object$1({
|
|
5904
|
-
kind: literal("connector"),
|
|
5905
|
-
action: text$1,
|
|
5906
|
-
connectionId: text$1.optional()
|
|
5907
|
-
}),
|
|
5908
|
-
object$1({
|
|
5909
|
-
kind: literal("openapi"),
|
|
5910
|
-
sourceUrl: text$1,
|
|
5911
|
-
method: text$1,
|
|
5912
|
-
path: text$1,
|
|
5913
|
-
serverUrl: text$1,
|
|
5914
|
-
document: json$2,
|
|
5915
|
-
auth: array(object$1({
|
|
5916
|
-
id: text$1,
|
|
5917
|
-
type: _enum([
|
|
5918
|
-
"bearer",
|
|
5919
|
-
"basic",
|
|
5920
|
-
"apiKey"
|
|
5921
|
-
]),
|
|
5922
|
-
name: text$1.optional(),
|
|
5923
|
-
in: _enum(["header", "query"]).optional()
|
|
5924
|
-
}))
|
|
5925
|
-
}),
|
|
5926
|
-
object$1({
|
|
5927
|
-
kind: literal("llm"),
|
|
5928
|
-
mode: _enum(["chat", "json"])
|
|
5929
|
-
}),
|
|
5930
|
-
object$1({
|
|
5931
|
-
kind: literal("agent"),
|
|
5932
|
-
code: boolean().optional(),
|
|
5933
|
-
model: text$1,
|
|
5934
|
-
prompt: text$1,
|
|
5935
|
-
maxRounds: number(),
|
|
5936
|
-
tools: array(object$1({
|
|
5937
|
-
id: text$1,
|
|
5938
|
-
name: text$1,
|
|
5939
|
-
description: text$1,
|
|
5940
|
-
action: text$1,
|
|
5941
|
-
connectionId: text$1.optional(),
|
|
5942
|
-
approval: boolean(),
|
|
5943
|
-
inputs: array(input.extend({ source: agentInput }))
|
|
5944
|
-
})),
|
|
5945
|
-
notification: object$1({
|
|
5946
|
-
taskId: text$1,
|
|
5947
|
-
messageHandle: text$1,
|
|
5948
|
-
inputs: record(text$1, agentValue)
|
|
5949
|
-
}).optional()
|
|
5950
|
-
})
|
|
5951
|
-
])
|
|
5952
|
-
});
|
|
5953
|
-
var operand = union([object$1({
|
|
5954
|
-
kind: literal("value"),
|
|
5955
|
-
value: json$2.optional(),
|
|
5956
|
-
jsonSchema: json$2.optional()
|
|
5957
|
-
}), object$1({
|
|
5958
|
-
kind: literal("source"),
|
|
5959
|
-
source
|
|
5960
|
-
})]);
|
|
5961
|
-
var condition = {
|
|
5962
|
-
matchMode: _enum(["first", "all"]),
|
|
5963
|
-
cases: array(object$1({
|
|
5964
|
-
description: text$1.optional(),
|
|
5965
|
-
output: text$1,
|
|
5966
|
-
groups: array(object$1({ expressions: array(object$1({
|
|
5967
|
-
left: operand,
|
|
5968
|
-
operator: _enum([
|
|
5969
|
-
"!=",
|
|
5970
|
-
"<",
|
|
5971
|
-
"<=",
|
|
5972
|
-
"==",
|
|
5973
|
-
">",
|
|
5974
|
-
">=",
|
|
5975
|
-
"contains",
|
|
5976
|
-
"endsWith",
|
|
5977
|
-
"hasKey",
|
|
5978
|
-
"hasValue",
|
|
5979
|
-
"isEmpty",
|
|
5980
|
-
"isFalse",
|
|
5981
|
-
"isNotEmpty",
|
|
5982
|
-
"isNotNull",
|
|
5983
|
-
"isNull",
|
|
5984
|
-
"isTrue",
|
|
5985
|
-
"notContains",
|
|
5986
|
-
"notHasKey",
|
|
5987
|
-
"notHasValue",
|
|
5988
|
-
"startsWith"
|
|
5989
|
-
]),
|
|
5990
|
-
right: operand.optional()
|
|
5991
|
-
})) }))
|
|
5992
|
-
}))
|
|
5993
|
-
};
|
|
5994
|
-
var wait = {
|
|
5995
|
-
inputDefinitions: array(input),
|
|
5996
|
-
prompt: text$1
|
|
5997
|
-
};
|
|
5998
|
-
var webhookOptions = object$1({
|
|
5999
|
-
allowedMethods: never().optional(),
|
|
6000
|
-
allowedOrigins: strings.optional(),
|
|
6001
|
-
noResponseBody: never().optional(),
|
|
6002
|
-
responseData: text$1.optional(),
|
|
6003
|
-
responseHeaders: record(text$1, text$1).optional(),
|
|
6004
|
-
responseStatusCode: number().int().min(200).max(599).optional()
|
|
6005
|
-
});
|
|
6006
|
-
var webhook = {
|
|
6007
|
-
bodyFields: array(input),
|
|
6008
|
-
method: _enum(webhookMethods),
|
|
6009
|
-
options: webhookOptions.optional()
|
|
5917
|
+
var schemaMapKeyword = {
|
|
5918
|
+
$defs: true,
|
|
5919
|
+
definitions: true,
|
|
5920
|
+
properties: true,
|
|
5921
|
+
patternProperties: true,
|
|
5922
|
+
dependentSchemas: true
|
|
6010
5923
|
};
|
|
6011
|
-
var
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
5924
|
+
var ignoredKeyword = {
|
|
5925
|
+
id: true,
|
|
5926
|
+
$id: true,
|
|
5927
|
+
$ref: true,
|
|
5928
|
+
$schema: true,
|
|
5929
|
+
$anchor: true,
|
|
5930
|
+
$vocabulary: true,
|
|
5931
|
+
$comment: true,
|
|
5932
|
+
default: true,
|
|
5933
|
+
enum: true,
|
|
5934
|
+
const: true,
|
|
5935
|
+
required: true,
|
|
5936
|
+
type: true,
|
|
5937
|
+
maximum: true,
|
|
5938
|
+
minimum: true,
|
|
5939
|
+
exclusiveMaximum: true,
|
|
5940
|
+
exclusiveMinimum: true,
|
|
5941
|
+
multipleOf: true,
|
|
5942
|
+
maxLength: true,
|
|
5943
|
+
minLength: true,
|
|
5944
|
+
pattern: true,
|
|
5945
|
+
format: true,
|
|
5946
|
+
maxItems: true,
|
|
5947
|
+
minItems: true,
|
|
5948
|
+
uniqueItems: true,
|
|
5949
|
+
maxProperties: true,
|
|
5950
|
+
minProperties: true
|
|
6020
5951
|
};
|
|
6021
|
-
var
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
5952
|
+
var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
|
|
5953
|
+
function dereference(schema, lookup = Object.create(null), baseURI = initialBaseURI, basePointer = "") {
|
|
5954
|
+
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
5955
|
+
const id = schema.$id || schema.id;
|
|
5956
|
+
if (id) {
|
|
5957
|
+
const url = new URL(id, baseURI.href);
|
|
5958
|
+
if (url.hash.length > 1) lookup[url.href] = schema;
|
|
5959
|
+
else {
|
|
5960
|
+
url.hash = "";
|
|
5961
|
+
if (basePointer === "") baseURI = url;
|
|
5962
|
+
else dereference(schema, lookup, baseURI);
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5965
|
+
} else if (schema !== true && schema !== false) return lookup;
|
|
5966
|
+
const schemaURI = baseURI.href + (basePointer ? "#" + basePointer : "");
|
|
5967
|
+
if (lookup[schemaURI] !== void 0) throw new Error(`Duplicate schema URI "${schemaURI}".`);
|
|
5968
|
+
lookup[schemaURI] = schema;
|
|
5969
|
+
if (schema === true || schema === false) return lookup;
|
|
5970
|
+
if (schema.__absolute_uri__ === void 0) Object.defineProperty(schema, "__absolute_uri__", {
|
|
5971
|
+
enumerable: false,
|
|
5972
|
+
value: schemaURI
|
|
5973
|
+
});
|
|
5974
|
+
if (schema.$ref && schema.__absolute_ref__ === void 0) {
|
|
5975
|
+
const url = new URL(schema.$ref, baseURI.href);
|
|
5976
|
+
url.hash = url.hash;
|
|
5977
|
+
Object.defineProperty(schema, "__absolute_ref__", {
|
|
5978
|
+
enumerable: false,
|
|
5979
|
+
value: url.href
|
|
5980
|
+
});
|
|
5981
|
+
}
|
|
5982
|
+
if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === void 0) {
|
|
5983
|
+
const url = new URL(schema.$recursiveRef, baseURI.href);
|
|
5984
|
+
url.hash = url.hash;
|
|
5985
|
+
Object.defineProperty(schema, "__absolute_recursive_ref__", {
|
|
5986
|
+
enumerable: false,
|
|
5987
|
+
value: url.href
|
|
5988
|
+
});
|
|
5989
|
+
}
|
|
5990
|
+
if (schema.$anchor) {
|
|
5991
|
+
const url = new URL("#" + schema.$anchor, baseURI.href);
|
|
5992
|
+
lookup[url.href] = schema;
|
|
5993
|
+
}
|
|
5994
|
+
for (let key in schema) {
|
|
5995
|
+
if (ignoredKeyword[key]) continue;
|
|
5996
|
+
const keyBase = `${basePointer}/${encodePointer(key)}`;
|
|
5997
|
+
const subSchema = schema[key];
|
|
5998
|
+
if (Array.isArray(subSchema)) {
|
|
5999
|
+
if (schemaArrayKeyword[key]) {
|
|
6000
|
+
const length = subSchema.length;
|
|
6001
|
+
for (let i = 0; i < length; i++) dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
|
|
6002
|
+
}
|
|
6003
|
+
} else if (schemaMapKeyword[key]) for (let subKey in subSchema) dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
|
|
6004
|
+
else dereference(subSchema, lookup, baseURI, keyBase);
|
|
6005
|
+
}
|
|
6006
|
+
return lookup;
|
|
6007
|
+
}
|
|
6008
|
+
//#endregion
|
|
6009
|
+
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/format.js
|
|
6010
|
+
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
6011
|
+
var DAYS = [
|
|
6012
|
+
0,
|
|
6013
|
+
31,
|
|
6014
|
+
28,
|
|
6015
|
+
31,
|
|
6016
|
+
30,
|
|
6017
|
+
31,
|
|
6018
|
+
30,
|
|
6019
|
+
31,
|
|
6020
|
+
31,
|
|
6021
|
+
30,
|
|
6022
|
+
31,
|
|
6023
|
+
30,
|
|
6024
|
+
31
|
|
6025
|
+
];
|
|
6026
|
+
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
|
6027
|
+
var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
|
|
6028
|
+
var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
6029
|
+
var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
|
|
6030
|
+
var URL_ = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
|
6031
|
+
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
6032
|
+
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
|
6033
|
+
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
|
6034
|
+
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
|
6035
|
+
var EMAIL = (input) => {
|
|
6036
|
+
if (input[0] === "\"") return false;
|
|
6037
|
+
const [name, host, ...rest] = input.split("@");
|
|
6038
|
+
if (!name || !host || rest.length !== 0 || name.length > 64 || host.length > 253) return false;
|
|
6039
|
+
if (name[0] === "." || name.endsWith(".") || name.includes("..")) return false;
|
|
6040
|
+
if (!/^[a-z0-9.-]+$/i.test(host) || !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name)) return false;
|
|
6041
|
+
return host.split(".").every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
|
|
6047
6042
|
};
|
|
6048
|
-
var
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
subflowId: text$1
|
|
6073
|
-
}),
|
|
6074
|
-
object$1({
|
|
6075
|
-
...base,
|
|
6076
|
-
kind: literal("task"),
|
|
6077
|
-
task: inline,
|
|
6078
|
-
additionalInputs: array(input).optional()
|
|
6079
|
-
}),
|
|
6080
|
-
object$1({
|
|
6081
|
-
...base,
|
|
6082
|
-
kind: literal("task"),
|
|
6083
|
-
taskId: text$1,
|
|
6084
|
-
additionalInputs: array(input).optional()
|
|
6085
|
-
}),
|
|
6086
|
-
strictObject({
|
|
6087
|
-
...base,
|
|
6088
|
-
kind: literal("approval"),
|
|
6089
|
-
...wait
|
|
6090
|
-
}).omit({ timeoutMs: true }),
|
|
6091
|
-
strictObject({
|
|
6092
|
-
...base,
|
|
6093
|
-
kind: literal("wait"),
|
|
6094
|
-
...wait
|
|
6095
|
-
}).omit({ timeoutMs: true }),
|
|
6096
|
-
object$1({
|
|
6097
|
-
...trigger$1,
|
|
6098
|
-
kind: literal("manual")
|
|
6099
|
-
}),
|
|
6100
|
-
strictObject({
|
|
6101
|
-
...trigger$1,
|
|
6102
|
-
kind: literal("error"),
|
|
6103
|
-
sourceFlowIds: sourceFlowIds.optional()
|
|
6104
|
-
}),
|
|
6105
|
-
object$1({
|
|
6106
|
-
...trigger$1,
|
|
6107
|
-
kind: literal("webhook"),
|
|
6108
|
-
...webhook
|
|
6109
|
-
}),
|
|
6110
|
-
object$1({
|
|
6111
|
-
...trigger$1,
|
|
6112
|
-
kind: literal("cron"),
|
|
6113
|
-
cronTimes: triggerScheduleSchema
|
|
6114
|
-
}),
|
|
6115
|
-
object$1({
|
|
6116
|
-
...trigger$1,
|
|
6117
|
-
kind: literal("poll"),
|
|
6118
|
-
connectionId: text$1.min(1).optional(),
|
|
6119
|
-
config: record(text$1, fixedInput),
|
|
6120
|
-
definition: object$1({
|
|
6121
|
-
...definition,
|
|
6122
|
-
type: literal("poll")
|
|
6123
|
-
}),
|
|
6124
|
-
pollTimes: triggerScheduleSchema
|
|
6125
|
-
}),
|
|
6126
|
-
object$1({
|
|
6127
|
-
...trigger$1,
|
|
6128
|
-
kind: literal("integration"),
|
|
6129
|
-
connectionId: text$1.min(1).optional(),
|
|
6130
|
-
config: record(text$1, fixedInput),
|
|
6131
|
-
definition: object$1({
|
|
6132
|
-
...definition,
|
|
6133
|
-
type: literal("integration"),
|
|
6134
|
-
endpoint
|
|
6135
|
-
})
|
|
6136
|
-
})
|
|
6137
|
-
]);
|
|
6138
|
-
var target$1 = union([object$1({ kind: literal("flow") }), object$1({
|
|
6139
|
-
kind: literal("subflow"),
|
|
6140
|
-
id: text$1
|
|
6141
|
-
})]);
|
|
6142
|
-
var edge = object$1({
|
|
6143
|
-
source: text$1,
|
|
6144
|
-
target: text$1,
|
|
6145
|
-
sourceHandle: text$1.optional()
|
|
6146
|
-
});
|
|
6147
|
-
var at = {
|
|
6148
|
-
nodeId: text$1,
|
|
6149
|
-
target: target$1
|
|
6150
|
-
};
|
|
6151
|
-
var subflow = object$1({
|
|
6152
|
-
name: text$1,
|
|
6153
|
-
inputs: array(input),
|
|
6154
|
-
outputs: array(port.extend({ sources: array(union([nodeSource, flowSource])) }))
|
|
6155
|
-
});
|
|
6156
|
-
var graph = object$1({
|
|
6157
|
-
nodes: record(text$1, node),
|
|
6158
|
-
edges: array(edge).default([])
|
|
6159
|
-
});
|
|
6160
|
-
var binding = object$1({
|
|
6161
|
-
kind: literal("variable"),
|
|
6162
|
-
target: text$1
|
|
6163
|
-
});
|
|
6164
|
-
var module = object$1({
|
|
6165
|
-
name: text$1,
|
|
6166
|
-
imports: strings,
|
|
6167
|
-
source: text$1
|
|
6168
|
-
});
|
|
6169
|
-
var document = object$1({
|
|
6170
|
-
bindings: record(text$1, binding),
|
|
6171
|
-
graph,
|
|
6172
|
-
subflows: record(text$1, subflow.extend({ graph })),
|
|
6173
|
-
tasks: record(text$1, managed)
|
|
6174
|
-
});
|
|
6175
|
-
object$1({
|
|
6176
|
-
modelVersion: union([
|
|
6177
|
-
literal(2),
|
|
6178
|
-
literal(4),
|
|
6179
|
-
literal(5)
|
|
6180
|
-
]),
|
|
6181
|
-
document,
|
|
6182
|
-
modules: record(text$1, module)
|
|
6183
|
-
}).extend({
|
|
6184
|
-
kind: literal("open-flow-flow-revision"),
|
|
6185
|
-
version: literal(1)
|
|
6186
|
-
});
|
|
6187
|
-
var shapes = {
|
|
6188
|
-
"graph.trigger.sources.set": {
|
|
6189
|
-
nodeId: text$1,
|
|
6190
|
-
before: sourceFlowIds.optional(),
|
|
6191
|
-
value: sourceFlowIds.optional()
|
|
6192
|
-
},
|
|
6193
|
-
"binding.create": {
|
|
6194
|
-
bindingId: text$1,
|
|
6195
|
-
binding
|
|
6196
|
-
},
|
|
6197
|
-
"binding.delete": { bindingId: text$1 },
|
|
6198
|
-
"binding.target.set": {
|
|
6199
|
-
bindingId: text$1,
|
|
6200
|
-
before: text$1,
|
|
6201
|
-
value: text$1
|
|
6202
|
-
},
|
|
6203
|
-
"graph.edge.connect": {
|
|
6204
|
-
target: target$1,
|
|
6205
|
-
edge
|
|
6206
|
-
},
|
|
6207
|
-
"graph.edge.disconnect": {
|
|
6208
|
-
target: target$1,
|
|
6209
|
-
edge
|
|
6210
|
-
},
|
|
6211
|
-
"graph.node.create": {
|
|
6212
|
-
...at,
|
|
6213
|
-
node
|
|
6214
|
-
},
|
|
6215
|
-
"graph.node.delete": at,
|
|
6216
|
-
"graph.node.field.set": union([
|
|
6217
|
-
object$1({
|
|
6218
|
-
...at,
|
|
6219
|
-
kind: literal("graph.node.field.set"),
|
|
6220
|
-
field: literal("connectionId"),
|
|
6221
|
-
before: text$1.min(1).optional(),
|
|
6222
|
-
value: text$1.min(1).optional()
|
|
6223
|
-
}),
|
|
6224
|
-
object$1({
|
|
6225
|
-
...at,
|
|
6226
|
-
kind: literal("graph.node.field.set"),
|
|
6227
|
-
field: _enum([
|
|
6228
|
-
"description",
|
|
6229
|
-
"icon",
|
|
6230
|
-
"name"
|
|
6231
|
-
]),
|
|
6232
|
-
before: text$1.optional(),
|
|
6233
|
-
value: text$1.optional()
|
|
6234
|
-
}),
|
|
6235
|
-
object$1({
|
|
6236
|
-
...at,
|
|
6237
|
-
kind: literal("graph.node.field.set"),
|
|
6238
|
-
field: literal("maxExecutions"),
|
|
6239
|
-
before: number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
|
|
6240
|
-
value: number().int().positive().max(Number.MAX_SAFE_INTEGER).optional()
|
|
6241
|
-
}),
|
|
6242
|
-
object$1({
|
|
6243
|
-
...at,
|
|
6244
|
-
kind: literal("graph.node.field.set"),
|
|
6245
|
-
field: literal("timeoutMs"),
|
|
6246
|
-
before: number().optional(),
|
|
6247
|
-
value: number().optional()
|
|
6248
|
-
})
|
|
6249
|
-
]),
|
|
6250
|
-
"graph.node.input.set": {
|
|
6251
|
-
...at,
|
|
6252
|
-
handle: text$1,
|
|
6253
|
-
before: mapping.optional(),
|
|
6254
|
-
value: mapping.optional()
|
|
6255
|
-
},
|
|
6256
|
-
"graph.node.additional-inputs.set": {
|
|
6257
|
-
...at,
|
|
6258
|
-
before: array(input).optional(),
|
|
6259
|
-
value: array(input).optional()
|
|
6260
|
-
},
|
|
6261
|
-
"graph.node.condition.set": {
|
|
6262
|
-
...at,
|
|
6263
|
-
before: object$1(condition),
|
|
6264
|
-
value: object$1(condition)
|
|
6265
|
-
},
|
|
6266
|
-
"graph.node.values.set": {
|
|
6267
|
-
...at,
|
|
6268
|
-
before: array(input),
|
|
6269
|
-
value: array(input)
|
|
6270
|
-
},
|
|
6271
|
-
"graph.node.resolution.set": {
|
|
6272
|
-
...at,
|
|
6273
|
-
target: object$1({ kind: literal("flow") }),
|
|
6274
|
-
before: object$1(wait),
|
|
6275
|
-
value: object$1(wait)
|
|
6276
|
-
},
|
|
6277
|
-
"graph.node.webhook.set": {
|
|
6278
|
-
...at,
|
|
6279
|
-
target: object$1({ kind: literal("flow") }),
|
|
6280
|
-
before: object$1(webhook),
|
|
6281
|
-
value: object$1(webhook)
|
|
6282
|
-
},
|
|
6283
|
-
"graph.node.task.ports.set": {
|
|
6284
|
-
...at,
|
|
6285
|
-
before: object$1(ports),
|
|
6286
|
-
value: object$1(ports)
|
|
6287
|
-
},
|
|
6288
|
-
"graph.node.task.name.set": {
|
|
6289
|
-
...at,
|
|
6290
|
-
before: text$1,
|
|
6291
|
-
value: text$1
|
|
6292
|
-
},
|
|
6293
|
-
"graph.node.task.capabilities.set": {
|
|
6294
|
-
...at,
|
|
6295
|
-
before: array(capability).optional(),
|
|
6296
|
-
value: array(capability).optional()
|
|
6297
|
-
},
|
|
6298
|
-
"graph.trigger.config.set": {
|
|
6299
|
-
nodeId: text$1,
|
|
6300
|
-
name: text$1,
|
|
6301
|
-
before: fixedInput.optional(),
|
|
6302
|
-
value: fixedInput.optional()
|
|
6303
|
-
},
|
|
6304
|
-
"graph.trigger.schedule.set": {
|
|
6305
|
-
nodeId: text$1,
|
|
6306
|
-
before: triggerScheduleSchema,
|
|
6307
|
-
value: triggerScheduleSchema
|
|
6308
|
-
},
|
|
6309
|
-
"module.create": {
|
|
6310
|
-
moduleId: text$1,
|
|
6311
|
-
module
|
|
6312
|
-
},
|
|
6313
|
-
"module.delete": { moduleId: text$1 },
|
|
6314
|
-
"module.rename": {
|
|
6315
|
-
moduleId: text$1,
|
|
6316
|
-
before: text$1,
|
|
6317
|
-
name: text$1
|
|
6318
|
-
},
|
|
6319
|
-
"module.source.replace": {
|
|
6320
|
-
moduleId: text$1,
|
|
6321
|
-
beforeImports: strings,
|
|
6322
|
-
beforeSource: text$1,
|
|
6323
|
-
imports: strings,
|
|
6324
|
-
source: text$1
|
|
6325
|
-
},
|
|
6326
|
-
"subflow.create": {
|
|
6327
|
-
subflowId: text$1,
|
|
6328
|
-
subflow: subflow.extend({ graph })
|
|
6329
|
-
},
|
|
6330
|
-
"subflow.definition.set": {
|
|
6331
|
-
subflowId: text$1,
|
|
6332
|
-
before: subflow,
|
|
6333
|
-
definition: subflow
|
|
6334
|
-
},
|
|
6335
|
-
"subflow.delete": { subflowId: text$1 },
|
|
6336
|
-
"task.create": {
|
|
6337
|
-
taskId: text$1,
|
|
6338
|
-
task: managed
|
|
6339
|
-
},
|
|
6340
|
-
"task.delete": { taskId: text$1 },
|
|
6341
|
-
"task.connector.connection.set": {
|
|
6342
|
-
taskId: text$1,
|
|
6343
|
-
before: text$1.optional(),
|
|
6344
|
-
value: text$1.optional()
|
|
6345
|
-
},
|
|
6346
|
-
"task.openapi.set": {
|
|
6347
|
-
taskId: text$1,
|
|
6348
|
-
before: managed,
|
|
6349
|
-
value: managed
|
|
6350
|
-
},
|
|
6351
|
-
"task.agent.set": {
|
|
6352
|
-
taskId: text$1,
|
|
6353
|
-
before: managed,
|
|
6354
|
-
value: managed
|
|
6355
|
-
},
|
|
6356
|
-
"task.llm.mode.set": {
|
|
6357
|
-
taskId: text$1,
|
|
6358
|
-
before: _enum(["chat", "json"]),
|
|
6359
|
-
value: _enum(["chat", "json"])
|
|
6360
|
-
},
|
|
6361
|
-
"task.name.set": {
|
|
6362
|
-
taskId: text$1,
|
|
6363
|
-
before: text$1,
|
|
6364
|
-
value: text$1
|
|
6365
|
-
}
|
|
6366
|
-
};
|
|
6367
|
-
var variants = new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object$1({
|
|
6368
|
-
kind: literal(kind),
|
|
6369
|
-
...shape
|
|
6370
|
-
})]));
|
|
6371
|
-
var operations = array(union([...variants.values()])).min(1);
|
|
6372
|
-
function parseOperation(candidate, index, parse) {
|
|
6373
|
-
try {
|
|
6374
|
-
return parse(candidate);
|
|
6375
|
-
} catch (error) {
|
|
6376
|
-
if (!(error instanceof ZodError)) throw error;
|
|
6377
|
-
throw new TypeError(`operations[${index}]: ${error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}`, { cause: error });
|
|
6378
|
-
}
|
|
6379
|
-
}
|
|
6380
|
-
function decodeChangeOperation(candidate, index) {
|
|
6381
|
-
const { kind } = parseOperation(candidate, index, object$1({ kind: text$1 }).parse);
|
|
6382
|
-
const schema = variants.get(kind);
|
|
6383
|
-
if (schema == null) throw new TypeError(`operations[${index}]: Unknown operation ${JSON.stringify(kind)}.`);
|
|
6384
|
-
return parseOperation(candidate, index, schema.parse);
|
|
6385
|
-
}
|
|
6386
|
-
function changeOperationsSchema(kind) {
|
|
6387
|
-
const schema = kind == null ? operations : variants.get(kind);
|
|
6388
|
-
if (schema == null) throw new TypeError(`Unknown operation ${JSON.stringify(kind)}.`);
|
|
6389
|
-
return toJSONSchema(schema, { io: "input" });
|
|
6390
|
-
}
|
|
6391
|
-
function resourceNameIssue(value) {
|
|
6392
|
-
const name = value.trim();
|
|
6393
|
-
if (name.length == 0) return "empty";
|
|
6394
|
-
if (name.length > 80) return "tooLong";
|
|
6395
|
-
for (const character of name) {
|
|
6396
|
-
const code = character.charCodeAt(0);
|
|
6397
|
-
if (code <= 31 || code >= 127 && code <= 159) return "controlCharacter";
|
|
6398
|
-
}
|
|
6399
|
-
if (!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(name)) return "specialCharacter";
|
|
6400
|
-
}
|
|
6401
|
-
//#endregion
|
|
6402
|
-
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
|
|
6403
|
-
function deepCompareStrict(a, b) {
|
|
6404
|
-
const typeofa = typeof a;
|
|
6405
|
-
if (typeofa !== typeof b) return false;
|
|
6406
|
-
if (Array.isArray(a)) {
|
|
6407
|
-
if (!Array.isArray(b)) return false;
|
|
6408
|
-
const length = a.length;
|
|
6409
|
-
if (length !== b.length) return false;
|
|
6410
|
-
for (let i = 0; i < length; i++) if (!deepCompareStrict(a[i], b[i])) return false;
|
|
6411
|
-
return true;
|
|
6412
|
-
}
|
|
6413
|
-
if (typeofa === "object") {
|
|
6414
|
-
if (!a || !b) return a === b;
|
|
6415
|
-
const aKeys = Object.keys(a);
|
|
6416
|
-
const bKeys = Object.keys(b);
|
|
6417
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
6418
|
-
for (const k of aKeys) if (!deepCompareStrict(a[k], b[k])) return false;
|
|
6419
|
-
return true;
|
|
6420
|
-
}
|
|
6421
|
-
return a === b;
|
|
6422
|
-
}
|
|
6423
|
-
//#endregion
|
|
6424
|
-
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/pointer.js
|
|
6425
|
-
function encodePointer(p) {
|
|
6426
|
-
return encodeURI(escapePointer(p));
|
|
6427
|
-
}
|
|
6428
|
-
function escapePointer(p) {
|
|
6429
|
-
return p.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
6430
|
-
}
|
|
6431
|
-
//#endregion
|
|
6432
|
-
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/dereference.js
|
|
6433
|
-
var schemaArrayKeyword = {
|
|
6434
|
-
prefixItems: true,
|
|
6435
|
-
items: true,
|
|
6436
|
-
allOf: true,
|
|
6437
|
-
anyOf: true,
|
|
6438
|
-
oneOf: true
|
|
6439
|
-
};
|
|
6440
|
-
var schemaMapKeyword = {
|
|
6441
|
-
$defs: true,
|
|
6442
|
-
definitions: true,
|
|
6443
|
-
properties: true,
|
|
6444
|
-
patternProperties: true,
|
|
6445
|
-
dependentSchemas: true
|
|
6446
|
-
};
|
|
6447
|
-
var ignoredKeyword = {
|
|
6448
|
-
id: true,
|
|
6449
|
-
$id: true,
|
|
6450
|
-
$ref: true,
|
|
6451
|
-
$schema: true,
|
|
6452
|
-
$anchor: true,
|
|
6453
|
-
$vocabulary: true,
|
|
6454
|
-
$comment: true,
|
|
6455
|
-
default: true,
|
|
6456
|
-
enum: true,
|
|
6457
|
-
const: true,
|
|
6458
|
-
required: true,
|
|
6459
|
-
type: true,
|
|
6460
|
-
maximum: true,
|
|
6461
|
-
minimum: true,
|
|
6462
|
-
exclusiveMaximum: true,
|
|
6463
|
-
exclusiveMinimum: true,
|
|
6464
|
-
multipleOf: true,
|
|
6465
|
-
maxLength: true,
|
|
6466
|
-
minLength: true,
|
|
6467
|
-
pattern: true,
|
|
6468
|
-
format: true,
|
|
6469
|
-
maxItems: true,
|
|
6470
|
-
minItems: true,
|
|
6471
|
-
uniqueItems: true,
|
|
6472
|
-
maxProperties: true,
|
|
6473
|
-
minProperties: true
|
|
6474
|
-
};
|
|
6475
|
-
var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
|
|
6476
|
-
function dereference(schema, lookup = Object.create(null), baseURI = initialBaseURI, basePointer = "") {
|
|
6477
|
-
if (schema && typeof schema === "object" && !Array.isArray(schema)) {
|
|
6478
|
-
const id = schema.$id || schema.id;
|
|
6479
|
-
if (id) {
|
|
6480
|
-
const url = new URL(id, baseURI.href);
|
|
6481
|
-
if (url.hash.length > 1) lookup[url.href] = schema;
|
|
6482
|
-
else {
|
|
6483
|
-
url.hash = "";
|
|
6484
|
-
if (basePointer === "") baseURI = url;
|
|
6485
|
-
else dereference(schema, lookup, baseURI);
|
|
6486
|
-
}
|
|
6487
|
-
}
|
|
6488
|
-
} else if (schema !== true && schema !== false) return lookup;
|
|
6489
|
-
const schemaURI = baseURI.href + (basePointer ? "#" + basePointer : "");
|
|
6490
|
-
if (lookup[schemaURI] !== void 0) throw new Error(`Duplicate schema URI "${schemaURI}".`);
|
|
6491
|
-
lookup[schemaURI] = schema;
|
|
6492
|
-
if (schema === true || schema === false) return lookup;
|
|
6493
|
-
if (schema.__absolute_uri__ === void 0) Object.defineProperty(schema, "__absolute_uri__", {
|
|
6494
|
-
enumerable: false,
|
|
6495
|
-
value: schemaURI
|
|
6496
|
-
});
|
|
6497
|
-
if (schema.$ref && schema.__absolute_ref__ === void 0) {
|
|
6498
|
-
const url = new URL(schema.$ref, baseURI.href);
|
|
6499
|
-
url.hash = url.hash;
|
|
6500
|
-
Object.defineProperty(schema, "__absolute_ref__", {
|
|
6501
|
-
enumerable: false,
|
|
6502
|
-
value: url.href
|
|
6503
|
-
});
|
|
6504
|
-
}
|
|
6505
|
-
if (schema.$recursiveRef && schema.__absolute_recursive_ref__ === void 0) {
|
|
6506
|
-
const url = new URL(schema.$recursiveRef, baseURI.href);
|
|
6507
|
-
url.hash = url.hash;
|
|
6508
|
-
Object.defineProperty(schema, "__absolute_recursive_ref__", {
|
|
6509
|
-
enumerable: false,
|
|
6510
|
-
value: url.href
|
|
6511
|
-
});
|
|
6512
|
-
}
|
|
6513
|
-
if (schema.$anchor) {
|
|
6514
|
-
const url = new URL("#" + schema.$anchor, baseURI.href);
|
|
6515
|
-
lookup[url.href] = schema;
|
|
6516
|
-
}
|
|
6517
|
-
for (let key in schema) {
|
|
6518
|
-
if (ignoredKeyword[key]) continue;
|
|
6519
|
-
const keyBase = `${basePointer}/${encodePointer(key)}`;
|
|
6520
|
-
const subSchema = schema[key];
|
|
6521
|
-
if (Array.isArray(subSchema)) {
|
|
6522
|
-
if (schemaArrayKeyword[key]) {
|
|
6523
|
-
const length = subSchema.length;
|
|
6524
|
-
for (let i = 0; i < length; i++) dereference(subSchema[i], lookup, baseURI, `${keyBase}/${i}`);
|
|
6525
|
-
}
|
|
6526
|
-
} else if (schemaMapKeyword[key]) for (let subKey in subSchema) dereference(subSchema[subKey], lookup, baseURI, `${keyBase}/${encodePointer(subKey)}`);
|
|
6527
|
-
else dereference(subSchema, lookup, baseURI, keyBase);
|
|
6528
|
-
}
|
|
6529
|
-
return lookup;
|
|
6530
|
-
}
|
|
6531
|
-
//#endregion
|
|
6532
|
-
//#region ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/format.js
|
|
6533
|
-
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
|
6534
|
-
var DAYS = [
|
|
6535
|
-
0,
|
|
6536
|
-
31,
|
|
6537
|
-
28,
|
|
6538
|
-
31,
|
|
6539
|
-
30,
|
|
6540
|
-
31,
|
|
6541
|
-
30,
|
|
6542
|
-
31,
|
|
6543
|
-
31,
|
|
6544
|
-
30,
|
|
6545
|
-
31,
|
|
6546
|
-
30,
|
|
6547
|
-
31
|
|
6548
|
-
];
|
|
6549
|
-
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
|
6550
|
-
var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
|
|
6551
|
-
var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
|
6552
|
-
var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
|
|
6553
|
-
var URL_ = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
|
6554
|
-
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
|
6555
|
-
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
|
6556
|
-
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
|
6557
|
-
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
|
6558
|
-
var EMAIL = (input) => {
|
|
6559
|
-
if (input[0] === "\"") return false;
|
|
6560
|
-
const [name, host, ...rest] = input.split("@");
|
|
6561
|
-
if (!name || !host || rest.length !== 0 || name.length > 64 || host.length > 253) return false;
|
|
6562
|
-
if (name[0] === "." || name.endsWith(".") || name.includes("..")) return false;
|
|
6563
|
-
if (!/^[a-z0-9.-]+$/i.test(host) || !/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(name)) return false;
|
|
6564
|
-
return host.split(".").every((part) => /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(part));
|
|
6565
|
-
};
|
|
6566
|
-
var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
|
|
6567
|
-
var IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
|
|
6568
|
-
var DURATION = (input) => input.length > 1 && input.length < 80 && (/^P\d+([.,]\d+)?W$/.test(input) || /^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) && /^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input));
|
|
6569
|
-
function bind(r) {
|
|
6570
|
-
return r.test.bind(r);
|
|
6571
|
-
}
|
|
6572
|
-
var format = {
|
|
6573
|
-
date,
|
|
6574
|
-
time: time.bind(void 0, false),
|
|
6575
|
-
"date-time": date_time,
|
|
6576
|
-
duration: DURATION,
|
|
6577
|
-
uri,
|
|
6578
|
-
"uri-reference": bind(URIREF),
|
|
6579
|
-
"uri-template": bind(URITEMPLATE),
|
|
6580
|
-
url: bind(URL_),
|
|
6581
|
-
email: EMAIL,
|
|
6582
|
-
hostname: bind(HOSTNAME),
|
|
6583
|
-
ipv4: bind(IPV4),
|
|
6584
|
-
ipv6: bind(IPV6),
|
|
6585
|
-
regex,
|
|
6586
|
-
uuid: bind(UUID),
|
|
6587
|
-
"json-pointer": bind(JSON_POINTER),
|
|
6588
|
-
"json-pointer-uri-fragment": bind(JSON_POINTER_URI_FRAGMENT),
|
|
6589
|
-
"relative-json-pointer": bind(RELATIVE_JSON_POINTER)
|
|
6043
|
+
var IPV4 = /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/;
|
|
6044
|
+
var IPV6 = /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;
|
|
6045
|
+
var DURATION = (input) => input.length > 1 && input.length < 80 && (/^P\d+([.,]\d+)?W$/.test(input) || /^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(input) && /^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(input));
|
|
6046
|
+
function bind(r) {
|
|
6047
|
+
return r.test.bind(r);
|
|
6048
|
+
}
|
|
6049
|
+
var format = {
|
|
6050
|
+
date,
|
|
6051
|
+
time: time.bind(void 0, false),
|
|
6052
|
+
"date-time": date_time,
|
|
6053
|
+
duration: DURATION,
|
|
6054
|
+
uri,
|
|
6055
|
+
"uri-reference": bind(URIREF),
|
|
6056
|
+
"uri-template": bind(URITEMPLATE),
|
|
6057
|
+
url: bind(URL_),
|
|
6058
|
+
email: EMAIL,
|
|
6059
|
+
hostname: bind(HOSTNAME),
|
|
6060
|
+
ipv4: bind(IPV4),
|
|
6061
|
+
ipv6: bind(IPV6),
|
|
6062
|
+
regex,
|
|
6063
|
+
uuid: bind(UUID),
|
|
6064
|
+
"json-pointer": bind(JSON_POINTER),
|
|
6065
|
+
"json-pointer-uri-fragment": bind(JSON_POINTER_URI_FRAGMENT),
|
|
6066
|
+
"relative-json-pointer": bind(RELATIVE_JSON_POINTER)
|
|
6590
6067
|
};
|
|
6591
6068
|
function isLeapYear(year) {
|
|
6592
6069
|
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
@@ -8909,1157 +8386,1938 @@ function splitRangeGreaterBranch(range1, range2) {
|
|
|
8909
8386
|
};
|
|
8910
8387
|
}
|
|
8911
8388
|
}
|
|
8912
|
-
return {
|
|
8913
|
-
left: {
|
|
8914
|
-
fromLeft: false,
|
|
8915
|
-
range: [min2, reversalExclusive(min1)]
|
|
8916
|
-
},
|
|
8917
|
-
center: [min1, max1],
|
|
8918
|
-
right: {
|
|
8919
|
-
fromLeft: false,
|
|
8920
|
-
range: [reversalExclusive(max1), max2]
|
|
8921
|
-
}
|
|
8922
|
-
};
|
|
8389
|
+
return {
|
|
8390
|
+
left: {
|
|
8391
|
+
fromLeft: false,
|
|
8392
|
+
range: [min2, reversalExclusive(min1)]
|
|
8393
|
+
},
|
|
8394
|
+
center: [min1, max1],
|
|
8395
|
+
right: {
|
|
8396
|
+
fromLeft: false,
|
|
8397
|
+
range: [reversalExclusive(max1), max2]
|
|
8398
|
+
}
|
|
8399
|
+
};
|
|
8400
|
+
}
|
|
8401
|
+
function splitRangeEqualsBranch(range1, range2) {
|
|
8402
|
+
const [min1, max1] = range1;
|
|
8403
|
+
const [min2, max2] = range2;
|
|
8404
|
+
const exclusive1 = min1.exclusive;
|
|
8405
|
+
const exclusive2 = min2.exclusive;
|
|
8406
|
+
let left;
|
|
8407
|
+
let centerBegin = min1;
|
|
8408
|
+
if (!exclusive1 && exclusive2) {
|
|
8409
|
+
centerBegin = min2;
|
|
8410
|
+
left = {
|
|
8411
|
+
fromLeft: true,
|
|
8412
|
+
range: [min1, reversalExclusive(min2)]
|
|
8413
|
+
};
|
|
8414
|
+
} else if (exclusive1 && !exclusive2) left = {
|
|
8415
|
+
fromLeft: false,
|
|
8416
|
+
range: [min2, reversalExclusive(min1)]
|
|
8417
|
+
};
|
|
8418
|
+
if (max1.num <= max2.num) {
|
|
8419
|
+
let hasRight = true;
|
|
8420
|
+
let isLeftRangeOverride = false;
|
|
8421
|
+
if (max1.num === max2.num) {
|
|
8422
|
+
const maxExclusive1 = max1.exclusive;
|
|
8423
|
+
const maxExclusive2 = max2.exclusive;
|
|
8424
|
+
hasRight = maxExclusive1 !== maxExclusive2;
|
|
8425
|
+
isLeftRangeOverride = !maxExclusive1 && maxExclusive2;
|
|
8426
|
+
}
|
|
8427
|
+
if (!isLeftRangeOverride) {
|
|
8428
|
+
let right;
|
|
8429
|
+
if (hasRight) right = {
|
|
8430
|
+
fromLeft: false,
|
|
8431
|
+
range: [reversalExclusive(max1), max2]
|
|
8432
|
+
};
|
|
8433
|
+
return {
|
|
8434
|
+
left,
|
|
8435
|
+
center: [centerBegin, max1],
|
|
8436
|
+
right
|
|
8437
|
+
};
|
|
8438
|
+
}
|
|
8439
|
+
}
|
|
8440
|
+
return {
|
|
8441
|
+
left,
|
|
8442
|
+
center: [centerBegin, max2],
|
|
8443
|
+
right: {
|
|
8444
|
+
fromLeft: true,
|
|
8445
|
+
range: [reversalExclusive(max2), max1]
|
|
8446
|
+
}
|
|
8447
|
+
};
|
|
8448
|
+
}
|
|
8449
|
+
function reversalExclusive(point) {
|
|
8450
|
+
return {
|
|
8451
|
+
num: point.num,
|
|
8452
|
+
exclusive: !point.exclusive
|
|
8453
|
+
};
|
|
8454
|
+
}
|
|
8455
|
+
//#endregion
|
|
8456
|
+
//#region src/json-schema-subset/checker/range.ts
|
|
8457
|
+
var createRangeSplitter = (undefinedMin) => (min1 = undefinedMin, max1 = Number.POSITIVE_INFINITY, min2 = undefinedMin, max2 = Number.POSITIVE_INFINITY) => {
|
|
8458
|
+
const { left, center, right } = splitRange$3([{
|
|
8459
|
+
num: min1,
|
|
8460
|
+
exclusive: false
|
|
8461
|
+
}, {
|
|
8462
|
+
num: max1,
|
|
8463
|
+
exclusive: false
|
|
8464
|
+
}], [{
|
|
8465
|
+
num: min2,
|
|
8466
|
+
exclusive: false
|
|
8467
|
+
}, {
|
|
8468
|
+
num: max2,
|
|
8469
|
+
exclusive: false
|
|
8470
|
+
}]);
|
|
8471
|
+
let leftItem;
|
|
8472
|
+
let rightItem;
|
|
8473
|
+
let intersectionItem;
|
|
8474
|
+
if (left) leftItem = {
|
|
8475
|
+
min: left.range[0].num,
|
|
8476
|
+
max: left.range[1].num,
|
|
8477
|
+
isFrom1: left.fromLeft
|
|
8478
|
+
};
|
|
8479
|
+
if (right) rightItem = {
|
|
8480
|
+
min: right.range[0].num,
|
|
8481
|
+
max: right.range[1].num,
|
|
8482
|
+
isFrom1: right.fromLeft
|
|
8483
|
+
};
|
|
8484
|
+
if (center) intersectionItem = {
|
|
8485
|
+
min: center[0].num,
|
|
8486
|
+
max: center[1].num
|
|
8487
|
+
};
|
|
8488
|
+
return {
|
|
8489
|
+
left: leftItem,
|
|
8490
|
+
right: rightItem,
|
|
8491
|
+
intersection: intersectionItem
|
|
8492
|
+
};
|
|
8493
|
+
};
|
|
8494
|
+
function toExpressionSingleResult({ left, right, intersection }) {
|
|
8495
|
+
if (!intersection) return ExpressionSingleResult.Rejection;
|
|
8496
|
+
let extra1 = false;
|
|
8497
|
+
let extra2 = false;
|
|
8498
|
+
if (left) {
|
|
8499
|
+
if (left.isFrom1) extra1 = true;
|
|
8500
|
+
else extra2 = true;
|
|
8501
|
+
}
|
|
8502
|
+
if (right) {
|
|
8503
|
+
if (right.isFrom1) extra1 = true;
|
|
8504
|
+
else extra2 = true;
|
|
8505
|
+
}
|
|
8506
|
+
if (extra1 && extra2) return ExpressionSingleResult.Intersection;
|
|
8507
|
+
if (extra1) return ExpressionSingleResult.Containing;
|
|
8508
|
+
if (extra2) return ExpressionSingleResult.ContainedBy;
|
|
8509
|
+
return ExpressionSingleResult.Equals;
|
|
8510
|
+
}
|
|
8511
|
+
//#endregion
|
|
8512
|
+
//#region src/json-schema-subset/checker/array.ts
|
|
8513
|
+
var splitRange$2 = createRangeSplitter(0);
|
|
8514
|
+
var quantum$1 = makeQuantum([
|
|
8515
|
+
"hasCommon",
|
|
8516
|
+
"hasExtra1",
|
|
8517
|
+
"hasExtra2",
|
|
8518
|
+
"hasRejection",
|
|
8519
|
+
"hasCommonBroken"
|
|
8520
|
+
]);
|
|
8521
|
+
function calculateArray({ calculate }, schema1, schema2) {
|
|
8522
|
+
const splitResult = splitRange$2(schema1.minItems, schema1.maxItems, schema2.minItems, schema2.maxItems);
|
|
8523
|
+
const splitExpression = toExpressionSingleResult(splitResult);
|
|
8524
|
+
if (splitExpression === ExpressionSingleResult.Rejection) return ExpressionRejection;
|
|
8525
|
+
const [items1, additionalItems1] = normalizeArray(schema1);
|
|
8526
|
+
const [items2, additionalItems2] = normalizeArray(schema2);
|
|
8527
|
+
const itemsLength = Math.max(items1.length, items2.length) + 1;
|
|
8528
|
+
const length = Math.min(itemsLength, splitResult.intersection.max);
|
|
8529
|
+
const quantumVariable = quantum$1.variable({});
|
|
8530
|
+
const minItems = Math.min(schema1.minItems ?? 0, schema2.minItems ?? 0);
|
|
8531
|
+
for (let i = 0; i < length; i++) {
|
|
8532
|
+
const expression = calculate(items1[i] ?? additionalItems1, items2[i] ?? additionalItems2);
|
|
8533
|
+
quantumVariable.push(expression, (singleExpression, variable) => {
|
|
8534
|
+
switch (singleExpression) {
|
|
8535
|
+
case ExpressionSingleResult.Equals:
|
|
8536
|
+
if (!variable.hasRejection) variable.hasCommon = true;
|
|
8537
|
+
break;
|
|
8538
|
+
case ExpressionSingleResult.Containing:
|
|
8539
|
+
if (!variable.hasRejection) variable.hasCommon = true;
|
|
8540
|
+
variable.hasExtra1 = true;
|
|
8541
|
+
break;
|
|
8542
|
+
case ExpressionSingleResult.ContainedBy:
|
|
8543
|
+
if (!variable.hasRejection) variable.hasCommon = true;
|
|
8544
|
+
variable.hasExtra2 = true;
|
|
8545
|
+
break;
|
|
8546
|
+
case ExpressionSingleResult.Intersection:
|
|
8547
|
+
if (!variable.hasRejection) variable.hasCommon = true;
|
|
8548
|
+
variable.hasExtra1 = true;
|
|
8549
|
+
variable.hasExtra2 = true;
|
|
8550
|
+
break;
|
|
8551
|
+
case ExpressionSingleResult.Rejection:
|
|
8552
|
+
if (i < minItems) variable.hasCommonBroken = true;
|
|
8553
|
+
variable.hasRejection = true;
|
|
8554
|
+
variable.hasExtra1 = true;
|
|
8555
|
+
variable.hasExtra2 = true;
|
|
8556
|
+
}
|
|
8557
|
+
});
|
|
8558
|
+
}
|
|
8559
|
+
quantumVariable.update((variable) => {
|
|
8560
|
+
switch (splitExpression) {
|
|
8561
|
+
case ExpressionSingleResult.Containing:
|
|
8562
|
+
variable.hasExtra1 = true;
|
|
8563
|
+
break;
|
|
8564
|
+
case ExpressionSingleResult.ContainedBy:
|
|
8565
|
+
variable.hasExtra2 = true;
|
|
8566
|
+
break;
|
|
8567
|
+
case ExpressionSingleResult.Intersection:
|
|
8568
|
+
variable.hasExtra1 = true;
|
|
8569
|
+
variable.hasExtra2 = true;
|
|
8570
|
+
}
|
|
8571
|
+
if (schema1.uniqueItems && !schema2.uniqueItems && (schema2.maxItems ?? Number.POSITIVE_INFINITY) > 1) variable.hasExtra2 = true;
|
|
8572
|
+
else if (!schema1.uniqueItems && schema2.uniqueItems && (schema1.maxItems ?? Number.POSITIVE_INFINITY) > 1) variable.hasExtra1 = true;
|
|
8573
|
+
if (schema1.maxItems === 0 || schema2.maxItems === 0) {
|
|
8574
|
+
variable.hasCommon = true;
|
|
8575
|
+
if (schema1.maxItems !== 0) variable.hasExtra1 = true;
|
|
8576
|
+
if (schema2.maxItems !== 0) variable.hasExtra2 = true;
|
|
8577
|
+
}
|
|
8578
|
+
});
|
|
8579
|
+
let expression = 0;
|
|
8580
|
+
for (const { hasExtra1, hasExtra2, hasCommon, hasCommonBroken } of quantumVariable) {
|
|
8581
|
+
let finalHasCommon = hasCommon;
|
|
8582
|
+
if (hasCommonBroken) finalHasCommon = false;
|
|
8583
|
+
if (!finalHasCommon) expression |= ExpressionRejection;
|
|
8584
|
+
else if (hasExtra1 && hasExtra2) expression |= ExpressionIntersection;
|
|
8585
|
+
else if (hasExtra1) expression |= ExpressionContaining;
|
|
8586
|
+
else if (hasExtra2) expression |= ExpressionContainedBy;
|
|
8587
|
+
else expression |= ExpressionEquals;
|
|
8588
|
+
}
|
|
8589
|
+
return expression;
|
|
8590
|
+
}
|
|
8591
|
+
function normalizeArray({ items, additionalItems }) {
|
|
8592
|
+
if (Array.isArray(items)) return [items, additionalItems ?? ANY];
|
|
8593
|
+
else return [[], items ?? ANY];
|
|
8594
|
+
}
|
|
8595
|
+
//#endregion
|
|
8596
|
+
//#region src/json-schema-subset/checker/cache.ts
|
|
8597
|
+
function wrapEqualsCheckerWithCache(check) {
|
|
8598
|
+
const map = /* @__PURE__ */ new Map();
|
|
8599
|
+
return (value1, value2) => {
|
|
8600
|
+
const isObject1 = isCompiledObject(value1);
|
|
8601
|
+
if (isObject1 !== isCompiledObject(value2)) return false;
|
|
8602
|
+
if (!isObject1) return value1 === value2;
|
|
8603
|
+
return getWithCache(map, value1, value2, check);
|
|
8604
|
+
};
|
|
8605
|
+
}
|
|
8606
|
+
function wrapSchemaCalculatorWithCache(check) {
|
|
8607
|
+
const map = /* @__PURE__ */ new Map();
|
|
8608
|
+
return (schema1, schema2) => getWithCache(map, schema1, schema2, check);
|
|
8609
|
+
}
|
|
8610
|
+
function getWithCache(map, node1, node2, check) {
|
|
8611
|
+
const key = `${getId(node1)}/${getId(node2)}`;
|
|
8612
|
+
let result = map.get(key);
|
|
8613
|
+
if (result === void 0) map.set(key, result = check(node1, node2));
|
|
8614
|
+
return result;
|
|
8615
|
+
}
|
|
8616
|
+
//#endregion
|
|
8617
|
+
//#region src/json-schema-subset/checker/enumAndConst.ts
|
|
8618
|
+
function calculateEnumAndEnum(context, schema1, schema2) {
|
|
8619
|
+
const enumList1 = normalizeEnumList(schema1);
|
|
8620
|
+
const enumList2 = normalizeEnumList(schema2);
|
|
8621
|
+
let foundExtra1 = false;
|
|
8622
|
+
let foundExtra2 = false;
|
|
8623
|
+
let foundIntersection = false;
|
|
8624
|
+
for (const enum1 of enumList1) {
|
|
8625
|
+
if (hasEqualsEnum(context, enumList2, enum1)) foundIntersection = true;
|
|
8626
|
+
else foundExtra1 = true;
|
|
8627
|
+
if (foundExtra1 && foundIntersection) break;
|
|
8628
|
+
}
|
|
8629
|
+
for (const enum2 of enumList2) {
|
|
8630
|
+
if (hasEqualsEnum(context, enumList1, enum2)) foundIntersection = true;
|
|
8631
|
+
else foundExtra2 = true;
|
|
8632
|
+
if (foundExtra2 && foundIntersection) break;
|
|
8633
|
+
}
|
|
8634
|
+
if (!foundIntersection) return ExpressionRejection;
|
|
8635
|
+
if (foundExtra1 && foundExtra2) return ExpressionIntersection;
|
|
8636
|
+
if (foundExtra1) return ExpressionContaining;
|
|
8637
|
+
if (foundExtra2) return ExpressionContainedBy;
|
|
8638
|
+
return ExpressionEquals;
|
|
8923
8639
|
}
|
|
8924
|
-
function
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
const
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
};
|
|
8937
|
-
} else if (exclusive1 && !exclusive2) left = {
|
|
8938
|
-
fromLeft: false,
|
|
8939
|
-
range: [min2, reversalExclusive(min1)]
|
|
8940
|
-
};
|
|
8941
|
-
if (max1.num <= max2.num) {
|
|
8942
|
-
let hasRight = true;
|
|
8943
|
-
let isLeftRangeOverride = false;
|
|
8944
|
-
if (max1.num === max2.num) {
|
|
8945
|
-
const maxExclusive1 = max1.exclusive;
|
|
8946
|
-
const maxExclusive2 = max2.exclusive;
|
|
8947
|
-
hasRight = maxExclusive1 !== maxExclusive2;
|
|
8948
|
-
isLeftRangeOverride = !maxExclusive1 && maxExclusive2;
|
|
8640
|
+
function calculateEnumAndSchema(enumSchema, schema) {
|
|
8641
|
+
let hasValid = false;
|
|
8642
|
+
let hasInvalid = false;
|
|
8643
|
+
for (const enumValue of normalizeEnumList(enumSchema)) {
|
|
8644
|
+
switch (valid(schema, enumValue)) {
|
|
8645
|
+
case ValidResult.Valid:
|
|
8646
|
+
hasValid = true;
|
|
8647
|
+
break;
|
|
8648
|
+
case ValidResult.Invalid:
|
|
8649
|
+
hasInvalid = true;
|
|
8650
|
+
break;
|
|
8651
|
+
case ValidResult.Unknown: return ExpressionAny;
|
|
8949
8652
|
}
|
|
8950
|
-
if (
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8653
|
+
if (hasValid && hasInvalid) break;
|
|
8654
|
+
}
|
|
8655
|
+
if (hasValid && hasInvalid) return ExpressionIntersection;
|
|
8656
|
+
if (hasValid) return ExpressionEquals | ExpressionContainedBy;
|
|
8657
|
+
if (hasInvalid) return ExpressionRejection;
|
|
8658
|
+
if (getKind(schema) === CompiledKind.Never) return ExpressionEquals;
|
|
8659
|
+
return ExpressionContainedBy;
|
|
8660
|
+
}
|
|
8661
|
+
function normalizeEnumList({ const: constValue, enum: enumList }) {
|
|
8662
|
+
if (constValue !== void 0) return [constValue];
|
|
8663
|
+
if (enumList) return enumList;
|
|
8664
|
+
throw new Error("invalid branch");
|
|
8665
|
+
}
|
|
8666
|
+
function hasEqualsEnum({ isEquals }, enumList, checkedEnum) {
|
|
8667
|
+
for (const searchedEnum of enumList) if (isEquals(searchedEnum, checkedEnum)) return true;
|
|
8668
|
+
return false;
|
|
8669
|
+
}
|
|
8670
|
+
//#endregion
|
|
8671
|
+
//#region src/json-schema-subset/checker/equals.ts
|
|
8672
|
+
function schemaEqualsChecker(extendsContext) {
|
|
8673
|
+
function isSchemaEquals(schema1, schema2) {
|
|
8674
|
+
const isExtends1 = extendsContext.isExtendsSchema(schema1);
|
|
8675
|
+
const isExtends2 = extendsContext.isExtendsSchema(schema2);
|
|
8676
|
+
if (isExtends1 || isExtends2) return extendsContext.equals(schema1, schema2);
|
|
8677
|
+
else return isCompiledSchemaEquals(schema1, schema2);
|
|
8678
|
+
}
|
|
8679
|
+
const equalsMap = /* @__PURE__ */ new Map();
|
|
8680
|
+
function isCompiledSchemaEquals(schema1, schema2) {
|
|
8681
|
+
const id1 = getId(schema1);
|
|
8682
|
+
const id2 = getId(schema2);
|
|
8683
|
+
if (id1 === id2) return true;
|
|
8684
|
+
const key = `${id1}/${id2}`;
|
|
8685
|
+
let isEquals = equalsMap.get(key);
|
|
8686
|
+
if (isEquals === void 0) {
|
|
8687
|
+
isEquals = isObjectLikeEquals(schema1, schema2);
|
|
8688
|
+
equalsMap.set(key, isEquals);
|
|
8961
8689
|
}
|
|
8690
|
+
return isEquals;
|
|
8962
8691
|
}
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8692
|
+
function isObjectLikeEquals(object1, object2) {
|
|
8693
|
+
if (Array.isArray(object1)) {
|
|
8694
|
+
if (!Array.isArray(object2)) return false;
|
|
8695
|
+
if (object1.length !== object2.length) return false;
|
|
8696
|
+
for (const [i, value1Element] of object1.entries()) if (!isValueEquals(value1Element, object2[i])) return false;
|
|
8697
|
+
} else {
|
|
8698
|
+
if (Array.isArray(object2)) return false;
|
|
8699
|
+
for (const key in object1) {
|
|
8700
|
+
if (!(key in object2)) return false;
|
|
8701
|
+
if (!isValueEquals(Reflect.get(object1, key), Reflect.get(object2, key))) return false;
|
|
8702
|
+
}
|
|
8703
|
+
for (const key in object2) if (!(key in object1)) return false;
|
|
8969
8704
|
}
|
|
8970
|
-
|
|
8705
|
+
return true;
|
|
8706
|
+
}
|
|
8707
|
+
function isValueEquals(value1, value2) {
|
|
8708
|
+
if (value1 === value2) return true;
|
|
8709
|
+
if (value1 === null) return false;
|
|
8710
|
+
if (typeof value1 !== "object") return false;
|
|
8711
|
+
if (typeof value1 !== typeof value2) return false;
|
|
8712
|
+
if (isCompiledSchema(value1) && isCompiledSchema(value2)) return isCompiledSchemaEquals(value1, value2);
|
|
8713
|
+
return isObjectLikeEquals(value1, value2);
|
|
8714
|
+
}
|
|
8715
|
+
return isSchemaEquals;
|
|
8971
8716
|
}
|
|
8972
|
-
|
|
8717
|
+
//#endregion
|
|
8718
|
+
//#region src/json-schema-subset/checker/numeric/integerNormalizer.ts
|
|
8719
|
+
function normalizeInteger(schema) {
|
|
8720
|
+
const floatRange = pickRange(schema);
|
|
8721
|
+
const multipleOf = schema.multipleOf ?? 1;
|
|
8722
|
+
const range = cutRange(floatRange, multipleOf);
|
|
8723
|
+
if (!range) return null;
|
|
8973
8724
|
return {
|
|
8974
|
-
|
|
8975
|
-
|
|
8725
|
+
multipleOf,
|
|
8726
|
+
range
|
|
8976
8727
|
};
|
|
8977
8728
|
}
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8729
|
+
function isPointRange([point1, point2]) {
|
|
8730
|
+
if (point1.num !== point2.num) return false;
|
|
8731
|
+
if (point1.exclusive) return false;
|
|
8732
|
+
if (point2.exclusive) return false;
|
|
8733
|
+
return true;
|
|
8734
|
+
}
|
|
8735
|
+
function cutRange(range, multipleOf) {
|
|
8736
|
+
if (!range) return;
|
|
8737
|
+
const [originMin, originMax] = range;
|
|
8738
|
+
let min = nextInteger(originMin.num, multipleOf);
|
|
8739
|
+
let max = previousInteger(originMax.num, multipleOf);
|
|
8740
|
+
if (min === originMin.num && originMin.exclusive) min += multipleOf;
|
|
8741
|
+
if (max === originMax.num && originMax.exclusive) max -= multipleOf;
|
|
8742
|
+
if (min > max) return;
|
|
8743
|
+
if (min === max) {
|
|
8744
|
+
if (min === Number.POSITIVE_INFINITY) return;
|
|
8745
|
+
if (min === Number.NEGATIVE_INFINITY) return;
|
|
8746
|
+
}
|
|
8747
|
+
return [{
|
|
8748
|
+
num: min,
|
|
8983
8749
|
exclusive: false
|
|
8984
8750
|
}, {
|
|
8985
|
-
num:
|
|
8986
|
-
exclusive: false
|
|
8987
|
-
}], [{
|
|
8988
|
-
num: min2,
|
|
8751
|
+
num: max,
|
|
8989
8752
|
exclusive: false
|
|
8990
|
-
}
|
|
8991
|
-
|
|
8753
|
+
}];
|
|
8754
|
+
}
|
|
8755
|
+
function nextInteger(float, multipleOf) {
|
|
8756
|
+
return Math.ceil(float / multipleOf) * multipleOf;
|
|
8757
|
+
}
|
|
8758
|
+
function previousInteger(float, multipleOf) {
|
|
8759
|
+
return Math.floor(float / multipleOf) * multipleOf;
|
|
8760
|
+
}
|
|
8761
|
+
//#endregion
|
|
8762
|
+
//#region src/json-schema-subset/checker/numeric/float.ts
|
|
8763
|
+
function calculateFloat(schema1, schema2) {
|
|
8764
|
+
const { left, right, center } = splitRange$3(pickRange(schema1), pickRange(schema2));
|
|
8765
|
+
if (!center) return ExpressionRejection;
|
|
8766
|
+
let extraLeft = false;
|
|
8767
|
+
let extraRight = false;
|
|
8768
|
+
if (left) {
|
|
8769
|
+
if (left.fromLeft) extraLeft = true;
|
|
8770
|
+
else extraRight = true;
|
|
8771
|
+
}
|
|
8772
|
+
if (right) {
|
|
8773
|
+
if (right.fromLeft) extraLeft = true;
|
|
8774
|
+
else extraRight = true;
|
|
8775
|
+
}
|
|
8776
|
+
if (extraLeft && extraRight) return ExpressionIntersection;
|
|
8777
|
+
if (extraLeft) return ExpressionContaining;
|
|
8778
|
+
if (extraRight) return ExpressionContainedBy;
|
|
8779
|
+
return ExpressionEquals;
|
|
8780
|
+
}
|
|
8781
|
+
function calculateFloatAndInteger(schema1, schema2) {
|
|
8782
|
+
const floatRange = pickRange(schema1);
|
|
8783
|
+
const integer = normalizeInteger(schema2);
|
|
8784
|
+
if (!integer) return ExpressionContaining;
|
|
8785
|
+
const result = splitRange$3(floatRange, integer.range);
|
|
8786
|
+
const intCenter = cutRange(result.center, integer.multipleOf);
|
|
8787
|
+
const leftIntRange = unwrapAndCutRange(result.left, integer.multipleOf);
|
|
8788
|
+
const rightIntRange = unwrapAndCutRange(result.right, integer.multipleOf);
|
|
8789
|
+
if (!result.center) return ExpressionRejection;
|
|
8790
|
+
let extraFloat = false;
|
|
8791
|
+
let extraInteger = false;
|
|
8792
|
+
if (result.left?.fromLeft) extraFloat = true;
|
|
8793
|
+
if (result.right?.fromLeft) extraFloat = true;
|
|
8794
|
+
if (!intCenter || !isPointRange(result.center)) extraFloat = true;
|
|
8795
|
+
if (leftIntRange) extraInteger = true;
|
|
8796
|
+
if (rightIntRange) extraInteger = true;
|
|
8797
|
+
if (extraFloat && extraInteger) return ExpressionIntersection;
|
|
8798
|
+
if (extraFloat) return ExpressionContaining;
|
|
8799
|
+
if (extraInteger) return ExpressionContainedBy;
|
|
8800
|
+
return ExpressionEquals;
|
|
8801
|
+
}
|
|
8802
|
+
function pickRange(schema) {
|
|
8803
|
+
let point1;
|
|
8804
|
+
let point2;
|
|
8805
|
+
if (schema.exclusiveMinimum !== void 0) point1 = {
|
|
8806
|
+
num: schema.exclusiveMinimum,
|
|
8807
|
+
exclusive: true
|
|
8808
|
+
};
|
|
8809
|
+
else if (schema.minimum !== void 0) point1 = {
|
|
8810
|
+
num: schema.minimum,
|
|
8992
8811
|
exclusive: false
|
|
8993
|
-
}]);
|
|
8994
|
-
let leftItem;
|
|
8995
|
-
let rightItem;
|
|
8996
|
-
let intersectionItem;
|
|
8997
|
-
if (left) leftItem = {
|
|
8998
|
-
min: left.range[0].num,
|
|
8999
|
-
max: left.range[1].num,
|
|
9000
|
-
isFrom1: left.fromLeft
|
|
9001
8812
|
};
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
8813
|
+
else point1 = {
|
|
8814
|
+
num: Number.NEGATIVE_INFINITY,
|
|
8815
|
+
exclusive: true
|
|
8816
|
+
};
|
|
8817
|
+
if (schema.exclusiveMaximum !== void 0) point2 = {
|
|
8818
|
+
num: schema.exclusiveMaximum,
|
|
8819
|
+
exclusive: true
|
|
9006
8820
|
};
|
|
9007
|
-
if (
|
|
9008
|
-
|
|
9009
|
-
|
|
8821
|
+
else if (schema.maximum !== void 0) point2 = {
|
|
8822
|
+
num: schema.maximum,
|
|
8823
|
+
exclusive: false
|
|
9010
8824
|
};
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
intersection: intersectionItem
|
|
8825
|
+
else point2 = {
|
|
8826
|
+
num: Number.POSITIVE_INFINITY,
|
|
8827
|
+
exclusive: true
|
|
9015
8828
|
};
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
8829
|
+
return [point1, point2];
|
|
8830
|
+
}
|
|
8831
|
+
function unwrapAndCutRange(side, multipleOf) {
|
|
8832
|
+
if (!side) return;
|
|
8833
|
+
if (side.fromLeft) return;
|
|
8834
|
+
return cutRange(side.range, multipleOf);
|
|
8835
|
+
}
|
|
8836
|
+
//#endregion
|
|
8837
|
+
//#region src/json-schema-subset/checker/numeric/integer.ts
|
|
8838
|
+
function calculateInteger(schema1, schema2) {
|
|
8839
|
+
const integer1 = normalizeInteger(schema1);
|
|
8840
|
+
const integer2 = normalizeInteger(schema2);
|
|
8841
|
+
if (!integer1 && !integer2) return ExpressionEquals;
|
|
8842
|
+
if (!integer1) return ExpressionContainedBy;
|
|
8843
|
+
if (!integer2) return ExpressionContaining;
|
|
8844
|
+
const { range: range1, multipleOf: multipleOf1 } = integer1;
|
|
8845
|
+
const { range: range2, multipleOf: multipleOf2 } = integer2;
|
|
8846
|
+
const result = splitRange$3(range1, range2);
|
|
8847
|
+
let centerRange;
|
|
8848
|
+
let lcm = 0;
|
|
8849
|
+
if (result.center) {
|
|
8850
|
+
lcm = getLCM(multipleOf1, multipleOf2);
|
|
8851
|
+
centerRange = cutRange(result.center, lcm);
|
|
9024
8852
|
}
|
|
9025
|
-
if (
|
|
9026
|
-
|
|
9027
|
-
|
|
8853
|
+
if (!centerRange) return ExpressionRejection;
|
|
8854
|
+
let extraLeft = false;
|
|
8855
|
+
let extraRight = false;
|
|
8856
|
+
const { left, right } = result;
|
|
8857
|
+
if (left && cutRange(left.range, left.fromLeft ? multipleOf1 : multipleOf2)) {
|
|
8858
|
+
if (left.fromLeft) extraLeft = true;
|
|
8859
|
+
else extraRight = true;
|
|
9028
8860
|
}
|
|
9029
|
-
if (
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
8861
|
+
if (right && cutRange(right.range, right.fromLeft ? multipleOf1 : multipleOf2)) {
|
|
8862
|
+
if (right.fromLeft) extraLeft = true;
|
|
8863
|
+
else extraRight = true;
|
|
8864
|
+
}
|
|
8865
|
+
extraLeft = extraLeft || hasExtraIntegersOnCenter(integer1, centerRange, lcm);
|
|
8866
|
+
extraRight = extraRight || hasExtraIntegersOnCenter(integer2, centerRange, lcm);
|
|
8867
|
+
if (extraLeft && extraRight) return ExpressionIntersection;
|
|
8868
|
+
if (extraLeft) return ExpressionContaining;
|
|
8869
|
+
if (extraRight) return ExpressionContainedBy;
|
|
8870
|
+
return ExpressionEquals;
|
|
8871
|
+
}
|
|
8872
|
+
function hasExtraIntegersOnCenter({ range, multipleOf }, lcmCenterRange, lcm) {
|
|
8873
|
+
const result = splitRange$3(range, lcmCenterRange);
|
|
8874
|
+
if (cutRange(result.left?.range, multipleOf)) return true;
|
|
8875
|
+
if (cutRange(result.right?.range, multipleOf)) return true;
|
|
8876
|
+
const center = cutRange(result.center, multipleOf);
|
|
8877
|
+
if (!center) return false;
|
|
8878
|
+
const lcmCenterLength = rangeLength(lcmCenterRange);
|
|
8879
|
+
if (rangeLength(center) > lcmCenterLength) return true;
|
|
8880
|
+
if (lcmCenterLength === 1) return false;
|
|
8881
|
+
if (multipleOf < lcm) return true;
|
|
8882
|
+
return false;
|
|
8883
|
+
}
|
|
8884
|
+
/** Returns the least common multiple. */
|
|
8885
|
+
function getLCM(a, b) {
|
|
8886
|
+
return a * b / getGCD(a, b);
|
|
8887
|
+
}
|
|
8888
|
+
/** @returns The greatest common divisor. */
|
|
8889
|
+
function getGCD(a, b) {
|
|
8890
|
+
if (a === 0) return b;
|
|
8891
|
+
return getGCD(b % a, a);
|
|
8892
|
+
}
|
|
8893
|
+
function rangeLength(range) {
|
|
8894
|
+
if (!range) return 0;
|
|
8895
|
+
const [point1, point2] = range;
|
|
8896
|
+
return point2.num - point1.num + 1;
|
|
9033
8897
|
}
|
|
9034
8898
|
//#endregion
|
|
9035
|
-
//#region src/json-schema-subset/checker/
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
8899
|
+
//#region src/json-schema-subset/checker/numeric/checker.ts
|
|
8900
|
+
function calculateNumeric(schema1, schema2) {
|
|
8901
|
+
if (isUndefinedNumber(schema1) || isUndefinedNumber(schema2)) return ExpressionAny;
|
|
8902
|
+
const isFloat1 = isFloat(schema1);
|
|
8903
|
+
const isFloat2 = isFloat(schema2);
|
|
8904
|
+
if (isFloat1 && isFloat2) return calculateFloat(schema1, schema2);
|
|
8905
|
+
else if (isFloat1) return calculateFloatAndInteger(schema1, schema2);
|
|
8906
|
+
else if (isFloat2) return swap(calculateFloatAndInteger(schema2, schema1));
|
|
8907
|
+
else return calculateInteger(schema1, schema2);
|
|
8908
|
+
}
|
|
8909
|
+
function isUndefinedNumber(schema) {
|
|
8910
|
+
const { multipleOf } = schema;
|
|
8911
|
+
if (multipleOf === void 0) return false;
|
|
8912
|
+
if (!Number.isInteger(multipleOf)) return true;
|
|
8913
|
+
if (multipleOf < 0) return true;
|
|
8914
|
+
return false;
|
|
8915
|
+
}
|
|
8916
|
+
function isFloat(schema) {
|
|
8917
|
+
const { multipleOf } = schema;
|
|
8918
|
+
if (multipleOf !== void 0 && Number.isInteger(multipleOf)) return false;
|
|
8919
|
+
if (schema.type === "integer") return false;
|
|
8920
|
+
return true;
|
|
8921
|
+
}
|
|
8922
|
+
//#endregion
|
|
8923
|
+
//#region src/json-schema-subset/checker/object.ts
|
|
8924
|
+
var splitRange$1 = createRangeSplitter(0);
|
|
8925
|
+
var quantum = makeQuantum([
|
|
8926
|
+
"hasCommonInRequired",
|
|
8927
|
+
"hasCommonOutRequired",
|
|
9039
8928
|
"hasExtra1",
|
|
9040
8929
|
"hasExtra2",
|
|
9041
|
-
"hasRejection"
|
|
9042
|
-
"hasCommonBroken"
|
|
8930
|
+
"hasRejection"
|
|
9043
8931
|
]);
|
|
9044
|
-
function
|
|
9045
|
-
|
|
9046
|
-
const
|
|
9047
|
-
if (
|
|
9048
|
-
const
|
|
9049
|
-
const
|
|
9050
|
-
const
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
variable.hasExtra2 = true;
|
|
9068
|
-
break;
|
|
9069
|
-
case ExpressionSingleResult.Intersection:
|
|
9070
|
-
if (!variable.hasRejection) variable.hasCommon = true;
|
|
9071
|
-
variable.hasExtra1 = true;
|
|
9072
|
-
variable.hasExtra2 = true;
|
|
9073
|
-
break;
|
|
9074
|
-
case ExpressionSingleResult.Rejection:
|
|
9075
|
-
if (i < minItems) variable.hasCommonBroken = true;
|
|
9076
|
-
variable.hasRejection = true;
|
|
9077
|
-
variable.hasExtra1 = true;
|
|
9078
|
-
variable.hasExtra2 = true;
|
|
9079
|
-
}
|
|
9080
|
-
});
|
|
9081
|
-
}
|
|
9082
|
-
quantumVariable.update((variable) => {
|
|
9083
|
-
switch (splitExpression) {
|
|
9084
|
-
case ExpressionSingleResult.Containing:
|
|
9085
|
-
variable.hasExtra1 = true;
|
|
9086
|
-
break;
|
|
9087
|
-
case ExpressionSingleResult.ContainedBy:
|
|
9088
|
-
variable.hasExtra2 = true;
|
|
9089
|
-
break;
|
|
9090
|
-
case ExpressionSingleResult.Intersection:
|
|
9091
|
-
variable.hasExtra1 = true;
|
|
9092
|
-
variable.hasExtra2 = true;
|
|
8932
|
+
function calculateObject(context, schema1, schema2) {
|
|
8933
|
+
if (isPropertiesCountCannotMatch(schema1, schema2)) return ExpressionRejection;
|
|
8934
|
+
const splitRequiredResult = splitRequired(schema1, schema2);
|
|
8935
|
+
if (!splitRequiredResult) return ExpressionRejection;
|
|
8936
|
+
const getProperty1 = createPropertySchemaGetter(schema1);
|
|
8937
|
+
const getProperty2 = createPropertySchemaGetter(schema2);
|
|
8938
|
+
const calculateKey = (key) => {
|
|
8939
|
+
const propertySchema1 = getProperty1(key);
|
|
8940
|
+
const propertySchema2 = getProperty2(key);
|
|
8941
|
+
if (areNotBothNever(propertySchema1, propertySchema2)) return context.calculate(propertySchema1, propertySchema2);
|
|
8942
|
+
else return 0;
|
|
8943
|
+
};
|
|
8944
|
+
const { commonRequired, extraRequired1, extraRequired2 } = splitRequiredResult;
|
|
8945
|
+
const quantumVariable = quantum.variable({});
|
|
8946
|
+
for (const requiredKey of [...commonRequired].toSorted()) quantumVariable.push(calculateKey(requiredKey), calculateCommonRequiredExpression);
|
|
8947
|
+
for (const requiredKey of [...extraRequired1].toSorted()) quantumVariable.push(calculateKey(requiredKey), calculateExtraRequiredExpression1);
|
|
8948
|
+
for (const requiredKey of [...extraRequired2].toSorted()) quantumVariable.push(calculateKey(requiredKey), calculateExtraRequiredExpression2);
|
|
8949
|
+
const { hasOptional1, hasOptional2 } = splitRequiredResult;
|
|
8950
|
+
if (hasOptional1 || hasOptional2) {
|
|
8951
|
+
const calculator = calculateOptionalExpression(hasOptional1, hasOptional2);
|
|
8952
|
+
for (const optionalKey of [...getOptionalKeys(schema1, schema2)].toSorted()) {
|
|
8953
|
+
const expression = calculateKey(optionalKey);
|
|
8954
|
+
if (expression !== 0) quantumVariable.push(expression, calculator);
|
|
9093
8955
|
}
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
if (
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
if (schema2.maxItems !== 0) variable.hasExtra2 = true;
|
|
8956
|
+
const additionalProperties1 = schema1.additionalProperties ?? ANY;
|
|
8957
|
+
const additionalProperties2 = schema2.additionalProperties ?? ANY;
|
|
8958
|
+
if (areNotBothNever(additionalProperties1, additionalProperties2)) {
|
|
8959
|
+
const expression = context.calculate(additionalProperties1, additionalProperties2);
|
|
8960
|
+
quantumVariable.push(expression, calculator);
|
|
9100
8961
|
}
|
|
9101
|
-
});
|
|
9102
|
-
let expression = 0;
|
|
9103
|
-
for (const { hasExtra1, hasExtra2, hasCommon, hasCommonBroken } of quantumVariable) {
|
|
9104
|
-
let finalHasCommon = hasCommon;
|
|
9105
|
-
if (hasCommonBroken) finalHasCommon = false;
|
|
9106
|
-
if (!finalHasCommon) expression |= ExpressionRejection;
|
|
9107
|
-
else if (hasExtra1 && hasExtra2) expression |= ExpressionIntersection;
|
|
9108
|
-
else if (hasExtra1) expression |= ExpressionContaining;
|
|
9109
|
-
else if (hasExtra2) expression |= ExpressionContainedBy;
|
|
9110
|
-
else expression |= ExpressionEquals;
|
|
9111
8962
|
}
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
}
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
}
|
|
9129
|
-
function wrapSchemaCalculatorWithCache(check) {
|
|
9130
|
-
const map = /* @__PURE__ */ new Map();
|
|
9131
|
-
return (schema1, schema2) => getWithCache(map, schema1, schema2, check);
|
|
8963
|
+
quantumVariable.update((variable) => {
|
|
8964
|
+
if (!variable.hasRejection) {
|
|
8965
|
+
if (extraRequired1.size > 0) variable.hasExtra2 = true;
|
|
8966
|
+
if (extraRequired2.size > 0) variable.hasExtra1 = true;
|
|
8967
|
+
}
|
|
8968
|
+
});
|
|
8969
|
+
const { requiredKeysCount } = splitRequiredResult;
|
|
8970
|
+
let expression = 0;
|
|
8971
|
+
for (const { hasExtra1, hasExtra2, hasCommonInRequired, hasCommonOutRequired, hasRejection } of quantumVariable) if (!hasCommonInRequired && requiredKeysCount > 0) expression |= ExpressionRejection;
|
|
8972
|
+
else if (!hasCommonOutRequired && requiredKeysCount === 0) expression |= ExpressionRejection;
|
|
8973
|
+
else if (hasRejection) expression |= ExpressionRejection;
|
|
8974
|
+
else if (hasExtra1 && hasExtra2) expression |= ExpressionIntersection;
|
|
8975
|
+
else if (hasExtra1) expression |= ExpressionContaining;
|
|
8976
|
+
else if (hasExtra2) expression |= ExpressionContainedBy;
|
|
8977
|
+
else expression |= ExpressionEquals;
|
|
8978
|
+
return expression;
|
|
9132
8979
|
}
|
|
9133
|
-
function
|
|
9134
|
-
|
|
9135
|
-
let result = map.get(key);
|
|
9136
|
-
if (result === void 0) map.set(key, result = check(node1, node2));
|
|
9137
|
-
return result;
|
|
8980
|
+
function isPropertiesCountCannotMatch(schema1, schema2) {
|
|
8981
|
+
return toExpressionSingleResult(splitRange$1(schema1.minProperties, schema1.maxProperties, schema2.minProperties, schema2.maxProperties)) === ExpressionSingleResult.Rejection;
|
|
9138
8982
|
}
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
const
|
|
9143
|
-
const
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
else foundExtra1 = true;
|
|
9150
|
-
if (foundExtra1 && foundIntersection) break;
|
|
8983
|
+
function splitRequired(schema1, schema2) {
|
|
8984
|
+
const extraRequired1 = new Set(schema1.required);
|
|
8985
|
+
const extraRequired2 = new Set(schema2.required);
|
|
8986
|
+
const commonRequired = /* @__PURE__ */ new Set();
|
|
8987
|
+
const wholeRequired = /* @__PURE__ */ new Set();
|
|
8988
|
+
const requiredCount1 = extraRequired1.size;
|
|
8989
|
+
const requiredCount2 = extraRequired2.size;
|
|
8990
|
+
for (const key of extraRequired1) {
|
|
8991
|
+
if (extraRequired2.has(key)) commonRequired.add(key);
|
|
8992
|
+
wholeRequired.add(key);
|
|
9151
8993
|
}
|
|
9152
|
-
for (const
|
|
9153
|
-
if (
|
|
9154
|
-
|
|
9155
|
-
if (foundExtra2 && foundIntersection) break;
|
|
8994
|
+
for (const key of extraRequired2) {
|
|
8995
|
+
if (extraRequired1.has(key)) commonRequired.add(key);
|
|
8996
|
+
wholeRequired.add(key);
|
|
9156
8997
|
}
|
|
9157
|
-
|
|
9158
|
-
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
return ExpressionEquals;
|
|
9162
|
-
}
|
|
9163
|
-
function calculateEnumAndSchema(enumSchema, schema) {
|
|
9164
|
-
let hasValid = false;
|
|
9165
|
-
let hasInvalid = false;
|
|
9166
|
-
for (const enumValue of normalizeEnumList(enumSchema)) {
|
|
9167
|
-
switch (valid(schema, enumValue)) {
|
|
9168
|
-
case ValidResult.Valid:
|
|
9169
|
-
hasValid = true;
|
|
9170
|
-
break;
|
|
9171
|
-
case ValidResult.Invalid:
|
|
9172
|
-
hasInvalid = true;
|
|
9173
|
-
break;
|
|
9174
|
-
case ValidResult.Unknown: return ExpressionAny;
|
|
9175
|
-
}
|
|
9176
|
-
if (hasValid && hasInvalid) break;
|
|
8998
|
+
const requiredKeysCount = wholeRequired.size;
|
|
8999
|
+
for (const key of commonRequired) {
|
|
9000
|
+
extraRequired1.delete(key);
|
|
9001
|
+
extraRequired2.delete(key);
|
|
9177
9002
|
}
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
if (
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9003
|
+
const maxProperties1 = schema1.maxProperties ?? Number.MAX_SAFE_INTEGER;
|
|
9004
|
+
const maxProperties2 = schema2.maxProperties ?? Number.MAX_SAFE_INTEGER;
|
|
9005
|
+
if (requiredKeysCount > maxProperties1 || requiredKeysCount > maxProperties2) return null;
|
|
9006
|
+
return {
|
|
9007
|
+
requiredKeysCount,
|
|
9008
|
+
extraRequired1,
|
|
9009
|
+
extraRequired2,
|
|
9010
|
+
commonRequired,
|
|
9011
|
+
hasOptional1: maxProperties1 > requiredCount1,
|
|
9012
|
+
hasOptional2: maxProperties2 > requiredCount2
|
|
9013
|
+
};
|
|
9188
9014
|
}
|
|
9189
|
-
function
|
|
9190
|
-
|
|
9191
|
-
|
|
9015
|
+
function getOptionalKeys(schema1, schema2) {
|
|
9016
|
+
const optionalKeys = new Set(schema1.required);
|
|
9017
|
+
const properties1 = schema1.properties;
|
|
9018
|
+
const properties2 = schema2.properties;
|
|
9019
|
+
const required1 = schema1.required;
|
|
9020
|
+
const required2 = schema2.required;
|
|
9021
|
+
if (properties1) for (const key in properties1) optionalKeys.add(key);
|
|
9022
|
+
if (properties2) for (const key in properties2) optionalKeys.add(key);
|
|
9023
|
+
if (required1) for (const key of required1) optionalKeys.delete(key);
|
|
9024
|
+
if (required2) for (const key of required2) optionalKeys.delete(key);
|
|
9025
|
+
return optionalKeys;
|
|
9192
9026
|
}
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9027
|
+
var calculateCommonRequiredExpression = (singleExpression, variable) => {
|
|
9028
|
+
switch (singleExpression) {
|
|
9029
|
+
case ExpressionSingleResult.Equals:
|
|
9030
|
+
variable.hasCommonInRequired = true;
|
|
9031
|
+
break;
|
|
9032
|
+
case ExpressionSingleResult.Containing:
|
|
9033
|
+
variable.hasExtra1 = true;
|
|
9034
|
+
variable.hasCommonInRequired = true;
|
|
9035
|
+
break;
|
|
9036
|
+
case ExpressionSingleResult.ContainedBy:
|
|
9037
|
+
variable.hasExtra2 = true;
|
|
9038
|
+
variable.hasCommonInRequired = true;
|
|
9039
|
+
break;
|
|
9040
|
+
case ExpressionSingleResult.Intersection:
|
|
9041
|
+
variable.hasExtra1 = true;
|
|
9042
|
+
variable.hasExtra2 = true;
|
|
9043
|
+
variable.hasCommonInRequired = true;
|
|
9044
|
+
break;
|
|
9045
|
+
case ExpressionSingleResult.Rejection: variable.hasRejection = true;
|
|
9201
9046
|
}
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9047
|
+
};
|
|
9048
|
+
var calculateExtraRequiredExpression1 = (singleExpression, variable) => {
|
|
9049
|
+
switch (singleExpression) {
|
|
9050
|
+
case ExpressionSingleResult.Equals:
|
|
9051
|
+
case ExpressionSingleResult.ContainedBy:
|
|
9052
|
+
variable.hasCommonInRequired = true;
|
|
9053
|
+
break;
|
|
9054
|
+
case ExpressionSingleResult.Intersection:
|
|
9055
|
+
case ExpressionSingleResult.Containing:
|
|
9056
|
+
variable.hasExtra1 = true;
|
|
9057
|
+
variable.hasCommonInRequired = true;
|
|
9058
|
+
break;
|
|
9059
|
+
case ExpressionSingleResult.Rejection: variable.hasRejection = true;
|
|
9214
9060
|
}
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
return true;
|
|
9061
|
+
};
|
|
9062
|
+
var calculateExtraRequiredExpression2 = (singleExpression, variable) => {
|
|
9063
|
+
switch (singleExpression) {
|
|
9064
|
+
case ExpressionSingleResult.Equals:
|
|
9065
|
+
case ExpressionSingleResult.Containing:
|
|
9066
|
+
variable.hasCommonInRequired = true;
|
|
9067
|
+
break;
|
|
9068
|
+
case ExpressionSingleResult.Intersection:
|
|
9069
|
+
case ExpressionSingleResult.ContainedBy:
|
|
9070
|
+
variable.hasExtra2 = true;
|
|
9071
|
+
variable.hasCommonInRequired = true;
|
|
9072
|
+
break;
|
|
9073
|
+
case ExpressionSingleResult.Rejection: variable.hasRejection = true;
|
|
9229
9074
|
}
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9075
|
+
};
|
|
9076
|
+
var calculateOptionalExpression = (hasOptional1, hasOptional2) => (singleExpression, variable) => {
|
|
9077
|
+
if (variable.hasRejection) return;
|
|
9078
|
+
let foundExtraPossibility1 = false;
|
|
9079
|
+
let foundExtraPossibility2 = false;
|
|
9080
|
+
let foundCommonPossibility = false;
|
|
9081
|
+
switch (singleExpression) {
|
|
9082
|
+
case ExpressionSingleResult.Equals:
|
|
9083
|
+
foundCommonPossibility = true;
|
|
9084
|
+
break;
|
|
9085
|
+
case ExpressionSingleResult.Containing:
|
|
9086
|
+
foundExtraPossibility1 = true;
|
|
9087
|
+
foundCommonPossibility = true;
|
|
9088
|
+
break;
|
|
9089
|
+
case ExpressionSingleResult.ContainedBy:
|
|
9090
|
+
foundExtraPossibility2 = true;
|
|
9091
|
+
foundCommonPossibility = true;
|
|
9092
|
+
break;
|
|
9093
|
+
case ExpressionSingleResult.Intersection:
|
|
9094
|
+
foundExtraPossibility1 = true;
|
|
9095
|
+
foundExtraPossibility2 = true;
|
|
9096
|
+
foundCommonPossibility = true;
|
|
9097
|
+
break;
|
|
9098
|
+
case ExpressionSingleResult.Rejection:
|
|
9099
|
+
foundExtraPossibility1 = true;
|
|
9100
|
+
foundExtraPossibility2 = true;
|
|
9101
|
+
}
|
|
9102
|
+
if (hasOptional1 && foundExtraPossibility1) variable.hasExtra1 = true;
|
|
9103
|
+
if (hasOptional2 && foundExtraPossibility2) variable.hasExtra2 = true;
|
|
9104
|
+
if (hasOptional1 && hasOptional2 && foundCommonPossibility) variable.hasCommonOutRequired = true;
|
|
9105
|
+
};
|
|
9106
|
+
function createPropertySchemaGetter(schema) {
|
|
9107
|
+
const properties = schema.properties;
|
|
9108
|
+
const propertyNames = schema.propertyNames;
|
|
9109
|
+
const additionalProperties = schema.additionalProperties;
|
|
9110
|
+
const patternProperties = [];
|
|
9111
|
+
if (schema.patternProperties) for (const pattern in schema.patternProperties) {
|
|
9112
|
+
const valueSchema = schema.patternProperties[pattern];
|
|
9113
|
+
const regExp = new RegExp(pattern, "i");
|
|
9114
|
+
patternProperties.push({
|
|
9115
|
+
pattern: regExp,
|
|
9116
|
+
schema: valueSchema
|
|
9117
|
+
});
|
|
9118
|
+
}
|
|
9119
|
+
return (key) => {
|
|
9120
|
+
if (propertyNames && valid(propertyNames, key) === ValidResult.Invalid) return NEVER;
|
|
9121
|
+
for (const { pattern, schema: patternSchema } of patternProperties) if (pattern.test(key)) return patternSchema;
|
|
9122
|
+
const propertySchema = (properties && properties[key]) ?? additionalProperties;
|
|
9123
|
+
if (!propertySchema) return ANY;
|
|
9124
|
+
return propertySchema;
|
|
9125
|
+
};
|
|
9126
|
+
}
|
|
9127
|
+
function areNotBothNever(schema1, schema2) {
|
|
9128
|
+
const kind1 = getKind(schema1);
|
|
9129
|
+
const kind2 = getKind(schema2);
|
|
9130
|
+
return kind1 !== CompiledKind.Never || kind2 !== CompiledKind.Never;
|
|
9131
|
+
}
|
|
9132
|
+
//#endregion
|
|
9133
|
+
//#region src/json-schema-subset/checker/string.ts
|
|
9134
|
+
var splitRange = createRangeSplitter(0);
|
|
9135
|
+
function calculateString(schema1, schema2) {
|
|
9136
|
+
if (schema2.format && !schema1.format) return ExpressionContaining;
|
|
9137
|
+
if (schema1.format && schema2.format && schema1.format !== schema2.format) return ExpressionAny;
|
|
9138
|
+
const expression = toExpressionSingleResult(splitRange(schema1.minLength, schema1.maxLength, schema2.minLength, schema2.maxLength));
|
|
9139
|
+
const hasPattern1 = !!schema1.pattern;
|
|
9140
|
+
const hasPattern2 = !!schema2.pattern;
|
|
9141
|
+
switch (expression) {
|
|
9142
|
+
case ExpressionSingleResult.Rejection: return ExpressionRejection;
|
|
9143
|
+
case ExpressionSingleResult.Containing: return hasPattern1 ? ExpressionAny : ExpressionContaining;
|
|
9144
|
+
case ExpressionSingleResult.ContainedBy: return hasPattern2 ? ExpressionAny : ExpressionContainedBy;
|
|
9145
|
+
case ExpressionSingleResult.Equals:
|
|
9146
|
+
if (hasPattern1 && hasPattern2) return schema1.pattern === schema2.pattern ? ExpressionEquals : ExpressionAny;
|
|
9147
|
+
if (hasPattern1) return ExpressionEquals | ExpressionContainedBy;
|
|
9148
|
+
if (hasPattern2) return ExpressionEquals | ExpressionContaining;
|
|
9149
|
+
return ExpressionEquals;
|
|
9150
|
+
case ExpressionSingleResult.Intersection:
|
|
9151
|
+
if (hasPattern1 && hasPattern2) return ExpressionAny;
|
|
9152
|
+
if (hasPattern1) return ExpressionIntersection | ExpressionRejection | ExpressionContainedBy;
|
|
9153
|
+
if (hasPattern2) return ExpressionIntersection | ExpressionRejection | ExpressionContaining;
|
|
9154
|
+
return ExpressionIntersection;
|
|
9237
9155
|
}
|
|
9238
|
-
return isSchemaEquals;
|
|
9239
9156
|
}
|
|
9240
9157
|
//#endregion
|
|
9241
|
-
//#region src/json-schema-subset/checker/
|
|
9242
|
-
function
|
|
9243
|
-
const
|
|
9244
|
-
const
|
|
9245
|
-
const
|
|
9246
|
-
|
|
9158
|
+
//#region src/json-schema-subset/checker/checker.ts
|
|
9159
|
+
function checkWithResult(extendsContext, schema1, schema2) {
|
|
9160
|
+
const context = {};
|
|
9161
|
+
const errorPaths = [];
|
|
9162
|
+
const calculate = wrapSchemaCalculatorWithCache(calculator(extendsContext, context));
|
|
9163
|
+
const describe = describer();
|
|
9164
|
+
const equals = schemaEqualsChecker(extendsContext);
|
|
9165
|
+
context.isEquals = wrapEqualsCheckerWithCache(isDeepEquals);
|
|
9166
|
+
context.calculate = expression({
|
|
9167
|
+
describe,
|
|
9168
|
+
equals,
|
|
9169
|
+
calculate,
|
|
9170
|
+
observeCalculation: (left, right, result, swapped) => {
|
|
9171
|
+
if (!isDecisiveMismatch(swapped ? swap(result) : result)) return;
|
|
9172
|
+
const errorPath = swapped ? findMismatchPath(right, left) : findMismatchPath(left, right);
|
|
9173
|
+
if (errorPath) errorPaths.push(errorPath);
|
|
9174
|
+
}
|
|
9175
|
+
});
|
|
9176
|
+
Object.freeze(context);
|
|
9177
|
+
const comparisonExpression = context.calculate(schema1, schema2);
|
|
9247
9178
|
return {
|
|
9248
|
-
|
|
9249
|
-
|
|
9179
|
+
errorPath: errorPaths[0],
|
|
9180
|
+
expression: comparisonExpression
|
|
9250
9181
|
};
|
|
9251
9182
|
}
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9183
|
+
var describer = () => (schema) => {
|
|
9184
|
+
let description;
|
|
9185
|
+
switch (getKind(schema)) {
|
|
9186
|
+
case CompiledKind.Not:
|
|
9187
|
+
description = {
|
|
9188
|
+
kind: ExpressionKind.Not,
|
|
9189
|
+
expression: schema.not
|
|
9190
|
+
};
|
|
9191
|
+
break;
|
|
9192
|
+
case CompiledKind.Combination:
|
|
9193
|
+
if ("allOf" in schema) description = {
|
|
9194
|
+
kind: ExpressionKind.AllOf,
|
|
9195
|
+
expressions: rejectInSchemaList(schema.allOf, CompiledKind.Any)
|
|
9196
|
+
};
|
|
9197
|
+
else if ("anyOf" in schema) description = {
|
|
9198
|
+
kind: ExpressionKind.AnyOf,
|
|
9199
|
+
expressions: rejectInSchemaList(schema.anyOf, CompiledKind.Never)
|
|
9200
|
+
};
|
|
9201
|
+
else if ("oneOf" in schema) description = {
|
|
9202
|
+
kind: ExpressionKind.OneOf,
|
|
9203
|
+
expressions: rejectInSchemaList(schema.oneOf, CompiledKind.Never)
|
|
9204
|
+
};
|
|
9205
|
+
else throw new Error(`invalid combination JSON Schema: ${JSON.stringify(schema)}`);
|
|
9206
|
+
break;
|
|
9207
|
+
default: description = { kind: ExpressionKind.Leaf };
|
|
9269
9208
|
}
|
|
9270
|
-
return
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
return Math.ceil(float / multipleOf) * multipleOf;
|
|
9280
|
-
}
|
|
9281
|
-
function previousInteger(float, multipleOf) {
|
|
9282
|
-
return Math.floor(float / multipleOf) * multipleOf;
|
|
9283
|
-
}
|
|
9284
|
-
//#endregion
|
|
9285
|
-
//#region src/json-schema-subset/checker/numeric/float.ts
|
|
9286
|
-
function calculateFloat(schema1, schema2) {
|
|
9287
|
-
const { left, right, center } = splitRange$3(pickRange(schema1), pickRange(schema2));
|
|
9288
|
-
if (!center) return ExpressionRejection;
|
|
9289
|
-
let extraLeft = false;
|
|
9290
|
-
let extraRight = false;
|
|
9291
|
-
if (left) {
|
|
9292
|
-
if (left.fromLeft) extraLeft = true;
|
|
9293
|
-
else extraRight = true;
|
|
9209
|
+
return description;
|
|
9210
|
+
};
|
|
9211
|
+
var calculator = (extendsContext, context) => (schema1, schema2) => {
|
|
9212
|
+
const kind1 = getKind(schema1);
|
|
9213
|
+
const kind2 = getKind(schema2);
|
|
9214
|
+
if (kind1 === CompiledKind.Extends || kind2 === CompiledKind.Extends) return extendsContext.calculate(schema1, schema2);
|
|
9215
|
+
switch (kind1) {
|
|
9216
|
+
case CompiledKind.Any: return kind2 === CompiledKind.Any ? ExpressionEquals : ExpressionContaining;
|
|
9217
|
+
case CompiledKind.Never: return kind2 === CompiledKind.Never ? ExpressionEquals : ExpressionContainedBy;
|
|
9294
9218
|
}
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9219
|
+
switch (kind2) {
|
|
9220
|
+
case CompiledKind.Any: return ExpressionContainedBy;
|
|
9221
|
+
case CompiledKind.Never: return ExpressionContaining;
|
|
9298
9222
|
}
|
|
9299
|
-
if (
|
|
9300
|
-
if (
|
|
9301
|
-
if (
|
|
9302
|
-
return
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
if (result.left?.fromLeft) extraFloat = true;
|
|
9316
|
-
if (result.right?.fromLeft) extraFloat = true;
|
|
9317
|
-
if (!intCenter || !isPointRange(result.center)) extraFloat = true;
|
|
9318
|
-
if (leftIntRange) extraInteger = true;
|
|
9319
|
-
if (rightIntRange) extraInteger = true;
|
|
9320
|
-
if (extraFloat && extraInteger) return ExpressionIntersection;
|
|
9321
|
-
if (extraFloat) return ExpressionContaining;
|
|
9322
|
-
if (extraInteger) return ExpressionContainedBy;
|
|
9323
|
-
return ExpressionEquals;
|
|
9324
|
-
}
|
|
9325
|
-
function pickRange(schema) {
|
|
9326
|
-
let point1;
|
|
9327
|
-
let point2;
|
|
9328
|
-
if (schema.exclusiveMinimum !== void 0) point1 = {
|
|
9329
|
-
num: schema.exclusiveMinimum,
|
|
9330
|
-
exclusive: true
|
|
9331
|
-
};
|
|
9332
|
-
else if (schema.minimum !== void 0) point1 = {
|
|
9333
|
-
num: schema.minimum,
|
|
9334
|
-
exclusive: false
|
|
9335
|
-
};
|
|
9336
|
-
else point1 = {
|
|
9337
|
-
num: Number.NEGATIVE_INFINITY,
|
|
9338
|
-
exclusive: true
|
|
9339
|
-
};
|
|
9340
|
-
if (schema.exclusiveMaximum !== void 0) point2 = {
|
|
9341
|
-
num: schema.exclusiveMaximum,
|
|
9342
|
-
exclusive: true
|
|
9343
|
-
};
|
|
9344
|
-
else if (schema.maximum !== void 0) point2 = {
|
|
9345
|
-
num: schema.maximum,
|
|
9346
|
-
exclusive: false
|
|
9347
|
-
};
|
|
9348
|
-
else point2 = {
|
|
9349
|
-
num: Number.POSITIVE_INFINITY,
|
|
9350
|
-
exclusive: true
|
|
9351
|
-
};
|
|
9352
|
-
return [point1, point2];
|
|
9223
|
+
if (kind1 === CompiledKind.EnumOrConst && kind2 === CompiledKind.EnumOrConst) return calculateEnumAndEnum(context, schema1, schema2);
|
|
9224
|
+
if (kind1 === CompiledKind.EnumOrConst) return calculateEnumAndSchema(schema1, schema2);
|
|
9225
|
+
if (kind2 === CompiledKind.EnumOrConst) return swap(calculateEnumAndSchema(schema2, schema1));
|
|
9226
|
+
if (kind1 !== kind2) return ExpressionRejection;
|
|
9227
|
+
switch (kind1) {
|
|
9228
|
+
case CompiledKind.Null: return ExpressionEquals;
|
|
9229
|
+
case CompiledKind.Numeric: return calculateNumeric(schema1, schema2);
|
|
9230
|
+
case CompiledKind.String: return calculateString(schema1, schema2);
|
|
9231
|
+
case CompiledKind.Boolean: return ExpressionEquals;
|
|
9232
|
+
case CompiledKind.Object: return calculateObject(context, schema1, schema2);
|
|
9233
|
+
case CompiledKind.Array: return calculateArray(context, schema1, schema2);
|
|
9234
|
+
default: throw new Error(`invalid kind ${kind1}`);
|
|
9235
|
+
}
|
|
9236
|
+
};
|
|
9237
|
+
function rejectInSchemaList(schemaList, kind) {
|
|
9238
|
+
return schemaList.filter((e) => getKind(e) !== kind);
|
|
9353
9239
|
}
|
|
9354
|
-
function
|
|
9355
|
-
|
|
9356
|
-
if (side.fromLeft) return;
|
|
9357
|
-
return cutRange(side.range, multipleOf);
|
|
9240
|
+
function isDecisiveMismatch(result) {
|
|
9241
|
+
return !hasEquals(result) && !hasContainedBy(result) && (hasContaining(result) || hasIntersection(result) || hasRejection(result));
|
|
9358
9242
|
}
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
const
|
|
9363
|
-
const
|
|
9364
|
-
if (
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9243
|
+
function findMismatchPath(source, target) {
|
|
9244
|
+
const targetPath = getPath(target);
|
|
9245
|
+
if (!targetPath) return void 0;
|
|
9246
|
+
const sourceKind = getKind(source);
|
|
9247
|
+
const targetKind = getKind(target);
|
|
9248
|
+
if (sourceKind !== targetKind) return [...targetPath, "type"];
|
|
9249
|
+
const sourceSchema = source;
|
|
9250
|
+
const targetSchema = target;
|
|
9251
|
+
switch (targetKind) {
|
|
9252
|
+
case CompiledKind.String:
|
|
9253
|
+
if ((sourceSchema.minLength ?? 0) < (targetSchema.minLength ?? 0)) return [...targetPath, "minLength"];
|
|
9254
|
+
if ((sourceSchema.maxLength ?? Number.POSITIVE_INFINITY) > (targetSchema.maxLength ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxLength"];
|
|
9255
|
+
if (sourceSchema.pattern !== targetSchema.pattern && targetSchema.pattern) return [...targetPath, "pattern"];
|
|
9256
|
+
if (sourceSchema.format !== targetSchema.format && targetSchema.format) return [...targetPath, "format"];
|
|
9257
|
+
break;
|
|
9258
|
+
case CompiledKind.Numeric:
|
|
9259
|
+
if ((sourceSchema.minimum ?? sourceSchema.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) < (targetSchema.minimum ?? targetSchema.exclusiveMinimum ?? Number.NEGATIVE_INFINITY)) return [...targetPath, targetSchema.exclusiveMinimum == null ? "minimum" : "exclusiveMinimum"];
|
|
9260
|
+
if ((sourceSchema.maximum ?? sourceSchema.exclusiveMaximum ?? Number.POSITIVE_INFINITY) > (targetSchema.maximum ?? targetSchema.exclusiveMaximum ?? Number.POSITIVE_INFINITY)) return [...targetPath, targetSchema.exclusiveMaximum == null ? "maximum" : "exclusiveMaximum"];
|
|
9261
|
+
if (sourceSchema.multipleOf !== targetSchema.multipleOf && targetSchema.multipleOf != null) return [...targetPath, "multipleOf"];
|
|
9262
|
+
break;
|
|
9263
|
+
case CompiledKind.Array:
|
|
9264
|
+
if ((sourceSchema.minItems ?? 0) < (targetSchema.minItems ?? 0)) return [...targetPath, "minItems"];
|
|
9265
|
+
if ((sourceSchema.maxItems ?? Number.POSITIVE_INFINITY) > (targetSchema.maxItems ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxItems"];
|
|
9266
|
+
if (!sourceSchema.uniqueItems && targetSchema.uniqueItems) return [...targetPath, "uniqueItems"];
|
|
9267
|
+
break;
|
|
9268
|
+
case CompiledKind.Object: {
|
|
9269
|
+
const sourceRequired = new Set(sourceSchema.required ?? []);
|
|
9270
|
+
if ((targetSchema.required ?? []).some((key) => !sourceRequired.has(key))) return [...targetPath, "required"];
|
|
9271
|
+
if ((sourceSchema.minProperties ?? 0) < (targetSchema.minProperties ?? 0)) return [...targetPath, "minProperties"];
|
|
9272
|
+
if ((sourceSchema.maxProperties ?? Number.POSITIVE_INFINITY) > (targetSchema.maxProperties ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxProperties"];
|
|
9273
|
+
break;
|
|
9274
|
+
}
|
|
9275
|
+
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const == null ? "enum" : "const"];
|
|
9276
|
+
}
|
|
9277
|
+
return targetPath;
|
|
9278
|
+
}
|
|
9279
|
+
//#endregion
|
|
9280
|
+
//#region src/json-schema-subset/extends/extendsContext.ts
|
|
9281
|
+
var ExtendsContext = class ExtendsContext {
|
|
9282
|
+
constructor(extendsSchemaClasses = []) {
|
|
9283
|
+
this.extendsSchemaClasses = Object.freeze([...extendsSchemaClasses]);
|
|
9375
9284
|
}
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
const { left, right } = result;
|
|
9380
|
-
if (left && cutRange(left.range, left.fromLeft ? multipleOf1 : multipleOf2)) {
|
|
9381
|
-
if (left.fromLeft) extraLeft = true;
|
|
9382
|
-
else extraRight = true;
|
|
9285
|
+
tryCompiledExtendsSchema(target, payload) {
|
|
9286
|
+
for (const extendsSchemaClass of this.extendsSchemaClasses) if (extendsSchemaClass.isMatch(target)) return new extendsSchemaClass(createId(), target, payload);
|
|
9287
|
+
return null;
|
|
9383
9288
|
}
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9289
|
+
isExtendsSchema(target) {
|
|
9290
|
+
for (const extendsSchemaClass of this.extendsSchemaClasses) if (target instanceof extendsSchemaClass) return true;
|
|
9291
|
+
return false;
|
|
9387
9292
|
}
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9293
|
+
calculate(schema1, schema2) {
|
|
9294
|
+
const shouldSwap = !(schema1 instanceof this.findMatchedClass(schema1, schema2));
|
|
9295
|
+
let expressionResult = 0;
|
|
9296
|
+
let result;
|
|
9297
|
+
if (shouldSwap) result = schema2.compare(schema1);
|
|
9298
|
+
else result = schema1.compare(schema2);
|
|
9299
|
+
for (let expression of result) {
|
|
9300
|
+
if (shouldSwap) expression = ExtendsContext.swap(expression);
|
|
9301
|
+
expressionResult |= toExpression(expression);
|
|
9302
|
+
}
|
|
9303
|
+
return expressionResult;
|
|
9304
|
+
}
|
|
9305
|
+
equals(schema1, schema2) {
|
|
9306
|
+
if (!(schema1 instanceof this.findMatchedClass(schema1, schema2))) return schema2.equals(schema1);
|
|
9307
|
+
else return schema1.equals(schema2);
|
|
9308
|
+
}
|
|
9309
|
+
findMatchedClass(schema1, schema2) {
|
|
9310
|
+
for (const schemaClass of this.extendsSchemaClasses) {
|
|
9311
|
+
if (schema1 instanceof schemaClass) return schemaClass;
|
|
9312
|
+
if (schema2 instanceof schemaClass) return schemaClass;
|
|
9313
|
+
}
|
|
9314
|
+
throw new Error("Invalid schema");
|
|
9315
|
+
}
|
|
9316
|
+
static swap(expression) {
|
|
9317
|
+
switch (expression) {
|
|
9318
|
+
case ExpressionSingleResult.Containing: return ExpressionSingleResult.ContainedBy;
|
|
9319
|
+
case ExpressionSingleResult.ContainedBy: return ExpressionSingleResult.Containing;
|
|
9320
|
+
default: return expression;
|
|
9321
|
+
}
|
|
9322
|
+
}
|
|
9323
|
+
};
|
|
9324
|
+
//#endregion
|
|
9325
|
+
//#region src/json-schema-subset/preprocessing.ts
|
|
9326
|
+
function preprocessSchema(schema, compile, printWarnLog = false) {
|
|
9327
|
+
const schemaResult = compile(schema);
|
|
9328
|
+
if (Array.isArray(schemaResult)) {
|
|
9329
|
+
const errorItems = [];
|
|
9330
|
+
collectWithPathPrefix(errorItems, schemaResult, "$");
|
|
9331
|
+
throw new SchemaError(errorItems);
|
|
9332
|
+
}
|
|
9333
|
+
const { schema: compiledSchema, warns } = schemaResult;
|
|
9334
|
+
if (printWarnLog && warns.length > 0) {
|
|
9335
|
+
console.warn(`found ${warns.length} warns after compile schema`);
|
|
9336
|
+
for (const warn of warns) console.warn(stringifySchemaError(warn));
|
|
9337
|
+
}
|
|
9338
|
+
return compiledSchema;
|
|
9406
9339
|
}
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9340
|
+
function preprocessSchemasPair(schema1, schema2, compile, printWarnLog = false) {
|
|
9341
|
+
const schemaResult1 = compile(schema1);
|
|
9342
|
+
const schemaResult2 = compile(schema2);
|
|
9343
|
+
if (Array.isArray(schemaResult1) || Array.isArray(schemaResult2)) {
|
|
9344
|
+
const errorItems = [];
|
|
9345
|
+
if (Array.isArray(schemaResult1)) collectWithPathPrefix(errorItems, schemaResult1, "$1");
|
|
9346
|
+
if (Array.isArray(schemaResult2)) collectWithPathPrefix(errorItems, schemaResult2, "$2");
|
|
9347
|
+
throw new SchemaError(errorItems);
|
|
9348
|
+
}
|
|
9349
|
+
const { schema: compiledSchema1, warns: superWarns } = schemaResult1;
|
|
9350
|
+
const { schema: compiledSchema2, warns: subWarns } = schemaResult2;
|
|
9351
|
+
if (printWarnLog) {
|
|
9352
|
+
if (superWarns.length > 0) console.warn(`found ${superWarns.length} warns after compile superSchema`);
|
|
9353
|
+
for (const warn of superWarns) console.warn(stringifySchemaError(warn));
|
|
9354
|
+
if (subWarns.length > 0) console.warn(`found ${subWarns.length} warns after compile subSchema`);
|
|
9355
|
+
for (const warn of subWarns) console.warn(stringifySchemaError(warn));
|
|
9356
|
+
}
|
|
9357
|
+
return [compiledSchema1, compiledSchema2];
|
|
9410
9358
|
}
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9359
|
+
function collectWithPathPrefix(errorItems, compiledItems, prefix) {
|
|
9360
|
+
for (const compiledItem of compiledItems) {
|
|
9361
|
+
const replacedItem = {
|
|
9362
|
+
...compiledItem,
|
|
9363
|
+
path: [prefix, ...compiledItem.path]
|
|
9364
|
+
};
|
|
9365
|
+
errorItems.push(replacedItem);
|
|
9366
|
+
}
|
|
9415
9367
|
}
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9368
|
+
//#endregion
|
|
9369
|
+
//#region src/json-schema-subset/global.ts
|
|
9370
|
+
var SubsetCompareResult = Object.freeze({
|
|
9371
|
+
True: 0,
|
|
9372
|
+
False: 1,
|
|
9373
|
+
Unknown: 2
|
|
9374
|
+
});
|
|
9375
|
+
function makeSubsetCompare({ extendsSchemaClasses, delegate } = {}) {
|
|
9376
|
+
const extendsContext = new ExtendsContext(extendsSchemaClasses);
|
|
9377
|
+
return Object.freeze({
|
|
9378
|
+
compile: (schema, payload, printWarnLog) => {
|
|
9379
|
+
const compiler = (candidate) => compile(candidate, extendsContext, payload, delegate);
|
|
9380
|
+
return preprocessSchema(schema, compiler, printWarnLog);
|
|
9381
|
+
},
|
|
9382
|
+
isSubset: (superSchema, subSchema, printWarnLog = false) => {
|
|
9383
|
+
const compiler = (candidate) => compile(candidate, extendsContext, void 0, delegate);
|
|
9384
|
+
const [schema1, schema2] = preprocessSchemasPair(superSchema, subSchema, compiler, printWarnLog);
|
|
9385
|
+
const { errorPath, expression } = checkWithResult(extendsContext, schema1, schema2);
|
|
9386
|
+
const foundTrueExpression = hasEquals(expression) || hasContainedBy(expression);
|
|
9387
|
+
const foundFalseExpression = hasContaining(expression) || hasIntersection(expression) || hasRejection(expression);
|
|
9388
|
+
if (foundTrueExpression && !foundFalseExpression) return { result: SubsetCompareResult.True };
|
|
9389
|
+
if (!foundTrueExpression && foundFalseExpression) return {
|
|
9390
|
+
errorPath,
|
|
9391
|
+
result: SubsetCompareResult.False
|
|
9392
|
+
};
|
|
9393
|
+
return { result: SubsetCompareResult.Unknown };
|
|
9394
|
+
}
|
|
9395
|
+
});
|
|
9420
9396
|
}
|
|
9421
9397
|
//#endregion
|
|
9422
|
-
//#region
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9398
|
+
//#region ../../node_modules/.bun/@wopjs+cast@0.1.16/node_modules/@wopjs/cast/dist/index.mjs
|
|
9399
|
+
var isString = (x) => typeof x === "string";
|
|
9400
|
+
var isArray = Array.isArray;
|
|
9401
|
+
var isObject = (x) => x !== null && typeof x === "object";
|
|
9402
|
+
var isPlainObject = (x) => isObject(x) && !isArray(x);
|
|
9403
|
+
var toPlainObject = (x) => isPlainObject(x) ? x : void 0;
|
|
9404
|
+
//#endregion
|
|
9405
|
+
//#region src/manifest/common/schemaComparer.ts
|
|
9406
|
+
function isStringLikeSchema(value) {
|
|
9407
|
+
return toPlainObject(value)?.type === "string";
|
|
9431
9408
|
}
|
|
9432
|
-
function
|
|
9433
|
-
const
|
|
9434
|
-
|
|
9435
|
-
if (!
|
|
9436
|
-
if (multipleOf < 0) return true;
|
|
9437
|
-
return false;
|
|
9409
|
+
function assertSchemaCompareContext(value) {
|
|
9410
|
+
const context = toPlainObject(value);
|
|
9411
|
+
const error = toPlainObject(context?.error);
|
|
9412
|
+
if (context == null || error == null || context.packageId != null && !isString(context.packageId) || error.message != null && !isString(error.message)) throw new TypeError("Invalid schema comparison context.");
|
|
9438
9413
|
}
|
|
9439
|
-
function
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
return true;
|
|
9414
|
+
function parseSchemaCompareContext(value) {
|
|
9415
|
+
if (value == null) return { error: {} };
|
|
9416
|
+
assertSchemaCompareContext(value);
|
|
9417
|
+
return value;
|
|
9444
9418
|
}
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
const
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
if (areNotBothNever(additionalProperties1, additionalProperties2)) {
|
|
9482
|
-
const expression = context.calculate(additionalProperties1, additionalProperties2);
|
|
9483
|
-
quantumVariable.push(expression, calculator);
|
|
9419
|
+
var SpecialSchema = class SpecialSchema {
|
|
9420
|
+
static setError(fromSchema, toSchema, message) {
|
|
9421
|
+
if (fromSchema instanceof SpecialSchema) fromSchema.context.error.message = message;
|
|
9422
|
+
else if (toSchema instanceof SpecialSchema) toSchema.context.error.message = message;
|
|
9423
|
+
}
|
|
9424
|
+
constructor(id, value, context) {
|
|
9425
|
+
this.id = id;
|
|
9426
|
+
this.value = value;
|
|
9427
|
+
this.context = parseSchemaCompareContext(context);
|
|
9428
|
+
}
|
|
9429
|
+
compare(other) {
|
|
9430
|
+
if (isCompiledSchema(other) && getKind(other) === CompiledKind.Any) return [ExpressionSingleResult.ContainedBy];
|
|
9431
|
+
return this.compareImpl(other);
|
|
9432
|
+
}
|
|
9433
|
+
};
|
|
9434
|
+
var SingleSelectSchema = class SingleSelectSchema extends SpecialSchema {
|
|
9435
|
+
static isMatch(value) {
|
|
9436
|
+
const enumValues = toPlainObject(value)?.enum;
|
|
9437
|
+
return Array.isArray(enumValues) && enumValues.every((v) => isString(v));
|
|
9438
|
+
}
|
|
9439
|
+
constructor(id, value, context) {
|
|
9440
|
+
if (!SingleSelectSchema.isMatch(value)) throw new TypeError("Invalid single-select schema.");
|
|
9441
|
+
super(id, value, context);
|
|
9442
|
+
}
|
|
9443
|
+
compareImpl(other) {
|
|
9444
|
+
if (isStringLikeSchema(other)) return [ExpressionSingleResult.ContainedBy];
|
|
9445
|
+
if (other instanceof SingleSelectSchema) {
|
|
9446
|
+
const f = new Set(this.value.enum);
|
|
9447
|
+
let result = ExpressionSingleResult.Equals;
|
|
9448
|
+
for (const v of other.value.enum) {
|
|
9449
|
+
if (!f.has(v)) result = ExpressionSingleResult.ContainedBy;
|
|
9450
|
+
f.delete(v);
|
|
9451
|
+
}
|
|
9452
|
+
if (f.size === 0) return [result];
|
|
9453
|
+
if (f.size === this.value.enum.length) return [ExpressionSingleResult.Rejection];
|
|
9454
|
+
return [ExpressionSingleResult.Intersection];
|
|
9484
9455
|
}
|
|
9456
|
+
return [ExpressionSingleResult.Rejection];
|
|
9485
9457
|
}
|
|
9486
|
-
|
|
9487
|
-
if (
|
|
9488
|
-
|
|
9489
|
-
|
|
9458
|
+
equals(other) {
|
|
9459
|
+
if (other instanceof SingleSelectSchema) {
|
|
9460
|
+
const f = new Set(this.value.enum);
|
|
9461
|
+
for (const v of other.value.enum) {
|
|
9462
|
+
if (!f.has(v)) return false;
|
|
9463
|
+
f.delete(v);
|
|
9464
|
+
}
|
|
9465
|
+
return f.size === 0;
|
|
9490
9466
|
}
|
|
9491
|
-
|
|
9492
|
-
const { requiredKeysCount } = splitRequiredResult;
|
|
9493
|
-
let expression = 0;
|
|
9494
|
-
for (const { hasExtra1, hasExtra2, hasCommonInRequired, hasCommonOutRequired, hasRejection } of quantumVariable) if (!hasCommonInRequired && requiredKeysCount > 0) expression |= ExpressionRejection;
|
|
9495
|
-
else if (!hasCommonOutRequired && requiredKeysCount === 0) expression |= ExpressionRejection;
|
|
9496
|
-
else if (hasRejection) expression |= ExpressionRejection;
|
|
9497
|
-
else if (hasExtra1 && hasExtra2) expression |= ExpressionIntersection;
|
|
9498
|
-
else if (hasExtra1) expression |= ExpressionContaining;
|
|
9499
|
-
else if (hasExtra2) expression |= ExpressionContainedBy;
|
|
9500
|
-
else expression |= ExpressionEquals;
|
|
9501
|
-
return expression;
|
|
9502
|
-
}
|
|
9503
|
-
function isPropertiesCountCannotMatch(schema1, schema2) {
|
|
9504
|
-
return toExpressionSingleResult(splitRange$1(schema1.minProperties, schema1.maxProperties, schema2.minProperties, schema2.maxProperties)) === ExpressionSingleResult.Rejection;
|
|
9505
|
-
}
|
|
9506
|
-
function splitRequired(schema1, schema2) {
|
|
9507
|
-
const extraRequired1 = new Set(schema1.required);
|
|
9508
|
-
const extraRequired2 = new Set(schema2.required);
|
|
9509
|
-
const commonRequired = /* @__PURE__ */ new Set();
|
|
9510
|
-
const wholeRequired = /* @__PURE__ */ new Set();
|
|
9511
|
-
const requiredCount1 = extraRequired1.size;
|
|
9512
|
-
const requiredCount2 = extraRequired2.size;
|
|
9513
|
-
for (const key of extraRequired1) {
|
|
9514
|
-
if (extraRequired2.has(key)) commonRequired.add(key);
|
|
9515
|
-
wholeRequired.add(key);
|
|
9467
|
+
return false;
|
|
9516
9468
|
}
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9469
|
+
};
|
|
9470
|
+
var BinarySchema = class BinarySchema extends SpecialSchema {
|
|
9471
|
+
static isMatch(value) {
|
|
9472
|
+
return toPlainObject(value)?.contentMediaType === "oomol/bin";
|
|
9520
9473
|
}
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
extraRequired2.delete(key);
|
|
9474
|
+
constructor(id, value, context) {
|
|
9475
|
+
if (!BinarySchema.isMatch(value)) throw new TypeError("Invalid binary schema.");
|
|
9476
|
+
super(id, value, context);
|
|
9525
9477
|
}
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
extraRequired2,
|
|
9533
|
-
commonRequired,
|
|
9534
|
-
hasOptional1: maxProperties1 > requiredCount1,
|
|
9535
|
-
hasOptional2: maxProperties2 > requiredCount2
|
|
9536
|
-
};
|
|
9537
|
-
}
|
|
9538
|
-
function getOptionalKeys(schema1, schema2) {
|
|
9539
|
-
const optionalKeys = new Set(schema1.required);
|
|
9540
|
-
const properties1 = schema1.properties;
|
|
9541
|
-
const properties2 = schema2.properties;
|
|
9542
|
-
const required1 = schema1.required;
|
|
9543
|
-
const required2 = schema2.required;
|
|
9544
|
-
if (properties1) for (const key in properties1) optionalKeys.add(key);
|
|
9545
|
-
if (properties2) for (const key in properties2) optionalKeys.add(key);
|
|
9546
|
-
if (required1) for (const key of required1) optionalKeys.delete(key);
|
|
9547
|
-
if (required2) for (const key of required2) optionalKeys.delete(key);
|
|
9548
|
-
return optionalKeys;
|
|
9549
|
-
}
|
|
9550
|
-
var calculateCommonRequiredExpression = (singleExpression, variable) => {
|
|
9551
|
-
switch (singleExpression) {
|
|
9552
|
-
case ExpressionSingleResult.Equals:
|
|
9553
|
-
variable.hasCommonInRequired = true;
|
|
9554
|
-
break;
|
|
9555
|
-
case ExpressionSingleResult.Containing:
|
|
9556
|
-
variable.hasExtra1 = true;
|
|
9557
|
-
variable.hasCommonInRequired = true;
|
|
9558
|
-
break;
|
|
9559
|
-
case ExpressionSingleResult.ContainedBy:
|
|
9560
|
-
variable.hasExtra2 = true;
|
|
9561
|
-
variable.hasCommonInRequired = true;
|
|
9562
|
-
break;
|
|
9563
|
-
case ExpressionSingleResult.Intersection:
|
|
9564
|
-
variable.hasExtra1 = true;
|
|
9565
|
-
variable.hasExtra2 = true;
|
|
9566
|
-
variable.hasCommonInRequired = true;
|
|
9567
|
-
break;
|
|
9568
|
-
case ExpressionSingleResult.Rejection: variable.hasRejection = true;
|
|
9478
|
+
compareImpl(other) {
|
|
9479
|
+
if (other instanceof BinarySchema) return [ExpressionSingleResult.Equals];
|
|
9480
|
+
else {
|
|
9481
|
+
SpecialSchema.setError(this, other, "edgeError.binDiffType");
|
|
9482
|
+
return [ExpressionSingleResult.Rejection];
|
|
9483
|
+
}
|
|
9569
9484
|
}
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
switch (singleExpression) {
|
|
9573
|
-
case ExpressionSingleResult.Equals:
|
|
9574
|
-
case ExpressionSingleResult.ContainedBy:
|
|
9575
|
-
variable.hasCommonInRequired = true;
|
|
9576
|
-
break;
|
|
9577
|
-
case ExpressionSingleResult.Intersection:
|
|
9578
|
-
case ExpressionSingleResult.Containing:
|
|
9579
|
-
variable.hasExtra1 = true;
|
|
9580
|
-
variable.hasCommonInRequired = true;
|
|
9581
|
-
break;
|
|
9582
|
-
case ExpressionSingleResult.Rejection: variable.hasRejection = true;
|
|
9485
|
+
equals(other) {
|
|
9486
|
+
return other instanceof BinarySchema;
|
|
9583
9487
|
}
|
|
9584
9488
|
};
|
|
9585
|
-
var
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
case ExpressionSingleResult.Containing:
|
|
9589
|
-
variable.hasCommonInRequired = true;
|
|
9590
|
-
break;
|
|
9591
|
-
case ExpressionSingleResult.Intersection:
|
|
9592
|
-
case ExpressionSingleResult.ContainedBy:
|
|
9593
|
-
variable.hasExtra2 = true;
|
|
9594
|
-
variable.hasCommonInRequired = true;
|
|
9595
|
-
break;
|
|
9596
|
-
case ExpressionSingleResult.Rejection: variable.hasRejection = true;
|
|
9489
|
+
var ArtifactSchema = class ArtifactSchema extends SpecialSchema {
|
|
9490
|
+
static isMatch(value) {
|
|
9491
|
+
return toPlainObject(value)?.contentMediaType === "oomol/artifact";
|
|
9597
9492
|
}
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
let foundExtraPossibility1 = false;
|
|
9602
|
-
let foundExtraPossibility2 = false;
|
|
9603
|
-
let foundCommonPossibility = false;
|
|
9604
|
-
switch (singleExpression) {
|
|
9605
|
-
case ExpressionSingleResult.Equals:
|
|
9606
|
-
foundCommonPossibility = true;
|
|
9607
|
-
break;
|
|
9608
|
-
case ExpressionSingleResult.Containing:
|
|
9609
|
-
foundExtraPossibility1 = true;
|
|
9610
|
-
foundCommonPossibility = true;
|
|
9611
|
-
break;
|
|
9612
|
-
case ExpressionSingleResult.ContainedBy:
|
|
9613
|
-
foundExtraPossibility2 = true;
|
|
9614
|
-
foundCommonPossibility = true;
|
|
9615
|
-
break;
|
|
9616
|
-
case ExpressionSingleResult.Intersection:
|
|
9617
|
-
foundExtraPossibility1 = true;
|
|
9618
|
-
foundExtraPossibility2 = true;
|
|
9619
|
-
foundCommonPossibility = true;
|
|
9620
|
-
break;
|
|
9621
|
-
case ExpressionSingleResult.Rejection:
|
|
9622
|
-
foundExtraPossibility1 = true;
|
|
9623
|
-
foundExtraPossibility2 = true;
|
|
9493
|
+
constructor(id, value, context) {
|
|
9494
|
+
if (!ArtifactSchema.isMatch(value)) throw new TypeError("Invalid Artifact schema.");
|
|
9495
|
+
super(id, value, context);
|
|
9624
9496
|
}
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
function createPropertySchemaGetter(schema) {
|
|
9630
|
-
const properties = schema.properties;
|
|
9631
|
-
const propertyNames = schema.propertyNames;
|
|
9632
|
-
const additionalProperties = schema.additionalProperties;
|
|
9633
|
-
const patternProperties = [];
|
|
9634
|
-
if (schema.patternProperties) for (const pattern in schema.patternProperties) {
|
|
9635
|
-
const valueSchema = schema.patternProperties[pattern];
|
|
9636
|
-
const regExp = new RegExp(pattern, "i");
|
|
9637
|
-
patternProperties.push({
|
|
9638
|
-
pattern: regExp,
|
|
9639
|
-
schema: valueSchema
|
|
9640
|
-
});
|
|
9497
|
+
compareImpl(other) {
|
|
9498
|
+
if (other instanceof ArtifactSchema) return [ExpressionSingleResult.Equals];
|
|
9499
|
+
SpecialSchema.setError(this, other, "edgeError.artifactDiffType");
|
|
9500
|
+
return [ExpressionSingleResult.Rejection];
|
|
9641
9501
|
}
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
const kind2 = getKind(schema2);
|
|
9653
|
-
return kind1 !== CompiledKind.Never || kind2 !== CompiledKind.Never;
|
|
9502
|
+
equals(other) {
|
|
9503
|
+
return other instanceof ArtifactSchema;
|
|
9504
|
+
}
|
|
9505
|
+
};
|
|
9506
|
+
function createSchemaComparer() {
|
|
9507
|
+
return makeSubsetCompare({ extendsSchemaClasses: [
|
|
9508
|
+
SingleSelectSchema,
|
|
9509
|
+
BinarySchema,
|
|
9510
|
+
ArtifactSchema
|
|
9511
|
+
] });
|
|
9654
9512
|
}
|
|
9513
|
+
createSchemaComparer();
|
|
9655
9514
|
//#endregion
|
|
9656
|
-
//#region src/
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9515
|
+
//#region src/flow/common/schema.ts
|
|
9516
|
+
function schemaObject(schema) {
|
|
9517
|
+
return schema != null && typeof schema == "object" && !Array.isArray(schema) ? schema : void 0;
|
|
9518
|
+
}
|
|
9519
|
+
var validators = /* @__PURE__ */ new WeakMap();
|
|
9520
|
+
function matchesSchema(value, schema) {
|
|
9521
|
+
return schemaValidationErrors(value, schema).length == 0;
|
|
9522
|
+
}
|
|
9523
|
+
function schemaValidationErrors(value, schema) {
|
|
9524
|
+
if (typeof schema == "boolean") return schema ? [] : ["The schema does not allow any value."];
|
|
9525
|
+
const source = schemaObject(schema);
|
|
9526
|
+
if (source == null || source.properties != null && schemaObject(source.properties) == null) return ["Invalid output schema."];
|
|
9527
|
+
try {
|
|
9528
|
+
let validator = validators.get(source);
|
|
9529
|
+
if (validator == null) {
|
|
9530
|
+
const declaration = typeof source.$schema == "string" ? source.$schema : "";
|
|
9531
|
+
const draft = declaration.includes("draft-04") ? "4" : declaration.includes("draft-07") ? "7" : declaration.includes("2020-12") ? "2020-12" : "2019-09";
|
|
9532
|
+
validator = new Validator(structuredClone(source), draft);
|
|
9533
|
+
validators.set(source, validator);
|
|
9534
|
+
}
|
|
9535
|
+
const result = validator.validate(value);
|
|
9536
|
+
return result.valid ? [] : result.errors.map((issue) => `${issue.instanceLocation || "/"}: ${issue.error}`);
|
|
9537
|
+
} catch {
|
|
9538
|
+
return ["Output schema validation failed."];
|
|
9678
9539
|
}
|
|
9679
9540
|
}
|
|
9680
9541
|
//#endregion
|
|
9681
|
-
//#region src/
|
|
9682
|
-
|
|
9683
|
-
|
|
9684
|
-
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9542
|
+
//#region src/decision/common/decision.ts
|
|
9543
|
+
var decisionLimits = {
|
|
9544
|
+
choice: 255,
|
|
9545
|
+
score: 10
|
|
9546
|
+
};
|
|
9547
|
+
/** Ordered prefixes are shared by authoring, schemas, validation, and execution. */
|
|
9548
|
+
function limitDecisionQuestion(question) {
|
|
9549
|
+
if (question.type === "noul" || question.criteria.length <= decisionLimits[question.type]) return question;
|
|
9550
|
+
if (question.type === "choice") return {
|
|
9551
|
+
...question,
|
|
9552
|
+
criteria: question.criteria.slice(0, decisionLimits.choice)
|
|
9553
|
+
};
|
|
9554
|
+
return {
|
|
9555
|
+
...question,
|
|
9556
|
+
criteria: question.criteria.slice(0, decisionLimits.score)
|
|
9557
|
+
};
|
|
9558
|
+
}
|
|
9559
|
+
function limitDecisionQuestions(questions) {
|
|
9560
|
+
const limited = questions.map(limitDecisionQuestion);
|
|
9561
|
+
return limited.every((question, i) => question === questions[i]) ? questions : limited;
|
|
9562
|
+
}
|
|
9563
|
+
/** Loading an oversized task also updates its previously generated output schemas. */
|
|
9564
|
+
function limitDecisionTask(task) {
|
|
9565
|
+
if (task.executor.kind !== "decision") return task;
|
|
9566
|
+
const original = task.executor.questions;
|
|
9567
|
+
const questions = limitDecisionQuestions(original);
|
|
9568
|
+
if (questions === original) return task;
|
|
9569
|
+
const outputs = task.outputs.map((port) => {
|
|
9570
|
+
if (!("handle" in port)) return port;
|
|
9571
|
+
const index = original.findIndex((question) => question.name === port.handle);
|
|
9572
|
+
if (index < 0 || original[index] === questions[index] || !dequal(port.jsonSchema, answerSchema(original[index]))) return port;
|
|
9573
|
+
return {
|
|
9574
|
+
...port,
|
|
9575
|
+
jsonSchema: decisionAnswerSchema(questions[index])
|
|
9576
|
+
};
|
|
9698
9577
|
});
|
|
9699
|
-
Object.freeze(context);
|
|
9700
|
-
const comparisonExpression = context.calculate(schema1, schema2);
|
|
9701
9578
|
return {
|
|
9702
|
-
|
|
9703
|
-
|
|
9579
|
+
...task,
|
|
9580
|
+
executor: {
|
|
9581
|
+
...task.executor,
|
|
9582
|
+
questions
|
|
9583
|
+
},
|
|
9584
|
+
outputs
|
|
9704
9585
|
};
|
|
9705
9586
|
}
|
|
9706
|
-
var
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9587
|
+
var decisionStateSchema = { type: [
|
|
9588
|
+
"string",
|
|
9589
|
+
"object",
|
|
9590
|
+
"array"
|
|
9591
|
+
] };
|
|
9592
|
+
var probability = {
|
|
9593
|
+
type: "number",
|
|
9594
|
+
minimum: 0,
|
|
9595
|
+
maximum: 1
|
|
9596
|
+
};
|
|
9597
|
+
var defaultDecisionQuestion = (name = "decision1") => ({
|
|
9598
|
+
name,
|
|
9599
|
+
type: "noul",
|
|
9600
|
+
instructions: ""
|
|
9601
|
+
});
|
|
9602
|
+
function decisionAnswerSchema(question) {
|
|
9603
|
+
return answerSchema(limitDecisionQuestion(question));
|
|
9604
|
+
}
|
|
9605
|
+
function answerSchema(question) {
|
|
9606
|
+
const properties = { type: { const: question.type } };
|
|
9607
|
+
if (question.type === "noul") properties.noul = probability;
|
|
9608
|
+
else {
|
|
9609
|
+
const keys = question.type === "choice" ? question.criteria.map((item) => item.name) : question.criteria.map((_, index) => String(index));
|
|
9610
|
+
properties.confidence = probability;
|
|
9611
|
+
properties.probabilities = {
|
|
9612
|
+
type: "object",
|
|
9613
|
+
properties: Object.fromEntries(keys.map((key) => [key, probability])),
|
|
9614
|
+
required: keys,
|
|
9615
|
+
additionalProperties: false
|
|
9616
|
+
};
|
|
9617
|
+
if (question.type === "choice") properties.choice = {
|
|
9618
|
+
type: "string",
|
|
9619
|
+
...keys.length ? { enum: keys } : {}
|
|
9620
|
+
};
|
|
9621
|
+
else {
|
|
9622
|
+
properties.score = {
|
|
9623
|
+
type: "number",
|
|
9624
|
+
minimum: 0,
|
|
9625
|
+
maximum: Math.max(0, keys.length - 1)
|
|
9723
9626
|
};
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9627
|
+
properties.legend = {
|
|
9628
|
+
type: "object",
|
|
9629
|
+
properties: Object.fromEntries(keys.map((key) => [key, { type: "string" }])),
|
|
9630
|
+
required: keys,
|
|
9631
|
+
additionalProperties: false
|
|
9727
9632
|
};
|
|
9728
|
-
|
|
9729
|
-
break;
|
|
9730
|
-
default: description = { kind: ExpressionKind.Leaf };
|
|
9633
|
+
}
|
|
9731
9634
|
}
|
|
9732
|
-
return
|
|
9635
|
+
return {
|
|
9636
|
+
type: "object",
|
|
9637
|
+
properties,
|
|
9638
|
+
required: Object.keys(properties)
|
|
9639
|
+
};
|
|
9640
|
+
}
|
|
9641
|
+
function decisionTask(questions = [defaultDecisionQuestion()], name = "AI Decision") {
|
|
9642
|
+
questions = limitDecisionQuestions(questions);
|
|
9643
|
+
const inputs = [{
|
|
9644
|
+
handle: "target",
|
|
9645
|
+
description: "Text, object, or array to evaluate across all questions.",
|
|
9646
|
+
jsonSchema: decisionStateSchema,
|
|
9647
|
+
nullable: false
|
|
9648
|
+
}];
|
|
9649
|
+
const outputs = questions.map((question) => ({
|
|
9650
|
+
handle: question.name,
|
|
9651
|
+
jsonSchema: decisionAnswerSchema(question),
|
|
9652
|
+
nullable: false
|
|
9653
|
+
}));
|
|
9654
|
+
return {
|
|
9655
|
+
name,
|
|
9656
|
+
executor: {
|
|
9657
|
+
kind: "decision",
|
|
9658
|
+
questions
|
|
9659
|
+
},
|
|
9660
|
+
inputs,
|
|
9661
|
+
outputs
|
|
9662
|
+
};
|
|
9663
|
+
}
|
|
9664
|
+
function checkJsonDepth(value, depth = 0) {
|
|
9665
|
+
if (depth > 64) throw new TypeError("Value exceeds the maximum JSON depth.");
|
|
9666
|
+
if (value != null && typeof value == "object") for (const child of Object.values(value)) checkJsonDepth(child, depth + 1);
|
|
9667
|
+
}
|
|
9668
|
+
//#endregion
|
|
9669
|
+
//#region src/flow/common/triggerScheduleSchema.ts
|
|
9670
|
+
var triggerScheduleSchema = array(union([object$1({
|
|
9671
|
+
type: literal("cron"),
|
|
9672
|
+
expression: string(),
|
|
9673
|
+
timezone: string()
|
|
9674
|
+
}), object$1({
|
|
9675
|
+
type: literal("every"),
|
|
9676
|
+
unit: _enum([
|
|
9677
|
+
"day",
|
|
9678
|
+
"hour",
|
|
9679
|
+
"minute",
|
|
9680
|
+
"month",
|
|
9681
|
+
"week"
|
|
9682
|
+
]),
|
|
9683
|
+
value: number()
|
|
9684
|
+
})]));
|
|
9685
|
+
//#endregion
|
|
9686
|
+
//#region src/flow/common/webhookMethod.ts
|
|
9687
|
+
var webhookMethods = [
|
|
9688
|
+
"GET",
|
|
9689
|
+
"POST",
|
|
9690
|
+
"PUT",
|
|
9691
|
+
"PATCH",
|
|
9692
|
+
"DELETE"
|
|
9693
|
+
];
|
|
9694
|
+
var text$1 = string();
|
|
9695
|
+
var json$2 = json$3();
|
|
9696
|
+
var strings = array(text$1);
|
|
9697
|
+
var port = object$1({
|
|
9698
|
+
description: text$1.optional(),
|
|
9699
|
+
jsonSchema: json$2,
|
|
9700
|
+
nullable: boolean(),
|
|
9701
|
+
handle: text$1
|
|
9702
|
+
});
|
|
9703
|
+
var input = port.extend({ value: json$2.optional() });
|
|
9704
|
+
var group = object$1({
|
|
9705
|
+
collapsed: boolean().optional(),
|
|
9706
|
+
group: text$1
|
|
9707
|
+
});
|
|
9708
|
+
var nodeSource = object$1({
|
|
9709
|
+
kind: literal("node"),
|
|
9710
|
+
nodeId: text$1,
|
|
9711
|
+
output: text$1,
|
|
9712
|
+
field: text$1.optional()
|
|
9713
|
+
});
|
|
9714
|
+
var flowSource = object$1({
|
|
9715
|
+
kind: literal("flow"),
|
|
9716
|
+
input: text$1
|
|
9717
|
+
});
|
|
9718
|
+
var source = union([
|
|
9719
|
+
nodeSource,
|
|
9720
|
+
flowSource,
|
|
9721
|
+
object$1({
|
|
9722
|
+
kind: literal("binding"),
|
|
9723
|
+
bindingId: text$1
|
|
9724
|
+
})
|
|
9725
|
+
]);
|
|
9726
|
+
var fixedInput = union([object$1({ kind: literal("unset") }), object$1({
|
|
9727
|
+
kind: literal("value"),
|
|
9728
|
+
value: json$2
|
|
9729
|
+
})]);
|
|
9730
|
+
var mapping = union([fixedInput, object$1({
|
|
9731
|
+
kind: literal("sources"),
|
|
9732
|
+
sources: array(source)
|
|
9733
|
+
})]);
|
|
9734
|
+
var inputs$1 = record(text$1, mapping);
|
|
9735
|
+
var ports = {
|
|
9736
|
+
inputs: array(union([input, group])),
|
|
9737
|
+
outputs: array(union([port, group]))
|
|
9738
|
+
};
|
|
9739
|
+
var capability = union([
|
|
9740
|
+
strictObject({
|
|
9741
|
+
kind: literal("connector"),
|
|
9742
|
+
action: text$1,
|
|
9743
|
+
connectionId: text$1.optional(),
|
|
9744
|
+
connections: array(strictObject({
|
|
9745
|
+
connectionId: text$1,
|
|
9746
|
+
alias: text$1.optional()
|
|
9747
|
+
}))
|
|
9748
|
+
}),
|
|
9749
|
+
strictObject({
|
|
9750
|
+
kind: literal("connector"),
|
|
9751
|
+
mode: literal("shared")
|
|
9752
|
+
}),
|
|
9753
|
+
strictObject({
|
|
9754
|
+
kind: literal("connector"),
|
|
9755
|
+
mode: literal("independent"),
|
|
9756
|
+
actions: array(strictObject({
|
|
9757
|
+
action: text$1,
|
|
9758
|
+
connectionId: text$1.optional()
|
|
9759
|
+
}))
|
|
9760
|
+
}),
|
|
9761
|
+
strictObject({
|
|
9762
|
+
kind: literal("connector"),
|
|
9763
|
+
actionHints: array(text$1).optional(),
|
|
9764
|
+
connectionHints: array(strictObject({
|
|
9765
|
+
action: text$1,
|
|
9766
|
+
connectionId: text$1,
|
|
9767
|
+
alias: text$1.optional()
|
|
9768
|
+
})).optional()
|
|
9769
|
+
})
|
|
9770
|
+
]);
|
|
9771
|
+
var inline = object$1({
|
|
9772
|
+
...ports,
|
|
9773
|
+
name: text$1,
|
|
9774
|
+
moduleId: text$1,
|
|
9775
|
+
capabilities: array(capability).optional()
|
|
9776
|
+
});
|
|
9777
|
+
var agentValue = union([object$1({
|
|
9778
|
+
kind: literal("value"),
|
|
9779
|
+
value: json$2
|
|
9780
|
+
}), object$1({
|
|
9781
|
+
kind: literal("input"),
|
|
9782
|
+
input: text$1
|
|
9783
|
+
})]);
|
|
9784
|
+
var agentInput = union([agentValue, object$1({ kind: literal("model") })]);
|
|
9785
|
+
var decisionQuestion = discriminatedUnion("type", [
|
|
9786
|
+
strictObject({
|
|
9787
|
+
name: text$1,
|
|
9788
|
+
instructions: text$1,
|
|
9789
|
+
type: literal("noul"),
|
|
9790
|
+
criteria: strictObject({
|
|
9791
|
+
true: text$1.optional(),
|
|
9792
|
+
false: text$1.optional()
|
|
9793
|
+
}).optional()
|
|
9794
|
+
}),
|
|
9795
|
+
strictObject({
|
|
9796
|
+
name: text$1,
|
|
9797
|
+
instructions: text$1,
|
|
9798
|
+
type: literal("choice"),
|
|
9799
|
+
criteria: array(strictObject({
|
|
9800
|
+
name: text$1,
|
|
9801
|
+
description: text$1
|
|
9802
|
+
}))
|
|
9803
|
+
}),
|
|
9804
|
+
strictObject({
|
|
9805
|
+
name: text$1,
|
|
9806
|
+
instructions: text$1,
|
|
9807
|
+
type: literal("score"),
|
|
9808
|
+
criteria: strings
|
|
9809
|
+
})
|
|
9810
|
+
]);
|
|
9811
|
+
var managed = object$1({
|
|
9812
|
+
...ports,
|
|
9813
|
+
name: text$1,
|
|
9814
|
+
executor: union([
|
|
9815
|
+
object$1({
|
|
9816
|
+
kind: literal("connector"),
|
|
9817
|
+
action: text$1,
|
|
9818
|
+
connectionId: text$1.optional()
|
|
9819
|
+
}),
|
|
9820
|
+
object$1({
|
|
9821
|
+
kind: literal("openapi"),
|
|
9822
|
+
sourceUrl: text$1,
|
|
9823
|
+
method: text$1,
|
|
9824
|
+
path: text$1,
|
|
9825
|
+
serverUrl: text$1,
|
|
9826
|
+
document: json$2,
|
|
9827
|
+
auth: array(object$1({
|
|
9828
|
+
id: text$1,
|
|
9829
|
+
type: _enum([
|
|
9830
|
+
"bearer",
|
|
9831
|
+
"basic",
|
|
9832
|
+
"apiKey"
|
|
9833
|
+
]),
|
|
9834
|
+
name: text$1.optional(),
|
|
9835
|
+
in: _enum(["header", "query"]).optional()
|
|
9836
|
+
}))
|
|
9837
|
+
}),
|
|
9838
|
+
strictObject({
|
|
9839
|
+
kind: literal("decision"),
|
|
9840
|
+
questions: array(decisionQuestion)
|
|
9841
|
+
}),
|
|
9842
|
+
object$1({
|
|
9843
|
+
kind: literal("llm"),
|
|
9844
|
+
mode: _enum(["chat", "json"])
|
|
9845
|
+
}),
|
|
9846
|
+
object$1({
|
|
9847
|
+
kind: literal("agent"),
|
|
9848
|
+
code: boolean().optional(),
|
|
9849
|
+
model: text$1,
|
|
9850
|
+
prompt: text$1,
|
|
9851
|
+
maxRounds: number(),
|
|
9852
|
+
tools: array(object$1({
|
|
9853
|
+
id: text$1,
|
|
9854
|
+
name: text$1,
|
|
9855
|
+
description: text$1,
|
|
9856
|
+
action: text$1,
|
|
9857
|
+
connectionId: text$1.optional(),
|
|
9858
|
+
approval: boolean(),
|
|
9859
|
+
inputs: array(input.extend({ source: agentInput }))
|
|
9860
|
+
})),
|
|
9861
|
+
notification: object$1({
|
|
9862
|
+
taskId: text$1,
|
|
9863
|
+
messageHandle: text$1,
|
|
9864
|
+
inputs: record(text$1, agentValue)
|
|
9865
|
+
}).optional()
|
|
9866
|
+
})
|
|
9867
|
+
])
|
|
9868
|
+
}).transform(limitDecisionTask);
|
|
9869
|
+
var operand = union([object$1({
|
|
9870
|
+
kind: literal("value"),
|
|
9871
|
+
value: json$2.optional(),
|
|
9872
|
+
jsonSchema: json$2.optional()
|
|
9873
|
+
}), object$1({
|
|
9874
|
+
kind: literal("source"),
|
|
9875
|
+
source
|
|
9876
|
+
})]);
|
|
9877
|
+
var condition = {
|
|
9878
|
+
matchMode: _enum(["first", "all"]),
|
|
9879
|
+
cases: array(object$1({
|
|
9880
|
+
description: text$1.optional(),
|
|
9881
|
+
output: text$1,
|
|
9882
|
+
groups: array(object$1({ expressions: array(object$1({
|
|
9883
|
+
left: operand,
|
|
9884
|
+
operator: _enum([
|
|
9885
|
+
"!=",
|
|
9886
|
+
"<",
|
|
9887
|
+
"<=",
|
|
9888
|
+
"==",
|
|
9889
|
+
">",
|
|
9890
|
+
">=",
|
|
9891
|
+
"contains",
|
|
9892
|
+
"endsWith",
|
|
9893
|
+
"hasKey",
|
|
9894
|
+
"hasValue",
|
|
9895
|
+
"isEmpty",
|
|
9896
|
+
"isFalse",
|
|
9897
|
+
"isNotEmpty",
|
|
9898
|
+
"isNotNull",
|
|
9899
|
+
"isNull",
|
|
9900
|
+
"isTrue",
|
|
9901
|
+
"notContains",
|
|
9902
|
+
"notHasKey",
|
|
9903
|
+
"notHasValue",
|
|
9904
|
+
"startsWith"
|
|
9905
|
+
]),
|
|
9906
|
+
right: operand.optional()
|
|
9907
|
+
})) }))
|
|
9908
|
+
}))
|
|
9733
9909
|
};
|
|
9734
|
-
var
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
if (kind1 === CompiledKind.Extends || kind2 === CompiledKind.Extends) return extendsContext.calculate(schema1, schema2);
|
|
9738
|
-
switch (kind1) {
|
|
9739
|
-
case CompiledKind.Any: return kind2 === CompiledKind.Any ? ExpressionEquals : ExpressionContaining;
|
|
9740
|
-
case CompiledKind.Never: return kind2 === CompiledKind.Never ? ExpressionEquals : ExpressionContainedBy;
|
|
9741
|
-
}
|
|
9742
|
-
switch (kind2) {
|
|
9743
|
-
case CompiledKind.Any: return ExpressionContainedBy;
|
|
9744
|
-
case CompiledKind.Never: return ExpressionContaining;
|
|
9745
|
-
}
|
|
9746
|
-
if (kind1 === CompiledKind.EnumOrConst && kind2 === CompiledKind.EnumOrConst) return calculateEnumAndEnum(context, schema1, schema2);
|
|
9747
|
-
if (kind1 === CompiledKind.EnumOrConst) return calculateEnumAndSchema(schema1, schema2);
|
|
9748
|
-
if (kind2 === CompiledKind.EnumOrConst) return swap(calculateEnumAndSchema(schema2, schema1));
|
|
9749
|
-
if (kind1 !== kind2) return ExpressionRejection;
|
|
9750
|
-
switch (kind1) {
|
|
9751
|
-
case CompiledKind.Null: return ExpressionEquals;
|
|
9752
|
-
case CompiledKind.Numeric: return calculateNumeric(schema1, schema2);
|
|
9753
|
-
case CompiledKind.String: return calculateString(schema1, schema2);
|
|
9754
|
-
case CompiledKind.Boolean: return ExpressionEquals;
|
|
9755
|
-
case CompiledKind.Object: return calculateObject(context, schema1, schema2);
|
|
9756
|
-
case CompiledKind.Array: return calculateArray(context, schema1, schema2);
|
|
9757
|
-
default: throw new Error(`invalid kind ${kind1}`);
|
|
9758
|
-
}
|
|
9910
|
+
var wait = {
|
|
9911
|
+
inputDefinitions: array(input),
|
|
9912
|
+
prompt: text$1
|
|
9759
9913
|
};
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
const sourceSchema = source;
|
|
9773
|
-
const targetSchema = target;
|
|
9774
|
-
switch (targetKind) {
|
|
9775
|
-
case CompiledKind.String:
|
|
9776
|
-
if ((sourceSchema.minLength ?? 0) < (targetSchema.minLength ?? 0)) return [...targetPath, "minLength"];
|
|
9777
|
-
if ((sourceSchema.maxLength ?? Number.POSITIVE_INFINITY) > (targetSchema.maxLength ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxLength"];
|
|
9778
|
-
if (sourceSchema.pattern !== targetSchema.pattern && targetSchema.pattern) return [...targetPath, "pattern"];
|
|
9779
|
-
if (sourceSchema.format !== targetSchema.format && targetSchema.format) return [...targetPath, "format"];
|
|
9780
|
-
break;
|
|
9781
|
-
case CompiledKind.Numeric:
|
|
9782
|
-
if ((sourceSchema.minimum ?? sourceSchema.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) < (targetSchema.minimum ?? targetSchema.exclusiveMinimum ?? Number.NEGATIVE_INFINITY)) return [...targetPath, targetSchema.exclusiveMinimum == null ? "minimum" : "exclusiveMinimum"];
|
|
9783
|
-
if ((sourceSchema.maximum ?? sourceSchema.exclusiveMaximum ?? Number.POSITIVE_INFINITY) > (targetSchema.maximum ?? targetSchema.exclusiveMaximum ?? Number.POSITIVE_INFINITY)) return [...targetPath, targetSchema.exclusiveMaximum == null ? "maximum" : "exclusiveMaximum"];
|
|
9784
|
-
if (sourceSchema.multipleOf !== targetSchema.multipleOf && targetSchema.multipleOf != null) return [...targetPath, "multipleOf"];
|
|
9785
|
-
break;
|
|
9786
|
-
case CompiledKind.Array:
|
|
9787
|
-
if ((sourceSchema.minItems ?? 0) < (targetSchema.minItems ?? 0)) return [...targetPath, "minItems"];
|
|
9788
|
-
if ((sourceSchema.maxItems ?? Number.POSITIVE_INFINITY) > (targetSchema.maxItems ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxItems"];
|
|
9789
|
-
if (!sourceSchema.uniqueItems && targetSchema.uniqueItems) return [...targetPath, "uniqueItems"];
|
|
9790
|
-
break;
|
|
9791
|
-
case CompiledKind.Object: {
|
|
9792
|
-
const sourceRequired = new Set(sourceSchema.required ?? []);
|
|
9793
|
-
if ((targetSchema.required ?? []).some((key) => !sourceRequired.has(key))) return [...targetPath, "required"];
|
|
9794
|
-
if ((sourceSchema.minProperties ?? 0) < (targetSchema.minProperties ?? 0)) return [...targetPath, "minProperties"];
|
|
9795
|
-
if ((sourceSchema.maxProperties ?? Number.POSITIVE_INFINITY) > (targetSchema.maxProperties ?? Number.POSITIVE_INFINITY)) return [...targetPath, "maxProperties"];
|
|
9796
|
-
break;
|
|
9797
|
-
}
|
|
9798
|
-
case CompiledKind.EnumOrConst: return [...targetPath, targetSchema.const == null ? "enum" : "const"];
|
|
9799
|
-
}
|
|
9800
|
-
return targetPath;
|
|
9801
|
-
}
|
|
9802
|
-
//#endregion
|
|
9803
|
-
//#region src/json-schema-subset/extends/extendsContext.ts
|
|
9804
|
-
var ExtendsContext = class ExtendsContext {
|
|
9805
|
-
constructor(extendsSchemaClasses = []) {
|
|
9806
|
-
this.extendsSchemaClasses = Object.freeze([...extendsSchemaClasses]);
|
|
9807
|
-
}
|
|
9808
|
-
tryCompiledExtendsSchema(target, payload) {
|
|
9809
|
-
for (const extendsSchemaClass of this.extendsSchemaClasses) if (extendsSchemaClass.isMatch(target)) return new extendsSchemaClass(createId(), target, payload);
|
|
9810
|
-
return null;
|
|
9811
|
-
}
|
|
9812
|
-
isExtendsSchema(target) {
|
|
9813
|
-
for (const extendsSchemaClass of this.extendsSchemaClasses) if (target instanceof extendsSchemaClass) return true;
|
|
9814
|
-
return false;
|
|
9815
|
-
}
|
|
9816
|
-
calculate(schema1, schema2) {
|
|
9817
|
-
const shouldSwap = !(schema1 instanceof this.findMatchedClass(schema1, schema2));
|
|
9818
|
-
let expressionResult = 0;
|
|
9819
|
-
let result;
|
|
9820
|
-
if (shouldSwap) result = schema2.compare(schema1);
|
|
9821
|
-
else result = schema1.compare(schema2);
|
|
9822
|
-
for (let expression of result) {
|
|
9823
|
-
if (shouldSwap) expression = ExtendsContext.swap(expression);
|
|
9824
|
-
expressionResult |= toExpression(expression);
|
|
9825
|
-
}
|
|
9826
|
-
return expressionResult;
|
|
9827
|
-
}
|
|
9828
|
-
equals(schema1, schema2) {
|
|
9829
|
-
if (!(schema1 instanceof this.findMatchedClass(schema1, schema2))) return schema2.equals(schema1);
|
|
9830
|
-
else return schema1.equals(schema2);
|
|
9831
|
-
}
|
|
9832
|
-
findMatchedClass(schema1, schema2) {
|
|
9833
|
-
for (const schemaClass of this.extendsSchemaClasses) {
|
|
9834
|
-
if (schema1 instanceof schemaClass) return schemaClass;
|
|
9835
|
-
if (schema2 instanceof schemaClass) return schemaClass;
|
|
9836
|
-
}
|
|
9837
|
-
throw new Error("Invalid schema");
|
|
9838
|
-
}
|
|
9839
|
-
static swap(expression) {
|
|
9840
|
-
switch (expression) {
|
|
9841
|
-
case ExpressionSingleResult.Containing: return ExpressionSingleResult.ContainedBy;
|
|
9842
|
-
case ExpressionSingleResult.ContainedBy: return ExpressionSingleResult.Containing;
|
|
9843
|
-
default: return expression;
|
|
9844
|
-
}
|
|
9845
|
-
}
|
|
9914
|
+
var webhookOptions = object$1({
|
|
9915
|
+
allowedMethods: never().optional(),
|
|
9916
|
+
allowedOrigins: strings.optional(),
|
|
9917
|
+
noResponseBody: never().optional(),
|
|
9918
|
+
responseData: text$1.optional(),
|
|
9919
|
+
responseHeaders: record(text$1, text$1).optional(),
|
|
9920
|
+
responseStatusCode: number().int().min(200).max(599).optional()
|
|
9921
|
+
});
|
|
9922
|
+
var webhook = {
|
|
9923
|
+
bodyFields: array(input),
|
|
9924
|
+
method: _enum(webhookMethods),
|
|
9925
|
+
options: webhookOptions.optional()
|
|
9846
9926
|
};
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
if (subWarns.length > 0) console.warn(`found ${subWarns.length} warns after compile subSchema`);
|
|
9878
|
-
for (const warn of subWarns) console.warn(stringifySchemaError(warn));
|
|
9879
|
-
}
|
|
9880
|
-
return [compiledSchema1, compiledSchema2];
|
|
9881
|
-
}
|
|
9882
|
-
function collectWithPathPrefix(errorItems, compiledItems, prefix) {
|
|
9883
|
-
for (const compiledItem of compiledItems) {
|
|
9884
|
-
const replacedItem = {
|
|
9885
|
-
...compiledItem,
|
|
9886
|
-
path: [prefix, ...compiledItem.path]
|
|
9887
|
-
};
|
|
9888
|
-
errorItems.push(replacedItem);
|
|
9889
|
-
}
|
|
9890
|
-
}
|
|
9891
|
-
//#endregion
|
|
9892
|
-
//#region src/json-schema-subset/global.ts
|
|
9893
|
-
var SubsetCompareResult = Object.freeze({
|
|
9894
|
-
True: 0,
|
|
9895
|
-
False: 1,
|
|
9896
|
-
Unknown: 2
|
|
9927
|
+
var definition = {
|
|
9928
|
+
configInputs: ports.inputs,
|
|
9929
|
+
definitionVersion: literal(2),
|
|
9930
|
+
description: text$1,
|
|
9931
|
+
displayName: text$1,
|
|
9932
|
+
key: text$1,
|
|
9933
|
+
name: text$1,
|
|
9934
|
+
outputs: array(port).refine((definitions) => new Set(definitions.map((output) => output.handle)).size === definitions.length, "Duplicate Trigger output handle."),
|
|
9935
|
+
provider: text$1
|
|
9936
|
+
};
|
|
9937
|
+
var endpoint = object$1({
|
|
9938
|
+
body: object$1({
|
|
9939
|
+
allowArray: boolean(),
|
|
9940
|
+
allowEmpty: boolean(),
|
|
9941
|
+
formats: array(_enum([
|
|
9942
|
+
"form",
|
|
9943
|
+
"json",
|
|
9944
|
+
"multipart",
|
|
9945
|
+
"text"
|
|
9946
|
+
]))
|
|
9947
|
+
}),
|
|
9948
|
+
methods: array(_enum([
|
|
9949
|
+
"DELETE",
|
|
9950
|
+
"GET",
|
|
9951
|
+
"HEAD",
|
|
9952
|
+
"PATCH",
|
|
9953
|
+
"POST",
|
|
9954
|
+
"PUT"
|
|
9955
|
+
])),
|
|
9956
|
+
successStatus: number()
|
|
9897
9957
|
});
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
return preprocessSchema(schema, compiler, printWarnLog);
|
|
9904
|
-
},
|
|
9905
|
-
isSubset: (superSchema, subSchema, printWarnLog = false) => {
|
|
9906
|
-
const compiler = (candidate) => compile(candidate, extendsContext, void 0, delegate);
|
|
9907
|
-
const [schema1, schema2] = preprocessSchemasPair(superSchema, subSchema, compiler, printWarnLog);
|
|
9908
|
-
const { errorPath, expression } = checkWithResult(extendsContext, schema1, schema2);
|
|
9909
|
-
const foundTrueExpression = hasEquals(expression) || hasContainedBy(expression);
|
|
9910
|
-
const foundFalseExpression = hasContaining(expression) || hasIntersection(expression) || hasRejection(expression);
|
|
9911
|
-
if (foundTrueExpression && !foundFalseExpression) return { result: SubsetCompareResult.True };
|
|
9912
|
-
if (!foundTrueExpression && foundFalseExpression) return {
|
|
9913
|
-
errorPath,
|
|
9914
|
-
result: SubsetCompareResult.False
|
|
9915
|
-
};
|
|
9916
|
-
return { result: SubsetCompareResult.Unknown };
|
|
9917
|
-
}
|
|
9918
|
-
});
|
|
9919
|
-
}
|
|
9920
|
-
//#endregion
|
|
9921
|
-
//#region ../../node_modules/.bun/@wopjs+cast@0.1.16/node_modules/@wopjs/cast/dist/index.mjs
|
|
9922
|
-
var isString = (x) => typeof x === "string";
|
|
9923
|
-
var isArray = Array.isArray;
|
|
9924
|
-
var isObject = (x) => x !== null && typeof x === "object";
|
|
9925
|
-
var isPlainObject = (x) => isObject(x) && !isArray(x);
|
|
9926
|
-
var toPlainObject = (x) => isPlainObject(x) ? x : void 0;
|
|
9927
|
-
//#endregion
|
|
9928
|
-
//#region src/manifest/common/schemaComparer.ts
|
|
9929
|
-
function isStringLikeSchema(value) {
|
|
9930
|
-
return toPlainObject(value)?.type === "string";
|
|
9931
|
-
}
|
|
9932
|
-
function assertSchemaCompareContext(value) {
|
|
9933
|
-
const context = toPlainObject(value);
|
|
9934
|
-
const error = toPlainObject(context?.error);
|
|
9935
|
-
if (context == null || error == null || context.packageId != null && !isString(context.packageId) || error.message != null && !isString(error.message)) throw new TypeError("Invalid schema comparison context.");
|
|
9936
|
-
}
|
|
9937
|
-
function parseSchemaCompareContext(value) {
|
|
9938
|
-
if (value == null) return { error: {} };
|
|
9939
|
-
assertSchemaCompareContext(value);
|
|
9940
|
-
return value;
|
|
9941
|
-
}
|
|
9942
|
-
var SpecialSchema = class SpecialSchema {
|
|
9943
|
-
static setError(fromSchema, toSchema, message) {
|
|
9944
|
-
if (fromSchema instanceof SpecialSchema) fromSchema.context.error.message = message;
|
|
9945
|
-
else if (toSchema instanceof SpecialSchema) toSchema.context.error.message = message;
|
|
9946
|
-
}
|
|
9947
|
-
constructor(id, value, context) {
|
|
9948
|
-
this.id = id;
|
|
9949
|
-
this.value = value;
|
|
9950
|
-
this.context = parseSchemaCompareContext(context);
|
|
9951
|
-
}
|
|
9952
|
-
compare(other) {
|
|
9953
|
-
if (isCompiledSchema(other) && getKind(other) === CompiledKind.Any) return [ExpressionSingleResult.ContainedBy];
|
|
9954
|
-
return this.compareImpl(other);
|
|
9955
|
-
}
|
|
9958
|
+
var sourceFlowIds = array(text$1.min(1)).refine((ids) => new Set(ids).size === ids.length, "Duplicate source Flow ID.");
|
|
9959
|
+
var trigger$1 = {
|
|
9960
|
+
name: text$1,
|
|
9961
|
+
description: text$1.optional(),
|
|
9962
|
+
icon: text$1.optional()
|
|
9956
9963
|
};
|
|
9957
|
-
var
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
super(id, value, context);
|
|
9965
|
-
}
|
|
9966
|
-
compareImpl(other) {
|
|
9967
|
-
if (isStringLikeSchema(other)) return [ExpressionSingleResult.ContainedBy];
|
|
9968
|
-
if (other instanceof SingleSelectSchema) {
|
|
9969
|
-
const f = new Set(this.value.enum);
|
|
9970
|
-
let result = ExpressionSingleResult.Equals;
|
|
9971
|
-
for (const v of other.value.enum) {
|
|
9972
|
-
if (!f.has(v)) result = ExpressionSingleResult.ContainedBy;
|
|
9973
|
-
f.delete(v);
|
|
9974
|
-
}
|
|
9975
|
-
if (f.size === 0) return [result];
|
|
9976
|
-
if (f.size === this.value.enum.length) return [ExpressionSingleResult.Rejection];
|
|
9977
|
-
return [ExpressionSingleResult.Intersection];
|
|
9978
|
-
}
|
|
9979
|
-
return [ExpressionSingleResult.Rejection];
|
|
9980
|
-
}
|
|
9981
|
-
equals(other) {
|
|
9982
|
-
if (other instanceof SingleSelectSchema) {
|
|
9983
|
-
const f = new Set(this.value.enum);
|
|
9984
|
-
for (const v of other.value.enum) {
|
|
9985
|
-
if (!f.has(v)) return false;
|
|
9986
|
-
f.delete(v);
|
|
9987
|
-
}
|
|
9988
|
-
return f.size === 0;
|
|
9989
|
-
}
|
|
9990
|
-
return false;
|
|
9991
|
-
}
|
|
9964
|
+
var base = {
|
|
9965
|
+
maxExecutions: number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
|
|
9966
|
+
inputs: inputs$1,
|
|
9967
|
+
name: text$1.optional(),
|
|
9968
|
+
description: text$1.optional(),
|
|
9969
|
+
icon: text$1.optional(),
|
|
9970
|
+
timeoutMs: number().optional()
|
|
9992
9971
|
};
|
|
9993
|
-
var
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9998
|
-
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
9972
|
+
var node = union([
|
|
9973
|
+
object$1({
|
|
9974
|
+
...base,
|
|
9975
|
+
inputs: record(text$1, never()),
|
|
9976
|
+
kind: literal("condition"),
|
|
9977
|
+
...condition
|
|
9978
|
+
}),
|
|
9979
|
+
object$1({
|
|
9980
|
+
...base,
|
|
9981
|
+
inputs: unknown().transform(() => ({})).default({}),
|
|
9982
|
+
kind: literal("value"),
|
|
9983
|
+
values: array(input)
|
|
9984
|
+
}),
|
|
9985
|
+
object$1({
|
|
9986
|
+
...base,
|
|
9987
|
+
kind: literal("subflow"),
|
|
9988
|
+
subflowId: text$1
|
|
9989
|
+
}),
|
|
9990
|
+
object$1({
|
|
9991
|
+
...base,
|
|
9992
|
+
kind: literal("task"),
|
|
9993
|
+
task: inline,
|
|
9994
|
+
additionalInputs: array(input).optional()
|
|
9995
|
+
}),
|
|
9996
|
+
object$1({
|
|
9997
|
+
...base,
|
|
9998
|
+
kind: literal("task"),
|
|
9999
|
+
taskId: text$1,
|
|
10000
|
+
additionalInputs: array(input).optional()
|
|
10001
|
+
}),
|
|
10002
|
+
strictObject({
|
|
10003
|
+
...base,
|
|
10004
|
+
kind: literal("approval"),
|
|
10005
|
+
...wait
|
|
10006
|
+
}).omit({ timeoutMs: true }),
|
|
10007
|
+
strictObject({
|
|
10008
|
+
...base,
|
|
10009
|
+
kind: literal("wait"),
|
|
10010
|
+
...wait
|
|
10011
|
+
}).omit({ timeoutMs: true }),
|
|
10012
|
+
object$1({
|
|
10013
|
+
...trigger$1,
|
|
10014
|
+
kind: literal("manual")
|
|
10015
|
+
}),
|
|
10016
|
+
strictObject({
|
|
10017
|
+
...trigger$1,
|
|
10018
|
+
kind: literal("error"),
|
|
10019
|
+
sourceFlowIds: sourceFlowIds.optional()
|
|
10020
|
+
}),
|
|
10021
|
+
object$1({
|
|
10022
|
+
...trigger$1,
|
|
10023
|
+
kind: literal("webhook"),
|
|
10024
|
+
...webhook
|
|
10025
|
+
}),
|
|
10026
|
+
object$1({
|
|
10027
|
+
...trigger$1,
|
|
10028
|
+
kind: literal("cron"),
|
|
10029
|
+
cronTimes: triggerScheduleSchema
|
|
10030
|
+
}),
|
|
10031
|
+
object$1({
|
|
10032
|
+
...trigger$1,
|
|
10033
|
+
kind: literal("poll"),
|
|
10034
|
+
connectionId: text$1.min(1).optional(),
|
|
10035
|
+
config: record(text$1, fixedInput),
|
|
10036
|
+
definition: object$1({
|
|
10037
|
+
...definition,
|
|
10038
|
+
type: literal("poll")
|
|
10039
|
+
}),
|
|
10040
|
+
pollTimes: triggerScheduleSchema
|
|
10041
|
+
}),
|
|
10042
|
+
object$1({
|
|
10043
|
+
...trigger$1,
|
|
10044
|
+
kind: literal("integration"),
|
|
10045
|
+
connectionId: text$1.min(1).optional(),
|
|
10046
|
+
config: record(text$1, fixedInput),
|
|
10047
|
+
definition: object$1({
|
|
10048
|
+
...definition,
|
|
10049
|
+
type: literal("integration"),
|
|
10050
|
+
endpoint
|
|
10051
|
+
})
|
|
10052
|
+
})
|
|
10053
|
+
]);
|
|
10054
|
+
var target$1 = union([object$1({ kind: literal("flow") }), object$1({
|
|
10055
|
+
kind: literal("subflow"),
|
|
10056
|
+
id: text$1
|
|
10057
|
+
})]);
|
|
10058
|
+
var edge = object$1({
|
|
10059
|
+
source: text$1,
|
|
10060
|
+
target: text$1,
|
|
10061
|
+
sourceHandle: text$1.optional()
|
|
10062
|
+
});
|
|
10063
|
+
var at = {
|
|
10064
|
+
nodeId: text$1,
|
|
10065
|
+
target: target$1
|
|
10066
|
+
};
|
|
10067
|
+
var subflow = object$1({
|
|
10068
|
+
name: text$1,
|
|
10069
|
+
inputs: array(input),
|
|
10070
|
+
outputs: array(port.extend({ sources: array(union([nodeSource, flowSource])) }))
|
|
10071
|
+
});
|
|
10072
|
+
var graph = object$1({
|
|
10073
|
+
nodes: record(text$1, node),
|
|
10074
|
+
edges: array(edge).default([])
|
|
10075
|
+
});
|
|
10076
|
+
var binding = object$1({
|
|
10077
|
+
kind: literal("variable"),
|
|
10078
|
+
target: text$1
|
|
10079
|
+
});
|
|
10080
|
+
var module = object$1({
|
|
10081
|
+
name: text$1,
|
|
10082
|
+
imports: strings,
|
|
10083
|
+
source: text$1
|
|
10084
|
+
});
|
|
10085
|
+
var document = object$1({
|
|
10086
|
+
bindings: record(text$1, binding),
|
|
10087
|
+
graph,
|
|
10088
|
+
subflows: record(text$1, subflow.extend({ graph })),
|
|
10089
|
+
tasks: record(text$1, managed)
|
|
10090
|
+
});
|
|
10091
|
+
object$1({
|
|
10092
|
+
modelVersion: union([
|
|
10093
|
+
literal(2),
|
|
10094
|
+
literal(4),
|
|
10095
|
+
literal(5)
|
|
10096
|
+
]),
|
|
10097
|
+
document,
|
|
10098
|
+
modules: record(text$1, module)
|
|
10099
|
+
}).extend({
|
|
10100
|
+
kind: literal("open-flow-flow-revision"),
|
|
10101
|
+
version: literal(1)
|
|
10102
|
+
});
|
|
10103
|
+
var shapes = {
|
|
10104
|
+
"graph.trigger.sources.set": {
|
|
10105
|
+
nodeId: text$1,
|
|
10106
|
+
before: sourceFlowIds.optional(),
|
|
10107
|
+
value: sourceFlowIds.optional()
|
|
10108
|
+
},
|
|
10109
|
+
"binding.create": {
|
|
10110
|
+
bindingId: text$1,
|
|
10111
|
+
binding
|
|
10112
|
+
},
|
|
10113
|
+
"binding.delete": { bindingId: text$1 },
|
|
10114
|
+
"binding.target.set": {
|
|
10115
|
+
bindingId: text$1,
|
|
10116
|
+
before: text$1,
|
|
10117
|
+
value: text$1
|
|
10118
|
+
},
|
|
10119
|
+
"graph.edge.connect": {
|
|
10120
|
+
target: target$1,
|
|
10121
|
+
edge
|
|
10122
|
+
},
|
|
10123
|
+
"graph.edge.disconnect": {
|
|
10124
|
+
target: target$1,
|
|
10125
|
+
edge
|
|
10126
|
+
},
|
|
10127
|
+
"graph.node.create": {
|
|
10128
|
+
...at,
|
|
10129
|
+
node
|
|
10130
|
+
},
|
|
10131
|
+
"graph.node.delete": at,
|
|
10132
|
+
"graph.node.field.set": union([
|
|
10133
|
+
object$1({
|
|
10134
|
+
...at,
|
|
10135
|
+
kind: literal("graph.node.field.set"),
|
|
10136
|
+
field: literal("connectionId"),
|
|
10137
|
+
before: text$1.min(1).optional(),
|
|
10138
|
+
value: text$1.min(1).optional()
|
|
10139
|
+
}),
|
|
10140
|
+
object$1({
|
|
10141
|
+
...at,
|
|
10142
|
+
kind: literal("graph.node.field.set"),
|
|
10143
|
+
field: _enum([
|
|
10144
|
+
"description",
|
|
10145
|
+
"icon",
|
|
10146
|
+
"name"
|
|
10147
|
+
]),
|
|
10148
|
+
before: text$1.optional(),
|
|
10149
|
+
value: text$1.optional()
|
|
10150
|
+
}),
|
|
10151
|
+
object$1({
|
|
10152
|
+
...at,
|
|
10153
|
+
kind: literal("graph.node.field.set"),
|
|
10154
|
+
field: literal("maxExecutions"),
|
|
10155
|
+
before: number().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),
|
|
10156
|
+
value: number().int().positive().max(Number.MAX_SAFE_INTEGER).optional()
|
|
10157
|
+
}),
|
|
10158
|
+
object$1({
|
|
10159
|
+
...at,
|
|
10160
|
+
kind: literal("graph.node.field.set"),
|
|
10161
|
+
field: literal("timeoutMs"),
|
|
10162
|
+
before: number().optional(),
|
|
10163
|
+
value: number().optional()
|
|
10164
|
+
})
|
|
10165
|
+
]),
|
|
10166
|
+
"graph.node.input.set": {
|
|
10167
|
+
...at,
|
|
10168
|
+
handle: text$1,
|
|
10169
|
+
before: mapping.optional(),
|
|
10170
|
+
value: mapping.optional()
|
|
10171
|
+
},
|
|
10172
|
+
"graph.node.additional-inputs.set": {
|
|
10173
|
+
...at,
|
|
10174
|
+
before: array(input).optional(),
|
|
10175
|
+
value: array(input).optional()
|
|
10176
|
+
},
|
|
10177
|
+
"graph.node.condition.set": {
|
|
10178
|
+
...at,
|
|
10179
|
+
before: object$1(condition),
|
|
10180
|
+
value: object$1(condition)
|
|
10181
|
+
},
|
|
10182
|
+
"graph.node.values.set": {
|
|
10183
|
+
...at,
|
|
10184
|
+
before: array(input),
|
|
10185
|
+
value: array(input)
|
|
10186
|
+
},
|
|
10187
|
+
"graph.node.resolution.set": {
|
|
10188
|
+
...at,
|
|
10189
|
+
target: object$1({ kind: literal("flow") }),
|
|
10190
|
+
before: object$1(wait),
|
|
10191
|
+
value: object$1(wait)
|
|
10192
|
+
},
|
|
10193
|
+
"graph.node.webhook.set": {
|
|
10194
|
+
...at,
|
|
10195
|
+
target: object$1({ kind: literal("flow") }),
|
|
10196
|
+
before: object$1(webhook),
|
|
10197
|
+
value: object$1(webhook)
|
|
10198
|
+
},
|
|
10199
|
+
"graph.node.task.ports.set": {
|
|
10200
|
+
...at,
|
|
10201
|
+
before: object$1(ports),
|
|
10202
|
+
value: object$1(ports)
|
|
10203
|
+
},
|
|
10204
|
+
"graph.node.task.name.set": {
|
|
10205
|
+
...at,
|
|
10206
|
+
before: text$1,
|
|
10207
|
+
value: text$1
|
|
10208
|
+
},
|
|
10209
|
+
"graph.node.task.capabilities.set": {
|
|
10210
|
+
...at,
|
|
10211
|
+
before: array(capability).optional(),
|
|
10212
|
+
value: array(capability).optional()
|
|
10213
|
+
},
|
|
10214
|
+
"graph.trigger.config.set": {
|
|
10215
|
+
nodeId: text$1,
|
|
10216
|
+
name: text$1,
|
|
10217
|
+
before: fixedInput.optional(),
|
|
10218
|
+
value: fixedInput.optional()
|
|
10219
|
+
},
|
|
10220
|
+
"graph.trigger.schedule.set": {
|
|
10221
|
+
nodeId: text$1,
|
|
10222
|
+
before: triggerScheduleSchema,
|
|
10223
|
+
value: triggerScheduleSchema
|
|
10224
|
+
},
|
|
10225
|
+
"module.create": {
|
|
10226
|
+
moduleId: text$1,
|
|
10227
|
+
module
|
|
10228
|
+
},
|
|
10229
|
+
"module.delete": { moduleId: text$1 },
|
|
10230
|
+
"module.rename": {
|
|
10231
|
+
moduleId: text$1,
|
|
10232
|
+
before: text$1,
|
|
10233
|
+
name: text$1
|
|
10234
|
+
},
|
|
10235
|
+
"module.source.replace": {
|
|
10236
|
+
moduleId: text$1,
|
|
10237
|
+
beforeImports: strings,
|
|
10238
|
+
beforeSource: text$1,
|
|
10239
|
+
imports: strings,
|
|
10240
|
+
source: text$1
|
|
10241
|
+
},
|
|
10242
|
+
"subflow.create": {
|
|
10243
|
+
subflowId: text$1,
|
|
10244
|
+
subflow: subflow.extend({ graph })
|
|
10245
|
+
},
|
|
10246
|
+
"subflow.definition.set": {
|
|
10247
|
+
subflowId: text$1,
|
|
10248
|
+
before: subflow,
|
|
10249
|
+
definition: subflow
|
|
10250
|
+
},
|
|
10251
|
+
"subflow.delete": { subflowId: text$1 },
|
|
10252
|
+
"task.create": {
|
|
10253
|
+
taskId: text$1,
|
|
10254
|
+
task: managed
|
|
10255
|
+
},
|
|
10256
|
+
"task.delete": { taskId: text$1 },
|
|
10257
|
+
"task.connector.connection.set": {
|
|
10258
|
+
taskId: text$1,
|
|
10259
|
+
before: text$1.optional(),
|
|
10260
|
+
value: text$1.optional()
|
|
10261
|
+
},
|
|
10262
|
+
"task.decision.set": {
|
|
10263
|
+
taskId: text$1,
|
|
10264
|
+
before: managed,
|
|
10265
|
+
value: managed
|
|
10266
|
+
},
|
|
10267
|
+
"task.openapi.set": {
|
|
10268
|
+
taskId: text$1,
|
|
10269
|
+
before: managed,
|
|
10270
|
+
value: managed
|
|
10271
|
+
},
|
|
10272
|
+
"task.agent.set": {
|
|
10273
|
+
taskId: text$1,
|
|
10274
|
+
before: managed,
|
|
10275
|
+
value: managed
|
|
10276
|
+
},
|
|
10277
|
+
"task.llm.mode.set": {
|
|
10278
|
+
taskId: text$1,
|
|
10279
|
+
before: _enum(["chat", "json"]),
|
|
10280
|
+
value: _enum(["chat", "json"])
|
|
10281
|
+
},
|
|
10282
|
+
"task.name.set": {
|
|
10283
|
+
taskId: text$1,
|
|
10284
|
+
before: text$1,
|
|
10285
|
+
value: text$1
|
|
10010
10286
|
}
|
|
10011
10287
|
};
|
|
10012
|
-
var
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
if (
|
|
10022
|
-
|
|
10023
|
-
return [ExpressionSingleResult.Rejection];
|
|
10024
|
-
}
|
|
10025
|
-
equals(other) {
|
|
10026
|
-
return other instanceof ArtifactSchema;
|
|
10288
|
+
var variants = new Map(Object.entries(shapes).map(([kind, shape]) => [kind, shape instanceof ZodType ? shape : object$1({
|
|
10289
|
+
kind: literal(kind),
|
|
10290
|
+
...shape
|
|
10291
|
+
})]));
|
|
10292
|
+
var operations = array(union([...variants.values()])).min(1);
|
|
10293
|
+
function parseOperation(candidate, index, parse) {
|
|
10294
|
+
try {
|
|
10295
|
+
return parse(candidate);
|
|
10296
|
+
} catch (error) {
|
|
10297
|
+
if (!(error instanceof ZodError)) throw error;
|
|
10298
|
+
throw new TypeError(`operations[${index}]: ${error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}`, { cause: error });
|
|
10027
10299
|
}
|
|
10028
|
-
};
|
|
10029
|
-
function createSchemaComparer() {
|
|
10030
|
-
return makeSubsetCompare({ extendsSchemaClasses: [
|
|
10031
|
-
SingleSelectSchema,
|
|
10032
|
-
BinarySchema,
|
|
10033
|
-
ArtifactSchema
|
|
10034
|
-
] });
|
|
10035
10300
|
}
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
return
|
|
10301
|
+
function decodeChangeOperation(candidate, index) {
|
|
10302
|
+
const { kind } = parseOperation(candidate, index, object$1({ kind: text$1 }).parse);
|
|
10303
|
+
const schema = variants.get(kind);
|
|
10304
|
+
if (schema == null) throw new TypeError(`operations[${index}]: Unknown operation ${JSON.stringify(kind)}.`);
|
|
10305
|
+
return parseOperation(candidate, index, schema.parse);
|
|
10041
10306
|
}
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10307
|
+
function changeOperationsSchema(kind) {
|
|
10308
|
+
const schema = kind == null ? operations : variants.get(kind);
|
|
10309
|
+
if (schema == null) throw new TypeError(`Unknown operation ${JSON.stringify(kind)}.`);
|
|
10310
|
+
return toJSONSchema(schema, { io: "input" });
|
|
10045
10311
|
}
|
|
10046
|
-
function
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
if (
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
if (
|
|
10053
|
-
const declaration = typeof source.$schema == "string" ? source.$schema : "";
|
|
10054
|
-
const draft = declaration.includes("draft-04") ? "4" : declaration.includes("draft-07") ? "7" : declaration.includes("2020-12") ? "2020-12" : "2019-09";
|
|
10055
|
-
validator = new Validator(structuredClone(source), draft);
|
|
10056
|
-
validators.set(source, validator);
|
|
10057
|
-
}
|
|
10058
|
-
const result = validator.validate(value);
|
|
10059
|
-
return result.valid ? [] : result.errors.map((issue) => `${issue.instanceLocation || "/"}: ${issue.error}`);
|
|
10060
|
-
} catch {
|
|
10061
|
-
return ["Output schema validation failed."];
|
|
10312
|
+
function resourceNameIssue(value) {
|
|
10313
|
+
const name = value.trim();
|
|
10314
|
+
if (name.length == 0) return "empty";
|
|
10315
|
+
if (name.length > 80) return "tooLong";
|
|
10316
|
+
for (const character of name) {
|
|
10317
|
+
const code = character.charCodeAt(0);
|
|
10318
|
+
if (code <= 31 || code >= 127 && code <= 159) return "controlCharacter";
|
|
10062
10319
|
}
|
|
10320
|
+
if (!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(name)) return "specialCharacter";
|
|
10063
10321
|
}
|
|
10064
10322
|
//#endregion
|
|
10065
10323
|
//#region src/openapi/common/openapi.ts
|
|
@@ -11605,6 +11863,9 @@ function defaultInputs(ports) {
|
|
|
11605
11863
|
function llmInputValue(values, handle, fallback) {
|
|
11606
11864
|
return values != null && Object.hasOwn(values, handle) ? values[handle] : fallback;
|
|
11607
11865
|
}
|
|
11866
|
+
function createDecisionTask(target, identity, name = "AI Decision", questions) {
|
|
11867
|
+
return createManagedTask(target, identity, decisionTask(questions, name));
|
|
11868
|
+
}
|
|
11608
11869
|
//#endregion
|
|
11609
11870
|
//#region src/control/common/draftOperations.ts
|
|
11610
11871
|
var text = string().min(1);
|
|
@@ -11682,6 +11943,7 @@ var descriptions = {
|
|
|
11682
11943
|
"cron": "An hourly scheduled start node.",
|
|
11683
11944
|
"poll": "Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.",
|
|
11684
11945
|
"integration": "Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.",
|
|
11946
|
+
"decision": "AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.",
|
|
11685
11947
|
"openapi": "A fixed JSON API operation. Replace the example document and URL before running.",
|
|
11686
11948
|
"connector": "A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show.",
|
|
11687
11949
|
"code": "A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.",
|
|
@@ -11707,6 +11969,16 @@ function authoringExample(name) {
|
|
|
11707
11969
|
name: "Flow Error"
|
|
11708
11970
|
});
|
|
11709
11971
|
break;
|
|
11972
|
+
case "decision":
|
|
11973
|
+
operations = createDecisionTask(target, {
|
|
11974
|
+
nodeId: "decision",
|
|
11975
|
+
taskId: "decision-task"
|
|
11976
|
+
}, "AI Decision", [{
|
|
11977
|
+
name: "needs_support",
|
|
11978
|
+
type: "noul",
|
|
11979
|
+
instructions: "Does the customer need support?"
|
|
11980
|
+
}]);
|
|
11981
|
+
break;
|
|
11710
11982
|
case "openapi":
|
|
11711
11983
|
operations = createManagedTask(target, {
|
|
11712
11984
|
nodeId: "api",
|