@sequenceholdings/orm 2.0.0 → 2.1.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.
- package/README.md +94 -2
- package/dist/authoring.cjs +1474 -54
- package/dist/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +242 -4
- package/dist/authoring.d.ts +242 -4
- package/dist/authoring.js +1465 -56
- package/dist/authoring.js.map +1 -1
- package/dist/canonical.cjs +740 -42
- package/dist/canonical.cjs.map +1 -1
- package/dist/canonical.d.cts +742 -53
- package/dist/canonical.d.ts +742 -53
- package/dist/canonical.js +724 -43
- package/dist/canonical.js.map +1 -1
- package/dist/cli.cjs +2478 -328
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2480 -330
- package/dist/cli.js.map +1 -1
- package/dist/client.cjs +90 -25
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +39 -22
- package/dist/client.d.ts +39 -22
- package/dist/client.js +87 -26
- package/dist/client.js.map +1 -1
- package/dist/compiler.cjs +1755 -329
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +56 -3
- package/dist/compiler.d.ts +56 -3
- package/dist/compiler.js +1756 -330
- package/dist/compiler.js.map +1 -1
- package/dist/constants-YoFGjIBM.d.cts +99 -0
- package/dist/constants-YoFGjIBM.d.ts +99 -0
- package/dist/dynamic-input.d.cts +1 -0
- package/dist/dynamic-input.d.ts +1 -0
- package/dist/index.cjs +1973 -164
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +474 -100
- package/dist/index.d.ts +474 -100
- package/dist/index.js +1940 -167
- package/dist/index.js.map +1 -1
- package/dist/ir.cjs +869 -46
- package/dist/ir.cjs.map +1 -1
- package/dist/ir.d.cts +699 -25
- package/dist/ir.d.ts +699 -25
- package/dist/ir.js +861 -47
- package/dist/ir.js.map +1 -1
- package/dist/{naming-CTvWSRTf.d.ts → naming-CPfx7EfF.d.ts} +28 -1
- package/dist/{naming-DRyinU4u.d.cts → naming-CU9ThP_E.d.cts} +28 -1
- package/dist/policy-1iZbGnZZ.d.cts +24 -0
- package/dist/policy-1iZbGnZZ.d.ts +24 -0
- package/dist/predicate-v2.cjs +852 -49
- package/dist/predicate-v2.cjs.map +1 -1
- package/dist/predicate-v2.d.cts +2 -1
- package/dist/predicate-v2.d.ts +2 -1
- package/dist/predicate-v2.js +852 -49
- package/dist/predicate-v2.js.map +1 -1
- package/dist/sdl.cjs +1309 -58
- package/dist/sdl.cjs.map +1 -1
- package/dist/sdl.d.cts +7 -3
- package/dist/sdl.d.ts +7 -3
- package/dist/sdl.js +1305 -59
- package/dist/sdl.js.map +1 -1
- package/package.json +11 -6
- package/templates/orm-namespace/CLAUDE.md +6 -4
- package/templates/orm-namespace/codegen.preset.d.cts +7 -0
- package/templates/orm-namespace/codegen.ts +2 -1
- package/templates/orm-namespace/graphql/example/queries.ts +4 -3
- package/templates/orm-namespace/package.json +2 -1
- package/templates/orm-namespace/schema/tables.ts +3 -2
- package/templates/orm-namespace/sequence.config.ts +7 -11
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** Shared grammar for namespace identifiers; never interpolate arbitrary paths. */
|
|
2
|
+
declare const NAMESPACE_PATTERN: RegExp;
|
|
3
|
+
/** Caller-scoped delegated data credential, supplied by an authenticated host. */
|
|
4
|
+
declare const ORM_DATA_TOKEN_HEADER = "x-sequence-data-token";
|
|
5
|
+
/** Separate service-identity credential; never used as an implicit fallback. */
|
|
6
|
+
declare const ORM_SERVICE_DATA_TOKEN_HEADER = "x-sequence-data-token-service";
|
|
7
|
+
declare const IDENTIFIER_PATTERN: RegExp;
|
|
8
|
+
/** Native source columns may have one leading underscore; relation names may not. */
|
|
9
|
+
declare const COLUMN_IDENTIFIER_PATTERN: RegExp;
|
|
10
|
+
declare const MAX_IDENTIFIER_LENGTH = 63;
|
|
11
|
+
/**
|
|
12
|
+
* Custom Roles & Capabilities claim keys as policies reference them: a
|
|
13
|
+
* host-scoped registry key, an org pin's `org/<key>`, or an Application
|
|
14
|
+
* capability pin's `app/<application-id>/<key>`. Matches the registry
|
|
15
|
+
* key grammar EXACTLY (`[a-z0-9-]`, 1–64 chars, no `_` — the FGA object-id
|
|
16
|
+
* delimiter) so any capability that's declarable/attachable in namespace.yaml
|
|
17
|
+
* can also be referenced here — a stricter pattern would let a valid key
|
|
18
|
+
* register yet fail at apply (e.g. `org/2fa`, a one-char or digit-led key).
|
|
19
|
+
*/
|
|
20
|
+
declare const CAPABILITY_KEY_PATTERN: RegExp;
|
|
21
|
+
declare const CLAIM_KEY_PATTERN: RegExp;
|
|
22
|
+
/** Qualified reference to a table outside the defining file: `<schema>.<table>`. */
|
|
23
|
+
declare const QUALIFIED_TABLE_PATTERN: RegExp;
|
|
24
|
+
/** Synced reflected sources are restricted to the gold layer. */
|
|
25
|
+
declare const SYNCED_SOURCE_PATTERN: RegExp;
|
|
26
|
+
declare const ORM_SCHEMA_PREFIX = "orm_";
|
|
27
|
+
declare const CONSUMER_ROLE_SUFFIX = "_consumer";
|
|
28
|
+
declare const ormSchemaName: (namespace: string) => string;
|
|
29
|
+
declare const consumerRoleName: (namespace: string) => string;
|
|
30
|
+
declare const DEFINITION_FILE_EXTENSIONS: readonly [".yml", ".yaml"];
|
|
31
|
+
/** Reserved basenames for the namespace-level config file (description, org capability pins). */
|
|
32
|
+
declare const NAMESPACE_CONFIG_FILENAMES: Set<string>;
|
|
33
|
+
declare const HASH_DOMAIN = "sequence-orm-definitions\0";
|
|
34
|
+
/**
|
|
35
|
+
* A per-file byte cap where the loader reads untrusted YAML into memory — a real failure mode, not a product
|
|
36
|
+
* limit. Counts of tables/indexes/params and policy/SQL lengths are
|
|
37
|
+
* deliberately uncapped; Postgres enforces its own limits loudly at apply.
|
|
38
|
+
*/
|
|
39
|
+
declare const MAX_DEFINITION_FILE_BYTES: number;
|
|
40
|
+
/** Generated SDL aggregates every table/view; it is not an individual source file. */
|
|
41
|
+
declare const MAX_GENERATED_SDL_BYTES: number;
|
|
42
|
+
/** Registration and reviewed exports carry SDL, canonical metadata, snapshots and migrations. */
|
|
43
|
+
declare const ORM_REGISTRATION_MAX_BYTES: number;
|
|
44
|
+
/** `/api/data/<ns>/actions/…` and `/api/data/<ns>/query` share the table path segment. */
|
|
45
|
+
declare const RESERVED_TABLE_NAMES: Set<string>;
|
|
46
|
+
/**
|
|
47
|
+
* The Data API's query-string grammar owns these parameter names — a column
|
|
48
|
+
* with one of them could never be filtered over the wire, so definitions
|
|
49
|
+
* refuse it up front ("validate rejects only what can never work").
|
|
50
|
+
*/
|
|
51
|
+
declare const RESERVED_COLUMN_NAMES: Set<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Per-cell metadata (`cellMetadata: true`, and every resolved-table source) is
|
|
54
|
+
* stored as typed system columns beside each tracked column `c`:
|
|
55
|
+
*
|
|
56
|
+
* - `c__at` timestamptz — when the cell was last written (NULL: never / no opinion)
|
|
57
|
+
* - `c__by` text — who wrote it
|
|
58
|
+
* - `c__rev` uuid — a resolved table's manual source only: the edit's
|
|
59
|
+
* identity, so an async writeback confirmation clears
|
|
60
|
+
* only the exact edit it delivered
|
|
61
|
+
*
|
|
62
|
+
* A resolved view additionally exposes, per resolved column, the winner's
|
|
63
|
+
* `c__src` (source name) and `c__lost` (newer candidates that lost, jsonb).
|
|
64
|
+
* None of these are GraphQL columns: they surface through the typed `cells`
|
|
65
|
+
* object and are never client-writable.
|
|
66
|
+
*/
|
|
67
|
+
declare const CELL_PARTS: readonly ["at", "by", "rev", "source", "conflicts"];
|
|
68
|
+
type CellPart = (typeof CELL_PARTS)[number];
|
|
69
|
+
declare const CELL_PART_SUFFIX: Readonly<Record<CellPart, string>>;
|
|
70
|
+
/** Longest physical column name that can carry cell parts (63 minus the longest suffix). */
|
|
71
|
+
declare const MAX_TRACKED_COLUMN_NAME: number;
|
|
72
|
+
/** GraphQL field carrying a row's per-cell metadata object. */
|
|
73
|
+
declare const CELLS_FIELD = "cells";
|
|
74
|
+
/** Physical (and logical) name of one cell part of a column. */
|
|
75
|
+
declare function cellColumnName(column: string, part: CellPart): string;
|
|
76
|
+
/**
|
|
77
|
+
* Actor recorded when the data plane computes a materialized resolved table's
|
|
78
|
+
* rows for every caller. Its claims are what the compute view's synced
|
|
79
|
+
* sources see (materialized ETL sources must be readable by anyone).
|
|
80
|
+
*/
|
|
81
|
+
declare const MATERIALIZE_ACTOR = "orm:materialize";
|
|
82
|
+
declare const MATERIALIZE_CLAIMS_JSON: string;
|
|
83
|
+
/**
|
|
84
|
+
* Apply-generated function that reconciles a materialized resolved table with
|
|
85
|
+
* its compute view: `SELECT * FROM orm_<ns>."<table>__refresh"(wait)` returns
|
|
86
|
+
* `(upserted, deleted, locked)`; without `wait` it skips when another refresh
|
|
87
|
+
* holds the table's lock. The one refresh implementation — the Atlas
|
|
88
|
+
* reconcile, the post-ETL hook, and an operator in psql all call it.
|
|
89
|
+
*/
|
|
90
|
+
declare function materializedRefreshFunctionName(table: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* Advisory-lock key serializing a materialized table's refreshes (hashed with
|
|
93
|
+
* `hashtext`). A full refresh holds it exclusively and every ORM write's
|
|
94
|
+
* per-row refresh holds it shared, both before reading the compute view — so
|
|
95
|
+
* a full refresh never reads a snapshot older than a write it then overwrites.
|
|
96
|
+
*/
|
|
97
|
+
declare function materializeLockKey(schema: string, table: string): string;
|
|
98
|
+
|
|
99
|
+
export { CELLS_FIELD as C, DEFINITION_FILE_EXTENSIONS as D, HASH_DOMAIN as H, IDENTIFIER_PATTERN as I, MATERIALIZE_ACTOR as M, NAMESPACE_PATTERN as N, ORM_DATA_TOKEN_HEADER as O, QUALIFIED_TABLE_PATTERN as Q, RESERVED_COLUMN_NAMES as R, SYNCED_SOURCE_PATTERN as S, CELL_PARTS as a, type CellPart as b, cellColumnName as c, ORM_SERVICE_DATA_TOKEN_HEADER as d, CAPABILITY_KEY_PATTERN as e, CELL_PART_SUFFIX as f, CLAIM_KEY_PATTERN as g, COLUMN_IDENTIFIER_PATTERN as h, CONSUMER_ROLE_SUFFIX as i, MATERIALIZE_CLAIMS_JSON as j, MAX_DEFINITION_FILE_BYTES as k, MAX_GENERATED_SDL_BYTES as l, MAX_IDENTIFIER_LENGTH as m, MAX_TRACKED_COLUMN_NAME as n, NAMESPACE_CONFIG_FILENAMES as o, ORM_REGISTRATION_MAX_BYTES as p, ORM_SCHEMA_PREFIX as q, RESERVED_TABLE_NAMES as r, consumerRoleName as s, materializeLockKey as t, materializedRefreshFunctionName as u, ormSchemaName as v };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** Shared grammar for namespace identifiers; never interpolate arbitrary paths. */
|
|
2
|
+
declare const NAMESPACE_PATTERN: RegExp;
|
|
3
|
+
/** Caller-scoped delegated data credential, supplied by an authenticated host. */
|
|
4
|
+
declare const ORM_DATA_TOKEN_HEADER = "x-sequence-data-token";
|
|
5
|
+
/** Separate service-identity credential; never used as an implicit fallback. */
|
|
6
|
+
declare const ORM_SERVICE_DATA_TOKEN_HEADER = "x-sequence-data-token-service";
|
|
7
|
+
declare const IDENTIFIER_PATTERN: RegExp;
|
|
8
|
+
/** Native source columns may have one leading underscore; relation names may not. */
|
|
9
|
+
declare const COLUMN_IDENTIFIER_PATTERN: RegExp;
|
|
10
|
+
declare const MAX_IDENTIFIER_LENGTH = 63;
|
|
11
|
+
/**
|
|
12
|
+
* Custom Roles & Capabilities claim keys as policies reference them: a
|
|
13
|
+
* host-scoped registry key, an org pin's `org/<key>`, or an Application
|
|
14
|
+
* capability pin's `app/<application-id>/<key>`. Matches the registry
|
|
15
|
+
* key grammar EXACTLY (`[a-z0-9-]`, 1–64 chars, no `_` — the FGA object-id
|
|
16
|
+
* delimiter) so any capability that's declarable/attachable in namespace.yaml
|
|
17
|
+
* can also be referenced here — a stricter pattern would let a valid key
|
|
18
|
+
* register yet fail at apply (e.g. `org/2fa`, a one-char or digit-led key).
|
|
19
|
+
*/
|
|
20
|
+
declare const CAPABILITY_KEY_PATTERN: RegExp;
|
|
21
|
+
declare const CLAIM_KEY_PATTERN: RegExp;
|
|
22
|
+
/** Qualified reference to a table outside the defining file: `<schema>.<table>`. */
|
|
23
|
+
declare const QUALIFIED_TABLE_PATTERN: RegExp;
|
|
24
|
+
/** Synced reflected sources are restricted to the gold layer. */
|
|
25
|
+
declare const SYNCED_SOURCE_PATTERN: RegExp;
|
|
26
|
+
declare const ORM_SCHEMA_PREFIX = "orm_";
|
|
27
|
+
declare const CONSUMER_ROLE_SUFFIX = "_consumer";
|
|
28
|
+
declare const ormSchemaName: (namespace: string) => string;
|
|
29
|
+
declare const consumerRoleName: (namespace: string) => string;
|
|
30
|
+
declare const DEFINITION_FILE_EXTENSIONS: readonly [".yml", ".yaml"];
|
|
31
|
+
/** Reserved basenames for the namespace-level config file (description, org capability pins). */
|
|
32
|
+
declare const NAMESPACE_CONFIG_FILENAMES: Set<string>;
|
|
33
|
+
declare const HASH_DOMAIN = "sequence-orm-definitions\0";
|
|
34
|
+
/**
|
|
35
|
+
* A per-file byte cap where the loader reads untrusted YAML into memory — a real failure mode, not a product
|
|
36
|
+
* limit. Counts of tables/indexes/params and policy/SQL lengths are
|
|
37
|
+
* deliberately uncapped; Postgres enforces its own limits loudly at apply.
|
|
38
|
+
*/
|
|
39
|
+
declare const MAX_DEFINITION_FILE_BYTES: number;
|
|
40
|
+
/** Generated SDL aggregates every table/view; it is not an individual source file. */
|
|
41
|
+
declare const MAX_GENERATED_SDL_BYTES: number;
|
|
42
|
+
/** Registration and reviewed exports carry SDL, canonical metadata, snapshots and migrations. */
|
|
43
|
+
declare const ORM_REGISTRATION_MAX_BYTES: number;
|
|
44
|
+
/** `/api/data/<ns>/actions/…` and `/api/data/<ns>/query` share the table path segment. */
|
|
45
|
+
declare const RESERVED_TABLE_NAMES: Set<string>;
|
|
46
|
+
/**
|
|
47
|
+
* The Data API's query-string grammar owns these parameter names — a column
|
|
48
|
+
* with one of them could never be filtered over the wire, so definitions
|
|
49
|
+
* refuse it up front ("validate rejects only what can never work").
|
|
50
|
+
*/
|
|
51
|
+
declare const RESERVED_COLUMN_NAMES: Set<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Per-cell metadata (`cellMetadata: true`, and every resolved-table source) is
|
|
54
|
+
* stored as typed system columns beside each tracked column `c`:
|
|
55
|
+
*
|
|
56
|
+
* - `c__at` timestamptz — when the cell was last written (NULL: never / no opinion)
|
|
57
|
+
* - `c__by` text — who wrote it
|
|
58
|
+
* - `c__rev` uuid — a resolved table's manual source only: the edit's
|
|
59
|
+
* identity, so an async writeback confirmation clears
|
|
60
|
+
* only the exact edit it delivered
|
|
61
|
+
*
|
|
62
|
+
* A resolved view additionally exposes, per resolved column, the winner's
|
|
63
|
+
* `c__src` (source name) and `c__lost` (newer candidates that lost, jsonb).
|
|
64
|
+
* None of these are GraphQL columns: they surface through the typed `cells`
|
|
65
|
+
* object and are never client-writable.
|
|
66
|
+
*/
|
|
67
|
+
declare const CELL_PARTS: readonly ["at", "by", "rev", "source", "conflicts"];
|
|
68
|
+
type CellPart = (typeof CELL_PARTS)[number];
|
|
69
|
+
declare const CELL_PART_SUFFIX: Readonly<Record<CellPart, string>>;
|
|
70
|
+
/** Longest physical column name that can carry cell parts (63 minus the longest suffix). */
|
|
71
|
+
declare const MAX_TRACKED_COLUMN_NAME: number;
|
|
72
|
+
/** GraphQL field carrying a row's per-cell metadata object. */
|
|
73
|
+
declare const CELLS_FIELD = "cells";
|
|
74
|
+
/** Physical (and logical) name of one cell part of a column. */
|
|
75
|
+
declare function cellColumnName(column: string, part: CellPart): string;
|
|
76
|
+
/**
|
|
77
|
+
* Actor recorded when the data plane computes a materialized resolved table's
|
|
78
|
+
* rows for every caller. Its claims are what the compute view's synced
|
|
79
|
+
* sources see (materialized ETL sources must be readable by anyone).
|
|
80
|
+
*/
|
|
81
|
+
declare const MATERIALIZE_ACTOR = "orm:materialize";
|
|
82
|
+
declare const MATERIALIZE_CLAIMS_JSON: string;
|
|
83
|
+
/**
|
|
84
|
+
* Apply-generated function that reconciles a materialized resolved table with
|
|
85
|
+
* its compute view: `SELECT * FROM orm_<ns>."<table>__refresh"(wait)` returns
|
|
86
|
+
* `(upserted, deleted, locked)`; without `wait` it skips when another refresh
|
|
87
|
+
* holds the table's lock. The one refresh implementation — the Atlas
|
|
88
|
+
* reconcile, the post-ETL hook, and an operator in psql all call it.
|
|
89
|
+
*/
|
|
90
|
+
declare function materializedRefreshFunctionName(table: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* Advisory-lock key serializing a materialized table's refreshes (hashed with
|
|
93
|
+
* `hashtext`). A full refresh holds it exclusively and every ORM write's
|
|
94
|
+
* per-row refresh holds it shared, both before reading the compute view — so
|
|
95
|
+
* a full refresh never reads a snapshot older than a write it then overwrites.
|
|
96
|
+
*/
|
|
97
|
+
declare function materializeLockKey(schema: string, table: string): string;
|
|
98
|
+
|
|
99
|
+
export { CELLS_FIELD as C, DEFINITION_FILE_EXTENSIONS as D, HASH_DOMAIN as H, IDENTIFIER_PATTERN as I, MATERIALIZE_ACTOR as M, NAMESPACE_PATTERN as N, ORM_DATA_TOKEN_HEADER as O, QUALIFIED_TABLE_PATTERN as Q, RESERVED_COLUMN_NAMES as R, SYNCED_SOURCE_PATTERN as S, CELL_PARTS as a, type CellPart as b, cellColumnName as c, ORM_SERVICE_DATA_TOKEN_HEADER as d, CAPABILITY_KEY_PATTERN as e, CELL_PART_SUFFIX as f, CLAIM_KEY_PATTERN as g, COLUMN_IDENTIFIER_PATTERN as h, CONSUMER_ROLE_SUFFIX as i, MATERIALIZE_CLAIMS_JSON as j, MAX_DEFINITION_FILE_BYTES as k, MAX_GENERATED_SDL_BYTES as l, MAX_IDENTIFIER_LENGTH as m, MAX_TRACKED_COLUMN_NAME as n, NAMESPACE_CONFIG_FILENAMES as o, ORM_REGISTRATION_MAX_BYTES as p, ORM_SCHEMA_PREFIX as q, RESERVED_TABLE_NAMES as r, consumerRoleName as s, materializeLockKey as t, materializedRefreshFunctionName as u, ormSchemaName as v };
|
package/dist/dynamic-input.d.cts
CHANGED