@prisma-next/target-sqlite 0.16.0-dev.32 → 0.16.0-dev.34

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 (52) hide show
  1. package/README.md +4 -0
  2. package/dist/codec-descriptor-2XsVwVp_.d.mts +30 -0
  3. package/dist/codec-descriptor-2XsVwVp_.d.mts.map +1 -0
  4. package/dist/codec-descriptor-BlnLtrba.d.mts +1 -0
  5. package/dist/codec-descriptor-DuYu6llI.mjs +111 -0
  6. package/dist/codec-descriptor-DuYu6llI.mjs.map +1 -0
  7. package/dist/codec-descriptor.d.mts +3 -0
  8. package/dist/codec-descriptor.mjs +2 -0
  9. package/dist/codec-types-BjeYtMEc.d.mts +23 -0
  10. package/dist/codec-types-BjeYtMEc.d.mts.map +1 -0
  11. package/dist/codec-types.d.mts +2 -2
  12. package/dist/codec-types.mjs +0 -1
  13. package/dist/{codecs-DGgo--O0.d.mts → codecs-D7gJOOpT.d.mts} +20 -10
  14. package/dist/codecs-D7gJOOpT.d.mts.map +1 -0
  15. package/dist/codecs.d.mts +2 -2
  16. package/dist/codecs.mjs +51 -22
  17. package/dist/codecs.mjs.map +1 -1
  18. package/dist/control.mjs +4 -4
  19. package/dist/{errors-B1JPoWDh.mjs → errors-By5PHAHj.mjs} +2 -2
  20. package/dist/{errors-B1JPoWDh.mjs.map → errors-By5PHAHj.mjs.map} +1 -1
  21. package/dist/migration.mjs +2 -2
  22. package/dist/{op-factory-call-BkqsWGiy.mjs → op-factory-call-D0iJ2rLo.mjs} +4 -4
  23. package/dist/{op-factory-call-BkqsWGiy.mjs.map → op-factory-call-D0iJ2rLo.mjs.map} +1 -1
  24. package/dist/op-factory-call.mjs +1 -1
  25. package/dist/pack.d.mts +1 -1
  26. package/dist/{planner-ByBNEpyf.mjs → planner-CuM2U40p.mjs} +4 -4
  27. package/dist/{planner-ByBNEpyf.mjs.map → planner-CuM2U40p.mjs.map} +1 -1
  28. package/dist/{planner-produced-sqlite-migration-kDBbdV5A.mjs → planner-produced-sqlite-migration-BtBhUMCI.mjs} +3 -3
  29. package/dist/{planner-produced-sqlite-migration-kDBbdV5A.mjs.map → planner-produced-sqlite-migration-BtBhUMCI.mjs.map} +1 -1
  30. package/dist/planner-produced-sqlite-migration.mjs +1 -1
  31. package/dist/planner.mjs +1 -1
  32. package/dist/{render-ops-BAw6MQWl.mjs → render-ops--tc17bbl.mjs} +2 -2
  33. package/dist/{render-ops-BAw6MQWl.mjs.map → render-ops--tc17bbl.mjs.map} +1 -1
  34. package/dist/render-ops.mjs +1 -1
  35. package/dist/runtime.mjs +1 -1
  36. package/dist/{sql-utils-BMteAbKH.mjs → sql-utils-Y5kXNiUB.mjs} +2 -2
  37. package/dist/{sql-utils-BMteAbKH.mjs.map → sql-utils-Y5kXNiUB.mjs.map} +1 -1
  38. package/dist/sql-utils.mjs +1 -1
  39. package/dist/{sqlite-contract-view-BKHdFV5Y.mjs → sqlite-contract-view-C9DFAHHV.mjs} +3 -3
  40. package/dist/{sqlite-contract-view-BKHdFV5Y.mjs.map → sqlite-contract-view-C9DFAHHV.mjs.map} +1 -1
  41. package/dist/{sqlite-migration-DEqyJo40.mjs → sqlite-migration-BWnQUTne.mjs} +4 -4
  42. package/dist/{sqlite-migration-DEqyJo40.mjs.map → sqlite-migration-BWnQUTne.mjs.map} +1 -1
  43. package/package.json +19 -18
  44. package/src/core/codec-descriptor.ts +253 -0
  45. package/src/core/codecs.ts +55 -16
  46. package/src/core/registry.ts +3 -0
  47. package/src/exports/codec-descriptor.ts +11 -0
  48. package/src/exports/codec-types.ts +8 -10
  49. package/src/exports/codecs.ts +1 -1
  50. package/dist/codec-types-CcFkbJ3o.d.mts +0 -21
  51. package/dist/codec-types-CcFkbJ3o.d.mts.map +0 -1
  52. package/dist/codecs-DGgo--O0.d.mts.map +0 -1
package/README.md CHANGED
@@ -42,6 +42,10 @@ export const contract = defineContract()
42
42
 
43
43
  Pack refs are pure JSON-friendly objects that make TypeScript contract authoring work in both emit and no-emit workflows without requiring separate manifest files.
44
44
 
45
+ ## Codec descriptor authoring
46
+
47
+ SQLite-bound codecs use the public `SqliteCodecDescriptor` protocol, `sqliteCodec(...)` adapter, and `defineSqliteCodecs(...)` tuple helper exported from `@prisma-next/target-sqlite/codec-descriptor`. See the [codec authoring guide](../../../../docs/reference/codec-authoring-guide.md#target-owned-sql-codec-descriptors) for subclassing, generic adaptation, stack contribution, structural validation, SQLite's scalar-only contract, and the current renderer transition.
48
+
45
49
  ## Architecture
46
50
 
47
51
  This package provides a runtime entry point for the SQLite target. All declarative fields (version, capabilities) are defined directly on the descriptor. The `./pack` entry point provides a pure pack ref for contract authoring.
@@ -0,0 +1,30 @@
1
+ import { ProjectionExpr } from "@prisma-next/sql-relational-core/ast";
2
+ import { AnyCodecDescriptor, CodecDescriptor, CodecDescriptorImpl, CodecRef } from "@prisma-next/framework-components/codec";
3
+ //#region src/core/codec-descriptor.d.ts
4
+ declare const SQLITE_CODEC_DESCRIPTOR_KIND: "sqlite-codec";
5
+ interface AnySqliteCodecDescriptor extends AnyCodecDescriptor {
6
+ readonly descriptorKind: typeof SQLITE_CODEC_DESCRIPTOR_KIND;
7
+ projectJson(expression: ProjectionExpr, ref: CodecRef): ProjectionExpr;
8
+ }
9
+ declare abstract class SqliteCodecDescriptor<P = void> extends CodecDescriptorImpl<P> implements AnySqliteCodecDescriptor {
10
+ readonly descriptorKind: "sqlite-codec";
11
+ protected abstract jsonProjection(expression: ProjectionExpr, params: P): ProjectionExpr;
12
+ projectJson(expression: ProjectionExpr, ref: CodecRef): ProjectionExpr;
13
+ private validateParams;
14
+ }
15
+ type DescriptorParams<D extends AnyCodecDescriptor> = D extends CodecDescriptor<infer P> ? P : never;
16
+ interface SqliteCodecOptions<P> {
17
+ readonly jsonProjection: (expression: ProjectionExpr, params: P) => ProjectionExpr;
18
+ }
19
+ type AdaptedSqliteCodecDescriptor<D extends AnyCodecDescriptor> = Pick<D, keyof CodecDescriptor<DescriptorParams<D>>> & Pick<AnySqliteCodecDescriptor, 'descriptorKind' | 'projectJson'>;
20
+ declare function sqliteCodec<D extends AnyCodecDescriptor>(descriptor: D, options: SqliteCodecOptions<DescriptorParams<D>>): AdaptedSqliteCodecDescriptor<D>;
21
+ declare function defineSqliteCodecs<const Descriptors extends readonly AnySqliteCodecDescriptor[]>(descriptors: Descriptors): Descriptors;
22
+ declare function isSqliteCodecDescriptor(value: unknown): value is AnySqliteCodecDescriptor;
23
+ interface SqliteCodecDescriptorRegistry {
24
+ descriptorFor(codecId: string): AnySqliteCodecDescriptor | undefined;
25
+ values(): IterableIterator<AnySqliteCodecDescriptor>;
26
+ }
27
+ declare function buildSqliteCodecDescriptorRegistry(descriptors: ReadonlyArray<unknown>): SqliteCodecDescriptorRegistry;
28
+ //#endregion
29
+ export { SqliteCodecOptions as a, isSqliteCodecDescriptor as c, SqliteCodecDescriptorRegistry as i, sqliteCodec as l, AnySqliteCodecDescriptor as n, buildSqliteCodecDescriptorRegistry as o, SqliteCodecDescriptor as r, defineSqliteCodecs as s, AdaptedSqliteCodecDescriptor as t };
30
+ //# sourceMappingURL=codec-descriptor-2XsVwVp_.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-descriptor-2XsVwVp_.d.mts","names":[],"sources":["../src/core/codec-descriptor.ts"],"mappings":";;;cAgBM;UAEW,iCAAiC;WACvC,uBAAuB;EAChC,YAAY,YAAY,gBAAgB,KAAK,WAAW;;uBAGpC,sBAAsB,kBAClC,oBAAoB,cACjB;WAEF;qBAEU,eAAe,YAAY,gBAAgB,QAAQ,IAAI;EAE1E,YAAY,YAAY,gBAAgB,KAAK,WAAW;UAgBhD;;KAQL,iBAAiB,UAAU,sBAC9B,UAAU,sBAAsB,KAAK;UAEtB,mBAAmB;WACzB,iBAAiB,YAAY,gBAAgB,QAAQ,MAAM;;KAG1D,6BAA6B,UAAU,sBAAsB,KACvE,SACM,gBAAgB,iBAAiB,OAEvC,KAAK;iBAwES,YAAY,UAAU,oBACpC,YAAY,GACZ,SAAS,mBAAmB,iBAAiB,MAC5C,6BAA6B;iBAOhB,yBAAyB,6BAA6B,4BACpE,aAAa,cACZ;iBAIa,wBAAwB,iBAAiB,SAAS;UAgCjD;EACf,cAAc,kBAAkB;EAChC,UAAU,iBAAiB;;iBAoBb,mCACd,aAAa,yBACZ"}
@@ -0,0 +1 @@
1
+ import "./codec-descriptor-2XsVwVp_.mjs";
@@ -0,0 +1,111 @@
1
+ import { CodecDescriptorImpl, validateCodecTypeParams } from "@prisma-next/framework-components/codec";
2
+ import { blindCast } from "@prisma-next/utils/casts";
3
+ import { structuredError } from "@prisma-next/utils/structured-error";
4
+ //#region src/core/codec-descriptor.ts
5
+ const SQLITE_CODEC_DESCRIPTOR_KIND = "sqlite-codec";
6
+ var SqliteCodecDescriptor = class extends CodecDescriptorImpl {
7
+ descriptorKind = SQLITE_CODEC_DESCRIPTOR_KIND;
8
+ projectJson(expression, ref) {
9
+ if (ref.many === true) throw structuredError("SQLITE.CODEC_DESCRIPTOR_ARRAY_UNSUPPORTED", `Codec '${ref.codecId}' uses CodecRef.many, but SQLite codec descriptors do not support stored scalar arrays.`, {
10
+ why: "SQLite has no stored scalar-array codec protocol, so applying a scalar projection to the whole stored array would be ambiguous.",
11
+ fix: "Use a scalar CodecRef or introduce an explicit target representation before projecting stored arrays.",
12
+ meta: { codecId: ref.codecId }
13
+ });
14
+ return this.jsonProjection(expression, this.validateParams(ref));
15
+ }
16
+ validateParams(ref) {
17
+ return blindCast(validateCodecTypeParams(this, ref));
18
+ }
19
+ };
20
+ var SqliteCodecDescriptorAdapter = class extends SqliteCodecDescriptor {
21
+ descriptor;
22
+ options;
23
+ codecId;
24
+ traits;
25
+ targetTypes;
26
+ paramsSchema;
27
+ metaFor;
28
+ renderOutputType;
29
+ renderInputType;
30
+ renderValueLiteral;
31
+ constructor(descriptor, options) {
32
+ super();
33
+ this.descriptor = descriptor;
34
+ this.options = options;
35
+ this.codecId = descriptor.codecId;
36
+ this.traits = descriptor.traits;
37
+ this.targetTypes = descriptor.targetTypes;
38
+ this.paramsSchema = descriptor.paramsSchema;
39
+ if (descriptor.meta !== void 0) Object.defineProperty(this, "meta", {
40
+ value: descriptor.meta,
41
+ enumerable: true
42
+ });
43
+ const metaFor = descriptor.metaFor;
44
+ if (metaFor !== void 0) this.metaFor = (params) => metaFor.call(descriptor, params);
45
+ const renderOutputType = descriptor.renderOutputType;
46
+ if (renderOutputType !== void 0) this.renderOutputType = (params) => renderOutputType.call(descriptor, params);
47
+ const renderInputType = descriptor.renderInputType;
48
+ if (renderInputType !== void 0) this.renderInputType = (params) => renderInputType.call(descriptor, params);
49
+ const renderValueLiteral = descriptor.renderValueLiteral;
50
+ if (renderValueLiteral !== void 0) this.renderValueLiteral = (value, side) => renderValueLiteral.call(descriptor, value, side);
51
+ }
52
+ get isParameterized() {
53
+ return this.descriptor.isParameterized;
54
+ }
55
+ factory = (params) => this.descriptor.factory(params);
56
+ jsonProjection(expression, params) {
57
+ return this.options.jsonProjection(expression, params);
58
+ }
59
+ };
60
+ function sqliteCodec(descriptor, options) {
61
+ return blindCast(new SqliteCodecDescriptorAdapter(descriptor, options));
62
+ }
63
+ function defineSqliteCodecs(descriptors) {
64
+ return descriptors;
65
+ }
66
+ function isSqliteCodecDescriptor(value) {
67
+ return typeof value === "object" && value !== null && "descriptorKind" in value && value.descriptorKind === SQLITE_CODEC_DESCRIPTOR_KIND && "codecId" in value && typeof value.codecId === "string" && "traits" in value && Array.isArray(value.traits) && "targetTypes" in value && Array.isArray(value.targetTypes) && value.targetTypes.every((targetType) => typeof targetType === "string") && "paramsSchema" in value && isObjectLike(value.paramsSchema) && "~standard" in value.paramsSchema && isObjectLike(value.paramsSchema["~standard"]) && "validate" in value.paramsSchema["~standard"] && typeof value.paramsSchema["~standard"].validate === "function" && "isParameterized" in value && typeof value.isParameterized === "boolean" && "factory" in value && typeof value.factory === "function" && "projectJson" in value && typeof value.projectJson === "function";
68
+ }
69
+ function isObjectLike(value) {
70
+ return typeof value === "object" && value !== null || typeof value === "function";
71
+ }
72
+ var SqliteCodecDescriptorRegistryImpl = class {
73
+ #descriptors;
74
+ constructor(descriptors) {
75
+ this.#descriptors = descriptors;
76
+ Object.freeze(this);
77
+ }
78
+ descriptorFor(codecId) {
79
+ return this.#descriptors.get(codecId);
80
+ }
81
+ *values() {
82
+ yield* this.#descriptors.values();
83
+ }
84
+ };
85
+ function buildSqliteCodecDescriptorRegistry(descriptors) {
86
+ const byId = /* @__PURE__ */ new Map();
87
+ for (const descriptor of descriptors) {
88
+ if (!isSqliteCodecDescriptor(descriptor)) {
89
+ const codecId = candidateCodecId(descriptor);
90
+ throw structuredError("SQLITE.CODEC_DESCRIPTOR_INVALID", `Codec descriptor '${codecId}' is not a valid SQLite codec descriptor.`, {
91
+ why: "SQLite codec registries require the sqlite-codec discriminant and complete target descriptor methods.",
92
+ fix: "Extend SqliteCodecDescriptor or adapt a generic descriptor with sqliteCodec().",
93
+ meta: { codecId }
94
+ });
95
+ }
96
+ if (byId.has(descriptor.codecId)) throw structuredError("SQLITE.CODEC_DESCRIPTOR_DUPLICATE", `Duplicate SQLite codec descriptor id '${descriptor.codecId}'.`, {
97
+ why: "Each codecId must resolve to exactly one SQLite descriptor during registry composition.",
98
+ fix: "Remove the duplicate target, adapter, or extension contribution.",
99
+ meta: { codecId: descriptor.codecId }
100
+ });
101
+ byId.set(descriptor.codecId, descriptor);
102
+ }
103
+ return new SqliteCodecDescriptorRegistryImpl(byId);
104
+ }
105
+ function candidateCodecId(value) {
106
+ return typeof value === "object" && value !== null && "codecId" in value && typeof value.codecId === "string" ? value.codecId : "<unknown>";
107
+ }
108
+ //#endregion
109
+ export { sqliteCodec as a, isSqliteCodecDescriptor as i, buildSqliteCodecDescriptorRegistry as n, defineSqliteCodecs as r, SqliteCodecDescriptor as t };
110
+
111
+ //# sourceMappingURL=codec-descriptor-DuYu6llI.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-descriptor-DuYu6llI.mjs","names":["#descriptors"],"sources":["../src/core/codec-descriptor.ts"],"sourcesContent":["import type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type AnyCodecDescriptor,\n type Codec,\n type CodecDescriptor,\n CodecDescriptorImpl,\n type CodecInstanceContext,\n type CodecMeta,\n type CodecRef,\n type CodecTrait,\n validateCodecTypeParams,\n} from '@prisma-next/framework-components/codec';\nimport type { ProjectionExpr } from '@prisma-next/sql-relational-core/ast';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { structuredError } from '@prisma-next/utils/structured-error';\n\nconst SQLITE_CODEC_DESCRIPTOR_KIND = 'sqlite-codec' as const;\n\nexport interface AnySqliteCodecDescriptor extends AnyCodecDescriptor {\n readonly descriptorKind: typeof SQLITE_CODEC_DESCRIPTOR_KIND;\n projectJson(expression: ProjectionExpr, ref: CodecRef): ProjectionExpr;\n}\n\nexport abstract class SqliteCodecDescriptor<P = void>\n extends CodecDescriptorImpl<P>\n implements AnySqliteCodecDescriptor\n{\n readonly descriptorKind = SQLITE_CODEC_DESCRIPTOR_KIND;\n\n protected abstract jsonProjection(expression: ProjectionExpr, params: P): ProjectionExpr;\n\n projectJson(expression: ProjectionExpr, ref: CodecRef): ProjectionExpr {\n if (ref.many === true) {\n throw structuredError(\n 'SQLITE.CODEC_DESCRIPTOR_ARRAY_UNSUPPORTED',\n `Codec '${ref.codecId}' uses CodecRef.many, but SQLite codec descriptors do not support stored scalar arrays.`,\n {\n why: 'SQLite has no stored scalar-array codec protocol, so applying a scalar projection to the whole stored array would be ambiguous.',\n fix: 'Use a scalar CodecRef or introduce an explicit target representation before projecting stored arrays.',\n meta: { codecId: ref.codecId },\n },\n );\n }\n\n return this.jsonProjection(expression, this.validateParams(ref));\n }\n\n private validateParams(ref: CodecRef): P {\n return blindCast<\n P,\n 'validateCodecTypeParams synchronously validates this descriptor schema before the typed hook'\n >(validateCodecTypeParams(this, ref));\n }\n}\n\ntype DescriptorParams<D extends AnyCodecDescriptor> =\n D extends CodecDescriptor<infer P> ? P : never;\n\nexport interface SqliteCodecOptions<P> {\n readonly jsonProjection: (expression: ProjectionExpr, params: P) => ProjectionExpr;\n}\n\nexport type AdaptedSqliteCodecDescriptor<D extends AnyCodecDescriptor> = Pick<\n D,\n keyof CodecDescriptor<DescriptorParams<D>>\n> &\n Pick<AnySqliteCodecDescriptor, 'descriptorKind' | 'projectJson'>;\n\nclass SqliteCodecDescriptorAdapter<D extends AnyCodecDescriptor> extends SqliteCodecDescriptor<\n DescriptorParams<D>\n> {\n override readonly codecId: string;\n override readonly traits: readonly CodecTrait[];\n override readonly targetTypes: readonly string[];\n override readonly paramsSchema: D['paramsSchema'];\n override readonly metaFor?: (params: DescriptorParams<D>) => CodecMeta | undefined;\n override readonly renderOutputType?: (params: DescriptorParams<D>) => string | undefined;\n override readonly renderInputType?: (params: DescriptorParams<D>) => string | undefined;\n override readonly renderValueLiteral?: (\n value: JsonValue,\n side: 'output' | 'input',\n ) => string | undefined;\n\n constructor(\n private readonly descriptor: D,\n private readonly options: SqliteCodecOptions<DescriptorParams<D>>,\n ) {\n super();\n this.codecId = descriptor.codecId;\n this.traits = descriptor.traits;\n this.targetTypes = descriptor.targetTypes;\n this.paramsSchema = descriptor.paramsSchema;\n\n if (descriptor.meta !== undefined) {\n Object.defineProperty(this, 'meta', {\n value: descriptor.meta,\n enumerable: true,\n });\n }\n\n const metaFor = descriptor.metaFor;\n if (metaFor !== undefined) {\n this.metaFor = (params) => metaFor.call(descriptor, params);\n }\n\n const renderOutputType = descriptor.renderOutputType;\n if (renderOutputType !== undefined) {\n this.renderOutputType = (params) => renderOutputType.call(descriptor, params);\n }\n\n const renderInputType = descriptor.renderInputType;\n if (renderInputType !== undefined) {\n this.renderInputType = (params) => renderInputType.call(descriptor, params);\n }\n\n const renderValueLiteral = descriptor.renderValueLiteral;\n if (renderValueLiteral !== undefined) {\n this.renderValueLiteral = (value, side) => renderValueLiteral.call(descriptor, value, side);\n }\n }\n\n override get isParameterized(): boolean {\n return this.descriptor.isParameterized;\n }\n\n override readonly factory = (\n params: DescriptorParams<D>,\n ): ((ctx: CodecInstanceContext) => Codec<string, readonly CodecTrait[], unknown, unknown>) =>\n this.descriptor.factory(params);\n\n protected override jsonProjection(\n expression: ProjectionExpr,\n params: DescriptorParams<D>,\n ): ProjectionExpr {\n return this.options.jsonProjection(expression, params);\n }\n}\n\nexport function sqliteCodec<D extends AnyCodecDescriptor>(\n descriptor: D,\n options: SqliteCodecOptions<DescriptorParams<D>>,\n): AdaptedSqliteCodecDescriptor<D> {\n return blindCast<\n AdaptedSqliteCodecDescriptor<D>,\n 'the adapter delegates every ordinary descriptor member while adding the validated SQLite protocol'\n >(new SqliteCodecDescriptorAdapter(descriptor, options));\n}\n\nexport function defineSqliteCodecs<const Descriptors extends readonly AnySqliteCodecDescriptor[]>(\n descriptors: Descriptors,\n): Descriptors {\n return descriptors;\n}\n\nexport function isSqliteCodecDescriptor(value: unknown): value is AnySqliteCodecDescriptor {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'descriptorKind' in value &&\n value.descriptorKind === SQLITE_CODEC_DESCRIPTOR_KIND &&\n 'codecId' in value &&\n typeof value.codecId === 'string' &&\n 'traits' in value &&\n Array.isArray(value.traits) &&\n 'targetTypes' in value &&\n Array.isArray(value.targetTypes) &&\n value.targetTypes.every((targetType) => typeof targetType === 'string') &&\n 'paramsSchema' in value &&\n isObjectLike(value.paramsSchema) &&\n '~standard' in value.paramsSchema &&\n isObjectLike(value.paramsSchema['~standard']) &&\n 'validate' in value.paramsSchema['~standard'] &&\n typeof value.paramsSchema['~standard'].validate === 'function' &&\n 'isParameterized' in value &&\n typeof value.isParameterized === 'boolean' &&\n 'factory' in value &&\n typeof value.factory === 'function' &&\n 'projectJson' in value &&\n typeof value.projectJson === 'function'\n );\n}\n\nfunction isObjectLike(value: unknown): value is object {\n return (typeof value === 'object' && value !== null) || typeof value === 'function';\n}\n\nexport interface SqliteCodecDescriptorRegistry {\n descriptorFor(codecId: string): AnySqliteCodecDescriptor | undefined;\n values(): IterableIterator<AnySqliteCodecDescriptor>;\n}\n\nclass SqliteCodecDescriptorRegistryImpl implements SqliteCodecDescriptorRegistry {\n readonly #descriptors: ReadonlyMap<string, AnySqliteCodecDescriptor>;\n\n constructor(descriptors: ReadonlyMap<string, AnySqliteCodecDescriptor>) {\n this.#descriptors = descriptors;\n Object.freeze(this);\n }\n\n descriptorFor(codecId: string): AnySqliteCodecDescriptor | undefined {\n return this.#descriptors.get(codecId);\n }\n\n *values(): IterableIterator<AnySqliteCodecDescriptor> {\n yield* this.#descriptors.values();\n }\n}\n\nexport function buildSqliteCodecDescriptorRegistry(\n descriptors: ReadonlyArray<unknown>,\n): SqliteCodecDescriptorRegistry {\n const byId = new Map<string, AnySqliteCodecDescriptor>();\n\n for (const descriptor of descriptors) {\n if (!isSqliteCodecDescriptor(descriptor)) {\n const codecId = candidateCodecId(descriptor);\n throw structuredError(\n 'SQLITE.CODEC_DESCRIPTOR_INVALID',\n `Codec descriptor '${codecId}' is not a valid SQLite codec descriptor.`,\n {\n why: 'SQLite codec registries require the sqlite-codec discriminant and complete target descriptor methods.',\n fix: 'Extend SqliteCodecDescriptor or adapt a generic descriptor with sqliteCodec().',\n meta: { codecId },\n },\n );\n }\n\n if (byId.has(descriptor.codecId)) {\n throw structuredError(\n 'SQLITE.CODEC_DESCRIPTOR_DUPLICATE',\n `Duplicate SQLite codec descriptor id '${descriptor.codecId}'.`,\n {\n why: 'Each codecId must resolve to exactly one SQLite descriptor during registry composition.',\n fix: 'Remove the duplicate target, adapter, or extension contribution.',\n meta: { codecId: descriptor.codecId },\n },\n );\n }\n\n byId.set(descriptor.codecId, descriptor);\n }\n\n return new SqliteCodecDescriptorRegistryImpl(byId);\n}\n\nfunction candidateCodecId(value: unknown): string {\n return typeof value === 'object' &&\n value !== null &&\n 'codecId' in value &&\n typeof value.codecId === 'string'\n ? value.codecId\n : '<unknown>';\n}\n"],"mappings":";;;;AAgBA,MAAM,+BAA+B;AAOrC,IAAs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U;GAC3C,MAAM,gBACJ,mCACA,qBAAqB,QAAQ,4CAC7B;IACE,KAAK;IACL,KAAK;IACL,MAAM,EAAE,QAAQ;GAClB,CACF;EACF;EAEA,IAAI,KAAK,IAAI,WAAW,OAAO,GAC7B,MAAM,gBACJ,qCACA,yCAAyC,WAAW,QAAQ,KAC5D;GACE,KAAK;GACL,KAAK;GACL,MAAM,EAAE,SAAS,WAAW,QAAQ;EACtC,CACF;EAGF,KAAK,IAAI,WAAW,SAAS,UAAU;CACzC;CAEA,OAAO,IAAI,kCAAkC,IAAI;AACnD;AAEA,SAAS,iBAAiB,OAAwB;CAChD,OAAO,OAAO,UAAU,YACtB,UAAU,QACV,aAAa,SACb,OAAO,MAAM,YAAY,WACvB,MAAM,UACN;AACN"}
@@ -0,0 +1,3 @@
1
+ import { a as SqliteCodecOptions, c as isSqliteCodecDescriptor, i as SqliteCodecDescriptorRegistry, l as sqliteCodec, n as AnySqliteCodecDescriptor, o as buildSqliteCodecDescriptorRegistry, r as SqliteCodecDescriptor, s as defineSqliteCodecs, t as AdaptedSqliteCodecDescriptor } from "./codec-descriptor-2XsVwVp_.mjs";
2
+ import "./codec-descriptor-BlnLtrba.mjs";
3
+ export { type AdaptedSqliteCodecDescriptor, type AnySqliteCodecDescriptor, SqliteCodecDescriptor, type SqliteCodecDescriptorRegistry, type SqliteCodecOptions, buildSqliteCodecDescriptorRegistry, defineSqliteCodecs, isSqliteCodecDescriptor, sqliteCodec };
@@ -0,0 +1,2 @@
1
+ import { a as sqliteCodec, i as isSqliteCodecDescriptor, n as buildSqliteCodecDescriptorRegistry, r as defineSqliteCodecs, t as SqliteCodecDescriptor } from "./codec-descriptor-DuYu6llI.mjs";
2
+ export { SqliteCodecDescriptor, buildSqliteCodecDescriptorRegistry, defineSqliteCodecs, isSqliteCodecDescriptor, sqliteCodec };
@@ -0,0 +1,23 @@
1
+ import { t as AdaptedSqliteCodecDescriptor } from "./codec-descriptor-2XsVwVp_.mjs";
2
+ import "./codec-descriptor-BlnLtrba.mjs";
3
+ import { a as SqliteDatetimeDescriptor, c as SqliteRealDescriptor, i as SqliteBlobDescriptor, l as SqliteTextDescriptor, o as SqliteIntegerDescriptor, r as SqliteBigintDescriptor, s as SqliteJsonDescriptor } from "./codecs-D7gJOOpT.mjs";
4
+ import { ExtractCodecTypes } from "@prisma-next/sql-relational-core/ast";
5
+ //#region src/exports/codec-types.d.ts
6
+ declare const codecDescriptorMap: {
7
+ readonly char: AdaptedSqliteCodecDescriptor<import("@prisma-next/sql-relational-core/ast").SqlCharDescriptor>;
8
+ readonly varchar: AdaptedSqliteCodecDescriptor<import("@prisma-next/sql-relational-core/ast").SqlVarcharDescriptor>;
9
+ readonly int: AdaptedSqliteCodecDescriptor<import("@prisma-next/sql-relational-core/ast").SqlIntDescriptor>;
10
+ readonly float: AdaptedSqliteCodecDescriptor<import("@prisma-next/sql-relational-core/ast").SqlFloatDescriptor>;
11
+ readonly text: SqliteTextDescriptor;
12
+ readonly integer: SqliteIntegerDescriptor;
13
+ readonly real: SqliteRealDescriptor;
14
+ readonly blob: SqliteBlobDescriptor;
15
+ readonly datetime: SqliteDatetimeDescriptor;
16
+ readonly json: SqliteJsonDescriptor;
17
+ readonly bigint: SqliteBigintDescriptor;
18
+ };
19
+ type Resolve<T> = { readonly [K in keyof T]: { readonly [P in keyof T[K]]: T[K][P]; }; };
20
+ type CodecTypes = Resolve<ExtractCodecTypes<typeof codecDescriptorMap>>;
21
+ //#endregion
22
+ export { CodecTypes as t };
23
+ //# sourceMappingURL=codec-types-BjeYtMEc.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec-types-BjeYtMEc.d.mts","names":[],"sources":["../src/exports/codec-types.ts"],"mappings":";;;;;cAsBM;iBAAA;;;;;;;;;;;;KAcD,QAAQ,iBAAiB,WAAW,gBAAgB,WAAW,EAAE,KAAK,EAAE,GAAG;KAEpE,aAAa,QAAQ,yBAAyB"}
@@ -1,3 +1,3 @@
1
- import { g as JsonValue } from "./codecs-DGgo--O0.mjs";
2
- import { t as CodecTypes } from "./codec-types-CcFkbJ3o.mjs";
1
+ import { _ as JsonValue } from "./codecs-D7gJOOpT.mjs";
2
+ import { t as CodecTypes } from "./codec-types-BjeYtMEc.mjs";
3
3
  export { CodecTypes, type JsonValue };
@@ -1,2 +1 @@
1
- import "@prisma-next/sql-relational-core/ast";
2
1
  export {};
@@ -1,5 +1,7 @@
1
+ import { i as SqliteCodecDescriptorRegistry, r as SqliteCodecDescriptor } from "./codec-descriptor-2XsVwVp_.mjs";
1
2
  import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from "./codec-ids-Dof8fZfe.mjs";
2
- import { CodecCallContext, CodecDescriptorImpl, CodecImpl, CodecInstanceContext } from "@prisma-next/framework-components/codec";
3
+ import { ProjectionExpr } from "@prisma-next/sql-relational-core/ast";
4
+ import { CodecCallContext, CodecImpl, CodecInstanceContext } from "@prisma-next/framework-components/codec";
3
5
  import { JsonValue } from "@prisma-next/contract/types";
4
6
  import { CodecDescriptorRegistry } from "@prisma-next/sql-relational-core/query-lane-context";
5
7
  //#region src/core/codec-helpers.d.ts
@@ -17,7 +19,8 @@ declare class SqliteTextCodec extends CodecImpl<typeof SQLITE_TEXT_CODEC_ID, rea
17
19
  encodeJson(value: string): JsonValue;
18
20
  decodeJson(json: JsonValue): string;
19
21
  }
20
- declare class SqliteTextDescriptor extends CodecDescriptorImpl<void> {
22
+ declare class SqliteTextDescriptor extends SqliteCodecDescriptor<void> {
23
+ protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
21
24
  readonly codecId: "sqlite/text@1";
22
25
  readonly traits: readonly ["equality", "order", "textual"];
23
26
  readonly targetTypes: readonly ["text"];
@@ -31,7 +34,8 @@ declare class SqliteIntegerCodec extends CodecImpl<typeof SQLITE_INTEGER_CODEC_I
31
34
  encodeJson(value: number): JsonValue;
32
35
  decodeJson(json: JsonValue): number;
33
36
  }
34
- declare class SqliteIntegerDescriptor extends CodecDescriptorImpl<void> {
37
+ declare class SqliteIntegerDescriptor extends SqliteCodecDescriptor<void> {
38
+ protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
35
39
  readonly codecId: "sqlite/integer@1";
36
40
  readonly traits: readonly ["equality", "order", "numeric"];
37
41
  readonly targetTypes: readonly ["integer"];
@@ -45,7 +49,8 @@ declare class SqliteRealCodec extends CodecImpl<typeof SQLITE_REAL_CODEC_ID, rea
45
49
  encodeJson(value: number): JsonValue;
46
50
  decodeJson(json: JsonValue): number;
47
51
  }
48
- declare class SqliteRealDescriptor extends CodecDescriptorImpl<void> {
52
+ declare class SqliteRealDescriptor extends SqliteCodecDescriptor<void> {
53
+ protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
49
54
  readonly codecId: "sqlite/real@1";
50
55
  readonly traits: readonly ["equality", "order", "numeric"];
51
56
  readonly targetTypes: readonly ["real"];
@@ -59,7 +64,8 @@ declare class SqliteBlobCodec extends CodecImpl<typeof SQLITE_BLOB_CODEC_ID, rea
59
64
  encodeJson(value: Uint8Array): JsonValue;
60
65
  decodeJson(json: JsonValue): Uint8Array;
61
66
  }
62
- declare class SqliteBlobDescriptor extends CodecDescriptorImpl<void> {
67
+ declare class SqliteBlobDescriptor extends SqliteCodecDescriptor<void> {
68
+ protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
63
69
  readonly codecId: "sqlite/blob@1";
64
70
  readonly traits: readonly ["equality"];
65
71
  readonly targetTypes: readonly ["blob"];
@@ -74,7 +80,8 @@ declare class SqliteDatetimeCodec extends CodecImpl<typeof SQLITE_DATETIME_CODEC
74
80
  encodeJson(value: Date): JsonValue;
75
81
  decodeJson(json: JsonValue): Date;
76
82
  }
77
- declare class SqliteDatetimeDescriptor extends CodecDescriptorImpl<void> {
83
+ declare class SqliteDatetimeDescriptor extends SqliteCodecDescriptor<void> {
84
+ protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
78
85
  readonly codecId: "sqlite/datetime@1";
79
86
  readonly traits: readonly ["equality", "order"];
80
87
  readonly targetTypes: readonly ["text"];
@@ -88,7 +95,8 @@ declare class SqliteJsonCodec extends CodecImpl<typeof SQLITE_JSON_CODEC_ID, rea
88
95
  encodeJson(value: JsonValue): JsonValue;
89
96
  decodeJson(json: JsonValue): JsonValue;
90
97
  }
91
- declare class SqliteJsonDescriptor extends CodecDescriptorImpl<void> {
98
+ declare class SqliteJsonDescriptor extends SqliteCodecDescriptor<void> {
99
+ protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
92
100
  readonly codecId: "sqlite/json@1";
93
101
  readonly traits: readonly ["equality"];
94
102
  readonly targetTypes: readonly ["text"];
@@ -102,7 +110,8 @@ declare class SqliteBigintCodec extends CodecImpl<typeof SQLITE_BIGINT_CODEC_ID,
102
110
  encodeJson(value: bigint): JsonValue;
103
111
  decodeJson(json: JsonValue): bigint;
104
112
  }
105
- declare class SqliteBigintDescriptor extends CodecDescriptorImpl<void> {
113
+ declare class SqliteBigintDescriptor extends SqliteCodecDescriptor<void> {
114
+ protected jsonProjection(expression: ProjectionExpr): ProjectionExpr;
106
115
  readonly codecId: "sqlite/bigint@1";
107
116
  readonly traits: readonly ["equality", "order", "numeric"];
108
117
  readonly targetTypes: readonly ["integer"];
@@ -118,6 +127,7 @@ declare const sqliteBigintColumn: () => import("@prisma-next/framework-component
118
127
  * Public consumer surface for the sqlite codec set: the sqlite adapter and any other consumer that needs to enumerate or look up a sqlite codec by id consumes this rather than the raw descriptor array. See ADR 208.
119
128
  */
120
129
  declare const sqliteCodecRegistry: CodecDescriptorRegistry;
130
+ declare const sqliteCodecDescriptorRegistry: SqliteCodecDescriptorRegistry;
121
131
  //#endregion
122
- export { SqliteIntegerDescriptor as a, SqliteTextDescriptor as c, sqliteDatetimeColumn as d, sqliteIntegerColumn as f, JsonValue$1 as g, sqliteTextColumn as h, SqliteDatetimeDescriptor as i, sqliteBigintColumn as l, sqliteRealColumn as m, SqliteBigintDescriptor as n, SqliteJsonDescriptor as o, sqliteJsonColumn as p, SqliteBlobDescriptor as r, SqliteRealDescriptor as s, sqliteCodecRegistry as t, sqliteBlobColumn as u };
123
- //# sourceMappingURL=codecs-DGgo--O0.d.mts.map
132
+ export { JsonValue$1 as _, SqliteDatetimeDescriptor as a, SqliteRealDescriptor as c, sqliteBlobColumn as d, sqliteDatetimeColumn as f, sqliteTextColumn as g, sqliteRealColumn as h, SqliteBlobDescriptor as i, SqliteTextDescriptor as l, sqliteJsonColumn as m, sqliteCodecRegistry as n, SqliteIntegerDescriptor as o, sqliteIntegerColumn as p, SqliteBigintDescriptor as r, SqliteJsonDescriptor as s, sqliteCodecDescriptorRegistry as t, sqliteBigintColumn as u };
133
+ //# sourceMappingURL=codecs-D7gJOOpT.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codecs-D7gJOOpT.d.mts","names":[],"sources":["../src/core/codec-helpers.ts","../src/core/codecs.ts","../src/core/registry.ts"],"mappings":";;;;;;;;;;KAIY;YAKI,cAAc;aACjB;;;cCkDA,wBAAwB,iBAC5B;EAKD,OAAO,eAAe,MAAM,mBAAmB;EAG/C,OAAO,cAAc,MAAM,mBAAmB;EAGpD,WAAW,gBAAgB;EAG3B,WAAW,MAAM;;cAKN,6BAA6B;YACrB,eAAe,YAAY,iBAAiB;WAG7C;WACA;WACA;WACA,8CAAY;EACrB,YAAY,KAAK,yBAAyB;;cAOxC,0EAAgB,WAAA;cAMhB,2BAA2B,iBAC/B;EAKD,OAAO,eAAe,MAAM,mBAAmB;EAG/C,OAAO,cAAc,MAAM,mBAAmB;EAGpD,WAAW,gBAAgB;EAG3B,WAAW,MAAM;;cAKN,gCAAgC;YACxB,eAAe,YAAY,iBAAiB;WAG7C;WACA;WACA;WACA,8CAAY;EACrB,YAAY,KAAK,yBAAyB;;cAOxC,6EAAmB,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EAG7D,WAAW,gBAAgB;EAW3B,WAAW,MAAM;;cAmBN,+BAA+B;YACvB,eAAe,YAAY,iBAAiB;WAG7C;WACA;WACA;WACA,8CAAY;EACrB,YAAY,KAAK,yBAAyB;;cAOxC,4EAAkB,WAAA;;;;;;;;cC7XlB,qBAAqB;cAGrB,+BAAA"}
package/dist/codecs.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as SqliteIntegerDescriptor, c as SqliteTextDescriptor, d as sqliteDatetimeColumn, f as sqliteIntegerColumn, g as JsonValue, h as sqliteTextColumn, i as SqliteDatetimeDescriptor, l as sqliteBigintColumn, m as sqliteRealColumn, n as SqliteBigintDescriptor, o as SqliteJsonDescriptor, p as sqliteJsonColumn, r as SqliteBlobDescriptor, s as SqliteRealDescriptor, t as sqliteCodecRegistry, u as sqliteBlobColumn } from "./codecs-DGgo--O0.mjs";
2
- export { type JsonValue, type SqliteBigintDescriptor, type SqliteBlobDescriptor, type SqliteDatetimeDescriptor, type SqliteIntegerDescriptor, type SqliteJsonDescriptor, type SqliteRealDescriptor, type SqliteTextDescriptor, sqliteBigintColumn, sqliteBlobColumn, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
1
+ import { _ as JsonValue, a as SqliteDatetimeDescriptor, c as SqliteRealDescriptor, d as sqliteBlobColumn, f as sqliteDatetimeColumn, g as sqliteTextColumn, h as sqliteRealColumn, i as SqliteBlobDescriptor, l as SqliteTextDescriptor, m as sqliteJsonColumn, n as sqliteCodecRegistry, o as SqliteIntegerDescriptor, p as sqliteIntegerColumn, r as SqliteBigintDescriptor, s as SqliteJsonDescriptor, t as sqliteCodecDescriptorRegistry, u as sqliteBigintColumn } from "./codecs-D7gJOOpT.mjs";
2
+ export { type JsonValue, type SqliteBigintDescriptor, type SqliteBlobDescriptor, type SqliteDatetimeDescriptor, type SqliteIntegerDescriptor, type SqliteJsonDescriptor, type SqliteRealDescriptor, type SqliteTextDescriptor, sqliteBigintColumn, sqliteBlobColumn, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
package/dist/codecs.mjs CHANGED
@@ -1,9 +1,15 @@
1
1
  import { a as SQLITE_JSON_CODEC_ID, i as SQLITE_INTEGER_CODEC_ID, n as SQLITE_BLOB_CODEC_ID, o as SQLITE_REAL_CODEC_ID, r as SQLITE_DATETIME_CODEC_ID, s as SQLITE_TEXT_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID } from "./codec-ids-DSU7S2Li.mjs";
2
- import { n as sqliteError } from "./errors-B1JPoWDh.mjs";
2
+ import { a as sqliteCodec, n as buildSqliteCodecDescriptorRegistry, r as defineSqliteCodecs, t as SqliteCodecDescriptor } from "./codec-descriptor-DuYu6llI.mjs";
3
+ import { n as sqliteError } from "./errors-By5PHAHj.mjs";
3
4
  import { sqlCharDescriptor, sqlFloatDescriptor, sqlIntDescriptor, sqlVarcharDescriptor } from "@prisma-next/sql-relational-core/ast";
4
- import { CodecDescriptorImpl, CodecImpl, column, voidParamsSchema } from "@prisma-next/framework-components/codec";
5
+ import { CodecImpl, column, voidParamsSchema } from "@prisma-next/framework-components/codec";
5
6
  import { buildCodecDescriptorRegistry } from "@prisma-next/sql-relational-core/codec-descriptor-registry";
6
7
  //#region src/core/codecs.ts
8
+ const identityJsonProjection = (expression) => expression;
9
+ const sqliteSqlCharDescriptor = sqliteCodec(sqlCharDescriptor, { jsonProjection: identityJsonProjection });
10
+ const sqliteSqlVarcharDescriptor = sqliteCodec(sqlVarcharDescriptor, { jsonProjection: identityJsonProjection });
11
+ const sqliteSqlIntDescriptor = sqliteCodec(sqlIntDescriptor, { jsonProjection: identityJsonProjection });
12
+ const sqliteSqlFloatDescriptor = sqliteCodec(sqlFloatDescriptor, { jsonProjection: identityJsonProjection });
7
13
  var SqliteTextCodec = class extends CodecImpl {
8
14
  async encode(value, _ctx) {
9
15
  return value;
@@ -18,7 +24,10 @@ var SqliteTextCodec = class extends CodecImpl {
18
24
  return json;
19
25
  }
20
26
  };
21
- var SqliteTextDescriptor = class extends CodecDescriptorImpl {
27
+ var SqliteTextDescriptor = class extends SqliteCodecDescriptor {
28
+ jsonProjection(expression) {
29
+ return expression;
30
+ }
22
31
  codecId = SQLITE_TEXT_CODEC_ID;
23
32
  traits = [
24
33
  "equality",
@@ -47,7 +56,10 @@ var SqliteIntegerCodec = class extends CodecImpl {
47
56
  return json;
48
57
  }
49
58
  };
50
- var SqliteIntegerDescriptor = class extends CodecDescriptorImpl {
59
+ var SqliteIntegerDescriptor = class extends SqliteCodecDescriptor {
60
+ jsonProjection(expression) {
61
+ return expression;
62
+ }
51
63
  codecId = SQLITE_INTEGER_CODEC_ID;
52
64
  traits = [
53
65
  "equality",
@@ -76,7 +88,10 @@ var SqliteRealCodec = class extends CodecImpl {
76
88
  return json;
77
89
  }
78
90
  };
79
- var SqliteRealDescriptor = class extends CodecDescriptorImpl {
91
+ var SqliteRealDescriptor = class extends SqliteCodecDescriptor {
92
+ jsonProjection(expression) {
93
+ return expression;
94
+ }
80
95
  codecId = SQLITE_REAL_CODEC_ID;
81
96
  traits = [
82
97
  "equality",
@@ -109,7 +124,10 @@ var SqliteBlobCodec = class extends CodecImpl {
109
124
  return new Uint8Array(Buffer.from(json, "base64"));
110
125
  }
111
126
  };
112
- var SqliteBlobDescriptor = class extends CodecDescriptorImpl {
127
+ var SqliteBlobDescriptor = class extends SqliteCodecDescriptor {
128
+ jsonProjection(expression) {
129
+ return expression;
130
+ }
113
131
  codecId = SQLITE_BLOB_CODEC_ID;
114
132
  traits = ["equality"];
115
133
  targetTypes = ["blob"];
@@ -146,7 +164,10 @@ var SqliteDatetimeCodec = class extends CodecImpl {
146
164
  return this.parseDate(json);
147
165
  }
148
166
  };
149
- var SqliteDatetimeDescriptor = class extends CodecDescriptorImpl {
167
+ var SqliteDatetimeDescriptor = class extends SqliteCodecDescriptor {
168
+ jsonProjection(expression) {
169
+ return expression;
170
+ }
150
171
  codecId = SQLITE_DATETIME_CODEC_ID;
151
172
  traits = ["equality", "order"];
152
173
  targetTypes = ["text"];
@@ -171,7 +192,10 @@ var SqliteJsonCodec = class extends CodecImpl {
171
192
  return json;
172
193
  }
173
194
  };
174
- var SqliteJsonDescriptor = class extends CodecDescriptorImpl {
195
+ var SqliteJsonDescriptor = class extends SqliteCodecDescriptor {
196
+ jsonProjection(expression) {
197
+ return expression;
198
+ }
175
199
  codecId = SQLITE_JSON_CODEC_ID;
176
200
  traits = ["equality"];
177
201
  targetTypes = ["text"];
@@ -209,7 +233,10 @@ var SqliteBigintCodec = class extends CodecImpl {
209
233
  return BigInt(json);
210
234
  }
211
235
  };
212
- var SqliteBigintDescriptor = class extends CodecDescriptorImpl {
236
+ var SqliteBigintDescriptor = class extends SqliteCodecDescriptor {
237
+ jsonProjection(expression) {
238
+ return expression;
239
+ }
213
240
  codecId = SQLITE_BIGINT_CODEC_ID;
214
241
  traits = [
215
242
  "equality",
@@ -224,18 +251,11 @@ var SqliteBigintDescriptor = class extends CodecDescriptorImpl {
224
251
  };
225
252
  const sqliteBigintDescriptor = new SqliteBigintDescriptor();
226
253
  const sqliteBigintColumn = () => column(sqliteBigintDescriptor.factory(), sqliteBigintDescriptor.codecId, void 0, "integer");
227
- //#endregion
228
- //#region src/core/registry.ts
229
- /**
230
- * Registry of every codec descriptor shipped by `@prisma-next/target-sqlite`.
231
- *
232
- * Public consumer surface for the sqlite codec set: the sqlite adapter and any other consumer that needs to enumerate or look up a sqlite codec by id consumes this rather than the raw descriptor array. See ADR 208.
233
- */
234
- const sqliteCodecRegistry = buildCodecDescriptorRegistry([
235
- sqlCharDescriptor,
236
- sqlVarcharDescriptor,
237
- sqlIntDescriptor,
238
- sqlFloatDescriptor,
254
+ const codecDescriptors = defineSqliteCodecs([
255
+ sqliteSqlCharDescriptor,
256
+ sqliteSqlVarcharDescriptor,
257
+ sqliteSqlIntDescriptor,
258
+ sqliteSqlFloatDescriptor,
239
259
  sqliteTextDescriptor,
240
260
  sqliteIntegerDescriptor,
241
261
  sqliteRealDescriptor,
@@ -245,6 +265,15 @@ const sqliteCodecRegistry = buildCodecDescriptorRegistry([
245
265
  sqliteBigintDescriptor
246
266
  ]);
247
267
  //#endregion
248
- export { sqliteBigintColumn, sqliteBlobColumn, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
268
+ //#region src/core/registry.ts
269
+ /**
270
+ * Registry of every codec descriptor shipped by `@prisma-next/target-sqlite`.
271
+ *
272
+ * Public consumer surface for the sqlite codec set: the sqlite adapter and any other consumer that needs to enumerate or look up a sqlite codec by id consumes this rather than the raw descriptor array. See ADR 208.
273
+ */
274
+ const sqliteCodecRegistry = buildCodecDescriptorRegistry(codecDescriptors);
275
+ const sqliteCodecDescriptorRegistry = buildSqliteCodecDescriptorRegistry(codecDescriptors);
276
+ //#endregion
277
+ export { sqliteBigintColumn, sqliteBlobColumn, sqliteCodecDescriptorRegistry, sqliteCodecRegistry, sqliteDatetimeColumn, sqliteIntegerColumn, sqliteJsonColumn, sqliteRealColumn, sqliteTextColumn };
249
278
 
250
279
  //# sourceMappingURL=codecs.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.mjs","names":[],"sources":["../src/core/codecs.ts","../src/core/registry.ts"],"sourcesContent":["/**\n * Native SQLite target codecs (TML-2357). Mirrors the Postgres codec class form in `packages/3-targets/3-targets/postgres/src/core/codecs.ts`.\n *\n * Each codec ships as three artifacts:\n *\n * 1. A `SqliteXCodec` class extending {@link CodecImpl} that wraps the encode/decode/encodeJson/decodeJson conversions inline. SQLite's runtime conversions are simple enough that there is no shared helper module; the class bodies are the single source of truth. 2. A `SqliteXDescriptor` class extending {@link CodecDescriptorImpl} declaring the codec id, traits, target types, and params schema. SQLite codecs do not carry\n * `meta` (no per-target native-type meta today) and are all non-parameterized. 3. A per-codec column helper (`sqliteXColumn`) that calls `descriptor.factory()` directly and packages the result into a {@link ColumnSpec} via the framework {@link column} packager. The helper is tied to its descriptor with `satisfies ColumnHelperFor` + `ColumnHelperForStrict` (every SQLite codec's resolved type is well-defined).\n *\n * After TML-2357 this is the canonical source of SQLite codec metadata and runtime behaviour — the legacy `mkCodec` / `defineCodec` carriers (and the parallel `byScalar` / `codecDescriptorDefinitions` collection exports) retired with the deletion sweep.\n *\n * Audit: every SQLite codec is non-parameterized and parameter-stateless; `factory()` takes no params (`P = void`) and returns a fresh codec constructed solely from `this`.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type AnyCodecDescriptor,\n type CodecCallContext,\n CodecDescriptorImpl,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from '@prisma-next/framework-components/codec';\nimport {\n sqlCharDescriptor,\n sqlFloatDescriptor,\n sqlIntDescriptor,\n sqlVarcharDescriptor,\n} from '@prisma-next/sql-relational-core/ast';\nimport {\n SQLITE_BIGINT_CODEC_ID,\n SQLITE_BLOB_CODEC_ID,\n SQLITE_DATETIME_CODEC_ID,\n SQLITE_INTEGER_CODEC_ID,\n SQLITE_JSON_CODEC_ID,\n SQLITE_REAL_CODEC_ID,\n SQLITE_TEXT_CODEC_ID,\n} from './codec-ids';\nimport { sqliteError } from './errors';\n\nexport class SqliteTextCodec extends CodecImpl<\n typeof SQLITE_TEXT_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqliteTextDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_TEXT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteTextCodec {\n return () => new SqliteTextCodec(this);\n }\n}\n\nexport const sqliteTextDescriptor = new SqliteTextDescriptor();\n\nexport const sqliteTextColumn = () =>\n column(sqliteTextDescriptor.factory(), sqliteTextDescriptor.codecId, undefined, 'text');\n\nsqliteTextColumn satisfies ColumnHelperFor<SqliteTextDescriptor>;\nsqliteTextColumn satisfies ColumnHelperForStrict<SqliteTextDescriptor>;\n\nexport class SqliteIntegerCodec extends CodecImpl<\n typeof SQLITE_INTEGER_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqliteIntegerDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_INTEGER_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['integer'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteIntegerCodec {\n return () => new SqliteIntegerCodec(this);\n }\n}\n\nexport const sqliteIntegerDescriptor = new SqliteIntegerDescriptor();\n\nexport const sqliteIntegerColumn = () =>\n column(sqliteIntegerDescriptor.factory(), sqliteIntegerDescriptor.codecId, undefined, 'integer');\n\nsqliteIntegerColumn satisfies ColumnHelperFor<SqliteIntegerDescriptor>;\nsqliteIntegerColumn satisfies ColumnHelperForStrict<SqliteIntegerDescriptor>;\n\nexport class SqliteRealCodec extends CodecImpl<\n typeof SQLITE_REAL_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqliteRealDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_REAL_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['real'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteRealCodec {\n return () => new SqliteRealCodec(this);\n }\n}\n\nexport const sqliteRealDescriptor = new SqliteRealDescriptor();\n\nexport const sqliteRealColumn = () =>\n column(sqliteRealDescriptor.factory(), sqliteRealDescriptor.codecId, undefined, 'real');\n\nsqliteRealColumn satisfies ColumnHelperFor<SqliteRealDescriptor>;\nsqliteRealColumn satisfies ColumnHelperForStrict<SqliteRealDescriptor>;\n\nexport class SqliteBlobCodec extends CodecImpl<\n typeof SQLITE_BLOB_CODEC_ID,\n readonly ['equality'],\n Uint8Array,\n Uint8Array\n> {\n async encode(value: Uint8Array, _ctx: CodecCallContext): Promise<Uint8Array> {\n return value;\n }\n async decode(wire: Uint8Array, _ctx: CodecCallContext): Promise<Uint8Array> {\n return wire;\n }\n encodeJson(value: Uint8Array): JsonValue {\n return Buffer.from(value).toString('base64');\n }\n decodeJson(json: JsonValue): Uint8Array {\n if (typeof json !== 'string') {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n 'sqlite/blob@1 contract value must be a base64 string',\n {\n meta: { codecId: SQLITE_BLOB_CODEC_ID, received: typeof json },\n },\n );\n }\n return new Uint8Array(Buffer.from(json, 'base64'));\n }\n}\n\nexport class SqliteBlobDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_BLOB_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['blob'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteBlobCodec {\n return () => new SqliteBlobCodec(this);\n }\n}\n\nexport const sqliteBlobDescriptor = new SqliteBlobDescriptor();\n\nexport const sqliteBlobColumn = () =>\n column(sqliteBlobDescriptor.factory(), sqliteBlobDescriptor.codecId, undefined, 'blob');\n\nsqliteBlobColumn satisfies ColumnHelperFor<SqliteBlobDescriptor>;\nsqliteBlobColumn satisfies ColumnHelperForStrict<SqliteBlobDescriptor>;\n\nexport class SqliteDatetimeCodec extends CodecImpl<\n typeof SQLITE_DATETIME_CODEC_ID,\n readonly ['equality', 'order'],\n string,\n Date\n> {\n // Reject `Invalid Date` (NaN-time) at every decode ingress so consumers never receive a Date object whose downstream operations silently produce NaN. Mirrors the stricter ISO-8601 validation on the postgres timestamp helpers.\n private parseDate(value: string): Date {\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n `sqlite/datetime@1 value must be a valid ISO-8601 string: ${value}`,\n { meta: { codecId: SQLITE_DATETIME_CODEC_ID, received: value } },\n );\n }\n return date;\n }\n async encode(value: Date, _ctx: CodecCallContext): Promise<string> {\n return value.toISOString();\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<Date> {\n return this.parseDate(wire);\n }\n encodeJson(value: Date): JsonValue {\n return value.toISOString();\n }\n decodeJson(json: JsonValue): Date {\n if (typeof json !== 'string') {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n 'sqlite/datetime@1 contract value must be an ISO-8601 string',\n { meta: { codecId: SQLITE_DATETIME_CODEC_ID, received: typeof json } },\n );\n }\n return this.parseDate(json);\n }\n}\n\nexport class SqliteDatetimeDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_DATETIME_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteDatetimeCodec {\n return () => new SqliteDatetimeCodec(this);\n }\n}\n\nexport const sqliteDatetimeDescriptor = new SqliteDatetimeDescriptor();\n\nexport const sqliteDatetimeColumn = () =>\n column(sqliteDatetimeDescriptor.factory(), sqliteDatetimeDescriptor.codecId, undefined, 'text');\n\nsqliteDatetimeColumn satisfies ColumnHelperFor<SqliteDatetimeDescriptor>;\nsqliteDatetimeColumn satisfies ColumnHelperForStrict<SqliteDatetimeDescriptor>;\n\nexport class SqliteJsonCodec extends CodecImpl<\n typeof SQLITE_JSON_CODEC_ID,\n readonly ['equality'],\n string | JsonValue,\n JsonValue\n> {\n async encode(value: JsonValue, _ctx: CodecCallContext): Promise<string> {\n return JSON.stringify(value);\n }\n async decode(wire: string | JsonValue, _ctx: CodecCallContext): Promise<JsonValue> {\n return typeof wire === 'string' ? (JSON.parse(wire) as JsonValue) : wire;\n }\n encodeJson(value: JsonValue): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): JsonValue {\n return json;\n }\n}\n\nexport class SqliteJsonDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_JSON_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteJsonCodec {\n return () => new SqliteJsonCodec(this);\n }\n}\n\nexport const sqliteJsonDescriptor = new SqliteJsonDescriptor();\n\nexport const sqliteJsonColumn = () =>\n column(sqliteJsonDescriptor.factory(), sqliteJsonDescriptor.codecId, undefined, 'text');\n\nsqliteJsonColumn satisfies ColumnHelperFor<SqliteJsonDescriptor>;\nsqliteJsonColumn satisfies ColumnHelperForStrict<SqliteJsonDescriptor>;\n\nexport class SqliteBigintCodec extends CodecImpl<\n typeof SQLITE_BIGINT_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number | bigint,\n bigint\n> {\n async encode(value: bigint, _ctx: CodecCallContext): Promise<number | bigint> {\n return value;\n }\n async decode(wire: number | bigint, _ctx: CodecCallContext): Promise<bigint> {\n return BigInt(wire);\n }\n encodeJson(value: bigint): JsonValue {\n const number = Number(value);\n if (!Number.isSafeInteger(number)) {\n throw sqliteError(\n 'RUNTIME.ENCODE_FAILED',\n 'sqlite/bigint@1 database JSON value must be a safe integer',\n { meta: { codecId: SQLITE_BIGINT_CODEC_ID, received: String(value) } },\n );\n }\n return number;\n }\n decodeJson(json: JsonValue): bigint {\n if (typeof json !== 'number') {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n 'sqlite/bigint@1 database JSON value must be a number',\n { meta: { codecId: SQLITE_BIGINT_CODEC_ID, received: typeof json } },\n );\n }\n if (!Number.isSafeInteger(json)) {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n 'sqlite/bigint@1 database JSON value must be a safe integer',\n { meta: { codecId: SQLITE_BIGINT_CODEC_ID, received: json } },\n );\n }\n return BigInt(json);\n }\n}\n\nexport class SqliteBigintDescriptor extends CodecDescriptorImpl<void> {\n override readonly codecId = SQLITE_BIGINT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['integer'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteBigintCodec {\n return () => new SqliteBigintCodec(this);\n }\n}\n\nexport const sqliteBigintDescriptor = new SqliteBigintDescriptor();\n\nexport const sqliteBigintColumn = () =>\n column(sqliteBigintDescriptor.factory(), sqliteBigintDescriptor.codecId, undefined, 'integer');\n\nsqliteBigintColumn satisfies ColumnHelperFor<SqliteBigintDescriptor>;\nsqliteBigintColumn satisfies ColumnHelperForStrict<SqliteBigintDescriptor>;\n\nexport const codecDescriptors: readonly AnyCodecDescriptor[] = [\n sqlCharDescriptor,\n sqlVarcharDescriptor,\n sqlIntDescriptor,\n sqlFloatDescriptor,\n sqliteTextDescriptor,\n sqliteIntegerDescriptor,\n sqliteRealDescriptor,\n sqliteBlobDescriptor,\n sqliteDatetimeDescriptor,\n sqliteJsonDescriptor,\n sqliteBigintDescriptor,\n];\n","import { buildCodecDescriptorRegistry } from '@prisma-next/sql-relational-core/codec-descriptor-registry';\nimport type { CodecDescriptorRegistry } from '@prisma-next/sql-relational-core/query-lane-context';\nimport { codecDescriptors } from './codecs';\n\n/**\n * Registry of every codec descriptor shipped by `@prisma-next/target-sqlite`.\n *\n * Public consumer surface for the sqlite codec set: the sqlite adapter and any other consumer that needs to enumerate or look up a sqlite codec by id consumes this rather than the raw descriptor array. See ADR 208.\n */\nexport const sqliteCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n"],"mappings":";;;;;;AA0CA,IAAa,kBAAb,cAAqC,UAKnC;CACA,MAAM,OAAO,OAAe,MAAyC;EACnE,OAAO;CACT;CACA,MAAM,OAAO,MAAc,MAAyC;EAClE,OAAO;CACT;CACA,WAAW,OAA0B;EACnC,OAAO;CACT;CACA,WAAW,MAAyB;EAClC,OAAO;CACT;AACF;AAEA,IAAa,uBAAb,cAA0C,oBAA0B;CAClE,UAA4B;CAC5B,SAA2B;EAAC;EAAY;EAAS;CAAS;CAC1D,cAAgC,CAAC,MAAM;CACvC,eAAiC;CACjC,UAAmE;EACjE,aAAa,IAAI,gBAAgB,IAAI;CACvC;AACF;AAEA,MAAa,uBAAuB,IAAI,qBAAqB;AAE7D,MAAa,yBACX,OAAO,qBAAqB,QAAQ,GAAG,qBAAqB,SAAS,KAAA,GAAW,MAAM;AAKxF,IAAa,qBAAb,cAAwC,UAKtC;CACA,MAAM,OAAO,OAAe,MAAyC;EACnE,OAAO;CACT;CACA,MAAM,OAAO,MAAc,MAAyC;EAClE,OAAO;CACT;CACA,WAAW,OAA0B;EACnC,OAAO;CACT;CACA,WAAW,MAAyB;EAClC,OAAO;CACT;AACF;AAEA,IAAa,0BAAb,cAA6C,oBAA0B;CACrE,UAA4B;CAC5B,SAA2B;EAAC;EAAY;EAAS;CAAS;CAC1D,cAAgC,CAAC,SAAS;CAC1C,eAAiC;CACjC,UAAsE;EACpE,aAAa,IAAI,mBAAmB,IAAI;CAC1C;AACF;AAEA,MAAa,0BAA0B,IAAI,wBAA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BAA6B;CD6V7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;ACvW6B,CAAgB"}
1
+ {"version":3,"file":"codecs.mjs","names":[],"sources":["../src/core/codecs.ts","../src/core/registry.ts"],"sourcesContent":["/**\n * Native SQLite target codecs (TML-2357). Mirrors the Postgres codec class form in `packages/3-targets/3-targets/postgres/src/core/codecs.ts`.\n *\n * Each codec ships as three artifacts:\n *\n * 1. A `SqliteXCodec` class extending {@link CodecImpl} that wraps the encode/decode/encodeJson/decodeJson conversions inline. SQLite's runtime conversions are simple enough that there is no shared helper module; the class bodies are the single source of truth. 2. A `SqliteXDescriptor` class extending {@link SqliteCodecDescriptor} declaring the codec id, traits, target types, params schema, and current scalar JSON projection. SQLite codecs do not carry\n * `meta` (no per-target native-type meta today) and are all non-parameterized. 3. A per-codec column helper (`sqliteXColumn`) that calls `descriptor.factory()` directly and packages the result into a {@link ColumnSpec} via the framework {@link column} packager. The helper is tied to its descriptor with `satisfies ColumnHelperFor` + `ColumnHelperForStrict` (every SQLite codec's resolved type is well-defined).\n *\n * After TML-2357 this is the canonical source of SQLite codec metadata and runtime behaviour — the legacy `mkCodec` / `defineCodec` carriers (and the parallel `byScalar` / `codecDescriptorDefinitions` collection exports) retired with the deletion sweep.\n *\n * Audit: every SQLite codec is non-parameterized and parameter-stateless; `factory()` takes no params (`P = void`) and returns a fresh codec constructed solely from `this`.\n */\n\nimport type { JsonValue } from '@prisma-next/contract/types';\nimport {\n type CodecCallContext,\n CodecImpl,\n type CodecInstanceContext,\n type ColumnHelperFor,\n type ColumnHelperForStrict,\n column,\n voidParamsSchema,\n} from '@prisma-next/framework-components/codec';\nimport {\n type ProjectionExpr,\n sqlCharDescriptor,\n sqlFloatDescriptor,\n sqlIntDescriptor,\n sqlVarcharDescriptor,\n} from '@prisma-next/sql-relational-core/ast';\nimport { defineSqliteCodecs, SqliteCodecDescriptor, sqliteCodec } from './codec-descriptor';\nimport {\n SQLITE_BIGINT_CODEC_ID,\n SQLITE_BLOB_CODEC_ID,\n SQLITE_DATETIME_CODEC_ID,\n SQLITE_INTEGER_CODEC_ID,\n SQLITE_JSON_CODEC_ID,\n SQLITE_REAL_CODEC_ID,\n SQLITE_TEXT_CODEC_ID,\n} from './codec-ids';\nimport { sqliteError } from './errors';\n\nconst identityJsonProjection = (expression: ProjectionExpr): ProjectionExpr => expression;\n\nexport const sqliteSqlCharDescriptor = sqliteCodec(sqlCharDescriptor, {\n jsonProjection: identityJsonProjection,\n});\n\nexport const sqliteSqlVarcharDescriptor = sqliteCodec(sqlVarcharDescriptor, {\n jsonProjection: identityJsonProjection,\n});\n\nexport const sqliteSqlIntDescriptor = sqliteCodec(sqlIntDescriptor, {\n jsonProjection: identityJsonProjection,\n});\n\nexport const sqliteSqlFloatDescriptor = sqliteCodec(sqlFloatDescriptor, {\n jsonProjection: identityJsonProjection,\n});\n\nexport class SqliteTextCodec extends CodecImpl<\n typeof SQLITE_TEXT_CODEC_ID,\n readonly ['equality', 'order', 'textual'],\n string,\n string\n> {\n async encode(value: string, _ctx: CodecCallContext): Promise<string> {\n return value;\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<string> {\n return wire;\n }\n encodeJson(value: string): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): string {\n return json as string;\n }\n}\n\nexport class SqliteTextDescriptor extends SqliteCodecDescriptor<void> {\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n return expression;\n }\n override readonly codecId = SQLITE_TEXT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'textual'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteTextCodec {\n return () => new SqliteTextCodec(this);\n }\n}\n\nexport const sqliteTextDescriptor = new SqliteTextDescriptor();\n\nexport const sqliteTextColumn = () =>\n column(sqliteTextDescriptor.factory(), sqliteTextDescriptor.codecId, undefined, 'text');\n\nsqliteTextColumn satisfies ColumnHelperFor<SqliteTextDescriptor>;\nsqliteTextColumn satisfies ColumnHelperForStrict<SqliteTextDescriptor>;\n\nexport class SqliteIntegerCodec extends CodecImpl<\n typeof SQLITE_INTEGER_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqliteIntegerDescriptor extends SqliteCodecDescriptor<void> {\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n return expression;\n }\n override readonly codecId = SQLITE_INTEGER_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['integer'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteIntegerCodec {\n return () => new SqliteIntegerCodec(this);\n }\n}\n\nexport const sqliteIntegerDescriptor = new SqliteIntegerDescriptor();\n\nexport const sqliteIntegerColumn = () =>\n column(sqliteIntegerDescriptor.factory(), sqliteIntegerDescriptor.codecId, undefined, 'integer');\n\nsqliteIntegerColumn satisfies ColumnHelperFor<SqliteIntegerDescriptor>;\nsqliteIntegerColumn satisfies ColumnHelperForStrict<SqliteIntegerDescriptor>;\n\nexport class SqliteRealCodec extends CodecImpl<\n typeof SQLITE_REAL_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number,\n number\n> {\n async encode(value: number, _ctx: CodecCallContext): Promise<number> {\n return value;\n }\n async decode(wire: number, _ctx: CodecCallContext): Promise<number> {\n return wire;\n }\n encodeJson(value: number): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): number {\n return json as number;\n }\n}\n\nexport class SqliteRealDescriptor extends SqliteCodecDescriptor<void> {\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n return expression;\n }\n override readonly codecId = SQLITE_REAL_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['real'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteRealCodec {\n return () => new SqliteRealCodec(this);\n }\n}\n\nexport const sqliteRealDescriptor = new SqliteRealDescriptor();\n\nexport const sqliteRealColumn = () =>\n column(sqliteRealDescriptor.factory(), sqliteRealDescriptor.codecId, undefined, 'real');\n\nsqliteRealColumn satisfies ColumnHelperFor<SqliteRealDescriptor>;\nsqliteRealColumn satisfies ColumnHelperForStrict<SqliteRealDescriptor>;\n\nexport class SqliteBlobCodec extends CodecImpl<\n typeof SQLITE_BLOB_CODEC_ID,\n readonly ['equality'],\n Uint8Array,\n Uint8Array\n> {\n async encode(value: Uint8Array, _ctx: CodecCallContext): Promise<Uint8Array> {\n return value;\n }\n async decode(wire: Uint8Array, _ctx: CodecCallContext): Promise<Uint8Array> {\n return wire;\n }\n encodeJson(value: Uint8Array): JsonValue {\n return Buffer.from(value).toString('base64');\n }\n decodeJson(json: JsonValue): Uint8Array {\n if (typeof json !== 'string') {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n 'sqlite/blob@1 contract value must be a base64 string',\n {\n meta: { codecId: SQLITE_BLOB_CODEC_ID, received: typeof json },\n },\n );\n }\n return new Uint8Array(Buffer.from(json, 'base64'));\n }\n}\n\nexport class SqliteBlobDescriptor extends SqliteCodecDescriptor<void> {\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n return expression;\n }\n override readonly codecId = SQLITE_BLOB_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['blob'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteBlobCodec {\n return () => new SqliteBlobCodec(this);\n }\n}\n\nexport const sqliteBlobDescriptor = new SqliteBlobDescriptor();\n\nexport const sqliteBlobColumn = () =>\n column(sqliteBlobDescriptor.factory(), sqliteBlobDescriptor.codecId, undefined, 'blob');\n\nsqliteBlobColumn satisfies ColumnHelperFor<SqliteBlobDescriptor>;\nsqliteBlobColumn satisfies ColumnHelperForStrict<SqliteBlobDescriptor>;\n\nexport class SqliteDatetimeCodec extends CodecImpl<\n typeof SQLITE_DATETIME_CODEC_ID,\n readonly ['equality', 'order'],\n string,\n Date\n> {\n // Reject `Invalid Date` (NaN-time) at every decode ingress so consumers never receive a Date object whose downstream operations silently produce NaN. Mirrors the stricter ISO-8601 validation on the postgres timestamp helpers.\n private parseDate(value: string): Date {\n const date = new Date(value);\n if (Number.isNaN(date.getTime())) {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n `sqlite/datetime@1 value must be a valid ISO-8601 string: ${value}`,\n { meta: { codecId: SQLITE_DATETIME_CODEC_ID, received: value } },\n );\n }\n return date;\n }\n async encode(value: Date, _ctx: CodecCallContext): Promise<string> {\n return value.toISOString();\n }\n async decode(wire: string, _ctx: CodecCallContext): Promise<Date> {\n return this.parseDate(wire);\n }\n encodeJson(value: Date): JsonValue {\n return value.toISOString();\n }\n decodeJson(json: JsonValue): Date {\n if (typeof json !== 'string') {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n 'sqlite/datetime@1 contract value must be an ISO-8601 string',\n { meta: { codecId: SQLITE_DATETIME_CODEC_ID, received: typeof json } },\n );\n }\n return this.parseDate(json);\n }\n}\n\nexport class SqliteDatetimeDescriptor extends SqliteCodecDescriptor<void> {\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n return expression;\n }\n override readonly codecId = SQLITE_DATETIME_CODEC_ID;\n override readonly traits = ['equality', 'order'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteDatetimeCodec {\n return () => new SqliteDatetimeCodec(this);\n }\n}\n\nexport const sqliteDatetimeDescriptor = new SqliteDatetimeDescriptor();\n\nexport const sqliteDatetimeColumn = () =>\n column(sqliteDatetimeDescriptor.factory(), sqliteDatetimeDescriptor.codecId, undefined, 'text');\n\nsqliteDatetimeColumn satisfies ColumnHelperFor<SqliteDatetimeDescriptor>;\nsqliteDatetimeColumn satisfies ColumnHelperForStrict<SqliteDatetimeDescriptor>;\n\nexport class SqliteJsonCodec extends CodecImpl<\n typeof SQLITE_JSON_CODEC_ID,\n readonly ['equality'],\n string | JsonValue,\n JsonValue\n> {\n async encode(value: JsonValue, _ctx: CodecCallContext): Promise<string> {\n return JSON.stringify(value);\n }\n async decode(wire: string | JsonValue, _ctx: CodecCallContext): Promise<JsonValue> {\n return typeof wire === 'string' ? (JSON.parse(wire) as JsonValue) : wire;\n }\n encodeJson(value: JsonValue): JsonValue {\n return value;\n }\n decodeJson(json: JsonValue): JsonValue {\n return json;\n }\n}\n\nexport class SqliteJsonDescriptor extends SqliteCodecDescriptor<void> {\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n return expression;\n }\n override readonly codecId = SQLITE_JSON_CODEC_ID;\n override readonly traits = ['equality'] as const;\n override readonly targetTypes = ['text'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteJsonCodec {\n return () => new SqliteJsonCodec(this);\n }\n}\n\nexport const sqliteJsonDescriptor = new SqliteJsonDescriptor();\n\nexport const sqliteJsonColumn = () =>\n column(sqliteJsonDescriptor.factory(), sqliteJsonDescriptor.codecId, undefined, 'text');\n\nsqliteJsonColumn satisfies ColumnHelperFor<SqliteJsonDescriptor>;\nsqliteJsonColumn satisfies ColumnHelperForStrict<SqliteJsonDescriptor>;\n\nexport class SqliteBigintCodec extends CodecImpl<\n typeof SQLITE_BIGINT_CODEC_ID,\n readonly ['equality', 'order', 'numeric'],\n number | bigint,\n bigint\n> {\n async encode(value: bigint, _ctx: CodecCallContext): Promise<number | bigint> {\n return value;\n }\n async decode(wire: number | bigint, _ctx: CodecCallContext): Promise<bigint> {\n return BigInt(wire);\n }\n encodeJson(value: bigint): JsonValue {\n const number = Number(value);\n if (!Number.isSafeInteger(number)) {\n throw sqliteError(\n 'RUNTIME.ENCODE_FAILED',\n 'sqlite/bigint@1 database JSON value must be a safe integer',\n { meta: { codecId: SQLITE_BIGINT_CODEC_ID, received: String(value) } },\n );\n }\n return number;\n }\n decodeJson(json: JsonValue): bigint {\n if (typeof json !== 'number') {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n 'sqlite/bigint@1 database JSON value must be a number',\n { meta: { codecId: SQLITE_BIGINT_CODEC_ID, received: typeof json } },\n );\n }\n if (!Number.isSafeInteger(json)) {\n throw sqliteError(\n 'RUNTIME.DECODE_FAILED',\n 'sqlite/bigint@1 database JSON value must be a safe integer',\n { meta: { codecId: SQLITE_BIGINT_CODEC_ID, received: json } },\n );\n }\n return BigInt(json);\n }\n}\n\nexport class SqliteBigintDescriptor extends SqliteCodecDescriptor<void> {\n protected override jsonProjection(expression: ProjectionExpr): ProjectionExpr {\n return expression;\n }\n override readonly codecId = SQLITE_BIGINT_CODEC_ID;\n override readonly traits = ['equality', 'order', 'numeric'] as const;\n override readonly targetTypes = ['integer'] as const;\n override readonly paramsSchema = voidParamsSchema;\n override factory(): (ctx: CodecInstanceContext) => SqliteBigintCodec {\n return () => new SqliteBigintCodec(this);\n }\n}\n\nexport const sqliteBigintDescriptor = new SqliteBigintDescriptor();\n\nexport const sqliteBigintColumn = () =>\n column(sqliteBigintDescriptor.factory(), sqliteBigintDescriptor.codecId, undefined, 'integer');\n\nsqliteBigintColumn satisfies ColumnHelperFor<SqliteBigintDescriptor>;\nsqliteBigintColumn satisfies ColumnHelperForStrict<SqliteBigintDescriptor>;\n\nexport const codecDescriptors = defineSqliteCodecs([\n sqliteSqlCharDescriptor,\n sqliteSqlVarcharDescriptor,\n sqliteSqlIntDescriptor,\n sqliteSqlFloatDescriptor,\n sqliteTextDescriptor,\n sqliteIntegerDescriptor,\n sqliteRealDescriptor,\n sqliteBlobDescriptor,\n sqliteDatetimeDescriptor,\n sqliteJsonDescriptor,\n sqliteBigintDescriptor,\n]);\n","import { buildCodecDescriptorRegistry } from '@prisma-next/sql-relational-core/codec-descriptor-registry';\nimport type { CodecDescriptorRegistry } from '@prisma-next/sql-relational-core/query-lane-context';\nimport { buildSqliteCodecDescriptorRegistry } from './codec-descriptor';\nimport { codecDescriptors } from './codecs';\n\n/**\n * Registry of every codec descriptor shipped by `@prisma-next/target-sqlite`.\n *\n * Public consumer surface for the sqlite codec set: the sqlite adapter and any other consumer that needs to enumerate or look up a sqlite codec by id consumes this rather than the raw descriptor array. See ADR 208.\n */\nexport const sqliteCodecRegistry: CodecDescriptorRegistry =\n buildCodecDescriptorRegistry(codecDescriptors);\n\nexport const sqliteCodecDescriptorRegistry = buildSqliteCodecDescriptorRegistry(codecDescriptors);\n"],"mappings":";;;;;;;AA0CA,MAAM,0BAA0B,eAA+C;AAE/E,MAAa,0BAA0B,YAAY,mBAAmB,EACpE,gBAAgB,uBAClB,CAAC;AAED,MAAa,6BAA6B,YAAY,sBAAsB,EAC1E,gBAAgB,uBAClB,CAAC;AAED,MAAa,yBAAyB,YAAY,kBAAkB,EAClE,gBAAgB,uBAClB,CAAC;AAED,MAAa,2BAA2B,YAAY,oBAAoB,EACtE,gBAAgB,uBAClB,CAAC;AAED,IAAa,kBAAb,cAAqC,UAKnC;CACA,MAAM,OAAO,OAAe,MAAyC;EACnE,OAAO;CACT;CACA,MAAM,OAAO,MAAc,MAAyC;EAClE,OAAO;CACT;CACA,WAAW,OAA0B;EACnC,OAAO;CACT;CACA,WAAW,MAAyB;EAClC,OAAO;CACT;AACF;AAEA,IAAa,uBAAb,cAA0C,sBAA4B;CACpE,eAAkC,YAA4C;EAC5E,OAAO;CACT;CACA,UAA4B;CAC5B,SAA2B;EAAC;EAAY;EAAS;CAAS;CAC1D,cAAgC,CAAC,MAAM;CACvC,eAAiC;CACjC,UAAmE;EACjE,aAAa,IAAI,gBAAgB,IAAI;CACvC;AACF;AAEA,MAAa,uBAAuB,IAAI,qBAAqB;AAE7D,MAAa,yBAC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,OAAO,KAAK;EAAE,EAAE,CACvE;EAEF,OAAO;CACT;CACA,WAAW,MAAyB;EAClC,IAAI,OAAO,SAAS,UAClB,MAAM,YACJ,yBACA,wDACA,EAAE,MAAM;GAAE,SAAS;GAAwB,UAAU,OAAO;EAAK,EAAE,CACrE;EAEF,IAAI,CAAC,OAAO,cAAc,IAAI,GAC5B,MAAM,YACJ,yBACA,8DACA,EAAE,MAAM;GAAE,SAAS;GAAwB,UAAU;EAAK,EAAE,CAC9D;EAEF,OAAO,OAAO,IAAI;CACpB;AACF;AAEA,IAAa,yBAAb,cAA4C,sBAA4B;CACtE,eAAkC,YAA4C;EAC5E,OAAO;CACT;CACA,UAA4B;CAC5B,SAA2B;EAAC;EAAY;EAAS;CAAS;CAC1D,cAAgC,CAAC,SAAS;CAC1C,eAAiC;CACjC,UAAqE;EACnE,aAAa,IAAI,kBAAkB,IAAI;CACzC;AACF;AAEA,MAAa,yBAAyB,IAAI,uBAAuB;AAEjE,MAAa,2BACX,OAAO,uBAAuB,QAAQ,GAAG,uBAAuB,SAAS,KAAA,GAAW,SAAS;AAK/F,MAAa,mBAAmB,mBAAmB;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;AC/YD,MAAa,sBACX,6BAA6B,gBAAgB;AAE/C,MAAa,gCAAgC,mCAAmC,gBAAgB"}
package/dist/control.mjs CHANGED
@@ -1,13 +1,13 @@
1
- import { n as sqliteError } from "./errors-B1JPoWDh.mjs";
1
+ import { n as sqliteError } from "./errors-By5PHAHj.mjs";
2
2
  import { t as sqliteTargetDescriptorMeta } from "./descriptor-meta-BPrgV878.mjs";
3
- import { a as verifySqliteDatabaseSchema, i as sqliteContractToSchema, n as createSqliteMigrationPlanner, r as diffSqliteSchema } from "./planner-ByBNEpyf.mjs";
3
+ import { a as verifySqliteDatabaseSchema, i as sqliteContractToSchema, n as createSqliteMigrationPlanner, r as diffSqliteSchema } from "./planner-CuM2U40p.mjs";
4
4
  import { r as MARKER_TABLE_NAME } from "./control-tables-D_o8dKRB.mjs";
5
- import { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from "./sqlite-contract-view-BKHdFV5Y.mjs";
5
+ import { i as sqliteCreateNamespace, n as SqliteContractSerializer, r as SqliteUnboundDatabase } from "./sqlite-contract-view-C9DFAHHV.mjs";
6
+ import { blindCast } from "@prisma-next/utils/casts";
6
7
  import { SqlStorage } from "@prisma-next/sql-contract/types";
7
8
  import { relationalNodeEntityKind, relationalNodeGranularity } from "@prisma-next/sql-schema-ir/types";
8
9
  import { runnerFailure, runnerSuccess } from "@prisma-next/family-sql/control";
9
10
  import { APP_SPACE_ID } from "@prisma-next/framework-components/control";
10
- import { blindCast } from "@prisma-next/utils/casts";
11
11
  import { ifDefined } from "@prisma-next/utils/defined";
12
12
  import { notOk, ok, okVoid } from "@prisma-next/utils/result";
13
13
  import { InternalError } from "@prisma-next/utils/internal-error";
@@ -1,5 +1,5 @@
1
- import { CliStructuredError } from "@prisma-next/errors/control";
2
1
  import { structuredError } from "@prisma-next/utils/structured-error";
2
+ import { CliStructuredError } from "@prisma-next/errors/control";
3
3
  //#region src/core/errors.ts
4
4
  function sqliteError(code, message, options) {
5
5
  return structuredError(code, message, options);
@@ -35,4 +35,4 @@ function errorSqliteMigrationStackMissing(operation) {
35
35
  //#endregion
36
36
  export { sqliteError as n, errorSqliteMigrationStackMissing as t };
37
37
 
38
- //# sourceMappingURL=errors-B1JPoWDh.mjs.map
38
+ //# sourceMappingURL=errors-By5PHAHj.mjs.map