@pixerate/editor 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -2
- package/THIRD_PARTY_NOTICES.md +88 -0
- package/dist/agent/index.cjs +83 -108
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +69 -211
- package/dist/agent/index.d.ts +69 -211
- package/dist/agent/index.js +76 -101
- package/dist/agent/index.js.map +1 -1
- package/dist/arrangeShortcuts-B8O3f8-P.d.cts +184 -0
- package/dist/arrangeShortcuts-sLlD2rSX.d.ts +184 -0
- package/dist/canvas/index.cjs +879 -83
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +291 -186
- package/dist/canvas/index.d.ts +291 -186
- package/dist/canvas/index.js +865 -69
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-26BVFKHU.cjs +453 -0
- package/dist/chunk-26BVFKHU.cjs.map +1 -0
- package/dist/chunk-2H7ZHPEJ.js +762 -0
- package/dist/chunk-2H7ZHPEJ.js.map +1 -0
- package/dist/chunk-7DWMJCAT.js +453 -0
- package/dist/chunk-7DWMJCAT.js.map +1 -0
- package/dist/chunk-ARRTP33I.js +101 -0
- package/dist/chunk-ARRTP33I.js.map +1 -0
- package/dist/chunk-CPOKFNBG.cjs +101 -0
- package/dist/chunk-CPOKFNBG.cjs.map +1 -0
- package/dist/chunk-G2I4QJOT.cjs +762 -0
- package/dist/chunk-G2I4QJOT.cjs.map +1 -0
- package/dist/{chunk-RU52I7QO.js → chunk-K3R5NG2D.js} +147 -42
- package/dist/chunk-K3R5NG2D.js.map +1 -0
- package/dist/{chunk-DENSCKFC.js → chunk-QBJ22YZR.js} +423 -30
- package/dist/chunk-QBJ22YZR.js.map +1 -0
- package/dist/{chunk-SAZRENEZ.cjs → chunk-RIKBJLS2.cjs} +424 -31
- package/dist/chunk-RIKBJLS2.cjs.map +1 -0
- package/dist/{chunk-6M3BCTBD.cjs → chunk-XDMXXC4Z.cjs} +230 -125
- package/dist/chunk-XDMXXC4Z.cjs.map +1 -0
- package/dist/commands/index.cjs +860 -0
- package/dist/commands/index.cjs.map +1 -0
- package/dist/commands/index.d.cts +592 -0
- package/dist/commands/index.d.ts +592 -0
- package/dist/commands/index.js +860 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/{controller-B7GIybc4.d.cts → controller-pePCJLT1.d.cts} +78 -5
- package/dist/{controller-B7GIybc4.d.ts → controller-pePCJLT1.d.ts} +78 -5
- package/dist/history/index.cjs +12 -2
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +211 -7
- package/dist/history/index.d.ts +211 -7
- package/dist/history/index.js +13 -3
- package/dist/image-editor/index.cjs +418 -13
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +154 -3
- package/dist/image-editor/index.d.ts +154 -3
- package/dist/image-editor/index.js +417 -12
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index.cjs +34 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -42
- package/dist/index.d.ts +5 -42
- package/dist/index.js +27 -69
- package/dist/index.js.map +1 -1
- package/dist/registry-D5-R90p0.d.cts +209 -0
- package/dist/registry-D5-R90p0.d.ts +209 -0
- package/dist/spreadsheet/index.cjs +19 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +67 -9
- package/dist/spreadsheet/index.d.ts +67 -9
- package/dist/spreadsheet/index.js +18 -2
- package/dist/{types-CJ4U-HHI.d.cts → types-DX4Mh4SL.d.cts} +1 -1
- package/dist/{types-CJ4U-HHI.d.ts → types-DX4Mh4SL.d.ts} +1 -1
- package/dist/types-GT5a5YAX.d.cts +86 -0
- package/dist/types-GT5a5YAX.d.ts +86 -0
- package/package.json +8 -2
- package/dist/chunk-2TWGLC5K.cjs +0 -262
- package/dist/chunk-2TWGLC5K.cjs.map +0 -1
- package/dist/chunk-6M3BCTBD.cjs.map +0 -1
- package/dist/chunk-DENSCKFC.js.map +0 -1
- package/dist/chunk-KAADNAPF.js +0 -262
- package/dist/chunk-KAADNAPF.js.map +0 -1
- package/dist/chunk-RU52I7QO.js.map +0 -1
- package/dist/chunk-SAZRENEZ.cjs.map +0 -1
- package/dist/types-BZgcDsC5.d.cts +0 -42
- package/dist/types-BZgcDsC5.d.ts +0 -42
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// src/agent/schema.ts
|
|
2
|
+
function typeOf(value) {
|
|
3
|
+
if (value === null) return "null";
|
|
4
|
+
if (Array.isArray(value)) return "array";
|
|
5
|
+
if (typeof value === "number") return Number.isInteger(value) ? "integer" : "number";
|
|
6
|
+
if (typeof value === "string" || typeof value === "boolean" || typeof value === "object") {
|
|
7
|
+
return typeof value;
|
|
8
|
+
}
|
|
9
|
+
return "undefined";
|
|
10
|
+
}
|
|
11
|
+
function matchesType(value, type) {
|
|
12
|
+
const actual = typeOf(value);
|
|
13
|
+
if (type === "number") return actual === "number" || actual === "integer";
|
|
14
|
+
return actual === type;
|
|
15
|
+
}
|
|
16
|
+
var isEqual = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
17
|
+
function validateJsonSchema(value, schema, path = "") {
|
|
18
|
+
if (!schema || typeof schema !== "object") return [];
|
|
19
|
+
const errors = [];
|
|
20
|
+
const at = path || "/";
|
|
21
|
+
if (schema.type !== void 0) {
|
|
22
|
+
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
23
|
+
if (!types.some((t) => matchesType(value, t))) {
|
|
24
|
+
errors.push({ path: at, message: `Expected ${types.join(" | ")}, got ${typeOf(value)}.` });
|
|
25
|
+
return errors;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (schema.const !== void 0 && !isEqual(value, schema.const)) {
|
|
29
|
+
errors.push({ path: at, message: `Expected ${JSON.stringify(schema.const)}.` });
|
|
30
|
+
}
|
|
31
|
+
if (schema.enum && !schema.enum.some((option) => isEqual(value, option))) {
|
|
32
|
+
errors.push({
|
|
33
|
+
path: at,
|
|
34
|
+
message: `Expected one of ${schema.enum.map((o) => JSON.stringify(o)).join(", ")}, got ${JSON.stringify(value)}.`
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (typeof value === "string") {
|
|
38
|
+
if (schema.minLength !== void 0 && value.length < schema.minLength) {
|
|
39
|
+
errors.push({ path: at, message: `Must be at least ${schema.minLength} characters.` });
|
|
40
|
+
}
|
|
41
|
+
if (schema.maxLength !== void 0 && value.length > schema.maxLength) {
|
|
42
|
+
errors.push({ path: at, message: `Must be at most ${schema.maxLength} characters.` });
|
|
43
|
+
}
|
|
44
|
+
if (schema.pattern !== void 0) {
|
|
45
|
+
let regex = null;
|
|
46
|
+
try {
|
|
47
|
+
regex = new RegExp(schema.pattern, "u");
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
if (regex && !regex.test(value)) {
|
|
51
|
+
errors.push({ path: at, message: `Must match pattern ${schema.pattern}.` });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (typeof value === "number") {
|
|
56
|
+
if (schema.minimum !== void 0 && value < schema.minimum) {
|
|
57
|
+
errors.push({ path: at, message: `Must be >= ${schema.minimum}.` });
|
|
58
|
+
}
|
|
59
|
+
if (schema.maximum !== void 0 && value > schema.maximum) {
|
|
60
|
+
errors.push({ path: at, message: `Must be <= ${schema.maximum}.` });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (Array.isArray(value)) {
|
|
64
|
+
if (schema.minItems !== void 0 && value.length < schema.minItems) {
|
|
65
|
+
errors.push({ path: at, message: `Must have at least ${schema.minItems} items.` });
|
|
66
|
+
}
|
|
67
|
+
if (schema.maxItems !== void 0 && value.length > schema.maxItems) {
|
|
68
|
+
errors.push({ path: at, message: `Must have at most ${schema.maxItems} items.` });
|
|
69
|
+
}
|
|
70
|
+
if (schema.items) {
|
|
71
|
+
value.forEach((item, index) => {
|
|
72
|
+
errors.push(...validateJsonSchema(item, schema.items, `${path}/${index}`));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (typeOf(value) === "object") {
|
|
77
|
+
const obj = value;
|
|
78
|
+
for (const key of schema.required ?? []) {
|
|
79
|
+
if (obj[key] === void 0) {
|
|
80
|
+
errors.push({ path: `${path}/${key}`, message: `Missing required property "${key}".` });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const properties = schema.properties ?? {};
|
|
84
|
+
for (const [key, child] of Object.entries(obj)) {
|
|
85
|
+
if (child === void 0) continue;
|
|
86
|
+
if (key in properties) {
|
|
87
|
+
errors.push(...validateJsonSchema(child, properties[key], `${path}/${key}`));
|
|
88
|
+
} else if (schema.additionalProperties === false) {
|
|
89
|
+
errors.push({ path: `${path}/${key}`, message: `Unknown property "${key}".` });
|
|
90
|
+
} else if (typeof schema.additionalProperties === "object") {
|
|
91
|
+
errors.push(...validateJsonSchema(child, schema.additionalProperties, `${path}/${key}`));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return errors;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export {
|
|
99
|
+
validateJsonSchema
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=chunk-ARRTP33I.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/agent/schema.ts"],"sourcesContent":["/**\n * JSON-Schema-lite: the subset of JSON Schema used by MCP tool `inputSchema`s,\n * plus a small validator for tool-call arguments. Unknown keywords are ignored.\n */\nexport type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';\n\nexport interface JsonSchema {\n\ttype?: JsonSchemaType | readonly JsonSchemaType[];\n\tdescription?: string;\n\ttitle?: string;\n\tenum?: readonly unknown[];\n\tconst?: unknown;\n\tdefault?: unknown;\n\tproperties?: { readonly [key: string]: JsonSchema };\n\trequired?: readonly string[];\n\tadditionalProperties?: boolean | JsonSchema;\n\titems?: JsonSchema;\n\tminItems?: number;\n\tmaxItems?: number;\n\tminimum?: number;\n\tmaximum?: number;\n\tminLength?: number;\n\tmaxLength?: number;\n\tpattern?: string;\n\t[keyword: string]: unknown;\n}\n\nexport interface SchemaValidationError {\n\t/** JSON-pointer-like path to the offending value, e.g. `/node/id` (`\"\"` is the root). */\n\tpath: string;\n\tmessage: string;\n}\n\nfunction typeOf(value: unknown): JsonSchemaType | 'undefined' {\n\tif (value === null) return 'null';\n\tif (Array.isArray(value)) return 'array';\n\tif (typeof value === 'number') return Number.isInteger(value) ? 'integer' : 'number';\n\tif (typeof value === 'string' || typeof value === 'boolean' || typeof value === 'object') {\n\t\treturn typeof value as JsonSchemaType;\n\t}\n\treturn 'undefined';\n}\n\nfunction matchesType(value: unknown, type: JsonSchemaType): boolean {\n\tconst actual = typeOf(value);\n\tif (type === 'number') return actual === 'number' || actual === 'integer';\n\treturn actual === type;\n}\n\nconst isEqual = (a: unknown, b: unknown) => a === b || JSON.stringify(a) === JSON.stringify(b);\n\n/**\n * Validates `value` against `schema` and returns every error found (an empty\n * array means valid). Supports `type` (incl. arrays of types), `enum`, `const`,\n * `properties`, `required`, `additionalProperties`, `items`, `minItems`,\n * `maxItems`, `minimum`, `maximum`, `minLength`, `maxLength` and `pattern`.\n */\nexport function validateJsonSchema(value: unknown, schema: JsonSchema | undefined, path = ''): SchemaValidationError[] {\n\tif (!schema || typeof schema !== 'object') return [];\n\tconst errors: SchemaValidationError[] = [];\n\tconst at = path || '/';\n\n\tif (schema.type !== undefined) {\n\t\tconst types = (Array.isArray(schema.type) ? schema.type : [schema.type]) as JsonSchemaType[];\n\t\tif (!types.some((t) => matchesType(value, t))) {\n\t\t\terrors.push({ path: at, message: `Expected ${types.join(' | ')}, got ${typeOf(value)}.` });\n\t\t\treturn errors;\n\t\t}\n\t}\n\tif (schema.const !== undefined && !isEqual(value, schema.const)) {\n\t\terrors.push({ path: at, message: `Expected ${JSON.stringify(schema.const)}.` });\n\t}\n\tif (schema.enum && !schema.enum.some((option) => isEqual(value, option))) {\n\t\terrors.push({\n\t\t\tpath: at,\n\t\t\tmessage: `Expected one of ${schema.enum.map((o) => JSON.stringify(o)).join(', ')}, got ${JSON.stringify(value)}.`\n\t\t});\n\t}\n\n\tif (typeof value === 'string') {\n\t\tif (schema.minLength !== undefined && value.length < schema.minLength) {\n\t\t\terrors.push({ path: at, message: `Must be at least ${schema.minLength} characters.` });\n\t\t}\n\t\tif (schema.maxLength !== undefined && value.length > schema.maxLength) {\n\t\t\terrors.push({ path: at, message: `Must be at most ${schema.maxLength} characters.` });\n\t\t}\n\t\tif (schema.pattern !== undefined) {\n\t\t\tlet regex: RegExp | null = null;\n\t\t\ttry {\n\t\t\t\tregex = new RegExp(schema.pattern, 'u');\n\t\t\t} catch {\n\t\t\t\t// An invalid pattern in the schema is not the caller's fault.\n\t\t\t}\n\t\t\tif (regex && !regex.test(value)) {\n\t\t\t\terrors.push({ path: at, message: `Must match pattern ${schema.pattern}.` });\n\t\t\t}\n\t\t}\n\t}\n\n\tif (typeof value === 'number') {\n\t\tif (schema.minimum !== undefined && value < schema.minimum) {\n\t\t\terrors.push({ path: at, message: `Must be >= ${schema.minimum}.` });\n\t\t}\n\t\tif (schema.maximum !== undefined && value > schema.maximum) {\n\t\t\terrors.push({ path: at, message: `Must be <= ${schema.maximum}.` });\n\t\t}\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tif (schema.minItems !== undefined && value.length < schema.minItems) {\n\t\t\terrors.push({ path: at, message: `Must have at least ${schema.minItems} items.` });\n\t\t}\n\t\tif (schema.maxItems !== undefined && value.length > schema.maxItems) {\n\t\t\terrors.push({ path: at, message: `Must have at most ${schema.maxItems} items.` });\n\t\t}\n\t\tif (schema.items) {\n\t\t\tvalue.forEach((item, index) => {\n\t\t\t\terrors.push(...validateJsonSchema(item, schema.items, `${path}/${index}`));\n\t\t\t});\n\t\t}\n\t}\n\n\tif (typeOf(value) === 'object') {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tfor (const key of schema.required ?? []) {\n\t\t\tif (obj[key] === undefined) {\n\t\t\t\terrors.push({ path: `${path}/${key}`, message: `Missing required property \"${key}\".` });\n\t\t\t}\n\t\t}\n\t\tconst properties = schema.properties ?? {};\n\t\tfor (const [key, child] of Object.entries(obj)) {\n\t\t\tif (child === undefined) continue;\n\t\t\tif (key in properties) {\n\t\t\t\terrors.push(...validateJsonSchema(child, properties[key], `${path}/${key}`));\n\t\t\t} else if (schema.additionalProperties === false) {\n\t\t\t\terrors.push({ path: `${path}/${key}`, message: `Unknown property \"${key}\".` });\n\t\t\t} else if (typeof schema.additionalProperties === 'object') {\n\t\t\t\terrors.push(...validateJsonSchema(child, schema.additionalProperties, `${path}/${key}`));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn errors;\n}\n"],"mappings":";AAiCA,SAAS,OAAO,OAA8C;AAC7D,MAAI,UAAU,KAAM,QAAO;AAC3B,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO;AACjC,MAAI,OAAO,UAAU,SAAU,QAAO,OAAO,UAAU,KAAK,IAAI,YAAY;AAC5E,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,aAAa,OAAO,UAAU,UAAU;AACzF,WAAO,OAAO;AAAA,EACf;AACA,SAAO;AACR;AAEA,SAAS,YAAY,OAAgB,MAA+B;AACnE,QAAM,SAAS,OAAO,KAAK;AAC3B,MAAI,SAAS,SAAU,QAAO,WAAW,YAAY,WAAW;AAChE,SAAO,WAAW;AACnB;AAEA,IAAM,UAAU,CAAC,GAAY,MAAe,MAAM,KAAK,KAAK,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC;AAQtF,SAAS,mBAAmB,OAAgB,QAAgC,OAAO,IAA6B;AACtH,MAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO,CAAC;AACnD,QAAM,SAAkC,CAAC;AACzC,QAAM,KAAK,QAAQ;AAEnB,MAAI,OAAO,SAAS,QAAW;AAC9B,UAAM,QA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,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC/C,UAAI,UAAU,OAAW;AACzB,UAAI,OAAO,YAAY;AACtB,eAAO,KAAK,GAAG,mBAAmB,OAAO,WAAW,GAAG,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;AAAA,MAC5E,WAAW,OAAO,yBAAyB,OAAO;AACjD,eAAO,KAAK,EAAE,MAAM,GAAG,IAAI,IAAI,GAAG,IAAI,SAAS,qBAAqB,GAAG,KAAK,CAAC;AAAA,MAC9E,WAAW,OAAO,OAAO,yBAAyB,UAAU;AAC3D,eAAO,KAAK,GAAG,mBAAmB,OAAO,OAAO,sBAAsB,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;AAAA,MACxF;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;","names":[]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/agent/schema.ts
|
|
2
|
+
function typeOf(value) {
|
|
3
|
+
if (value === null) return "null";
|
|
4
|
+
if (Array.isArray(value)) return "array";
|
|
5
|
+
if (typeof value === "number") return Number.isInteger(value) ? "integer" : "number";
|
|
6
|
+
if (typeof value === "string" || typeof value === "boolean" || typeof value === "object") {
|
|
7
|
+
return typeof value;
|
|
8
|
+
}
|
|
9
|
+
return "undefined";
|
|
10
|
+
}
|
|
11
|
+
function matchesType(value, type) {
|
|
12
|
+
const actual = typeOf(value);
|
|
13
|
+
if (type === "number") return actual === "number" || actual === "integer";
|
|
14
|
+
return actual === type;
|
|
15
|
+
}
|
|
16
|
+
var isEqual = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
17
|
+
function validateJsonSchema(value, schema, path = "") {
|
|
18
|
+
if (!schema || typeof schema !== "object") return [];
|
|
19
|
+
const errors = [];
|
|
20
|
+
const at = path || "/";
|
|
21
|
+
if (schema.type !== void 0) {
|
|
22
|
+
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
23
|
+
if (!types.some((t) => matchesType(value, t))) {
|
|
24
|
+
errors.push({ path: at, message: `Expected ${types.join(" | ")}, got ${typeOf(value)}.` });
|
|
25
|
+
return errors;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (schema.const !== void 0 && !isEqual(value, schema.const)) {
|
|
29
|
+
errors.push({ path: at, message: `Expected ${JSON.stringify(schema.const)}.` });
|
|
30
|
+
}
|
|
31
|
+
if (schema.enum && !schema.enum.some((option) => isEqual(value, option))) {
|
|
32
|
+
errors.push({
|
|
33
|
+
path: at,
|
|
34
|
+
message: `Expected one of ${schema.enum.map((o) => JSON.stringify(o)).join(", ")}, got ${JSON.stringify(value)}.`
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (typeof value === "string") {
|
|
38
|
+
if (schema.minLength !== void 0 && value.length < schema.minLength) {
|
|
39
|
+
errors.push({ path: at, message: `Must be at least ${schema.minLength} characters.` });
|
|
40
|
+
}
|
|
41
|
+
if (schema.maxLength !== void 0 && value.length > schema.maxLength) {
|
|
42
|
+
errors.push({ path: at, message: `Must be at most ${schema.maxLength} characters.` });
|
|
43
|
+
}
|
|
44
|
+
if (schema.pattern !== void 0) {
|
|
45
|
+
let regex = null;
|
|
46
|
+
try {
|
|
47
|
+
regex = new RegExp(schema.pattern, "u");
|
|
48
|
+
} catch (e) {
|
|
49
|
+
}
|
|
50
|
+
if (regex && !regex.test(value)) {
|
|
51
|
+
errors.push({ path: at, message: `Must match pattern ${schema.pattern}.` });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (typeof value === "number") {
|
|
56
|
+
if (schema.minimum !== void 0 && value < schema.minimum) {
|
|
57
|
+
errors.push({ path: at, message: `Must be >= ${schema.minimum}.` });
|
|
58
|
+
}
|
|
59
|
+
if (schema.maximum !== void 0 && value > schema.maximum) {
|
|
60
|
+
errors.push({ path: at, message: `Must be <= ${schema.maximum}.` });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (Array.isArray(value)) {
|
|
64
|
+
if (schema.minItems !== void 0 && value.length < schema.minItems) {
|
|
65
|
+
errors.push({ path: at, message: `Must have at least ${schema.minItems} items.` });
|
|
66
|
+
}
|
|
67
|
+
if (schema.maxItems !== void 0 && value.length > schema.maxItems) {
|
|
68
|
+
errors.push({ path: at, message: `Must have at most ${schema.maxItems} items.` });
|
|
69
|
+
}
|
|
70
|
+
if (schema.items) {
|
|
71
|
+
value.forEach((item, index) => {
|
|
72
|
+
errors.push(...validateJsonSchema(item, schema.items, `${path}/${index}`));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (typeOf(value) === "object") {
|
|
77
|
+
const obj = value;
|
|
78
|
+
for (const key of _nullishCoalesce(schema.required, () => ( []))) {
|
|
79
|
+
if (obj[key] === void 0) {
|
|
80
|
+
errors.push({ path: `${path}/${key}`, message: `Missing required property "${key}".` });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const properties = _nullishCoalesce(schema.properties, () => ( {}));
|
|
84
|
+
for (const [key, child] of Object.entries(obj)) {
|
|
85
|
+
if (child === void 0) continue;
|
|
86
|
+
if (key in properties) {
|
|
87
|
+
errors.push(...validateJsonSchema(child, properties[key], `${path}/${key}`));
|
|
88
|
+
} else if (schema.additionalProperties === false) {
|
|
89
|
+
errors.push({ path: `${path}/${key}`, message: `Unknown property "${key}".` });
|
|
90
|
+
} else if (typeof schema.additionalProperties === "object") {
|
|
91
|
+
errors.push(...validateJsonSchema(child, schema.additionalProperties, `${path}/${key}`));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return errors;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
exports.validateJsonSchema = validateJsonSchema;
|
|
101
|
+
//# sourceMappingURL=chunk-CPOKFNBG.cjs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,EAAqB,MAAA,CAAO,QAAQ,CAAA,OAAA,EAAU,CAAC,CAAA;AAAA,IACjF;AACA,IAAA,GAAA,CAAI,MAAA,CAAO,KAAA,EAAO;AACjB,MAAA,KAAA,CAAM,OAAA,CAAQ,CAAC,IAAA,EAAM,KAAA,EAAA,GAAU;AAC9B,QAAA,MAAA,CAAO,IAAA,CAAK,GAAG,kBAAA,CAAmB,IAAA,EAAM,MAAA,CAAO,KAAA,EAAO,CAAA,EAAA;AACtD,MAAA;AACF,IAAA;AACD,EAAA;AAEgC,EAAA;AACnB,IAAA;AAC6B,IAAA;AACZ,MAAA;AACoB,QAAA;AAChD,MAAA;AACD,IAAA;AACyC,IAAA;AACO,IAAA;AACtB,MAAA;AACF,MAAA;AACiC,QAAA;AACN,MAAA;AACF,QAAA;AACE,MAAA;AACD,QAAA;AACjD,MAAA;AACD,IAAA;AACD,EAAA;AAEO,EAAA;AACR;AD/C+D;AACA;AACA;AACA","file":"/home/runner/work/editor/editor/packages/core/dist/chunk-CPOKFNBG.cjs","sourcesContent":[null,"/**\n * JSON-Schema-lite: the subset of JSON Schema used by MCP tool `inputSchema`s,\n * plus a small validator for tool-call arguments. Unknown keywords are ignored.\n */\nexport type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';\n\nexport interface JsonSchema {\n\ttype?: JsonSchemaType | readonly JsonSchemaType[];\n\tdescription?: string;\n\ttitle?: string;\n\tenum?: readonly unknown[];\n\tconst?: unknown;\n\tdefault?: unknown;\n\tproperties?: { readonly [key: string]: JsonSchema };\n\trequired?: readonly string[];\n\tadditionalProperties?: boolean | JsonSchema;\n\titems?: JsonSchema;\n\tminItems?: number;\n\tmaxItems?: number;\n\tminimum?: number;\n\tmaximum?: number;\n\tminLength?: number;\n\tmaxLength?: number;\n\tpattern?: string;\n\t[keyword: string]: unknown;\n}\n\nexport interface SchemaValidationError {\n\t/** JSON-pointer-like path to the offending value, e.g. `/node/id` (`\"\"` is the root). */\n\tpath: string;\n\tmessage: string;\n}\n\nfunction typeOf(value: unknown): JsonSchemaType | 'undefined' {\n\tif (value === null) return 'null';\n\tif (Array.isArray(value)) return 'array';\n\tif (typeof value === 'number') return Number.isInteger(value) ? 'integer' : 'number';\n\tif (typeof value === 'string' || typeof value === 'boolean' || typeof value === 'object') {\n\t\treturn typeof value as JsonSchemaType;\n\t}\n\treturn 'undefined';\n}\n\nfunction matchesType(value: unknown, type: JsonSchemaType): boolean {\n\tconst actual = typeOf(value);\n\tif (type === 'number') return actual === 'number' || actual === 'integer';\n\treturn actual === type;\n}\n\nconst isEqual = (a: unknown, b: unknown) => a === b || JSON.stringify(a) === JSON.stringify(b);\n\n/**\n * Validates `value` against `schema` and returns every error found (an empty\n * array means valid). Supports `type` (incl. arrays of types), `enum`, `const`,\n * `properties`, `required`, `additionalProperties`, `items`, `minItems`,\n * `maxItems`, `minimum`, `maximum`, `minLength`, `maxLength` and `pattern`.\n */\nexport function validateJsonSchema(value: unknown, schema: JsonSchema | undefined, path = ''): SchemaValidationError[] {\n\tif (!schema || typeof schema !== 'object') return [];\n\tconst errors: SchemaValidationError[] = [];\n\tconst at = path || '/';\n\n\tif (schema.type !== undefined) {\n\t\tconst types = (Array.isArray(schema.type) ? schema.type : [schema.type]) as JsonSchemaType[];\n\t\tif (!types.some((t) => matchesType(value, t))) {\n\t\t\terrors.push({ path: at, message: `Expected ${types.join(' | ')}, got ${typeOf(value)}.` });\n\t\t\treturn errors;\n\t\t}\n\t}\n\tif (schema.const !== undefined && !isEqual(value, schema.const)) {\n\t\terrors.push({ path: at, message: `Expected ${JSON.stringify(schema.const)}.` });\n\t}\n\tif (schema.enum && !schema.enum.some((option) => isEqual(value, option))) {\n\t\terrors.push({\n\t\t\tpath: at,\n\t\t\tmessage: `Expected one of ${schema.enum.map((o) => JSON.stringify(o)).join(', ')}, got ${JSON.stringify(value)}.`\n\t\t});\n\t}\n\n\tif (typeof value === 'string') {\n\t\tif (schema.minLength !== undefined && value.length < schema.minLength) {\n\t\t\terrors.push({ path: at, message: `Must be at least ${schema.minLength} characters.` });\n\t\t}\n\t\tif (schema.maxLength !== undefined && value.length > schema.maxLength) {\n\t\t\terrors.push({ path: at, message: `Must be at most ${schema.maxLength} characters.` });\n\t\t}\n\t\tif (schema.pattern !== undefined) {\n\t\t\tlet regex: RegExp | null = null;\n\t\t\ttry {\n\t\t\t\tregex = new RegExp(schema.pattern, 'u');\n\t\t\t} catch {\n\t\t\t\t// An invalid pattern in the schema is not the caller's fault.\n\t\t\t}\n\t\t\tif (regex && !regex.test(value)) {\n\t\t\t\terrors.push({ path: at, message: `Must match pattern ${schema.pattern}.` });\n\t\t\t}\n\t\t}\n\t}\n\n\tif (typeof value === 'number') {\n\t\tif (schema.minimum !== undefined && value < schema.minimum) {\n\t\t\terrors.push({ path: at, message: `Must be >= ${schema.minimum}.` });\n\t\t}\n\t\tif (schema.maximum !== undefined && value > schema.maximum) {\n\t\t\terrors.push({ path: at, message: `Must be <= ${schema.maximum}.` });\n\t\t}\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tif (schema.minItems !== undefined && value.length < schema.minItems) {\n\t\t\terrors.push({ path: at, message: `Must have at least ${schema.minItems} items.` });\n\t\t}\n\t\tif (schema.maxItems !== undefined && value.length > schema.maxItems) {\n\t\t\terrors.push({ path: at, message: `Must have at most ${schema.maxItems} items.` });\n\t\t}\n\t\tif (schema.items) {\n\t\t\tvalue.forEach((item, index) => {\n\t\t\t\terrors.push(...validateJsonSchema(item, schema.items, `${path}/${index}`));\n\t\t\t});\n\t\t}\n\t}\n\n\tif (typeOf(value) === 'object') {\n\t\tconst obj = value as Record<string, unknown>;\n\t\tfor (const key of schema.required ?? []) {\n\t\t\tif (obj[key] === undefined) {\n\t\t\t\terrors.push({ path: `${path}/${key}`, message: `Missing required property \"${key}\".` });\n\t\t\t}\n\t\t}\n\t\tconst properties = schema.properties ?? {};\n\t\tfor (const [key, child] of Object.entries(obj)) {\n\t\t\tif (child === undefined) continue;\n\t\t\tif (key in properties) {\n\t\t\t\terrors.push(...validateJsonSchema(child, properties[key], `${path}/${key}`));\n\t\t\t} else if (schema.additionalProperties === false) {\n\t\t\t\terrors.push({ path: `${path}/${key}`, message: `Unknown property \"${key}\".` });\n\t\t\t} else if (typeof schema.additionalProperties === 'object') {\n\t\t\t\terrors.push(...validateJsonSchema(child, schema.additionalProperties, `${path}/${key}`));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn errors;\n}\n"]}
|