@prisma-next/target-sqlite 0.12.0-dev.11 → 0.12.0-dev.12
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/{codec-ids-C4UfWqAE.d.mts → codec-ids-ry_1hyIa.d.mts} +1 -1
- package/dist/{codec-ids-C4UfWqAE.d.mts.map → codec-ids-ry_1hyIa.d.mts.map} +1 -1
- package/dist/codec-ids.d.mts +1 -1
- package/dist/{codec-types-B2ci-b_W.d.mts → codec-types-DthJOcMQ.d.mts} +2 -2
- package/dist/{codec-types-B2ci-b_W.d.mts.map → codec-types-DthJOcMQ.d.mts.map} +1 -1
- package/dist/codec-types.d.mts +2 -2
- package/dist/{codecs-DqDWNIKq.d.mts → codecs-pGBT6kq8.d.mts} +2 -2
- package/dist/{codecs-DqDWNIKq.d.mts.map → codecs-pGBT6kq8.d.mts.map} +1 -1
- package/dist/codecs.d.mts +1 -1
- package/dist/control.d.mts +1 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +4 -72
- package/dist/control.mjs.map +1 -1
- package/dist/{descriptor-meta-DIbCXU65.mjs → descriptor-meta-rKforwQA.mjs} +3 -1
- package/dist/descriptor-meta-rKforwQA.mjs.map +1 -0
- package/dist/migration.d.mts +2 -2
- package/dist/op-factory-call.d.mts +2 -2
- package/dist/pack.d.mts +2 -1
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/{planner-BDZolRbq.mjs → planner-Cygvz9Wp.mjs} +2 -2
- package/dist/{planner-BDZolRbq.mjs.map → planner-Cygvz9Wp.mjs.map} +1 -1
- package/dist/{planner-produced-sqlite-migration-D4FSvPE4.d.mts → planner-produced-sqlite-migration-Cyxk0Z8w.d.mts} +3 -3
- package/dist/{planner-produced-sqlite-migration-D4FSvPE4.d.mts.map → planner-produced-sqlite-migration-Cyxk0Z8w.d.mts.map} +1 -1
- package/dist/planner-produced-sqlite-migration.d.mts +1 -1
- package/dist/{planner-target-details-B-VJkUsu.d.mts → planner-target-details-DkD4PzGm.d.mts} +1 -1
- package/dist/{planner-target-details-B-VJkUsu.d.mts.map → planner-target-details-DkD4PzGm.d.mts.map} +1 -1
- package/dist/planner-target-details.d.mts +1 -1
- package/dist/planner.d.mts +2 -2
- package/dist/planner.mjs +1 -1
- package/dist/render-ops.d.mts +1 -1
- package/dist/runtime.d.mts +17 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +2 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/{shared-DDOJntxk.d.mts → shared-WFV75TJF.d.mts} +2 -2
- package/dist/{shared-DDOJntxk.d.mts.map → shared-WFV75TJF.d.mts.map} +1 -1
- package/dist/sqlite-contract-serializer-Hy7WQPea.mjs +100 -0
- package/dist/sqlite-contract-serializer-Hy7WQPea.mjs.map +1 -0
- package/dist/{sqlite-migration-Feio34n3.d.mts → sqlite-migration-BmldCeJh.d.mts} +2 -2
- package/dist/{sqlite-migration-Feio34n3.d.mts.map → sqlite-migration-BmldCeJh.d.mts.map} +1 -1
- package/package.json +18 -18
- package/src/core/descriptor-meta.ts +2 -0
- package/src/core/sqlite-contract-serializer.ts +38 -9
- package/src/core/sqlite-unbound-database.ts +30 -0
- package/src/exports/runtime.ts +1 -0
- package/dist/descriptor-meta-DIbCXU65.mjs.map +0 -1
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
import type { Contract } from '@prisma-next/contract/types';
|
|
2
2
|
import { SqlContractSerializerBase } from '@prisma-next/family-sql/ir';
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
type Namespace,
|
|
5
|
+
NamespaceBase,
|
|
6
|
+
UNBOUND_NAMESPACE_ID,
|
|
7
|
+
} from '@prisma-next/framework-components/ir';
|
|
8
|
+
import type {
|
|
9
|
+
SqlNamespaceTablesInput,
|
|
10
|
+
SqlStorage,
|
|
11
|
+
StorageTable,
|
|
12
|
+
} from '@prisma-next/sql-contract/types';
|
|
13
|
+
import { SqliteDatabase, SqliteUnboundDatabase } from './sqlite-unbound-database';
|
|
4
14
|
|
|
5
15
|
/**
|
|
6
16
|
* SQLite target `ContractSerializer` concretion. Mirrors the Postgres
|
|
7
|
-
* shape: inherits the full SQL-family deserialization pipeline
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `serializeContract` falls through to the family-base default —
|
|
12
|
-
* SQLite's contract is JSON-clean today. Once target-only fields land
|
|
13
|
-
* (e.g. per-target derived storage fields) this is the home for
|
|
14
|
-
* stripping them from the persisted envelope.
|
|
17
|
+
* shape: inherits the full SQL-family deserialization pipeline and
|
|
18
|
+
* materialises namespace entries as SQLite database concretions that
|
|
19
|
+
* expose `qualifyTable()` for runtime SQL rendering.
|
|
15
20
|
*/
|
|
16
21
|
export class SqliteContractSerializer extends SqlContractSerializerBase<Contract<SqlStorage>> {
|
|
17
22
|
constructor() {
|
|
18
23
|
super(new Map());
|
|
19
24
|
}
|
|
25
|
+
|
|
26
|
+
protected override hydrateSqlNamespaceEntry(
|
|
27
|
+
nsId: string,
|
|
28
|
+
raw: Namespace | Record<string, unknown>,
|
|
29
|
+
): Namespace | SqlNamespaceTablesInput {
|
|
30
|
+
if (raw instanceof NamespaceBase) {
|
|
31
|
+
return raw;
|
|
32
|
+
}
|
|
33
|
+
const hydrated = super.hydrateSqlNamespaceEntry(nsId, raw) as {
|
|
34
|
+
id: string;
|
|
35
|
+
tables: Readonly<Record<string, StorageTable>>;
|
|
36
|
+
};
|
|
37
|
+
const { id, tables } = hydrated;
|
|
38
|
+
const emptyTables = Object.keys(tables).length === 0;
|
|
39
|
+
if (id === UNBOUND_NAMESPACE_ID && emptyTables) {
|
|
40
|
+
return SqliteUnboundDatabase.instance;
|
|
41
|
+
}
|
|
42
|
+
if (id !== UNBOUND_NAMESPACE_ID) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`SqliteContractSerializer: SQLite has no schema concept; the only valid namespace id is "${UNBOUND_NAMESPACE_ID}" (received "${id}").`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return new SqliteDatabase({ id, tables });
|
|
48
|
+
}
|
|
20
49
|
}
|
|
@@ -5,6 +5,36 @@ import {
|
|
|
5
5
|
} from '@prisma-next/framework-components/ir';
|
|
6
6
|
import type { StorageTable } from '@prisma-next/sql-contract/types';
|
|
7
7
|
|
|
8
|
+
export type SqliteDatabaseInput = {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly tables: Readonly<Record<string, StorageTable>>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* SQLite namespace concretion carrying table metadata and unqualified
|
|
15
|
+
* `qualifyTable()` emission for runtime SQL rendering.
|
|
16
|
+
*/
|
|
17
|
+
export class SqliteDatabase extends NamespaceBase {
|
|
18
|
+
readonly kind = 'database' as const;
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly tables: Readonly<Record<string, StorageTable>>;
|
|
21
|
+
|
|
22
|
+
constructor(input: SqliteDatabaseInput) {
|
|
23
|
+
super();
|
|
24
|
+
this.id = input.id;
|
|
25
|
+
this.tables = Object.freeze({ ...input.tables });
|
|
26
|
+
freezeNode(this);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
qualifier(): string {
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
qualifyTable(tableName: string): string {
|
|
34
|
+
return `"${tableName}"`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
8
38
|
/**
|
|
9
39
|
* SQLite target `Namespace` concretion. SQLite has no schema or
|
|
10
40
|
* database-namespacing concept at the SQL level — there is exactly one
|
package/src/exports/runtime.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor-meta-DIbCXU65.mjs","names":[],"sources":["../src/core/authoring.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import { temporalAuthoringPresets } from '@prisma-next/family-sql/control';\nimport type { AuthoringFieldNamespace } from '@prisma-next/framework-components/authoring';\n\nexport const sqliteAuthoringFieldPresets = {\n temporal: /* @__PURE__ */ temporalAuthoringPresets({\n codecId: 'sqlite/datetime@1',\n nativeType: 'text',\n }),\n} as const satisfies AuthoringFieldNamespace;\n","import type { CodecTypes } from '../exports/codec-types';\nimport { sqliteAuthoringFieldPresets } from './authoring';\nimport { sqliteTargetDescriptorMetaRuntime } from './descriptor-meta-runtime';\n\nconst sqliteTargetDescriptorMetaBase = {\n ...sqliteTargetDescriptorMetaRuntime,\n authoring: {\n field: sqliteAuthoringFieldPresets,\n },\n} as const;\n\nexport const sqliteTargetDescriptorMeta: typeof sqliteTargetDescriptorMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = sqliteTargetDescriptorMetaBase;\n"],"mappings":";;;AAGA,MAAa,8BAA8B,EACzC,UAA0B,yCAAyB;CACjD,SAAS;CACT,YAAY;AACd,CAAC,EACH;ACGA,MAAa,6BAET;CARF,GAAG;CACH,WAAW,EACT,OAAO,4BACT;AAKE"}
|