@sequenceholdings/orm 2.10.0 → 2.11.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 +74 -4
- package/dist/authoring.cjs +796 -7
- package/dist/authoring.cjs.map +1 -1
- package/dist/authoring.d.cts +10 -1
- package/dist/authoring.d.ts +10 -1
- package/dist/authoring.js +796 -7
- package/dist/authoring.js.map +1 -1
- package/dist/canonical.cjs +777 -6
- package/dist/canonical.cjs.map +1 -1
- package/dist/canonical.js +777 -6
- package/dist/canonical.js.map +1 -1
- package/dist/cli.cjs +7697 -7686
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +7698 -7687
- package/dist/cli.js.map +1 -1
- package/dist/client.cjs +5 -10
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -13
- package/dist/client.d.ts +2 -13
- package/dist/client.js +6 -10
- package/dist/client.js.map +1 -1
- package/dist/compiler.cjs +815 -100
- package/dist/compiler.cjs.map +1 -1
- package/dist/compiler.d.cts +5 -16
- package/dist/compiler.d.ts +5 -16
- package/dist/compiler.js +817 -99
- package/dist/compiler.js.map +1 -1
- package/dist/index.cjs +3611 -3287
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +577 -7
- package/dist/index.d.ts +577 -7
- package/dist/index.js +3600 -3285
- package/dist/index.js.map +1 -1
- package/dist/ir.cjs +784 -18
- package/dist/ir.cjs.map +1 -1
- package/dist/ir.d.cts +3 -6
- package/dist/ir.d.ts +3 -6
- package/dist/ir.js +784 -18
- package/dist/ir.js.map +1 -1
- package/dist/predicate-v2.cjs +796 -31
- package/dist/predicate-v2.cjs.map +1 -1
- package/dist/predicate-v2.js +796 -31
- package/dist/predicate-v2.js.map +1 -1
- package/dist/sdl.cjs +790 -28
- package/dist/sdl.cjs.map +1 -1
- package/dist/sdl.d.cts +1 -5
- package/dist/sdl.d.ts +1 -5
- package/dist/sdl.js +790 -28
- package/dist/sdl.js.map +1 -1
- package/package.json +1 -1
- package/src/codegen-gql/server-fns.cjs +1 -1
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ Every writer affecting the invariant must participate in the revision protocol.
|
|
|
109
109
|
Guarded operations use **IR v2**; older runtimes reject them. Upgrade the host
|
|
110
110
|
compiler and executor together before registering guarded documents, regenerate
|
|
111
111
|
SDL with the matching SDK, and only then activate consumers. Existing unguarded
|
|
112
|
-
operations keep their IR v1
|
|
112
|
+
operations keep their IR v1 execution semantics. This source addition requires
|
|
113
113
|
a matching SDK release and host rollout; it is not a claim that the published
|
|
114
114
|
Preview version already supports it.
|
|
115
115
|
|
|
@@ -134,8 +134,7 @@ variables file. Input failures do not submit the operation or retry a mutation.
|
|
|
134
134
|
|
|
135
135
|
Execute posts the persistent operation name and expected query/mutation kind to
|
|
136
136
|
Atlas's `/api/data/v2` endpoint. Version 2 `operations.manifest.json` files contain
|
|
137
|
-
names, kinds, and gates without schema or operation hashes.
|
|
138
|
-
accept legacy version 1 manifests. The platform resolves the name against the
|
|
137
|
+
names, kinds, and gates without schema or operation hashes. The compiler emits version 2 manifests. The platform resolves the name against the
|
|
139
138
|
active namespace contract. `seq-studio orm execute <namespace> <operation>` runs
|
|
140
139
|
the deployed operation by name without a checkout.
|
|
141
140
|
|
|
@@ -170,6 +169,77 @@ the declaration with casts or edits to generated canonical JSON. ORM releases
|
|
|
170
169
|
use the separate [Studio CLI chain release workflow](https://github.com/sequenceholdings/studio/blob/main/.changeset/README.md#studio-cli-chain-releases);
|
|
171
170
|
chain packages do not use Changesets.
|
|
172
171
|
|
|
172
|
+
## Synced table indexes (introduced in 2.11.0)
|
|
173
|
+
|
|
174
|
+
A typed synced table can declare non-unique secondary btree indexes with the
|
|
175
|
+
same `IndexInput` shape `defineTable` uses. The sync still owns the relation's
|
|
176
|
+
columns, keys and rows; the ORM owns only these indexes.
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
export const links = defineSyncedTable("synced_customer_transaction_links", {
|
|
180
|
+
memberCustomerUid: t.text(), transactionUid: t.text(), postDate: t.date(),
|
|
181
|
+
relationshipManagerId: t.text(),
|
|
182
|
+
}, {
|
|
183
|
+
source: "gold.customer_transaction_links_current",
|
|
184
|
+
primaryKey: ["memberCustomerUid", "transactionUid"],
|
|
185
|
+
policies: { read: "true" },
|
|
186
|
+
indexes: [
|
|
187
|
+
{ columns: ["postDate", "transactionUid"], name: "ix_ctl_post_date_txn" },
|
|
188
|
+
{ columns: ["relationshipManagerId", "postDate", "transactionUid"], name: "ix_ctl_rm_post_date_txn" },
|
|
189
|
+
],
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- Only typed synced tables (declared columns) can declare indexes. Every index
|
|
194
|
+
column must be declared. `unique: true` is rejected: the primary key already
|
|
195
|
+
identifies a row, and a unique index can fail the sync.
|
|
196
|
+
- Names follow `defineTable`: explicit, or `ix_<table>_<columns>`. They must fit
|
|
197
|
+
Postgres's 63-byte limit and be unique in the namespace. The index lives in
|
|
198
|
+
the physical relation's schema (for example `gold`), not `orm_<namespace>`.
|
|
199
|
+
- Indexes are part of the canonical form and content hash. Adding, changing or
|
|
200
|
+
removing one produces a new committed migration whose snapshot records them
|
|
201
|
+
under `_sequenceOrm.syncedIndexes`. Its SQL has no statements for them,
|
|
202
|
+
because the physical relation is bound per environment.
|
|
203
|
+
- Apply resolves each synced table's backing, the relation the serving stage
|
|
204
|
+
bound (not `source`). If the index name is free, it runs `CREATE INDEX` on that
|
|
205
|
+
relation and, in the same transaction, records the new index's OID in the
|
|
206
|
+
namespace's ledger, `orm_<namespace>._synced_index_ledger`. It drops removed or
|
|
207
|
+
changed indexes with a guarded `DROP INDEX IF EXISTS`, from the relation they
|
|
208
|
+
were on before a rebind, and deletes their ledger rows. Then it verifies each
|
|
209
|
+
index is the recorded, valid, non-unique btree on that relation with the
|
|
210
|
+
declared keys. Apply re-asserts them every time and is idempotent.
|
|
211
|
+
- **Ownership:** an index is the ORM's only while a ledger row for this
|
|
212
|
+
namespace's table and relation records its current OID. Apply never drops,
|
|
213
|
+
replaces or adopts any other index: a same-named index the sync built (even a
|
|
214
|
+
unique one), another namespace's index on a shared backing, or one someone
|
|
215
|
+
dropped and recreated under the name (it has a new OID). Apply fails with
|
|
216
|
+
SQLSTATE `55000` instead; rename the declared index. A ledger row whose index
|
|
217
|
+
vanished (the pipeline recreated the table) counts as not built, so the next
|
|
218
|
+
apply or reconcile builds and records it again.
|
|
219
|
+
- The index is created on the partitioned parent (never `ON ONLY`), so every
|
|
220
|
+
current partition and every partition a SNAPSHOT sync later attaches gets one.
|
|
221
|
+
- **Locking:** a partitioned parent cannot build `CONCURRENTLY`. The build holds
|
|
222
|
+
a `SHARE` lock that blocks the sync's writes until it finishes. Apply on a
|
|
223
|
+
large table between sync runs.
|
|
224
|
+
- **Privileges:** on Lakebase the applying identity can `CREATE INDEX` and
|
|
225
|
+
`DROP INDEX` on the sync's relation without owning it; the index belongs to
|
|
226
|
+
the relation's owner, so nothing that needs index ownership (`COMMENT ON
|
|
227
|
+
INDEX`, `ALTER INDEX`, `REINDEX`) is ever emitted. Each statement starts as
|
|
228
|
+
the applier, switches with `set_config('role', <schema owner>, true)` only to
|
|
229
|
+
read or write the ledger, and switches back before any index DDL. The ledger
|
|
230
|
+
lives in the namespace schema, belongs to its owner (`orm_exec`), and grants
|
|
231
|
+
consumers nothing; drizzle-kit convergence ignores it.
|
|
232
|
+
- **Drift:** if a pipeline drops and recreates the synced table, the indexes go
|
|
233
|
+
with it. `pendingSyncedIndexStatements` reports the missing ones, and any
|
|
234
|
+
index the ledger does not record. It reads the ledger as the schema owner in
|
|
235
|
+
one transaction, so pass a drizzle database that supports `transaction`. Atlas checks
|
|
236
|
+
them in rehearsal, reports them on `GET /api/orm/namespaces/<ns>/synced-indexes`,
|
|
237
|
+
and restores them on `POST` with `{ "expected_version_id": "<active version>" }`
|
|
238
|
+
(namespace admin) or on the next schema apply.
|
|
239
|
+
- `orm apply` requires a runtime that advertises `syncedIndexes` on
|
|
240
|
+
`/api/orm/runtime-capabilities`. Reviewed (controlled) and frozen namespaces
|
|
241
|
+
refuse synced indexes. v1 YAML synced tables still cannot declare indexes.
|
|
242
|
+
|
|
173
243
|
## Default read-only SQL (introduced in 2.6.0)
|
|
174
244
|
|
|
175
245
|
With the matching SDK and Atlas rollout, every active v2 namespace supports
|
|
@@ -295,7 +365,7 @@ ORM 2.7.0 and downstream Artifact Studio 0.10.0, Managed Functions 0.4.4, Pipeli
|
|
|
295
365
|
|
|
296
366
|
Discover object-specific `GetCustomer`, `ListCustomers`, `CreateCustomer`,
|
|
297
367
|
`UpdateCustomer`, and `DeleteCustomer` contracts through the ORM catalog, then
|
|
298
|
-
execute their
|
|
368
|
+
execute their names through the existing Data API. Read-only objects
|
|
299
369
|
expose reads; writes retain the existing schema and policy requirements.
|
|
300
370
|
Authored operations with matching names take precedence. No default count or
|
|
301
371
|
link-traversal operation is added. TypeScript wrappers remain deferred.
|