@sequenceholdings/orm 0.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -24
- package/dist/authoring.cjs +1072 -60
- package/dist/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +291 -26
- package/dist/authoring.d.ts +291 -26
- package/dist/authoring.js +1062 -61
- package/dist/authoring.js.map +1 -1
- package/dist/canonical.cjs +415 -9
- package/dist/canonical.cjs.map +1 -1
- package/dist/canonical.d.cts +235 -1
- package/dist/canonical.d.ts +235 -1
- package/dist/canonical.js +411 -10
- package/dist/canonical.js.map +1 -1
- package/dist/cli.cjs +1860 -228
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1861 -229
- package/dist/cli.js.map +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js.map +1 -1
- package/dist/compiler.cjs +512 -54
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +39 -231
- package/dist/compiler.d.ts +39 -231
- package/dist/compiler.js +510 -55
- package/dist/compiler.js.map +1 -1
- package/dist/drizzle.cjs +14 -0
- package/dist/drizzle.cjs.map +1 -0
- package/dist/drizzle.d.cts +1 -0
- package/dist/drizzle.d.ts +1 -0
- package/dist/drizzle.js +3 -0
- package/dist/drizzle.js.map +1 -0
- package/dist/dynamic-input.cjs +391 -0
- package/dist/dynamic-input.cjs.map +1 -0
- package/dist/dynamic-input.d.cts +111 -0
- package/dist/dynamic-input.d.ts +111 -0
- package/dist/dynamic-input.js +380 -0
- package/dist/dynamic-input.js.map +1 -0
- package/dist/index.cjs +2229 -220
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -9
- package/dist/index.d.ts +125 -9
- package/dist/index.js +2205 -221
- package/dist/index.js.map +1 -1
- package/dist/ir.cjs +249 -14
- package/dist/ir.cjs.map +1 -1
- package/dist/ir.d.cts +20 -80
- package/dist/ir.d.ts +20 -80
- package/dist/ir.js +249 -14
- package/dist/ir.js.map +1 -1
- package/dist/predicate-v2.cjs +1099 -0
- package/dist/predicate-v2.cjs.map +1 -0
- package/dist/predicate-v2.d.cts +142 -0
- package/dist/predicate-v2.d.ts +142 -0
- package/dist/predicate-v2.js +1089 -0
- package/dist/predicate-v2.js.map +1 -0
- package/dist/sdl.cjs +344 -55
- package/dist/sdl.cjs.map +1 -1
- package/dist/sdl.d.cts +1 -3
- package/dist/sdl.d.ts +1 -3
- package/dist/sdl.js +344 -55
- package/dist/sdl.js.map +1 -1
- package/package.json +20 -3
- package/src/codegen-gql/preset.cjs +64 -0
- package/src/codegen-gql/server-fns.cjs +11 -6
- package/templates/orm-namespace/CLAUDE.md +6 -5
- package/templates/orm-namespace/codegen.preset.cjs +17 -0
- package/templates/orm-namespace/codegen.ts +1 -1
- package/templates/orm-namespace/package.json +3 -0
- package/templates/orm-namespace/schema/tables.ts +1 -1
- package/templates/orm-namespace/sequence.config.ts +1 -1
package/README.md
CHANGED
|
@@ -1,37 +1,62 @@
|
|
|
1
1
|
# @sequenceholdings/orm
|
|
2
2
|
|
|
3
|
-
Sequence ORM
|
|
3
|
+
Sequence ORM v2 is a Preview SDK for TypeScript-defined governed data
|
|
4
|
+
namespaces. You define tables, policies, and named GraphQL operations in source
|
|
5
|
+
control; the platform compiles them into persisted operations and enforces the
|
|
6
|
+
caller's access on every execution.
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
## Install
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
Install the CLI and SDK together:
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- `compiler/` — predicate AST and identifier/literal helpers → SQL fragments for policies and claims
|
|
13
|
-
- `engine/` — namespace definitions → ordered migration plans (`hint` / `ddl` / `security` / `function`) plus drizzle-kit snapshots for the registry. Each declared action compiles to a `SECURITY INVOKER` Postgres function (`orm_<ns>.action_<name>`) created at apply, so the invoke path is a single `SELECT`; writes never run as client-rewritten statements. Apply also `PREPARE`s each executes statement so Postgres validates its columns/types (plpgsql function bodies defer that to first invoke), failing the apply on a bad reference. `executes` may be one statement or an ordered list (run atomically); `returns:` makes the function `RETURNS TABLE(...)` and hands back the RETURNING rows.
|
|
14
|
-
- `loader.ts` — a namespace directory of `*.yaml` files → validated `NamespaceDefinition`
|
|
15
|
-
- `hash.ts` — canonical content hash (key-order-insensitive) used for content-addressed registry versions
|
|
16
|
-
- `client/` (`@sequenceholdings/orm/client`) — typed Data API client; fetch-only, no node builtins. `createOrmClient` acts as the caller (session bearer, or a managed function's delegated user token — the default); `createServiceOrmClient` is the loudly-named escalation that acts as the platform service account attached to the function (its manifest's top-level `service_account`). See the `sequence-orm` skill → "two consumer modes".
|
|
17
|
-
- `codegen/` — derives the client's wire types from the definitions; `apply` refreshes `types.gen.ts` on every successful run (there is no separate `generate` command — one verb owns the loop)
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add -g @sequenceholdings/studio-cli@0.1.27 @sequenceholdings/orm@2.0.0
|
|
14
|
+
```
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
Create a namespace project:
|
|
20
17
|
|
|
18
|
+
```bash
|
|
19
|
+
seq-studio orm init lending
|
|
20
|
+
cd lending
|
|
21
|
+
pnpm install
|
|
21
22
|
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
|
|
24
|
+
## Everyday workflow
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Edit sequence.config.ts, schema/*.ts, and graphql/**/*.ts.
|
|
28
|
+
seq-studio orm generate .
|
|
29
|
+
seq-studio orm validate .
|
|
30
|
+
seq-studio orm plan . -e <environment-name>
|
|
31
|
+
seq-studio orm apply . -e <environment-name>
|
|
27
32
|
```
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
`generate` writes `schema.graphql`, `operations.manifest.json`, cache policies,
|
|
35
|
+
and typed consumer modules. Commit generated outputs and migrations with the
|
|
36
|
+
source that produced them.
|
|
37
|
+
|
|
38
|
+
Use `apply --dry-run` to rehearse a migration against a disposable copy of the
|
|
39
|
+
target environment's data. `apply --no-create` refuses to provision a missing
|
|
40
|
+
namespace, which is useful for deployment checks.
|
|
41
|
+
|
|
42
|
+
## Execute persisted operations
|
|
43
|
+
|
|
44
|
+
Operations execute by their generated manifest name, never by sending GraphQL
|
|
45
|
+
text or SQL:
|
|
33
46
|
|
|
34
47
|
```bash
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
seq-studio orm execute GetOpenDeals . \
|
|
49
|
+
--variables-file variables.json \
|
|
50
|
+
-e <environment-name>
|
|
37
51
|
```
|
|
52
|
+
|
|
53
|
+
`variables.json` must contain a JSON object. The platform validates variables,
|
|
54
|
+
operation requirements, and row policies as the signed-in caller.
|
|
55
|
+
|
|
56
|
+
## Public exports
|
|
57
|
+
|
|
58
|
+
- `@sequenceholdings/orm/authoring` — namespace, table, policy, and view DSL
|
|
59
|
+
- `@sequenceholdings/orm/client` — persisted-operation client utilities
|
|
60
|
+
- `@sequenceholdings/orm/drizzle` — supported Drizzle helpers for views
|
|
61
|
+
- `@sequenceholdings/orm/codegen` — GraphQL Code Generator preset used by a
|
|
62
|
+
scaffolded namespace
|