@prisma-next/target-postgres 0.14.0-dev.6 → 0.14.0-dev.60

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 (253) hide show
  1. package/dist/authoring-WkqG_MkU.mjs +419 -0
  2. package/dist/authoring-WkqG_MkU.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/{codec-ids-CnXu9Qy3.d.mts → codec-ids-BzrFF-I4.d.mts} +3 -2
  6. package/dist/codec-ids-BzrFF-I4.d.mts.map +1 -0
  7. package/dist/{codec-ids-BvytN2P8.mjs → codec-ids-C_-Hj6bL.mjs} +3 -2
  8. package/dist/codec-ids-C_-Hj6bL.mjs.map +1 -0
  9. package/dist/codec-ids.d.mts +2 -2
  10. package/dist/codec-ids.mjs +2 -2
  11. package/dist/{codec-types-DHCkwPKE.d.mts → codec-types-BiIWziRO.d.mts} +3 -2
  12. package/dist/codec-types-BiIWziRO.d.mts.map +1 -0
  13. package/dist/codec-types.d.mts +1 -1
  14. package/dist/codecs-CkVQrZ4G.mjs +913 -0
  15. package/dist/codecs-CkVQrZ4G.mjs.map +1 -0
  16. package/dist/{codecs--0A5_4Bq.d.mts → codecs-Cm-nS4mQ.d.mts} +111 -4
  17. package/dist/codecs-Cm-nS4mQ.d.mts.map +1 -0
  18. package/dist/codecs.d.mts +2 -2
  19. package/dist/codecs.mjs +3 -757
  20. package/dist/codecs.mjs.map +1 -1
  21. package/dist/contract-free.d.mts +33 -3
  22. package/dist/contract-free.d.mts.map +1 -1
  23. package/dist/contract-free.mjs +4 -4
  24. package/dist/control-policy-Co_13Hxa.mjs +1128 -0
  25. package/dist/control-policy-Co_13Hxa.mjs.map +1 -0
  26. package/dist/control.d.mts +2 -2
  27. package/dist/control.d.mts.map +1 -1
  28. package/dist/control.mjs +900 -35
  29. package/dist/control.mjs.map +1 -1
  30. package/dist/data-transform-BOWpliq8.mjs.map +1 -1
  31. package/dist/{data-transform-DDgWdB5o.d.mts → data-transform-DPzwBMhW.d.mts} +3 -3
  32. package/dist/{data-transform-DDgWdB5o.d.mts.map → data-transform-DPzwBMhW.d.mts.map} +1 -1
  33. package/dist/data-transform.d.mts +1 -1
  34. package/dist/{ddl-QDyOSeLc.mjs → ddl-B-krEXY1.mjs} +77 -6
  35. package/dist/ddl-B-krEXY1.mjs.map +1 -0
  36. package/dist/ddl.d.mts +3 -2
  37. package/dist/ddl.mjs +2 -2
  38. package/dist/default-normalizer.d.mts +1 -1
  39. package/dist/default-normalizer.d.mts.map +1 -1
  40. package/dist/default-normalizer.mjs +247 -1
  41. package/dist/default-normalizer.mjs.map +1 -0
  42. package/dist/descriptor-meta-BOcKPaLE.mjs +22 -0
  43. package/dist/descriptor-meta-BOcKPaLE.mjs.map +1 -0
  44. package/dist/descriptor-meta-runtime-UwYdV8fD.mjs +12 -0
  45. package/dist/descriptor-meta-runtime-UwYdV8fD.mjs.map +1 -0
  46. package/dist/diff-database-schema-BOsDnH64.mjs +266 -0
  47. package/dist/diff-database-schema-BOsDnH64.mjs.map +1 -0
  48. package/dist/diff-database-schema.d.mts +46 -0
  49. package/dist/diff-database-schema.d.mts.map +1 -0
  50. package/dist/diff-database-schema.mjs +2 -0
  51. package/dist/errors-DO-w0EUS.mjs +35 -0
  52. package/dist/errors-DO-w0EUS.mjs.map +1 -0
  53. package/dist/errors.d.mts +11 -9
  54. package/dist/errors.d.mts.map +1 -1
  55. package/dist/errors.mjs +1 -1
  56. package/dist/issue-planner.d.mts +35 -11
  57. package/dist/issue-planner.d.mts.map +1 -1
  58. package/dist/issue-planner.mjs +2 -2
  59. package/dist/migration.d.mts +5 -5
  60. package/dist/migration.d.mts.map +1 -1
  61. package/dist/migration.mjs +4 -4
  62. package/dist/namespace-ids-xtp_ZY86.mjs +7 -0
  63. package/dist/namespace-ids-xtp_ZY86.mjs.map +1 -0
  64. package/dist/native-type-normalizer.mjs +37 -1
  65. package/dist/native-type-normalizer.mjs.map +1 -0
  66. package/dist/nodes-B815pj_X.mjs +162 -0
  67. package/dist/nodes-B815pj_X.mjs.map +1 -0
  68. package/dist/nodes-BtQyZha6.d.mts +146 -0
  69. package/dist/nodes-BtQyZha6.d.mts.map +1 -0
  70. package/dist/{op-factory-call-DmQEc3XV.d.mts → op-factory-call-D6_7-7Vc.d.mts} +68 -15
  71. package/dist/op-factory-call-D6_7-7Vc.d.mts.map +1 -0
  72. package/dist/{op-factory-call-D_p5vxwt.mjs → op-factory-call-DxNNKUeZ.mjs} +300 -31
  73. package/dist/op-factory-call-DxNNKUeZ.mjs.map +1 -0
  74. package/dist/op-factory-call.d.mts +2 -2
  75. package/dist/op-factory-call.mjs +2 -2
  76. package/dist/pack.d.mts +144 -3
  77. package/dist/pack.d.mts.map +1 -1
  78. package/dist/pack.mjs +1 -1
  79. package/dist/planner-CNrc1Odu.mjs +422 -0
  80. package/dist/planner-CNrc1Odu.mjs.map +1 -0
  81. package/dist/{planner-ddl-builders-B2wOwLqI.mjs → planner-ddl-builders-B8Nn6nHN.mjs} +12 -27
  82. package/dist/planner-ddl-builders-B8Nn6nHN.mjs.map +1 -0
  83. package/dist/planner-ddl-builders.d.mts +4 -6
  84. package/dist/planner-ddl-builders.d.mts.map +1 -1
  85. package/dist/planner-ddl-builders.mjs +2 -2
  86. package/dist/planner-identity-values-CJPha2Sz.mjs.map +1 -1
  87. package/dist/planner-identity-values.d.mts +8 -2
  88. package/dist/planner-identity-values.d.mts.map +1 -1
  89. package/dist/planner-identity-values.mjs +2 -2
  90. package/dist/{planner-produced-postgres-migration-Cji5vxUf.mjs → planner-produced-postgres-migration-NI-oGKcw.mjs} +3 -3
  91. package/dist/{planner-produced-postgres-migration-Cji5vxUf.mjs.map → planner-produced-postgres-migration-NI-oGKcw.mjs.map} +1 -1
  92. package/dist/{planner-produced-postgres-migration-QqHa2C2l.d.mts → planner-produced-postgres-migration-a-tjfKsA.d.mts} +4 -4
  93. package/dist/{planner-produced-postgres-migration-QqHa2C2l.d.mts.map → planner-produced-postgres-migration-a-tjfKsA.d.mts.map} +1 -1
  94. package/dist/planner-produced-postgres-migration.d.mts +1 -1
  95. package/dist/planner-produced-postgres-migration.mjs +1 -1
  96. package/dist/{planner-sql-checks-jqUUGyQR.mjs → planner-sql-checks-AXoxB1Jl.mjs} +2 -2
  97. package/dist/{planner-sql-checks-jqUUGyQR.mjs.map → planner-sql-checks-AXoxB1Jl.mjs.map} +1 -1
  98. package/dist/planner-sql-checks.d.mts +2 -2
  99. package/dist/planner-sql-checks.d.mts.map +1 -1
  100. package/dist/planner-sql-checks.mjs +1 -1
  101. package/dist/{planner-target-details-CIY6tLeo.d.mts → planner-target-details-HkP4RrRO.d.mts} +2 -2
  102. package/dist/planner-target-details-HkP4RrRO.d.mts.map +1 -0
  103. package/dist/planner-target-details.d.mts +1 -1
  104. package/dist/planner.d.mts +72 -17
  105. package/dist/planner.d.mts.map +1 -1
  106. package/dist/planner.mjs +3 -2
  107. package/dist/postgres-contract-view-C9j5cqP0.d.mts +34 -0
  108. package/dist/postgres-contract-view-C9j5cqP0.d.mts.map +1 -0
  109. package/dist/{postgres-contract-serializer-k3TAcPMY.mjs → postgres-contract-view-Dg-N7KA7.mjs} +45 -41
  110. package/dist/postgres-contract-view-Dg-N7KA7.mjs.map +1 -0
  111. package/dist/postgres-database-schema-node-CfdTY-Qs.d.mts +218 -0
  112. package/dist/postgres-database-schema-node-CfdTY-Qs.d.mts.map +1 -0
  113. package/dist/{postgres-migration-Y4YBJqkS.d.mts → postgres-migration-Bzzi0Asr.d.mts} +28 -9
  114. package/dist/postgres-migration-Bzzi0Asr.d.mts.map +1 -0
  115. package/dist/{postgres-migration-B5jKrXv3.mjs → postgres-migration-ChyRsWvE.mjs} +53 -45
  116. package/dist/postgres-migration-ChyRsWvE.mjs.map +1 -0
  117. package/dist/postgres-native-enum-xdiqmBf_.mjs +41 -0
  118. package/dist/postgres-native-enum-xdiqmBf_.mjs.map +1 -0
  119. package/dist/postgres-rls-policy--CSddvMR.d.mts +52 -0
  120. package/dist/postgres-rls-policy--CSddvMR.d.mts.map +1 -0
  121. package/dist/postgres-role-schema-node-BiSTCTNg.mjs +195 -0
  122. package/dist/postgres-role-schema-node-BiSTCTNg.mjs.map +1 -0
  123. package/dist/postgres-schema-CU4gF6QZ.d.mts +257 -0
  124. package/dist/postgres-schema-CU4gF6QZ.d.mts.map +1 -0
  125. package/dist/{postgres-schema-COGZ1ark.mjs → postgres-schema-DTLA_aRi.mjs} +171 -10
  126. package/dist/postgres-schema-DTLA_aRi.mjs.map +1 -0
  127. package/dist/postgres-table-schema-node-9FCtCUz2.mjs +153 -0
  128. package/dist/postgres-table-schema-node-9FCtCUz2.mjs.map +1 -0
  129. package/dist/render-ops.d.mts +1 -1
  130. package/dist/{render-typescript-KMgosran.mjs → render-typescript-7yqILcwr.mjs} +45 -16
  131. package/dist/render-typescript-7yqILcwr.mjs.map +1 -0
  132. package/dist/render-typescript.mjs +1 -1
  133. package/dist/resolve-ddl-schema-Ca88Tg6W.mjs +22 -0
  134. package/dist/resolve-ddl-schema-Ca88Tg6W.mjs.map +1 -0
  135. package/dist/rls-canonicalize.d.mts +20 -0
  136. package/dist/rls-canonicalize.d.mts.map +1 -0
  137. package/dist/rls-canonicalize.mjs +2 -0
  138. package/dist/runtime.d.mts +6 -8
  139. package/dist/runtime.d.mts.map +1 -1
  140. package/dist/runtime.mjs +3 -3
  141. package/dist/runtime.mjs.map +1 -1
  142. package/dist/schema-ir-annotations.d.mts +15 -0
  143. package/dist/schema-ir-annotations.d.mts.map +1 -0
  144. package/dist/schema-ir-annotations.mjs +2 -0
  145. package/dist/types.d.mts +4 -140
  146. package/dist/types.mjs +5 -2
  147. package/dist/wire-name-rHHtr1h0.mjs +75 -0
  148. package/dist/wire-name-rHHtr1h0.mjs.map +1 -0
  149. package/package.json +23 -17
  150. package/src/contract-free/checks.ts +73 -0
  151. package/src/contract-free/ddl.ts +71 -1
  152. package/src/core/authoring.ts +356 -2
  153. package/src/core/codec-ids.ts +1 -0
  154. package/src/core/codec-type-map.ts +2 -0
  155. package/src/core/codecs.ts +180 -1
  156. package/src/core/ddl/nodes.ts +141 -2
  157. package/src/core/default-normalizer.ts +122 -2
  158. package/src/core/descriptor-meta.ts +10 -1
  159. package/src/core/entity-kinds.ts +41 -0
  160. package/src/core/errors.ts +14 -12
  161. package/src/core/migrations/bound-schema.ts +10 -0
  162. package/src/core/migrations/column-ddl-rendering.ts +117 -0
  163. package/src/core/migrations/contract-to-postgres-database-schema-node.ts +160 -0
  164. package/src/core/migrations/control-policy.ts +99 -46
  165. package/src/core/migrations/diff-database-schema.ts +217 -0
  166. package/src/core/migrations/issue-planner.ts +692 -652
  167. package/src/core/migrations/op-factory-call.ts +189 -21
  168. package/src/core/migrations/operations/columns.ts +24 -12
  169. package/src/core/migrations/operations/constraints.ts +1 -1
  170. package/src/core/migrations/operations/data-transform.ts +6 -0
  171. package/src/core/migrations/operations/dependencies.ts +2 -1
  172. package/src/core/migrations/operations/rls.ts +187 -0
  173. package/src/core/migrations/operations/shared.ts +0 -30
  174. package/src/core/migrations/planner-ddl-builders.ts +20 -58
  175. package/src/core/migrations/planner-identity-values.ts +1 -1
  176. package/src/core/migrations/planner-recipes.ts +31 -13
  177. package/src/core/migrations/planner-sql-checks.ts +1 -1
  178. package/src/core/migrations/planner-strategies.ts +248 -216
  179. package/src/core/migrations/planner-target-details.ts +3 -1
  180. package/src/core/migrations/planner.ts +381 -59
  181. package/src/core/migrations/postgres-migration.ts +70 -86
  182. package/src/core/migrations/render-typescript.ts +42 -15
  183. package/src/core/migrations/resolve-ddl-schema.ts +26 -0
  184. package/src/core/migrations/runner.ts +10 -16
  185. package/src/core/migrations/verify-postgres-namespaces.ts +47 -31
  186. package/src/core/namespace-ids.ts +3 -0
  187. package/src/core/postgres-contract-serializer.ts +46 -71
  188. package/src/core/postgres-contract-view.ts +48 -0
  189. package/src/core/postgres-native-enum.ts +51 -0
  190. package/src/core/postgres-rls-enablement.ts +34 -0
  191. package/src/core/postgres-rls-policy.ts +64 -0
  192. package/src/core/postgres-role.ts +37 -0
  193. package/src/core/postgres-schema-verifier.ts +10 -7
  194. package/src/core/postgres-schema.ts +64 -15
  195. package/src/core/postgres-validators.ts +33 -0
  196. package/src/core/psl-infer/infer-psl-contract.ts +1325 -0
  197. package/src/core/psl-infer/postgres-default-mapping.ts +16 -0
  198. package/src/core/psl-infer/postgres-type-map.ts +128 -0
  199. package/src/core/rls/canonicalize.ts +48 -0
  200. package/src/core/rls/wire-name.ts +33 -0
  201. package/src/core/schema-ir/postgres-database-schema-node.ts +60 -0
  202. package/src/core/schema-ir/postgres-namespace-schema-node.ts +79 -0
  203. package/src/core/schema-ir/postgres-policy-schema-node.ts +90 -0
  204. package/src/core/schema-ir/postgres-role-schema-node.ts +63 -0
  205. package/src/core/schema-ir/postgres-table-schema-node.ts +140 -0
  206. package/src/core/schema-ir/schema-node-kinds.ts +106 -0
  207. package/src/exports/codecs.ts +3 -0
  208. package/src/exports/contract-free.ts +11 -1
  209. package/src/exports/control.ts +27 -33
  210. package/src/exports/ddl.ts +6 -0
  211. package/src/exports/diff-database-schema.ts +7 -0
  212. package/src/exports/issue-planner.ts +1 -1
  213. package/src/exports/migration.ts +1 -0
  214. package/src/exports/op-factory-call.ts +1 -0
  215. package/src/exports/planner-ddl-builders.ts +0 -2
  216. package/src/exports/planner-identity-values.ts +4 -1
  217. package/src/exports/planner.ts +1 -0
  218. package/src/exports/rls-canonicalize.ts +7 -0
  219. package/src/exports/runtime.ts +1 -0
  220. package/src/exports/schema-ir-annotations.ts +1 -0
  221. package/src/exports/types.ts +34 -0
  222. package/dist/codec-ids-BvytN2P8.mjs.map +0 -1
  223. package/dist/codec-ids-CnXu9Qy3.d.mts.map +0 -1
  224. package/dist/codec-types-DHCkwPKE.d.mts.map +0 -1
  225. package/dist/codecs--0A5_4Bq.d.mts.map +0 -1
  226. package/dist/ddl-QDyOSeLc.mjs.map +0 -1
  227. package/dist/default-normalizer-DyyCHQWs.mjs +0 -131
  228. package/dist/default-normalizer-DyyCHQWs.mjs.map +0 -1
  229. package/dist/descriptor-meta-CpGygXpI.mjs +0 -140
  230. package/dist/descriptor-meta-CpGygXpI.mjs.map +0 -1
  231. package/dist/errors-CUk87ByX.mjs +0 -33
  232. package/dist/errors-CUk87ByX.mjs.map +0 -1
  233. package/dist/issue-planner-DL6g3CmE.mjs +0 -824
  234. package/dist/issue-planner-DL6g3CmE.mjs.map +0 -1
  235. package/dist/native-type-normalizer-Bc9XJzWC.mjs +0 -38
  236. package/dist/native-type-normalizer-Bc9XJzWC.mjs.map +0 -1
  237. package/dist/nodes-Bbhs2rwj.mjs +0 -76
  238. package/dist/nodes-Bbhs2rwj.mjs.map +0 -1
  239. package/dist/nodes-pLeLgdis.d.mts +0 -67
  240. package/dist/nodes-pLeLgdis.d.mts.map +0 -1
  241. package/dist/op-factory-call-D_p5vxwt.mjs.map +0 -1
  242. package/dist/op-factory-call-DmQEc3XV.d.mts.map +0 -1
  243. package/dist/planner-Bs_baQax.mjs +0 -324
  244. package/dist/planner-Bs_baQax.mjs.map +0 -1
  245. package/dist/planner-ddl-builders-B2wOwLqI.mjs.map +0 -1
  246. package/dist/planner-target-details-CIY6tLeo.d.mts.map +0 -1
  247. package/dist/postgres-contract-serializer-k3TAcPMY.mjs.map +0 -1
  248. package/dist/postgres-migration-B5jKrXv3.mjs.map +0 -1
  249. package/dist/postgres-migration-Y4YBJqkS.d.mts.map +0 -1
  250. package/dist/postgres-schema-COGZ1ark.mjs.map +0 -1
  251. package/dist/render-typescript-KMgosran.mjs.map +0 -1
  252. package/dist/types.d.mts.map +0 -1
  253. package/src/core/postgres-enum-type-schema.ts +0 -17
@@ -9,7 +9,9 @@ export type OperationClass =
9
9
  | 'unique'
10
10
  | 'index'
11
11
  | 'foreignKey'
12
- | 'checkConstraint';
12
+ | 'checkConstraint'
13
+ | 'rlsPolicy'
14
+ | 'rowLevelSecurity';
13
15
 
14
16
  export interface PostgresPlanTargetDetails {
15
17
  readonly schema: string;
@@ -13,28 +13,48 @@ import {
13
13
  plannerFailure,
14
14
  } from '@prisma-next/family-sql/control';
15
15
  import type { ExecuteRequestLowerer } from '@prisma-next/family-sql/control-adapter';
16
- import { verifySqlSchema } from '@prisma-next/family-sql/schema-verify';
17
16
  import type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';
18
17
  import type {
19
18
  MigrationPlanner,
20
19
  MigrationPlanWithAuthoringSurface,
21
20
  MigrationScaffoldContext,
22
- SchemaIssue,
21
+ SchemaDiffIssue,
22
+ SchemaOwnership,
23
23
  } from '@prisma-next/framework-components/control';
24
24
  import { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';
25
+ import type { SqlStorage } from '@prisma-next/sql-contract/types';
26
+ import type { SqlSchemaIR } from '@prisma-next/sql-schema-ir/types';
25
27
  import { blindCast } from '@prisma-next/utils/casts';
26
- import { parsePostgresDefault } from '../default-normalizer';
27
- import { normalizeSchemaNativeType } from '../native-type-normalizer';
28
+ import { ifDefined } from '@prisma-next/utils/defined';
29
+ import { PostgresRlsPolicy } from '../postgres-rls-policy';
30
+ import { parseRlsPolicyWireName } from '../rls/wire-name';
31
+ import { PostgresDatabaseSchemaNode } from '../schema-ir/postgres-database-schema-node';
32
+ import { PostgresPolicySchemaNode } from '../schema-ir/postgres-policy-schema-node';
33
+ import { PostgresSchemaNodeKind, type SqlSchemaDiffNode } from '../schema-ir/schema-node-kinds';
28
34
  import {
29
35
  formatPostgresControlPolicySubjectLabel,
36
+ resolveNamespaceIdForDdlSchema,
30
37
  resolvePostgresCallControlPolicySubject,
31
- resolvePostgresIssueControlPolicySubject,
32
- resolvePostgresIssueCreationFactoryName,
38
+ resolvePostgresNodeIssueControlPolicySubject,
39
+ resolvePostgresNodeIssueCreationFactoryName,
33
40
  } from './control-policy';
34
- import { planIssues } from './issue-planner';
41
+ import { buildPostgresPlanDiff } from './diff-database-schema';
42
+ import {
43
+ coalesceSubtreeIssues,
44
+ issueNode,
45
+ issueSchemaName,
46
+ issueTableName,
47
+ planIssues,
48
+ } from './issue-planner';
35
49
  import type { PostgresOpFactoryCall } from './op-factory-call';
50
+ import {
51
+ CreatePostgresRlsPolicyCall,
52
+ DropPostgresRlsPolicyCall,
53
+ RenamePostgresRlsPolicyCall,
54
+ } from './op-factory-call';
36
55
  import { TypeScriptRenderablePostgresMigration } from './planner-produced-postgres-migration';
37
56
  import { postgresPlannerStrategies } from './planner-strategies';
57
+ import { resolveDdlSchemaForNamespaceStorage } from './resolve-ddl-schema';
38
58
  import { verifyPostgresNamespacePresence } from './verify-postgres-namespaces';
39
59
 
40
60
  type PlannerFrameworkComponents = SqlMigrationPlannerPlanOptions extends {
@@ -47,10 +67,6 @@ type PlannerOptionsWithComponents = SqlMigrationPlannerPlanOptions & {
47
67
  readonly frameworkComponents: PlannerFrameworkComponents;
48
68
  };
49
69
 
50
- type VerifySqlSchemaOptionsWithComponents = Parameters<typeof verifySqlSchema>[0] & {
51
- readonly frameworkComponents: PlannerFrameworkComponents;
52
- };
53
-
54
70
  export function createPostgresMigrationPlanner(
55
71
  lowerer: ExecuteRequestLowerer,
56
72
  ): PostgresMigrationPlanner {
@@ -75,18 +91,20 @@ export type PostgresPlanResult =
75
91
  /**
76
92
  * Postgres migration planner — a thin wrapper over `planIssues`.
77
93
  *
78
- * `plan()` verifies the live schema against the target contract (producing
79
- * `SchemaIssue[]`) and delegates to `planIssues` with the unified
80
- * `postgresPlannerStrategies` list: enum-change, NOT-NULL backfill,
81
- * type-change, nullable-tightening, codec-hook storage types,
82
- * component-declared dependency installs, and shared-temp-default /
83
- * empty-table-guarded NOT-NULL add-column. The same strategy list runs for
84
- * `migration plan`, `db update`, and `db init`; behavior diverges purely on
85
- * `policy.allowedOperationClasses` (the data-safe strategies short-circuit
86
- * when `'data'` is excluded). The issue planner applies operation-class
87
- * policy gates and emits a single `PostgresOpFactoryCall[]` that drives both
88
- * the runtime-ops view (via `renderOps`) and the `renderTypeScript()`
89
- * authoring surface.
94
+ * `plan()` diffs the target contract against the live schema via the one
95
+ * differ (`buildPostgresPlanDiff`, producing node-typed `SchemaDiffIssue[]`)
96
+ * and delegates to `planIssues` with the unified `postgresPlannerStrategies`
97
+ * list: NOT-NULL backfill, type-change, nullable-tightening, codec-hook
98
+ * storage types, component-declared dependency installs, and
99
+ * shared-temp-default / empty-table-guarded NOT-NULL add-column. The same
100
+ * strategy list runs for `migration plan`, `db update`, and `db init`;
101
+ * behavior diverges purely on `policy.allowedOperationClasses` (the
102
+ * data-safe strategies short-circuit when `'data'` is excluded). The issue
103
+ * planner applies operation-class policy gates and emits a single
104
+ * `PostgresOpFactoryCall[]` that drives both the runtime-ops view (via
105
+ * `renderOps`) and the `renderTypeScript()` authoring surface. RLS policy
106
+ * drift (the structural half of the same one-differ tree) is handled
107
+ * separately via `planPostgresSchemaDiff`.
90
108
  */
91
109
  export class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgres'> {
92
110
  readonly #lowerer: ExecuteRequestLowerer | undefined;
@@ -122,6 +140,11 @@ export class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgr
122
140
  * the marker row by the right space.
123
141
  */
124
142
  readonly spaceId: string;
143
+ /**
144
+ * Ownership oracle over the contract-space composition — see
145
+ * {@link SqlMigrationPlannerPlanOptions.ownership}.
146
+ */
147
+ readonly ownership?: SchemaOwnership;
125
148
  }): PostgresPlanResult {
126
149
  return this.planSql(options as SqlMigrationPlannerPlanOptions);
127
150
  }
@@ -151,9 +174,68 @@ export class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgr
151
174
  return policyResult;
152
175
  }
153
176
 
154
- const schemaIssues = this.collectSchemaIssues(options);
177
+ // The one combined tree diff drives the whole plan: relational findings
178
+ // become structural DDL via `planIssues`, policy findings become RLS ops
179
+ // via `planPostgresSchemaDiff`. Verify runs its own full-tree node diff
180
+ // (`diffSchema`) over the same schema and rejects on a
181
+ // surviving failure.
182
+ PostgresDatabaseSchemaNode.assert(options.schema);
183
+ const { issues: rawIssues } = buildPostgresPlanDiff({
184
+ contract: options.contract,
185
+ actualSchema: options.schema,
186
+ frameworkComponents: options.frameworkComponents,
187
+ });
188
+ const policyDiffIssues = rawIssues.filter((issue) => isPolicyDiffIssue(issue));
189
+ const relationalDiffIssues = rawIssues.filter((issue) => !isPolicyDiffIssue(issue));
190
+
191
+ // The generic differ is total and un-gated: strict-mode extras filtering
192
+ // (dropping `not-expected` findings outside strict mode, mirroring the
193
+ // retired coordinate walk's `if (strict) { ...extra_* } }` guards),
194
+ // subtree coalescing (a missing/extra table also emits an issue for
195
+ // every child under it — redundant once the table-level Create/Drop call
196
+ // already accounts for the whole subtree), and ownership are all post-diff
197
+ // planner steps.
198
+ //
199
+ // Ownership: a live extra is only this plan's to drop when no contract
200
+ // space owns it. The differ ran against THIS space's contract, so a table
201
+ // a sibling space owns surfaces here as `not-expected`; the planner asks
202
+ // the ownership oracle (the passive aggregate) whether any space declares
203
+ // it and, if so, leaves it alone — it is a sibling's table, not an orphan.
204
+ // A table no space owns stays a genuine extra to drop under a destructive
205
+ // policy. Ownership lives in the aggregate; the planner only asks. Absent
206
+ // oracle (single-space, none handed) keeps every extra. Coalescing MUST
207
+ // run before this so a sibling-owned table's child issues have already
208
+ // collapsed into the one table-level issue that carries the table name.
209
+ const strict =
210
+ options.policy.allowedOperationClasses.includes('widening') ||
211
+ options.policy.allowedOperationClasses.includes('destructive');
212
+ const coalesced = coalesceSubtreeIssues(relationalDiffIssues);
213
+ const owned = retainUnownedExtras(coalesced, options.ownership, options.contract);
214
+ const gated = strict ? owned : owned.filter((issue) => issue.reason !== 'not-expected');
215
+
216
+ // Namespace presence (`CREATE SCHEMA`) is a planner-only op-generation
217
+ // concern stitched in here rather than inside the shared diff — verify
218
+ // never needs it (a missing schema already surfaces as a `not-found`
219
+ // table in the relational findings). These synthesized issues are added
220
+ // AFTER coalescing/scoping (never coalesced against the table diff —
221
+ // their path is an ancestor of every table path under that schema, so
222
+ // running them through the same coalesce would swallow the table-level
223
+ // `not-found` issues that drive `CREATE TABLE`) and are NOT subject to
224
+ // sibling-space scoping, matching the retired coordinate walk exactly.
225
+ const namespaceIssues = verifyPostgresNamespacePresence({
226
+ contract: options.contract,
227
+ schema: options.schema,
228
+ });
229
+ const schemaIssues = [...namespaceIssues, ...gated];
230
+
155
231
  const codecHooks = extractCodecControlHooks(options.frameworkComponents);
156
232
  const storageTypes = options.contract.storage.types ?? {};
233
+ // The strategy layer reads the live schema by bare table name for existence
234
+ // checks (shared-temp-default safety, FK/unique probes), so it takes one
235
+ // per-schema namespace node — never the whole tree root, and never a flat
236
+ // merge of every namespace (which would collide same-named tables across
237
+ // schemas). Probing more than one namespace at once is future work.
238
+ const relationalSchema = relationalNamespaceNode(options.schema, schemaName);
157
239
 
158
240
  // Input-side control-policy partition. `external` / `observed` subjects
159
241
  // — and non-creation issues for `tolerated` subjects — are dropped from
@@ -166,8 +248,8 @@ export class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgr
166
248
  issues: schemaIssues,
167
249
  contract: options.contract,
168
250
  resolveControlPolicySubject: (issue) =>
169
- resolvePostgresIssueControlPolicySubject(issue, options.contract),
170
- resolveCreationFactoryName: resolvePostgresIssueCreationFactoryName,
251
+ resolvePostgresNodeIssueControlPolicySubject(issue, options.contract),
252
+ resolveCreationFactoryName: resolvePostgresNodeIssueCreationFactoryName,
171
253
  formatSubjectLabel: (factoryName, subject) =>
172
254
  formatPostgresControlPolicySubjectLabel(factoryName, subject, options.contract),
173
255
  });
@@ -179,12 +261,12 @@ export class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgr
179
261
  // `db update` / `db init`, which means data-safety strategies needing
180
262
  // from/to comparisons (unsafe type change, nullable tightening) are
181
263
  // inapplicable there — reconciliation falls through to
182
- // `mapIssueToCall`'s direct destructive handlers.
264
+ // `mapNodeIssueToCall`'s direct destructive handlers.
183
265
  fromContract: options.fromContract,
184
266
  schemaName,
185
267
  codecHooks,
186
268
  storageTypes,
187
- schema: options.schema,
269
+ ...ifDefined('schema', relationalSchema),
188
270
  policy: options.policy,
189
271
  frameworkComponents: options.frameworkComponents,
190
272
  strategies: postgresPlannerStrategies,
@@ -194,6 +276,17 @@ export class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgr
194
276
  return plannerFailure(result.failure);
195
277
  }
196
278
 
279
+ const schemaDiffCalls = this.planPostgresSchemaDiff(options, policyDiffIssues);
280
+ const schemaDiffPartition = partitionCallsByControlPolicy({
281
+ calls: schemaDiffCalls,
282
+ contract: options.contract,
283
+ resolveControlPolicySubject: (call) =>
284
+ resolvePostgresCallControlPolicySubject(call, options.contract),
285
+ resolveFactoryName: (call) => call.factoryName,
286
+ formatSubjectLabel: (factoryName, subject) =>
287
+ formatPostgresControlPolicySubjectLabel(factoryName, subject, options.contract),
288
+ });
289
+
197
290
  // Inline `onFieldEvent`-emitted ops after structural DDL. The fixed
198
291
  // ordering is `structural → added → dropped → altered`, with
199
292
  // within-group sorting by `(tableName, fieldName)` so re-emits are
@@ -219,9 +312,10 @@ export class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgr
219
312
  formatSubjectLabel: (factoryName, subject) =>
220
313
  formatPostgresControlPolicySubjectLabel(factoryName, subject, options.contract),
221
314
  });
222
- const calls = [...result.value.calls, ...fieldEventPartition.kept];
315
+ const calls = [...result.value.calls, ...schemaDiffPartition.kept, ...fieldEventPartition.kept];
223
316
  const warnings: SqlPlannerConflict[] = [
224
317
  ...issuePartition.warnings,
318
+ ...schemaDiffPartition.warnings,
225
319
  ...fieldEventPartition.warnings,
226
320
  ];
227
321
 
@@ -240,6 +334,142 @@ export class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgr
240
334
  });
241
335
  }
242
336
 
337
+ /**
338
+ * Maps the RLS policy presence findings of the one combined tree diff
339
+ * (`buildPostgresPlanDiff`, already ownership-filtered) into
340
+ * `CREATE POLICY` / `DROP POLICY` / `ALTER POLICY … RENAME TO` ops. It
341
+ * does not re-diff — it consumes exactly the policy-node subset of the
342
+ * shared diff's issues. Enablement is NOT decided here: `ENABLE`/`DISABLE
343
+ * ROW LEVEL SECURITY` derive from the table's marker-driven `rlsEnabled`
344
+ * attribute diff on the relational side.
345
+ *
346
+ * Rename post-pass: a `not-found` and a `not-expected` policy on the SAME
347
+ * table whose wire-name content hashes match but prefixes differ are one
348
+ * prefix-only rename, collapsed into a single non-destructive
349
+ * `RenamePostgresRlsPolicyCall`. Multi-candidate hash groups pair
350
+ * deterministically by sorted wire name; leftovers proceed as
351
+ * create/drop. Unparseable wire names never pair.
352
+ *
353
+ * The pairing runs only when the policy allows `widening` (rename's
354
+ * class). Without it (db-init's additive-only set), pairing degrades
355
+ * deliberately to the additive half: the new name is CREATEd and the old
356
+ * policy survives live until a widening/destructive-allowed plan runs —
357
+ * emitting an ungated widening rename would only fail at the runner's
358
+ * class re-enforcement.
359
+ */
360
+ private planPostgresSchemaDiff(
361
+ options: PlannerOptionsWithComponents,
362
+ filteredDiffIssues: readonly SchemaDiffIssue<SqlSchemaDiffNode>[],
363
+ ): readonly PostgresOpFactoryCall[] {
364
+ const allowsDestructive = options.policy.allowedOperationClasses.includes('destructive');
365
+ const allowsWidening = options.policy.allowedOperationClasses.includes('widening');
366
+
367
+ interface PolicyFinding {
368
+ readonly node: PostgresPolicySchemaNode;
369
+ readonly schemaForTable: string;
370
+ }
371
+ const missing: PolicyFinding[] = [];
372
+ const extra: PolicyFinding[] = [];
373
+
374
+ for (const issue of filteredDiffIssues) {
375
+ // 'not-equal' is unreachable for content-addressed policies: the wire name
376
+ // encodes the body hash, so two policies sharing a local key (same name)
377
+ // are always equal and isEqualTo never returns false.
378
+ if (issue.reason === 'not-found') {
379
+ const expected = issue.expected;
380
+ PostgresPolicySchemaNode.assert(expected);
381
+ // expected.namespaceId is the DDL schema name (resolved during projection);
382
+ // this re-resolution is a no-op as long as PostgresSchema.ddlSchemaName() returns this.id.
383
+ missing.push({
384
+ node: expected,
385
+ schemaForTable: resolveDdlSchemaForNamespaceStorage(
386
+ options.contract.storage,
387
+ expected.namespaceId,
388
+ ),
389
+ });
390
+ } else if (issue.reason === 'not-expected') {
391
+ const actual = issue.actual;
392
+ PostgresPolicySchemaNode.assert(actual);
393
+ extra.push({
394
+ node: actual,
395
+ schemaForTable: resolveDdlSchemaForNamespaceStorage(
396
+ options.contract.storage,
397
+ actual.namespaceId,
398
+ ),
399
+ });
400
+ }
401
+ }
402
+
403
+ const calls: PostgresOpFactoryCall[] = [];
404
+ const renamedExtras = new Set<PolicyFinding>();
405
+ const renamedMissing = new Set<PolicyFinding>();
406
+ const pairingKey = (finding: PolicyFinding, hash: string): string =>
407
+ JSON.stringify([finding.schemaForTable, finding.node.tableName, hash]);
408
+
409
+ if (allowsWidening) {
410
+ const extrasByGroup = new Map<string, PolicyFinding[]>();
411
+ for (const finding of extra) {
412
+ const parsed = parseRlsPolicyWireName(finding.node.name);
413
+ if (parsed === undefined) continue;
414
+ const key = pairingKey(finding, parsed.hash);
415
+ const group = extrasByGroup.get(key) ?? [];
416
+ group.push(finding);
417
+ extrasByGroup.set(key, group);
418
+ }
419
+ for (const group of extrasByGroup.values()) {
420
+ group.sort((a, b) => (a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0));
421
+ }
422
+
423
+ const sortedMissing = [...missing].sort((a, b) =>
424
+ a.node.name < b.node.name ? -1 : a.node.name > b.node.name ? 1 : 0,
425
+ );
426
+ for (const missingFinding of sortedMissing) {
427
+ const parsed = parseRlsPolicyWireName(missingFinding.node.name);
428
+ if (parsed === undefined) continue;
429
+ const candidates = extrasByGroup.get(pairingKey(missingFinding, parsed.hash));
430
+ const candidate = candidates?.shift();
431
+ if (candidate === undefined) continue;
432
+ // Same name would never surface as missing+extra (the differ pairs by
433
+ // name), so a matched candidate always differs in prefix only.
434
+ renamedExtras.add(candidate);
435
+ renamedMissing.add(missingFinding);
436
+ calls.push(
437
+ new RenamePostgresRlsPolicyCall(
438
+ missingFinding.schemaForTable,
439
+ missingFinding.node.tableName,
440
+ candidate.node.name,
441
+ missingFinding.node.name,
442
+ ),
443
+ );
444
+ }
445
+ }
446
+
447
+ for (const finding of missing) {
448
+ if (renamedMissing.has(finding)) continue;
449
+ calls.push(
450
+ new CreatePostgresRlsPolicyCall(
451
+ finding.schemaForTable,
452
+ finding.node.tableName,
453
+ policyNodeToContractPolicy(finding.node),
454
+ ),
455
+ );
456
+ }
457
+ if (allowsDestructive) {
458
+ for (const finding of extra) {
459
+ if (renamedExtras.has(finding)) continue;
460
+ calls.push(
461
+ new DropPostgresRlsPolicyCall(
462
+ finding.schemaForTable,
463
+ finding.node.tableName,
464
+ finding.node.name,
465
+ ),
466
+ );
467
+ }
468
+ }
469
+
470
+ return calls;
471
+ }
472
+
243
473
  private ensureAdditivePolicy(policy: MigrationOperationPolicy) {
244
474
  if (!policy.allowedOperationClasses.includes('additive')) {
245
475
  return plannerFailure([
@@ -252,35 +482,127 @@ export class PostgresMigrationPlanner implements MigrationPlanner<'sql', 'postgr
252
482
  }
253
483
  return null;
254
484
  }
485
+ }
255
486
 
256
- private collectSchemaIssues(options: PlannerOptionsWithComponents): readonly SchemaIssue[] {
257
- // `db init` uses additive-only policy and intentionally ignores extra
258
- // schema objects. Any reconciliation-capable policy (widening or
259
- // destructive) must inspect extras to reconcile strict equality.
260
- const allowed = options.policy.allowedOperationClasses;
261
- const strict = allowed.includes('widening') || allowed.includes('destructive');
262
- const verifyOptions: VerifySqlSchemaOptionsWithComponents = {
263
- contract: options.contract,
264
- schema: options.schema,
265
- strict,
266
- typeMetadataRegistry: new Map(),
267
- frameworkComponents: options.frameworkComponents,
268
- normalizeDefault: parsePostgresDefault,
269
- normalizeNativeType: normalizeSchemaNativeType,
270
- };
271
- const verifyResult = verifySqlSchema(verifyOptions);
272
- // Schema presence is a Postgres-specific concern (no equivalent in
273
- // SQLite / Mongo), so the issue emission lives in the target layer
274
- // rather than in the family verifier. Stitch it in here so a single
275
- // `SchemaIssue[]` flows through `planIssues` and the planner emits
276
- // CREATE SCHEMA in the dep bucket before any CreateTableCall.
277
- const namespaceIssues = verifyPostgresNamespacePresence({
278
- contract: options.contract,
279
- schema: options.schema,
280
- });
281
- if (namespaceIssues.length === 0) {
282
- return verifyResult.schema.issues;
283
- }
284
- return [...namespaceIssues, ...verifyResult.schema.issues];
285
- }
487
+ /**
488
+ * A diff issue whose node is an RLS policy the structural half of the one
489
+ * combined tree diff, routed to `planPostgresSchemaDiff` instead of
490
+ * `planIssues`.
491
+ */
492
+ function isPolicyDiffIssue(issue: SchemaDiffIssue<SqlSchemaDiffNode>): boolean {
493
+ const node = issue.expected ?? issue.actual;
494
+ return node !== undefined && PostgresPolicySchemaNode.is(node);
495
+ }
496
+
497
+ /**
498
+ * Drops a `not-expected` issue when it is a whole extra TABLE that some
499
+ * contract space owns, asking the ownership oracle per node.
500
+ *
501
+ * The consultation applies ONLY to table-level extras — a live table this
502
+ * space's contract lacks — identified by asking the issue's own node
503
+ * (`nodeKind === table`), never by counting path segments. `declaresEntity`
504
+ * answers over the whole composition (self included), keyed on the schema-IR
505
+ * entity coordinate so a genuine orphan in one namespace is never conflated
506
+ * with a same-named table a sibling space declares in another, or with a
507
+ * same-named non-table entity (an enum, an RLS policy) a sibling declares in
508
+ * the SAME namespace: a positive answer means another space owns THIS table
509
+ * in THIS namespace (a table this space owned would be in its expected tree,
510
+ * never an extra) — leave it. A negative answer means no space owns it — a
511
+ * genuine orphan to drop. `entityKind` is the literal `'table'` here: this
512
+ * function only ever asks about a node already confirmed to be
513
+ * `PostgresSchemaNodeKind.table` (checked just above), and the diff tree's
514
+ * `nodeKind` vocabulary (`'postgres-table'`) is distinct from the storage
515
+ * `entries` vocabulary `elementCoordinates` walks (`'table'`) — the literal
516
+ * is that storage-entries spelling, not the node kind.
517
+ *
518
+ * The issue path carries the *resolved DDL schema* (e.g. `public`), but a
519
+ * contract space's own declared namespace id can be the unbound sentinel
520
+ * (`__unbound__`) that resolves to that schema — the two spellings would
521
+ * never string-match. `resolveNamespaceIdForDdlSchema` recovers the raw
522
+ * namespace id THIS space's own contract would use for that DDL schema, so
523
+ * a table this space's own unbound namespace declares (and any sibling
524
+ * whose own unbound namespace resolves the same way) is compared on the
525
+ * same coordinate the aggregate's `elementCoordinates` walk yields.
526
+ *
527
+ * A DEEPER extra (an extra column/constraint on a table this space DOES own —
528
+ * only the child drifted, so the table is in the expected tree) is this
529
+ * space's own drift and is always kept for dropping; asking the oracle there
530
+ * would wrongly suppress it, because the owned table answers `true`. Shallower
531
+ * issues (namespace/root) are never ownership-scoped here. No oracle ⇒ every
532
+ * extra is kept (single-space plan).
533
+ */
534
+ function retainUnownedExtras(
535
+ issues: readonly SchemaDiffIssue<SqlSchemaDiffNode>[],
536
+ ownership: SchemaOwnership | undefined,
537
+ contract: Contract<SqlStorage>,
538
+ ): readonly SchemaDiffIssue<SqlSchemaDiffNode>[] {
539
+ if (ownership === undefined) return issues;
540
+ return issues.filter((issue) => {
541
+ if (issue.reason !== 'not-expected') return true;
542
+ const node = issueNode(issue);
543
+ if (node === undefined || node.nodeKind !== PostgresSchemaNodeKind.table) return true;
544
+ const ddlSchemaName = issueSchemaName(issue);
545
+ const tableName = issueTableName(issue);
546
+ if (ddlSchemaName === undefined || tableName === undefined) return true;
547
+ const namespaceId = resolveNamespaceIdForDdlSchema(contract, ddlSchemaName);
548
+ return !ownership.declaresEntity({ namespaceId, entityKind: 'table', entityName: tableName });
549
+ });
550
+ }
551
+
552
+ /**
553
+ * Returns the one namespace node the relational strategy layer probes for
554
+ * live-table existence and reads codec-hook context off — the namespace
555
+ * matching the planner's resolved schema name, or the first namespace when
556
+ * none matches. `undefined` when the tree has no namespaces, so the strategy
557
+ * context uses its empty-schema default.
558
+ *
559
+ * The relational strategies key tables by bare name, so they can only probe one
560
+ * namespace at a time; probing across every namespace at once is future work.
561
+ *
562
+ * Returns the real `PostgresNamespaceSchemaNode` reference rather than a
563
+ * projection: `storageTypePlanCallStrategy` hands this same value to codec
564
+ * `planTypeOperations` hooks as `schema`, and hooks read the Postgres-specific
565
+ * `nativeEnumTypeNames` field off it (via `PostgresNamespaceSchemaNode.is`) to
566
+ * decide whether a native enum type already exists — a projection that only
567
+ * copies `tables` would silently drop that signal. `StrategyContext.schema`'s
568
+ * declared type (`SqlSchemaIR`, shared with SQLite's flat shape) doesn't
569
+ * capture this, so the return is `blindCast` the same way `namespaceSchemaNodes`
570
+ * in the family's relational walk already treats a namespace node as a
571
+ * structurally-`SqlSchemaIR`-shaped value.
572
+ */
573
+ function relationalNamespaceNode(
574
+ schema: PostgresDatabaseSchemaNode,
575
+ schemaName: string,
576
+ ): SqlSchemaIR | undefined {
577
+ const namespaceNodes = Object.values(schema.namespaces);
578
+ const namespaceNode =
579
+ namespaceNodes.find((node) => node.schemaName === schemaName) ?? namespaceNodes[0];
580
+ if (namespaceNode === undefined) return undefined;
581
+ return blindCast<
582
+ SqlSchemaIR,
583
+ 'PostgresNamespaceSchemaNode carries tables (+ nativeEnumTypeNames, read by codec hooks via PostgresNamespaceSchemaNode.is) structurally compatible with the SqlSchemaIR shape the strategy layer declares'
584
+ >(namespaceNode);
585
+ }
586
+
587
+ /**
588
+ * Rebuilds the `PostgresRlsPolicy` contract entity `CreatePostgresRlsPolicyCall`
589
+ * carries (its `renderTypeScript`/`createRlsPolicy` paths serialize the whole
590
+ * entity, `namespaceId` included). This reconstructs rather than looking the
591
+ * original up in the contract on purpose: the diff node's `namespaceId` is the
592
+ * *resolved DDL schema* (set when the expected tree was built), which is the
593
+ * value the emitted op must carry; the contract-stored entity holds the raw,
594
+ * pre-resolution coordinate, so a lookup would change the migration output.
595
+ */
596
+ function policyNodeToContractPolicy(node: PostgresPolicySchemaNode): PostgresRlsPolicy {
597
+ return new PostgresRlsPolicy({
598
+ name: node.name,
599
+ prefix: node.prefix,
600
+ tableName: node.tableName,
601
+ namespaceId: node.namespaceId,
602
+ operation: node.operation,
603
+ roles: [...node.roles],
604
+ ...ifDefined('using', node.using),
605
+ ...ifDefined('withCheck', node.withCheck),
606
+ permissive: node.permissive,
607
+ });
286
608
  }