@prisma-next/sql-runtime 0.14.0 → 0.15.0-dev.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.
@@ -1,16 +1,486 @@
1
- import { i as createSqlExecutionStack, r as createExecutionContext, t as SqlRuntimeBase } from "../exports-BXdIMaxT.mjs";
1
+ import { a as createExecutionContext, i as decodeRow, o as createSqlExecutionStack, r as buildDecodeContext, t as SqlRuntimeBase } from "../exports-D5-Py3YP.mjs";
2
2
  import { canonicalizeJson } from "@prisma-next/framework-components/utils";
3
3
  import { runtimeError } from "@prisma-next/framework-components/runtime";
4
4
  import { SelectAst, TableSource } from "@prisma-next/sql-relational-core/ast";
5
5
  import { ifDefined } from "@prisma-next/utils/defined";
6
6
  import { instantiateExecutionStack } from "@prisma-next/framework-components/execution";
7
- import { coreHash, profileHash } from "@prisma-next/contract/types";
7
+ import { blindCast } from "@prisma-next/utils/casts";
8
+ import { asNamespaceId, coreHash, profileHash } from "@prisma-next/contract/types";
8
9
  import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
9
- import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
10
+ import { IRNodeBase, NamespaceBase, UNBOUND_NAMESPACE_ID, freezeNode, hydrateNamespaceEntities } from "@prisma-next/framework-components/ir";
10
11
  import { builtinGeneratorIds } from "@prisma-next/ids";
11
12
  import { generateId } from "@prisma-next/ids/runtime";
12
- import { SqlStorage, SqlUnboundNamespace, buildSqlNamespace } from "@prisma-next/sql-contract/types";
13
+ import { SqlStorage } from "@prisma-next/sql-contract/types";
13
14
  import { applicationDomainOf, collectAsync, collectAsync as collectAsync$1, createDevDatabase, drainAsyncIterable, teardownTestDatabase, withClient } from "@prisma-next/test-utils";
15
+ import { type } from "arktype";
16
+ //#region ../1-core/contract/src/ir/storage-entry-schemas.ts
17
+ const literalKindSchema = type("'literal'");
18
+ const functionKindSchema = type("'function'");
19
+ const ControlPolicySchema = type("'managed' | 'tolerated' | 'external' | 'observed'");
20
+ const ColumnDefaultLiteralSchema = type.declare().type({
21
+ kind: literalKindSchema,
22
+ value: "string | number | boolean | null | unknown[] | Record<string, unknown>"
23
+ });
24
+ const ColumnDefaultFunctionSchema = type.declare().type({
25
+ kind: functionKindSchema,
26
+ expression: "string"
27
+ });
28
+ const ColumnDefaultSchema = ColumnDefaultLiteralSchema.or(ColumnDefaultFunctionSchema);
29
+ const StorageValueSetRefSchema = type({
30
+ plane: "'storage'",
31
+ namespaceId: "string",
32
+ entityKind: "'valueSet'",
33
+ entityName: "string",
34
+ "spaceId?": "string"
35
+ });
36
+ const StorageColumnSchema = type({
37
+ "+": "reject",
38
+ nativeType: "string",
39
+ codecId: "string",
40
+ nullable: "boolean",
41
+ "many?": "boolean",
42
+ "typeParams?": "Record<string, unknown>",
43
+ "typeRef?": "string",
44
+ "default?": ColumnDefaultSchema,
45
+ "control?": ControlPolicySchema,
46
+ "valueSet?": StorageValueSetRefSchema
47
+ }).narrow((col, ctx) => {
48
+ if (col.typeParams !== void 0 && col.typeRef !== void 0) return ctx.mustBe("a column with either typeParams or typeRef, not both");
49
+ return true;
50
+ });
51
+ /**
52
+ * Storage value-set entry under `storage.namespaces[id].entries.valueSet[name]`.
53
+ * Carries a `kind: 'valueSet'` discriminator (enumerable, survives JSON) and an
54
+ * ordered `values` array of codec-encoded permitted values.
55
+ */
56
+ const StorageValueSetSchema = type({
57
+ kind: "'valueSet'",
58
+ values: type("string | number | boolean | null | unknown[] | Record<string, unknown>").array().readonly()
59
+ });
60
+ const PrimaryKeySchema = type.declare().type({
61
+ columns: type.string.array().readonly(),
62
+ "name?": "string"
63
+ });
64
+ const UniqueConstraintSchema = type.declare().type({
65
+ columns: type.string.array().readonly(),
66
+ "name?": "string"
67
+ });
68
+ const IndexSchema = type({
69
+ columns: type.string.array().readonly(),
70
+ "name?": "string",
71
+ "type?": "string",
72
+ "options?": "Record<string, unknown>"
73
+ });
74
+ const ForeignKeyReferenceSchema = type({
75
+ "+": "reject",
76
+ namespaceId: "string",
77
+ tableName: "string",
78
+ columns: type.string.array().readonly(),
79
+ "spaceId?": "string"
80
+ });
81
+ const ForeignKeySourceSchema = type({
82
+ "+": "reject",
83
+ namespaceId: "string",
84
+ tableName: "string",
85
+ columns: type.string.array().readonly()
86
+ });
87
+ const ReferentialActionSchema = type.declare().type("'noAction' | 'restrict' | 'cascade' | 'setNull' | 'setDefault'");
88
+ const ForeignKeySchema = type.declare().type({
89
+ source: ForeignKeySourceSchema,
90
+ target: ForeignKeyReferenceSchema,
91
+ "name?": "string",
92
+ "onDelete?": ReferentialActionSchema,
93
+ "onUpdate?": ReferentialActionSchema
94
+ });
95
+ const CheckConstraintSchema = type({
96
+ "+": "reject",
97
+ name: "string",
98
+ column: "string",
99
+ valueSet: StorageValueSetRefSchema
100
+ });
101
+ const StorageTableSchema = type({
102
+ "+": "reject",
103
+ columns: type({ "[string]": StorageColumnSchema }),
104
+ "primaryKey?": PrimaryKeySchema,
105
+ uniques: UniqueConstraintSchema.array().readonly(),
106
+ indexes: IndexSchema.array().readonly(),
107
+ foreignKeys: ForeignKeySchema.array().readonly(),
108
+ "control?": ControlPolicySchema,
109
+ "checks?": CheckConstraintSchema.array().readonly()
110
+ });
111
+ //#endregion
112
+ //#region ../1-core/contract/src/ir/sql-node.ts
113
+ /**
114
+ * SQL family IR node base. Carries the family-level `kind` discriminator
115
+ * `'sql'` and inherits the framework's `freezeNode` affordance.
116
+ *
117
+ * Single family-level discriminator (not per-leaf) reflects the fact that
118
+ * SQL IR has no polymorphic dispatch today — verifiers and serializers
119
+ * walk by structural position (`storage.tables[name].columns[name]`),
120
+ * not by inspecting `kind`. The abstract bar for per-leaf discriminators
121
+ * isn't earned until a future polymorphic consumer arrives.
122
+ *
123
+ * `kind` is installed as a non-enumerable own property on every instance,
124
+ * which keeps three things clean simultaneously:
125
+ *
126
+ * - `JSON.stringify(node)` produces the canonical pre-lift JSON envelope
127
+ * shape (no `kind` field), so emitted contract.json files and the
128
+ * `validateSqlContractFully` arktype schemas stay unchanged.
129
+ * - Test assertions that use `toEqual({...})` against the pre-lift flat
130
+ * shape continue to pass — only enumerable own properties are
131
+ * compared.
132
+ * - Direct access (`node.kind`) and runtime narrowing
133
+ * (`if (node.kind === 'sql')`) still work, so future polymorphic
134
+ * dispatch can begin reading `kind` without a runtime change.
135
+ *
136
+ * Future per-leaf overrides land cleanly: a class that gains a
137
+ * polymorphic-dispatch consumer (e.g. an enum type instance walked
138
+ * alongside other types) overrides `kind` with its narrower literal
139
+ * at that leaf level. Per-leaf overrides will use enumerable kind
140
+ * (matching the Mongo per-class-discriminator precedent) because they
141
+ * encode dispatch-relevant information that callers need to see in
142
+ * JSON envelopes; the family-level `'sql'` is uniform across all SQL
143
+ * IR and carries no dispatch-relevant information.
144
+ */
145
+ var SqlNode = class extends IRNodeBase {
146
+ kind;
147
+ constructor() {
148
+ super();
149
+ Object.defineProperty(this, "kind", {
150
+ value: "sql",
151
+ writable: false,
152
+ enumerable: false,
153
+ configurable: true
154
+ });
155
+ }
156
+ };
157
+ //#endregion
158
+ //#region ../1-core/contract/src/ir/check-constraint.ts
159
+ /**
160
+ * SQL Contract IR node for a table-level check constraint that restricts
161
+ * a column to the permitted values of a value-set.
162
+ *
163
+ * The constraint is **structured** (names a column and a value-set
164
+ * reference), not a raw SQL expression. Each target renders its own DDL
165
+ * from the structured form, keeping the contract target-agnostic.
166
+ *
167
+ * Construction is idempotent: passing an existing `CheckConstraint`
168
+ * instance as input produces a new instance with identical fields.
169
+ * The constructor does not use `instanceof` for input discrimination —
170
+ * it reads plain named properties, which is sufficient since
171
+ * `CheckConstraintInput` is a structural type.
172
+ */
173
+ var CheckConstraint = class extends SqlNode {
174
+ name;
175
+ column;
176
+ valueSet;
177
+ constructor(input) {
178
+ super();
179
+ this.name = input.name;
180
+ this.column = input.column;
181
+ this.valueSet = input.valueSet;
182
+ freezeNode(this);
183
+ }
184
+ };
185
+ //#endregion
186
+ //#region ../1-core/contract/src/ir/foreign-key-reference.ts
187
+ /**
188
+ * SQL Contract IR node for one side (source or target) of a foreign-key
189
+ * declaration. Carries the full coordinate: namespace, table, and columns.
190
+ *
191
+ * Cross-space discrimination is based on `spaceId` presence: absent means
192
+ * local (same contract-space); present means cross-space (the referenced
193
+ * table lives in the contract-space identified by `spaceId`).
194
+ *
195
+ * For local references `spaceId` is absent from JSON, keeping the serialized
196
+ * shape byte-identical to contracts authored before cross-space support was
197
+ * added. For cross-space references `spaceId` appears in JSON so round-trips
198
+ * are lossless.
199
+ *
200
+ * Use `UNBOUND_NAMESPACE_ID` from `@prisma-next/framework-components/ir`
201
+ * as the sentinel `namespaceId` for single-namespace (unbound) references.
202
+ */
203
+ var ForeignKeyReference = class extends SqlNode {
204
+ namespaceId;
205
+ tableName;
206
+ columns;
207
+ constructor(input) {
208
+ super();
209
+ this.namespaceId = asNamespaceId(input.namespaceId);
210
+ this.tableName = input.tableName;
211
+ this.columns = input.columns;
212
+ if (input.spaceId !== void 0) this.spaceId = input.spaceId;
213
+ freezeNode(this);
214
+ }
215
+ };
216
+ //#endregion
217
+ //#region ../1-core/contract/src/ir/foreign-key.ts
218
+ /**
219
+ * SQL Contract IR node for a table-level foreign-key declaration — the
220
+ * referential constraint only (source, target, `onDelete`/`onUpdate`).
221
+ *
222
+ * A persisted `foreignKeys[]` entry always denotes a real constraint: whether
223
+ * to emit the constraint at all, and whether to back it with an index, are
224
+ * authoring-time decisions (PSL `@relation(index:)`, TS `fk({ constraint,
225
+ * index })`) resolved once at `contract emit` — a `constraint: false` FK
226
+ * simply has no entry here, and a backing index (if any) is its own discrete,
227
+ * named entry in the table's `indexes[]`.
228
+ *
229
+ * Each FK carries explicit `source` and `target` {@link ForeignKeyReference}
230
+ * coordinates (namespace, table, columns). For single-namespace contracts the
231
+ * sentinel `UNBOUND_NAMESPACE_ID` appears on both sides.
232
+ *
233
+ * The nested references are normalised to {@link ForeignKeyReference}
234
+ * instances inside the constructor so downstream walks see a uniform AST
235
+ * regardless of whether the input was a JSON literal or an already-constructed
236
+ * class instance.
237
+ */
238
+ var ForeignKey = class extends SqlNode {
239
+ source;
240
+ target;
241
+ constructor(input) {
242
+ super();
243
+ this.source = input.source instanceof ForeignKeyReference ? input.source : new ForeignKeyReference(input.source);
244
+ this.target = input.target instanceof ForeignKeyReference ? input.target : new ForeignKeyReference(input.target);
245
+ if (input.name !== void 0) this.name = input.name;
246
+ if (input.onDelete !== void 0) this.onDelete = input.onDelete;
247
+ if (input.onUpdate !== void 0) this.onUpdate = input.onUpdate;
248
+ freezeNode(this);
249
+ }
250
+ };
251
+ //#endregion
252
+ //#region ../1-core/contract/src/ir/primary-key.ts
253
+ /**
254
+ * SQL Contract IR node for a table's primary-key constraint.
255
+ */
256
+ var PrimaryKey = class extends SqlNode {
257
+ columns;
258
+ constructor(input) {
259
+ super();
260
+ this.columns = input.columns;
261
+ if (input.name !== void 0) this.name = input.name;
262
+ freezeNode(this);
263
+ }
264
+ };
265
+ //#endregion
266
+ //#region ../1-core/contract/src/ir/sql-index.ts
267
+ /**
268
+ * SQL Contract IR node for a table-level secondary index.
269
+ *
270
+ * Note that this class shadows the global TypeScript `Index` lib type
271
+ * at the family-shared name; consumer files that need both should
272
+ * alias one (e.g.
273
+ * `import { Index as SqlIndexNode } from '@prisma-next/sql-contract/types'`).
274
+ */
275
+ var Index = class extends SqlNode {
276
+ columns;
277
+ constructor(input) {
278
+ super();
279
+ this.columns = input.columns;
280
+ if (input.name !== void 0) this.name = input.name;
281
+ if (input.type !== void 0) this.type = input.type;
282
+ if (input.options !== void 0) this.options = input.options;
283
+ freezeNode(this);
284
+ }
285
+ };
286
+ //#endregion
287
+ //#region ../1-core/contract/src/ir/storage-column.ts
288
+ /**
289
+ * SQL Contract IR node for a single column entry in `StorageTable.columns`.
290
+ *
291
+ * Single concrete family-shared class — every SQL target reads the
292
+ * same column shape today, so there is no per-target subclass. The
293
+ * class type accepts any caller that constructs via
294
+ * `new StorageColumn(input)`; literal construction sites must pass
295
+ * through the constructor or the family-base hydration walker.
296
+ *
297
+ * The column's `name` is not on the class — columns are keyed by name
298
+ * in the parent `StorageTable.columns: Record<string, StorageColumn>`
299
+ * map, so a `name` field would be redundant with the key.
300
+ */
301
+ var StorageColumn = class extends SqlNode {
302
+ nativeType;
303
+ codecId;
304
+ nullable;
305
+ constructor(input) {
306
+ super();
307
+ this.nativeType = input.nativeType;
308
+ this.codecId = input.codecId;
309
+ this.nullable = input.nullable;
310
+ if (input.many !== void 0) this.many = input.many;
311
+ if (input.typeParams !== void 0) this.typeParams = input.typeParams;
312
+ if (input.typeRef !== void 0) this.typeRef = input.typeRef;
313
+ if (input.default !== void 0) this.default = input.default;
314
+ if (input.control !== void 0) this.control = input.control;
315
+ if (input.valueSet !== void 0) this.valueSet = input.valueSet;
316
+ freezeNode(this);
317
+ }
318
+ };
319
+ //#endregion
320
+ //#region ../1-core/contract/src/ir/unique-constraint.ts
321
+ /**
322
+ * SQL Contract IR node for a table-level unique constraint.
323
+ */
324
+ var UniqueConstraint = class extends SqlNode {
325
+ columns;
326
+ constructor(input) {
327
+ super();
328
+ this.columns = input.columns;
329
+ if (input.name !== void 0) this.name = input.name;
330
+ freezeNode(this);
331
+ }
332
+ };
333
+ //#endregion
334
+ //#region ../1-core/contract/src/ir/storage-table.ts
335
+ /**
336
+ * SQL Contract IR node for a single table entry in a namespace's
337
+ * `tables` map.
338
+ *
339
+ * The constructor normalises nested IR-class fields (columns, primary
340
+ * key, uniques, indexes, foreign keys) into the appropriate class
341
+ * instances so downstream walks see a uniform AST regardless of whether
342
+ * the input was a JSON literal or an already-constructed class.
343
+ *
344
+ * The table's `name` is not on the class — tables are keyed by name in
345
+ * the parent namespace's `tables: Record<string, StorageTable>` map.
346
+ */
347
+ var StorageTable = class StorageTable extends SqlNode {
348
+ columns;
349
+ uniques;
350
+ indexes;
351
+ foreignKeys;
352
+ constructor(input) {
353
+ super();
354
+ this.columns = Object.freeze(Object.fromEntries(Object.entries(input.columns).map(([name, col]) => [name, col instanceof StorageColumn ? col : new StorageColumn(col)])));
355
+ if (input.primaryKey !== void 0) this.primaryKey = input.primaryKey instanceof PrimaryKey ? input.primaryKey : new PrimaryKey(input.primaryKey);
356
+ this.uniques = Object.freeze(input.uniques.map((u) => u instanceof UniqueConstraint ? u : new UniqueConstraint(u)));
357
+ this.indexes = Object.freeze(input.indexes.map((i) => i instanceof Index ? i : new Index(i)));
358
+ this.foreignKeys = Object.freeze(input.foreignKeys.map((fk) => fk instanceof ForeignKey ? fk : new ForeignKey(fk)));
359
+ if (input.control !== void 0) this.control = input.control;
360
+ if (input.checks !== void 0 && input.checks.length > 0) this.checks = Object.freeze(input.checks.map((cc) => new CheckConstraint(cc)));
361
+ freezeNode(this);
362
+ }
363
+ /**
364
+ * Runtime guard that a namespace `table` entry is really a `StorageTable`.
365
+ * The compiler already types the entry as `StorageTable`, but a
366
+ * freshly-deserialized contract may carry plain JSON at that slot until
367
+ * hydration; this duck-types the structural shape. Accepts `undefined` so
368
+ * optional-chained entry lookups pass straight through.
369
+ */
370
+ static is(value) {
371
+ if (typeof value !== "object" || value === null) return false;
372
+ return "columns" in value && "uniques" in value && "indexes" in value && "foreignKeys" in value;
373
+ }
374
+ static assert(value, coordinate) {
375
+ if (!StorageTable.is(value)) throw new Error(`Expected a StorageTable at ${coordinate}`);
376
+ }
377
+ };
378
+ //#endregion
379
+ //#region ../1-core/contract/src/ir/storage-value-set.ts
380
+ /**
381
+ * SQL Contract IR node for a value-set entry in a namespace's `valueSet`
382
+ * map (`SqlNamespace.entries.valueSet`).
383
+ *
384
+ * A value-set records the ordered set of permitted codec-encoded values for
385
+ * an enum-like column restriction. It does not carry a `codecId` — the
386
+ * column that references it already holds the codec; the value-set holds
387
+ * only the permitted values.
388
+ *
389
+ * The node's `kind` is enumerable (`'valueSet'`) so the JSON envelope
390
+ * carries the discriminator and the serializer hydration walker can
391
+ * dispatch on it. This follows the per-leaf enumerable-kind convention
392
+ * established in the SQL-node comment (future polymorphic dispatch on
393
+ * namespace entries needs the discriminator in JSON).
394
+ *
395
+ * The entry's name is not on the class — value-sets are keyed by name in
396
+ * the parent namespace's `valueSet: Record<string, StorageValueSet>` map.
397
+ */
398
+ var StorageValueSet = class extends SqlNode {
399
+ kind = "valueSet";
400
+ values;
401
+ constructor(input) {
402
+ super();
403
+ this.values = Object.freeze([...input.values]);
404
+ freezeNode(this);
405
+ }
406
+ };
407
+ //#endregion
408
+ //#region ../1-core/contract/src/entity-kinds.ts
409
+ const tableEntityKind = {
410
+ kind: "table",
411
+ schema: StorageTableSchema,
412
+ construct: (input) => new StorageTable(input)
413
+ };
414
+ const valueSetEntityKind = {
415
+ kind: "valueSet",
416
+ schema: StorageValueSetSchema,
417
+ construct: (input) => new StorageValueSet(input)
418
+ };
419
+ /**
420
+ * Assembles the `kind → descriptor` registry for SQL namespaces: the built-in
421
+ * `table` and `valueSet` kinds plus any target `packKinds`. This builds the
422
+ * lookup table — it does not touch contract data. `hydrateNamespaceEntities`
423
+ * later consumes this registry to turn a namespace's raw entries into IR
424
+ * instances, and `createSqlContractSchema` derives validation from the same
425
+ * registry. Throws on a duplicate kind.
426
+ */
427
+ function composeSqlEntityKinds(packKinds = []) {
428
+ const kinds = /* @__PURE__ */ new Map([["table", tableEntityKind], ["valueSet", valueSetEntityKind]]);
429
+ for (const descriptor of packKinds) {
430
+ if (kinds.has(descriptor.kind)) throw new Error(`composeSqlEntityKinds: duplicate entity kind "${descriptor.kind}" — each kind may be registered only once`);
431
+ kinds.set(descriptor.kind, descriptor);
432
+ }
433
+ return kinds;
434
+ }
435
+ //#endregion
436
+ //#region ../1-core/contract/src/ir/sql-storage.ts
437
+ /**
438
+ * Abstract SQL family namespace base class. Target concretions (`PostgresSchema`,
439
+ * `SqliteDatabase`, …) extend this — it is never instantiated directly.
440
+ * `entries` is the open ADR 224 dictionary: `entries[entityKind][entityName]`
441
+ * addresses any entity.
442
+ */
443
+ var SqlNamespaceBase = class extends NamespaceBase {};
444
+ //#endregion
445
+ //#region ../1-core/contract/test/test-support.ts
446
+ /**
447
+ * Minimal concrete `SqlNamespaceBase` for use in `packages/2-sql/**` unit tests.
448
+ *
449
+ * This is a legitimate target concretion — not a materialised family
450
+ * namespace. Production code never constructs one; the target-specific
451
+ * concretions (`PostgresSchema`, `SqliteDatabase`) are used in production.
452
+ */
453
+ var TestSqlNamespace = class extends SqlNamespaceBase {
454
+ id;
455
+ entries;
456
+ constructor(input) {
457
+ super();
458
+ this.id = input.id;
459
+ const dispatched = hydrateNamespaceEntities(input.entries, composeSqlEntityKinds(), "carry");
460
+ this.entries = Object.freeze(blindCast(dispatched));
461
+ Object.defineProperty(this, "kind", {
462
+ value: "test-sql-namespace",
463
+ writable: false,
464
+ enumerable: false,
465
+ configurable: true
466
+ });
467
+ freezeNode(this);
468
+ }
469
+ get table() {
470
+ return this.entries.table ?? Object.freeze({});
471
+ }
472
+ get valueSet() {
473
+ return this.entries.valueSet;
474
+ }
475
+ qualifyTable(tableName) {
476
+ if (this.id === UNBOUND_NAMESPACE_ID) return `"${tableName}"`;
477
+ return `"${this.id}"."${tableName}"`;
478
+ }
479
+ };
480
+ function createTestSqlNamespace(input) {
481
+ return new TestSqlNamespace(input);
482
+ }
483
+ //#endregion
14
484
  //#region test/test-codec.ts
15
485
  function defineTestCodec(config) {
16
486
  const identity = (v) => v;
@@ -327,7 +797,7 @@ function createStubAdapter() {
327
797
  };
328
798
  }
329
799
  function unboundNamespaceWithTables(tables) {
330
- return buildSqlNamespace({
800
+ return createTestSqlNamespace({
331
801
  id: UNBOUND_NAMESPACE_ID,
332
802
  entries: { table: tables }
333
803
  });
@@ -344,10 +814,16 @@ function createTestContract(contract) {
344
814
  storage: rest["storage"] ? new SqlStorage({
345
815
  ...rest["storage"],
346
816
  storageHash: storageHashValue,
347
- namespaces: rest["storage"].namespaces ?? { __unbound__: SqlUnboundNamespace.instance }
817
+ namespaces: rest["storage"].namespaces ?? { __unbound__: createTestSqlNamespace({
818
+ id: "__unbound__",
819
+ entries: { table: {} }
820
+ }) }
348
821
  }) : new SqlStorage({
349
822
  storageHash: storageHashValue,
350
- namespaces: { __unbound__: SqlUnboundNamespace.instance }
823
+ namespaces: { __unbound__: createTestSqlNamespace({
824
+ id: "__unbound__",
825
+ entries: { table: {} }
826
+ }) }
351
827
  }),
352
828
  domain: rest["domain"] ?? applicationDomainOf({ models: rest["models"] ?? {} }),
353
829
  roots: rest["roots"] ?? {},
@@ -362,6 +838,6 @@ function stubAst() {
362
838
  return SelectAst.from(TableSource.named("stub"));
363
839
  }
364
840
  //#endregion
365
- export { buildTestContractCodecs, collectAsync, createDevDatabase, createStubAdapter, createTestAdapterDescriptor, createTestContext, createTestContract, createTestRuntime, createTestStackInstance, createTestTargetDescriptor, descriptorsFromCodecs, drainPlanExecution, emptySqlTestDomain, executePlanAndCollect, seedTestMarker, setupTestDatabase, stubAst, teardownTestDatabase, unboundNamespaceWithTables, withClient, writeTestContractMarker };
841
+ export { buildDecodeContext, buildTestContractCodecs, collectAsync, createDevDatabase, createStubAdapter, createTestAdapterDescriptor, createTestContext, createTestContract, createTestRuntime, createTestStackInstance, createTestTargetDescriptor, decodeRow, descriptorsFromCodecs, drainPlanExecution, emptySqlTestDomain, executePlanAndCollect, seedTestMarker, setupTestDatabase, stubAst, teardownTestDatabase, unboundNamespaceWithTables, withClient, writeTestContractMarker };
366
842
 
367
843
  //# sourceMappingURL=utils.mjs.map