@prisma-next/target-postgres 0.14.0-dev.2 → 0.14.0-dev.20

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 (153) hide show
  1. package/dist/canonicalize-Bn3BM1Cn.mjs +46 -0
  2. package/dist/canonicalize-Bn3BM1Cn.mjs.map +1 -0
  3. package/dist/canonicalize-CAbXtVtB.d.mts +37 -0
  4. package/dist/canonicalize-CAbXtVtB.d.mts.map +1 -0
  5. package/dist/codecs.mjs.map +1 -1
  6. package/dist/contract-free.d.mts +8 -3
  7. package/dist/contract-free.d.mts.map +1 -1
  8. package/dist/contract-free.mjs +3 -3
  9. package/dist/control.d.mts +1 -1
  10. package/dist/control.mjs +6 -6
  11. package/dist/data-transform-BOWpliq8.mjs.map +1 -1
  12. package/dist/{data-transform-DDgWdB5o.d.mts → data-transform-qKy1U5V9.d.mts} +2 -2
  13. package/dist/{data-transform-DDgWdB5o.d.mts.map → data-transform-qKy1U5V9.d.mts.map} +1 -1
  14. package/dist/data-transform.d.mts +1 -1
  15. package/dist/{ddl-QDyOSeLc.mjs → ddl-D1K9soOg.mjs} +62 -5
  16. package/dist/ddl-D1K9soOg.mjs.map +1 -0
  17. package/dist/ddl.d.mts +3 -2
  18. package/dist/ddl.mjs +2 -2
  19. package/dist/{default-normalizer-DyyCHQWs.mjs → default-normalizer-CzV8-QSu.mjs} +58 -2
  20. package/dist/default-normalizer-CzV8-QSu.mjs.map +1 -0
  21. package/dist/default-normalizer.d.mts +1 -1
  22. package/dist/default-normalizer.d.mts.map +1 -1
  23. package/dist/default-normalizer.mjs +1 -1
  24. package/dist/descriptor-meta-b_SzXwen.mjs +239 -0
  25. package/dist/descriptor-meta-b_SzXwen.mjs.map +1 -0
  26. package/dist/{issue-planner-DL6g3CmE.mjs → issue-planner-CUeQ7D83.mjs} +11 -9
  27. package/dist/issue-planner-CUeQ7D83.mjs.map +1 -0
  28. package/dist/issue-planner.d.mts +3 -3
  29. package/dist/issue-planner.d.mts.map +1 -1
  30. package/dist/issue-planner.mjs +1 -1
  31. package/dist/migration.d.mts +3 -3
  32. package/dist/migration.mjs +2 -2
  33. package/dist/nodes-CSkPX3rI.d.mts +120 -0
  34. package/dist/nodes-CSkPX3rI.d.mts.map +1 -0
  35. package/dist/{nodes-Bbhs2rwj.mjs → nodes-Dh__NS58.mjs} +56 -2
  36. package/dist/nodes-Dh__NS58.mjs.map +1 -0
  37. package/dist/{op-factory-call-DmQEc3XV.d.mts → op-factory-call-CQ4P40QC.d.mts} +44 -13
  38. package/dist/op-factory-call-CQ4P40QC.d.mts.map +1 -0
  39. package/dist/{op-factory-call-D_p5vxwt.mjs → op-factory-call-CyqPjAwf.mjs} +199 -28
  40. package/dist/op-factory-call-CyqPjAwf.mjs.map +1 -0
  41. package/dist/op-factory-call.d.mts +1 -1
  42. package/dist/op-factory-call.mjs +1 -1
  43. package/dist/pack.d.mts +74 -1
  44. package/dist/pack.d.mts.map +1 -1
  45. package/dist/pack.mjs +1 -1
  46. package/dist/{planner-Bs_baQax.mjs → planner-D5zY__R3.mjs} +115 -23
  47. package/dist/planner-D5zY__R3.mjs.map +1 -0
  48. package/dist/{planner-ddl-builders-B2wOwLqI.mjs → planner-ddl-builders-B8Nn6nHN.mjs} +12 -27
  49. package/dist/planner-ddl-builders-B8Nn6nHN.mjs.map +1 -0
  50. package/dist/planner-ddl-builders.d.mts +2 -4
  51. package/dist/planner-ddl-builders.d.mts.map +1 -1
  52. package/dist/planner-ddl-builders.mjs +2 -2
  53. package/dist/{planner-produced-postgres-migration-QqHa2C2l.d.mts → planner-produced-postgres-migration-CNTSCMl7.d.mts} +3 -3
  54. package/dist/{planner-produced-postgres-migration-QqHa2C2l.d.mts.map → planner-produced-postgres-migration-CNTSCMl7.d.mts.map} +1 -1
  55. package/dist/{planner-produced-postgres-migration-Cji5vxUf.mjs → planner-produced-postgres-migration-D8JHnu5j.mjs} +2 -2
  56. package/dist/{planner-produced-postgres-migration-Cji5vxUf.mjs.map → planner-produced-postgres-migration-D8JHnu5j.mjs.map} +1 -1
  57. package/dist/planner-produced-postgres-migration.d.mts +1 -1
  58. package/dist/planner-produced-postgres-migration.mjs +1 -1
  59. package/dist/{planner-sql-checks-jqUUGyQR.mjs → planner-sql-checks-CI6Z21mm.mjs} +2 -2
  60. package/dist/{planner-sql-checks-jqUUGyQR.mjs.map → planner-sql-checks-CI6Z21mm.mjs.map} +1 -1
  61. package/dist/planner-sql-checks.mjs +1 -1
  62. package/dist/{planner-target-details-CIY6tLeo.d.mts → planner-target-details-HkP4RrRO.d.mts} +2 -2
  63. package/dist/planner-target-details-HkP4RrRO.d.mts.map +1 -0
  64. package/dist/planner-target-details.d.mts +1 -1
  65. package/dist/planner.d.mts +35 -3
  66. package/dist/planner.d.mts.map +1 -1
  67. package/dist/planner.mjs +2 -2
  68. package/dist/{postgres-contract-serializer-k3TAcPMY.mjs → postgres-contract-serializer-k5eg5ZUZ.mjs} +29 -16
  69. package/dist/postgres-contract-serializer-k5eg5ZUZ.mjs.map +1 -0
  70. package/dist/{postgres-migration-B5jKrXv3.mjs → postgres-migration-BoqzWSkj.mjs} +2 -2
  71. package/dist/{postgres-migration-B5jKrXv3.mjs.map → postgres-migration-BoqzWSkj.mjs.map} +1 -1
  72. package/dist/{postgres-migration-Y4YBJqkS.d.mts → postgres-migration-DJNJHcdP.d.mts} +4 -4
  73. package/dist/{postgres-migration-Y4YBJqkS.d.mts.map → postgres-migration-DJNJHcdP.d.mts.map} +1 -1
  74. package/dist/postgres-rls-policy-D_z1osEq.d.mts +60 -0
  75. package/dist/postgres-rls-policy-D_z1osEq.d.mts.map +1 -0
  76. package/dist/postgres-role-_CCuyPCQ.d.mts +33 -0
  77. package/dist/postgres-role-_CCuyPCQ.d.mts.map +1 -0
  78. package/dist/{postgres-schema-COGZ1ark.mjs → postgres-schema-BVDr_61a.mjs} +139 -3
  79. package/dist/postgres-schema-BVDr_61a.mjs.map +1 -0
  80. package/dist/postgres-schema-D0h4lsw2.d.mts +158 -0
  81. package/dist/postgres-schema-D0h4lsw2.d.mts.map +1 -0
  82. package/dist/postgres-schema-ir-BF0X8jit.mjs +66 -0
  83. package/dist/postgres-schema-ir-BF0X8jit.mjs.map +1 -0
  84. package/dist/postgres-schema-ir-BQ3RpZMz.d.mts +60 -0
  85. package/dist/postgres-schema-ir-BQ3RpZMz.d.mts.map +1 -0
  86. package/dist/postgres-schema-ir-annotations-El62Sywa.mjs +14 -0
  87. package/dist/postgres-schema-ir-annotations-El62Sywa.mjs.map +1 -0
  88. package/dist/render-ops.d.mts +1 -1
  89. package/dist/rls-canonicalize.d.mts +2 -0
  90. package/dist/rls-canonicalize.mjs +2 -0
  91. package/dist/runtime.d.mts +3 -2
  92. package/dist/runtime.d.mts.map +1 -1
  93. package/dist/runtime.mjs +2 -2
  94. package/dist/schema-ir-annotations.d.mts +8 -0
  95. package/dist/schema-ir-annotations.d.mts.map +1 -0
  96. package/dist/schema-ir-annotations.mjs +2 -0
  97. package/dist/types.d.mts +5 -140
  98. package/dist/types.mjs +3 -2
  99. package/package.json +21 -17
  100. package/src/contract-free/checks.ts +73 -0
  101. package/src/contract-free/ddl.ts +45 -1
  102. package/src/core/authoring.ts +115 -1
  103. package/src/core/codecs.ts +1 -1
  104. package/src/core/ddl/nodes.ts +94 -2
  105. package/src/core/default-normalizer.ts +60 -2
  106. package/src/core/descriptor-meta.ts +4 -0
  107. package/src/core/entity-kinds.ts +16 -0
  108. package/src/core/migrations/bound-schema.ts +10 -0
  109. package/src/core/migrations/control-policy.ts +3 -0
  110. package/src/core/migrations/issue-planner.ts +8 -0
  111. package/src/core/migrations/op-factory-call.ts +106 -21
  112. package/src/core/migrations/operations/columns.ts +24 -12
  113. package/src/core/migrations/operations/data-transform.ts +6 -0
  114. package/src/core/migrations/operations/rls.ts +106 -0
  115. package/src/core/migrations/operations/shared.ts +0 -30
  116. package/src/core/migrations/planner-ddl-builders.ts +15 -56
  117. package/src/core/migrations/planner-recipes.ts +31 -13
  118. package/src/core/migrations/planner-strategies.ts +3 -11
  119. package/src/core/migrations/planner-target-details.ts +3 -1
  120. package/src/core/migrations/planner.ts +99 -1
  121. package/src/core/migrations/verify-postgres-namespaces.ts +12 -15
  122. package/src/core/migrations/verify-postgres-rls-policies.ts +62 -0
  123. package/src/core/postgres-contract-serializer.ts +43 -19
  124. package/src/core/postgres-rls-policy.ts +103 -0
  125. package/src/core/postgres-role.ts +53 -0
  126. package/src/core/postgres-schema-ir-annotations.ts +22 -0
  127. package/src/core/postgres-schema-ir.ts +101 -0
  128. package/src/core/postgres-schema.ts +24 -4
  129. package/src/core/postgres-validators.ts +20 -0
  130. package/src/core/rls/canonicalize.ts +48 -0
  131. package/src/exports/contract-free.ts +7 -1
  132. package/src/exports/ddl.ts +4 -0
  133. package/src/exports/planner-ddl-builders.ts +0 -2
  134. package/src/exports/planner.ts +1 -0
  135. package/src/exports/rls-canonicalize.ts +6 -0
  136. package/src/exports/schema-ir-annotations.ts +1 -0
  137. package/src/exports/types.ts +12 -0
  138. package/dist/ddl-QDyOSeLc.mjs.map +0 -1
  139. package/dist/default-normalizer-DyyCHQWs.mjs.map +0 -1
  140. package/dist/descriptor-meta-CpGygXpI.mjs +0 -140
  141. package/dist/descriptor-meta-CpGygXpI.mjs.map +0 -1
  142. package/dist/issue-planner-DL6g3CmE.mjs.map +0 -1
  143. package/dist/nodes-Bbhs2rwj.mjs.map +0 -1
  144. package/dist/nodes-pLeLgdis.d.mts +0 -67
  145. package/dist/nodes-pLeLgdis.d.mts.map +0 -1
  146. package/dist/op-factory-call-D_p5vxwt.mjs.map +0 -1
  147. package/dist/op-factory-call-DmQEc3XV.d.mts.map +0 -1
  148. package/dist/planner-Bs_baQax.mjs.map +0 -1
  149. package/dist/planner-ddl-builders-B2wOwLqI.mjs.map +0 -1
  150. package/dist/planner-target-details-CIY6tLeo.d.mts.map +0 -1
  151. package/dist/postgres-contract-serializer-k3TAcPMY.mjs.map +0 -1
  152. package/dist/postgres-schema-COGZ1ark.mjs.map +0 -1
  153. package/dist/types.d.mts.map +0 -1
@@ -17,8 +17,16 @@ import { blindCast } from '@prisma-next/utils/casts';
17
17
  import { ifDefined } from '@prisma-next/utils/defined';
18
18
  import { PostgresTableSource } from './ast/table-source';
19
19
  import { PG_TEXT_CODEC_ID } from './codec-ids';
20
+ import { policyEntityKind, roleEntityKind } from './entity-kinds';
21
+ import type { PostgresRlsPolicy } from './postgres-rls-policy';
22
+ import type { PostgresRole } from './postgres-role';
20
23
  import { escapeLiteral } from './sql-utils';
21
24
 
25
+ export type PostgresNamespaceEntries = SqlNamespaceEntries & {
26
+ readonly policy?: Readonly<Record<string, PostgresRlsPolicy>>;
27
+ readonly role?: Readonly<Record<string, PostgresRole>>;
28
+ };
29
+
22
30
  export interface PostgresSchemaInput {
23
31
  readonly id: string;
24
32
  readonly entries: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
@@ -50,13 +58,17 @@ export class PostgresSchema extends NamespaceBase {
50
58
 
51
59
  declare readonly kind: 'schema';
52
60
  readonly id: string;
53
- readonly entries: SqlNamespaceEntries;
61
+ readonly entries: PostgresNamespaceEntries;
54
62
 
55
63
  constructor(input: PostgresSchemaInput) {
56
64
  super();
57
65
  this.id = input.id;
58
66
 
59
- const dispatched = hydrateNamespaceEntities(input.entries, composeSqlEntityKinds(), 'carry');
67
+ const dispatched = hydrateNamespaceEntities(
68
+ input.entries,
69
+ composeSqlEntityKinds([policyEntityKind, roleEntityKind]),
70
+ 'carry',
71
+ );
60
72
 
61
73
  // Drop an empty valueSet so presence signals non-emptiness.
62
74
  const valueSetRaw = dispatched['valueSet'];
@@ -67,8 +79,8 @@ export class PostgresSchema extends NamespaceBase {
67
79
 
68
80
  this.entries = Object.freeze(
69
81
  blindCast<
70
- SqlNamespaceEntries,
71
- 'composeSqlEntityKinds() supplies table→StorageTable and valueSet→StorageValueSet descriptors, so this open-dict result holds exactly the typed members SqlNamespaceEntries declares; the descriptor Map erases those per-kind Node types from the return.'
82
+ PostgresNamespaceEntries,
83
+ 'composeSqlEntityKinds([policyEntityKind, roleEntityKind]) supplies table→StorageTable, valueSet→StorageValueSet, policy→PostgresRlsPolicy, role→PostgresRole descriptors'
72
84
  >(withPresence),
73
85
  );
74
86
  Object.defineProperty(this, 'kind', {
@@ -88,6 +100,14 @@ export class PostgresSchema extends NamespaceBase {
88
100
  return this.entries.valueSet;
89
101
  }
90
102
 
103
+ get policy(): Readonly<Record<string, PostgresRlsPolicy>> {
104
+ return this.entries.policy ?? Object.freeze({});
105
+ }
106
+
107
+ get role(): Readonly<Record<string, PostgresRole>> {
108
+ return this.entries.role ?? Object.freeze({});
109
+ }
110
+
91
111
  /**
92
112
  * The bare schema qualifier as it would appear in a rendered SQL
93
113
  * fragment (already quoted). The unbound-schema singleton overrides
@@ -0,0 +1,20 @@
1
+ import { type } from 'arktype';
2
+
3
+ export const PostgresRoleSchema = type({
4
+ kind: "'role'",
5
+ name: 'string',
6
+ namespaceId: 'string',
7
+ });
8
+
9
+ export const PostgresRlsPolicySchema = type({
10
+ kind: "'policy'",
11
+ name: 'string',
12
+ prefix: 'string',
13
+ tableName: 'string',
14
+ namespaceId: 'string',
15
+ operation: "'select' | 'insert' | 'update' | 'delete' | 'all'",
16
+ roles: type.string.array().readonly(),
17
+ 'using?': 'string',
18
+ 'withCheck?': 'string',
19
+ permissive: 'boolean',
20
+ });
@@ -0,0 +1,48 @@
1
+ import { createHash } from 'node:crypto';
2
+
3
+ export type RlsPolicyOperation = 'select' | 'insert' | 'update' | 'delete' | 'all';
4
+
5
+ export interface ContentHashParts {
6
+ readonly using?: string;
7
+ readonly withCheck?: string;
8
+ readonly roles: readonly string[];
9
+ readonly operation: RlsPolicyOperation;
10
+ readonly permissive: boolean;
11
+ }
12
+
13
+ /**
14
+ * Stabilizes an authored predicate for hashing: trim, and collapse runs of
15
+ * internal whitespace to a single space.
16
+ *
17
+ * This is deliberately minimal. The content hash is the equivalence relation
18
+ * for a policy, and the wire name (prefix + hash) is the only thing ever
19
+ * compared — we never recompute the hash from an introspected policy body, so
20
+ * there is no need to match Postgres's reprinted form. Minimal normalization
21
+ * also protects the no-collision property: aggressive rewriting (lowercasing,
22
+ * paren-stripping, cast-alias folding) risks collapsing two distinct predicates
23
+ * onto one hash. Out-of-band alteration of a hashed policy is unsupported.
24
+ *
25
+ * The normalizer is a stability commitment: any change re-suffixes all wire names.
26
+ */
27
+ export function normalizePredicate(sql: string): string {
28
+ return sql.replace(/\s+/g, ' ').trim();
29
+ }
30
+
31
+ /**
32
+ * Returns the first 8 lowercase hex characters of the SHA-256 digest over the
33
+ * canonical content tuple for an RLS policy:
34
+ *
35
+ * [normalize(using), normalize(withCheck), sortedRoles, operation, permissive]
36
+ *
37
+ * Schema and table are excluded (they are orthogonal to policy equivalence).
38
+ * Uses `JSON.stringify` for a deterministic encoding.
39
+ */
40
+ export function computeContentHash(parts: ContentHashParts): string {
41
+ const using = normalizePredicate(parts.using ?? '');
42
+ const withCheck = normalizePredicate(parts.withCheck ?? '');
43
+ const roles = [...new Set(parts.roles)].sort();
44
+ const permissive = parts.permissive ? 'permissive' : 'restrictive';
45
+
46
+ const tuple = JSON.stringify([using, withCheck, roles, parts.operation, permissive]);
47
+ return createHash('sha256').update(tuple).digest('hex').slice(0, 8);
48
+ }
@@ -24,5 +24,11 @@ export {
24
24
  buildControlTableBootstrapQueries,
25
25
  buildSignMarkerBootstrapQueries,
26
26
  } from '../contract-free/control-bootstrap';
27
- export { addColumnAction, alterTable, createSchema, createTable } from '../contract-free/ddl';
27
+ export {
28
+ addColumnAction,
29
+ alterTable,
30
+ createSchema,
31
+ createTable,
32
+ dropDefaultAction,
33
+ } from '../contract-free/ddl';
28
34
  export { PostgresTableSource } from '../core/ast/table-source';
@@ -3,9 +3,13 @@ export {
3
3
  type AlterTableActionVisitor,
4
4
  type AnyAlterTableAction,
5
5
  type AnyPostgresDdlNode,
6
+ DropDefaultAction,
6
7
  PostgresAlterTable,
8
+ PostgresCreatePolicy,
7
9
  PostgresCreateSchema,
8
10
  PostgresCreateTable,
9
11
  PostgresDdlNode,
10
12
  type PostgresDdlVisitor,
13
+ PostgresDropPolicy,
14
+ type RlsPolicyOperation,
11
15
  } from '../core/ddl/nodes';
@@ -1,7 +1,5 @@
1
1
  export {
2
- buildAddColumnSql,
3
2
  buildColumnDefaultSql,
4
3
  buildColumnTypeSql,
5
- buildCreateTableSql,
6
4
  renderDefaultLiteral,
7
5
  } from '../core/migrations/planner-ddl-builders';
@@ -1 +1,2 @@
1
1
  export { createPostgresMigrationPlanner } from '../core/migrations/planner';
2
+ export { diffPostgresRlsPolicies } from '../core/migrations/verify-postgres-rls-policies';
@@ -0,0 +1,6 @@
1
+ export {
2
+ type ContentHashParts,
3
+ computeContentHash,
4
+ normalizePredicate,
5
+ type RlsPolicyOperation,
6
+ } from '../core/rls/canonicalize';
@@ -0,0 +1 @@
1
+ export { resolveDdlSchemaForNamespaceStorage } from '../core/postgres-schema-ir-annotations';
@@ -1,6 +1,18 @@
1
1
  export {
2
+ PostgresRlsPolicy,
3
+ type PostgresRlsPolicyInput,
4
+ type RlsPolicyOperation,
5
+ } from '../core/postgres-rls-policy';
6
+ export { PostgresRole, type PostgresRoleInput } from '../core/postgres-role';
7
+ export {
8
+ isPostgresSchema,
2
9
  PostgresSchema,
3
10
  PostgresUnboundSchema,
4
11
  postgresCreateNamespace,
5
12
  } from '../core/postgres-schema';
13
+ export {
14
+ isPostgresSchemaIR,
15
+ PostgresSchemaIR,
16
+ type PostgresSchemaIRInput,
17
+ } from '../core/postgres-schema-ir';
6
18
  export type { PostgresColumnDefault } from '../core/types';
@@ -1 +0,0 @@
1
- {"version":3,"file":"ddl-QDyOSeLc.mjs","names":[],"sources":["../src/contract-free/checks.ts","../src/contract-free/ddl.ts"],"sourcesContent":["import type { SelectAst } from '@prisma-next/sql-relational-core/ast';\nimport {\n type CfExpr,\n type CfExprSelectQuery,\n cfExpr,\n cfTable,\n exprSelect,\n} from '@prisma-next/sql-relational-core/contract-free';\nimport { PostgresTableSource } from '../core/ast/table-source';\nimport { PG_TEXT_CODEC_ID } from '../core/codec-ids';\nimport { postgresCreateNamespace } from '../core/postgres-schema';\n\n/**\n * `to_regclass($1)` with the qualified table name bound as a text parameter.\n * Thin vocabulary wrapper over the core `cfExpr.fn` helper — the target\n * supplies only the template and the codec'd operand.\n */\nexport function toRegclass(qualifiedName: string): CfExpr {\n return cfExpr.fn({\n method: 'to_regclass',\n template: 'to_regclass({{self}})',\n self: cfExpr.param(qualifiedName, PG_TEXT_CODEC_ID),\n returns: { codecId: PG_TEXT_CODEC_ID, nullable: true },\n });\n}\n\nexport interface TableExistsCheckBuilder {\n tableAbsent(): SelectAst;\n tablePresent(): SelectAst;\n}\n\n/**\n * Typed builder for the migration planner's table-existence checks. Produces\n * FROM-less `SELECT to_regclass($1) IS [NOT] NULL AS \"result\"` ASTs with the\n * qualified table name bound as a text parameter — never inlined into the SQL.\n *\n * `schema` is a namespace coordinate: the framework `__unbound__` sentinel\n * elides the qualifier (search_path decides at runtime); any other id\n * qualifies as `\"schema\".\"table\"`.\n */\nexport function tableExistsAst(schema: string, table: string): TableExistsCheckBuilder {\n const qualified = postgresCreateNamespace({ id: schema, entries: { table: {} } }).qualifyTable(\n table,\n );\n const regclass = toRegclass(qualified);\n return {\n tableAbsent: () => exprSelect().project('result', regclass.isNull()).build(),\n tablePresent: () => exprSelect().project('result', regclass.isNotNull()).build(),\n };\n}\n\nexport interface ConstraintExistsCheckBuilder {\n constraintPresent(): SelectAst;\n constraintAbsent(): SelectAst;\n}\n\n/**\n * Typed builder for the migration planner's constraint-existence checks.\n * Produces `SELECT [NOT ]EXISTS (SELECT 1 FROM pg_constraint c JOIN\n * pg_namespace n ON n.oid = c.connamespace WHERE c.conname = $1 AND\n * n.nspname = $2 [AND c.conrelid = to_regclass($3)]) AS \"result\"` with the\n * constraint name, schema name, and qualified table name bound as text\n * parameters.\n *\n * When `table` is omitted the check matches by name + schema across all\n * tables. Pass `table` to scope the check to a single table (prevents false\n * matches on identically-named constraints in different tables). `schema`\n * is a namespace coordinate: the `__unbound__` sentinel compares `nspname`\n * against `current_schema()` instead of a bound parameter.\n */\nexport function constraintExistsAst(options: {\n readonly constraintName: string;\n readonly schema: string;\n readonly table?: string;\n}): ConstraintExistsCheckBuilder {\n const namespace = postgresCreateNamespace({ id: options.schema, entries: { table: {} } });\n const conditions = [\n cfExpr.columnRef('c', 'conname').eqParam(options.constraintName, PG_TEXT_CODEC_ID),\n cfExpr.columnRef('n', 'nspname').eqExpr(namespace.schemaFilterExpression()),\n ];\n if (options.table !== undefined) {\n conditions.push(\n cfExpr.columnRef('c', 'conrelid').eqExpr(toRegclass(namespace.qualifyTable(options.table))),\n );\n }\n const inner = (): CfExprSelectQuery =>\n exprSelect()\n .from(cfTable('pg_constraint', 'c'))\n .join(\n cfTable('pg_namespace', 'n'),\n cfExpr.columnRef('n', 'oid').eqExpr(cfExpr.columnRef('c', 'connamespace')),\n )\n .project('one', cfExpr.lit(1))\n .where(cfExpr.allOf(conditions));\n return {\n constraintPresent: () => exprSelect().project('result', cfExpr.exists(inner())).build(),\n constraintAbsent: () => exprSelect().project('result', cfExpr.notExists(inner())).build(),\n };\n}\n\nfunction checkNamespace(schema: string) {\n return postgresCreateNamespace({ id: schema, entries: { table: {} } });\n}\n\nfunction informationSchemaColumns(): PostgresTableSource {\n return new PostgresTableSource({ schema: 'information_schema', name: 'columns' });\n}\n\nfunction infoSchemaColumnConditions(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n}): CfExpr[] {\n return [\n cfExpr\n .identifierRef('table_schema')\n .eqExpr(checkNamespace(options.schema).schemaFilterExpression()),\n cfExpr.identifierRef('table_name').eqParam(options.table, PG_TEXT_CODEC_ID),\n cfExpr.identifierRef('column_name').eqParam(options.column, PG_TEXT_CODEC_ID),\n ];\n}\n\nfunction infoSchemaColumnQuery(conditions: ReadonlyArray<CfExpr>): CfExprSelectQuery {\n return exprSelect()\n .from(informationSchemaColumns())\n .project('one', cfExpr.lit(1))\n .where(cfExpr.allOf(conditions));\n}\n\nexport interface ColumnExistsCheckBuilder {\n columnPresent(): SelectAst;\n columnAbsent(): SelectAst;\n}\n\n/**\n * Typed builder for column-existence checks over\n * `information_schema.columns`, with schema, table, and column names bound\n * as text parameters.\n */\nexport function columnExistsAst(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n}): ColumnExistsCheckBuilder {\n const inner = () => infoSchemaColumnQuery(infoSchemaColumnConditions(options));\n return {\n columnPresent: () => exprSelect().project('result', cfExpr.exists(inner())).build(),\n columnAbsent: () => exprSelect().project('result', cfExpr.notExists(inner())).build(),\n };\n}\n\n/**\n * Typed nullability check: EXISTS over `information_schema.columns` with\n * `is_nullable` compared against the bound `'YES'` / `'NO'` marker.\n */\nexport function columnNullabilityAst(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n readonly nullable: boolean;\n}): SelectAst {\n const conditions = [\n ...infoSchemaColumnConditions(options),\n cfExpr.identifierRef('is_nullable').eqParam(options.nullable ? 'YES' : 'NO', PG_TEXT_CODEC_ID),\n ];\n return exprSelect()\n .project('result', cfExpr.exists(infoSchemaColumnQuery(conditions)))\n .build();\n}\n\nexport interface ColumnDefaultCheckBuilder {\n defaultPresent(): SelectAst;\n defaultAbsent(): SelectAst;\n noDefault(): SelectAst;\n}\n\n/**\n * Typed default-presence checks over `information_schema.columns`.\n * `defaultPresent` / `defaultAbsent` assert the column row exists with a\n * non-null / null `column_default`; `noDefault` is the NOT EXISTS variant\n * (also true when the column row is missing entirely).\n */\nexport function columnDefaultAst(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n}): ColumnDefaultCheckBuilder {\n const withDefault = () =>\n infoSchemaColumnQuery([\n ...infoSchemaColumnConditions(options),\n cfExpr.identifierRef('column_default').isNotNull(),\n ]);\n const withoutDefault = () =>\n infoSchemaColumnQuery([\n ...infoSchemaColumnConditions(options),\n cfExpr.identifierRef('column_default').isNull(),\n ]);\n return {\n defaultPresent: () => exprSelect().project('result', cfExpr.exists(withDefault())).build(),\n defaultAbsent: () => exprSelect().project('result', cfExpr.exists(withoutDefault())).build(),\n noDefault: () => exprSelect().project('result', cfExpr.notExists(withDefault())).build(),\n };\n}\n\n/**\n * Typed column-type check: EXISTS over `pg_attribute` joined to `pg_class`\n * and `pg_namespace`, comparing `format_type(a.atttypid, a.atttypmod)`\n * against the bound expected display type and excluding dropped columns.\n */\nexport function columnTypeAst(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n readonly expectedType: string;\n}): SelectAst {\n const formatType = cfExpr.fn({\n method: 'format_type',\n template: 'format_type({{self}}, {{arg0}})',\n self: cfExpr.columnRef('a', 'atttypid'),\n args: [cfExpr.columnRef('a', 'atttypmod')],\n returns: { codecId: PG_TEXT_CODEC_ID, nullable: false },\n });\n const inner = exprSelect()\n .from(cfTable('pg_attribute', 'a'))\n .join(\n cfTable('pg_class', 'c'),\n cfExpr.columnRef('c', 'oid').eqExpr(cfExpr.columnRef('a', 'attrelid')),\n )\n .join(\n cfTable('pg_namespace', 'n'),\n cfExpr.columnRef('n', 'oid').eqExpr(cfExpr.columnRef('c', 'relnamespace')),\n )\n .project('one', cfExpr.lit(1))\n .where(\n cfExpr.allOf([\n cfExpr\n .columnRef('n', 'nspname')\n .eqExpr(checkNamespace(options.schema).schemaFilterExpression()),\n cfExpr.columnRef('c', 'relname').eqParam(options.table, PG_TEXT_CODEC_ID),\n cfExpr.columnRef('a', 'attname').eqParam(options.column, PG_TEXT_CODEC_ID),\n formatType.eqParam(options.expectedType, PG_TEXT_CODEC_ID),\n cfExpr.columnRef('a', 'attisdropped').not(),\n ]),\n );\n return exprSelect().project('result', cfExpr.exists(inner)).build();\n}\n\nexport interface TablePrimaryKeyCheckBuilder {\n pkPresent(): SelectAst;\n pkAbsent(): SelectAst;\n}\n\n/**\n * Typed primary-key existence check over `pg_index` joined to `pg_class`\n * and `pg_namespace`, with a LEFT JOIN on the index relation so an\n * optional `constraintName` can scope the match to a named constraint.\n */\nexport function tablePrimaryKeyAst(options: {\n readonly schema: string;\n readonly table: string;\n readonly constraintName?: string;\n}): TablePrimaryKeyCheckBuilder {\n const conditions = [\n cfExpr\n .columnRef('n', 'nspname')\n .eqExpr(checkNamespace(options.schema).schemaFilterExpression()),\n cfExpr.columnRef('c', 'relname').eqParam(options.table, PG_TEXT_CODEC_ID),\n cfExpr.columnRef('i', 'indisprimary'),\n ];\n if (options.constraintName !== undefined) {\n conditions.push(\n cfExpr.columnRef('c2', 'relname').eqParam(options.constraintName, PG_TEXT_CODEC_ID),\n );\n }\n const inner = () =>\n exprSelect()\n .from(cfTable('pg_index', 'i'))\n .join(\n cfTable('pg_class', 'c'),\n cfExpr.columnRef('c', 'oid').eqExpr(cfExpr.columnRef('i', 'indrelid')),\n )\n .join(\n cfTable('pg_namespace', 'n'),\n cfExpr.columnRef('n', 'oid').eqExpr(cfExpr.columnRef('c', 'relnamespace')),\n )\n .leftJoin(\n cfTable('pg_class', 'c2'),\n cfExpr.columnRef('c2', 'oid').eqExpr(cfExpr.columnRef('i', 'indexrelid')),\n )\n .project('one', cfExpr.lit(1))\n .where(cfExpr.allOf(conditions));\n return {\n pkPresent: () => exprSelect().project('result', cfExpr.exists(inner())).build(),\n pkAbsent: () => exprSelect().project('result', cfExpr.notExists(inner())).build(),\n };\n}\n\n/**\n * Typed emptiness check: NOT EXISTS over the user table itself with\n * `LIMIT 1`. The table is addressed through the namespace's polymorphic\n * `tableSource` (qualified for named schemas, bare for the unbound slot).\n */\nexport function tableIsEmptyAst(schema: string, table: string): SelectAst {\n const inner = exprSelect()\n .from(checkNamespace(schema).tableSource(table))\n .project('one', cfExpr.lit(1))\n .limit(1);\n return exprSelect().project('result', cfExpr.notExists(inner)).build();\n}\n\n/**\n * Typed no-NULL-values data check used by `SET NOT NULL` prechecks:\n * NOT EXISTS over the user table where the column IS NULL.\n */\nexport function noNullValuesAst(options: {\n readonly schema: string;\n readonly table: string;\n readonly column: string;\n}): SelectAst {\n const inner = exprSelect()\n .from(checkNamespace(options.schema).tableSource(options.table))\n .project('one', cfExpr.lit(1))\n .where(cfExpr.identifierRef(options.column).isNull());\n return exprSelect().project('result', cfExpr.notExists(inner)).build();\n}\n\nexport interface ExtensionExistsCheckBuilder {\n extensionPresent(): SelectAst;\n extensionAbsent(): SelectAst;\n}\n\n/**\n * Typed extension existence check over `pg_extension`, with the extension\n * name bound as a text parameter.\n */\nexport function extensionExistsAst(extensionName: string): ExtensionExistsCheckBuilder {\n const inner = () =>\n exprSelect()\n .from(cfTable('pg_extension'))\n .project('one', cfExpr.lit(1))\n .where(cfExpr.identifierRef('extname').eqParam(extensionName, PG_TEXT_CODEC_ID));\n return {\n extensionPresent: () => exprSelect().project('result', cfExpr.exists(inner())).build(),\n extensionAbsent: () => exprSelect().project('result', cfExpr.notExists(inner())).build(),\n };\n}\n\nexport interface IndexExistsCheckBuilder {\n indexPresent(): SelectAst;\n indexAbsent(): SelectAst;\n}\n\n/**\n * Typed index existence check riding the same `to_regclass` vocabulary as\n * `tableExistsAst`, with the qualified index name bound as a text parameter.\n */\nexport function indexExistsAst(schema: string, indexName: string): IndexExistsCheckBuilder {\n const regclass = toRegclass(checkNamespace(schema).qualifyTable(indexName));\n return {\n indexPresent: () => exprSelect().project('result', regclass.isNotNull()).build(),\n indexAbsent: () => exprSelect().project('result', regclass.isNull()).build(),\n };\n}\n","import type { DdlColumn, DdlTableConstraint } from '@prisma-next/sql-relational-core/ast';\nimport {\n AddColumnAction,\n type AnyAlterTableAction,\n PostgresAlterTable,\n PostgresCreateSchema,\n PostgresCreateTable,\n} from '../core/ddl/nodes';\n\n/**\n * Build a Postgres `CREATE TABLE` query node.\n *\n * Pass `constraints` for table-level composite primary keys, foreign keys, and\n * unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},\n * and {@link UniqueConstraint} classes from `@prisma-next/sql-relational-core/ast`.\n *\n * Precondition: identifiers (`table`, `schema`, column names/types) are\n * emitted to SQL verbatim — they are not quoted or escaped, so callers must\n * pass pre-trusted values (e.g. fixed control-plane identifiers). String-literal\n * default values, by contrast, are single-quote-escaped (embedded `'` doubled)\n * by the renderer. Identifier quoting for untrusted identifiers is added when\n * the migration planner adopts this lowering path.\n */\nexport function createTable(options: {\n readonly table: string;\n readonly schema?: string;\n readonly ifNotExists?: boolean;\n readonly columns: readonly DdlColumn[];\n readonly constraints?: readonly DdlTableConstraint[];\n}): PostgresCreateTable {\n return new PostgresCreateTable(options);\n}\n\n/**\n * Build a Postgres `CREATE SCHEMA` query node. See {@link createTable} for the\n * pre-trusted-identifier precondition.\n */\nexport function createSchema(options: {\n readonly schema: string;\n readonly ifNotExists?: boolean;\n}): PostgresCreateSchema {\n return new PostgresCreateSchema(options);\n}\n\n/**\n * Build an `ADD COLUMN` action for use inside {@link alterTable}.\n * The column is a structured `DdlColumn` so codec-encoded defaults flow\n * through the adapter's `pgRenderDdlColumn` → `pgRenderDdlColumnDefault` path.\n */\nexport function addColumnAction(column: DdlColumn): AddColumnAction {\n return new AddColumnAction(column);\n}\n\n/**\n * Build a Postgres `ALTER TABLE` query node carrying one or more actions.\n * See {@link addColumnAction} for building actions.\n */\nexport function alterTable(options: {\n readonly table: string;\n readonly schema?: string;\n readonly actions: readonly AnyAlterTableAction[];\n}): PostgresAlterTable {\n return new PostgresAlterTable(options);\n}\n"],"mappings":";;;;;;;;;;AAiBA,SAAgB,WAAW,eAA+B;CACxD,OAAO,OAAO,GAAG;EACf,QAAQ;EACR,UAAU;EACV,MAAM,OAAO,MAAM,eAAe,gBAAgB;EAClD,SAAS;GAAE,SAAS;GAAkB,UAAU;EAAK;CACvD,CAAC;AACH;;;;;;;;;;AAgBA,SAAgB,eAAe,QAAgB,OAAwC;CAIrF,MAAM,WAAW,WAHC,wBAAwB;EAAE,IAAI;EAAQ,SAAS,EAAE,OAAO,CAAC,EAAE;CAAE,CAAC,CAAC,CAAC,aAChF,KAEkC,CAAC;CACrC,OAAO;EACL,mBAAmB,WAAW,CAAC,CAAC,QAAQ,UAAU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,aAAa,SAAS,CAAC;CAC1E,OAAO;EACL,oBAAoB,WAAW,CAAC,CAAC,QAAQ,UAAU,SAAS,UAAU,CAAC,CAAC,CAAC,MAAM;EAC/E,mBAAmB,WAAW,CAAC,CAAC,QAAQ,UAAU,SAAS,OAAO,CAAC,CAAC,CAAC,MAAM;CAC7E;AACF;;;;;;;;;;;;;;;;;ACnVA,SAAgB,YAAY,SAMJ;CACtB,OAAO,IAAI,oBAAoB,OAAO;AACxC;;;;;AAMA,SAAgB,aAAa,SAGJ;CACvB,OAAO,IAAI,qBAAqB,OAAO;AACzC;;;;;;AAOA,SAAgB,gBAAgB,QAAoC;CAClE,OAAO,IAAI,gBAAgB,MAAM;AACnC;;;;;AAMA,SAAgB,WAAW,SAIJ;CACrB,OAAO,IAAI,mBAAmB,OAAO;AACvC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"default-normalizer-DyyCHQWs.mjs","names":[],"sources":["../src/core/default-normalizer.ts"],"sourcesContent":["import type { ColumnDefault } from '@prisma-next/contract/types';\n\n/**\n * Pre-compiled regex patterns for performance.\n * These are compiled once at module load time rather than on each function call.\n */\nconst NEXTVAL_PATTERN = /^nextval\\s*\\(/i;\nconst NOW_FUNCTION_PATTERN = /^(now\\s*\\(\\s*\\)|CURRENT_TIMESTAMP)$/i;\nconst CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\\s*\\(\\s*\\)$/i;\nconst TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\\s+(?:with|without)\\s+time\\s+zone)?$/i;\nconst TEXT_CAST_SUFFIX = /::text$/i;\nconst NOW_LITERAL_PATTERN = /^'now'$/i;\nconst UUID_PATTERN = /^gen_random_uuid\\s*\\(\\s*\\)$/i;\nconst UUID_OSSP_PATTERN = /^uuid_generate_v4\\s*\\(\\s*\\)$/i;\nconst NULL_PATTERN = /^NULL(?:::.+)?$/i;\nconst TRUE_PATTERN = /^true$/i;\nconst FALSE_PATTERN = /^false$/i;\nconst NUMERIC_PATTERN = /^-?\\d+(\\.\\d+)?$/;\nconst STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'(?:::(?:\"[^\"]+\"|[\\w\\s]+)(?:\\(\\d+\\))?)?$/;\n\n/**\n * Returns the canonical expression for a timestamp default function, or undefined\n * if the expression is not a recognized timestamp default.\n *\n * Keeps now()/CURRENT_TIMESTAMP and clock_timestamp() distinct:\n * - now(), CURRENT_TIMESTAMP, ('now'::text)::timestamp... → 'now()'\n * - clock_timestamp(), clock_timestamp()::timestamptz → 'clock_timestamp()'\n *\n * These are semantically different in Postgres: now() returns the transaction\n * start time (constant within a transaction), while clock_timestamp() returns\n * the actual wall-clock time (can differ across rows in a single INSERT).\n */\nfunction canonicalizeTimestampDefault(expr: string): string | undefined {\n if (NOW_FUNCTION_PATTERN.test(expr)) return 'now()';\n if (CLOCK_TIMESTAMP_PATTERN.test(expr)) return 'clock_timestamp()';\n\n if (!TIMESTAMP_CAST_SUFFIX.test(expr)) return undefined;\n\n let inner = expr.replace(TIMESTAMP_CAST_SUFFIX, '').trim();\n\n if (inner.startsWith('(') && inner.endsWith(')')) {\n inner = inner.slice(1, -1).trim();\n }\n\n if (NOW_FUNCTION_PATTERN.test(inner)) return 'now()';\n if (CLOCK_TIMESTAMP_PATTERN.test(inner)) return 'clock_timestamp()';\n\n inner = inner.replace(TEXT_CAST_SUFFIX, '').trim();\n if (NOW_LITERAL_PATTERN.test(inner)) return 'now()';\n\n return undefined;\n}\n\n/**\n * Parses a raw Postgres column default expression into a normalized ColumnDefault.\n * This enables semantic comparison between contract defaults and introspected schema defaults.\n *\n * Used by the migration diff layer to normalize raw database defaults during comparison,\n * keeping the introspection layer focused on faithful data capture.\n *\n * @param rawDefault - Raw default expression from information_schema.columns.column_default\n * @param nativeType - Native column type, used for type-aware parsing (bigint tagging, JSON detection)\n * @returns Normalized ColumnDefault or undefined if the expression cannot be parsed\n */\nexport function parsePostgresDefault(\n rawDefault: string,\n nativeType?: string,\n): ColumnDefault | undefined {\n const trimmed = rawDefault.trim();\n const normalizedType = nativeType?.toLowerCase();\n const isBigInt = normalizedType === 'bigint' || normalizedType === 'int8';\n\n if (NEXTVAL_PATTERN.test(trimmed)) {\n return { kind: 'function', expression: 'autoincrement()' };\n }\n\n const canonicalTimestamp = canonicalizeTimestampDefault(trimmed);\n if (canonicalTimestamp) {\n return { kind: 'function', expression: canonicalTimestamp };\n }\n\n if (UUID_PATTERN.test(trimmed)) {\n return { kind: 'function', expression: 'gen_random_uuid()' };\n }\n\n if (UUID_OSSP_PATTERN.test(trimmed)) {\n return { kind: 'function', expression: 'gen_random_uuid()' };\n }\n\n if (NULL_PATTERN.test(trimmed)) {\n return { kind: 'literal', value: null };\n }\n\n if (TRUE_PATTERN.test(trimmed)) {\n return { kind: 'literal', value: true };\n }\n if (FALSE_PATTERN.test(trimmed)) {\n return { kind: 'literal', value: false };\n }\n\n if (NUMERIC_PATTERN.test(trimmed)) {\n const num = Number(trimmed);\n if (!Number.isFinite(num)) return undefined;\n if (isBigInt && !Number.isSafeInteger(num)) {\n return { kind: 'literal', value: trimmed };\n }\n return { kind: 'literal', value: num };\n }\n\n const stringMatch = trimmed.match(STRING_LITERAL_PATTERN);\n if (stringMatch?.[1] !== undefined) {\n const unescaped = stringMatch[1].replace(/''/g, \"'\");\n if (normalizedType === 'json' || normalizedType === 'jsonb') {\n try {\n return { kind: 'literal', value: JSON.parse(unescaped) };\n } catch {\n // Keep legacy behavior for malformed/non-JSON string content.\n }\n }\n if (isBigInt && NUMERIC_PATTERN.test(unescaped)) {\n const num = Number(unescaped);\n if (Number.isSafeInteger(num)) {\n return { kind: 'literal', value: num };\n }\n return { kind: 'literal', value: unescaped };\n }\n return { kind: 'literal', value: unescaped };\n }\n\n return { kind: 'function', expression: trimmed };\n}\n"],"mappings":";;;;;AAMA,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAChC,MAAM,wBAAwB;AAC9B,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AA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,MAAM;EAAW,OAAO;CAAK;CAGxC,IAAI,aAAa,KAAK,OAAO,GAC3B,OAAO;EAAE,MAAM;EAAW,OAAO;CAAK;CAExC,IAAI,cAAc,KAAK,OAAO,GAC5B,OAAO;EAAE,MAAM;EAAW,OAAO;CAAM;CAGzC,IAAI,gBAAgB,KAAK,OAAO,GAAG;EACjC,MAAM,MAAM,OAAO,OAAO;EAC1B,IAAI,CAAC,OAAO,SAAS,GAAG,GAAG,OAAO,KAAA;EAClC,IAAI,YAAY,CAAC,OAAO,cAAc,GAAG,GACvC,OAAO;GAAE,MAAM;GAAW,OAAO;EAAQ;EAE3C,OAAO;GAAE,MAAM;GAAW,OAAO;EAAI;CACvC;CAEA,MAAM,cAAc,QAAQ,MAAM,sBAAsB;CACxD,IAAI,cAAc,OAAO,KAAA,GAAW;EAClC,MAAM,YAAY,YAAY,EAAE,CAAC,QAAQ,OAAO,GAAG;EACnD,IAAI,mBAAmB,UAAU,mBAAmB,SAClD,IAAI;GACF,OAAO;IAAE,MAAM;IAAW,OAAO,KAAK,MAAM,SAAS;GAAE;EACzD,QAAQ,CAER;EAEF,IAAI,YAAY,gBAAgB,KAAK,SAAS,GAAG;GAC/C,MAAM,MAAM,OAAO,SAAS;GAC5B,IAAI,OAAO,cAAc,GAAG,GAC1B,OAAO;IAAE,MAAM;IAAW,OAAO;GAAI;GAEvC,OAAO;IAAE,MAAM;IAAW,OAAO;GAAU;EAC7C;EACA,OAAO;GAAE,MAAM;GAAW,OAAO;EAAU;CAC7C;CAEA,OAAO;EAAE,MAAM;EAAY,YAAY;CAAQ;AACjD"}
@@ -1,140 +0,0 @@
1
- import { temporalAuthoringPresets } from "@prisma-next/family-sql/control";
2
- //#region src/core/authoring.ts
3
- const postgresAuthoringTypes = {};
4
- const postgresAuthoringEntityTypes = {};
5
- /**
6
- * Field presets contributed by the Postgres target pack.
7
- *
8
- * These mirror the PSL scalar-to-codec mapping used by the Postgres adapter
9
- * (see `createPostgresPslScalarTypeDescriptors`), so that authoring a field
10
- * via the TS callback surface (e.g. `field.int()`) and via the PSL scalar
11
- * surface (e.g. `Int`) lowers to byte-identical contracts.
12
- *
13
- * The `uuidNative` / `id.uuidv4Native` / `id.uuidv7Native` presets use the
14
- * native Postgres `uuid` type (codecId `pg/uuid@1`). For cross-target
15
- * portability use `uuidString` / `id.uuidv4String` / `id.uuidv7String` from
16
- * the family pack instead.
17
- */
18
- const postgresAuthoringFieldPresets = {
19
- text: {
20
- kind: "fieldPreset",
21
- output: {
22
- codecId: "pg/text@1",
23
- nativeType: "text"
24
- }
25
- },
26
- int: {
27
- kind: "fieldPreset",
28
- output: {
29
- codecId: "pg/int4@1",
30
- nativeType: "int4"
31
- }
32
- },
33
- bigint: {
34
- kind: "fieldPreset",
35
- output: {
36
- codecId: "pg/int8@1",
37
- nativeType: "int8"
38
- }
39
- },
40
- float: {
41
- kind: "fieldPreset",
42
- output: {
43
- codecId: "pg/float8@1",
44
- nativeType: "float8"
45
- }
46
- },
47
- decimal: {
48
- kind: "fieldPreset",
49
- output: {
50
- codecId: "pg/numeric@1",
51
- nativeType: "numeric"
52
- }
53
- },
54
- boolean: {
55
- kind: "fieldPreset",
56
- output: {
57
- codecId: "pg/bool@1",
58
- nativeType: "bool"
59
- }
60
- },
61
- json: {
62
- kind: "fieldPreset",
63
- output: {
64
- codecId: "pg/jsonb@1",
65
- nativeType: "jsonb"
66
- }
67
- },
68
- bytes: {
69
- kind: "fieldPreset",
70
- output: {
71
- codecId: "pg/bytea@1",
72
- nativeType: "bytea"
73
- }
74
- },
75
- dateTime: {
76
- kind: "fieldPreset",
77
- output: {
78
- codecId: "pg/timestamptz@1",
79
- nativeType: "timestamptz"
80
- }
81
- },
82
- temporal: /* @__PURE__ */ temporalAuthoringPresets({
83
- codecId: "pg/timestamptz@1",
84
- nativeType: "timestamptz"
85
- }),
86
- uuidNative: {
87
- kind: "fieldPreset",
88
- output: {
89
- codecId: "pg/uuid@1",
90
- nativeType: "uuid"
91
- }
92
- },
93
- id: {
94
- uuidv4Native: {
95
- kind: "fieldPreset",
96
- output: {
97
- codecId: "pg/uuid@1",
98
- nativeType: "uuid",
99
- executionDefaults: { onCreate: {
100
- kind: "generator",
101
- id: "uuidv4"
102
- } },
103
- id: true
104
- }
105
- },
106
- uuidv7Native: {
107
- kind: "fieldPreset",
108
- output: {
109
- codecId: "pg/uuid@1",
110
- nativeType: "uuid",
111
- executionDefaults: { onCreate: {
112
- kind: "generator",
113
- id: "uuidv7"
114
- } },
115
- id: true
116
- }
117
- }
118
- }
119
- };
120
- const postgresTargetDescriptorMetaRuntime = {
121
- kind: "target",
122
- familyId: "sql",
123
- targetId: "postgres",
124
- id: "postgres",
125
- version: "0.0.1",
126
- capabilities: {}
127
- };
128
- const postgresTargetDescriptorMeta = {
129
- ...postgresTargetDescriptorMetaRuntime,
130
- defaultNamespaceId: "public",
131
- authoring: {
132
- type: postgresAuthoringTypes,
133
- field: postgresAuthoringFieldPresets,
134
- entityTypes: postgresAuthoringEntityTypes
135
- }
136
- };
137
- //#endregion
138
- export { postgresTargetDescriptorMetaRuntime as n, postgresAuthoringEntityTypes as r, postgresTargetDescriptorMeta as t };
139
-
140
- //# sourceMappingURL=descriptor-meta-CpGygXpI.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"descriptor-meta-CpGygXpI.mjs","names":[],"sources":["../src/core/authoring.ts","../src/core/descriptor-meta-runtime.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import { temporalAuthoringPresets } from '@prisma-next/family-sql/control';\nimport type {\n AuthoringEntityTypeNamespace,\n AuthoringFieldNamespace,\n AuthoringTypeNamespace,\n} from '@prisma-next/framework-components/authoring';\n\nexport const postgresAuthoringTypes = {} as const satisfies AuthoringTypeNamespace;\n\nexport const postgresAuthoringEntityTypes = {} as const satisfies AuthoringEntityTypeNamespace;\n\n/**\n * Field presets contributed by the Postgres target pack.\n *\n * These mirror the PSL scalar-to-codec mapping used by the Postgres adapter\n * (see `createPostgresPslScalarTypeDescriptors`), so that authoring a field\n * via the TS callback surface (e.g. `field.int()`) and via the PSL scalar\n * surface (e.g. `Int`) lowers to byte-identical contracts.\n *\n * The `uuidNative` / `id.uuidv4Native` / `id.uuidv7Native` presets use the\n * native Postgres `uuid` type (codecId `pg/uuid@1`). For cross-target\n * portability use `uuidString` / `id.uuidv4String` / `id.uuidv7String` from\n * the family pack instead.\n */\nexport const postgresAuthoringFieldPresets = {\n text: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/text@1',\n nativeType: 'text',\n },\n },\n int: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/int4@1',\n nativeType: 'int4',\n },\n },\n bigint: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/int8@1',\n nativeType: 'int8',\n },\n },\n float: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/float8@1',\n nativeType: 'float8',\n },\n },\n decimal: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/numeric@1',\n nativeType: 'numeric',\n },\n },\n boolean: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/bool@1',\n nativeType: 'bool',\n },\n },\n json: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/jsonb@1',\n nativeType: 'jsonb',\n },\n },\n bytes: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/bytea@1',\n nativeType: 'bytea',\n },\n },\n dateTime: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n },\n },\n temporal: /* @__PURE__ */ temporalAuthoringPresets({\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n }),\n uuidNative: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/uuid@1',\n nativeType: 'uuid',\n },\n },\n id: {\n uuidv4Native: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/uuid@1',\n nativeType: 'uuid',\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv4',\n },\n },\n id: true,\n },\n },\n uuidv7Native: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/uuid@1',\n nativeType: 'uuid',\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv7',\n },\n },\n id: true,\n },\n },\n },\n} as const satisfies AuthoringFieldNamespace;\n","// Runtime-safe slice of the postgres target descriptor metadata.\n//\n// This file exists separately from ./descriptor-meta on purpose: the runtime\n// plane reads only `kind/familyId/targetId/id/version/capabilities` (plus the\n// `__codecTypes` phantom). The `authoring` slot lives on the pack/control\n// descriptor only, because authoring contributions are consumed at\n// contract-construction time by `assembleAuthoringContributions` (control\n// plane) and the PSL interpreter — never at runtime.\n//\n// Keeping the runtime closure free of the `./authoring` import is what lets\n// the bundler tree-shake `@prisma-next/family-sql/control` (and its\n// transitive `verify-sql-schema` chunk) out of the runtime entry. Do not\n// add an `authoring` field here — if you need to, the pack/control meta in\n// `./descriptor-meta` is the right place. See TML-2766 for context.\nimport type { CodecTypes } from '../exports/codec-types';\n\nconst postgresTargetDescriptorMetaRuntimeBase = {\n kind: 'target',\n familyId: 'sql',\n targetId: 'postgres',\n id: 'postgres',\n version: '0.0.1',\n capabilities: {},\n} as const;\n\nexport const postgresTargetDescriptorMetaRuntime: typeof postgresTargetDescriptorMetaRuntimeBase & {\n readonly __codecTypes?: CodecTypes;\n} = postgresTargetDescriptorMetaRuntimeBase;\n","import type { CodecTypes } from '../exports/codec-types';\nimport {\n postgresAuthoringEntityTypes,\n postgresAuthoringFieldPresets,\n postgresAuthoringTypes,\n} from './authoring';\nimport { postgresTargetDescriptorMetaRuntime } from './descriptor-meta-runtime';\n\nconst postgresTargetDescriptorMetaBase = {\n ...postgresTargetDescriptorMetaRuntime,\n defaultNamespaceId: 'public',\n authoring: {\n type: postgresAuthoringTypes,\n field: postgresAuthoringFieldPresets,\n entityTypes: postgresAuthoringEntityTypes,\n },\n} as const;\n\nexport const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = postgresTargetDescript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