@voltro/database 0.83.1 → 0.85.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/dist/sql.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- import { ConfigError } from 'effect';
1
+ import { Config } from 'effect';
2
+ import { Connection } from 'effect/sql/SqlConnection';
2
3
  import { Effect } from 'effect';
3
- import { Fragment } from '@effect/sql/Statement';
4
+ import { Fragment } from 'effect/sql/Statement';
4
5
  import { Layer } from 'effect';
5
6
  import { Schema } from 'effect';
6
- import { SqlClient } from '@effect/sql';
7
- import { SqlError } from '@effect/sql/SqlError';
8
- import { SqlError as SqlError_2 } from '@effect/sql';
9
- import { Statement } from '@effect/sql';
7
+ import { SqlClient } from 'effect/sql';
8
+ import { SqlError } from 'effect/sql/SqlError';
9
+ import { SqlError as SqlError_2 } from 'effect/sql';
10
+ import { Statement } from 'effect/sql';
10
11
 
11
12
  /** Every hash this source may have been recorded under: its own, and the body
12
13
  * before each framework edit in {@link FRAMEWORK_MIGRATION_EDITS}. */
@@ -719,6 +720,10 @@ export declare const chunkTables: <T>(xs: ReadonlyArray<T>, n: number) => T[][];
719
720
  */
720
721
  export declare const classifyRollingDeploySafety: (op: MigrationOperation, context?: RollingDeployContext) => RollingDeploySafety;
721
722
 
723
+ /** Explicit finalization removes verified retained artifacts, never the receipt.
724
+ * Finalizing a published conversion permanently closes its rollback window. */
725
+ export declare const cleanupSqliteDecimalPublication: (sql: SqlClient.SqlClient, request: SqliteRetainedSourceRequest, target: TableSnapshot, triggers?: ReadonlyArray<SqliteDecimalTargetTrigger>) => Effect.Effect<void, SqlError>;
726
+
722
727
  /**
723
728
  * Every resume-ledger row, gone — for a caller that has just UNDONE the run
724
729
  * the rows describe. A ledger that outlives the work it recorded would make
@@ -805,7 +810,8 @@ declare interface ColumnDefinition<TsType, Type extends ColumnType = ColumnType,
805
810
  */
806
811
  readonly fkAutoIndex?: boolean;
807
812
  /**
808
- * This id-shaped scalar names something outside the local relational graph.
813
+ * This id-shaped scalar deliberately has no single foreign key target,
814
+ * including external-system ids and local polymorphic targets.
809
815
  * Set by `.externalId()` so schema audits do not guess a local FK from the
810
816
  * column name. Metadata only; it emits no constraint or DDL.
811
817
  */
@@ -964,6 +970,14 @@ declare interface ColumnDefinition<TsType, Type extends ColumnType = ColumnType,
964
970
  * column is just `bytes` with server-merge semantics.
965
971
  */
966
972
  readonly crdtManaged?: boolean;
973
+ /**
974
+ * End-to-end-sealed CRDT marker, set by `crdtSealed()`. The column holds an
975
+ * append-only LOG of encrypted CRDT updates the server cannot read: the
976
+ * write path appends an incoming frame (or applies a client's snapshot
977
+ * frame) and never decodes or merges — clients holding the key do. Same
978
+ * `bytes` storage and zero DDL churn as `crdtManaged`.
979
+ */
980
+ readonly crdtSealed?: boolean;
967
981
  /**
968
982
  * Optimistic-concurrency marker, set by `.version()`.
969
983
  *
@@ -1021,6 +1035,7 @@ declare interface ColumnDefinition<TsType, Type extends ColumnType = ColumnType,
1021
1035
  * MUST be `<= precision`. See {@link ColumnDefinition.precision}.
1022
1036
  */
1023
1037
  readonly scale?: number;
1038
+ /* Excluded from this release type: sqliteDecimalEncoding */
1024
1039
  /**
1025
1040
  * Vector dimensionality. Populated only when `type === 'vector'`.
1026
1041
  * The migration emitter uses it to size the column DDL —
@@ -1227,7 +1242,8 @@ declare interface ColumnDefinition_2<TsType, Type extends ColumnType_2 = ColumnT
1227
1242
  */
1228
1243
  readonly fkAutoIndex?: boolean;
1229
1244
  /**
1230
- * This id-shaped scalar names something outside the local relational graph.
1245
+ * This id-shaped scalar deliberately has no single foreign key target,
1246
+ * including external-system ids and local polymorphic targets.
1231
1247
  * Set by `.externalId()` so schema audits do not guess a local FK from the
1232
1248
  * column name. Metadata only; it emits no constraint or DDL.
1233
1249
  */
@@ -1386,6 +1402,14 @@ declare interface ColumnDefinition_2<TsType, Type extends ColumnType_2 = ColumnT
1386
1402
  * column is just `bytes` with server-merge semantics.
1387
1403
  */
1388
1404
  readonly crdtManaged?: boolean;
1405
+ /**
1406
+ * End-to-end-sealed CRDT marker, set by `crdtSealed()`. The column holds an
1407
+ * append-only LOG of encrypted CRDT updates the server cannot read: the
1408
+ * write path appends an incoming frame (or applies a client's snapshot
1409
+ * frame) and never decodes or merges — clients holding the key do. Same
1410
+ * `bytes` storage and zero DDL churn as `crdtManaged`.
1411
+ */
1412
+ readonly crdtSealed?: boolean;
1389
1413
  /**
1390
1414
  * Optimistic-concurrency marker, set by `.version()`.
1391
1415
  *
@@ -1443,6 +1467,7 @@ declare interface ColumnDefinition_2<TsType, Type extends ColumnType_2 = ColumnT
1443
1467
  * MUST be `<= precision`. See {@link ColumnDefinition.precision}.
1444
1468
  */
1445
1469
  readonly scale?: number;
1470
+ /* Excluded from this release type: sqliteDecimalEncoding */
1446
1471
  /**
1447
1472
  * Vector dimensionality. Populated only when `type === 'vector'`.
1448
1473
  * The migration emitter uses it to size the column DDL —
@@ -1703,6 +1728,10 @@ export declare interface ColumnSnapshot {
1703
1728
  */
1704
1729
  readonly precision?: number;
1705
1730
  readonly scale?: number;
1731
+ /** Physical SQLite-family exact-decimal representation. Absent on ordinary
1732
+ * NUMERIC columns. The marker is observable schema state, not a DSL hint:
1733
+ * changing it requires data conversion, never a plain SQL type cast. */
1734
+ readonly sqliteDecimalEncoding?: 'sortable-v1';
1706
1735
  /**
1707
1736
  * Id-generation scheme for `type: 'id'` columns. Mirrors
1708
1737
  * `ColumnDefinition.idScheme.kind` so the applier can tell a numeric
@@ -2549,7 +2578,7 @@ declare type DialectId = 'postgres' | 'mysql' | 'mariadb' | 'mssql' | 'sqlite' |
2549
2578
  * Resolve the live dialect from the `SqlClient`.
2550
2579
  *
2551
2580
  * `sql.onDialectOrElse` collapses the six voltro dialects onto four driver
2552
- * tokens: mysql+mariadb share `mysql` (one `@effect/sql-mysql2` client) and
2581
+ * tokens: mysql+mariadb share `mysql` (one `effect/sql-mysql2` client) and
2553
2582
  * sqlite+turso share `sqlite`. That collapse is fine for every consumer here —
2554
2583
  * the paired dialects behave identically for everything this module decides.
2555
2584
  *
@@ -3116,7 +3145,7 @@ export declare interface FileMigration {
3116
3145
  export declare interface FileMigrationContext {
3117
3146
  /**
3118
3147
  * The escape hatch, and it asks for a reason. `raw('why')` returns the
3119
- * `@effect/sql` client — `sql.unsafe(...)`, `sql\`...\``,
3148
+ * `effect/sql` client — `sql.unsafe(...)`, `sql\`...\``,
3120
3149
  * `sql.onDialectOrElse({...})` — for the one thing neither `store` nor
3121
3150
  * `schema` expresses. The reason is required (an empty one throws), it is
3122
3151
  * what `voltro doctor` lists beside every migration that reaches for raw
@@ -3315,6 +3344,12 @@ export declare const fingerprintSchema: (snapshot: SchemaSnapshot) => string;
3315
3344
 
3316
3345
  export declare const fnv1a64: (input: string) => bigint;
3317
3346
 
3347
+ /** Read identities and decimal observations before driver numeric conversion.
3348
+ * Keys include storage type: text/blob use full hex (including NUL); numeric
3349
+ * keys use the engine's SQL literal. Duplicate selected keys refuse conversion.
3350
+ * This reads only; its caller owns exclusion and retained-artifact verification. */
3351
+ export declare const forEachSqliteDecimalSourcePage: <E, R>(connection: Pick<Connection, "executeUnprepared">, retained: string, keys: ReadonlyArray<string>, columns: ReadonlyArray<SqliteDecimalSourceColumn>, visit: (cells: ReadonlyArray<SqliteDecimalReviewedCell>) => Effect.Effect<void, E, R>) => Effect.Effect<void, SqlError | E, R>;
3352
+
3318
3353
  /** The refusal a foreign claim produces — one sentence for both boot paths. */
3319
3354
  export declare const foreignOwnerMessage: (self: string, owner: string, claimedAt: string | undefined) => string;
3320
3355
 
@@ -3382,6 +3417,11 @@ export declare interface HeldMigrationLock {
3382
3417
  /** Release the lock and return its connection to the pool. Idempotent only
3383
3418
  * in the sense that the dialect statements are; call it once. */
3384
3419
  readonly release: Effect.Effect<void, SqlError>;
3420
+ /** The reserved connection holding the lock (none on sqlite). Idle between
3421
+ * its keep-alive touches, so work that needs a connection OTHER than its
3422
+ * transaction's — a visibility probe — reads through this one instead of
3423
+ * reserving a third: the migration's contract is two connections. */
3424
+ readonly connection: Connection | undefined;
3385
3425
  }
3386
3426
 
3387
3427
  /**
@@ -3776,6 +3816,8 @@ export declare type MigrationAtomicity = 'plan-transactional' | 'per-operation';
3776
3816
 
3777
3817
  export declare const migrationAtomicityFor: (dialect: DialectId) => MigrationAtomicity;
3778
3818
 
3819
+ declare type MigrationBatch = (statements: ReadonlyArray<string>) => Effect.Effect<void, SqlError>;
3820
+
3779
3821
  /**
3780
3822
  * The hash of a migration file's SOURCE, recorded beside its ledger row.
3781
3823
  *
@@ -3854,7 +3896,7 @@ export declare type MigrationModuleImporter = (file: string) => Promise<Record<s
3854
3896
  * `log` and the two probes the store can answer about its own shape
3855
3897
  * (`tableExists`, `columnExists`) work without one; each refusal names what to
3856
3898
  * do instead. Also raised at construction when what was handed in as `sql` is not
3857
- * an `@effect/sql` client, or when a SQL-backed store arrives without the
3899
+ * an `effect/sql` client, or when a SQL-backed store arrives without the
3858
3900
  * client it executes on — both are refused before a body can run rather
3859
3901
  * than surfacing as a TypeError from inside the first helper that touches
3860
3902
  * the client.
@@ -4675,6 +4717,10 @@ declare interface PredicateLeaf_2 {
4675
4717
  readonly path?: ReadonlyArray<string | number>;
4676
4718
  }
4677
4719
 
4720
+ /** Internal encoded stage. The reviewed target is bound into retained ownership;
4721
+ * source publication and artifact cleanup remain separate operations. */
4722
+ export declare const prepareSqliteDecimalStage: (sql: SqlClient.SqlClient, request: SqliteRetainedSourceRequest, target: TableSnapshot) => Effect.Effect<SqliteDecimalStage, SqlError>;
4723
+
4678
4724
  /** Read the complete eligible history, independent of the dashboard's recent
4679
4725
  * history limit. The token must be rechecked by squashMigrationPlans on write. */
4680
4726
  export declare const previewMigrationSquash: (options: Pick<SquashOptions, "before" | "fingerprint">) => Effect.Effect<MigrationSquashPreview, Error, SqlClient.SqlClient>;
@@ -4702,7 +4748,16 @@ export declare const previewMigrationSquash: (options: Pick<SquashOptions, "befo
4702
4748
  * Eager provisioning is the APP's move (call this from a seed/startup over its
4703
4749
  * own tenant table); the framework has no tenant registry to enumerate.
4704
4750
  */
4705
- export declare const provisionTenantNamespace: (tables: ReadonlyArray<AnyTable>, namespace: string, sqlLayer: Layer.Layer<SqlClient.SqlClient, ConfigError.ConfigError | SqlError_2.SqlError, never>, dialect?: DialectId, options?: SchemaApplyOptions) => Promise<void>;
4751
+ export declare const provisionTenantNamespace: (tables: ReadonlyArray<AnyTable>, namespace: string, sqlLayer: Layer.Layer<SqlClient.SqlClient, Config.ConfigError | SqlError_2.SqlError, never>, dialect?: DialectId, options?: SchemaApplyOptions) => Promise<void>;
4752
+
4753
+ /** Internal offline publication. Receipt and published image share the same
4754
+ * commit as table replacement. Retry verifies receipt/schema/retained artifacts
4755
+ * without requiring live rows to remain unchanged after successful publication. */
4756
+ export declare const publishSqliteDecimalStage: (sql: SqlClient.SqlClient, request: SqliteRetainedSourceRequest, target: TableSnapshot, triggers?: ReadonlyArray<SqliteDecimalTargetTrigger>) => Effect.Effect<{
4757
+ readonly marker: string;
4758
+ readonly image: string;
4759
+ readonly sourceCopy: string;
4760
+ }, SqlError>;
4706
4761
 
4707
4762
  /**
4708
4763
  * The runtime-facing materialized query — a plain bag of strings the store and
@@ -5407,6 +5462,12 @@ export declare const reactiveTriggerRepairSql: (input: {
5407
5462
 
5408
5463
  export declare const readMigrationSnapshotCandidates: (sql: SqlClient.SqlClient, live: SchemaSnapshot) => Effect.Effect<ReadonlyArray<MigrationSnapshotCandidate>, SqlError>;
5409
5464
 
5465
+ /** Collect observations for callers that explicitly need a complete review.
5466
+ * Retained-source validation consumes pages directly instead. */
5467
+ export declare const readSqliteDecimalSource: (connection: Pick<Connection, "executeUnprepared">, retained: string, keys: ReadonlyArray<string>, columns: ReadonlyArray<SqliteDecimalSourceColumn>) => Effect.Effect<ReadonlyArray<SqliteDecimalReviewedCell>, SqlError>;
5468
+
5469
+ export declare const readSqliteTableSchema: (connection: Pick<Connection, "executeUnprepared">, table: string) => Effect.Effect<SqliteTableSchema, SqlError>;
5470
+
5410
5471
  /** Every string column of a base table in the connected database. */
5411
5472
  export declare const readUndeclaredCharsetColumns: (sql: SqlClient.SqlClient) => Effect.Effect<ReadonlyArray<UndeclaredCharsetColumn>, SqlError>;
5412
5473
 
@@ -5462,6 +5523,8 @@ export declare const recordUpToDate: (sql: SqlClient.SqlClient, plan: MigrationP
5462
5523
  readonly source: string;
5463
5524
  }) => Effect.Effect<"recorded" | "already-current", never>;
5464
5525
 
5526
+ /* Excluded from this release type: registerSqliteMigrationBatch */
5527
+
5465
5528
  /* Excluded from this release type: registerSqlPoolCapacity */
5466
5529
 
5467
5530
  export declare type RehearsalOutcome =
@@ -5576,6 +5639,11 @@ export declare const rollbackFileBasedMigration: (sql: SqlClient.SqlClient, ctx:
5576
5639
  durationMs: number;
5577
5640
  }, unknown>;
5578
5641
 
5642
+ /** Restore original declared values only while the published rows are unchanged.
5643
+ * The receipt changes in the same commit, so a retry preserves subsequent writes.
5644
+ * Retained copies remain owned until a separate explicit cleanup. */
5645
+ export declare const rollbackSqliteDecimalPublication: (sql: SqlClient.SqlClient, request: SqliteRetainedSourceRequest, target: TableSnapshot, triggers?: ReadonlyArray<SqliteDecimalTargetTrigger>) => Effect.Effect<void, SqlError>;
5646
+
5579
5647
  /**
5580
5648
  * What the plan already knows that a single operation does not: the tables it
5581
5649
  * creates. Optional — without it nothing is known to be new and every verdict
@@ -5715,7 +5783,7 @@ export declare interface RunFileBasedMigrationsCtx {
5715
5783
  * `voltro_isr_cache` so framework releases that grow new columns
5716
5784
  * don't crash old DBs at boot.
5717
5785
  */
5718
- export declare const runFrameworkBootstrap: (tables: ReadonlyArray<AnyTable>, sqlLayer: Layer.Layer<SqlClient.SqlClient, ConfigError.ConfigError | SqlError_2.SqlError, never>, dialect?: DialectId, options?: SchemaApplyOptions) => Promise<void>;
5786
+ export declare const runFrameworkBootstrap: (tables: ReadonlyArray<AnyTable>, sqlLayer: Layer.Layer<SqlClient.SqlClient, Config.ConfigError | SqlError_2.SqlError, never>, dialect?: DialectId, options?: SchemaApplyOptions) => Promise<void>;
5719
5787
 
5720
5788
  /**
5721
5789
  * Run `applySchema` against a fresh SqlClient from the provided sqlLayer.
@@ -5725,7 +5793,7 @@ export declare const runFrameworkBootstrap: (tables: ReadonlyArray<AnyTable>, sq
5725
5793
  * `dialect` is passed through to the DDL emitter so SQL types + reactive
5726
5794
  * trigger emission match the underlying engine.
5727
5795
  */
5728
- export declare const runMigrate: (tables: ReadonlyArray<AnyTable>, sqlLayer: Layer.Layer<SqlClient.SqlClient, ConfigError.ConfigError | SqlError_2.SqlError, never>, dialect?: DialectId, options?: SchemaApplyOptions) => Promise<void>;
5796
+ export declare const runMigrate: (tables: ReadonlyArray<AnyTable>, sqlLayer: Layer.Layer<SqlClient.SqlClient, Config.ConfigError | SqlError_2.SqlError, never>, dialect?: DialectId, options?: SchemaApplyOptions) => Promise<void>;
5729
5797
 
5730
5798
  /**
5731
5799
  * Execute ONE planned operation with the applier's own per-dialect
@@ -5779,6 +5847,11 @@ export declare const runSchemaOp: (sql: SqlClient.SqlClient, op: MigrationSchema
5779
5847
  /** Runs one Effect over the connection — the shape `ManagedRuntime.runPromise` and a store's `run` share. */
5780
5848
  export declare type RunSql = <A>(effect: Effect.Effect<A, SqlError, SqlClient.SqlClient>) => Promise<A>;
5781
5849
 
5850
+ /** Execute one SQLite-family schema rewrite atomically. This is an operation
5851
+ * boundary, not a transaction over the complete migration plan. Call outside
5852
+ * existing transactions so FK enforcement can be changed before BEGIN. */
5853
+ export declare const runSqliteMigrationBatch: (sql: SqlClient.SqlClient, statements: ReadonlyArray<string>) => Effect.Effect<void, SqlError>;
5854
+
5782
5855
  export declare const SCHEMA_OWNER_TABLE = "_voltro_schema_owner";
5783
5856
 
5784
5857
  /**
@@ -5987,6 +6060,8 @@ declare interface SpatialClause_2 {
5987
6060
  readonly order?: 'asc' | 'desc';
5988
6061
  }
5989
6062
 
6063
+ export declare const splitStatements: (sql: string) => ReadonlyArray<string>;
6064
+
5990
6065
  /**
5991
6066
  * The `sql` template tag — captures a tagged-template literal into a
5992
6067
  * {@link RawSqlFragment} descriptor without binding it to any client.
@@ -6004,6 +6079,131 @@ declare interface SpatialClause_2 {
6004
6079
  */
6005
6080
  export declare const sql: (strings: TemplateStringsArray, ...values: ReadonlyArray<unknown>) => RawSqlFragment;
6006
6081
 
6082
+ /** Internal conversion input. NUMERIC affinity may already have rounded even
6083
+ * integer-looking values. Its driver result is never an exact decimal source. */
6084
+ export declare type SqliteDecimalConversionSource = {
6085
+ readonly kind: 'text';
6086
+ readonly value: unknown;
6087
+ } | {
6088
+ readonly kind: 'sortable-v1';
6089
+ readonly value: unknown;
6090
+ readonly shape: SqliteDecimalShape;
6091
+ } | {
6092
+ readonly kind: 'numeric';
6093
+ readonly value: unknown;
6094
+ /** An explicit per-value decision, not an automatic String(number) cast.
6095
+ * Supply an authoritative decimal or deliberately accept a rounded value.
6096
+ * Acknowledging possible prior loss does not recover the original digits. */
6097
+ readonly resolution?: {
6098
+ readonly decimal: string;
6099
+ readonly acknowledgePriorRounding: true;
6100
+ };
6101
+ };
6102
+
6103
+ declare interface SqliteDecimalDecision {
6104
+ readonly rowIdentity: string;
6105
+ readonly column: string;
6106
+ readonly encoded: string | null;
6107
+ readonly sourceIdentity: string;
6108
+ readonly target: SqliteDecimalShape;
6109
+ }
6110
+
6111
+ /** Canonical identity order shared by array reviews and streamed witnesses. */
6112
+ export declare const sqliteDecimalDecisionIdentity: (cell: Pick<SqliteDecimalDecision, "rowIdentity" | "column">) => string;
6113
+
6114
+ /** Internal reviewed cell input. Row identities come from the retained source,
6115
+ * not positional array indexes or driver-rounded numeric primary keys. */
6116
+ export declare interface SqliteDecimalReviewedCell {
6117
+ readonly rowIdentity: string;
6118
+ readonly column: string;
6119
+ readonly source: SqliteDecimalConversionSource;
6120
+ readonly target: SqliteDecimalShape;
6121
+ }
6122
+
6123
+ /** Internal candidate storage codec. Not yet connected to DDL or store writes. */
6124
+ export declare interface SqliteDecimalShape {
6125
+ readonly precision: number;
6126
+ readonly scale: number;
6127
+ }
6128
+
6129
+ export declare interface SqliteDecimalSourceColumn {
6130
+ readonly name: string;
6131
+ readonly source: 'text' | 'numeric' | {
6132
+ readonly encoding: 'sortable-v1';
6133
+ readonly shape: SqliteDecimalShape;
6134
+ };
6135
+ readonly target: SqliteDecimalShape;
6136
+ }
6137
+
6138
+ export declare interface SqliteDecimalStage {
6139
+ readonly stage: string;
6140
+ readonly marker: string;
6141
+ readonly sourceCopy: string;
6142
+ readonly sourceMarker: string;
6143
+ readonly sourceManifest: string;
6144
+ readonly sourceContents: SqliteTableContents;
6145
+ readonly sourceRowIdentity: SqliteRowIdentity;
6146
+ readonly manifest: string;
6147
+ readonly schema: SqliteTableSchema;
6148
+ /** Captured before final source/stage validation. Publication must assert
6149
+ * this epoch rather than recapturing it after validation has completed. */
6150
+ readonly validationEpoch: number;
6151
+ readonly indexes: ReadonlyArray<string>;
6152
+ }
6153
+
6154
+ export declare interface SqliteDecimalTargetTrigger {
6155
+ readonly name: string;
6156
+ readonly sql: string;
6157
+ }
6158
+
6159
+ /* Excluded from this release type: sqliteMigrationBatchStatements */
6160
+
6161
+ /** Internal preparation input from an existing file migration. The caller owns
6162
+ * offline exclusion; this is artifact metadata, not a second migration runner. */
6163
+ export declare interface SqliteRetainedSourceRequest {
6164
+ readonly migrationId: string;
6165
+ readonly source: string;
6166
+ readonly targetIdentity: string;
6167
+ readonly reviewedSchema: SqliteTableSchema;
6168
+ readonly decimalReview?: {
6169
+ readonly keys: ReadonlyArray<string>;
6170
+ readonly columns: ReadonlyArray<SqliteDecimalSourceColumn>;
6171
+ /** Repeatable input in unique canonical decision order; may stream from disk. */
6172
+ readonly cells: Iterable<SqliteDecimalReviewedCell>;
6173
+ };
6174
+ }
6175
+
6176
+ /** Physical identity retained separately from declared row values. Integer
6177
+ * identities and sequence watermarks never pass through JavaScript numbers. */
6178
+ declare interface SqliteRowIdentity {
6179
+ readonly alias: string | null;
6180
+ readonly columns: ReadonlyArray<string>;
6181
+ readonly rowCount: number;
6182
+ readonly digest: string;
6183
+ readonly sequence: string | null;
6184
+ readonly autoincrement: boolean;
6185
+ readonly sequenceBackend: 'sqlite' | 'turso';
6186
+ }
6187
+
6188
+ /** Internal multiset witness: includes storage classes and duplicate counts,
6189
+ * with values formatted in SQL before the driver can narrow integer/real data.
6190
+ * Independent of row order; not a lock or protection against a forged manifest. */
6191
+ declare interface SqliteTableContents {
6192
+ readonly columns: ReadonlyArray<string>;
6193
+ readonly digest: string;
6194
+ }
6195
+
6196
+ /** Internal, serializable schema witness for one ordinary main-schema table.
6197
+ * SQL is retained exactly: even semantically equivalent DDL changes require a
6198
+ * new review. This is neither artifact ownership nor a writer exclusion lock. */
6199
+ export declare interface SqliteTableSchema {
6200
+ readonly objects: ReadonlyArray<{
6201
+ readonly type: string;
6202
+ readonly name: string;
6203
+ readonly sql: string | null;
6204
+ }>;
6205
+ }
6206
+
6007
6207
  /* Excluded from this release type: sqlPoolCapacity */
6008
6208
 
6009
6209
  /**
@@ -6169,10 +6369,9 @@ declare interface Table<Name extends string, Fields extends Record<string, Colum
6169
6369
  /**
6170
6370
  * The plugin references DECLARED on this table, surviving `table()`.
6171
6371
  *
6172
- * `pluginRefSpecOf` reads a column BUILDER, and materialisation replaces it
6173
- * with a plain field descriptor — so without this the declaration is
6174
- * unreadable the moment the table exists, and any tool deriving structure
6175
- * from the schema sees an ordinary `text()` column.
6372
+ * Derived from column metadata on every table rebuild, including columns
6373
+ * contributed by mixins. Consumers can inspect these rules without knowing
6374
+ * the private metadata on each materialized scalar definition.
6176
6375
  */
6177
6376
  readonly appliedPluginRefs?: ReadonlyArray<{
6178
6377
  readonly column: string;
@@ -6219,7 +6418,7 @@ declare interface Table<Name extends string, Fields extends Record<string, Colum
6219
6418
  * BEFORE every INSERT. Populated by `.validate(schema)`. Set
6220
6419
  * per-table at table-construction time; immutable thereafter.
6221
6420
  */
6222
- readonly insertSchema?: Schema.Schema.Any;
6421
+ readonly insertSchema?: Schema.Top;
6223
6422
  /**
6224
6423
  * Optional `effect/Schema` the framework decodes a patch against
6225
6424
  * BEFORE every UPDATE. Populated by `.validatePatch(schema)`. The
@@ -6228,7 +6427,7 @@ declare interface Table<Name extends string, Fields extends Record<string, Colum
6228
6427
  * are checked. Set per-table at table-construction time; immutable
6229
6428
  * thereafter.
6230
6429
  */
6231
- readonly validatePatchSchema?: Schema.Schema.Any;
6430
+ readonly validatePatchSchema?: Schema.Top;
6232
6431
  with: <const Mixins extends ReadonlyArray<AnyMixin>>(...mixins: Mixins) => Table<Name, Fields & MergeMixinFields<Mixins>, Reactive, IxNames>;
6233
6432
  /**
6234
6433
  * Attach an effect/Schema that validates EVERY insert against the
@@ -6256,7 +6455,7 @@ declare interface Table<Name extends string, Fields extends Record<string, Colum
6256
6455
  * `id` and `createdAt` are already filled in by the time the
6257
6456
  * decoder sees the row.
6258
6457
  */
6259
- validate: <S extends Schema.Schema.Any>(schema: S) => Table<Name, Fields, Reactive, IxNames>;
6458
+ validate: <S extends Schema.Top>(schema: S) => Table<Name, Fields, Reactive, IxNames>;
6260
6459
  /**
6261
6460
  * Attach an effect/Schema that validates UPDATE patches against the
6262
6461
  * table. The framework wraps the schema in `Schema.partial`, so a
@@ -6287,7 +6486,7 @@ declare interface Table<Name extends string, Fields extends Record<string, Colum
6287
6486
  * wrapping is applied for you, so don't pre-wrap fields in
6288
6487
  * `Schema.optional`.
6289
6488
  */
6290
- validatePatch: <S extends Schema.Schema.Any>(schema: S) => Table<Name, Fields, Reactive, IxNames>;
6489
+ validatePatch: <S extends Schema.Struct<Schema.Struct.Fields>>(schema: S) => Table<Name, Fields, Reactive, IxNames>;
6291
6490
  /**
6292
6491
  * Declare a (possibly composite) secondary index on the table.
6293
6492
  *
@@ -6905,6 +7104,11 @@ declare type VectorDistance = 'cosine' | 'l2' | 'inner';
6905
7104
  */
6906
7105
  declare type VectorDistance_2 = 'cosine' | 'l2' | 'inner';
6907
7106
 
7107
+ /** A matching recorded fingerprint cannot certify a partially converted table.
7108
+ * Read physical markers before accepting a SQLite-family boot. No data or DDL
7109
+ * is touched, and ordinary schemas do not incur per-table catalog queries. */
7110
+ export declare const verifySqliteDecimalStorage: (sql: SqlClient.SqlClient, declared: ReadonlyArray<TableLike>) => Effect.Effect<void, SqlError>;
7111
+
6908
7112
  /**
6909
7113
  * A read-only SQL view descriptor. Structurally a `TableLike` (carries
6910
7114
  * `tableName` + `fields`) so the query builder + row decoder + by-name