constructa-schema 0.0.1 → 0.0.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Constructa contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -3,3 +3,44 @@
3
3
  Portable generator definitions, validation schemas, and related types shared by every Constructa interface.
4
4
 
5
5
  Planned areas include definition versioning, primitive and composite definitions, validation results, and safe serialization. This package must remain independent of execution, UI, network, and persistence concerns.
6
+
7
+ ## Portable data constraint
8
+
9
+ Portable generator definitions are JSON-only data. Supported values are strings, booleans, `null`, finite numbers other than negative zero, arrays, and plain object records whose properties are all JSON values.
10
+
11
+ Omit optional data by leaving the property out. `undefined` is not a portable value, including in object properties or array items. Values that JSON would coerce, execute, or silently omit are rejected, including functions, symbols, bigints, `NaN`, infinities, cyclic objects, sparse arrays, custom `toJSON` behavior, class instances, maps, sets, dates, accessors, symbol keys, and non-enumerable properties.
12
+
13
+ Use `isJsonValue`, `assertJsonValue`, or `findJsonValueError` to enforce this constraint before later schema-specific validation.
14
+
15
+ ## Schema version
16
+
17
+ Complete portable definitions must include `schemaVersion: 1`. `CURRENT_SCHEMA_VERSION` identifies the version emitted by current Constructa tooling, and `SUPPORTED_SCHEMA_VERSIONS` lists the versions accepted by this package.
18
+
19
+ Use `isSchemaVersion`, `assertSchemaVersion`, `isVersionedDefinition`, `assertVersionedDefinition`, `findSchemaVersionValueFailure`, or `findSchemaVersionFailure` to reject missing or unsupported version markers with structured failures.
20
+
21
+ ## Definition envelope
22
+
23
+ The canonical top-level generator definition document is:
24
+
25
+ ```json
26
+ {
27
+ "schemaVersion": 1,
28
+ "type": "integer",
29
+ "configuration": {
30
+ "min": 1,
31
+ "max": 100
32
+ },
33
+ "name": "Small integer",
34
+ "description": "An integer in a bounded range."
35
+ }
36
+ ```
37
+
38
+ `schemaVersion`, `type`, and `configuration` are required. `type` must be a non-empty string, and `configuration` must be a JSON object. `name` and `description` are optional strings.
39
+
40
+ Unknown top-level properties are rejected so all surfaces exchange one canonical document shape. Generator-specific data belongs inside `configuration`, where each generator can validate its own fields in later phases.
41
+
42
+ Use `isDefinitionEnvelope`, `assertDefinitionEnvelope`, `parseDefinitionEnvelope`, `safeParseDefinitionEnvelope`, or `findDefinitionEnvelopeFailure` to validate the complete envelope.
43
+
44
+ ## Dependency boundary
45
+
46
+ This is the bottom of the domain dependency graph and has no Constructa runtime dependencies. In particular, it must not import core, generators, exporters, the SDK, applications, UI, environment, persistence, or transport code.
package/dist/index.d.ts CHANGED
@@ -1 +1,76 @@
1
- export {}
1
+ //#region src/index.d.ts
2
+ type JsonPrimitive = boolean | null | number | string;
3
+ type JsonValue = JsonArray | JsonObject | JsonPrimitive;
4
+ type JsonArray = readonly JsonValue[];
5
+ type JsonObject = {
6
+ readonly [key: string]: JsonValue;
7
+ };
8
+ declare const CURRENT_SCHEMA_VERSION = 1;
9
+ declare const SUPPORTED_SCHEMA_VERSIONS: readonly [1];
10
+ type SchemaVersion = (typeof SUPPORTED_SCHEMA_VERSIONS)[number];
11
+ type VersionedDefinition = JsonObject & {
12
+ readonly schemaVersion: SchemaVersion;
13
+ };
14
+ type DefinitionEnvelope = {
15
+ readonly schemaVersion: SchemaVersion;
16
+ readonly type: string;
17
+ readonly configuration: JsonObject;
18
+ readonly name?: string;
19
+ readonly description?: string;
20
+ };
21
+ declare const DEFINITION_ENVELOPE_TOP_LEVEL_KEYS: readonly ["schemaVersion", "type", "configuration", "name", "description"];
22
+ type SchemaVersionFailureCode = "schema_version_missing" | "schema_version_unsupported";
23
+ type SchemaVersionFailure = {
24
+ readonly code: SchemaVersionFailureCode;
25
+ readonly message: string;
26
+ readonly path: string;
27
+ readonly severity: "error";
28
+ readonly supportedVersions: readonly SchemaVersion[];
29
+ };
30
+ type DefinitionEnvelopeFailureCode = SchemaVersionFailureCode | "definition_envelope_not_json" | "definition_envelope_not_object" | "generator_type_missing" | "generator_type_invalid" | "configuration_missing" | "configuration_invalid" | "name_invalid" | "description_invalid" | "top_level_property_unknown";
31
+ type DefinitionEnvelopeShapeFailureCode = Exclude<DefinitionEnvelopeFailureCode, SchemaVersionFailureCode>;
32
+ type DefinitionEnvelopeShapeFailure = {
33
+ readonly code: DefinitionEnvelopeShapeFailureCode;
34
+ readonly message: string;
35
+ readonly path: string;
36
+ readonly severity: "error";
37
+ };
38
+ type DefinitionEnvelopeFailure = SchemaVersionFailure | DefinitionEnvelopeShapeFailure;
39
+ type DefinitionEnvelopeParseResult = {
40
+ readonly success: true;
41
+ readonly value: DefinitionEnvelope;
42
+ } | {
43
+ readonly success: false;
44
+ readonly failure: DefinitionEnvelopeFailure;
45
+ };
46
+ declare class JsonValueError extends TypeError {
47
+ constructor(path: string, reason: string);
48
+ }
49
+ declare class SchemaVersionError extends TypeError {
50
+ readonly failure: SchemaVersionFailure;
51
+ constructor(failure: SchemaVersionFailure);
52
+ }
53
+ declare class DefinitionEnvelopeError extends TypeError {
54
+ readonly failure: DefinitionEnvelopeFailure;
55
+ constructor(failure: DefinitionEnvelopeFailure);
56
+ }
57
+ declare function isJsonValue(value: unknown): value is JsonValue;
58
+ declare function isSchemaVersion(value: unknown): value is SchemaVersion;
59
+ declare function isVersionedDefinition(value: unknown): value is VersionedDefinition;
60
+ declare function isDefinitionEnvelope(value: unknown): value is DefinitionEnvelope;
61
+ declare function assertJsonValue(value: unknown, path?: string): asserts value is JsonValue;
62
+ declare function assertSchemaVersion(value: unknown, path?: string): asserts value is SchemaVersion;
63
+ declare function assertVersionedDefinition(value: unknown, path?: string): asserts value is VersionedDefinition;
64
+ declare function assertDefinitionEnvelope(value: unknown, path?: string): asserts value is DefinitionEnvelope;
65
+ declare function parseDefinitionEnvelope(value: unknown, path?: string): DefinitionEnvelope;
66
+ declare function safeParseDefinitionEnvelope(value: unknown, path?: string): DefinitionEnvelopeParseResult;
67
+ declare function findJsonValueError(value: unknown, path?: string): {
68
+ path: string;
69
+ reason: string;
70
+ } | undefined;
71
+ declare function findDefinitionEnvelopeFailure(value: unknown, path?: string): DefinitionEnvelopeFailure | undefined;
72
+ declare function findSchemaVersionFailure(value: unknown, path?: string): SchemaVersionFailure | undefined;
73
+ declare function findSchemaVersionValueFailure(value: unknown, path?: string): SchemaVersionFailure | undefined;
74
+ //#endregion
75
+ export { CURRENT_SCHEMA_VERSION, DEFINITION_ENVELOPE_TOP_LEVEL_KEYS, DefinitionEnvelope, DefinitionEnvelopeError, DefinitionEnvelopeFailure, DefinitionEnvelopeFailureCode, DefinitionEnvelopeParseResult, DefinitionEnvelopeShapeFailure, DefinitionEnvelopeShapeFailureCode, JsonArray, JsonObject, JsonPrimitive, JsonValue, JsonValueError, SUPPORTED_SCHEMA_VERSIONS, SchemaVersion, SchemaVersionError, SchemaVersionFailure, SchemaVersionFailureCode, VersionedDefinition, assertDefinitionEnvelope, assertJsonValue, assertSchemaVersion, assertVersionedDefinition, findDefinitionEnvelopeFailure, findJsonValueError, findSchemaVersionFailure, findSchemaVersionValueFailure, isDefinitionEnvelope, isJsonValue, isSchemaVersion, isVersionedDefinition, parseDefinitionEnvelope, safeParseDefinitionEnvelope };
76
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";KAAY;KAEA,YAAY,YAAY,aAAa;KAErC,qBAAqB;KAErB;YACA,cAAc;;cAGb;cAEA;KAED,wBAAwB;KAExB,sBAAsB;WACvB,eAAe;;KAGd;WACD,eAAe;WACf;WACA,eAAe;WACf;WACA;;cAGE;KAQD;KAIA;WACD,MAAM;WACN;WACA;WACA;WACA,4BAA4B;;KAG3B,gCACR;KAWQ,qCAAqC,QAC/C,+BACA;KAGU;WACD,MAAM;WACN;WACA;WACA;;KAGC,4BACR,uBACA;KAEQ;WAEG;WACA,OAAO;;WAGP;WACA,SAAS;;cAGX,uBAAuB;EACtB,YAAA,cAAc;;cAMf,2BAA2B;WAC7B,SAAS;EAEN,YAAA,SAAS;;cAOV,gCAAgC;WAClC,SAAS;EAEN,YAAA,SAAS;;iBAOP,YAAY,iBAAiB,SAAS;iBAItC,gBAAgB,iBAAiB,SAAS;iBAI1C,sBACd,iBACC,SAAS;iBAQI,qBACd,iBACC,SAAS;iBAII,gBACd,gBACA,wBACS,SAAS;iBAQJ,oBACd,gBACA,wBACS,SAAS;iBAQJ,0BACd,gBACA,wBACS,SAAS;iBAUJ,yBACd,gBACA,wBACS,SAAS;iBAQJ,wBACd,gBACA,gBACC;iBAKa,4BACd,gBACA,gBACC;iBAUa,mBACd,gBACA;EACG;EAAc;;iBAIH,8BACd,gBACA,gBACC;iBA8Ea,yBACd,gBACA,gBACC;iBAaa,8BACd,gBACA,gBACC"}
package/dist/index.js CHANGED
@@ -0,0 +1,255 @@
1
+ //#region src/index.ts
2
+ const CURRENT_SCHEMA_VERSION = 1;
3
+ const SUPPORTED_SCHEMA_VERSIONS = [1];
4
+ const DEFINITION_ENVELOPE_TOP_LEVEL_KEYS = [
5
+ "schemaVersion",
6
+ "type",
7
+ "configuration",
8
+ "name",
9
+ "description"
10
+ ];
11
+ var JsonValueError = class extends TypeError {
12
+ constructor(path, reason) {
13
+ super(`${path}: ${reason}`);
14
+ this.name = "JsonValueError";
15
+ }
16
+ };
17
+ var SchemaVersionError = class extends TypeError {
18
+ failure;
19
+ constructor(failure) {
20
+ super(`${failure.path}: ${failure.message}`);
21
+ this.name = "SchemaVersionError";
22
+ this.failure = failure;
23
+ }
24
+ };
25
+ var DefinitionEnvelopeError = class extends TypeError {
26
+ failure;
27
+ constructor(failure) {
28
+ super(`${failure.path}: ${failure.message}`);
29
+ this.name = "DefinitionEnvelopeError";
30
+ this.failure = failure;
31
+ }
32
+ };
33
+ function isJsonValue(value) {
34
+ return findJsonValueError(value) === void 0;
35
+ }
36
+ function isSchemaVersion(value) {
37
+ return value === 1;
38
+ }
39
+ function isVersionedDefinition(value) {
40
+ return findSchemaVersionFailure(value) === void 0 && isJsonRecord(value) && isJsonValue(value);
41
+ }
42
+ function isDefinitionEnvelope(value) {
43
+ return findDefinitionEnvelopeFailure(value) === void 0;
44
+ }
45
+ function assertJsonValue(value, path = "$") {
46
+ const error = findJsonValueError(value, path);
47
+ if (error !== void 0) throw new JsonValueError(error.path, error.reason);
48
+ }
49
+ function assertSchemaVersion(value, path = "$.schemaVersion") {
50
+ const failure = findSchemaVersionValueFailure(value, path);
51
+ if (failure !== void 0) throw new SchemaVersionError(failure);
52
+ }
53
+ function assertVersionedDefinition(value, path = "$") {
54
+ const failure = findSchemaVersionFailure(value, path);
55
+ if (failure !== void 0) throw new SchemaVersionError(failure);
56
+ assertJsonValue(value, path);
57
+ }
58
+ function assertDefinitionEnvelope(value, path = "$") {
59
+ const failure = findDefinitionEnvelopeFailure(value, path);
60
+ if (failure !== void 0) throw new DefinitionEnvelopeError(failure);
61
+ }
62
+ function parseDefinitionEnvelope(value, path = "$") {
63
+ assertDefinitionEnvelope(value, path);
64
+ return value;
65
+ }
66
+ function safeParseDefinitionEnvelope(value, path = "$") {
67
+ const failure = findDefinitionEnvelopeFailure(value, path);
68
+ if (failure !== void 0) return {
69
+ failure,
70
+ success: false
71
+ };
72
+ return {
73
+ success: true,
74
+ value
75
+ };
76
+ }
77
+ function findJsonValueError(value, path = "$") {
78
+ return findJsonValueErrorInternal(value, path, /* @__PURE__ */ new Set());
79
+ }
80
+ function findDefinitionEnvelopeFailure(value, path = "$") {
81
+ const jsonError = findJsonValueError(value, path);
82
+ if (jsonError !== void 0) return createDefinitionEnvelopeFailure("definition_envelope_not_json", {
83
+ message: jsonError.reason,
84
+ path: jsonError.path
85
+ });
86
+ if (!isJsonRecord(value)) return createDefinitionEnvelopeFailure("definition_envelope_not_object", { path });
87
+ const versionFailure = findSchemaVersionFailure(value, path);
88
+ if (versionFailure !== void 0) return versionFailure;
89
+ if (!Object.hasOwn(value, "type")) return createDefinitionEnvelopeFailure("generator_type_missing", { path: appendPathSegment(path, "type") });
90
+ const typeValue = value.type;
91
+ if (typeof typeValue !== "string" || typeValue.trim().length === 0) return createDefinitionEnvelopeFailure("generator_type_invalid", { path: appendPathSegment(path, "type") });
92
+ if (!Object.hasOwn(value, "configuration")) return createDefinitionEnvelopeFailure("configuration_missing", { path: appendPathSegment(path, "configuration") });
93
+ if (!isJsonRecord(value.configuration)) return createDefinitionEnvelopeFailure("configuration_invalid", { path: appendPathSegment(path, "configuration") });
94
+ for (const optionalStringField of ["name", "description"]) {
95
+ const fieldFailure = findDefinitionEnvelopeStringFieldFailure(value, {
96
+ invalidCode: optionalStringField === "name" ? "name_invalid" : "description_invalid",
97
+ path: appendPathSegment(path, optionalStringField),
98
+ property: optionalStringField
99
+ });
100
+ if (fieldFailure !== void 0) return fieldFailure;
101
+ }
102
+ const unknownKey = Object.keys(value).find((key) => !DEFINITION_ENVELOPE_TOP_LEVEL_KEYS.includes(key));
103
+ if (unknownKey !== void 0) return createDefinitionEnvelopeFailure("top_level_property_unknown", {
104
+ message: `Unknown top-level property: ${unknownKey}`,
105
+ path: appendPathSegment(path, unknownKey)
106
+ });
107
+ }
108
+ function findSchemaVersionFailure(value, path = "$") {
109
+ if (!isJsonRecord(value) || !Object.hasOwn(value, "schemaVersion")) return createSchemaVersionFailure("schema_version_missing", { path: appendPathSegment(path, "schemaVersion") });
110
+ return findSchemaVersionValueFailure(value.schemaVersion, appendPathSegment(path, "schemaVersion"));
111
+ }
112
+ function findSchemaVersionValueFailure(value, path = "$.schemaVersion") {
113
+ if (isSchemaVersion(value)) return;
114
+ return createSchemaVersionFailure("schema_version_unsupported", { path });
115
+ }
116
+ function findJsonValueErrorInternal(value, path, ancestors) {
117
+ switch (typeof value) {
118
+ case "boolean":
119
+ case "string": return;
120
+ case "number":
121
+ if (!Number.isFinite(value)) return {
122
+ path,
123
+ reason: "number must be finite"
124
+ };
125
+ if (Object.is(value, -0)) return {
126
+ path,
127
+ reason: "number must not be negative zero"
128
+ };
129
+ return;
130
+ case "object":
131
+ if (value === null) return;
132
+ return findJsonObjectError(value, path, ancestors);
133
+ case "bigint":
134
+ case "function":
135
+ case "symbol":
136
+ case "undefined": return {
137
+ path,
138
+ reason: `${typeof value} is not JSON-compatible`
139
+ };
140
+ }
141
+ }
142
+ function createSchemaVersionFailure(code, options) {
143
+ return {
144
+ code,
145
+ message: code === "schema_version_missing" ? `schemaVersion is required and must be 1` : `schemaVersion must be 1`,
146
+ path: options.path,
147
+ severity: "error",
148
+ supportedVersions: SUPPORTED_SCHEMA_VERSIONS
149
+ };
150
+ }
151
+ function createDefinitionEnvelopeFailure(code, options) {
152
+ return {
153
+ code,
154
+ message: options.message ?? getDefinitionEnvelopeFailureMessage(code),
155
+ path: options.path,
156
+ severity: "error"
157
+ };
158
+ }
159
+ function getDefinitionEnvelopeFailureMessage(code) {
160
+ switch (code) {
161
+ case "definition_envelope_not_json": return "definition envelope must be portable JSON data";
162
+ case "definition_envelope_not_object": return "definition envelope must be a JSON object";
163
+ case "generator_type_missing": return "type is required";
164
+ case "generator_type_invalid": return "type must be a non-empty string";
165
+ case "configuration_missing": return "configuration is required";
166
+ case "configuration_invalid": return "configuration must be a JSON object";
167
+ case "name_invalid": return "name must be a string when present";
168
+ case "description_invalid": return "description must be a string when present";
169
+ case "top_level_property_unknown": return "unknown top-level properties are not allowed";
170
+ }
171
+ }
172
+ function findDefinitionEnvelopeStringFieldFailure(value, options) {
173
+ if (!Object.hasOwn(value, options.property)) return;
174
+ return typeof value[options.property] === "string" ? void 0 : createDefinitionEnvelopeFailure(options.invalidCode, { path: options.path });
175
+ }
176
+ function appendPathSegment(path, segment) {
177
+ return path === "$" ? `$.${segment}` : `${path}.${segment}`;
178
+ }
179
+ function isJsonRecord(value) {
180
+ const prototype = typeof value === "object" && value !== null ? Object.getPrototypeOf(value) : void 0;
181
+ return typeof value === "object" && value !== null && !Array.isArray(value) && (prototype === null || prototype === Object.prototype);
182
+ }
183
+ function findJsonObjectError(value, path, ancestors) {
184
+ if (ancestors.has(value)) return {
185
+ path,
186
+ reason: "cyclic objects are not JSON-compatible"
187
+ };
188
+ if (hasCallableToJson(value)) return {
189
+ path,
190
+ reason: "objects with toJSON behavior are not portable"
191
+ };
192
+ ancestors.add(value);
193
+ const error = Array.isArray(value) ? findJsonArrayError(value, path, ancestors) : findJsonRecordError(value, path, ancestors);
194
+ ancestors.delete(value);
195
+ return error;
196
+ }
197
+ function hasCallableToJson(value) {
198
+ return "toJSON" in value && typeof value.toJSON === "function";
199
+ }
200
+ function findJsonArrayError(value, path, ancestors) {
201
+ const extraProperty = Object.keys(value).find((key) => !isArrayIndexKey(key));
202
+ if (extraProperty !== void 0) return {
203
+ path: `${path}.${extraProperty}`,
204
+ reason: "array object properties would be omitted from JSON"
205
+ };
206
+ const ownPropertyError = findUnsupportedOwnProperty(value, path, ["length"]);
207
+ if (ownPropertyError !== void 0) return ownPropertyError;
208
+ for (let index = 0; index < value.length; index += 1) {
209
+ if (!(index in value)) return {
210
+ path: `${path}[${index}]`,
211
+ reason: "sparse array slots are not JSON-compatible"
212
+ };
213
+ const itemError = findJsonValueErrorInternal(value[index], `${path}[${index}]`, ancestors);
214
+ if (itemError !== void 0) return itemError;
215
+ }
216
+ }
217
+ function isArrayIndexKey(key) {
218
+ const index = Number(key);
219
+ return Number.isInteger(index) && index >= 0 && index < 2 ** 32 - 1 && String(index) === key;
220
+ }
221
+ function findJsonRecordError(value, path, ancestors) {
222
+ const prototype = Object.getPrototypeOf(value);
223
+ if (prototype !== null && prototype !== Object.prototype) return {
224
+ path,
225
+ reason: "object must be a plain JSON record"
226
+ };
227
+ const ownPropertyError = findUnsupportedOwnProperty(value, path);
228
+ if (ownPropertyError !== void 0) return ownPropertyError;
229
+ for (const key of Object.keys(value)) {
230
+ const itemError = findJsonValueErrorInternal(value[key], `${path}.${key}`, ancestors);
231
+ if (itemError !== void 0) return itemError;
232
+ }
233
+ }
234
+ function findUnsupportedOwnProperty(value, path, allowedNonEnumerableProperties = []) {
235
+ if (Object.getOwnPropertySymbols(value).length > 0) return {
236
+ path,
237
+ reason: "symbol keys are not JSON-compatible"
238
+ };
239
+ const allowedNonEnumerable = new Set(allowedNonEnumerableProperties);
240
+ const descriptors = Object.getOwnPropertyDescriptors(value);
241
+ for (const [key, descriptor] of Object.entries(descriptors)) {
242
+ if ("get" in descriptor || "set" in descriptor) return {
243
+ path: `${path}.${key}`,
244
+ reason: "accessor properties are not portable JSON data"
245
+ };
246
+ if (!descriptor.enumerable && !allowedNonEnumerable.has(key)) return {
247
+ path: `${path}.${key}`,
248
+ reason: "non-enumerable properties would be omitted from JSON"
249
+ };
250
+ }
251
+ }
252
+ //#endregion
253
+ export { CURRENT_SCHEMA_VERSION, DEFINITION_ENVELOPE_TOP_LEVEL_KEYS, DefinitionEnvelopeError, JsonValueError, SUPPORTED_SCHEMA_VERSIONS, SchemaVersionError, assertDefinitionEnvelope, assertJsonValue, assertSchemaVersion, assertVersionedDefinition, findDefinitionEnvelopeFailure, findJsonValueError, findSchemaVersionFailure, findSchemaVersionValueFailure, isDefinitionEnvelope, isJsonValue, isSchemaVersion, isVersionedDefinition, parseDefinitionEnvelope, safeParseDefinitionEnvelope };
254
+
255
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export type JsonPrimitive = boolean | null | number | string;\n\nexport type JsonValue = JsonArray | JsonObject | JsonPrimitive;\n\nexport type JsonArray = readonly JsonValue[];\n\nexport type JsonObject = {\n readonly [key: string]: JsonValue;\n};\n\nexport const CURRENT_SCHEMA_VERSION = 1;\n\nexport const SUPPORTED_SCHEMA_VERSIONS = [CURRENT_SCHEMA_VERSION] as const;\n\nexport type SchemaVersion = (typeof SUPPORTED_SCHEMA_VERSIONS)[number];\n\nexport type VersionedDefinition = JsonObject & {\n readonly schemaVersion: SchemaVersion;\n};\n\nexport type DefinitionEnvelope = {\n readonly schemaVersion: SchemaVersion;\n readonly type: string;\n readonly configuration: JsonObject;\n readonly name?: string;\n readonly description?: string;\n};\n\nexport const DEFINITION_ENVELOPE_TOP_LEVEL_KEYS = [\n \"schemaVersion\",\n \"type\",\n \"configuration\",\n \"name\",\n \"description\",\n] as const;\n\nexport type SchemaVersionFailureCode =\n | \"schema_version_missing\"\n | \"schema_version_unsupported\";\n\nexport type SchemaVersionFailure = {\n readonly code: SchemaVersionFailureCode;\n readonly message: string;\n readonly path: string;\n readonly severity: \"error\";\n readonly supportedVersions: readonly SchemaVersion[];\n};\n\nexport type DefinitionEnvelopeFailureCode =\n | SchemaVersionFailureCode\n | \"definition_envelope_not_json\"\n | \"definition_envelope_not_object\"\n | \"generator_type_missing\"\n | \"generator_type_invalid\"\n | \"configuration_missing\"\n | \"configuration_invalid\"\n | \"name_invalid\"\n | \"description_invalid\"\n | \"top_level_property_unknown\";\n\nexport type DefinitionEnvelopeShapeFailureCode = Exclude<\n DefinitionEnvelopeFailureCode,\n SchemaVersionFailureCode\n>;\n\nexport type DefinitionEnvelopeShapeFailure = {\n readonly code: DefinitionEnvelopeShapeFailureCode;\n readonly message: string;\n readonly path: string;\n readonly severity: \"error\";\n};\n\nexport type DefinitionEnvelopeFailure =\n | SchemaVersionFailure\n | DefinitionEnvelopeShapeFailure;\n\nexport type DefinitionEnvelopeParseResult =\n | {\n readonly success: true;\n readonly value: DefinitionEnvelope;\n }\n | {\n readonly success: false;\n readonly failure: DefinitionEnvelopeFailure;\n };\n\nexport class JsonValueError extends TypeError {\n constructor(path: string, reason: string) {\n super(`${path}: ${reason}`);\n this.name = \"JsonValueError\";\n }\n}\n\nexport class SchemaVersionError extends TypeError {\n readonly failure: SchemaVersionFailure;\n\n constructor(failure: SchemaVersionFailure) {\n super(`${failure.path}: ${failure.message}`);\n this.name = \"SchemaVersionError\";\n this.failure = failure;\n }\n}\n\nexport class DefinitionEnvelopeError extends TypeError {\n readonly failure: DefinitionEnvelopeFailure;\n\n constructor(failure: DefinitionEnvelopeFailure) {\n super(`${failure.path}: ${failure.message}`);\n this.name = \"DefinitionEnvelopeError\";\n this.failure = failure;\n }\n}\n\nexport function isJsonValue(value: unknown): value is JsonValue {\n return findJsonValueError(value) === undefined;\n}\n\nexport function isSchemaVersion(value: unknown): value is SchemaVersion {\n return value === CURRENT_SCHEMA_VERSION;\n}\n\nexport function isVersionedDefinition(\n value: unknown,\n): value is VersionedDefinition {\n return (\n findSchemaVersionFailure(value) === undefined &&\n isJsonRecord(value) &&\n isJsonValue(value)\n );\n}\n\nexport function isDefinitionEnvelope(\n value: unknown,\n): value is DefinitionEnvelope {\n return findDefinitionEnvelopeFailure(value) === undefined;\n}\n\nexport function assertJsonValue(\n value: unknown,\n path = \"$\",\n): asserts value is JsonValue {\n const error = findJsonValueError(value, path);\n\n if (error !== undefined) {\n throw new JsonValueError(error.path, error.reason);\n }\n}\n\nexport function assertSchemaVersion(\n value: unknown,\n path = \"$.schemaVersion\",\n): asserts value is SchemaVersion {\n const failure = findSchemaVersionValueFailure(value, path);\n\n if (failure !== undefined) {\n throw new SchemaVersionError(failure);\n }\n}\n\nexport function assertVersionedDefinition(\n value: unknown,\n path = \"$\",\n): asserts value is VersionedDefinition {\n const failure = findSchemaVersionFailure(value, path);\n\n if (failure !== undefined) {\n throw new SchemaVersionError(failure);\n }\n\n assertJsonValue(value, path);\n}\n\nexport function assertDefinitionEnvelope(\n value: unknown,\n path = \"$\",\n): asserts value is DefinitionEnvelope {\n const failure = findDefinitionEnvelopeFailure(value, path);\n\n if (failure !== undefined) {\n throw new DefinitionEnvelopeError(failure);\n }\n}\n\nexport function parseDefinitionEnvelope(\n value: unknown,\n path = \"$\",\n): DefinitionEnvelope {\n assertDefinitionEnvelope(value, path);\n return value;\n}\n\nexport function safeParseDefinitionEnvelope(\n value: unknown,\n path = \"$\",\n): DefinitionEnvelopeParseResult {\n const failure = findDefinitionEnvelopeFailure(value, path);\n\n if (failure !== undefined) {\n return { failure, success: false };\n }\n\n return { success: true, value: value as DefinitionEnvelope };\n}\n\nexport function findJsonValueError(\n value: unknown,\n path = \"$\",\n): { path: string; reason: string } | undefined {\n return findJsonValueErrorInternal(value, path, new Set());\n}\n\nexport function findDefinitionEnvelopeFailure(\n value: unknown,\n path = \"$\",\n): DefinitionEnvelopeFailure | undefined {\n const jsonError = findJsonValueError(value, path);\n\n if (jsonError !== undefined) {\n return createDefinitionEnvelopeFailure(\"definition_envelope_not_json\", {\n message: jsonError.reason,\n path: jsonError.path,\n });\n }\n\n if (!isJsonRecord(value)) {\n return createDefinitionEnvelopeFailure(\"definition_envelope_not_object\", {\n path,\n });\n }\n\n const versionFailure = findSchemaVersionFailure(value, path);\n\n if (versionFailure !== undefined) {\n return versionFailure;\n }\n\n if (!Object.hasOwn(value, \"type\")) {\n return createDefinitionEnvelopeFailure(\"generator_type_missing\", {\n path: appendPathSegment(path, \"type\"),\n });\n }\n\n const typeValue = value.type;\n\n if (typeof typeValue !== \"string\" || typeValue.trim().length === 0) {\n return createDefinitionEnvelopeFailure(\"generator_type_invalid\", {\n path: appendPathSegment(path, \"type\"),\n });\n }\n\n if (!Object.hasOwn(value, \"configuration\")) {\n return createDefinitionEnvelopeFailure(\"configuration_missing\", {\n path: appendPathSegment(path, \"configuration\"),\n });\n }\n\n if (!isJsonRecord(value.configuration)) {\n return createDefinitionEnvelopeFailure(\"configuration_invalid\", {\n path: appendPathSegment(path, \"configuration\"),\n });\n }\n\n for (const optionalStringField of [\"name\", \"description\"] as const) {\n const fieldFailure = findDefinitionEnvelopeStringFieldFailure(value, {\n invalidCode:\n optionalStringField === \"name\" ? \"name_invalid\" : \"description_invalid\",\n path: appendPathSegment(path, optionalStringField),\n property: optionalStringField,\n });\n\n if (fieldFailure !== undefined) {\n return fieldFailure;\n }\n }\n\n const unknownKey = Object.keys(value).find(\n (key) =>\n !DEFINITION_ENVELOPE_TOP_LEVEL_KEYS.includes(\n key as (typeof DEFINITION_ENVELOPE_TOP_LEVEL_KEYS)[number],\n ),\n );\n\n if (unknownKey !== undefined) {\n return createDefinitionEnvelopeFailure(\"top_level_property_unknown\", {\n message: `Unknown top-level property: ${unknownKey}`,\n path: appendPathSegment(path, unknownKey),\n });\n }\n\n return undefined;\n}\n\nexport function findSchemaVersionFailure(\n value: unknown,\n path = \"$\",\n): SchemaVersionFailure | undefined {\n if (!isJsonRecord(value) || !Object.hasOwn(value, \"schemaVersion\")) {\n return createSchemaVersionFailure(\"schema_version_missing\", {\n path: appendPathSegment(path, \"schemaVersion\"),\n });\n }\n\n return findSchemaVersionValueFailure(\n value.schemaVersion,\n appendPathSegment(path, \"schemaVersion\"),\n );\n}\n\nexport function findSchemaVersionValueFailure(\n value: unknown,\n path = \"$.schemaVersion\",\n): SchemaVersionFailure | undefined {\n if (isSchemaVersion(value)) {\n return undefined;\n }\n\n return createSchemaVersionFailure(\"schema_version_unsupported\", { path });\n}\n\nfunction findJsonValueErrorInternal(\n value: unknown,\n path: string,\n ancestors: Set<object>,\n): { path: string; reason: string } | undefined {\n switch (typeof value) {\n case \"boolean\":\n case \"string\":\n return undefined;\n case \"number\":\n if (!Number.isFinite(value)) {\n return { path, reason: \"number must be finite\" };\n }\n if (Object.is(value, -0)) {\n return { path, reason: \"number must not be negative zero\" };\n }\n return undefined;\n case \"object\":\n if (value === null) {\n return undefined;\n }\n return findJsonObjectError(value, path, ancestors);\n case \"bigint\":\n case \"function\":\n case \"symbol\":\n case \"undefined\":\n return { path, reason: `${typeof value} is not JSON-compatible` };\n }\n}\n\nfunction createSchemaVersionFailure(\n code: SchemaVersionFailureCode,\n options: { readonly path: string },\n): SchemaVersionFailure {\n return {\n code,\n message:\n code === \"schema_version_missing\"\n ? `schemaVersion is required and must be ${CURRENT_SCHEMA_VERSION}`\n : `schemaVersion must be ${CURRENT_SCHEMA_VERSION}`,\n path: options.path,\n severity: \"error\",\n supportedVersions: SUPPORTED_SCHEMA_VERSIONS,\n };\n}\n\nfunction createDefinitionEnvelopeFailure(\n code: DefinitionEnvelopeShapeFailureCode,\n options: { readonly message?: string; readonly path: string },\n): DefinitionEnvelopeShapeFailure {\n return {\n code,\n message: options.message ?? getDefinitionEnvelopeFailureMessage(code),\n path: options.path,\n severity: \"error\",\n };\n}\n\nfunction getDefinitionEnvelopeFailureMessage(\n code: DefinitionEnvelopeShapeFailureCode,\n) {\n switch (code) {\n case \"definition_envelope_not_json\":\n return \"definition envelope must be portable JSON data\";\n case \"definition_envelope_not_object\":\n return \"definition envelope must be a JSON object\";\n case \"generator_type_missing\":\n return \"type is required\";\n case \"generator_type_invalid\":\n return \"type must be a non-empty string\";\n case \"configuration_missing\":\n return \"configuration is required\";\n case \"configuration_invalid\":\n return \"configuration must be a JSON object\";\n case \"name_invalid\":\n return \"name must be a string when present\";\n case \"description_invalid\":\n return \"description must be a string when present\";\n case \"top_level_property_unknown\":\n return \"unknown top-level properties are not allowed\";\n }\n}\n\nfunction findDefinitionEnvelopeStringFieldFailure(\n value: Record<string, unknown>,\n options: {\n readonly invalidCode: DefinitionEnvelopeShapeFailureCode;\n readonly path: string;\n readonly property: string;\n },\n): DefinitionEnvelopeShapeFailure | undefined {\n if (!Object.hasOwn(value, options.property)) {\n return undefined;\n }\n\n return typeof value[options.property] === \"string\"\n ? undefined\n : createDefinitionEnvelopeFailure(options.invalidCode, {\n path: options.path,\n });\n}\n\nfunction appendPathSegment(path: string, segment: string) {\n return path === \"$\" ? `$.${segment}` : `${path}.${segment}`;\n}\n\nfunction isJsonRecord(value: unknown): value is Record<string, unknown> {\n const prototype =\n typeof value === \"object\" && value !== null\n ? Object.getPrototypeOf(value)\n : undefined;\n\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n (prototype === null || prototype === Object.prototype)\n );\n}\n\nfunction findJsonObjectError(\n value: object,\n path: string,\n ancestors: Set<object>,\n): { path: string; reason: string } | undefined {\n if (ancestors.has(value)) {\n return { path, reason: \"cyclic objects are not JSON-compatible\" };\n }\n\n if (hasCallableToJson(value)) {\n return { path, reason: \"objects with toJSON behavior are not portable\" };\n }\n\n ancestors.add(value);\n const error = Array.isArray(value)\n ? findJsonArrayError(value, path, ancestors)\n : findJsonRecordError(value, path, ancestors);\n ancestors.delete(value);\n\n return error;\n}\n\nfunction hasCallableToJson(value: object) {\n return (\n \"toJSON\" in value &&\n typeof (value as { readonly toJSON?: unknown }).toJSON === \"function\"\n );\n}\n\nfunction findJsonArrayError(\n value: readonly unknown[],\n path: string,\n ancestors: Set<object>,\n): { path: string; reason: string } | undefined {\n const extraProperty = Object.keys(value).find((key) => !isArrayIndexKey(key));\n\n if (extraProperty !== undefined) {\n return {\n path: `${path}.${extraProperty}`,\n reason: \"array object properties would be omitted from JSON\",\n };\n }\n\n const ownPropertyError = findUnsupportedOwnProperty(value, path, [\"length\"]);\n\n if (ownPropertyError !== undefined) {\n return ownPropertyError;\n }\n\n for (let index = 0; index < value.length; index += 1) {\n if (!(index in value)) {\n return {\n path: `${path}[${index}]`,\n reason: \"sparse array slots are not JSON-compatible\",\n };\n }\n\n const itemError = findJsonValueErrorInternal(\n value[index],\n `${path}[${index}]`,\n ancestors,\n );\n\n if (itemError !== undefined) {\n return itemError;\n }\n }\n\n return undefined;\n}\n\nfunction isArrayIndexKey(key: string) {\n const index = Number(key);\n\n return (\n Number.isInteger(index) &&\n index >= 0 &&\n index < 2 ** 32 - 1 &&\n String(index) === key\n );\n}\n\nfunction findJsonRecordError(\n value: object,\n path: string,\n ancestors: Set<object>,\n): { path: string; reason: string } | undefined {\n const prototype = Object.getPrototypeOf(value);\n\n if (prototype !== null && prototype !== Object.prototype) {\n return { path, reason: \"object must be a plain JSON record\" };\n }\n\n const ownPropertyError = findUnsupportedOwnProperty(value, path);\n\n if (ownPropertyError !== undefined) {\n return ownPropertyError;\n }\n\n for (const key of Object.keys(value)) {\n const itemError = findJsonValueErrorInternal(\n (value as Record<string, unknown>)[key],\n `${path}.${key}`,\n ancestors,\n );\n\n if (itemError !== undefined) {\n return itemError;\n }\n }\n\n return undefined;\n}\n\nfunction findUnsupportedOwnProperty(\n value: object,\n path: string,\n allowedNonEnumerableProperties: readonly string[] = [],\n): { path: string; reason: string } | undefined {\n if (Object.getOwnPropertySymbols(value).length > 0) {\n return { path, reason: \"symbol keys are not JSON-compatible\" };\n }\n\n const allowedNonEnumerable = new Set(allowedNonEnumerableProperties);\n const descriptors = Object.getOwnPropertyDescriptors(value);\n\n for (const [key, descriptor] of Object.entries(descriptors)) {\n if (\"get\" in descriptor || \"set\" in descriptor) {\n return {\n path: `${path}.${key}`,\n reason: \"accessor properties are not portable JSON data\",\n };\n }\n\n if (!descriptor.enumerable && !allowedNonEnumerable.has(key)) {\n return {\n path: `${path}.${key}`,\n reason: \"non-enumerable properties would be omitted from JSON\",\n };\n }\n }\n\n return undefined;\n}\n"],"mappings":";AAUA,MAAa,yBAAyB;AAEtC,MAAa,4BAA4B,CAAA,CAAuB;AAgBhE,MAAa,qCAAqC;CAChD;CACA;CACA;CACA;CACA;AACF;AAoDA,IAAa,iBAAb,cAAoC,UAAU;CAC5C,YAAY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OAAO,KAAK,KAAK,GAAG;EACpC,MAAM,YAAY,2BACf,MAAkC,MACnC,GAAG,KAAK,GAAG,OACX,SACF;EAEA,IAAI,cAAc,KAAA,GAChB,OAAO;CAEX;AAGF;AAEA,SAAS,2BACP,OACA,MACA,iCAAoD,CAAC,GACP;CAC9C,IAAI,OAAO,sBAAsB,KAAK,CAAC,CAAC,SAAS,GAC/C,OAAO;EAAE;EAAM,QAAQ;CAAsC;CAG/D,MAAM,uBAAuB,IAAI,IAAI,8BAA8B;CACnE,MAAM,cAAc,OAAO,0BAA0B,KAAK;CAE1D,KAAK,MAAM,CAAC,KAAK,eAAe,OAAO,QAAQ,WAAW,GAAG;EAC3D,IAAI,SAAS,cAAc,SAAS,YAClC,OAAO;GACL,MAAM,GAAG,KAAK,GAAG;GACjB,QAAQ;EACV;EAGF,IAAI,CAAC,WAAW,cAAc,CAAC,qBAAqB,IAAI,GAAG,GACzD,OAAO;GACL,MAAM,GAAG,KAAK,GAAG;GACjB,QAAQ;EACV;CAEJ;AAGF"}
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "constructa-schema",
3
- "version": "0.0.1",
3
+ "version": "0.0.4",
4
4
  "description": "Portable schemas and types for Constructa generator definitions.",
5
5
  "private": false,
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Jack-WebDev/constructa.git",
10
+ "directory": "packages/schema"
11
+ },
7
12
  "type": "module",
8
13
  "files": [
9
14
  "dist"
@@ -17,15 +22,15 @@
17
22
  "default": "./dist/index.js"
18
23
  }
19
24
  },
20
- "scripts": {
21
- "build": "tsdown",
22
- "check-types": "tsc --noEmit"
23
- },
24
25
  "publishConfig": {
25
26
  "access": "public"
26
27
  },
27
28
  "devDependencies": {
28
- "@constructa/config": "workspace:*",
29
- "typescript": "catalog:"
29
+ "typescript": "^6.0.3",
30
+ "@constructa/config": "0.0.0"
31
+ },
32
+ "scripts": {
33
+ "build": "tsdown",
34
+ "check-types": "tsc --noEmit"
30
35
  }
31
- }
36
+ }