@prisma-next/sql-contract 0.3.0-pr.94.3 → 0.3.0-pr.95.2

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 (44) hide show
  1. package/dist/exports/factories.d.ts +2 -0
  2. package/dist/exports/factories.d.ts.map +1 -0
  3. package/dist/exports/factories.js +83 -0
  4. package/dist/exports/factories.js.map +1 -0
  5. package/dist/exports/pack-types.d.ts +2 -0
  6. package/dist/exports/pack-types.d.ts.map +1 -0
  7. package/dist/exports/pack-types.js +1 -0
  8. package/dist/exports/pack-types.js.map +1 -0
  9. package/dist/exports/types.d.ts +2 -0
  10. package/dist/exports/types.d.ts.map +1 -0
  11. package/dist/exports/types.js +1 -0
  12. package/dist/exports/types.js.map +1 -0
  13. package/dist/exports/validators.d.ts +2 -0
  14. package/dist/exports/validators.d.ts.map +1 -0
  15. package/dist/exports/validators.js +104 -0
  16. package/dist/exports/validators.js.map +1 -0
  17. package/dist/factories.d.ts +38 -0
  18. package/dist/factories.d.ts.map +1 -0
  19. package/dist/index.d.ts +4 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/pack-types.d.ts +10 -0
  22. package/dist/pack-types.d.ts.map +1 -0
  23. package/dist/types.d.ts +94 -0
  24. package/dist/types.d.ts.map +1 -0
  25. package/dist/{validators.d.mts → validators.d.ts} +5 -10
  26. package/dist/validators.d.ts.map +1 -0
  27. package/package.json +22 -15
  28. package/src/exports/types.ts +1 -0
  29. package/src/types.ts +27 -0
  30. package/src/validators.ts +10 -0
  31. package/dist/factories.d.mts +0 -43
  32. package/dist/factories.d.mts.map +0 -1
  33. package/dist/factories.mjs +0 -75
  34. package/dist/factories.mjs.map +0 -1
  35. package/dist/pack-types.d.mts +0 -13
  36. package/dist/pack-types.d.mts.map +0 -1
  37. package/dist/pack-types.mjs +0 -1
  38. package/dist/types-BMHD8-1o.d.mts +0 -72
  39. package/dist/types-BMHD8-1o.d.mts.map +0 -1
  40. package/dist/types.d.mts +0 -2
  41. package/dist/types.mjs +0 -1
  42. package/dist/validators.d.mts.map +0 -1
  43. package/dist/validators.mjs +0 -117
  44. package/dist/validators.mjs.map +0 -1
@@ -0,0 +1,2 @@
1
+ export { col, contract, fk, index, model, pk, storage, table, unique, } from '../factories';
2
+ //# sourceMappingURL=factories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../src/exports/factories.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,QAAQ,EACR,EAAE,EACF,KAAK,EACL,KAAK,EACL,EAAE,EACF,OAAO,EACP,KAAK,EACL,MAAM,GACP,MAAM,cAAc,CAAC"}
@@ -0,0 +1,83 @@
1
+ // src/factories.ts
2
+ function col(nativeType, codecId, nullable = false) {
3
+ return {
4
+ nativeType,
5
+ codecId,
6
+ nullable
7
+ };
8
+ }
9
+ function pk(...columns) {
10
+ return {
11
+ columns
12
+ };
13
+ }
14
+ function unique(...columns) {
15
+ return {
16
+ columns
17
+ };
18
+ }
19
+ function index(...columns) {
20
+ return {
21
+ columns
22
+ };
23
+ }
24
+ function fk(columns, refTable, refColumns, name) {
25
+ const references = {
26
+ table: refTable,
27
+ columns: refColumns
28
+ };
29
+ return {
30
+ columns,
31
+ references,
32
+ ...name !== void 0 && { name }
33
+ };
34
+ }
35
+ function table(columns, opts) {
36
+ return {
37
+ columns,
38
+ ...opts?.pk !== void 0 && { primaryKey: opts.pk },
39
+ uniques: opts?.uniques ?? [],
40
+ indexes: opts?.indexes ?? [],
41
+ foreignKeys: opts?.fks ?? []
42
+ };
43
+ }
44
+ function model(table2, fields, relations = {}) {
45
+ const storage2 = { table: table2 };
46
+ return {
47
+ storage: storage2,
48
+ fields,
49
+ relations
50
+ };
51
+ }
52
+ function storage(tables) {
53
+ return { tables };
54
+ }
55
+ function contract(opts) {
56
+ return {
57
+ schemaVersion: opts.schemaVersion ?? "1",
58
+ target: opts.target,
59
+ targetFamily: opts.targetFamily ?? "sql",
60
+ coreHash: opts.coreHash,
61
+ storage: opts.storage,
62
+ models: opts.models ?? {},
63
+ relations: opts.relations ?? {},
64
+ mappings: opts.mappings ?? {},
65
+ ...opts.profileHash !== void 0 && { profileHash: opts.profileHash },
66
+ ...opts.capabilities !== void 0 && { capabilities: opts.capabilities },
67
+ ...opts.extensionPacks !== void 0 && { extensionPacks: opts.extensionPacks },
68
+ ...opts.meta !== void 0 && { meta: opts.meta },
69
+ ...opts.sources !== void 0 && { sources: opts.sources }
70
+ };
71
+ }
72
+ export {
73
+ col,
74
+ contract,
75
+ fk,
76
+ index,
77
+ model,
78
+ pk,
79
+ storage,
80
+ table,
81
+ unique
82
+ };
83
+ //# sourceMappingURL=factories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/factories.ts"],"sourcesContent":["import type {\n ForeignKey,\n ForeignKeyReferences,\n Index,\n ModelDefinition,\n ModelField,\n ModelStorage,\n PrimaryKey,\n SqlContract,\n SqlMappings,\n SqlStorage,\n StorageColumn,\n StorageTable,\n UniqueConstraint,\n} from './types';\n\n/**\n * Creates a StorageColumn with nativeType and codecId.\n *\n * @param nativeType - Native database type identifier (e.g., 'int4', 'text', 'vector')\n * @param codecId - Codec identifier (e.g., 'pg/int4@1', 'pg/text@1')\n * @param nullable - Whether the column is nullable (default: false)\n * @returns StorageColumn with nativeType and codecId\n */\nexport function col(nativeType: string, codecId: string, nullable = false): StorageColumn {\n return {\n nativeType,\n codecId,\n nullable,\n };\n}\n\nexport function pk(...columns: readonly string[]): PrimaryKey {\n return {\n columns,\n };\n}\n\nexport function unique(...columns: readonly string[]): UniqueConstraint {\n return {\n columns,\n };\n}\n\nexport function index(...columns: readonly string[]): Index {\n return {\n columns,\n };\n}\n\nexport function fk(\n columns: readonly string[],\n refTable: string,\n refColumns: readonly string[],\n name?: string,\n): ForeignKey {\n const references: ForeignKeyReferences = {\n table: refTable,\n columns: refColumns,\n };\n return {\n columns,\n references,\n ...(name !== undefined && { name }),\n };\n}\n\nexport function table(\n columns: Record<string, StorageColumn>,\n opts?: {\n pk?: PrimaryKey;\n uniques?: readonly UniqueConstraint[];\n indexes?: readonly Index[];\n fks?: readonly ForeignKey[];\n },\n): StorageTable {\n return {\n columns,\n ...(opts?.pk !== undefined && { primaryKey: opts.pk }),\n uniques: opts?.uniques ?? [],\n indexes: opts?.indexes ?? [],\n foreignKeys: opts?.fks ?? [],\n };\n}\n\nexport function model(\n table: string,\n fields: Record<string, ModelField>,\n relations: Record<string, unknown> = {},\n): ModelDefinition {\n const storage: ModelStorage = { table };\n return {\n storage,\n fields,\n relations,\n };\n}\n\nexport function storage(tables: Record<string, StorageTable>): SqlStorage {\n return { tables };\n}\n\nexport function contract(opts: {\n target: string;\n coreHash: string;\n storage: SqlStorage;\n models?: Record<string, ModelDefinition>;\n relations?: Record<string, unknown>;\n mappings?: Partial<SqlMappings>;\n schemaVersion?: '1';\n targetFamily?: 'sql';\n profileHash?: string;\n capabilities?: Record<string, Record<string, boolean>>;\n extensionPacks?: Record<string, unknown>;\n meta?: Record<string, unknown>;\n sources?: Record<string, unknown>;\n}): SqlContract {\n return {\n schemaVersion: opts.schemaVersion ?? '1',\n target: opts.target,\n targetFamily: opts.targetFamily ?? 'sql',\n coreHash: opts.coreHash,\n storage: opts.storage,\n models: opts.models ?? {},\n relations: opts.relations ?? {},\n mappings: (opts.mappings ?? {}) as SqlMappings,\n ...(opts.profileHash !== undefined && { profileHash: opts.profileHash }),\n ...(opts.capabilities !== undefined && { capabilities: opts.capabilities }),\n ...(opts.extensionPacks !== undefined && { extensionPacks: opts.extensionPacks }),\n ...(opts.meta !== undefined && { meta: opts.meta }),\n ...(opts.sources !== undefined && { sources: opts.sources as Record<string, unknown> }),\n } as SqlContract;\n}\n"],"mappings":";AAwBO,SAAS,IAAI,YAAoB,SAAiB,WAAW,OAAsB;AACxF,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,MAAM,SAAwC;AAC5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mBAAmB,UAAa,EAAE,gBAAgB,KAAK,eAAe;AAAA,IAC/E,GAAI,KAAK,SAAS,UAAa,EAAE,MAAM,KAAK,KAAK;AAAA,IACjD,GAAI,KAAK,YAAY,UAAa,EAAE,SAAS,KAAK,QAAmC;AAAA,EACvF;AACF;","names":["table","storage"]}
@@ -0,0 +1,2 @@
1
+ export type { StorageTypeMetadata } from '../pack-types';
2
+ //# sourceMappingURL=pack-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-types.d.ts","sourceRoot":"","sources":["../../src/exports/pack-types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=pack-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export type { ExtractCodecTypes, ExtractOperationTypes, ForeignKey, ForeignKeyReferences, Index, ModelDefinition, ModelField, ModelStorage, PrimaryKey, SqlContract, SqlMappings, SqlStorage, StorageColumn, StorageTable, StorageTypeInstance, UniqueConstraint, } from '../types';
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/exports/types.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,oBAAoB,EACpB,KAAK,EACL,eAAe,EACf,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,UAAU,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,2 @@
1
+ export { validateModel, validateSqlContract, validateStorage } from '../validators';
2
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/exports/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,104 @@
1
+ // src/validators.ts
2
+ import { type } from "arktype";
3
+ var StorageColumnSchema = type.declare().type({
4
+ nativeType: "string",
5
+ codecId: "string",
6
+ nullable: "boolean",
7
+ "typeParams?": "Record<string, unknown>",
8
+ "typeRef?": "string"
9
+ });
10
+ var StorageTypeInstanceSchema = type.declare().type({
11
+ codecId: "string",
12
+ nativeType: "string",
13
+ typeParams: "Record<string, unknown>"
14
+ });
15
+ var PrimaryKeySchema = type.declare().type({
16
+ columns: type.string.array().readonly(),
17
+ "name?": "string"
18
+ });
19
+ var UniqueConstraintSchema = type.declare().type({
20
+ columns: type.string.array().readonly(),
21
+ "name?": "string"
22
+ });
23
+ var IndexSchema = type.declare().type({
24
+ columns: type.string.array().readonly(),
25
+ "name?": "string"
26
+ });
27
+ var ForeignKeyReferencesSchema = type.declare().type({
28
+ table: "string",
29
+ columns: type.string.array().readonly()
30
+ });
31
+ var ForeignKeySchema = type.declare().type({
32
+ columns: type.string.array().readonly(),
33
+ references: ForeignKeyReferencesSchema,
34
+ "name?": "string"
35
+ });
36
+ var StorageTableSchema = type.declare().type({
37
+ columns: type({ "[string]": StorageColumnSchema }),
38
+ "primaryKey?": PrimaryKeySchema,
39
+ uniques: UniqueConstraintSchema.array().readonly(),
40
+ indexes: IndexSchema.array().readonly(),
41
+ foreignKeys: ForeignKeySchema.array().readonly()
42
+ });
43
+ var StorageSchema = type.declare().type({
44
+ tables: type({ "[string]": StorageTableSchema }),
45
+ "types?": type({ "[string]": StorageTypeInstanceSchema })
46
+ });
47
+ var ModelFieldSchema = type.declare().type({
48
+ column: "string"
49
+ });
50
+ var ModelStorageSchema = type.declare().type({
51
+ table: "string"
52
+ });
53
+ var ModelSchema = type.declare().type({
54
+ storage: ModelStorageSchema,
55
+ fields: type({ "[string]": ModelFieldSchema }),
56
+ relations: type({ "[string]": "unknown" })
57
+ });
58
+ var SqlContractSchema = type({
59
+ "schemaVersion?": "'1'",
60
+ target: "string",
61
+ targetFamily: "'sql'",
62
+ coreHash: "string",
63
+ "profileHash?": "string",
64
+ "capabilities?": "Record<string, Record<string, boolean>>",
65
+ "extensionPacks?": "Record<string, unknown>",
66
+ "meta?": "Record<string, unknown>",
67
+ "sources?": "Record<string, unknown>",
68
+ models: type({ "[string]": ModelSchema }),
69
+ storage: StorageSchema
70
+ });
71
+ function validateStorage(value) {
72
+ const result = StorageSchema(value);
73
+ if (result instanceof type.errors) {
74
+ const messages = result.map((p) => p.message).join("; ");
75
+ throw new Error(`Storage validation failed: ${messages}`);
76
+ }
77
+ return result;
78
+ }
79
+ function validateModel(value) {
80
+ const result = ModelSchema(value);
81
+ if (result instanceof type.errors) {
82
+ const messages = result.map((p) => p.message).join("; ");
83
+ throw new Error(`Model validation failed: ${messages}`);
84
+ }
85
+ return result;
86
+ }
87
+ function validateSqlContract(value) {
88
+ const rawValue = value;
89
+ if (rawValue.targetFamily !== void 0 && rawValue.targetFamily !== "sql") {
90
+ throw new Error(`Unsupported target family: ${rawValue.targetFamily}`);
91
+ }
92
+ const contractResult = SqlContractSchema(value);
93
+ if (contractResult instanceof type.errors) {
94
+ const messages = contractResult.map((p) => p.message).join("; ");
95
+ throw new Error(`Contract structural validation failed: ${messages}`);
96
+ }
97
+ return contractResult;
98
+ }
99
+ export {
100
+ validateModel,
101
+ validateSqlContract,
102
+ validateStorage
103
+ };
104
+ //# sourceMappingURL=validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/validators.ts"],"sourcesContent":["import { type } from 'arktype';\nimport type {\n ForeignKey,\n ForeignKeyReferences,\n Index,\n ModelDefinition,\n ModelField,\n ModelStorage,\n PrimaryKey,\n SqlContract,\n SqlStorage,\n StorageColumn,\n StorageTable,\n StorageTypeInstance,\n UniqueConstraint,\n} from './types';\n\nconst StorageColumnSchema = type.declare<StorageColumn>().type({\n nativeType: 'string',\n codecId: 'string',\n nullable: 'boolean',\n 'typeParams?': 'Record<string, unknown>',\n 'typeRef?': 'string',\n});\n\nconst StorageTypeInstanceSchema = type.declare<StorageTypeInstance>().type({\n codecId: 'string',\n nativeType: 'string',\n typeParams: 'Record<string, unknown>',\n});\n\nconst PrimaryKeySchema = type.declare<PrimaryKey>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nconst UniqueConstraintSchema = type.declare<UniqueConstraint>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nconst IndexSchema = type.declare<Index>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nconst ForeignKeyReferencesSchema = type.declare<ForeignKeyReferences>().type({\n table: 'string',\n columns: type.string.array().readonly(),\n});\n\nconst ForeignKeySchema = type.declare<ForeignKey>().type({\n columns: type.string.array().readonly(),\n references: ForeignKeyReferencesSchema,\n 'name?': 'string',\n});\n\nconst StorageTableSchema = type.declare<StorageTable>().type({\n columns: type({ '[string]': StorageColumnSchema }),\n 'primaryKey?': PrimaryKeySchema,\n uniques: UniqueConstraintSchema.array().readonly(),\n indexes: IndexSchema.array().readonly(),\n foreignKeys: ForeignKeySchema.array().readonly(),\n});\n\nconst StorageSchema = type.declare<SqlStorage>().type({\n tables: type({ '[string]': StorageTableSchema }),\n 'types?': type({ '[string]': StorageTypeInstanceSchema }),\n});\n\nconst ModelFieldSchema = type.declare<ModelField>().type({\n column: 'string',\n});\n\nconst ModelStorageSchema = type.declare<ModelStorage>().type({\n table: 'string',\n});\n\nconst ModelSchema = type.declare<ModelDefinition>().type({\n storage: ModelStorageSchema,\n fields: type({ '[string]': ModelFieldSchema }),\n relations: type({ '[string]': 'unknown' }),\n});\n\nconst SqlContractSchema = type({\n 'schemaVersion?': \"'1'\",\n target: 'string',\n targetFamily: \"'sql'\",\n coreHash: 'string',\n 'profileHash?': 'string',\n 'capabilities?': 'Record<string, Record<string, boolean>>',\n 'extensionPacks?': 'Record<string, unknown>',\n 'meta?': 'Record<string, unknown>',\n 'sources?': 'Record<string, unknown>',\n models: type({ '[string]': ModelSchema }),\n storage: StorageSchema,\n});\n\n/**\n * Validates the structural shape of SqlStorage using Arktype.\n *\n * @param value - The storage value to validate\n * @returns The validated storage if structure is valid\n * @throws Error if the storage structure is invalid\n */\nexport function validateStorage(value: unknown): SqlStorage {\n const result = StorageSchema(value);\n if (result instanceof type.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Storage validation failed: ${messages}`);\n }\n return result;\n}\n\n/**\n * Validates the structural shape of ModelDefinition using Arktype.\n *\n * @param value - The model value to validate\n * @returns The validated model if structure is valid\n * @throws Error if the model structure is invalid\n */\nexport function validateModel(value: unknown): ModelDefinition {\n const result = ModelSchema(value);\n if (result instanceof type.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Model validation failed: ${messages}`);\n }\n return result;\n}\n\n/**\n * Validates the structural shape of a SqlContract using Arktype.\n *\n * **Responsibility: Validation Only**\n * This function validates that the contract has the correct structure and types.\n * It does NOT normalize the contract - normalization must happen in the contract builder.\n *\n * The contract passed to this function must already be normalized (all required fields present).\n * If normalization is needed, it should be done by the contract builder before calling this function.\n *\n * This ensures all required fields are present and have the correct types.\n *\n * @param value - The contract value to validate (typically from a JSON import)\n * @returns The validated contract if structure is valid\n * @throws Error if the contract structure is invalid\n */\nexport function validateSqlContract<T extends SqlContract<SqlStorage>>(value: unknown): T {\n // Check targetFamily first to provide a clear error message for unsupported target families\n const rawValue = value as { targetFamily?: string };\n if (rawValue.targetFamily !== undefined && rawValue.targetFamily !== 'sql') {\n throw new Error(`Unsupported target family: ${rawValue.targetFamily}`);\n }\n\n const contractResult = SqlContractSchema(value);\n\n if (contractResult instanceof type.errors) {\n const messages = contractResult.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Contract structural validation failed: ${messages}`);\n }\n\n // After validation, contractResult matches the schema and preserves the input structure\n // TypeScript needs an assertion here due to exactOptionalPropertyTypes differences\n // between Arktype's inferred type and the generic T, but runtime-wise they're compatible\n return contractResult as T;\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAiBrB,IAAM,sBAAsB,KAAK,QAAuB,EAAE,KAAK;AAAA,EAC7D,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,UAAU;AAAA,EACV,eAAe;AAAA,EACf,YAAY;AACd,CAAC;AAED,IAAM,4BAA4B,KAAK,QAA6B,EAAE,KAAK;AAAA,EACzE,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,YAAY;AACd,CAAC;AAED,IAAM,mBAAmB,KAAK,QAAoB,EAAE,KAAK;AAAA,EACvD,SAAS,KAAK,OAAO,MAAM,EAAE,SAAS;AAAA,EACtC,SAAS;AACX,CAAC;AAED,IAAM,yBAAyB,KAAK,QAA0B,EAAE,KAAK;AAAA,EACnE,SAAS,KAAK,OAAO,MAAM,EAAE,SAAS;AAAA,EACtC,SAAS;AACX,CAAC;AAED,IAAM,cAAc,KAAK,QAAe,EAAE,KAAK;AAAA,EAC7C,SAAS,KAAK,OAAO,MAAM,EAAE,SAAS;AAAA,EACtC,SAAS;AACX,CAAC;AAED,IAAM,6BAA6B,KAAK,QAA8B,EAAE,KAAK;AAAA,EAC3E,OAAO;AAAA,EACP,SAAS,KAAK,OAAO,MAAM,EAAE,SAAS;AACxC,CAAC;AAED,IAAM,mBAAmB,KAAK,QAAoB,EAAE,KAAK;AAAA,EACvD,SAAS,KAAK,OAAO,MAAM,EAAE,SAAS;AAAA,EACtC,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AAED,IAAM,qBAAqB,KAAK,QAAsB,EAAE,KAAK;AAAA,EAC3D,SAAS,KAAK,EAAE,YAAY,oBAAoB,CAAC;AAAA,EACjD,eAAe;AAAA,EACf,SAAS,uBAAuB,MAAM,EAAE,SAAS;AAAA,EACj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AAE,KAAK,IAAI;AAC5E,UAAM,IAAI,MAAM,4BAA4B,QAAQ,EAAE;AAAA,EACxD;AACA,SAAO;AACT;AAkBO,SAAS,oBAAuD,OAAmB;AAExF,QAAM,WAAW;AACjB,MAAI,SAAS,iBAAiB,UAAa,SAAS,iBAAiB,OAAO;AAC1E,UAAM,IAAI,MAAM,8BAA8B,SAAS,YAAY,EAAE;AAAA,EACvE;AAEA,QAAM,iBAAiB,kBAAkB,KAAK;AAE9C,MAAI,0BAA0B,KAAK,QAAQ;AACzC,UAAM,WAAW,eAAe,IAAI,CAAC,MAA2B,EAAE,OAAO,EAAE,KAAK,IAAI;AACpF,UAAM,IAAI,MAAM,0CAA0C,QAAQ,EAAE;AAAA,EACtE;AAKA,SAAO;AACT;","names":[]}
@@ -0,0 +1,38 @@
1
+ import type { ForeignKey, Index, ModelDefinition, ModelField, PrimaryKey, SqlContract, SqlMappings, SqlStorage, StorageColumn, StorageTable, UniqueConstraint } from './types';
2
+ /**
3
+ * Creates a StorageColumn with nativeType and codecId.
4
+ *
5
+ * @param nativeType - Native database type identifier (e.g., 'int4', 'text', 'vector')
6
+ * @param codecId - Codec identifier (e.g., 'pg/int4@1', 'pg/text@1')
7
+ * @param nullable - Whether the column is nullable (default: false)
8
+ * @returns StorageColumn with nativeType and codecId
9
+ */
10
+ export declare function col(nativeType: string, codecId: string, nullable?: boolean): StorageColumn;
11
+ export declare function pk(...columns: readonly string[]): PrimaryKey;
12
+ export declare function unique(...columns: readonly string[]): UniqueConstraint;
13
+ export declare function index(...columns: readonly string[]): Index;
14
+ export declare function fk(columns: readonly string[], refTable: string, refColumns: readonly string[], name?: string): ForeignKey;
15
+ export declare function table(columns: Record<string, StorageColumn>, opts?: {
16
+ pk?: PrimaryKey;
17
+ uniques?: readonly UniqueConstraint[];
18
+ indexes?: readonly Index[];
19
+ fks?: readonly ForeignKey[];
20
+ }): StorageTable;
21
+ export declare function model(table: string, fields: Record<string, ModelField>, relations?: Record<string, unknown>): ModelDefinition;
22
+ export declare function storage(tables: Record<string, StorageTable>): SqlStorage;
23
+ export declare function contract(opts: {
24
+ target: string;
25
+ coreHash: string;
26
+ storage: SqlStorage;
27
+ models?: Record<string, ModelDefinition>;
28
+ relations?: Record<string, unknown>;
29
+ mappings?: Partial<SqlMappings>;
30
+ schemaVersion?: '1';
31
+ targetFamily?: 'sql';
32
+ profileHash?: string;
33
+ capabilities?: Record<string, Record<string, boolean>>;
34
+ extensionPacks?: Record<string, unknown>;
35
+ meta?: Record<string, unknown>;
36
+ sources?: Record<string, unknown>;
37
+ }): SqlContract;
38
+ //# sourceMappingURL=factories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../src/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,KAAK,EACL,eAAe,EACf,UAAU,EAEV,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,aAAa,CAMxF;AAED,wBAAgB,EAAE,CAAC,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAI5D;AAED,wBAAgB,MAAM,CAAC,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,CAItE;AAED,wBAAgB,KAAK,CAAC,GAAG,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,CAI1D;AAED,wBAAgB,EAAE,CAChB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,IAAI,CAAC,EAAE,MAAM,GACZ,UAAU,CAUZ;AAED,wBAAgB,KAAK,CACnB,OAAO,EAAE,MAAM,CAAC,M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AAC;CACnC,GAAG,WAAW,CAgBd"}
@@ -0,0 +1,4 @@
1
+ export * from './exports/factories';
2
+ export * from './exports/types';
3
+ export * from './exports/validators';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Storage type metadata for pack refs.
3
+ */
4
+ export interface StorageTypeMetadata {
5
+ readonly typeId: string;
6
+ readonly familyId: string;
7
+ readonly targetId: string;
8
+ readonly nativeType?: string;
9
+ }
10
+ //# sourceMappingURL=pack-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-types.d.ts","sourceRoot":"","sources":["../src/pack-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B"}
@@ -0,0 +1,94 @@
1
+ import type { ContractBase } from '@prisma-next/contract/types';
2
+ export type StorageColumn = {
3
+ readonly nativeType: string;
4
+ readonly codecId: string;
5
+ readonly nullable: boolean;
6
+ /**
7
+ * Opaque, codec-owned JS/type parameters.
8
+ * The codec that owns `codecId` defines the shape and semantics.
9
+ * Mutually exclusive with `typeRef`.
10
+ */
11
+ readonly typeParams?: Record<string, unknown>;
12
+ /**
13
+ * Reference to a named type instance in `storage.types`.
14
+ * Mutually exclusive with `typeParams`.
15
+ */
16
+ readonly typeRef?: string;
17
+ };
18
+ export type PrimaryKey = {
19
+ readonly columns: readonly string[];
20
+ readonly name?: string;
21
+ };
22
+ export type UniqueConstraint = {
23
+ readonly columns: readonly string[];
24
+ readonly name?: string;
25
+ };
26
+ export type Index = {
27
+ readonly columns: readonly string[];
28
+ readonly name?: string;
29
+ };
30
+ export type ForeignKeyReferences = {
31
+ readonly table: string;
32
+ readonly columns: readonly string[];
33
+ };
34
+ export type ForeignKey = {
35
+ readonly columns: readonly string[];
36
+ readonly references: ForeignKeyReferences;
37
+ readonly name?: string;
38
+ };
39
+ export type StorageTable = {
40
+ readonly columns: Record<string, StorageColumn>;
41
+ readonly primaryKey?: PrimaryKey;
42
+ readonly uniques: ReadonlyArray<UniqueConstraint>;
43
+ readonly indexes: ReadonlyArray<Index>;
44
+ readonly foreignKeys: ReadonlyArray<ForeignKey>;
45
+ };
46
+ /**
47
+ * A named, parameterized type instance.
48
+ * These are registered in `storage.types` for reuse across columns
49
+ * and to enable ergonomic schema surfaces like `schema.types.MyType`.
50
+ */
51
+ export type StorageTypeInstance = {
52
+ readonly codecId: string;
53
+ readonly nativeType: string;
54
+ readonly typeParams: Record<string, unknown>;
55
+ };
56
+ export type SqlStorage = {
57
+ readonly tables: Record<string, StorageTable>;
58
+ /**
59
+ * Named type instances for parameterized/custom types.
60
+ * Columns can reference these via `typeRef`.
61
+ */
62
+ readonly types?: Record<string, StorageTypeInstance>;
63
+ };
64
+ export type ModelField = {
65
+ readonly column: string;
66
+ };
67
+ export type ModelStorage = {
68
+ readonly table: string;
69
+ };
70
+ export type ModelDefinition = {
71
+ readonly storage: ModelStorage;
72
+ readonly fields: Record<string, ModelField>;
73
+ readonly relations: Record<string, unknown>;
74
+ };
75
+ export type SqlMappings = {
76
+ readonly modelToTable?: Record<string, string>;
77
+ readonly tableToModel?: Record<string, string>;
78
+ readonly fieldToColumn?: Record<string, Record<string, string>>;
79
+ readonly columnToField?: Record<string, Record<string, string>>;
80
+ readonly codecTypes: Record<string, {
81
+ readonly output: unknown;
82
+ }>;
83
+ readonly operationTypes: Record<string, Record<string, unknown>>;
84
+ };
85
+ export type SqlContract<S extends SqlStorage = SqlStorage, M extends Record<string, unknown> = Record<string, unknown>, R extends Record<string, unknown> = Record<string, unknown>, Map extends SqlMappings = SqlMappings> = ContractBase & {
86
+ readonly targetFamily: string;
87
+ readonly storage: S;
88
+ readonly models: M;
89
+ readonly relations: R;
90
+ readonly mappings: Map;
91
+ };
92
+ export type ExtractCodecTypes<TContract extends SqlContract<SqlStorage>> = TContract['mappings']['codecTypes'];
93
+ export type ExtractOperationTypes<TContract extends SqlContract<SqlStorage>> = TContract['mappings']['operationTypes'];
94
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,I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C,EAC3D,GAAG,SAAS,WAAW,GAAG,WAAW,IACnC,YAAY,GAAG;IACjB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACnB,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,WAAW,CAAC,UAAU,CAAC,IACrE,SAAS,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC;AAEtC,MAAM,MAAM,qBAAqB,CAAC,SAAS,SAAS,WAAW,CAAC,UAAU,CAAC,IACzE,SAAS,CAAC,UAAU,CAAC,CAAC,gBAAgB,CAAC,CAAC"}
@@ -1,7 +1,4 @@
1
- import { f as SqlStorage, o as ModelDefinition, u as SqlContract } from "./types-BMHD8-1o.mjs";
2
-
3
- //#region src/validators.d.ts
4
-
1
+ import type { ModelDefinition, SqlContract, SqlStorage } from './types';
5
2
  /**
6
3
  * Validates the structural shape of SqlStorage using Arktype.
7
4
  *
@@ -9,7 +6,7 @@ import { f as SqlStorage, o as ModelDefinition, u as SqlContract } from "./types
9
6
  * @returns The validated storage if structure is valid
10
7
  * @throws Error if the storage structure is invalid
11
8
  */
12
- declare function validateStorage(value: unknown): SqlStorage;
9
+ export declare function validateStorage(value: unknown): SqlStorage;
13
10
  /**
14
11
  * Validates the structural shape of ModelDefinition using Arktype.
15
12
  *
@@ -17,7 +14,7 @@ declare function validateStorage(value: unknown): SqlStorage;
17
14
  * @returns The validated model if structure is valid
18
15
  * @throws Error if the model structure is invalid
19
16
  */
20
- declare function validateModel(value: unknown): ModelDefinition;
17
+ export declare function validateModel(value: unknown): ModelDefinition;
21
18
  /**
22
19
  * Validates the structural shape of a SqlContract using Arktype.
23
20
  *
@@ -34,7 +31,5 @@ declare function validateModel(value: unknown): ModelDefinition;
34
31
  * @returns The validated contract if structure is valid
35
32
  * @throws Error if the contract structure is invalid
36
33
  */
37
- declare function validateSqlContract<T extends SqlContract<SqlStorage>>(value: unknown): T;
38
- //#endregion
39
- export { validateModel, validateSqlContract, validateStorage };
40
- //# sourceMappingURL=validators.d.mts.map
34
+ export declare function validateSqlContract<T extends SqlContract<SqlStorage>>(value: unknown): T;
35
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,eAAe,EAIf,WAAW,EACX,UAAU,EAKX,MAAM,SAAS,CAAC;AAmFjB;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAO1D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAO7D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAkBxF"}
package/package.json CHANGED
@@ -1,40 +1,47 @@
1
1
  {
2
2
  "name": "@prisma-next/sql-contract",
3
- "version": "0.3.0-pr.94.3",
3
+ "version": "0.3.0-pr.95.2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
- "engines": {
7
- "node": ">=20"
8
- },
9
6
  "description": "SQL contract types, validators, and IR factories for Prisma Next",
10
7
  "dependencies": {
11
8
  "arktype": "^2.1.25",
12
- "@prisma-next/contract": "0.3.0-pr.94.3"
9
+ "@prisma-next/contract": "0.3.0-pr.95.2"
13
10
  },
14
11
  "devDependencies": {
15
- "tsdown": "0.18.4",
12
+ "tsup": "8.5.1",
16
13
  "typescript": "5.9.3",
17
14
  "vitest": "4.0.16",
18
15
  "@prisma-next/test-utils": "0.0.1",
19
- "@prisma-next/tsconfig": "0.0.0",
20
- "@prisma-next/tsdown": "0.0.0"
16
+ "@prisma-next/tsconfig": "0.0.0"
21
17
  },
22
18
  "files": [
23
19
  "dist",
24
20
  "src"
25
21
  ],
26
22
  "exports": {
27
- "./factories": "./dist/factories.mjs",
28
- "./pack-types": "./dist/pack-types.mjs",
29
- "./types": "./dist/types.mjs",
30
- "./validators": "./dist/validators.mjs",
31
- "./package.json": "./package.json"
23
+ "./types": {
24
+ "types": "./dist/exports/types.d.ts",
25
+ "import": "./dist/exports/types.js"
26
+ },
27
+ "./validators": {
28
+ "types": "./dist/exports/validators.d.ts",
29
+ "import": "./dist/exports/validators.js"
30
+ },
31
+ "./factories": {
32
+ "types": "./dist/exports/factories.d.ts",
33
+ "import": "./dist/exports/factories.js"
34
+ },
35
+ "./pack-types": {
36
+ "types": "./dist/exports/pack-types.d.ts",
37
+ "import": "./dist/exports/pack-types.js"
38
+ }
32
39
  },
33
40
  "scripts": {
34
- "build": "tsdown",
41
+ "build": "tsup --config tsup.config.ts && tsc --project tsconfig.build.json",
35
42
  "test": "vitest run",
36
43
  "test:coverage": "vitest run --coverage",
37
- "typecheck": "tsc --noEmit",
44
+ "typecheck": "tsc --project tsconfig.json --noEmit",
38
45
  "lint": "biome check . --error-on-warnings",
39
46
  "lint:fix": "biome check --write .",
40
47
  "lint:fix:unsafe": "biome check --write --unsafe .",
@@ -13,5 +13,6 @@ export type {
13
13
  SqlStorage,
14
14
  StorageColumn,
15
15
  StorageTable,
16
+ StorageTypeInstance,
16
17
  UniqueConstraint,
17
18
  } from '../types';
package/src/types.ts CHANGED
@@ -4,6 +4,17 @@ export type StorageColumn = {
4
4
  readonly nativeType: string;
5
5
  readonly codecId: string;
6
6
  readonly nullable: boolean;
7
+ /**
8
+ * Opaque, codec-owned JS/type parameters.
9
+ * The codec that owns `codecId` defines the shape and semantics.
10
+ * Mutually exclusive with `typeRef`.
11
+ */
12
+ readonly typeParams?: Record<string, unknown>;
13
+ /**
14
+ * Reference to a named type instance in `storage.types`.
15
+ * Mutually exclusive with `typeParams`.
16
+ */
17
+ readonly typeRef?: string;
7
18
  };
8
19
 
9
20
  export type PrimaryKey = {
@@ -40,8 +51,24 @@ export type StorageTable = {
40
51
  readonly foreignKeys: ReadonlyArray<ForeignKey>;
41
52
  };
42
53
 
54
+ /**
55
+ * A named, parameterized type instance.
56
+ * These are registered in `storage.types` for reuse across columns
57
+ * and to enable ergonomic schema surfaces like `schema.types.MyType`.
58
+ */
59
+ export type StorageTypeInstance = {
60
+ readonly codecId: string;
61
+ readonly nativeType: string;
62
+ readonly typeParams: Record<string, unknown>;
63
+ };
64
+
43
65
  export type SqlStorage = {
44
66
  readonly tables: Record<string, StorageTable>;
67
+ /**
68
+ * Named type instances for parameterized/custom types.
69
+ * Columns can reference these via `typeRef`.
70
+ */
71
+ readonly types?: Record<string, StorageTypeInstance>;
45
72
  };
46
73
 
47
74
  export type ModelField = {
package/src/validators.ts CHANGED
@@ -11,6 +11,7 @@ import type {
11
11
  SqlStorage,
12
12
  StorageColumn,
13
13
  StorageTable,
14
+ StorageTypeInstance,
14
15
  UniqueConstraint,
15
16
  } from './types';
16
17
 
@@ -18,6 +19,14 @@ const StorageColumnSchema = type.declare<StorageColumn>().type({
18
19
  nativeType: 'string',
19
20
  codecId: 'string',
20
21
  nullable: 'boolean',
22
+ 'typeParams?': 'Record<string, unknown>',
23
+ 'typeRef?': 'string',
24
+ });
25
+
26
+ const StorageTypeInstanceSchema = type.declare<StorageTypeInstance>().type({
27
+ codecId: 'string',
28
+ nativeType: 'string',
29
+ typeParams: 'Record<string, unknown>',
21
30
  });
22
31
 
23
32
  const PrimaryKeySchema = type.declare<PrimaryKey>().type({
@@ -56,6 +65,7 @@ const StorageTableSchema = type.declare<StorageTable>().type({
56
65
 
57
66
  const StorageSchema = type.declare<SqlStorage>().type({
58
67
  tables: type({ '[string]': StorageTableSchema }),
68
+ 'types?': type({ '[string]': StorageTypeInstanceSchema }),
59
69
  });
60
70
 
61
71
  const ModelFieldSchema = type.declare<ModelField>().type({
@@ -1,43 +0,0 @@
1
- import { a as Index, d as SqlMappings, f as SqlStorage, h as UniqueConstraint, l as PrimaryKey, m as StorageTable, o as ModelDefinition, p as StorageColumn, r as ForeignKey, s as ModelField, u as SqlContract } from "./types-BMHD8-1o.mjs";
2
-
3
- //#region src/factories.d.ts
4
-
5
- /**
6
- * Creates a StorageColumn with nativeType and codecId.
7
- *
8
- * @param nativeType - Native database type identifier (e.g., 'int4', 'text', 'vector')
9
- * @param codecId - Codec identifier (e.g., 'pg/int4@1', 'pg/text@1')
10
- * @param nullable - Whether the column is nullable (default: false)
11
- * @returns StorageColumn with nativeType and codecId
12
- */
13
- declare function col(nativeType: string, codecId: string, nullable?: boolean): StorageColumn;
14
- declare function pk(...columns: readonly string[]): PrimaryKey;
15
- declare function unique(...columns: readonly string[]): UniqueConstraint;
16
- declare function index(...columns: readonly string[]): Index;
17
- declare function fk(columns: readonly string[], refTable: string, refColumns: readonly string[], name?: string): ForeignKey;
18
- declare function table(columns: Record<string, StorageColumn>, opts?: {
19
- pk?: PrimaryKey;
20
- uniques?: readonly UniqueConstraint[];
21
- indexes?: readonly Index[];
22
- fks?: readonly ForeignKey[];
23
- }): StorageTable;
24
- declare function model(table: string, fields: Record<string, ModelField>, relations?: Record<string, unknown>): ModelDefinition;
25
- declare function storage(tables: Record<string, StorageTable>): SqlStorage;
26
- declare function contract(opts: {
27
- target: string;
28
- coreHash: string;
29
- storage: SqlStorage;
30
- models?: Record<string, ModelDefinition>;
31
- relations?: Record<string, unknown>;
32
- mappings?: Partial<SqlMappings>;
33
- schemaVersion?: '1';
34
- targetFamily?: 'sql';
35
- profileHash?: string;
36
- capabilities?: Record<string, Record<string, boolean>>;
37
- extensionPacks?: Record<string, unknown>;
38
- meta?: Record<string, unknown>;
39
- sources?: Record<string, unknown>;
40
- }): SqlContract;
41
- //#endregion
42
- export { col, contract, fk, index, model, pk, storage, table, unique };
43
- //# sourceMappingURL=factories.d.mts.map
@@ -1 +0,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bE,IAAA,EAAA;EASF,MAAA,EAAA,MAAO;EAAwB,QAAA,EAAA,MAAA;EAAf,OAAA,EAOrB,UAPqB;EAA+B,MAAA,CAAA,EAQpD,MARoD,CAAA,MAAA,EAQrC,eARqC,CAAA;EAAU,SAAA,CAAA,EAS3D,MAT2D,CAAA,MAAA,EAAA,OAAA,CAAA;EAIzD,QAAA,CAAA,EAMH,OANW,CAMH,WANG,CAAA;EAGb,aAAA,CAAA,EAAA,GAAA;EACe,YAAA,CAAA,EAAA,KAAA;EAAf,WAAA,CAAA,EAAA,MAAA;EACG,YAAA,CAAA,EAKG,MALH,CAAA,MAAA,EAKkB,MALlB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;EACO,cAAA,CAAA,EAKF,MALE,CAAA,MAAA,EAAA,OAAA,CAAA;EAAR,IAAA,CAAA,EAMJ,MANI,CAAA,MAAA,EAAA,OAAA,CAAA;EAImB,OAAA,CAAA,EAGpB,MAHoB,CAAA,MAAA,EAAA,OAAA,CAAA;CAAf,CAAA,EAIb,WAJa"}
@@ -1,75 +0,0 @@
1
- //#region src/factories.ts
2
- /**
3
- * Creates a StorageColumn with nativeType and codecId.
4
- *
5
- * @param nativeType - Native database type identifier (e.g., 'int4', 'text', 'vector')
6
- * @param codecId - Codec identifier (e.g., 'pg/int4@1', 'pg/text@1')
7
- * @param nullable - Whether the column is nullable (default: false)
8
- * @returns StorageColumn with nativeType and codecId
9
- */
10
- function col(nativeType, codecId, nullable = false) {
11
- return {
12
- nativeType,
13
- codecId,
14
- nullable
15
- };
16
- }
17
- function pk(...columns) {
18
- return { columns };
19
- }
20
- function unique(...columns) {
21
- return { columns };
22
- }
23
- function index(...columns) {
24
- return { columns };
25
- }
26
- function fk(columns, refTable, refColumns, name) {
27
- return {
28
- columns,
29
- references: {
30
- table: refTable,
31
- columns: refColumns
32
- },
33
- ...name !== void 0 && { name }
34
- };
35
- }
36
- function table(columns, opts) {
37
- return {
38
- columns,
39
- ...opts?.pk !== void 0 && { primaryKey: opts.pk },
40
- uniques: opts?.uniques ?? [],
41
- indexes: opts?.indexes ?? [],
42
- foreignKeys: opts?.fks ?? []
43
- };
44
- }
45
- function model(table$1, fields, relations = {}) {
46
- return {
47
- storage: { table: table$1 },
48
- fields,
49
- relations
50
- };
51
- }
52
- function storage(tables) {
53
- return { tables };
54
- }
55
- function contract(opts) {
56
- return {
57
- schemaVersion: opts.schemaVersion ?? "1",
58
- target: opts.target,
59
- targetFamily: opts.targetFamily ?? "sql",
60
- coreHash: opts.coreHash,
61
- storage: opts.storage,
62
- models: opts.models ?? {},
63
- relations: opts.relations ?? {},
64
- mappings: opts.mappings ?? {},
65
- ...opts.profileHash !== void 0 && { profileHash: opts.profileHash },
66
- ...opts.capabilities !== void 0 && { capabilities: opts.capabilities },
67
- ...opts.extensionPacks !== void 0 && { extensionPacks: opts.extensionPacks },
68
- ...opts.meta !== void 0 && { meta: opts.meta },
69
- ...opts.sources !== void 0 && { sources: opts.sources }
70
- };
71
- }
72
-
73
- //#endregion
74
- export { col, contract, fk, index, model, pk, storage, table, unique };
75
- //# sourceMappingURL=factories.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"factories.mjs","names":[],"sources":["../src/factories.ts"],"sourcesContent":["import type {\n ForeignKey,\n ForeignKeyReferences,\n Index,\n ModelDefinition,\n ModelField,\n ModelStorage,\n PrimaryKey,\n SqlContract,\n SqlMappings,\n SqlStorage,\n StorageColumn,\n StorageTable,\n UniqueConstraint,\n} from './types';\n\n/**\n * Creates a StorageColumn with nativeType and codecId.\n *\n * @param nativeType - Native database type identifier (e.g., 'int4', 'text', 'vector')\n * @param codecId - Codec identifier (e.g., 'pg/int4@1', 'pg/text@1')\n * @param nullable - Whether the column is nullable (default: false)\n * @returns StorageColumn with nativeType and codecId\n */\nexport function col(nativeType: string, codecId: string, nullable = false): StorageColumn {\n return {\n nativeType,\n codecId,\n nullable,\n };\n}\n\nexport function pk(...columns: readonly string[]): PrimaryKey {\n return {\n columns,\n };\n}\n\nexport function unique(...columns: readonly string[]): UniqueConstraint {\n return {\n columns,\n };\n}\n\nexport function index(...columns: readonly string[]): Index {\n return {\n columns,\n };\n}\n\nexport function fk(\n columns: readonly string[],\n refTable: string,\n refColumns: readonly string[],\n name?: string,\n): ForeignKey {\n const references: ForeignKeyReferences = {\n table: refTable,\n columns: refColumns,\n };\n return {\n columns,\n references,\n ...(name !== undefined && { name }),\n };\n}\n\nexport function table(\n columns: Record<string, StorageColumn>,\n opts?: {\n pk?: PrimaryKey;\n uniques?: readonly UniqueConstraint[];\n indexes?: readonly Index[];\n fks?: readonly ForeignKey[];\n },\n): StorageTable {\n return {\n columns,\n ...(opts?.pk !== undefined && { primaryKey: opts.pk }),\n uniques: opts?.uniques ?? [],\n indexes: opts?.indexes ?? [],\n foreignKeys: opts?.fks ?? [],\n };\n}\n\nexport function model(\n table: string,\n fields: Record<string, ModelField>,\n relations: Record<string, unknown> = {},\n): ModelDefinition {\n const storage: ModelStorage = { table };\n return {\n storage,\n fields,\n relations,\n };\n}\n\nexport function storage(tables: Record<string, StorageTable>): SqlStorage {\n return { tables };\n}\n\nexport function contract(opts: {\n target: string;\n coreHash: string;\n storage: SqlStorage;\n models?: Record<string, ModelDefinition>;\n relations?: Record<string, unknown>;\n mappings?: Partial<SqlMappings>;\n schemaVersion?: '1';\n targetFamily?: 'sql';\n profileHash?: string;\n capabilities?: Record<string, Record<string, boolean>>;\n extensionPacks?: Record<string, unknown>;\n meta?: Record<string, unknown>;\n sources?: Record<string, unknown>;\n}): SqlContract {\n return {\n schemaVersion: opts.schemaVersion ?? '1',\n target: opts.target,\n targetFamily: opts.targetFamily ?? 'sql',\n coreHash: opts.coreHash,\n storage: opts.storage,\n models: opts.models ?? {},\n relations: opts.relations ?? {},\n mappings: (opts.mappings ?? {}) as SqlMappings,\n ...(opts.profileHash !== undefined && { profileHash: opts.profileHash }),\n ...(opts.capabilities !== undefined && { capabilities: opts.capabilities }),\n ...(opts.extensionPacks !== undefined && { extensionPacks: opts.extensionPacks }),\n ...(opts.meta !== undefined && { meta: opts.meta }),\n ...(opts.sources !== undefined && { sources: opts.sources as Record<string, unknown> }),\n } as SqlContract;\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAgB,IAAI,YAAoB,SAAiB,WAAW,OAAsB;AACxF,QAAO;EACL;EACA;EACA;EACD;;AAGH,SAAgB,GAAG,GAAG,SAAwC;AAC5D,QAAO,EACL,SACD;;AAGH,SAAgB,OAAO,GAAG,SAA8C;AACtE,QAAO,EACL,SACD;;AAGH,SAAgB,MAAM,GAAG,SAAmC;AAC1D,QAAO,EACL,SACD;;AAGH,SAAgB,GACd,SACA,UACA,YACA,MACY;AAKZ,QAAO;EACL;EACA,YANuC;GACvC,OAAO;GACP,SAAS;GACV;EAIC,GAAI,SAAS,UAAa,EAAE,MAAM;EACnC;;AAGH,SAAgB,MACd,SACA,MAMc;AACd,QAAO;EACL;EACA,GAAI,MAAM,OAAO,UAAa,EAAE,YAAY,KAAK,IAAI;EACrD,SAAS,MAAM,WAAW,EAAE;EAC5B,SAAS,MAAM,WAAW,EAAE;EAC5B,aAAa,MAAM,OAAO,EAAE;EAC7B;;AAGH,SAAgB,MACd,SACA,QACA,YAAqC,EAAE,EACtB;AAEjB,QAAO;EACL,SAF4B,EAAE,gBAAO;EAGrC;EACA;EACD;;AAGH,SAAgB,QAAQ,QAAkD;AACxE,QAAO,EAAE,QAAQ;;AAGnB,SAAgB,SAAS,MAcT;AACd,QAAO;EACL,eAAe,KAAK,iBAAiB;EACrC,QAAQ,KAAK;EACb,cAAc,KAAK,gBAAgB;EACnC,UAAU,KAAK;EACf,SAAS,KAAK;EACd,QAAQ,KAAK,UAAU,EAAE;EACzB,WAAW,KAAK,aAAa,EAAE;EAC/B,UAAW,KAAK,YAAY,EAAE;EAC9B,GAAI,KAAK,gBAAgB,UAAa,EAAE,aAAa,KAAK,aAAa;EACvE,GAAI,KAAK,iBAAiB,UAAa,EAAE,cAAc,KAAK,cAAc;EAC1E,GAAI,KAAK,mBAAmB,UAAa,EAAE,gBAAgB,KAAK,gBAAgB;EAChF,GAAI,KAAK,SAAS,UAAa,EAAE,MAAM,KAAK,MAAM;EAClD,GAAI,KAAK,YAAY,UAAa,EAAE,SAAS,KAAK,SAAoC;EACvF"}
@@ -1,13 +0,0 @@
1
- //#region src/pack-types.d.ts
2
- /**
3
- * Storage type metadata for pack refs.
4
- */
5
- interface StorageTypeMetadata {
6
- readonly typeId: string;
7
- readonly familyId: string;
8
- readonly targetId: string;
9
- readonly nativeType?: string;
10
- }
11
- //#endregion
12
- export { type StorageTypeMetadata };
13
- //# sourceMappingURL=pack-types.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pack-types.d.mts","names":[],"sources":["../src/pack-types.ts"],"sourcesContent":[],"mappings":";;AAGA;;UAAiB,mBAAA"}
@@ -1 +0,0 @@
1
- export { };
@@ -1,72 +0,0 @@
1
- import { ContractBase } from "@prisma-next/contract/types";
2
-
3
- //#region src/types.d.ts
4
- type StorageColumn = {
5
- readonly nativeType: string;
6
- readonly codecId: string;
7
- readonly nullable: boolean;
8
- };
9
- type PrimaryKey = {
10
- readonly columns: readonly string[];
11
- readonly name?: string;
12
- };
13
- type UniqueConstraint = {
14
- readonly columns: readonly string[];
15
- readonly name?: string;
16
- };
17
- type Index = {
18
- readonly columns: readonly string[];
19
- readonly name?: string;
20
- };
21
- type ForeignKeyReferences = {
22
- readonly table: string;
23
- readonly columns: readonly string[];
24
- };
25
- type ForeignKey = {
26
- readonly columns: readonly string[];
27
- readonly references: ForeignKeyReferences;
28
- readonly name?: string;
29
- };
30
- type StorageTable = {
31
- readonly columns: Record<string, StorageColumn>;
32
- readonly primaryKey?: PrimaryKey;
33
- readonly uniques: ReadonlyArray<UniqueConstraint>;
34
- readonly indexes: ReadonlyArray<Index>;
35
- readonly foreignKeys: ReadonlyArray<ForeignKey>;
36
- };
37
- type SqlStorage = {
38
- readonly tables: Record<string, StorageTable>;
39
- };
40
- type ModelField = {
41
- readonly column: string;
42
- };
43
- type ModelStorage = {
44
- readonly table: string;
45
- };
46
- type ModelDefinition = {
47
- readonly storage: ModelStorage;
48
- readonly fields: Record<string, ModelField>;
49
- readonly relations: Record<string, unknown>;
50
- };
51
- type SqlMappings = {
52
- readonly modelToTable?: Record<string, string>;
53
- readonly tableToModel?: Record<string, string>;
54
- readonly fieldToColumn?: Record<string, Record<string, string>>;
55
- readonly columnToField?: Record<string, Record<string, string>>;
56
- readonly codecTypes: Record<string, {
57
- readonly output: unknown;
58
- }>;
59
- readonly operationTypes: Record<string, Record<string, unknown>>;
60
- };
61
- type SqlContract<S extends SqlStorage = SqlStorage, M extends Record<string, unknown> = Record<string, unknown>, R extends Record<string, unknown> = Record<string, unknown>, Map extends SqlMappings = SqlMappings> = ContractBase & {
62
- readonly targetFamily: string;
63
- readonly storage: S;
64
- readonly models: M;
65
- readonly relations: R;
66
- readonly mappings: Map;
67
- };
68
- type ExtractCodecTypes<TContract extends SqlContract<SqlStorage>> = TContract['mappings']['codecTypes'];
69
- type ExtractOperationTypes<TContract extends SqlContract<SqlStorage>> = TContract['mappings']['operationTypes'];
70
- //#endregion
71
- export { Index as a, ModelStorage as c, SqlMappings as d, SqlStorage as f, UniqueConstraint as h, ForeignKeyReferences as i, PrimaryKey as l, StorageTable as m, ExtractOperationTypes as n, ModelDefinition as o, StorageColumn as p, ForeignKey as r, ModelField as s, ExtractCodecTypes as t, SqlContract as u };
72
- //# sourceMappingURL=types-BMHD8-1o.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-BMHD8-1o.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAEY,aAAA;;EAAA,SAAA,OAAa,EAAA,MAAA;EAMb,SAAA,QAAU,EAAA,OAAA;AAKtB,CAAA;AAKY,KAVA,UAAA,GAUK;EAKL,SAAA,OAAA,EAAA,SAAoB,MAAA,EAAA;EAKpB,SAAA,IAAU,CAAA,EAAA,MAAA;AAMtB,CAAA;AACmC,KAtBvB,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CAAA,EAbsB,MAatB,CAAA,MAAA,EAAA,MAAA,CAAA;EAEgB,SAAA,YAAA,CAAA,EAdM,MAcN,CAAA,MAAA,EAAA,MAAA,CAAA;EACD,SAAA,aAAA,CAAA,EAdQ,MAcR,CAAA,MAAA,EAduB,MAcvB,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA;EACG,SAAA,aAAA,CAAA,EAdK,MAcL,CAAA,MAAA,EAdoB,MAcpB,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA;EACD,SAAA,UAAA,EAdE,MAcF,CAAA,MAAA,EAAA;IAAG,SAAA,MAAA,EAAA,OAAA;EAGZ,CAAA,CAAA;EAAgD,SAAA,cAAA,EAhBjC,MAgBiC,CAAA,MAAA,EAhBlB,MAgBkB,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;CAAZ;AAC9C,KAdU,WAcV,CAAA,UAbU,UAaV,GAbuB,UAavB,EAAA,UAZU,MAYV,CAAA,MAAA,EAAA,OAAA,CAAA,GAZoC,MAYpC,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,UAXU,MAWV,CAAA,MAAA,EAAA,OAAA,CAAA,GAXoC,MAWpC,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,YAVY,WAUZ,GAV0B,WAU1B,CAAA,GATE,YASF,GAAA;EAAS,SAAA,YAAA,EAAA,MAAA;EAEC,SAAA,OAAA,EATQ,CASR;EAAoD,SAAA,MAAA,EAR7C,CAQ6C;EAAZ,SAAA,SAAA,EAP9B,CAO8B;EAClD,SAAA,QAAA,EAPmB,GAOnB;CAAS;KAJC,oCAAoC,YAAY,eAC1D;KAEU,wCAAwC,YAAY,eAC9D"}
package/dist/types.d.mts DELETED
@@ -1,2 +0,0 @@
1
- import { a as Index, c as ModelStorage, d as SqlMappings, f as SqlStorage, h as UniqueConstraint, i as ForeignKeyReferences, l as PrimaryKey, m as StorageTable, n as ExtractOperationTypes, o as ModelDefinition, p as StorageColumn, r as ForeignKey, s as ModelField, t as ExtractCodecTypes, u as SqlContract } from "./types-BMHD8-1o.mjs";
2
- export { type ExtractCodecTypes, type ExtractOperationTypes, type ForeignKey, type ForeignKeyReferences, type Index, type ModelDefinition, type ModelField, type ModelStorage, type PrimaryKey, type SqlContract, type SqlMappings, type SqlStorage, type StorageColumn, type StorageTable, type UniqueConstraint };
package/dist/types.mjs DELETED
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- {"version":3,"file":"validators.d.mts","names":[],"sources":["../src/validators.ts"],"sourcesContent":[],"mappings":";;;;;;AA+FA;AAgBA;AAyBA;;;AAAwF,iBAzCxE,eAAA,CAyCwE,KAAA,EAAA,OAAA,CAAA,EAzCvC,UAyCuC;;;;;;;;iBAzBxE,aAAA,kBAA+B;;;;;;;;;;;;;;;;;iBAyB/B,8BAA8B,YAAY,8BAA8B"}
@@ -1,117 +0,0 @@
1
- import { type } from "arktype";
2
-
3
- //#region src/validators.ts
4
- const StorageColumnSchema = type.declare().type({
5
- nativeType: "string",
6
- codecId: "string",
7
- nullable: "boolean"
8
- });
9
- const PrimaryKeySchema = type.declare().type({
10
- columns: type.string.array().readonly(),
11
- "name?": "string"
12
- });
13
- const UniqueConstraintSchema = type.declare().type({
14
- columns: type.string.array().readonly(),
15
- "name?": "string"
16
- });
17
- const IndexSchema = type.declare().type({
18
- columns: type.string.array().readonly(),
19
- "name?": "string"
20
- });
21
- const ForeignKeyReferencesSchema = type.declare().type({
22
- table: "string",
23
- columns: type.string.array().readonly()
24
- });
25
- const ForeignKeySchema = type.declare().type({
26
- columns: type.string.array().readonly(),
27
- references: ForeignKeyReferencesSchema,
28
- "name?": "string"
29
- });
30
- const StorageTableSchema = type.declare().type({
31
- columns: type({ "[string]": StorageColumnSchema }),
32
- "primaryKey?": PrimaryKeySchema,
33
- uniques: UniqueConstraintSchema.array().readonly(),
34
- indexes: IndexSchema.array().readonly(),
35
- foreignKeys: ForeignKeySchema.array().readonly()
36
- });
37
- const StorageSchema = type.declare().type({ tables: type({ "[string]": StorageTableSchema }) });
38
- const ModelFieldSchema = type.declare().type({ column: "string" });
39
- const ModelStorageSchema = type.declare().type({ table: "string" });
40
- const ModelSchema = type.declare().type({
41
- storage: ModelStorageSchema,
42
- fields: type({ "[string]": ModelFieldSchema }),
43
- relations: type({ "[string]": "unknown" })
44
- });
45
- const SqlContractSchema = type({
46
- "schemaVersion?": "'1'",
47
- target: "string",
48
- targetFamily: "'sql'",
49
- coreHash: "string",
50
- "profileHash?": "string",
51
- "capabilities?": "Record<string, Record<string, boolean>>",
52
- "extensionPacks?": "Record<string, unknown>",
53
- "meta?": "Record<string, unknown>",
54
- "sources?": "Record<string, unknown>",
55
- models: type({ "[string]": ModelSchema }),
56
- storage: StorageSchema
57
- });
58
- /**
59
- * Validates the structural shape of SqlStorage using Arktype.
60
- *
61
- * @param value - The storage value to validate
62
- * @returns The validated storage if structure is valid
63
- * @throws Error if the storage structure is invalid
64
- */
65
- function validateStorage(value) {
66
- const result = StorageSchema(value);
67
- if (result instanceof type.errors) {
68
- const messages = result.map((p) => p.message).join("; ");
69
- throw new Error(`Storage validation failed: ${messages}`);
70
- }
71
- return result;
72
- }
73
- /**
74
- * Validates the structural shape of ModelDefinition using Arktype.
75
- *
76
- * @param value - The model value to validate
77
- * @returns The validated model if structure is valid
78
- * @throws Error if the model structure is invalid
79
- */
80
- function validateModel(value) {
81
- const result = ModelSchema(value);
82
- if (result instanceof type.errors) {
83
- const messages = result.map((p) => p.message).join("; ");
84
- throw new Error(`Model validation failed: ${messages}`);
85
- }
86
- return result;
87
- }
88
- /**
89
- * Validates the structural shape of a SqlContract using Arktype.
90
- *
91
- * **Responsibility: Validation Only**
92
- * This function validates that the contract has the correct structure and types.
93
- * It does NOT normalize the contract - normalization must happen in the contract builder.
94
- *
95
- * The contract passed to this function must already be normalized (all required fields present).
96
- * If normalization is needed, it should be done by the contract builder before calling this function.
97
- *
98
- * This ensures all required fields are present and have the correct types.
99
- *
100
- * @param value - The contract value to validate (typically from a JSON import)
101
- * @returns The validated contract if structure is valid
102
- * @throws Error if the contract structure is invalid
103
- */
104
- function validateSqlContract(value) {
105
- const rawValue = value;
106
- if (rawValue.targetFamily !== void 0 && rawValue.targetFamily !== "sql") throw new Error(`Unsupported target family: ${rawValue.targetFamily}`);
107
- const contractResult = SqlContractSchema(value);
108
- if (contractResult instanceof type.errors) {
109
- const messages = contractResult.map((p) => p.message).join("; ");
110
- throw new Error(`Contract structural validation failed: ${messages}`);
111
- }
112
- return contractResult;
113
- }
114
-
115
- //#endregion
116
- export { validateModel, validateSqlContract, validateStorage };
117
- //# sourceMappingURL=validators.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validators.mjs","names":[],"sources":["../src/validators.ts"],"sourcesContent":["import { type } from 'arktype';\nimport type {\n ForeignKey,\n ForeignKeyReferences,\n Index,\n ModelDefinition,\n ModelField,\n ModelStorage,\n PrimaryKey,\n SqlContract,\n SqlStorage,\n StorageColumn,\n StorageTable,\n UniqueConstraint,\n} from './types';\n\nconst StorageColumnSchema = type.declare<StorageColumn>().type({\n nativeType: 'string',\n codecId: 'string',\n nullable: 'boolean',\n});\n\nconst PrimaryKeySchema = type.declare<PrimaryKey>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nconst UniqueConstraintSchema = type.declare<UniqueConstraint>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nconst IndexSchema = type.declare<Index>().type({\n columns: type.string.array().readonly(),\n 'name?': 'string',\n});\n\nconst ForeignKeyReferencesSchema = type.declare<ForeignKeyReferences>().type({\n table: 'string',\n columns: type.string.array().readonly(),\n});\n\nconst ForeignKeySchema = type.declare<ForeignKey>().type({\n columns: type.string.array().readonly(),\n references: ForeignKeyReferencesSchema,\n 'name?': 'string',\n});\n\nconst StorageTableSchema = type.declare<StorageTable>().type({\n columns: type({ '[string]': StorageColumnSchema }),\n 'primaryKey?': PrimaryKeySchema,\n uniques: UniqueConstraintSchema.array().readonly(),\n indexes: IndexSchema.array().readonly(),\n foreignKeys: ForeignKeySchema.array().readonly(),\n});\n\nconst StorageSchema = type.declare<SqlStorage>().type({\n tables: type({ '[string]': StorageTableSchema }),\n});\n\nconst ModelFieldSchema = type.declare<ModelField>().type({\n column: 'string',\n});\n\nconst ModelStorageSchema = type.declare<ModelStorage>().type({\n table: 'string',\n});\n\nconst ModelSchema = type.declare<ModelDefinition>().type({\n storage: ModelStorageSchema,\n fields: type({ '[string]': ModelFieldSchema }),\n relations: type({ '[string]': 'unknown' }),\n});\n\nconst SqlContractSchema = type({\n 'schemaVersion?': \"'1'\",\n target: 'string',\n targetFamily: \"'sql'\",\n coreHash: 'string',\n 'profileHash?': 'string',\n 'capabilities?': 'Record<string, Record<string, boolean>>',\n 'extensionPacks?': 'Record<string, unknown>',\n 'meta?': 'Record<string, unknown>',\n 'sources?': 'Record<string, unknown>',\n models: type({ '[string]': ModelSchema }),\n storage: StorageSchema,\n});\n\n/**\n * Validates the structural shape of SqlStorage using Arktype.\n *\n * @param value - The storage value to validate\n * @returns The validated storage if structure is valid\n * @throws Error if the storage structure is invalid\n */\nexport function validateStorage(value: unknown): SqlStorage {\n const result = StorageSchema(value);\n if (result instanceof type.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Storage validation failed: ${messages}`);\n }\n return result;\n}\n\n/**\n * Validates the structural shape of ModelDefinition using Arktype.\n *\n * @param value - The model value to validate\n * @returns The validated model if structure is valid\n * @throws Error if the model structure is invalid\n */\nexport function validateModel(value: unknown): ModelDefinition {\n const result = ModelSchema(value);\n if (result instanceof type.errors) {\n const messages = result.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Model validation failed: ${messages}`);\n }\n return result;\n}\n\n/**\n * Validates the structural shape of a SqlContract using Arktype.\n *\n * **Responsibility: Validation Only**\n * This function validates that the contract has the correct structure and types.\n * It does NOT normalize the contract - normalization must happen in the contract builder.\n *\n * The contract passed to this function must already be normalized (all required fields present).\n * If normalization is needed, it should be done by the contract builder before calling this function.\n *\n * This ensures all required fields are present and have the correct types.\n *\n * @param value - The contract value to validate (typically from a JSON import)\n * @returns The validated contract if structure is valid\n * @throws Error if the contract structure is invalid\n */\nexport function validateSqlContract<T extends SqlContract<SqlStorage>>(value: unknown): T {\n // Check targetFamily first to provide a clear error message for unsupported target families\n const rawValue = value as { targetFamily?: string };\n if (rawValue.targetFamily !== undefined && rawValue.targetFamily !== 'sql') {\n throw new Error(`Unsupported target family: ${rawValue.targetFamily}`);\n }\n\n const contractResult = SqlContractSchema(value);\n\n if (contractResult instanceof type.errors) {\n const messages = contractResult.map((p: { message: string }) => p.message).join('; ');\n throw new Error(`Contract structural validation failed: ${messages}`);\n }\n\n // After validation, contractResult matches the schema and preserves the input structure\n // TypeScript needs an assertion here due to exactOptionalPropertyTypes differences\n // between Arktype's inferred type and the generic T, but runtime-wise they're compatible\n return contractResult as T;\n}\n"],"mappings":";;;AAgBA,MAAM,sBAAsB,KAAK,SAAwB,CAAC,KAAK;CAC7D,YAAY;CACZ,SAAS;CACT,UAAU;CACX,CAAC;AAEF,MAAM,mBAAmB,KAAK,SAAqB,CAAC,KAAK;CACvD,SAAS,KAAK,OAAO,OAAO,CAAC,UAAU;CACvC,SAAS;CACV,CAAC;AAEF,MAAM,yBAAyB,KAAK,SAA2B,CAAC,KAAK;CACnE,SAAS,KAAK,OAAO,OAAO,CAAC,UAAU;CACvC,SAAS;CACV,CAAC;AAEF,MAAM,cAAc,KAAK,SAAgB,CAAC,KAAK;CAC7C,SAAS,KAAK,OAAO,OAAO,CAAC,UAAU;CACvC,SAAS;CACV,CAAC;AAEF,MAAM,6BAA6B,KAAK,SAA+B,CAAC,KAAK;CAC3E,OAAO;CACP,SAAS,KAAK,OAAO,OAAO,CAAC,UAAU;CACxC,CAAC;AAEF,MAAM,mBAAmB,KAAK,SAAqB,CAAC,KAAK;CACvD,SAAS,KAAK,OAAO,OAAO,CAAC,UAAU;CACvC,YAAY;CACZ,SAAS;CACV,CAAC;AAEF,MAAM,qBAAqB,KAAK,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