@prisma-next/family-sql 0.11.0-dev.43 → 0.11.0-dev.45
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/control.mjs +1 -1
- package/dist/ir.d.mts +1 -1
- package/dist/ir.d.mts.map +1 -1
- package/dist/ir.mjs +1 -1
- package/dist/{sql-contract-serializer-VVoSAnYg.mjs → sql-contract-serializer-BXa6wp51.mjs} +17 -7
- package/dist/sql-contract-serializer-BXa6wp51.mjs.map +1 -0
- package/package.json +21 -21
- package/src/core/ir/sql-contract-serializer-base.ts +40 -10
- package/dist/sql-contract-serializer-VVoSAnYg.mjs.map +0 -1
package/dist/control.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-F4JpCJl7.mjs";
|
|
2
|
-
import { t as SqlContractSerializer } from "./sql-contract-serializer-
|
|
2
|
+
import { t as SqlContractSerializer } from "./sql-contract-serializer-BXa6wp51.mjs";
|
|
3
3
|
import { a as extractCodecControlHooks, t as verifySqlSchema } from "./verify-sql-schema-DcP55TWb.mjs";
|
|
4
4
|
import { t as collectSupportedCodecTypeIds } from "./verify-Crewz6hG.mjs";
|
|
5
5
|
import { n as temporalAuthoringPresets, r as timestampNowControlDescriptor } from "./timestamp-now-generator-r7BP5n3l.mjs";
|
package/dist/ir.d.mts
CHANGED
|
@@ -39,7 +39,7 @@ declare abstract class SqlContractSerializerBase<TContract extends Contract<SqlS
|
|
|
39
39
|
serializeContract(contract: TContract): JsonObject;
|
|
40
40
|
protected parseSqlContractStructure(json: unknown): Contract<SqlStorage>;
|
|
41
41
|
protected hydrateSqlStorage(validated: Contract<SqlStorage>): Contract<SqlStorage>;
|
|
42
|
-
protected hydrateSqlNamespaceMap(namespaces: Readonly<Record<string, Namespace | Record<string, unknown>>>): Readonly<Record<string, Namespace
|
|
42
|
+
protected hydrateSqlNamespaceMap(namespaces: Readonly<Record<string, Namespace | Record<string, unknown>>>): Readonly<Record<string, Namespace>>;
|
|
43
43
|
protected hydrateSqlNamespaceEntry(nsId: string, raw: Namespace | Record<string, unknown>): Namespace | SqlNamespaceTablesInput;
|
|
44
44
|
protected hydrateStorageTypeEntry(entry: SqlStorageTypeEntry): SqlStorageTypeEntry;
|
|
45
45
|
protected constructTargetContract(hydrated: Contract<SqlStorage>): TContract;
|
package/dist/ir.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ir.d.mts","names":[],"sources":["../src/core/ir/sql-contract-serializer-base.ts","../src/core/ir/sql-contract-serializer.ts","../src/core/ir/sql-schema-verifier-base.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"ir.d.mts","names":[],"sources":["../src/core/ir/sql-contract-serializer-base.ts","../src/core/ir/sql-contract-serializer.ts","../src/core/ir/sql-schema-verifier-base.ts"],"mappings":";;;;;;;;KAuCY,yBAAA,IAA6B,KAAA,cAAmB,mBAAmB;;AAA/E;;;;AAA+E;AA0B/E;;;;;;;;;;;;;;;;;;uBAAsB,yBAAA,mBAA4C,QAAA,CAAS,UAAA,cAC9D,kBAAA,CAAmB,SAAA;EAAA,iBAKX,kBAAA;EAAA,iBAHF,cAAA;cAGE,kBAAA,GAAoB,WAAA,SAAoB,yBAAA,GACzD,kBAAA,GAAqB,WAAA,SAAoB,IAAA;EAW3C,mBAAA,WAA8B,SAAA,GAAY,SAAA,CAAA,CAAW,IAAA,YAAgB,CAAA;EAMrE,iBAAA,CAAkB,QAAA,EAAU,SAAA,GAAY,UAAA;EAAA,UAI9B,yBAAA,CAA0B,IAAA,YAAgB,QAAA,CAAS,UAAA;EAAA,UAOnD,iBAAA,CAAkB,SAAA,EAAW,QAAA,CAAS,UAAA,IAAc,QAAA,CAAS,UAAA;EAAA,UA0C7D,sBAAA,CACR,UAAA,EAAY,QAAA,CAAS,MAAA,SAAe,SAAA,GAAY,MAAA,sBAC/C,QAAA,CAAS,MAAA,SAAe,SAAA;EAAA,UAcjB,wBAAA,CACR,IAAA,UACA,GAAA,EAAK,SAAA,GAAY,MAAA,oBAChB,SAAA,GAAY,uBAAA;EAAA,UAsEL,uBAAA,CAAwB,KAAA,EAAO,mBAAA,GAAsB,mBAAA;EAAA,UAerD,uBAAA,CAAwB,QAAA,EAAU,QAAA,CAAS,UAAA,IAAc,SAAA;AAAA;;;;;;;;AA/MrE;;;;cC1Ba,qBAAA,SAA8B,yBAAA,CAA0B,QAAA,CAAS,UAAA;;;;;;;;;;;;AD0B9E;;;;AAA+E;AA0B/E;;;;;;;;uBEtCsB,qBAAA,gCACT,cAAA,CAAe,SAAA,EAAW,OAAA;EAErC,YAAA,CAAa,OAAA,EAAS,mBAAA,CAAoB,SAAA,EAAW,OAAA,IAAW,kBAAA;EFqDlC;;;;;;EAAA,mBExCX,qBAAA,CACjB,OAAA,EAAS,mBAAA,CAAoB,SAAA,EAAW,OAAA,aAC9B,WAAA;EFuDoC;;;;;EAAA,mBEhD7B,sBAAA,CACjB,OAAA,EAAS,mBAAA,CAAoB,SAAA,EAAW,OAAA,aAC9B,WAAA;AAAA"}
|
package/dist/ir.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as SqlContractSerializerBase, t as SqlContractSerializer } from "./sql-contract-serializer-
|
|
1
|
+
import { n as SqlContractSerializerBase, t as SqlContractSerializer } from "./sql-contract-serializer-BXa6wp51.mjs";
|
|
2
2
|
//#region src/core/ir/sql-schema-verifier-base.ts
|
|
3
3
|
/**
|
|
4
4
|
* SQL family `SchemaVerifier` abstract base. Centralises the SQL-shared
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ifDefined } from "@prisma-next/utils/defined";
|
|
1
2
|
import { ContractValidationError } from "@prisma-next/contract/contract-validation-error";
|
|
2
|
-
import { NamespaceBase } from "@prisma-next/framework-components/ir";
|
|
3
|
-
import { SqlStorage, StorageTable } from "@prisma-next/sql-contract/types";
|
|
3
|
+
import { NamespaceBase, UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
|
|
4
|
+
import { SqlStorage, SqlUnboundNamespace, StorageTable, buildSqlNamespace } from "@prisma-next/sql-contract/types";
|
|
4
5
|
import { createSqlContractSchema, validateSqlContractFully } from "@prisma-next/sql-contract/validators";
|
|
6
|
+
import { blindCast } from "@prisma-next/utils/casts";
|
|
5
7
|
import { type } from "arktype";
|
|
6
8
|
//#region src/core/ir/sql-contract-serializer-base.ts
|
|
7
9
|
const NamespaceRawSchema = type({
|
|
@@ -58,18 +60,26 @@ var SqlContractSerializerBase = class {
|
|
|
58
60
|
const types = validated.storage.types;
|
|
59
61
|
const hydratedTypes = types !== void 0 ? Object.fromEntries(Object.entries(types).map(([name, entry]) => [name, this.hydrateStorageTypeEntry(entry)])) : void 0;
|
|
60
62
|
const rawNamespaces = validated.storage.namespaces;
|
|
61
|
-
|
|
63
|
+
if (rawNamespaces === void 0) throw new ContractValidationError("Contract storage.namespaces is required after structural validation", "structural");
|
|
64
|
+
const hydratedNamespaces = this.hydrateSqlNamespaceMap(rawNamespaces);
|
|
65
|
+
const unbound = hydratedNamespaces[UNBOUND_NAMESPACE_ID] ?? SqlUnboundNamespace.instance;
|
|
62
66
|
return {
|
|
63
67
|
...validated,
|
|
64
68
|
storage: new SqlStorage({
|
|
65
69
|
storageHash: validated.storage.storageHash,
|
|
66
|
-
...
|
|
67
|
-
|
|
70
|
+
...ifDefined("types", hydratedTypes),
|
|
71
|
+
namespaces: blindCast({
|
|
72
|
+
...hydratedNamespaces,
|
|
73
|
+
[UNBOUND_NAMESPACE_ID]: unbound
|
|
74
|
+
})
|
|
68
75
|
})
|
|
69
76
|
};
|
|
70
77
|
}
|
|
71
78
|
hydrateSqlNamespaceMap(namespaces) {
|
|
72
|
-
return Object.fromEntries(Object.entries(namespaces).map(([nsId,
|
|
79
|
+
return Object.fromEntries(Object.entries(namespaces).map(([nsId, namespaceEntryRaw]) => {
|
|
80
|
+
const namespaceHydrated = this.hydrateSqlNamespaceEntry(nsId, namespaceEntryRaw);
|
|
81
|
+
return [nsId, namespaceHydrated instanceof NamespaceBase ? namespaceHydrated : buildSqlNamespace(namespaceHydrated)];
|
|
82
|
+
}));
|
|
73
83
|
}
|
|
74
84
|
hydrateSqlNamespaceEntry(nsId, raw) {
|
|
75
85
|
if (raw instanceof NamespaceBase) return raw;
|
|
@@ -144,4 +154,4 @@ var SqlContractSerializer = class extends SqlContractSerializerBase {
|
|
|
144
154
|
//#endregion
|
|
145
155
|
export { SqlContractSerializerBase as n, SqlContractSerializer as t };
|
|
146
156
|
|
|
147
|
-
//# sourceMappingURL=sql-contract-serializer-
|
|
157
|
+
//# sourceMappingURL=sql-contract-serializer-BXa6wp51.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-contract-serializer-BXa6wp51.mjs","names":[],"sources":["../src/core/ir/sql-contract-serializer-base.ts","../src/core/ir/sql-contract-serializer.ts"],"sourcesContent":["import { ContractValidationError } from '@prisma-next/contract/contract-validation-error';\nimport type { Contract } from '@prisma-next/contract/types';\nimport type { ContractSerializer } from '@prisma-next/framework-components/control';\nimport {\n type Namespace,\n NamespaceBase,\n UNBOUND_NAMESPACE_ID,\n} from '@prisma-next/framework-components/ir';\nimport {\n buildSqlNamespace,\n type SqlNamespaceTablesInput,\n SqlStorage,\n type SqlStorageInput,\n type SqlStorageTypeEntry,\n SqlUnboundNamespace,\n StorageTable,\n type StorageTableInput,\n} from '@prisma-next/sql-contract/types';\nimport {\n createSqlContractSchema,\n validateSqlContractFully,\n} from '@prisma-next/sql-contract/validators';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { JsonObject } from '@prisma-next/utils/json';\nimport { type Type, type } from 'arktype';\n\nconst NamespaceRawSchema = type({\n id: 'string',\n 'kind?': 'string',\n // Undeclared keys (`tables`, `enum`, and any pack-contributed slot maps)\n // intentionally pass through; the slot loop below iterates them by name.\n '+': 'ignore',\n});\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport type SqlEntityHydrationFactory = (entry: unknown) => SqlStorageTypeEntry;\n\n/**\n * SQL family `ContractSerializer` abstract base. Carries the SQL-shared\n * deserialization pipeline:\n *\n * 1. `parseSqlContractStructure` validates the on-disk JSON envelope\n * against the SQL contract arktype schema (`validateSqlContractFully`)\n * and returns the validated flat-data shape.\n * 2. `hydrateSqlStorage` walks the validated `storage` subtree and\n * constructs the family-shared SQL Contract IR class hierarchy\n * (`SqlStorage` -> `StorageTable` -> `StorageColumn` / `PrimaryKey`\n * / …). The rest of the contract envelope is JSON-clean primitive\n * data and passes through unchanged.\n * 3. `constructTargetContract` is the target-specific extension hook;\n * defaults to identity. Targets that need to attach target-only\n * fields (e.g. target-specific derived storage fields) override it.\n *\n * Default `serializeContract` is identity over the contract — concrete\n * SQL targets ship JSON-clean class instances, so the contract value\n * can be stringified directly. The non-enumerable family-level `kind`\n * discriminator on `SqlNode` instances stays out of the persisted\n * envelope automatically. Targets that need to canonicalize on the way\n * out (key ordering, dropping computed-only fields) override\n * `serializeContract` directly.\n */\nexport abstract class SqlContractSerializerBase<TContract extends Contract<SqlStorage>>\n implements ContractSerializer<TContract>\n{\n private readonly contractSchema: Type<unknown> | undefined;\n\n constructor(\n private readonly entityTypeRegistry: ReadonlyMap<string, SqlEntityHydrationFactory> = new Map(),\n validatorFragments?: ReadonlyMap<string, Type<unknown>>,\n ) {\n // Only build a fragments-aware contract schema when pack contributions\n // exist. The cached module-level default in `validators.ts` covers the\n // no-contributions case and avoids per-instance schema compilation.\n this.contractSchema =\n validatorFragments !== undefined && validatorFragments.size > 0\n ? createSqlContractSchema(validatorFragments)\n : undefined;\n }\n\n deserializeContract<T extends TContract = TContract>(json: unknown): T {\n const validated = this.parseSqlContractStructure(json);\n const hydrated = this.hydrateSqlStorage(validated);\n return this.constructTargetContract(hydrated) as T;\n }\n\n serializeContract(contract: TContract): JsonObject {\n return contract as unknown as JsonObject;\n }\n\n protected parseSqlContractStructure(json: unknown): Contract<SqlStorage> {\n return validateSqlContractFully<Contract<SqlStorage>>(\n json,\n this.contractSchema !== undefined ? { contractSchema: this.contractSchema } : undefined,\n );\n }\n\n protected hydrateSqlStorage(validated: Contract<SqlStorage>): Contract<SqlStorage> {\n const types = validated.storage.types;\n const hydratedTypes =\n types !== undefined\n ? Object.fromEntries(\n Object.entries(types).map(([name, entry]) => [\n name,\n this.hydrateStorageTypeEntry(entry),\n ]),\n )\n : undefined;\n\n const rawNamespaces = validated.storage.namespaces;\n if (rawNamespaces === undefined) {\n throw new ContractValidationError(\n 'Contract storage.namespaces is required after structural validation',\n 'structural',\n );\n }\n const hydratedNamespaces = this.hydrateSqlNamespaceMap(rawNamespaces);\n // Keep the `__unbound__` brand sound: a deserialized contract may declare\n // only named namespaces (cross-namespace contracts omit the late-bound\n // slot), so inject the family unbound singleton when absent rather than\n // asserting a shape that isn't present.\n const unbound = hydratedNamespaces[UNBOUND_NAMESPACE_ID] ?? SqlUnboundNamespace.instance;\n\n return {\n ...validated,\n storage: new SqlStorage({\n storageHash: validated.storage.storageHash,\n ...ifDefined('types', hydratedTypes),\n // `__unbound__` is guaranteed present above; the residual narrowing is\n // the family invariant that hydrated SQL namespaces are `SqlNamespace`\n // instances (target/family classes, not the wider framework `Namespace`).\n namespaces: blindCast<\n SqlStorageInput['namespaces'],\n 'hydrated SQL namespaces are SqlNamespace instances; __unbound__ guaranteed present (injected above)'\n >({ ...hydratedNamespaces, [UNBOUND_NAMESPACE_ID]: unbound }),\n }),\n };\n }\n\n protected hydrateSqlNamespaceMap(\n namespaces: Readonly<Record<string, Namespace | Record<string, unknown>>>,\n ): Readonly<Record<string, Namespace>> {\n return Object.fromEntries(\n Object.entries(namespaces).map(([nsId, namespaceEntryRaw]) => {\n // Raw entries passed structural validation; hydrate materialises family IR class instances.\n const namespaceHydrated = this.hydrateSqlNamespaceEntry(nsId, namespaceEntryRaw);\n const namespaceMaterialised =\n namespaceHydrated instanceof NamespaceBase\n ? namespaceHydrated\n : buildSqlNamespace(namespaceHydrated);\n return [nsId, namespaceMaterialised];\n }),\n );\n }\n\n protected hydrateSqlNamespaceEntry(\n nsId: string,\n raw: Namespace | Record<string, unknown>,\n ): Namespace | SqlNamespaceTablesInput {\n if (raw instanceof NamespaceBase) {\n return raw;\n }\n const rawRecord = isPlainRecord(raw) ? raw : {};\n const id = typeof rawRecord['id'] === 'string' ? rawRecord['id'] : nsId;\n const parsed = NamespaceRawSchema({ ...rawRecord, id });\n if (parsed instanceof type.errors) {\n const messages = parsed.map((p: { message: string }) => p.message).join('; ');\n throw new ContractValidationError(`Namespace hydration failed: ${messages}`, 'structural');\n }\n const result: Record<string, unknown> = { id };\n\n for (const [propertyKey, slotValue] of Object.entries(parsed)) {\n if (propertyKey === 'id') continue;\n if (slotValue === null || typeof slotValue !== 'object') continue;\n\n if (propertyKey === 'tables') {\n result['tables'] = Object.fromEntries(\n Object.entries(slotValue as Record<string, unknown>).map(([tableName, table]) => [\n tableName,\n table instanceof StorageTable ? table : new StorageTable(table as StorageTableInput),\n ]),\n );\n continue;\n }\n\n const hydratedSlot = Object.fromEntries(\n Object.entries(slotValue as Record<string, unknown>).map(([entryName, entry]) => {\n if (typeof entry !== 'object' || entry === null) {\n return [entryName, entry];\n }\n const kind = (entry as { kind?: unknown }).kind;\n if (typeof kind === 'string') {\n const factory = this.entityTypeRegistry.get(kind);\n if (factory !== undefined) {\n return [entryName, factory(entry)];\n }\n }\n return [entryName, entry];\n }),\n );\n if (Object.keys(hydratedSlot).length > 0) {\n result[propertyKey] = hydratedSlot;\n }\n }\n\n const enumRaw = rawRecord['enum'];\n if (enumRaw !== undefined && typeof enumRaw === 'object' && enumRaw !== null) {\n for (const entry of Object.values(enumRaw as Record<string, unknown>)) {\n if (typeof entry !== 'object' || entry === null) continue;\n const kind = (entry as { kind?: unknown }).kind;\n if (typeof kind === 'string' && this.entityTypeRegistry.get(kind) === undefined) {\n throw new ContractValidationError(\n `Entry kind '${kind}' has no registered hydration factory.`,\n 'structural',\n );\n }\n }\n }\n\n const tables = (result['tables'] ?? {}) as Record<string, StorageTable>;\n const enumSlot = result['enum'] as NonNullable<SqlNamespaceTablesInput['enum']> | undefined;\n return {\n ...result,\n tables,\n ...(enumSlot !== undefined ? { enum: enumSlot } : {}),\n } as SqlNamespaceTablesInput;\n }\n\n protected hydrateStorageTypeEntry(entry: SqlStorageTypeEntry): SqlStorageTypeEntry {\n if (typeof entry !== 'object' || entry === null) {\n return entry;\n }\n const kind = (entry as { kind?: unknown }).kind;\n if (typeof kind !== 'string') {\n return entry;\n }\n const factory = this.entityTypeRegistry.get(kind);\n if (factory === undefined) {\n return entry;\n }\n return factory(entry);\n }\n\n protected constructTargetContract(hydrated: Contract<SqlStorage>): TContract {\n return hydrated as TContract;\n }\n}\n","import type { Contract } from '@prisma-next/contract/types';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport { SqlContractSerializerBase } from './sql-contract-serializer-base';\n\n/**\n * Default SQL family `ContractSerializer` concretion. Inherits the\n * full SQL-shared deserialization pipeline (structural validation +\n * IR-class hydration) without pack-registered `storage.types`\n * hydration factories — targets that emit polymorphic JSON outside the\n * codec-typed envelope wire a target-specific subclass with a populated\n * registry (see Postgres). Family-level call sites instantiate this\n * default directly when no target serializer is supplied.\n */\nexport class SqlContractSerializer extends SqlContractSerializerBase<Contract<SqlStorage>> {\n constructor() {\n super(new Map());\n }\n}\n"],"mappings":";;;;;;;;AA2BA,MAAM,qBAAqB,KAAK;CAC9B,IAAI;CACJ,SAAS;CAGT,KAAK;AACP,CAAC;AAED,SAAS,cAAc,OAAkD;CACvE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAsB,4BAAtB,MAEA;CAIqB;CAHnB;CAEA,YACE,qC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Y,MACtE,KAAK,MAAM,SAAS,OAAO,OAAO,OAAkC,GAAG;GACrE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;GACjD,MAAM,OAAQ,MAA6B;GAC3C,IAAI,OAAO,SAAS,YAAY,KAAK,mBAAmB,IAAI,IAAI,MAAM,KAAA,GACpE,MAAM,IAAI,wBACR,eAAe,KAAK,yCACpB,YACF;EAEJ;EAGF,MAAM,SAAU,OAAO,aAAa,CAAC;EACrC,MAAM,WAAW,OAAO;EACxB,OAAO;GACL,GAAG;GACH;GACA,GAAI,aAAa,KAAA,IAAY,EAAE,MAAM,SAAS,IAAI,CAAC;EACrD;CACF;CAEA,wBAAkC,OAAiD;EACjF,IAAI,OAAO,UAAU,YAAY,UAAU,MACzC,OAAO;EAET,MAAM,OAAQ,MAA6B;EAC3C,IAAI,OAAO,SAAS,UAClB,OAAO;EAET,MAAM,UAAU,KAAK,mBAAmB,IAAI,IAAI;EAChD,IAAI,YAAY,KAAA,GACd,OAAO;EAET,OAAO,QAAQ,KAAK;CACtB;CAEA,wBAAkC,UAA2C;EAC3E,OAAO;CACT;AACF;;;;;;;;;;;;AC5OA,IAAa,wBAAb,cAA2C,0BAAgD;CACzF,cAAc;EACZ,sBAAM,IAAI,IAAI,CAAC;CACjB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/family-sql",
|
|
3
|
-
"version": "0.11.0-dev.
|
|
3
|
+
"version": "0.11.0-dev.45",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"description": "SQL family descriptor for Prisma Next",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@prisma-next/contract": "0.11.0-dev.
|
|
10
|
-
"@prisma-next/emitter": "0.11.0-dev.
|
|
11
|
-
"@prisma-next/framework-components": "0.11.0-dev.
|
|
12
|
-
"@prisma-next/migration-tools": "0.11.0-dev.
|
|
13
|
-
"@prisma-next/operations": "0.11.0-dev.
|
|
14
|
-
"@prisma-next/sql-contract": "0.11.0-dev.
|
|
15
|
-
"@prisma-next/sql-contract-emitter": "0.11.0-dev.
|
|
16
|
-
"@prisma-next/sql-contract-ts": "0.11.0-dev.
|
|
17
|
-
"@prisma-next/sql-operations": "0.11.0-dev.
|
|
18
|
-
"@prisma-next/sql-relational-core": "0.11.0-dev.
|
|
19
|
-
"@prisma-next/sql-runtime": "0.11.0-dev.
|
|
20
|
-
"@prisma-next/sql-schema-ir": "0.11.0-dev.
|
|
21
|
-
"@prisma-next/utils": "0.11.0-dev.
|
|
9
|
+
"@prisma-next/contract": "0.11.0-dev.45",
|
|
10
|
+
"@prisma-next/emitter": "0.11.0-dev.45",
|
|
11
|
+
"@prisma-next/framework-components": "0.11.0-dev.45",
|
|
12
|
+
"@prisma-next/migration-tools": "0.11.0-dev.45",
|
|
13
|
+
"@prisma-next/operations": "0.11.0-dev.45",
|
|
14
|
+
"@prisma-next/sql-contract": "0.11.0-dev.45",
|
|
15
|
+
"@prisma-next/sql-contract-emitter": "0.11.0-dev.45",
|
|
16
|
+
"@prisma-next/sql-contract-ts": "0.11.0-dev.45",
|
|
17
|
+
"@prisma-next/sql-operations": "0.11.0-dev.45",
|
|
18
|
+
"@prisma-next/sql-relational-core": "0.11.0-dev.45",
|
|
19
|
+
"@prisma-next/sql-runtime": "0.11.0-dev.45",
|
|
20
|
+
"@prisma-next/sql-schema-ir": "0.11.0-dev.45",
|
|
21
|
+
"@prisma-next/utils": "0.11.0-dev.45",
|
|
22
22
|
"arktype": "^2.2.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@prisma-next/driver-postgres": "0.11.0-dev.
|
|
26
|
-
"@prisma-next/psl-parser": "0.11.0-dev.
|
|
27
|
-
"@prisma-next/psl-printer": "0.11.0-dev.
|
|
28
|
-
"@prisma-next/sql-contract-psl": "0.11.0-dev.
|
|
29
|
-
"@prisma-next/test-utils": "0.11.0-dev.
|
|
30
|
-
"@prisma-next/tsconfig": "0.11.0-dev.
|
|
31
|
-
"@prisma-next/tsdown": "0.11.0-dev.
|
|
25
|
+
"@prisma-next/driver-postgres": "0.11.0-dev.45",
|
|
26
|
+
"@prisma-next/psl-parser": "0.11.0-dev.45",
|
|
27
|
+
"@prisma-next/psl-printer": "0.11.0-dev.45",
|
|
28
|
+
"@prisma-next/sql-contract-psl": "0.11.0-dev.45",
|
|
29
|
+
"@prisma-next/test-utils": "0.11.0-dev.45",
|
|
30
|
+
"@prisma-next/tsconfig": "0.11.0-dev.45",
|
|
31
|
+
"@prisma-next/tsdown": "0.11.0-dev.45",
|
|
32
32
|
"tsdown": "0.22.0",
|
|
33
33
|
"typescript": "5.9.3",
|
|
34
34
|
"vitest": "4.1.6"
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { ContractValidationError } from '@prisma-next/contract/contract-validation-error';
|
|
2
2
|
import type { Contract } from '@prisma-next/contract/types';
|
|
3
3
|
import type { ContractSerializer } from '@prisma-next/framework-components/control';
|
|
4
|
-
import { type Namespace, NamespaceBase } from '@prisma-next/framework-components/ir';
|
|
5
4
|
import {
|
|
5
|
+
type Namespace,
|
|
6
|
+
NamespaceBase,
|
|
7
|
+
UNBOUND_NAMESPACE_ID,
|
|
8
|
+
} from '@prisma-next/framework-components/ir';
|
|
9
|
+
import {
|
|
10
|
+
buildSqlNamespace,
|
|
6
11
|
type SqlNamespaceTablesInput,
|
|
7
12
|
SqlStorage,
|
|
13
|
+
type SqlStorageInput,
|
|
8
14
|
type SqlStorageTypeEntry,
|
|
15
|
+
SqlUnboundNamespace,
|
|
9
16
|
StorageTable,
|
|
10
17
|
type StorageTableInput,
|
|
11
18
|
} from '@prisma-next/sql-contract/types';
|
|
@@ -13,6 +20,8 @@ import {
|
|
|
13
20
|
createSqlContractSchema,
|
|
14
21
|
validateSqlContractFully,
|
|
15
22
|
} from '@prisma-next/sql-contract/validators';
|
|
23
|
+
import { blindCast } from '@prisma-next/utils/casts';
|
|
24
|
+
import { ifDefined } from '@prisma-next/utils/defined';
|
|
16
25
|
import type { JsonObject } from '@prisma-next/utils/json';
|
|
17
26
|
import { type Type, type } from 'arktype';
|
|
18
27
|
|
|
@@ -102,27 +111,48 @@ export abstract class SqlContractSerializerBase<TContract extends Contract<SqlSt
|
|
|
102
111
|
: undefined;
|
|
103
112
|
|
|
104
113
|
const rawNamespaces = validated.storage.namespaces;
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
if (rawNamespaces === undefined) {
|
|
115
|
+
throw new ContractValidationError(
|
|
116
|
+
'Contract storage.namespaces is required after structural validation',
|
|
117
|
+
'structural',
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
const hydratedNamespaces = this.hydrateSqlNamespaceMap(rawNamespaces);
|
|
121
|
+
// Keep the `__unbound__` brand sound: a deserialized contract may declare
|
|
122
|
+
// only named namespaces (cross-namespace contracts omit the late-bound
|
|
123
|
+
// slot), so inject the family unbound singleton when absent rather than
|
|
124
|
+
// asserting a shape that isn't present.
|
|
125
|
+
const unbound = hydratedNamespaces[UNBOUND_NAMESPACE_ID] ?? SqlUnboundNamespace.instance;
|
|
107
126
|
|
|
108
127
|
return {
|
|
109
128
|
...validated,
|
|
110
129
|
storage: new SqlStorage({
|
|
111
130
|
storageHash: validated.storage.storageHash,
|
|
112
|
-
...(
|
|
113
|
-
|
|
131
|
+
...ifDefined('types', hydratedTypes),
|
|
132
|
+
// `__unbound__` is guaranteed present above; the residual narrowing is
|
|
133
|
+
// the family invariant that hydrated SQL namespaces are `SqlNamespace`
|
|
134
|
+
// instances (target/family classes, not the wider framework `Namespace`).
|
|
135
|
+
namespaces: blindCast<
|
|
136
|
+
SqlStorageInput['namespaces'],
|
|
137
|
+
'hydrated SQL namespaces are SqlNamespace instances; __unbound__ guaranteed present (injected above)'
|
|
138
|
+
>({ ...hydratedNamespaces, [UNBOUND_NAMESPACE_ID]: unbound }),
|
|
114
139
|
}),
|
|
115
140
|
};
|
|
116
141
|
}
|
|
117
142
|
|
|
118
143
|
protected hydrateSqlNamespaceMap(
|
|
119
144
|
namespaces: Readonly<Record<string, Namespace | Record<string, unknown>>>,
|
|
120
|
-
): Readonly<Record<string, Namespace
|
|
145
|
+
): Readonly<Record<string, Namespace>> {
|
|
121
146
|
return Object.fromEntries(
|
|
122
|
-
Object.entries(namespaces).map(([nsId,
|
|
123
|
-
|
|
124
|
-
this.hydrateSqlNamespaceEntry(nsId,
|
|
125
|
-
|
|
147
|
+
Object.entries(namespaces).map(([nsId, namespaceEntryRaw]) => {
|
|
148
|
+
// Raw entries passed structural validation; hydrate materialises family IR class instances.
|
|
149
|
+
const namespaceHydrated = this.hydrateSqlNamespaceEntry(nsId, namespaceEntryRaw);
|
|
150
|
+
const namespaceMaterialised =
|
|
151
|
+
namespaceHydrated instanceof NamespaceBase
|
|
152
|
+
? namespaceHydrated
|
|
153
|
+
: buildSqlNamespace(namespaceHydrated);
|
|
154
|
+
return [nsId, namespaceMaterialised];
|
|
155
|
+
}),
|
|
126
156
|
);
|
|
127
157
|
}
|
|
128
158
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sql-contract-serializer-VVoSAnYg.mjs","names":[],"sources":["../src/core/ir/sql-contract-serializer-base.ts","../src/core/ir/sql-contract-serializer.ts"],"sourcesContent":["import { ContractValidationError } from '@prisma-next/contract/contract-validation-error';\nimport type { Contract } from '@prisma-next/contract/types';\nimport type { ContractSerializer } from '@prisma-next/framework-components/control';\nimport { type Namespace, NamespaceBase } from '@prisma-next/framework-components/ir';\nimport {\n type SqlNamespaceTablesInput,\n SqlStorage,\n type SqlStorageTypeEntry,\n StorageTable,\n type StorageTableInput,\n} from '@prisma-next/sql-contract/types';\nimport {\n createSqlContractSchema,\n validateSqlContractFully,\n} from '@prisma-next/sql-contract/validators';\nimport type { JsonObject } from '@prisma-next/utils/json';\nimport { type Type, type } from 'arktype';\n\nconst NamespaceRawSchema = type({\n id: 'string',\n 'kind?': 'string',\n // Undeclared keys (`tables`, `enum`, and any pack-contributed slot maps)\n // intentionally pass through; the slot loop below iterates them by name.\n '+': 'ignore',\n});\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nexport type SqlEntityHydrationFactory = (entry: unknown) => SqlStorageTypeEntry;\n\n/**\n * SQL family `ContractSerializer` abstract base. Carries the SQL-shared\n * deserialization pipeline:\n *\n * 1. `parseSqlContractStructure` validates the on-disk JSON envelope\n * against the SQL contract arktype schema (`validateSqlContractFully`)\n * and returns the validated flat-data shape.\n * 2. `hydrateSqlStorage` walks the validated `storage` subtree and\n * constructs the family-shared SQL Contract IR class hierarchy\n * (`SqlStorage` -> `StorageTable` -> `StorageColumn` / `PrimaryKey`\n * / …). The rest of the contract envelope is JSON-clean primitive\n * data and passes through unchanged.\n * 3. `constructTargetContract` is the target-specific extension hook;\n * defaults to identity. Targets that need to attach target-only\n * fields (e.g. target-specific derived storage fields) override it.\n *\n * Default `serializeContract` is identity over the contract — concrete\n * SQL targets ship JSON-clean class instances, so the contract value\n * can be stringified directly. The non-enumerable family-level `kind`\n * discriminator on `SqlNode` instances stays out of the persisted\n * envelope automatically. Targets that need to canonicalize on the way\n * out (key ordering, dropping computed-only fields) override\n * `serializeContract` directly.\n */\nexport abstract class SqlContractSerializerBase<TContract extends Contract<SqlStorage>>\n implements ContractSerializer<TContract>\n{\n private readonly contractSchema: Type<unknown> | undefined;\n\n constructor(\n private readonly entityTypeRegistry: ReadonlyMap<string, SqlEntityHydrationFactory> = new Map(),\n validatorFragments?: ReadonlyMap<string, Type<unknown>>,\n ) {\n // Only build a fragments-aware contract schema when pack contributions\n // exist. The cached module-level default in `validators.ts` covers the\n // no-contributions case and avoids per-instance schema compilation.\n this.contractSchema =\n validatorFragments !== undefined && validatorFragments.size > 0\n ? createSqlContractSchema(validatorFragments)\n : undefined;\n }\n\n deserializeContract<T extends TContract = TContract>(json: unknown): T {\n const validated = this.parseSqlContractStructure(json);\n const hydrated = this.hydrateSqlStorage(validated);\n return this.constructTargetContract(hydrated) as T;\n }\n\n serializeContract(contract: TContract): JsonObject {\n return contract as unknown as JsonObject;\n }\n\n protected parseSqlContractStructure(json: unknown): Contract<SqlStorage> {\n return validateSqlContractFully<Contract<SqlStorage>>(\n json,\n this.contractSchema !== undefined ? { contractSchema: this.contractSchema } : undefined,\n );\n }\n\n protected hydrateSqlStorage(validated: Contract<SqlStorage>): Contract<SqlStorage> {\n const types = validated.storage.types;\n const hydratedTypes =\n types !== undefined\n ? Object.fromEntries(\n Object.entries(types).map(([name, entry]) => [\n name,\n this.hydrateStorageTypeEntry(entry),\n ]),\n )\n : undefined;\n\n const rawNamespaces = validated.storage.namespaces;\n const hydratedNamespaces =\n rawNamespaces !== undefined ? this.hydrateSqlNamespaceMap(rawNamespaces) : undefined;\n\n return {\n ...validated,\n storage: new SqlStorage({\n storageHash: validated.storage.storageHash,\n ...(hydratedTypes !== undefined ? { types: hydratedTypes } : {}),\n ...(hydratedNamespaces !== undefined ? { namespaces: hydratedNamespaces } : {}),\n }),\n };\n }\n\n protected hydrateSqlNamespaceMap(\n namespaces: Readonly<Record<string, Namespace | Record<string, unknown>>>,\n ): Readonly<Record<string, Namespace | SqlNamespaceTablesInput>> {\n return Object.fromEntries(\n Object.entries(namespaces).map(([nsId, raw]) => [\n nsId,\n this.hydrateSqlNamespaceEntry(nsId, raw),\n ]),\n );\n }\n\n protected hydrateSqlNamespaceEntry(\n nsId: string,\n raw: Namespace | Record<string, unknown>,\n ): Namespace | SqlNamespaceTablesInput {\n if (raw instanceof NamespaceBase) {\n return raw;\n }\n const rawRecord = isPlainRecord(raw) ? raw : {};\n const id = typeof rawRecord['id'] === 'string' ? rawRecord['id'] : nsId;\n const parsed = NamespaceRawSchema({ ...rawRecord, id });\n if (parsed instanceof type.errors) {\n const messages = parsed.map((p: { message: string }) => p.message).join('; ');\n throw new ContractValidationError(`Namespace hydration failed: ${messages}`, 'structural');\n }\n const result: Record<string, unknown> = { id };\n\n for (const [propertyKey, slotValue] of Object.entries(parsed)) {\n if (propertyKey === 'id') continue;\n if (slotValue === null || typeof slotValue !== 'object') continue;\n\n if (propertyKey === 'tables') {\n result['tables'] = Object.fromEntries(\n Object.entries(slotValue as Record<string, unknown>).map(([tableName, table]) => [\n tableName,\n table instanceof StorageTable ? table : new StorageTable(table as StorageTableInput),\n ]),\n );\n continue;\n }\n\n const hydratedSlot = Object.fromEntries(\n Object.entries(slotValue as Record<string, unknown>).map(([entryName, entry]) => {\n if (typeof entry !== 'object' || entry === null) {\n return [entryName, entry];\n }\n const kind = (entry as { kind?: unknown }).kind;\n if (typeof kind === 'string') {\n const factory = this.entityTypeRegistry.get(kind);\n if (factory !== undefined) {\n return [entryName, factory(entry)];\n }\n }\n return [entryName, entry];\n }),\n );\n if (Object.keys(hydratedSlot).length > 0) {\n result[propertyKey] = hydratedSlot;\n }\n }\n\n const enumRaw = rawRecord['enum'];\n if (enumRaw !== undefined && typeof enumRaw === 'object' && enumRaw !== null) {\n for (const entry of Object.values(enumRaw as Record<string, unknown>)) {\n if (typeof entry !== 'object' || entry === null) continue;\n const kind = (entry as { kind?: unknown }).kind;\n if (typeof kind === 'string' && this.entityTypeRegistry.get(kind) === undefined) {\n throw new ContractValidationError(\n `Entry kind '${kind}' has no registered hydration factory.`,\n 'structural',\n );\n }\n }\n }\n\n const tables = (result['tables'] ?? {}) as Record<string, StorageTable>;\n const enumSlot = result['enum'] as NonNullable<SqlNamespaceTablesInput['enum']> | undefined;\n return {\n ...result,\n tables,\n ...(enumSlot !== undefined ? { enum: enumSlot } : {}),\n } as SqlNamespaceTablesInput;\n }\n\n protected hydrateStorageTypeEntry(entry: SqlStorageTypeEntry): SqlStorageTypeEntry {\n if (typeof entry !== 'object' || entry === null) {\n return entry;\n }\n const kind = (entry as { kind?: unknown }).kind;\n if (typeof kind !== 'string') {\n return entry;\n }\n const factory = this.entityTypeRegistry.get(kind);\n if (factory === undefined) {\n return entry;\n }\n return factory(entry);\n }\n\n protected constructTargetContract(hydrated: Contract<SqlStorage>): TContract {\n return hydrated as TContract;\n }\n}\n","import type { Contract } from '@prisma-next/contract/types';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport { SqlContractSerializerBase } from './sql-contract-serializer-base';\n\n/**\n * Default SQL family `ContractSerializer` concretion. Inherits the\n * full SQL-shared deserialization pipeline (structural validation +\n * IR-class hydration) without pack-registered `storage.types`\n * hydration factories — targets that emit polymorphic JSON outside the\n * codec-typed envelope wire a target-specific subclass with a populated\n * registry (see Postgres). Family-level call sites instantiate this\n * default directly when no target serializer is supplied.\n */\nexport class SqlContractSerializer extends SqlContractSerializerBase<Contract<SqlStorage>> {\n constructor() {\n super(new Map());\n }\n}\n"],"mappings":";;;;;;AAkBA,MAAM,qBAAqB,KAAK;CAC9B,IAAI;CACJ,SAAS;CAGT,KAAK;AACP,CAAC;AAED,SAAS,cAAc,OAAkD;CACvE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAsB,4BAAtB,MAEA;CAIqB;CAHnB;CAEA,YACE,qCAAsF,IAAI,IAAI,GAC9F,oBACA;EAFiB,KAAA,qBAAA;EAMjB,KAAK,iBACH,uBAAuB,KAAA,KAAa,mBAAmB,OAAO,IAC1D,wBAAwB,kBAAkB,IAC1C,KAAA;CACR;CAEA,oBAAqD,MAAkB;EACrE,MAAM,YAAY,KAAK,0BAA0B,IAAI;EACrD,MAAM,WAAW,KAAK,kBAAkB,SAAS;EACjD,OAAO,KAAK,wBAAwB,QAAQ;CAC9C;CAEA,kBAAkB,UAAiC;EACjD,OAAO;CACT;CAEA,0BAAoC,MAAqC;EACvE,OAAO,yBACL,MACA,KAAK,mBAAmB,KAAA,IAAY,EAAE,gBAAgB,KAAK,eAAe,IAAI,KAAA,CAChF;CACF;CAEA,kBAA4B,WAAuD;EACjF,M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