@adminiumjs/engine 0.2.2-rc.0 → 0.2.3
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/config-schema/envelope.d.ts +35 -2
- package/dist/config-schema/envelope.d.ts.map +1 -1
- package/dist/config-schema/envelope.js +38 -1
- package/dist/config-schema/envelope.js.map +1 -1
- package/dist/config-schema/index.d.ts +2 -1
- package/dist/config-schema/index.d.ts.map +1 -1
- package/dist/config-schema/index.js +6 -1
- package/dist/config-schema/index.js.map +1 -1
- package/dist/generate/archetype.d.ts +17 -0
- package/dist/generate/archetype.d.ts.map +1 -1
- package/dist/generate/archetype.js +8 -2
- package/dist/generate/archetype.js.map +1 -1
- package/dist/generate/crud.d.ts +12 -0
- package/dist/generate/crud.d.ts.map +1 -1
- package/dist/generate/crud.js +8 -1
- package/dist/generate/crud.js.map +1 -1
- package/dist/generate/index.d.ts +9 -0
- package/dist/generate/index.d.ts.map +1 -1
- package/dist/generate/index.js +57 -4
- package/dist/generate/index.js.map +1 -1
- package/dist/generate/recompose.d.ts.map +1 -1
- package/dist/generate/recompose.js +2 -1
- package/dist/generate/recompose.js.map +1 -1
- package/dist/ir-json-schema.d.ts +18 -0
- package/dist/ir-json-schema.d.ts.map +1 -0
- package/dist/ir-json-schema.js +65 -0
- package/dist/ir-json-schema.js.map +1 -0
- package/ir-v1.schema.json +1148 -0
- package/package.json +6 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Where the docs site serves this document (`apps/docs/src/pages/schemas/`). */
|
|
2
|
+
export declare const IR_SCHEMA_URL = "https://docs.adminium.dev/schemas/ir-v1.json";
|
|
3
|
+
/**
|
|
4
|
+
* The schema document, serialized exactly as `ir-v1.schema.json` holds it.
|
|
5
|
+
*
|
|
6
|
+
* `io: 'input'` is deliberate: the model defaults nearly everything, and an
|
|
7
|
+
* author needs to know what they MAY omit. The output schema would mark every
|
|
8
|
+
* defaulted field required and reject the minimal IR §2.3 promises works.
|
|
9
|
+
*
|
|
10
|
+
* `$schema` is added to the root as an allowed property. The generated document
|
|
11
|
+
* is `additionalProperties: false` throughout (every IR object is a Zod
|
|
12
|
+
* `strictObject`), so without this the very pointer that makes an editor
|
|
13
|
+
* validate the file would be the first thing the editor flagged.
|
|
14
|
+
* `schema-import`'s `parsers/json.ts` strips it on the way in for the same
|
|
15
|
+
* reason.
|
|
16
|
+
*/
|
|
17
|
+
export declare function irJsonSchemaDocument(): string;
|
|
18
|
+
//# sourceMappingURL=ir-json-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir-json-schema.d.ts","sourceRoot":"","sources":["../src/ir-json-schema.ts"],"names":[],"mappings":"AAkBA,iFAAiF;AACjF,eAAO,MAAM,aAAa,iDAAiD,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CA0C7C"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* The published JSON Schema for the IR — `docs.adminium.dev/schemas/ir-v1.json`.
|
|
4
|
+
*
|
|
5
|
+
* The JSON IR guide has told readers to point `$schema` at that URL since the
|
|
6
|
+
* page was written, and no such document was ever generated: the URL 404'd. A
|
|
7
|
+
* hand-written one would have drifted from the model within a release, so this
|
|
8
|
+
* derives it from `databaseModelSchema` — the same schema that validates every
|
|
9
|
+
* import.
|
|
10
|
+
*
|
|
11
|
+
* Lives in `src` rather than in the emitting script because both the script
|
|
12
|
+
* (via `dist`) and the drift test (via `src`) must produce byte-identical
|
|
13
|
+
* output; two copies would be the drift the artifact exists to prevent.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import { IR_VERSION, databaseModelSchema } from './schema-model.js';
|
|
17
|
+
/** Where the docs site serves this document (`apps/docs/src/pages/schemas/`). */
|
|
18
|
+
export const IR_SCHEMA_URL = 'https://docs.adminium.dev/schemas/ir-v1.json';
|
|
19
|
+
/**
|
|
20
|
+
* The schema document, serialized exactly as `ir-v1.schema.json` holds it.
|
|
21
|
+
*
|
|
22
|
+
* `io: 'input'` is deliberate: the model defaults nearly everything, and an
|
|
23
|
+
* author needs to know what they MAY omit. The output schema would mark every
|
|
24
|
+
* defaulted field required and reject the minimal IR §2.3 promises works.
|
|
25
|
+
*
|
|
26
|
+
* `$schema` is added to the root as an allowed property. The generated document
|
|
27
|
+
* is `additionalProperties: false` throughout (every IR object is a Zod
|
|
28
|
+
* `strictObject`), so without this the very pointer that makes an editor
|
|
29
|
+
* validate the file would be the first thing the editor flagged.
|
|
30
|
+
* `schema-import`'s `parsers/json.ts` strips it on the way in for the same
|
|
31
|
+
* reason.
|
|
32
|
+
*/
|
|
33
|
+
export function irJsonSchemaDocument() {
|
|
34
|
+
const generated = z.toJSONSchema(databaseModelSchema, { io: 'input' });
|
|
35
|
+
// `introspectedAt` defaults to `new Date().toISOString()`, so the raw output
|
|
36
|
+
// embeds the moment of generation and the artifact differs from itself on
|
|
37
|
+
// every run — a `--check` gate that fails on a clean tree teaches people to
|
|
38
|
+
// ignore it. The default is not expressible as a constant anyway: it means
|
|
39
|
+
// "when this was imported", which is what the description now says.
|
|
40
|
+
const introspectedAt = generated.properties?.introspectedAt;
|
|
41
|
+
if (introspectedAt !== undefined) {
|
|
42
|
+
const stable = { ...introspectedAt };
|
|
43
|
+
delete stable.default;
|
|
44
|
+
generated.properties.introspectedAt = {
|
|
45
|
+
...stable,
|
|
46
|
+
description: 'ISO 8601. Defaults to the moment of import when omitted.',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return `${JSON.stringify({
|
|
50
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
51
|
+
$id: IR_SCHEMA_URL,
|
|
52
|
+
title: `Adminium schema IR v${String(IR_VERSION)}`,
|
|
53
|
+
description: 'The intermediate representation every Adminium schema import converges on. ' +
|
|
54
|
+
'Generated from packages/engine/src/schema-model.ts — do not edit by hand.',
|
|
55
|
+
...generated,
|
|
56
|
+
properties: {
|
|
57
|
+
$schema: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Optional pointer to this schema. Adminium ignores it on import.',
|
|
60
|
+
},
|
|
61
|
+
...generated.properties,
|
|
62
|
+
},
|
|
63
|
+
}, null, 2)}\n`;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=ir-json-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir-json-schema.js","sourceRoot":"","sources":["../src/ir-json-schema.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,iFAAiF;AACjF,MAAM,CAAC,MAAM,aAAa,GAAG,8CAA8C,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,SAAS,GAAG,CAAC,CAAC,YAAY,CAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAGpE,CAAC;IAEF,6EAA6E;IAC7E,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,oEAAoE;IACpE,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,EAAE,cAEhC,CAAC;IACd,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,CAAC;QACrC,OAAO,MAAM,CAAC,OAAO,CAAC;QACrB,SAAS,CAAC,UAAsC,CAAC,cAAc,GAAG;YACjE,GAAG,MAAM;YACT,WAAW,EAAE,0DAA0D;SACxE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,SAAS,CACtB;QACE,OAAO,EAAE,8CAA8C;QACvD,GAAG,EAAE,aAAa;QAClB,KAAK,EAAE,uBAAuB,MAAM,CAAC,UAAU,CAAC,EAAE;QAClD,WAAW,EACT,6EAA6E;YAC7E,2EAA2E;QAC7E,GAAG,SAAS;QACZ,UAAU,EAAE;YACV,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iEAAiE;aAC/E;YACD,GAAG,SAAS,CAAC,UAAU;SACxB;KACF,EACD,IAAI,EACJ,CAAC,CACF,IAAI,CAAC;AACR,CAAC"}
|