@zmdb/schema 1.0.0-beta.1

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.
Files changed (68) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +30 -0
  3. package/dist/custom-types/index.d.ts +41 -0
  4. package/dist/custom-types/index.d.ts.map +1 -0
  5. package/dist/custom-types/index.js +32 -0
  6. package/dist/custom-types/index.js.map +1 -0
  7. package/dist/derive/index.d.ts +122 -0
  8. package/dist/derive/index.d.ts.map +1 -0
  9. package/dist/derive/index.js +13 -0
  10. package/dist/derive/index.js.map +1 -0
  11. package/dist/derive/query.d.ts +62 -0
  12. package/dist/derive/query.d.ts.map +1 -0
  13. package/dist/derive/query.js +18 -0
  14. package/dist/derive/query.js.map +1 -0
  15. package/dist/dto/index.d.ts +224 -0
  16. package/dist/dto/index.d.ts.map +1 -0
  17. package/dist/dto/index.js +118 -0
  18. package/dist/dto/index.js.map +1 -0
  19. package/dist/entity-modeling/index.d.ts +12 -0
  20. package/dist/entity-modeling/index.d.ts.map +1 -0
  21. package/dist/entity-modeling/index.js +28 -0
  22. package/dist/entity-modeling/index.js.map +1 -0
  23. package/dist/index.d.ts +151 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +84 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/ir/index.d.ts +374 -0
  28. package/dist/ir/index.d.ts.map +1 -0
  29. package/dist/ir/index.js +735 -0
  30. package/dist/ir/index.js.map +1 -0
  31. package/dist/ir/validation-shape.d.ts +46 -0
  32. package/dist/ir/validation-shape.d.ts.map +1 -0
  33. package/dist/ir/validation-shape.js +130 -0
  34. package/dist/ir/validation-shape.js.map +1 -0
  35. package/dist/ir/vocabulary.d.ts +54 -0
  36. package/dist/ir/vocabulary.d.ts.map +1 -0
  37. package/dist/ir/vocabulary.js +51 -0
  38. package/dist/ir/vocabulary.js.map +1 -0
  39. package/dist/naming/index.d.ts +26 -0
  40. package/dist/naming/index.d.ts.map +1 -0
  41. package/dist/naming/index.js +147 -0
  42. package/dist/naming/index.js.map +1 -0
  43. package/dist/openapi/index.d.ts +57 -0
  44. package/dist/openapi/index.d.ts.map +1 -0
  45. package/dist/openapi/index.js +98 -0
  46. package/dist/openapi/index.js.map +1 -0
  47. package/dist/relations/index.d.ts +23 -0
  48. package/dist/relations/index.d.ts.map +1 -0
  49. package/dist/relations/index.js +98 -0
  50. package/dist/relations/index.js.map +1 -0
  51. package/dist/tags/index.d.ts +261 -0
  52. package/dist/tags/index.d.ts.map +1 -0
  53. package/dist/tags/index.js +64 -0
  54. package/dist/tags/index.js.map +1 -0
  55. package/package.json +82 -0
  56. package/src/custom-types/index.ts +59 -0
  57. package/src/derive/index.ts +224 -0
  58. package/src/derive/query.ts +128 -0
  59. package/src/dto/index.ts +395 -0
  60. package/src/entity-modeling/index.ts +33 -0
  61. package/src/index.ts +263 -0
  62. package/src/ir/index.ts +1085 -0
  63. package/src/ir/validation-shape.ts +145 -0
  64. package/src/ir/vocabulary.ts +56 -0
  65. package/src/naming/index.ts +159 -0
  66. package/src/openapi/index.ts +133 -0
  67. package/src/relations/index.ts +134 -0
  68. package/src/tags/index.ts +284 -0
@@ -0,0 +1,118 @@
1
+ import {} from '../derive/index.js';
2
+ import {} from '../index.js';
3
+ function base64Encode(str) {
4
+ if (globalThis.Buffer) {
5
+ return globalThis.Buffer.from(str, 'utf-8').toString('base64url');
6
+ }
7
+ if (globalThis.btoa) {
8
+ return globalThis.btoa(str).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
9
+ }
10
+ throw new Error('No base64 encoder available');
11
+ }
12
+ function base64Decode(str) {
13
+ if (globalThis.Buffer) {
14
+ return globalThis.Buffer.from(str, 'base64url').toString('utf-8');
15
+ }
16
+ if (globalThis.atob) {
17
+ let base64 = str.replace(/-/g, '+').replace(/_/g, '/');
18
+ while (base64.length % 4)
19
+ base64 += '=';
20
+ return globalThis.atob(base64);
21
+ }
22
+ throw new Error('No base64 decoder available');
23
+ }
24
+ export function encodeCursor(payload) {
25
+ return base64Encode(JSON.stringify(payload));
26
+ }
27
+ export function decodeCursor(cursor) {
28
+ if (typeof cursor !== 'string' || !cursor.trim()) {
29
+ throw new Error('Invalid cursor: must be a non-empty string');
30
+ }
31
+ try {
32
+ const json = base64Decode(cursor);
33
+ const parsed = JSON.parse(json);
34
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
35
+ throw new Error('Invalid cursor payload');
36
+ }
37
+ // boundary: JSON.parse returns unknown (untrusted client payload); runtime check above proves parsed is a non-null, non-array object.
38
+ return parsed;
39
+ }
40
+ catch (err) {
41
+ if (err instanceof Error && err.message.startsWith('Invalid cursor')) {
42
+ throw err;
43
+ }
44
+ throw new Error(`Invalid cursor format: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
45
+ }
46
+ }
47
+ export function project(row, cols) {
48
+ if (!cols)
49
+ return row;
50
+ // boundary: a `Pick` is built key-by-key, so it is only complete once the loop
51
+ // ends — there is no expression form that types a partially-filled mapped
52
+ // type. The loop below writes exactly `cols`, which is what `Pick<Row, K>`
53
+ // claims; `noUncheckedIndexedAccess` keeps the reads honest.
54
+ const out = {};
55
+ for (const c of cols)
56
+ out[c] = row[c];
57
+ return out;
58
+ }
59
+ /** Apply a Get's select projection to a fetched row. */
60
+ export function getResult(row, opts) {
61
+ return project(row, opts?.select);
62
+ }
63
+ export function buildListResult(rows, opts) {
64
+ const limit = opts?.limit;
65
+ const hasMore = typeof limit === 'number' && rows.length > limit;
66
+ const kept = hasMore ? rows.slice(0, limit) : rows;
67
+ const select = opts?.select;
68
+ const items = select ? kept.map(r => project(r, select)) : kept;
69
+ let computedCursor = opts?.cursor;
70
+ if (!computedCursor && hasMore && kept.length > 0) {
71
+ const lastRow = kept[kept.length - 1];
72
+ if (lastRow) {
73
+ const cursorObj = {};
74
+ const cols = opts?.orderBy ? [...opts.orderBy] : [];
75
+ if (opts?.pkColumn && !cols.some(c => String(c.column) === opts.pkColumn)) {
76
+ cols.push({ column: opts.pkColumn, dir: 'asc' });
77
+ }
78
+ for (const item of cols) {
79
+ if (!item)
80
+ continue;
81
+ const colStr = String(item.column);
82
+ if (colStr in lastRow) {
83
+ cursorObj[colStr] = lastRow[colStr];
84
+ }
85
+ }
86
+ if (Object.keys(cursorObj).length > 0) {
87
+ computedCursor = encodeCursor(cursorObj);
88
+ }
89
+ }
90
+ }
91
+ const result = {
92
+ items,
93
+ hasMore,
94
+ ...(computedCursor !== undefined ? { cursor: computedCursor } : {}),
95
+ };
96
+ return opts?.total !== undefined ? { ...result, total: opts.total } : result;
97
+ }
98
+ /** Ordered field list for an aggregate spec: group-key cols then computed keys. */
99
+ export function describeAggregate(spec) {
100
+ const keys = (spec.groupBy ?? []).map(k => String(k));
101
+ return [...keys, ...Object.keys(spec.computed)];
102
+ }
103
+ /** Assemble a SearchResult (reuses buildListResult; preserves _score on hits). */
104
+ export function buildSearchResult(rows, opts) {
105
+ const limit = opts?.limit;
106
+ const hasMore = typeof limit === 'number' && rows.length > limit;
107
+ const kept = hasMore ? rows.slice(0, limit) : rows;
108
+ const items = kept.map(hit => {
109
+ // `SearchHit<Row>` is `Row & {_score?}`, so it *is* a `Row` for projection
110
+ // purposes — no `hit as Row` needed once `project` is keyed on the argument.
111
+ const base = opts?.select ? project(hit, opts.select) : hit;
112
+ // preserve the ranking score on the projected hit
113
+ return hit._score !== undefined ? { ...base, _score: hit._score } : base;
114
+ });
115
+ const result = { items, hasMore };
116
+ return opts?.total !== undefined ? { ...result, total: opts.total } : result;
117
+ }
118
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAe,MAAM,aAAa,CAAC;AA4G1C,SAAS,YAAY,CAAC,GAAW;IAC/B,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;QACtB,OAAO,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AAG,IAAI,EAAE,KAAK,CAAC;IAC1B,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACjE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QAC3B,2EAA2E;QAC3E,6EAA6E;QAC7E,MAAM,IAAI,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAC5D,kDAAkD;QAClD,OAAO,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3E,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GAAqC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IACpE,OAAO,IAAI,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare function flattenEmbeddable(prefix: string, value: Record<string, unknown>): Record<string, unknown>;
2
+ export declare function liftEmbeddable(prefix: string, row: Record<string, unknown>): Record<string, unknown>;
3
+ export interface SingleTableInheritance {
4
+ discriminator: string;
5
+ map: Record<string, readonly string[]>;
6
+ }
7
+ export declare function discriminatorFor(_sti: SingleTableInheritance, type: string): string;
8
+ export declare function rowToSubtype(sti: SingleTableInheritance, row: Record<string, unknown>): {
9
+ type: string;
10
+ data: Record<string, unknown>;
11
+ };
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entity-modeling/index.ts"],"names":[],"mappings":"AACA,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzG;AACD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOpG;AAGD,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;CACxC;AACD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnF;AACD,wBAAgB,YAAY,CAC1B,GAAG,EAAE,sBAAsB,EAC3B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAMjD"}
@@ -0,0 +1,28 @@
1
+ // §2 embeddables
2
+ export function flattenEmbeddable(prefix, value) {
3
+ const out = {};
4
+ for (const [k, v] of Object.entries(value))
5
+ out[`${prefix}_${k}`] = v;
6
+ return out;
7
+ }
8
+ export function liftEmbeddable(prefix, row) {
9
+ const p = `${prefix}_`;
10
+ const out = {};
11
+ for (const [k, v] of Object.entries(row)) {
12
+ if (k.startsWith(p))
13
+ out[k.slice(p.length)] = v;
14
+ }
15
+ return out;
16
+ }
17
+ export function discriminatorFor(_sti, type) {
18
+ return type;
19
+ }
20
+ export function rowToSubtype(sti, row) {
21
+ const type = String(row[sti.discriminator]);
22
+ const cols = sti.map[type] ?? [];
23
+ const data = {};
24
+ for (const c of cols)
25
+ data[c] = row[c];
26
+ return { type, data };
27
+ }
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entity-modeling/index.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,KAA8B;IAC9E,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,CAAC,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,GAA4B;IACzE,MAAM,CAAC,GAAG,GAAG,MAAM,GAAG,CAAC;IACvB,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACzC,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAOD,MAAM,UAAU,gBAAgB,CAAC,IAA4B,EAAE,IAAY;IACzE,OAAO,IAAI,CAAC;AACd,CAAC;AACD,MAAM,UAAU,YAAY,CAC1B,GAA2B,EAC3B,GAA4B;IAE5B,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { type ExtensionType, type SchemaIR } from './ir/index.js';
2
+ export type SqlType = 'serial' | 'integer' | 'bigint' | 'numeric' | 'text' | 'varchar' | 'boolean' | 'timestamp' | 'json' | 'jsonEnum';
3
+ export interface ValidationRule {
4
+ readonly kind: string;
5
+ readonly value?: unknown;
6
+ readonly message?: string;
7
+ /**
8
+ * The argument list, for a rule that came from `@zmdb/validator`'s runtime `tags`.
9
+ *
10
+ * Declared rather than tolerated: `ir/index.ts`'s `ruleArgument` has always read it,
11
+ * and `openapi.spec.ts` has always passed one, so leaving it off the type meant the
12
+ * only two writers of this field disagreed with its declaration.
13
+ */
14
+ readonly args?: readonly unknown[];
15
+ }
16
+ export interface ColumnFlags {
17
+ readonly nullable: boolean;
18
+ readonly primaryKey?: boolean | undefined;
19
+ readonly unique?: boolean | undefined;
20
+ readonly autoIncrement?: boolean | undefined;
21
+ readonly hasDefault?: boolean | undefined;
22
+ readonly length?: number | undefined;
23
+ readonly enum?: readonly string[] | undefined;
24
+ readonly sensitive?: boolean | undefined;
25
+ }
26
+ export interface ColumnMeta {
27
+ readonly type: SqlType | ExtensionType;
28
+ readonly flags: ColumnFlags;
29
+ readonly default?: unknown;
30
+ readonly references?: {
31
+ readonly target: string;
32
+ };
33
+ readonly validation?: readonly ValidationRule[];
34
+ }
35
+ export type ColumnsMap = Readonly<Record<string, ColumnMeta>>;
36
+ /**
37
+ * A schema value: a table described in physical SQL names, for the code that runs.
38
+ *
39
+ * There is no type parameter for the column map, and its absence is the point. It used to
40
+ * carry the *literal* map so that `Entity<S>` could read property types out of it; every
41
+ * derivation now takes the declared type instead, so a literal map would be a parameter
42
+ * nothing reads. `table`, `columns`, `primaryKey` and the local side of `references` are
43
+ * in database vocabulary. The carried IR keeps declared names for derived types,
44
+ * validation, payloads and result aliases.
45
+ */
46
+ export interface CoreSchema<T extends string = string> {
47
+ readonly table: T;
48
+ readonly columns: ColumnsMap;
49
+ readonly primaryKey: readonly string[];
50
+ readonly references: readonly {
51
+ readonly column: string;
52
+ readonly target: string;
53
+ }[];
54
+ readonly ftsTable?: string | boolean | undefined;
55
+ /**
56
+ * The IR this value was built from, carried rather than recomputed.
57
+ *
58
+ * Required, and that is the point. `columns` is a lossy projection: a `ColumnMeta` has
59
+ * a `SqlType` and a flag map, and it has nowhere to put a json payload's shape, a
60
+ * constraint's arguments, or the difference between a column that is `integer + Serial`
61
+ * and one that is merely `integer`. There used to be an `irFromSchema` that guessed
62
+ * those back — four walkers over column metadata, each reconstructing what the
63
+ * declaration had already said, each with its own idea of the answer. Every one of them
64
+ * now reads this field, so the DDL, the validator, the JSON Schema and the seeder are
65
+ * looking at the same bytes.
66
+ *
67
+ * `schemaFromIR(schema.ir)` is `schema` (see `ir.spec.ts`), which is what makes the
68
+ * field safe to depend on: it holds everything the value does, so nothing has to choose
69
+ * between them.
70
+ */
71
+ readonly ir: SchemaIR;
72
+ }
73
+ declare const zmdbEntity: unique symbol;
74
+ /**
75
+ * A schema value that remembers the type it was generated from.
76
+ *
77
+ * The query compiler wants the table and the column types as data, so a tagged
78
+ * declaration still has to become a `CoreSchema` — but a `CoreSchema` has erased which
79
+ * type it came from, and a column map cannot be read back into one: it has a `SqlType`
80
+ * and a flag bag, and nowhere to put a json payload's shape. This phantom keeps the
81
+ * answer instead of reconstructing it. `schemaOf<User>()` is a `TaggedSchema<User>`, so
82
+ * anything holding the value can recover `User` and derive from the declaration.
83
+ *
84
+ * The slot is a `unique symbol` like every tag in `./tags`, and for the same reason:
85
+ * un-forgeable, and it erases, so no generated literal carries it at runtime. It is
86
+ * *required* rather than optional, which is what makes it inferrable: a function that
87
+ * wants the declared type asks for a `TaggedSchema<T>` and gets `T` from the argument,
88
+ * which is how `defineRepository`, `defineEntityStateMachine` and `findJoined` are
89
+ * parameterised on a declaration while still being handed a value.
90
+ */
91
+ export interface TaggedSchema<T> extends CoreSchema<string> {
92
+ readonly [zmdbEntity]: T;
93
+ }
94
+ /**
95
+ * The schema value for a tagged type, generated at build time.
96
+ *
97
+ * The only way to get one, and it declares nothing: `User` already says the table, the
98
+ * columns, the keys and the constraints, so this asks for that declaration as data.
99
+ * `@zmdb/compiler` replaces the call with a frozen literal — `schemaFromIR` applied
100
+ * to the IR it read off `T` — so the schema is written exactly once, in the type.
101
+ *
102
+ * ```ts
103
+ * const users = defineRepository(schemaOf<User>(), driver);
104
+ * ```
105
+ *
106
+ * There is no runtime implementation and cannot be one, for the same reason
107
+ * `toJsonSchema<T>()` has none: the answer is a function of a type argument, and type
108
+ * arguments do not survive to runtime. A build that did not run the transform gets an
109
+ * error saying so rather than a plausible-looking empty schema.
110
+ */
111
+ export declare function schemaOf<T>(): TaggedSchema<T>;
112
+ export { type CreateDTO, type DeclaredTable, type Entity, type PrimaryKeyOf, type ReadDTO, type UpdateDTO, } from './derive/index.js';
113
+ /**
114
+ * True for a non-null, non-array object.
115
+ *
116
+ * Lives here (the DAG root) because every downstream package needs the same
117
+ * proof before a keyed read: without it, reading `value[key]` off an `unknown`
118
+ * requires `as Record<string, unknown>`, and those casts are exactly what
119
+ * ARCHITECTURE §2.1 forbids on the public surface.
120
+ */
121
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
122
+ /**
123
+ * Invariant type equality. Stricter than mutual assignability: it distinguishes
124
+ * `any`/`unknown`/`never` and does not collapse optional vs `| undefined`.
125
+ */
126
+ export type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => (T extends B ? 1 : 2) ? true : false;
127
+ /** One-way assignability, for "at least this shape" assertions. */
128
+ export type Extends<A, B> = [A] extends [B] ? true : false;
129
+ /**
130
+ * Two-way assignability: each side accepts the other, differences in intersection
131
+ * spelling and union ordering included.
132
+ *
133
+ * This is the right tool for asserting what a derived type *means* when the columns
134
+ * are tagged. `Entity<User>['email']` is `string & Sql<'text'>`, not `string`, because
135
+ * a tag survives every derivation on purpose (that is how a projection or an aggregate
136
+ * still knows the column's SQL type). `Equal` sees two different types there and is
137
+ * correct to; `Mutual` sees that either can be used where the other is expected, which
138
+ * is the claim such a test is usually making. Pair it with `Equal<keyof A, keyof B>`
139
+ * when the key set and optionality matter too — assignability alone does not pin those.
140
+ */
141
+ export type Mutual<A, B> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
142
+ /** Assert a type-level predicate. `Expect<Equal<X, Y>>` fails to compile if X ≠ Y. */
143
+ export type Expect<T extends true> = T;
144
+ /** Negative form: `ExpectNot<Equal<X, Y>>` fails to compile if X = Y. */
145
+ export type ExpectNot<T extends false> = T;
146
+ export { resolveRelation } from './relations/index.js';
147
+ export { type ResolvedRelation } from './relations/index.js';
148
+ export { type Populated, type PopulatedEntity } from './derive/index.js';
149
+ export { type WhereDTO, type ListDTO, type ListResult, type OrderByDTO, type PaginationDTO } from './dto/index.js';
150
+ export { buildListResult } from './dto/index.js';
151
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAElE,MAAM,MAAM,OAAO,GACf,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,SAAS,GACT,MAAM,GACN,SAAS,GACT,SAAS,GACT,WAAW,GACX,MAAM,GACN,UAAU,CAAC;AAEf,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;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S,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAE3D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEtF,sFAAsF;AACtF,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;AAEvC,yEAAyE;AACzE,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC;AAM3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAMzE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACnH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,84 @@
1
+ // @zmdb/schema — the vocabulary a table is described in, and the derivations
2
+ // every other package reads off it.
3
+ //
4
+ // There is no builder DSL any more — `defineSchema`, the ten column builders and the
5
+ // eight function-style modifiers were deleted with the last of their callers, and
6
+ // `schemaOf<T>()` is what produces a schema value now. A table is declared once, as a
7
+ // type, in the tags of `./tags`; `@zmdb/compiler` reflects that declaration into a
8
+ // `SchemaIR` and `schemaFromIR` turns the IR into the value the query compiler reads. So
9
+ // what is left in this file is the *data model* — `SqlType`, `ColumnFlags`, `ColumnMeta`,
10
+ // `CoreSchema` — plus the derived-type family and the type-level assertion helpers.
11
+ //
12
+ // The derived types have one spelling each, and it takes the declared type. See the
13
+ // DTO suite below.
14
+ // The IR bindings below are types. With verbatimModuleSyntax, the named import
15
+ // clause remains an empty runtime import of the IR module.
16
+ import {} from './ir/index.js';
17
+ /**
18
+ * The schema value for a tagged type, generated at build time.
19
+ *
20
+ * The only way to get one, and it declares nothing: `User` already says the table, the
21
+ * columns, the keys and the constraints, so this asks for that declaration as data.
22
+ * `@zmdb/compiler` replaces the call with a frozen literal — `schemaFromIR` applied
23
+ * to the IR it read off `T` — so the schema is written exactly once, in the type.
24
+ *
25
+ * ```ts
26
+ * const users = defineRepository(schemaOf<User>(), driver);
27
+ * ```
28
+ *
29
+ * There is no runtime implementation and cannot be one, for the same reason
30
+ * `toJsonSchema<T>()` has none: the answer is a function of a type argument, and type
31
+ * arguments do not survive to runtime. A build that did not run the transform gets an
32
+ * error saying so rather than a plausible-looking empty schema.
33
+ */
34
+ export function schemaOf() {
35
+ throw new Error('schemaOf<T>() was not replaced at build time. It is compiled away by @zmdb/compiler ' +
36
+ '(the unplugin, Metro adapter, or project compiler), which did not run over this file — a type argument cannot ' +
37
+ 'be read at runtime, so there is nothing to fall back to.');
38
+ }
39
+ // ---------------------------------------------------------------------------
40
+ // The DTO suite (REQ-TF-4)
41
+ // ---------------------------------------------------------------------------
42
+ //
43
+ // Re-exported, not defined. `./derive` reads the declared type, and there is no second
44
+ // spelling any more: each of these used to have a column-map twin here, with every
45
+ // derivation choosing between them by asking `S extends TaggedSchema<infer T>`.
46
+ //
47
+ // Both halves of that had to go. The column-map walk could not answer some of the
48
+ // questions — a `json` column came out `unknown`, because a payload's shape is a type
49
+ // and a `ColumnMeta` has nowhere to put one — so the two branches did not merely differ
50
+ // in spelling, they differed in what they knew. And the dispatch meant every derivation
51
+ // asked a question about its argument before it could begin, which is the inversion this
52
+ // design exists to remove: the declaration is the source, and a value generated from it
53
+ // is downstream.
54
+ //
55
+ // What takes the place of the dispatch is inference, once, at the boundary where a value
56
+ // actually arrives: a function that is handed a generated schema declares the parameter
57
+ // `TaggedSchema<T>` and gets `T` from it (`defineRepository`, `findJoined`,
58
+ // `defineEntityStateMachine`, `repositoryToken`). Everything after that point is
59
+ // parameterised on the declared type. `schema-of.type-test.ts` pins the crossing.
60
+ export {} from './derive/index.js';
61
+ /**
62
+ * True for a non-null, non-array object.
63
+ *
64
+ * Lives here (the DAG root) because every downstream package needs the same
65
+ * proof before a keyed read: without it, reading `value[key]` off an `unknown`
66
+ * requires `as Record<string, unknown>`, and those casts are exactly what
67
+ * ARCHITECTURE §2.1 forbids on the public surface.
68
+ */
69
+ export function isRecord(value) {
70
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
71
+ }
72
+ // Relations: resolution and the two row helpers. `Populated`/`PopulatedEntity` come from
73
+ // `./derive`, which reads the relation off the declared type — there is no relations map to
74
+ // derive them from any more, and no `manyToOne`/`oneToMany`/`oneToOne`/`manyToMany` builder
75
+ // to write one with.
76
+ export { resolveRelation } from './relations/index.js';
77
+ export {} from './relations/index.js';
78
+ export {} from './derive/index.js';
79
+ // ---------------------------------------------------------------------------
80
+ // Entity State Machine & State Transition Helpers
81
+ // ---------------------------------------------------------------------------
82
+ export {} from './dto/index.js';
83
+ export { buildListResult } from './dto/index.js';
84
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,oCAAoC;AACpC,EAAE;AACF,qFAAqF;AACrF,kFAAkF;AAClF,sFAAsF;AACtF,mFAAmF;AACnF,yFAAyF;AACzF,0FAA0F;AAC1F,oFAAoF;AACpF,EAAE;AACF,oFAAoF;AACpF,mBAAmB;AAEnB,+EAA+E;AAC/E,2DAA2D;AAC3D,OAAO,EAAqC,MAAM,eAAe,CAAC;AA0HlE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,IAAI,KAAK,CACb,sFAAsF;QACpF,gHAAgH;QAChH,0DAA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