@sequenceholdings/orm 2.1.0 → 2.2.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.
Files changed (77) hide show
  1. package/README.md +40 -1
  2. package/dist/authoring.cjs +1619 -121
  3. package/dist/authoring.cjs.map +1 -1
  4. package/dist/authoring.d.cts +252 -8
  5. package/dist/authoring.d.ts +252 -8
  6. package/dist/authoring.js +1607 -123
  7. package/dist/authoring.js.map +1 -1
  8. package/dist/canonical.cjs +713 -41
  9. package/dist/canonical.cjs.map +1 -1
  10. package/dist/canonical.d.cts +1520 -51
  11. package/dist/canonical.d.ts +1520 -51
  12. package/dist/canonical.js +693 -42
  13. package/dist/canonical.js.map +1 -1
  14. package/dist/cli.cjs +7103 -3901
  15. package/dist/cli.cjs.map +1 -1
  16. package/dist/cli.js +7104 -3902
  17. package/dist/cli.js.map +1 -1
  18. package/dist/client.cjs +122 -40
  19. package/dist/client.cjs.map +1 -1
  20. package/dist/client.d.cts +85 -25
  21. package/dist/client.d.ts +85 -25
  22. package/dist/client.js +119 -41
  23. package/dist/client.js.map +1 -1
  24. package/dist/compiler.cjs +2464 -450
  25. package/dist/compiler.cjs.map +1 -1
  26. package/dist/compiler.d.cts +79 -4
  27. package/dist/compiler.d.ts +79 -4
  28. package/dist/compiler.js +2457 -451
  29. package/dist/compiler.js.map +1 -1
  30. package/dist/constants-C6EG6Wq7.d.cts +99 -0
  31. package/dist/constants-C6EG6Wq7.d.ts +99 -0
  32. package/dist/definition-DjfC7Lll.d.cts +91 -0
  33. package/dist/definition-DjfC7Lll.d.ts +91 -0
  34. package/dist/dynamic-input.cjs +2 -1
  35. package/dist/dynamic-input.cjs.map +1 -1
  36. package/dist/dynamic-input.d.cts +9 -1
  37. package/dist/dynamic-input.d.ts +9 -1
  38. package/dist/dynamic-input.js +2 -1
  39. package/dist/dynamic-input.js.map +1 -1
  40. package/dist/index.cjs +2656 -418
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +693 -116
  43. package/dist/index.d.ts +693 -116
  44. package/dist/index.js +2622 -420
  45. package/dist/index.js.map +1 -1
  46. package/dist/ir.cjs +811 -48
  47. package/dist/ir.cjs.map +1 -1
  48. package/dist/ir.d.cts +670 -27
  49. package/dist/ir.d.ts +670 -27
  50. package/dist/ir.js +802 -49
  51. package/dist/ir.js.map +1 -1
  52. package/dist/{naming-DCn94LJ4.d.ts → naming-CPfx7EfF.d.ts} +14 -1
  53. package/dist/{naming-DPglwzkB.d.cts → naming-CU9ThP_E.d.cts} +14 -1
  54. package/dist/policy-1iZbGnZZ.d.cts +24 -0
  55. package/dist/policy-1iZbGnZZ.d.ts +24 -0
  56. package/dist/predicate-v2.cjs +804 -51
  57. package/dist/predicate-v2.cjs.map +1 -1
  58. package/dist/predicate-v2.d.cts +2 -1
  59. package/dist/predicate-v2.d.ts +2 -1
  60. package/dist/predicate-v2.js +804 -51
  61. package/dist/predicate-v2.js.map +1 -1
  62. package/dist/sdl.cjs +1014 -75
  63. package/dist/sdl.cjs.map +1 -1
  64. package/dist/sdl.d.cts +14 -3
  65. package/dist/sdl.d.ts +14 -3
  66. package/dist/sdl.js +1012 -76
  67. package/dist/sdl.js.map +1 -1
  68. package/package.json +13 -7
  69. package/src/codegen-gql/server-fns.cjs +2 -2
  70. package/templates/orm-namespace/AGENTS.md +10 -0
  71. package/templates/orm-namespace/CLAUDE.md +1 -82
  72. package/templates/orm-namespace/codegen.preset.d.cts +7 -0
  73. package/templates/orm-namespace/codegen.ts +2 -1
  74. package/templates/orm-namespace/graphql/example/queries.ts +4 -3
  75. package/templates/orm-namespace/package.json +2 -1
  76. package/templates/orm-namespace/schema/tables.ts +3 -2
  77. package/templates/orm-namespace/sequence.config.ts +7 -11
package/README.md CHANGED
@@ -16,7 +16,7 @@ branch on a namespace or product identity. See
16
16
  Install the CLI and SDK together:
17
17
 
18
18
  ```bash
19
- pnpm add -g @sequenceholdings/studio-cli@0.1.35 @sequenceholdings/orm@2.1.0
19
+ pnpm add -g @sequenceholdings/studio-cli@0.3.0 @sequenceholdings/orm@2.1.1
20
20
  ```
21
21
 
22
22
  Create a namespace project:
@@ -46,6 +46,29 @@ canonical metadata, snapshots, documents, and migration statements.
46
46
  Commit generated outputs and migrations with the
47
47
  source that produced them.
48
48
 
49
+ Owned `defineTable` contracts support named `checks` and referential actions
50
+ on enforced `toOne` links or composite `foreignKeys`:
51
+
52
+ ```ts
53
+ const reports = defineTable('reports', {
54
+ id: t.uuid().primaryKey(),
55
+ status: t.text().notNull(),
56
+ }, {
57
+ checks: [{ name: 'reports_status_check', expression: "status IN ('draft', 'active')" }],
58
+ })
59
+
60
+ const runs = defineTable('runs', {
61
+ id: t.uuid().primaryKey(),
62
+ reportId: t.uuid().notNull(),
63
+ }, {
64
+ links: { report: toOne(reports, { on: 'reportId', enforce: true, onDelete: 'cascade' }) },
65
+ })
66
+ ```
67
+
68
+ Check expressions use a validated subset of PostgreSQL predicates. See
69
+ [database constraints](../../../docs/platform/orm-v2.md#database-integrity-constraints)
70
+ for the supported operators, actions, migration behavior, and limitations.
71
+
49
72
  Use `apply --dry-run` to rehearse a migration against a disposable copy of the
50
73
  target environment's data. `apply --no-create` refuses to provision a missing
51
74
  namespace, which is useful for deployment checks.
@@ -115,3 +138,19 @@ This client rollout switch does not bypass server feature flags or authorization
115
138
  - `@sequenceholdings/orm/drizzle` — supported Drizzle helpers for views
116
139
  - `@sequenceholdings/orm/codegen` — GraphQL Code Generator preset used by a
117
140
  scaffolded namespace
141
+
142
+ The `@sequenceholdings/orm/client` entry point contains the persisted-operation
143
+ executor and error types without importing compiler, migration, Node builtins,
144
+ or third-party runtime dependencies. It is safe to bundle into browser and
145
+ function applications. The Managed Functions SDK bundles this entry point so
146
+ deployed functions do not install ORM's authoring dependencies.
147
+
148
+ Use `createArtifactOrmExecutor` from `@sequenceholdings/artifact-studio` inside
149
+ an authenticated Artifact, and `createFunctionOrmExecutor` from
150
+ `@sequenceholdings/managed-functions/orm` inside a Managed Function. Both accept
151
+ the generated JSON manifest and preserve the caller's governed data access.
152
+ For a function invocation with no human caller (a Lattice step), use
153
+ `createFunctionServiceOrmExecutor`, which acts as the function's attached
154
+ service account. The host adapters supply authentication; they do not grant namespace access or
155
+ register operations. Do not extract CLI credentials or invent a browser token
156
+ provider to wire a generated client.