@prisma-next/target-postgres 0.14.0-dev.55 → 0.14.0-dev.56

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 (117) hide show
  1. package/dist/{authoring-BBIGcFZM.mjs → authoring-WkqG_MkU.mjs} +38 -6
  2. package/dist/authoring-WkqG_MkU.mjs.map +1 -0
  3. package/dist/contract-free.d.mts +27 -2
  4. package/dist/contract-free.d.mts.map +1 -1
  5. package/dist/contract-free.mjs +3 -3
  6. package/dist/{control-policy-DievMCOV.mjs → control-policy-BtOZBVxL.mjs} +38 -13
  7. package/dist/control-policy-BtOZBVxL.mjs.map +1 -0
  8. package/dist/control.mjs +6 -6
  9. package/dist/{ddl-D5j4JiAB.mjs → ddl-B-krEXY1.mjs} +18 -4
  10. package/dist/{ddl-D5j4JiAB.mjs.map → ddl-B-krEXY1.mjs.map} +1 -1
  11. package/dist/ddl.d.mts +2 -2
  12. package/dist/ddl.mjs +2 -2
  13. package/dist/{descriptor-meta-C-tyS25s.mjs → descriptor-meta-BOcKPaLE.mjs} +4 -3
  14. package/dist/descriptor-meta-BOcKPaLE.mjs.map +1 -0
  15. package/dist/{diff-database-schema-ff3ioNtK.mjs → diff-database-schema-CWb-jeLy.mjs} +19 -11
  16. package/dist/diff-database-schema-CWb-jeLy.mjs.map +1 -0
  17. package/dist/diff-database-schema.d.mts +1 -1
  18. package/dist/diff-database-schema.d.mts.map +1 -1
  19. package/dist/diff-database-schema.mjs +1 -1
  20. package/dist/issue-planner.d.mts +1 -1
  21. package/dist/issue-planner.d.mts.map +1 -1
  22. package/dist/issue-planner.mjs +1 -1
  23. package/dist/migration.d.mts +2 -2
  24. package/dist/migration.mjs +2 -2
  25. package/dist/{nodes-Dh__NS58.mjs → nodes-B815pj_X.mjs} +34 -2
  26. package/dist/{nodes-Dh__NS58.mjs.map → nodes-B815pj_X.mjs.map} +1 -1
  27. package/dist/{nodes-CSkPX3rI.d.mts → nodes-BtQyZha6.d.mts} +29 -3
  28. package/dist/nodes-BtQyZha6.d.mts.map +1 -0
  29. package/dist/{op-factory-call-Dt-Jx5JS.d.mts → op-factory-call-D6_7-7Vc.d.mts} +24 -2
  30. package/dist/{op-factory-call-Dt-Jx5JS.d.mts.map → op-factory-call-D6_7-7Vc.d.mts.map} +1 -1
  31. package/dist/{op-factory-call-DZWTTjKM.mjs → op-factory-call-DxNNKUeZ.mjs} +99 -4
  32. package/dist/op-factory-call-DxNNKUeZ.mjs.map +1 -0
  33. package/dist/op-factory-call.d.mts +1 -1
  34. package/dist/op-factory-call.mjs +1 -1
  35. package/dist/pack.d.mts +29 -2
  36. package/dist/pack.d.mts.map +1 -1
  37. package/dist/pack.mjs +1 -1
  38. package/dist/{planner-DWQYPxP8.mjs → planner-BryLk0Ie.mjs} +80 -24
  39. package/dist/planner-BryLk0Ie.mjs.map +1 -0
  40. package/dist/{planner-produced-postgres-migration-Ch1L8RiV.mjs → planner-produced-postgres-migration-BLJH1zIc.mjs} +2 -2
  41. package/dist/{planner-produced-postgres-migration-Ch1L8RiV.mjs.map → planner-produced-postgres-migration-BLJH1zIc.mjs.map} +1 -1
  42. package/dist/{planner-produced-postgres-migration-C0a7I1-e.d.mts → planner-produced-postgres-migration-CGifB6VH.d.mts} +2 -2
  43. package/dist/{planner-produced-postgres-migration-C0a7I1-e.d.mts.map → planner-produced-postgres-migration-CGifB6VH.d.mts.map} +1 -1
  44. package/dist/planner-produced-postgres-migration.d.mts +1 -1
  45. package/dist/planner-produced-postgres-migration.mjs +1 -1
  46. package/dist/{planner-sql-checks-D8Q5ck4o.mjs → planner-sql-checks-AXoxB1Jl.mjs} +2 -2
  47. package/dist/{planner-sql-checks-D8Q5ck4o.mjs.map → planner-sql-checks-AXoxB1Jl.mjs.map} +1 -1
  48. package/dist/planner-sql-checks.mjs +1 -1
  49. package/dist/planner.d.mts +23 -6
  50. package/dist/planner.d.mts.map +1 -1
  51. package/dist/planner.mjs +2 -2
  52. package/dist/{postgres-contract-view-C-By7rOB.mjs → postgres-contract-view-Dg-N7KA7.mjs} +4 -3
  53. package/dist/postgres-contract-view-Dg-N7KA7.mjs.map +1 -0
  54. package/dist/{postgres-database-schema-node-UpzA0Ug5.d.mts → postgres-database-schema-node-CfdTY-Qs.d.mts} +18 -3
  55. package/dist/postgres-database-schema-node-CfdTY-Qs.d.mts.map +1 -0
  56. package/dist/{postgres-migration-D3XACWKM.mjs → postgres-migration-BahMHTbj.mjs} +3 -3
  57. package/dist/{postgres-migration-D3XACWKM.mjs.map → postgres-migration-BahMHTbj.mjs.map} +1 -1
  58. package/dist/{postgres-migration-DFaxuRyI.d.mts → postgres-migration-cyBe2Ee0.d.mts} +2 -2
  59. package/dist/{postgres-migration-DFaxuRyI.d.mts.map → postgres-migration-cyBe2Ee0.d.mts.map} +1 -1
  60. package/dist/{postgres-table-schema-node-BZWWEo7B.mjs → postgres-role-schema-node-BiSTCTNg.mjs} +4 -69
  61. package/dist/postgres-role-schema-node-BiSTCTNg.mjs.map +1 -0
  62. package/dist/{postgres-schema-9vFZLwGo.d.mts → postgres-schema-CU4gF6QZ.d.mts} +30 -2
  63. package/dist/postgres-schema-CU4gF6QZ.d.mts.map +1 -0
  64. package/dist/{postgres-schema-DcG72fcT.mjs → postgres-schema-DTLA_aRi.mjs} +41 -2
  65. package/dist/postgres-schema-DTLA_aRi.mjs.map +1 -0
  66. package/dist/postgres-table-schema-node-9FCtCUz2.mjs +153 -0
  67. package/dist/postgres-table-schema-node-9FCtCUz2.mjs.map +1 -0
  68. package/dist/{resolve-ddl-schema-BOtCoeKV.mjs → resolve-ddl-schema-Ca88Tg6W.mjs} +2 -2
  69. package/dist/{resolve-ddl-schema-BOtCoeKV.mjs.map → resolve-ddl-schema-Ca88Tg6W.mjs.map} +1 -1
  70. package/dist/rls-canonicalize.d.mts +19 -1
  71. package/dist/rls-canonicalize.d.mts.map +1 -0
  72. package/dist/rls-canonicalize.mjs +2 -2
  73. package/dist/runtime.d.mts.map +1 -1
  74. package/dist/runtime.mjs +1 -1
  75. package/dist/schema-ir-annotations.mjs +1 -1
  76. package/dist/types.d.mts +3 -3
  77. package/dist/types.mjs +4 -3
  78. package/dist/{canonicalize-Bn3BM1Cn.mjs → wire-name-rHHtr1h0.mjs} +31 -2
  79. package/dist/wire-name-rHHtr1h0.mjs.map +1 -0
  80. package/package.json +20 -20
  81. package/src/contract-free/ddl.ts +26 -0
  82. package/src/core/authoring.ts +44 -1
  83. package/src/core/ddl/nodes.ts +48 -1
  84. package/src/core/descriptor-meta.ts +2 -0
  85. package/src/core/entity-kinds.ts +11 -0
  86. package/src/core/migrations/contract-to-postgres-database-schema-node.ts +9 -0
  87. package/src/core/migrations/control-policy.ts +31 -1
  88. package/src/core/migrations/diff-database-schema.ts +1 -0
  89. package/src/core/migrations/issue-planner.ts +49 -4
  90. package/src/core/migrations/op-factory-call.ts +81 -1
  91. package/src/core/migrations/operations/rls.ts +82 -1
  92. package/src/core/migrations/planner.ts +110 -26
  93. package/src/core/postgres-contract-serializer.ts +7 -1
  94. package/src/core/postgres-rls-enablement.ts +34 -0
  95. package/src/core/postgres-schema.ts +19 -3
  96. package/src/core/postgres-validators.ts +6 -0
  97. package/src/core/rls/wire-name.ts +33 -0
  98. package/src/core/schema-ir/postgres-table-schema-node.ts +25 -3
  99. package/src/exports/contract-free.ts +4 -0
  100. package/src/exports/ddl.ts +2 -0
  101. package/src/exports/rls-canonicalize.ts +1 -0
  102. package/src/exports/types.ts +4 -0
  103. package/dist/authoring-BBIGcFZM.mjs.map +0 -1
  104. package/dist/canonicalize-Bn3BM1Cn.mjs.map +0 -1
  105. package/dist/control-policy-DievMCOV.mjs.map +0 -1
  106. package/dist/descriptor-meta-C-tyS25s.mjs.map +0 -1
  107. package/dist/diff-database-schema-ff3ioNtK.mjs.map +0 -1
  108. package/dist/nodes-CSkPX3rI.d.mts.map +0 -1
  109. package/dist/op-factory-call-DZWTTjKM.mjs.map +0 -1
  110. package/dist/planner-DWQYPxP8.mjs.map +0 -1
  111. package/dist/postgres-contract-view-C-By7rOB.mjs.map +0 -1
  112. package/dist/postgres-database-schema-node-UpzA0Ug5.d.mts.map +0 -1
  113. package/dist/postgres-schema-9vFZLwGo.d.mts.map +0 -1
  114. package/dist/postgres-schema-DcG72fcT.mjs.map +0 -1
  115. package/dist/postgres-table-schema-node-BZWWEo7B.mjs.map +0 -1
  116. package/dist/schema-node-kinds-ClScchhi.mjs +0 -76
  117. package/dist/schema-node-kinds-ClScchhi.mjs.map +0 -1
@@ -1,76 +0,0 @@
1
- import { relationalNodeEntityKind, relationalNodeGranularity } from "@prisma-next/sql-schema-ir/types";
2
- //#region src/core/schema-ir/schema-node-kinds.ts
3
- /**
4
- * The `nodeKind` discriminant for each Postgres schema-diff node. Each node
5
- * carries a unique value; the static `is`/`assert` guards compare against these
6
- * identifiers rather than spelling the string inline or using `instanceof`. The
7
- * field is an enumerable own property carried on every node instance.
8
- */
9
- const PostgresSchemaNodeKind = {
10
- database: "postgres-database",
11
- namespace: "postgres-namespace",
12
- table: "postgres-table",
13
- policy: "postgres-policy",
14
- role: "postgres-role"
15
- };
16
- /**
17
- * The one real map from a Postgres-specific `nodeKind` to the
18
- * framework-neutral {@link DiffSubjectGranularity} its diff issues carry —
19
- * resolution is by `nodeKind` equality against this map, never a
20
- * `nodeKind`-suffix string match and never anything stamped on the node.
21
- */
22
- const POSTGRES_NODE_GRANULARITY = {
23
- [PostgresSchemaNodeKind.database]: "structural",
24
- [PostgresSchemaNodeKind.namespace]: "namespace",
25
- [PostgresSchemaNodeKind.table]: "entity",
26
- [PostgresSchemaNodeKind.policy]: "structural",
27
- [PostgresSchemaNodeKind.role]: "structural"
28
- };
29
- function isPostgresSchemaNodeKind(nodeKind) {
30
- return Object.hasOwn(POSTGRES_NODE_GRANULARITY, nodeKind);
31
- }
32
- /** Looks up the subject granularity for a Postgres-specific `nodeKind`. */
33
- function postgresNodeGranularity(nodeKind) {
34
- return POSTGRES_NODE_GRANULARITY[nodeKind];
35
- }
36
- /**
37
- * The subject granularity for any node kind that appears in a Postgres diff
38
- * tree — the tree mixes Postgres-specific kinds (database/namespace/table/
39
- * policy/role) with the relational leaf kinds (columns, constraints, indexes,
40
- * …), so this dispatches to whichever family/target map owns the kind. Called
41
- * on demand by consumers (the family verdict, the framework aggregate's
42
- * unclaimed-elements sweep, via the {@link
43
- * import('@prisma-next/framework-components/control').SchemaSubjectClassifierCapable}
44
- * capability) — never stamped onto the issue or the node.
45
- */
46
- function postgresDiffSubjectGranularity(nodeKind) {
47
- return isPostgresSchemaNodeKind(nodeKind) ? postgresNodeGranularity(nodeKind) : relationalNodeGranularity(nodeKind);
48
- }
49
- /**
50
- * The one real map from a Postgres-specific `nodeKind` to its storage
51
- * `entityKind` — the same vocabulary the contract storage's `entries`
52
- * dictionary keys use. Only the whole-table kind has an entity of its own;
53
- * database/namespace/policy/role nodes map to nothing here (a namespace is
54
- * addressed by id, not by an `entries` kind; policies and roles are
55
- * structural, never a sibling space's unclaimed entity).
56
- */
57
- const POSTGRES_NODE_ENTITY_KIND = { [PostgresSchemaNodeKind.table]: "table" };
58
- /** Looks up the storage entityKind for a Postgres-specific `nodeKind`. */
59
- function postgresNodeEntityKind(nodeKind) {
60
- return POSTGRES_NODE_ENTITY_KIND[nodeKind];
61
- }
62
- /**
63
- * The storage `entityKind` for any node kind that appears in a Postgres diff
64
- * tree — sibling of {@link postgresDiffSubjectGranularity}, dispatching the
65
- * same way to whichever family/target map owns the kind. Called on demand by
66
- * the framework aggregate's unclaimed-elements sweep via the {@link
67
- * import('@prisma-next/framework-components/control').SchemaSubjectClassifierCapable}
68
- * capability — never stamped onto the issue or the node.
69
- */
70
- function postgresDiffSubjectEntityKind(nodeKind) {
71
- return isPostgresSchemaNodeKind(nodeKind) ? postgresNodeEntityKind(nodeKind) : relationalNodeEntityKind(nodeKind);
72
- }
73
- //#endregion
74
- export { postgresDiffSubjectEntityKind as n, postgresDiffSubjectGranularity as r, PostgresSchemaNodeKind as t };
75
-
76
- //# sourceMappingURL=schema-node-kinds-ClScchhi.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema-node-kinds-ClScchhi.mjs","names":[],"sources":["../src/core/schema-ir/schema-node-kinds.ts"],"sourcesContent":["import type {\n DiffableNode,\n DiffSubjectGranularity,\n} from '@prisma-next/framework-components/control';\nimport {\n relationalNodeEntityKind,\n relationalNodeGranularity,\n type SqlSchemaIRNode,\n} from '@prisma-next/sql-schema-ir/types';\n\n/**\n * A Postgres schema-diff-tree node: a `SqlSchemaIRNode` that also implements\n * `DiffableNode` (the five `Postgres*SchemaNode` classes). `SqlSchemaIRNode`\n * alone is not a `DiffableNode` — its relational subclasses (`SqlColumnIR`, …)\n * carry no `id`/`isEqualTo`/`children` — so this intersection is the honest node\n * type the differ produces and the planner consumes (`SchemaDiff<SqlSchemaDiffNode>`).\n */\nexport type SqlSchemaDiffNode = SqlSchemaIRNode & DiffableNode;\n\n/**\n * The `nodeKind` discriminant for each Postgres schema-diff node. Each node\n * carries a unique value; the static `is`/`assert` guards compare against these\n * identifiers rather than spelling the string inline or using `instanceof`. The\n * field is an enumerable own property carried on every node instance.\n */\nexport const PostgresSchemaNodeKind = {\n database: 'postgres-database',\n namespace: 'postgres-namespace',\n table: 'postgres-table',\n policy: 'postgres-policy',\n role: 'postgres-role',\n} as const;\n\nexport type PostgresSchemaNodeKind =\n (typeof PostgresSchemaNodeKind)[keyof typeof PostgresSchemaNodeKind];\n\n/**\n * The one real map from a Postgres-specific `nodeKind` to the\n * framework-neutral {@link DiffSubjectGranularity} its diff issues carry —\n * resolution is by `nodeKind` equality against this map, never a\n * `nodeKind`-suffix string match and never anything stamped on the node.\n */\nconst POSTGRES_NODE_GRANULARITY: Readonly<Record<PostgresSchemaNodeKind, DiffSubjectGranularity>> =\n {\n [PostgresSchemaNodeKind.database]: 'structural',\n [PostgresSchemaNodeKind.namespace]: 'namespace',\n [PostgresSchemaNodeKind.table]: 'entity',\n [PostgresSchemaNodeKind.policy]: 'structural',\n [PostgresSchemaNodeKind.role]: 'structural',\n };\n\nfunction isPostgresSchemaNodeKind(nodeKind: string): nodeKind is PostgresSchemaNodeKind {\n return Object.hasOwn(POSTGRES_NODE_GRANULARITY, nodeKind);\n}\n\n/** Looks up the subject granularity for a Postgres-specific `nodeKind`. */\nexport function postgresNodeGranularity(nodeKind: PostgresSchemaNodeKind): DiffSubjectGranularity {\n return POSTGRES_NODE_GRANULARITY[nodeKind];\n}\n\n/**\n * The subject granularity for any node kind that appears in a Postgres diff\n * tree — the tree mixes Postgres-specific kinds (database/namespace/table/\n * policy/role) with the relational leaf kinds (columns, constraints, indexes,\n * …), so this dispatches to whichever family/target map owns the kind. Called\n * on demand by consumers (the family verdict, the framework aggregate's\n * unclaimed-elements sweep, via the {@link\n * import('@prisma-next/framework-components/control').SchemaSubjectClassifierCapable}\n * capability) — never stamped onto the issue or the node.\n */\nexport function postgresDiffSubjectGranularity(nodeKind: string): DiffSubjectGranularity {\n return isPostgresSchemaNodeKind(nodeKind)\n ? postgresNodeGranularity(nodeKind)\n : relationalNodeGranularity(nodeKind);\n}\n\n/**\n * The one real map from a Postgres-specific `nodeKind` to its storage\n * `entityKind` — the same vocabulary the contract storage's `entries`\n * dictionary keys use. Only the whole-table kind has an entity of its own;\n * database/namespace/policy/role nodes map to nothing here (a namespace is\n * addressed by id, not by an `entries` kind; policies and roles are\n * structural, never a sibling space's unclaimed entity).\n */\nconst POSTGRES_NODE_ENTITY_KIND: Partial<Readonly<Record<PostgresSchemaNodeKind, string>>> = {\n [PostgresSchemaNodeKind.table]: 'table',\n};\n\n/** Looks up the storage entityKind for a Postgres-specific `nodeKind`. */\nexport function postgresNodeEntityKind(nodeKind: PostgresSchemaNodeKind): string | undefined {\n return POSTGRES_NODE_ENTITY_KIND[nodeKind];\n}\n\n/**\n * The storage `entityKind` for any node kind that appears in a Postgres diff\n * tree — sibling of {@link postgresDiffSubjectGranularity}, dispatching the\n * same way to whichever family/target map owns the kind. Called on demand by\n * the framework aggregate's unclaimed-elements sweep via the {@link\n * import('@prisma-next/framework-components/control').SchemaSubjectClassifierCapable}\n * capability — never stamped onto the issue or the node.\n */\nexport function postgresDiffSubjectEntityKind(nodeKind: string): string | undefined {\n return isPostgresSchemaNodeKind(nodeKind)\n ? postgresNodeEntityKind(nodeKind)\n : relationalNodeEntityKind(nodeKind);\n}\n"],"mappings":";;;;;;;;AAyBA,MAAa,yBAAyB;CACpC,UAAU;CACV,WAAW;CACX,OAAO;CACP,QAAQ;CACR,MAAM;AACR;;;;;;;AAWA,MAAM,4BACJ;EACG,uBAAuB,WAAW;EAClC,uBAAuB,YAAY;EACnC,uBAAuB,QAAQ;EAC/B,uBAAuB,SAAS;EAChC,uBAAuB,OAAO;AACjC;AAEF,SAAS,yBAAyB,UAAsD;CACtF,OAAO,OAAO,OAAO,2BAA2B,QAAQ;AAC1D;;AAGA,SAAgB,wBAAwB,UAA0D;CAChG,OAAO,0BAA0B;AACnC;;;;;;;;;;;AAYA,SAAgB,+BAA+B,UAA0C;CACvF,OAAO,yBAAyB,QAAQ,IACpC,wBAAwB,QAAQ,IAChC,0BAA0B,QAAQ;AACxC;;;;;;;;;AAUA,MAAM,4BAAuF,GAC1F,uBAAuB,QAAQ,QAClC;;AAGA,SAAgB,uBAAuB,UAAsD;CAC3F,OAAO,0BAA0B;AACnC;;;;;;;;;AAUA,SAAgB,8BAA8B,UAAsC;CAClF,OAAO,yBAAyB,QAAQ,IACpC,uBAAuB,QAAQ,IAC/B,yBAAyB,QAAQ;AACvC"}