@maroonedog/luq 2.4.3 → 2.5.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 +199 -9
- package/dist/chain/field-chain.types.d.ts +11 -1
- package/dist/chain/index.d.ts +2 -0
- package/dist/chain/plugin-not-imported.types.d.ts +40 -0
- package/dist/chain/plugin-not-imported.types.js +2 -0
- package/dist/chain/plugin-not-imported.types.mjs +1 -0
- package/dist/chain/slot-catalog.generated.d.ts +265 -0
- package/dist/chain/slot-catalog.generated.js +4 -0
- package/dist/chain/slot-catalog.generated.mjs +3 -0
- package/dist/core/type-erasure.d.ts +20 -0
- package/dist/core/type-erasure.js +23 -0
- package/dist/core/type-erasure.mjs +22 -0
- package/dist/field-rule/use-field.d.ts +2 -1
- package/dist/field-rule/use-field.js +9 -2
- package/dist/field-rule/use-field.mjs +9 -2
- package/dist/json-schema/array-keyword-guards.d.ts +31 -0
- package/dist/json-schema/array-keyword-guards.js +120 -0
- package/dist/json-schema/array-keyword-guards.mjs +114 -0
- package/dist/json-schema/assert-object-keyword-values.d.ts +59 -0
- package/dist/json-schema/assert-object-keyword-values.js +149 -0
- package/dist/json-schema/assert-object-keyword-values.mjs +141 -0
- package/dist/json-schema/collect-definitions.d.ts +7 -0
- package/dist/json-schema/collect-definitions.js +9 -0
- package/dist/json-schema/collect-definitions.mjs +10 -1
- package/dist/json-schema/declare-additional-properties.d.ts +11 -1
- package/dist/json-schema/declare-additional-properties.js +13 -1
- package/dist/json-schema/declare-additional-properties.mjs +13 -1
- package/dist/json-schema/declare-object-keywords.d.ts +4 -0
- package/dist/json-schema/declare-object-keywords.js +11 -4
- package/dist/json-schema/declare-object-keywords.mjs +11 -4
- package/dist/json-schema/declare-required-properties.js +6 -0
- package/dist/json-schema/declare-required-properties.mjs +6 -0
- package/dist/json-schema/declare-value-keywords.d.ts +10 -1
- package/dist/json-schema/declare-value-keywords.js +43 -4
- package/dist/json-schema/declare-value-keywords.mjs +43 -4
- package/dist/json-schema/extensions/json-schema/index.d.ts +1 -1
- package/dist/json-schema/extensions/json-schema/index.js +2 -1
- package/dist/json-schema/extensions/json-schema/index.mjs +1 -1
- package/dist/json-schema/flatten-array-schema.d.ts +11 -1
- package/dist/json-schema/flatten-array-schema.js +20 -7
- package/dist/json-schema/flatten-array-schema.mjs +20 -7
- package/dist/json-schema/index.d.ts +1 -0
- package/dist/json-schema/index.js +3 -1
- package/dist/json-schema/index.mjs +1 -0
- package/dist/json-schema/keyword-map-string.js +30 -1
- package/dist/json-schema/keyword-map-string.mjs +30 -1
- package/dist/json-schema/keyword-map.js +2 -0
- package/dist/json-schema/keyword-map.mjs +2 -0
- package/dist/json-schema/malformed-schema-error.d.ts +38 -0
- package/dist/json-schema/malformed-schema-error.js +103 -0
- package/dist/json-schema/malformed-schema-error.mjs +98 -0
- package/dist/plugins/manifest.generated.d.ts +18 -0
- package/dist/plugins/manifest.generated.js +77 -77
- package/dist/plugins/manifest.generated.mjs +77 -77
- package/dist/plugins/one-of/one-of.js +18 -4
- package/dist/plugins/one-of/one-of.mjs +18 -4
- package/dist/schema-tooling/index.d.ts +11 -0
- package/dist/schema-tooling/index.js +12 -1
- package/dist/schema-tooling/index.mjs +10 -0
- package/package.json +8 -6
|
@@ -33,7 +33,10 @@ function describeAllowed(allowed) {
|
|
|
33
33
|
function areAllMembersPrimitive(allowed) {
|
|
34
34
|
return allowed.every((member) => member === null || typeof member !== "object");
|
|
35
35
|
}
|
|
36
|
-
/** One membership test, decided ONCE at build time and never re-decided.
|
|
36
|
+
/** One membership test, decided ONCE at build time and never re-decided. The
|
|
37
|
+
* list must already be a snapshot: the linear path CLOSES OVER it rather than
|
|
38
|
+
* copying it into a Set, so a caller-owned array reaching here would stay
|
|
39
|
+
* readable — and mutable — through the returned validator. */
|
|
37
40
|
function createMembershipTest(allowed) {
|
|
38
41
|
if (allowed.length > SET_MEMBERSHIP_THRESHOLD &&
|
|
39
42
|
areAllMembersPrimitive(allowed)) {
|
|
@@ -50,13 +53,24 @@ export const oneOfPlugin = /*#__PURE__*/ definePlugin()({
|
|
|
50
53
|
if (!isArray(allowed) || allowed.length === 0) {
|
|
51
54
|
throw new PluginArgumentError(ctx.pluginName, "allowed", allowed);
|
|
52
55
|
}
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
// A built validator is a SNAPSHOT of what it was built from, and this list
|
|
57
|
+
// arrives BY REFERENCE: reached through the `enum` keyword it is the very
|
|
58
|
+
// array inside the caller's schema document. Without this copy, appending
|
|
59
|
+
// to that array in place after build() — a config reload that mutates the
|
|
60
|
+
// document rather than replacing it — silently widens a validator that is
|
|
61
|
+
// already serving traffic. It would also do so only SOMETIMES: the Set
|
|
62
|
+
// path in createMembershipTest copies and the linear path does not, so the
|
|
63
|
+
// behaviour would flip at a member count the caller has no reason to know
|
|
64
|
+
// about. Copying here, at the one point where the caller's array enters
|
|
65
|
+
// the plugin, is what makes both paths and the reported `expected` agree.
|
|
66
|
+
const members = Object.freeze(allowed.slice());
|
|
67
|
+
const isMember = createMembershipTest(members);
|
|
68
|
+
const rendered = describeAllowed(members);
|
|
55
69
|
return check({
|
|
56
70
|
code: ctx.code,
|
|
57
71
|
messageFactory: ctx.messageFactory,
|
|
58
72
|
severity: ctx.severity,
|
|
59
|
-
run: (value) => isMember(value) ? PASS : fail({ expected:
|
|
73
|
+
run: (value) => isMember(value) ? PASS : fail({ expected: members, actual: value }),
|
|
60
74
|
describe: () => `Value must be one of: ${rendered}`,
|
|
61
75
|
buildMessageContext: () => ({}),
|
|
62
76
|
});
|
|
@@ -5,3 +5,14 @@ export { isDraft07Schema, isSchemaObject } from "../json-schema";
|
|
|
5
5
|
/** The vocabulary itself: what a tool must have a decision for. */
|
|
6
6
|
export { listDraft07Keywords } from "../json-schema";
|
|
7
7
|
export type { ChildSchema, Draft07Schema, Draft07SchemaObject, } from "../json-schema";
|
|
8
|
+
/**
|
|
9
|
+
* Which plugin offers which chain method, on which slot, and the specifier to
|
|
10
|
+
* import it from.
|
|
11
|
+
*
|
|
12
|
+
* A generator emitting `.min(3)` has to emit the import that makes `.min`
|
|
13
|
+
* exist, and nothing else in the package answers that: the barrel names the
|
|
14
|
+
* symbols but not the methods they add. Data only — no plugin is loaded by
|
|
15
|
+
* reading it.
|
|
16
|
+
*/
|
|
17
|
+
export { PLUGIN_MANIFEST } from "../plugins/manifest.generated";
|
|
18
|
+
export type { PluginManifestEntry, PluginSurface, } from "../plugins/manifest.generated";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listDraft07Keywords = exports.isSchemaObject = exports.isDraft07Schema = exports.readChildSchemas = exports.flattenSchema = void 0;
|
|
3
|
+
exports.PLUGIN_MANIFEST = exports.listDraft07Keywords = exports.isSchemaObject = exports.isDraft07Schema = exports.readChildSchemas = exports.flattenSchema = void 0;
|
|
4
4
|
// ===========================================================================
|
|
5
5
|
// src/schema-tooling/index.ts — re-exports only. Nothing is defined here.
|
|
6
6
|
//
|
|
@@ -24,3 +24,14 @@ Object.defineProperty(exports, "isSchemaObject", { enumerable: true, get: functi
|
|
|
24
24
|
/** The vocabulary itself: what a tool must have a decision for. */
|
|
25
25
|
var json_schema_4 = require("../json-schema");
|
|
26
26
|
Object.defineProperty(exports, "listDraft07Keywords", { enumerable: true, get: function () { return json_schema_4.listDraft07Keywords; } });
|
|
27
|
+
/**
|
|
28
|
+
* Which plugin offers which chain method, on which slot, and the specifier to
|
|
29
|
+
* import it from.
|
|
30
|
+
*
|
|
31
|
+
* A generator emitting `.min(3)` has to emit the import that makes `.min`
|
|
32
|
+
* exist, and nothing else in the package answers that: the barrel names the
|
|
33
|
+
* symbols but not the methods they add. Data only — no plugin is loaded by
|
|
34
|
+
* reading it.
|
|
35
|
+
*/
|
|
36
|
+
var manifest_generated_1 = require("../plugins/manifest.generated");
|
|
37
|
+
Object.defineProperty(exports, "PLUGIN_MANIFEST", { enumerable: true, get: function () { return manifest_generated_1.PLUGIN_MANIFEST; } });
|
|
@@ -16,3 +16,13 @@ export { readChildSchemas } from "../json-schema/index.mjs";
|
|
|
16
16
|
export { isDraft07Schema, isSchemaObject } from "../json-schema/index.mjs";
|
|
17
17
|
/** The vocabulary itself: what a tool must have a decision for. */
|
|
18
18
|
export { listDraft07Keywords } from "../json-schema/index.mjs";
|
|
19
|
+
/**
|
|
20
|
+
* Which plugin offers which chain method, on which slot, and the specifier to
|
|
21
|
+
* import it from.
|
|
22
|
+
*
|
|
23
|
+
* A generator emitting `.min(3)` has to emit the import that makes `.min`
|
|
24
|
+
* exist, and nothing else in the package answers that: the barrel names the
|
|
25
|
+
* symbols but not the methods they add. Data only — no plugin is loaded by
|
|
26
|
+
* reading it.
|
|
27
|
+
*/
|
|
28
|
+
export { PLUGIN_MANIFEST } from "../plugins/manifest.generated.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maroonedog/luq",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Universal Model & API Definition Platform - TypeScript validation library evolving into cross-language code generation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -448,7 +448,7 @@
|
|
|
448
448
|
"test": "jest --no-watch --no-watchman --passWithNoTests",
|
|
449
449
|
"test:watch": "jest --watch",
|
|
450
450
|
"lint": "npm run lint:ox && npm run lint:naming",
|
|
451
|
-
"prepare": "npm run build",
|
|
451
|
+
"prepare": "npm run generate:sources && npm run build",
|
|
452
452
|
"prepublishOnly": "npm run verify",
|
|
453
453
|
"generate-docs": "npx ts-node --project scripts/tsconfig.json scripts/generate-docs.ts",
|
|
454
454
|
"lint:fix": "oxlint -c .oxlintrc.json --fix src bench",
|
|
@@ -460,7 +460,8 @@
|
|
|
460
460
|
"typecheck:scripts": "tsc --noEmit -p scripts/tsconfig.json",
|
|
461
461
|
"typecheck:bench": "tsc --noEmit -p bench/tsconfig.json",
|
|
462
462
|
"generate": "npm run generate:sources && npm run generate:exports && npm run generate:lock",
|
|
463
|
-
"generate:sources": "npm run generate:manifest && npm run generate:barrel",
|
|
463
|
+
"generate:sources": "npm run generate:manifest && npm run generate:barrel && npm run generate:slot-catalog",
|
|
464
|
+
"generate:slot-catalog": "npx ts-node --project scripts/tsconfig.json scripts/generate-slot-catalog.ts",
|
|
464
465
|
"generate:manifest": "npx ts-node --project scripts/tsconfig.json scripts/generate-plugin-manifest.ts",
|
|
465
466
|
"generate:barrel": "npx ts-node --project scripts/tsconfig.json scripts/generate-plugin-barrel.ts",
|
|
466
467
|
"generate:exports": "npx ts-node --project scripts/tsconfig.json scripts/generate-package-exports.ts",
|
|
@@ -483,9 +484,10 @@
|
|
|
483
484
|
"verify": "npm run generate:sources && npm run format:check && npm run lint && npm run lint:filenames && npm run typecheck && npm run test:types && npm run check:source && npm run check:catalog && npm run build && npm run check:dist && npm run check:docs && npm run check:distribution && npm test",
|
|
484
485
|
"test:types": "tsc --noEmit -p tsconfig.type-test.json",
|
|
485
486
|
"check:doc-examples": "npx ts-node --project scripts/tsconfig.json scripts/check-doc-examples.ts",
|
|
487
|
+
"check:readme-links": "npx ts-node --project scripts/tsconfig.json scripts/check-readme-links.ts",
|
|
486
488
|
"check:doc-imports": "npx ts-node --project scripts/tsconfig.json scripts/check-doc-imports.ts",
|
|
487
489
|
"check:generated-docs": "npx ts-node --project scripts/tsconfig.json scripts/generate-docs.ts --check",
|
|
488
|
-
"check:docs": "npm run check:generated-docs && npm run check:doc-examples && npm run check:doc-imports && npm run check:conformance-figures && npm run check:perf-figures",
|
|
490
|
+
"check:docs": "npm run check:generated-docs && npm run check:readme-links && npm run check:doc-examples && npm run check:doc-imports && npm run check:conformance-figures && npm run check:perf-figures",
|
|
489
491
|
"bench:record": "npx ts-node --project scripts/tsconfig.json scripts/run-bench.ts --record",
|
|
490
492
|
"bench:gate": "npx ts-node --project scripts/tsconfig.json scripts/run-bench.ts --gate",
|
|
491
493
|
"check:conformance-figures": "npx ts-node --project scripts/tsconfig.json scripts/check-conformance-figures.ts",
|
|
@@ -536,9 +538,9 @@
|
|
|
536
538
|
"ts-node": "^10.9.2",
|
|
537
539
|
"tsx": "^4.20.3",
|
|
538
540
|
"typescript": "^5.8.3",
|
|
539
|
-
"valibot": "^1.
|
|
541
|
+
"valibot": "^1.5.0",
|
|
540
542
|
"yup": "^1.7.1",
|
|
541
|
-
"zod": "^4.
|
|
543
|
+
"zod": "^4.6.2"
|
|
542
544
|
},
|
|
543
545
|
"sideEffects": false
|
|
544
546
|
}
|