@prisma-next/target-postgres 0.15.0 → 0.16.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{authoring-BtsOWgI3.mjs → authoring-34L18kA1.mjs} +18 -8
- package/dist/authoring-34L18kA1.mjs.map +1 -0
- package/dist/canonicalize-D1F4vUnP.d.mts.map +1 -1
- package/dist/{codec-ids-CI144z7g.d.mts → codec-ids-BswpvvND.d.mts} +3 -3
- package/dist/codec-ids-BswpvvND.d.mts.map +1 -0
- package/dist/{codec-ids-B10ZZHzw.mjs → codec-ids-D3G8K0YM.mjs} +3 -2
- package/dist/codec-ids-D3G8K0YM.mjs.map +1 -0
- package/dist/codec-ids.d.mts +2 -2
- package/dist/codec-ids.mjs +2 -2
- package/dist/{codec-types-CTfT4U4O.d.mts → codec-types-CQ07nOz-.d.mts} +4 -5
- package/dist/codec-types-CQ07nOz-.d.mts.map +1 -0
- package/dist/codec-types.d.mts +1 -1
- package/dist/{codecs-D7W9O0Xx.d.mts → codecs-G4DTY0F_.d.mts} +35 -7
- package/dist/codecs-G4DTY0F_.d.mts.map +1 -0
- package/dist/{codecs-DRbb26Or.mjs → codecs-TCsGgW-Y.mjs} +77 -5
- package/dist/codecs-TCsGgW-Y.mjs.map +1 -0
- package/dist/codecs.d.mts +2 -3
- package/dist/codecs.d.mts.map +1 -1
- package/dist/codecs.mjs +2 -2
- package/dist/contract-free.d.mts +2 -3
- package/dist/contract-free.d.mts.map +1 -1
- package/dist/contract-free.mjs +3 -3
- package/dist/{control-policy-DtbkLLGv.mjs → control-policy-S7XBe07W.mjs} +44 -75
- package/dist/control-policy-S7XBe07W.mjs.map +1 -0
- package/dist/control.d.mts +0 -1
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +75 -25
- package/dist/control.mjs.map +1 -1
- package/dist/data-transform-BOWpliq8.mjs.map +1 -1
- package/dist/{data-transform-DPzwBMhW.d.mts → data-transform-CGvE8yGx.d.mts} +1 -2
- package/dist/data-transform-CGvE8yGx.d.mts.map +1 -0
- package/dist/data-transform.d.mts +1 -1
- package/dist/{ddl-GTTOvjx_.mjs → ddl-DHXKzQ99.mjs} +3 -3
- package/dist/{ddl-GTTOvjx_.mjs.map → ddl-DHXKzQ99.mjs.map} +1 -1
- package/dist/ddl.d.mts +1 -1
- package/dist/default-normalizer-B9ZUiyUE.mjs +264 -0
- package/dist/default-normalizer-B9ZUiyUE.mjs.map +1 -0
- package/dist/default-normalizer.d.mts +14 -2
- package/dist/default-normalizer.d.mts.map +1 -1
- package/dist/default-normalizer.mjs +2 -248
- package/dist/{descriptor-meta-CFQKLXl_.mjs → descriptor-meta-qubYaxQA.mjs} +9 -4
- package/dist/descriptor-meta-qubYaxQA.mjs.map +1 -0
- package/dist/{diff-database-schema-GncqMuSI.mjs → diff-database-schema-BRxq7l98.mjs} +92 -26
- package/dist/diff-database-schema-BRxq7l98.mjs.map +1 -0
- package/dist/diff-database-schema.d.mts +4 -13
- package/dist/diff-database-schema.d.mts.map +1 -1
- package/dist/diff-database-schema.mjs +1 -1
- package/dist/{errors-DO-w0EUS.mjs → errors-ByDS0xJL.mjs} +6 -6
- package/dist/errors-ByDS0xJL.mjs.map +1 -0
- package/dist/errors.d.mts +4 -4
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +1 -1
- package/dist/issue-planner.d.mts +1 -2
- package/dist/issue-planner.d.mts.map +1 -1
- package/dist/issue-planner.mjs +1 -1
- package/dist/migration.d.mts +3 -4
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +2 -2
- package/dist/native-type-normalizer.d.mts.map +1 -1
- package/dist/{nodes-Dv5eCSq9.d.mts → nodes-CQzM2hR0.d.mts} +1 -2
- package/dist/nodes-CQzM2hR0.d.mts.map +1 -0
- package/dist/{op-factory-call-C38NzvQD.mjs → op-factory-call-Ci3H6InB.mjs} +37 -21
- package/dist/op-factory-call-Ci3H6InB.mjs.map +1 -0
- package/dist/{op-factory-call-Bn9zDx4_.d.mts → op-factory-call-DT7kdjVP.d.mts} +10 -7
- package/dist/op-factory-call-DT7kdjVP.d.mts.map +1 -0
- package/dist/op-factory-call.d.mts +2 -2
- package/dist/op-factory-call.mjs +2 -2
- package/dist/pack.d.mts +122 -6
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +1 -1
- package/dist/{planner-kql24i_F.mjs → planner-BpL7uktH.mjs} +15 -15
- package/dist/planner-BpL7uktH.mjs.map +1 -0
- package/dist/planner-ddl-builders.d.mts +1 -2
- package/dist/planner-ddl-builders.d.mts.map +1 -1
- package/dist/planner-identity-values.d.mts +0 -1
- package/dist/planner-identity-values.d.mts.map +1 -1
- package/dist/{planner-produced-postgres-migration-BEY1T0Xm.d.mts → planner-produced-postgres-migration-8QP8eMph.d.mts} +3 -4
- package/dist/planner-produced-postgres-migration-8QP8eMph.d.mts.map +1 -0
- package/dist/{planner-produced-postgres-migration-D7y-PEHK.mjs → planner-produced-postgres-migration-D8exrrxA.mjs} +8 -5
- package/dist/planner-produced-postgres-migration-D8exrrxA.mjs.map +1 -0
- package/dist/planner-produced-postgres-migration.d.mts +1 -1
- package/dist/planner-produced-postgres-migration.mjs +1 -1
- package/dist/planner-schema-lookup.d.mts +0 -1
- package/dist/planner-schema-lookup.d.mts.map +1 -1
- package/dist/{planner-sql-checks-zqNfs2XZ.mjs → planner-sql-checks-BuB877wH.mjs} +2 -2
- package/dist/{planner-sql-checks-zqNfs2XZ.mjs.map → planner-sql-checks-BuB877wH.mjs.map} +1 -1
- package/dist/planner-sql-checks.d.mts +0 -1
- package/dist/planner-sql-checks.d.mts.map +1 -1
- package/dist/planner-sql-checks.mjs +1 -1
- package/dist/planner-target-details-HkP4RrRO.d.mts.map +1 -1
- package/dist/planner.d.mts +9 -4
- package/dist/planner.d.mts.map +1 -1
- package/dist/planner.mjs +2 -2
- package/dist/{postgres-contract-view-C9j5cqP0.d.mts → postgres-contract-view-CeU7FJjW.d.mts} +4 -3
- package/dist/postgres-contract-view-CeU7FJjW.d.mts.map +1 -0
- package/dist/{postgres-contract-view-DM8sN1Ot.mjs → postgres-contract-view-DebHMqGR.mjs} +4 -4
- package/dist/{postgres-contract-view-DM8sN1Ot.mjs.map → postgres-contract-view-DebHMqGR.mjs.map} +1 -1
- package/dist/{postgres-database-schema-node-CJv5bfbs.d.mts → postgres-database-schema-node-DMXsIwAb.d.mts} +12 -4
- package/dist/postgres-database-schema-node-DMXsIwAb.d.mts.map +1 -0
- package/dist/{postgres-migration-arMSWU9b.mjs → postgres-migration-Bn3fj1I4.mjs} +22 -6
- package/dist/postgres-migration-Bn3fj1I4.mjs.map +1 -0
- package/dist/{postgres-migration-DbckK1su.d.mts → postgres-migration-DLIvzHjX.d.mts} +31 -7
- package/dist/postgres-migration-DLIvzHjX.d.mts.map +1 -0
- package/dist/{postgres-rls-policy--CSddvMR.d.mts → postgres-rls-policy-CYXdqG9B.d.mts} +1 -2
- package/dist/postgres-rls-policy-CYXdqG9B.d.mts.map +1 -0
- package/dist/{postgres-role-schema-node-Cm-j0ZGM.mjs → postgres-role-schema-node-bg32e7I-.mjs} +3 -2
- package/dist/postgres-role-schema-node-bg32e7I-.mjs.map +1 -0
- package/dist/{postgres-schema-Cm4DtiGA.mjs → postgres-schema-CewLYHB7.mjs} +2 -2
- package/dist/{postgres-schema-Cm4DtiGA.mjs.map → postgres-schema-CewLYHB7.mjs.map} +1 -1
- package/dist/{postgres-schema-DKq6s1P3.d.mts → postgres-schema-FdKRwe7X.d.mts} +3 -4
- package/dist/postgres-schema-FdKRwe7X.d.mts.map +1 -0
- package/dist/render-ops.d.mts +0 -1
- package/dist/render-ops.d.mts.map +1 -1
- package/dist/{render-typescript-7yqILcwr.mjs → render-typescript-Ta7_6CGf.mjs} +20 -8
- package/dist/render-typescript-Ta7_6CGf.mjs.map +1 -0
- package/dist/render-typescript.d.mts +2 -1
- package/dist/render-typescript.d.mts.map +1 -1
- package/dist/render-typescript.mjs +1 -1
- package/dist/{resolve-ddl-schema-XyBaaenM.mjs → resolve-ddl-schema-D0wi_P9Q.mjs} +2 -2
- package/dist/{resolve-ddl-schema-XyBaaenM.mjs.map → resolve-ddl-schema-D0wi_P9Q.mjs.map} +1 -1
- package/dist/rls-canonicalize.d.mts +0 -1
- package/dist/rls-canonicalize.d.mts.map +1 -1
- package/dist/runtime.d.mts +1 -2
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/schema-ir-annotations.d.mts +0 -1
- package/dist/schema-ir-annotations.d.mts.map +1 -1
- package/dist/schema-ir-annotations.mjs +1 -1
- package/dist/schema-node-kinds-DxvWh2Ic.d.mts +29 -0
- package/dist/schema-node-kinds-DxvWh2Ic.d.mts.map +1 -0
- package/dist/sql-utils.d.mts.map +1 -1
- package/dist/{table-source-BvFo7gVs.d.mts → table-source-D5c2fxAQ.d.mts} +1 -2
- package/dist/table-source-D5c2fxAQ.d.mts.map +1 -0
- package/dist/{types-BDKkx8MA.d.mts → types-D2MLzLBD.d.mts} +1 -2
- package/dist/types-D2MLzLBD.d.mts.map +1 -0
- package/dist/types.d.mts +6 -5
- package/dist/types.mjs +4 -4
- package/package.json +21 -21
- package/src/core/authoring.ts +18 -5
- package/src/core/codec-helpers.ts +53 -1
- package/src/core/codec-ids.ts +1 -0
- package/src/core/codecs.ts +56 -3
- package/src/core/default-normalizer.ts +22 -0
- package/src/core/descriptor-meta.ts +2 -0
- package/src/core/errors.ts +5 -5
- package/src/core/index-types.ts +15 -0
- package/src/core/migrations/contract-to-postgres-database-schema-node.ts +99 -19
- package/src/core/migrations/control-policy.ts +4 -3
- package/src/core/migrations/diff-database-schema.ts +6 -3
- package/src/core/migrations/issue-planner.ts +41 -80
- package/src/core/migrations/op-factory-call.ts +41 -22
- package/src/core/migrations/operations/data-transform.ts +2 -2
- package/src/core/migrations/planner-produced-postgres-migration.ts +9 -2
- package/src/core/migrations/planner-strategies.ts +6 -6
- package/src/core/migrations/planner.ts +13 -4
- package/src/core/migrations/postgres-migration.ts +62 -2
- package/src/core/migrations/render-typescript.ts +20 -8
- package/src/core/migrations/runner.ts +12 -11
- package/src/core/migrations/verify-postgres-namespaces.ts +0 -1
- package/src/core/psl-infer/infer-psl-contract.ts +130 -12
- package/src/core/schema-ir/postgres-policy-schema-node.ts +12 -2
- package/src/exports/codecs.ts +2 -0
- package/src/exports/control.ts +2 -0
- package/src/exports/default-normalizer.ts +1 -1
- package/src/exports/op-factory-call.ts +5 -0
- package/src/exports/types.ts +1 -0
- package/dist/authoring-BtsOWgI3.mjs.map +0 -1
- package/dist/codec-ids-B10ZZHzw.mjs.map +0 -1
- package/dist/codec-ids-CI144z7g.d.mts.map +0 -1
- package/dist/codec-types-CTfT4U4O.d.mts.map +0 -1
- package/dist/codecs-D7W9O0Xx.d.mts.map +0 -1
- package/dist/codecs-DRbb26Or.mjs.map +0 -1
- package/dist/control-policy-DtbkLLGv.mjs.map +0 -1
- package/dist/data-transform-DPzwBMhW.d.mts.map +0 -1
- package/dist/default-normalizer.mjs.map +0 -1
- package/dist/descriptor-meta-CFQKLXl_.mjs.map +0 -1
- package/dist/diff-database-schema-GncqMuSI.mjs.map +0 -1
- package/dist/errors-DO-w0EUS.mjs.map +0 -1
- package/dist/nodes-Dv5eCSq9.d.mts.map +0 -1
- package/dist/op-factory-call-Bn9zDx4_.d.mts.map +0 -1
- package/dist/op-factory-call-C38NzvQD.mjs.map +0 -1
- package/dist/planner-kql24i_F.mjs.map +0 -1
- package/dist/planner-produced-postgres-migration-BEY1T0Xm.d.mts.map +0 -1
- package/dist/planner-produced-postgres-migration-D7y-PEHK.mjs.map +0 -1
- package/dist/postgres-contract-view-C9j5cqP0.d.mts.map +0 -1
- package/dist/postgres-database-schema-node-CJv5bfbs.d.mts.map +0 -1
- package/dist/postgres-migration-DbckK1su.d.mts.map +0 -1
- package/dist/postgres-migration-arMSWU9b.mjs.map +0 -1
- package/dist/postgres-rls-policy--CSddvMR.d.mts.map +0 -1
- package/dist/postgres-role-schema-node-Cm-j0ZGM.mjs.map +0 -1
- package/dist/postgres-schema-DKq6s1P3.d.mts.map +0 -1
- package/dist/render-typescript-7yqILcwr.mjs.map +0 -1
- package/dist/table-source-BvFo7gVs.d.mts.map +0 -1
- package/dist/types-BDKkx8MA.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres-schema-Cm4DtiGA.mjs","names":[],"sources":["../src/core/postgres-rls-enablement.ts","../src/core/postgres-rls-policy.ts","../src/core/postgres-role.ts","../src/core/postgres-validators.ts","../src/core/ast/table-source.ts","../src/core/entity-kinds.ts","../src/core/postgres-schema.ts"],"sourcesContent":["import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from '@prisma-next/sql-contract/types';\n\nexport interface PostgresRlsEnablementInput {\n /** Name of the table this marker declares RLS-controlled. */\n readonly tableName: string;\n /** Namespace coordinate (schema name). Markers are schema-scoped like policies. */\n readonly namespaceId: string;\n}\n\n/**\n * Postgres contract-IR marker for `@@rls` on a model: the table named here is\n * RLS-controlled (`ENABLE ROW LEVEL SECURITY` is driven by this marker, never\n * by the policy set).\n *\n * This is an authored, serialized Contract-IR entity — it is registered as an\n * entity kind, extends `SqlNode`, and is stored in `contract.json` under\n * `entries.rls[tableName]`. Target-only concept — no SQL-family abstract.\n * Frozen at construction via `freezeNode(this)`. The `kind: 'rls'`\n * discriminant is enumerable so it survives JSON serialization; the literal\n * matches the entries key (one-string rule).\n */\nexport class PostgresRlsEnablement extends SqlNode {\n override readonly kind = 'rls' as const;\n readonly tableName: string;\n readonly namespaceId: string;\n\n constructor(input: PostgresRlsEnablementInput) {\n super();\n this.tableName = input.tableName;\n this.namespaceId = input.namespaceId;\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from '@prisma-next/sql-contract/types';\n\nexport type RlsPolicyOperation = 'select' | 'insert' | 'update' | 'delete' | 'all';\n\nexport interface PostgresRlsPolicyInput {\n /** Full wire name: `<prefix>_<8hex>`. Stored as-is; hashing is not this class's job. */\n readonly name: string;\n /** User-supplied prefix (the part before the `_<8hex>` suffix). */\n readonly prefix: string;\n /** Name of the table this policy attaches to, by name within the same schema. */\n readonly tableName: string;\n /** Namespace coordinate (schema name). Policies are schema-scoped. */\n readonly namespaceId: string;\n readonly operation: RlsPolicyOperation;\n /** Sorted role names rendered in `TO <roles>`. Plain strings in this slice. */\n readonly roles: readonly string[];\n /** USING predicate SQL string, if present. */\n readonly using?: string;\n /** WITH CHECK predicate SQL string, if present. */\n readonly withCheck?: string;\n /** `true` = `AS PERMISSIVE`, `false` = `AS RESTRICTIVE`. */\n readonly permissive: boolean;\n}\n\n/**\n * Postgres contract-IR class for a row-level security policy (`CREATE POLICY … ON …`).\n *\n * This is an authored, serialized Contract-IR entity — it is registered as an entity\n * kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;\n * the schema-diff tree uses `PostgresPolicySchemaNode` for that role.\n *\n * Target-only concept — no SQL-family abstract. Extends `SqlNode` directly.\n * Frozen at construction via `freezeNode(this)`. The `kind: 'policy'`\n * discriminant is enumerable (overrides SqlNode's non-enumerable `'sql'`) so it\n * survives JSON serialization and enables dispatch. The literal matches the\n * entries key (one-string rule: node.kind === entries key === entity kind).\n */\nexport class PostgresRlsPolicy extends SqlNode {\n override readonly kind = 'policy' as const;\n readonly name: string;\n readonly prefix: string;\n readonly tableName: string;\n readonly namespaceId: string;\n readonly operation: RlsPolicyOperation;\n readonly roles: readonly string[];\n declare readonly using?: string;\n declare readonly withCheck?: string;\n readonly permissive: boolean;\n\n constructor(input: PostgresRlsPolicyInput) {\n super();\n this.name = input.name;\n this.prefix = input.prefix;\n this.tableName = input.tableName;\n this.namespaceId = input.namespaceId;\n this.operation = input.operation;\n this.roles = Object.freeze([...input.roles]);\n if (input.using !== undefined) this.using = input.using;\n if (input.withCheck !== undefined) this.withCheck = input.withCheck;\n this.permissive = input.permissive;\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from '@prisma-next/sql-contract/types';\n\n/**\n * Roles are referenced by the contract but never owned — the framework\n * issues no `CREATE`/`DROP ROLE`, so a role's effective governance is always\n * `external`: a missing declared role fails verify, an extra live role is\n * tolerated, and the planner emits zero role DDL. `external` is the only\n * value a role's control can ever carry.\n */\nexport const ROLE_DEFAULT_CONTROL_POLICY = 'external';\n\nexport interface PostgresRoleInput {\n readonly name: string;\n /**\n * Namespace coordinate. Roles are cluster-scoped; pass `UNBOUND_NAMESPACE_ID`\n * from `@prisma-next/framework-components/ir`.\n */\n readonly namespaceId: string;\n /**\n * Defaults to {@link ROLE_DEFAULT_CONTROL_POLICY} when omitted. Roles are\n * referenced but never owned, so `'external'` is the only allowed value.\n */\n readonly control?: 'external';\n}\n\n/**\n * Postgres contract-IR class for a database role (`CREATE ROLE …`).\n *\n * This is an authored, serialized Contract-IR entity — it is registered as an entity\n * kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;\n * the schema-diff tree uses `PostgresRoleSchemaNode` for that role.\n *\n * Roles are cluster-scoped, so their namespace coordinate is always\n * `UNBOUND_NAMESPACE_ID`. Target-only concept — no SQL-family abstract.\n * Extends `SqlNode` directly, frozen at construction via `freezeNode(this)`.\n * The `kind: 'role'` discriminant is enumerable so it survives JSON.\n * Matches the entries key (one-string rule).\n *\n * `control` always carries a value (never omitted): it defaults to\n * {@link ROLE_DEFAULT_CONTROL_POLICY} in the constructor, so both a\n * freshly-authored role and one hydrated from an older `contract.json`\n * lacking the field resolve the same way — the control-policy resolver\n * reads it directly off the entity instead of special-casing role issues.\n */\nexport class PostgresRole extends SqlNode {\n override readonly kind = 'role' as const;\n readonly name: string;\n readonly namespaceId: string;\n readonly control: 'external';\n\n constructor(input: PostgresRoleInput) {\n super();\n this.name = input.name;\n this.namespaceId = input.namespaceId;\n this.control = input.control ?? ROLE_DEFAULT_CONTROL_POLICY;\n freezeNode(this);\n }\n}\n","import { type } from 'arktype';\n\nexport const PostgresRoleSchema = type({\n kind: \"'role'\",\n name: 'string',\n namespaceId: 'string',\n 'control?': \"'external'\",\n});\n\nexport const PostgresRlsPolicySchema = type({\n kind: \"'policy'\",\n name: 'string',\n prefix: 'string',\n tableName: 'string',\n namespaceId: 'string',\n operation: \"'select' | 'insert' | 'update' | 'delete' | 'all'\",\n roles: type.string.array().readonly(),\n 'using?': 'string',\n 'withCheck?': 'string',\n permissive: 'boolean',\n});\n\nexport const PostgresRlsEnablementSchema = type({\n kind: \"'rls'\",\n tableName: 'string',\n namespaceId: 'string',\n});\n\nexport const PostgresNativeEnumSchema = type({\n kind: \"'postgres-enum'\",\n typeName: 'string',\n members: type.string.array().readonly(),\n 'control?': \"'managed' | 'tolerated' | 'external' | 'observed'\",\n});\n","import {\n type AnyFromSource,\n type AstRewriter,\n TableSource,\n} from '@prisma-next/sql-relational-core/ast';\n\nexport class PostgresTableSource extends TableSource {\n readonly schema: string | undefined;\n\n constructor(options: {\n readonly name: string;\n readonly schema?: string;\n readonly alias?: string;\n }) {\n super(options.name, options.alias);\n this.schema = options.schema;\n this.freeze();\n }\n\n override rewrite(rewriter: AstRewriter): AnyFromSource {\n return rewriter.tableSource ? rewriter.tableSource(this) : this;\n }\n}\n","import type { EntityKindDescriptor } from '@prisma-next/framework-components/ir';\nimport { PostgresNativeEnum, type PostgresNativeEnumInput } from './postgres-native-enum';\nimport { PostgresRlsEnablement, type PostgresRlsEnablementInput } from './postgres-rls-enablement';\nimport { PostgresRlsPolicy, type PostgresRlsPolicyInput } from './postgres-rls-policy';\nimport { PostgresRole, type PostgresRoleInput } from './postgres-role';\nimport {\n PostgresNativeEnumSchema,\n PostgresRlsEnablementSchema,\n PostgresRlsPolicySchema,\n PostgresRoleSchema,\n} from './postgres-validators';\n\nexport const policyEntityKind: EntityKindDescriptor<PostgresRlsPolicyInput, PostgresRlsPolicy> = {\n kind: 'policy',\n schema: PostgresRlsPolicySchema,\n construct: (input) => new PostgresRlsPolicy(input),\n};\n\nexport const roleEntityKind: EntityKindDescriptor<PostgresRoleInput, PostgresRole> = {\n kind: 'role',\n schema: PostgresRoleSchema,\n construct: (input) => new PostgresRole(input),\n};\n\nexport const rlsEnablementEntityKind: EntityKindDescriptor<\n PostgresRlsEnablementInput,\n PostgresRlsEnablement\n> = {\n kind: 'rls',\n schema: PostgresRlsEnablementSchema,\n construct: (input) => new PostgresRlsEnablement(input),\n};\n\nexport const nativeEnumEntityKind: EntityKindDescriptor<\n PostgresNativeEnumInput,\n PostgresNativeEnum\n> = {\n kind: 'native_enum',\n schema: PostgresNativeEnumSchema,\n construct: (input) => new PostgresNativeEnum(input),\n};\n","import type { Contract } from '@prisma-next/contract/types';\nimport {\n freezeNode,\n hydrateNamespaceEntities,\n UNBOUND_NAMESPACE_ID,\n} from '@prisma-next/framework-components/ir';\nimport { composeSqlEntityKinds } from '@prisma-next/sql-contract/entity-kinds';\nimport {\n SqlNamespaceBase,\n type SqlNamespaceEntries,\n type SqlNamespaceInput,\n type SqlStorage,\n type StorageTable,\n type StorageValueSet,\n} from '@prisma-next/sql-contract/types';\n\nimport { type CfExpr, cfExpr } from '@prisma-next/sql-relational-core/contract-free';\nimport { invariant } from '@prisma-next/utils/assertions';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { PostgresTableSource } from './ast/table-source';\nimport { PG_TEXT_CODEC_ID } from './codec-ids';\nimport {\n nativeEnumEntityKind,\n policyEntityKind,\n rlsEnablementEntityKind,\n roleEntityKind,\n} from './entity-kinds';\nimport { PostgresNativeEnum } from './postgres-native-enum';\nimport type { PostgresRlsEnablement } from './postgres-rls-enablement';\nimport type { PostgresRlsPolicy } from './postgres-rls-policy';\nimport type { PostgresRole } from './postgres-role';\nimport { escapeLiteral } from './sql-utils';\n\nexport type PostgresContract = Contract<SqlStorage> & { readonly target: 'postgres' };\n\nexport type PostgresNamespaceEntries = SqlNamespaceEntries & {\n readonly policy?: Readonly<Record<string, PostgresRlsPolicy>>;\n readonly role?: Readonly<Record<string, PostgresRole>>;\n readonly rls?: Readonly<Record<string, PostgresRlsEnablement>>;\n readonly native_enum?: Readonly<Record<string, PostgresNativeEnum>>;\n};\n\nexport interface PostgresSchemaInput {\n readonly id: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, unknown>>>>;\n}\n\n/**\n * Postgres target `Namespace` concretion — a Postgres schema (`CREATE\n * SCHEMA …`). Each Postgres `SqlStorage` carries a\n * `namespaces: Record<NamespaceId, PostgresSchema>` map populated by\n * the Postgres PSL interpreter from `namespace { … }` AST buckets.\n *\n * `entries` holds entity-kind maps (`table`, `valueSet`). Qualifier\n * emission is the rendering seam: DDL / SQL emission asks the namespace\n * for its qualifier (`\"<schema>\"`) or for a qualified table name\n * (`\"<schema>\".\"<table>\"`) and consumes the result polymorphically.\n * The unbound singleton below overrides these methods to elide the\n * prefix entirely — call sites stay polymorphic and never branch on\n * `id === UNBOUND_NAMESPACE_ID`.\n */\nexport class PostgresSchema extends SqlNamespaceBase {\n /**\n * Stable singleton reference for the late-bound slot. Materialised\n * lazily below the singleton subclass declaration so the static\n * initialiser sees the subclass before assigning. Consumers always\n * reach for `PostgresSchema.unbound` (or `PostgresUnboundSchema.instance`\n * — same identity).\n */\n static unbound: PostgresUnboundSchema;\n\n declare readonly kind: 'schema';\n readonly id: string;\n readonly entries: PostgresNamespaceEntries;\n\n constructor(input: PostgresSchemaInput) {\n super();\n this.id = input.id;\n\n const dispatched = hydrateNamespaceEntities(\n input.entries,\n composeSqlEntityKinds([\n policyEntityKind,\n roleEntityKind,\n rlsEnablementEntityKind,\n nativeEnumEntityKind,\n ]),\n 'carry',\n );\n\n // A native enum keys under its PHYSICAL type name in storage `entries`\n // (ADR 221 coordinate `entityName`). The family/authoring layer keys every\n // block by its author handle, so re-key the `native_enum` slot by each\n // entity's `typeName` here — target-local Postgres code that already knows\n // this entity kind. This runs at both authoring and hydration; a serialized\n // contract's key already equals the `typeName`, so the re-key is idempotent.\n const nativeEnumSlot = dispatched['native_enum'];\n if (nativeEnumSlot !== undefined) {\n const rekeyed: Record<string, unknown> = {};\n for (const [handle, entity] of Object.entries(nativeEnumSlot)) {\n const physicalName = PostgresNativeEnum.is(entity) ? entity.typeName : handle;\n invariant(\n !Object.hasOwn(rekeyed, physicalName),\n `PostgresSchema \"${input.id}\": two native_enum entities resolve to the same physical type name \"${physicalName}\". Give them distinct @@map type names.`,\n );\n rekeyed[physicalName] = entity;\n }\n dispatched['native_enum'] = Object.freeze(rekeyed);\n }\n\n // Drop an empty valueSet so presence signals non-emptiness.\n const valueSetRaw = dispatched['valueSet'];\n const withPresence =\n valueSetRaw !== undefined && Object.keys(valueSetRaw).length === 0\n ? { ...dispatched, valueSet: undefined }\n : dispatched;\n\n const entriesInput: Record<string, Readonly<Record<string, unknown>> | undefined> = {\n ...withPresence,\n };\n\n this.entries = Object.freeze(\n blindCast<\n PostgresNamespaceEntries,\n 'composeSqlEntityKinds([policyEntityKind, roleEntityKind, rlsEnablementEntityKind, nativeEnumEntityKind]) supplies table→StorageTable, valueSet→StorageValueSet, policy→PostgresRlsPolicy, role→PostgresRole, rls→PostgresRlsEnablement, native_enum→PostgresNativeEnum descriptors'\n >(entriesInput),\n );\n Object.defineProperty(this, 'kind', {\n value: 'schema',\n writable: false,\n enumerable: false,\n configurable: true,\n });\n freezeNode(this);\n }\n\n get table(): Readonly<Record<string, StorageTable>> {\n return this.entries.table ?? Object.freeze({});\n }\n\n get valueSet(): Readonly<Record<string, StorageValueSet>> | undefined {\n return this.entries.valueSet;\n }\n\n get policy(): Readonly<Record<string, PostgresRlsPolicy>> {\n return this.entries.policy ?? Object.freeze({});\n }\n\n get role(): Readonly<Record<string, PostgresRole>> {\n return this.entries.role ?? Object.freeze({});\n }\n\n get rls(): Readonly<Record<string, PostgresRlsEnablement>> {\n return this.entries.rls ?? Object.freeze({});\n }\n\n /**\n * The bare schema qualifier as it would appear in a rendered SQL\n * fragment (already quoted). The unbound-schema singleton overrides\n * this to return `''`.\n */\n qualifier(): string {\n return `\"${this.id}\"`;\n }\n\n /**\n * Qualify a table name with the schema prefix\n * (`\"<schema>\".\"<table>\"`). The unbound-schema singleton overrides\n * this to emit just `\"<table>\"` so the resolved DDL is unqualified\n * and `search_path` decides where the object lands at runtime.\n */\n qualifyTable(tableName: string): string {\n return `\"${this.id}\".\"${tableName}\"`;\n }\n\n /**\n * Render a SQL string-literal containing the qualified-name form\n * suitable for `to_regclass(...)` arguments (e.g. `'\"public\".\"user\"'`).\n * The unbound singleton overrides this to elide the schema prefix\n * (`'\"user\"'`) so `search_path` resolves the object at runtime.\n */\n regclassLiteral(name: string): string {\n return `'${escapeLiteral(this.qualifyTable(name))}'`;\n }\n\n /**\n * Render a SQL expression that evaluates to this namespace's schema\n * name at runtime, ready to drop into a `WHERE table_schema = …` /\n * `WHERE n.nspname = …` clause. Named schemas emit a quoted SQL\n * literal (`'public'`); the unbound singleton overrides this to emit\n * `current_schema()` so catalog queries match whichever schema the\n * connection's `search_path` resolved at runtime.\n */\n schemaSqlExpression(): string {\n return `'${escapeLiteral(this.id)}'`;\n }\n\n /**\n * Typed-AST counterpart of {@link schemaSqlExpression}: the expression a\n * builder-built catalog check compares `n.nspname` / `table_schema`\n * against. Named schemas bind the schema name as a text parameter; the\n * unbound singleton overrides this to the opaque `current_schema()`\n * expression so the live connection's `search_path` decides at runtime.\n */\n schemaFilterExpression(): CfExpr {\n return cfExpr.param(this.id, PG_TEXT_CODEC_ID);\n }\n\n /**\n * Typed-AST counterpart of {@link qualifyTable}: the FROM source a\n * builder-built check uses to address a user table in this namespace.\n * Named schemas qualify (`\"schema\".\"table\"`); the unbound singleton\n * overrides this to leave the table unqualified so `search_path`\n * resolves it at runtime.\n */\n tableSource(tableName: string, alias?: string): PostgresTableSource {\n return new PostgresTableSource({\n name: tableName,\n schema: this.id,\n ...ifDefined('alias', alias),\n });\n }\n\n /**\n * The bare schema name a DDL planner should target when emitting\n * statements that need to identify this namespace in the live\n * database (e.g. `CREATE TABLE \"<ddlSchemaName>\".\"<table>\" …`,\n * catalog filters, planner conflict lookups). Named schemas resolve\n * to their own id. The `PostgresUnboundSchema` singleton inherits\n * this and returns `UNBOUND_NAMESPACE_ID` — callers that dispatch\n * through `qualifyTableName` route through the polymorphic\n * `PostgresUnboundSchema` overrides and produce unqualified\n * (search-path-resolved) output automatically.\n */\n ddlSchemaName(_storage: SqlStorage): string {\n return this.id;\n }\n}\n\n/**\n * Singleton subclass for the reserved sentinel namespace id\n * (`UNBOUND_NAMESPACE_ID`) — the late-bound Postgres slot whose binding\n * the connection's `search_path` resolves at runtime. Overrides\n * qualifier emission to elide the schema prefix; call sites that consume\n * `qualifier()` / `qualifyTable()` get unqualified output without\n * branching on the namespace id.\n *\n * This is the target-side materialization of \"the framework provides\n * affordances; targets implement specifics\": the framework names the\n * sentinel; Postgres decides what late-bound means here (the table\n * name, naked — the schema is supplied by the live connection's\n * `search_path`).\n *\n * `ddlSchemaName` is inherited from `PostgresSchema` and returns\n * `UNBOUND_NAMESPACE_ID`. Downstream helpers such as `qualifyTableName`\n * route through the polymorphic factory and produce unqualified output\n * automatically.\n */\nexport class PostgresUnboundSchema extends PostgresSchema {\n static readonly instance: PostgresUnboundSchema = new PostgresUnboundSchema();\n\n constructor(input?: PostgresSchemaInput) {\n super(input ?? { id: UNBOUND_NAMESPACE_ID, entries: { table: {} } });\n }\n\n override qualifier(): string {\n return '';\n }\n\n override qualifyTable(tableName: string): string {\n return `\"${tableName}\"`;\n }\n\n override schemaSqlExpression(): string {\n return 'current_schema()';\n }\n\n override schemaFilterExpression(): CfExpr {\n return cfExpr.raw('current_schema()', { codecId: PG_TEXT_CODEC_ID, nullable: false });\n }\n\n override tableSource(tableName: string, alias?: string): PostgresTableSource {\n return new PostgresTableSource({\n name: tableName,\n ...ifDefined('alias', alias),\n });\n }\n}\n\nPostgresSchema.unbound = PostgresUnboundSchema.instance;\n\n/**\n * Narrow an arbitrary namespace (or `undefined`) to `PostgresSchema`\n * so callers can dispatch to the polymorphic emission methods without\n * branching at the call site. Uses the structural `kind` discriminator\n * (`'schema'`) rather than `instanceof` so the check survives realm /\n * bundle / hot-reload boundaries — matching the rest of the IR's\n * narrowing convention. `PostgresUnboundSchema` passes through because\n * it inherits the same `kind: 'schema'` from `PostgresSchema`.\n */\nexport function isPostgresSchema(ns: unknown): ns is PostgresSchema {\n return (ns as { kind?: unknown } | null | undefined)?.kind === 'schema';\n}\n\n/**\n * Target-supplied `Namespace` factory the Postgres target plumbs\n * through `defineContract({ createNamespace })` and the SQL PSL\n * interpreter. Returns the unbound singleton for the framework\n * sentinel and a fresh `PostgresSchema` for any other coordinate.\n *\n * The factory has no per-call state — every named id deterministically\n * maps to a distinct schema instance — so callers can pass it through\n * by reference and trust the resulting `SqlStorage.namespaces` map to\n * be value-stable for a given input set. Native-enum column type names are\n * schema-qualified earlier, at column construction, via the target's\n * `authoring.qualifyColumnType` hook (`postgresQualifyColumnType`), so this\n * factory just materialises the namespace from already-qualified entries.\n */\nexport function postgresCreateNamespace(input: SqlNamespaceInput): PostgresSchema {\n const schemaInput: PostgresSchemaInput = {\n id: input.id,\n entries: {\n ...input.entries,\n table: input.entries['table'] ?? {},\n },\n };\n if (input.id === UNBOUND_NAMESPACE_ID) {\n return new PostgresUnboundSchema(schemaInput);\n }\n return new PostgresSchema(schemaInput);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,wBAAb,cAA2C,QAAQ;CACjD,OAAyB;CACzB;CACA;CAEA,YAAY,OAAmC;EAC7C,MAAM;EACN,KAAK,YAAY,MAAM;EACvB,KAAK,cAAc,MAAM;EACzB,WAAW,IAAI;CACjB;AACF;;;;;;;;;;;;;;;;ACKA,IAAa,oBAAb,cAAuC,QAAQ;CAC7C,OAAyB;CACzB;CACA;CACA;CACA;CACA;CACA;CAGA;CAEA,YAAY,OAA+B;EACzC,MAAM;EACN,KAAK,OAAO,MAAM;EAClB,KAAK,SAAS,MAAM;EACpB,KAAK,YAAY,MAAM;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AAO,IAAI,UAAU;CACvB;CAEA,sBAAuC;EACrC,OAAO;CACT;CAEA,yBAA0C;EACxC,OAAO,OAAO,IAAI,oBAAoB;GAAE,SAAS;GAAkB,UAAU;EAAM,CAAC;CACtF;CAEA,YAAqB,WAAmB,OAAqC;EAC3E,OAAO,IAAI,oBAAoB;GAC7B,MAAM;GACN,GAAG,UAAU,SAAS,KAAK;EAC7B,CAAC;CACH;AACF;AAEA,eAAe,UAAU,sBAAsB;;;;;;;;;;AAW/C,SAAgB,iBAAiB,IAAmC;CAClE,OAAQ,IAA8C,SAAS;AACjE;;;;;;;;;;;;;;;AAgBA,SAAgB,wBAAwB,OAA0C;CAChF,MAAM,cAAmC;EACvC,IAAI,MAAM;EACV,SAAS;GACP,GAAG,MAAM;GACT,OAAO,MAAM,QAAQ,YAAY,CAAC;EACpC;CACF;CACA,IAAI,MAAM,OAAO,sBACf,OAAO,IAAI,sBAAsB,WAAW;CAE9C,OAAO,IAAI,eAAe,WAAW;AACvC"}
|
|
1
|
+
{"version":3,"file":"postgres-schema-CewLYHB7.mjs","names":[],"sources":["../src/core/postgres-rls-enablement.ts","../src/core/postgres-rls-policy.ts","../src/core/postgres-role.ts","../src/core/postgres-validators.ts","../src/core/ast/table-source.ts","../src/core/entity-kinds.ts","../src/core/postgres-schema.ts"],"sourcesContent":["import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from '@prisma-next/sql-contract/types';\n\nexport interface PostgresRlsEnablementInput {\n /** Name of the table this marker declares RLS-controlled. */\n readonly tableName: string;\n /** Namespace coordinate (schema name). Markers are schema-scoped like policies. */\n readonly namespaceId: string;\n}\n\n/**\n * Postgres contract-IR marker for `@@rls` on a model: the table named here is\n * RLS-controlled (`ENABLE ROW LEVEL SECURITY` is driven by this marker, never\n * by the policy set).\n *\n * This is an authored, serialized Contract-IR entity — it is registered as an\n * entity kind, extends `SqlNode`, and is stored in `contract.json` under\n * `entries.rls[tableName]`. Target-only concept — no SQL-family abstract.\n * Frozen at construction via `freezeNode(this)`. The `kind: 'rls'`\n * discriminant is enumerable so it survives JSON serialization; the literal\n * matches the entries key (one-string rule).\n */\nexport class PostgresRlsEnablement extends SqlNode {\n override readonly kind = 'rls' as const;\n readonly tableName: string;\n readonly namespaceId: string;\n\n constructor(input: PostgresRlsEnablementInput) {\n super();\n this.tableName = input.tableName;\n this.namespaceId = input.namespaceId;\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from '@prisma-next/sql-contract/types';\n\nexport type RlsPolicyOperation = 'select' | 'insert' | 'update' | 'delete' | 'all';\n\nexport interface PostgresRlsPolicyInput {\n /** Full wire name: `<prefix>_<8hex>`. Stored as-is; hashing is not this class's job. */\n readonly name: string;\n /** User-supplied prefix (the part before the `_<8hex>` suffix). */\n readonly prefix: string;\n /** Name of the table this policy attaches to, by name within the same schema. */\n readonly tableName: string;\n /** Namespace coordinate (schema name). Policies are schema-scoped. */\n readonly namespaceId: string;\n readonly operation: RlsPolicyOperation;\n /** Sorted role names rendered in `TO <roles>`. Plain strings in this slice. */\n readonly roles: readonly string[];\n /** USING predicate SQL string, if present. */\n readonly using?: string;\n /** WITH CHECK predicate SQL string, if present. */\n readonly withCheck?: string;\n /** `true` = `AS PERMISSIVE`, `false` = `AS RESTRICTIVE`. */\n readonly permissive: boolean;\n}\n\n/**\n * Postgres contract-IR class for a row-level security policy (`CREATE POLICY … ON …`).\n *\n * This is an authored, serialized Contract-IR entity — it is registered as an entity\n * kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;\n * the schema-diff tree uses `PostgresPolicySchemaNode` for that role.\n *\n * Target-only concept — no SQL-family abstract. Extends `SqlNode` directly.\n * Frozen at construction via `freezeNode(this)`. The `kind: 'policy'`\n * discriminant is enumerable (overrides SqlNode's non-enumerable `'sql'`) so it\n * survives JSON serialization and enables dispatch. The literal matches the\n * entries key (one-string rule: node.kind === entries key === entity kind).\n */\nexport class PostgresRlsPolicy extends SqlNode {\n override readonly kind = 'policy' as const;\n readonly name: string;\n readonly prefix: string;\n readonly tableName: string;\n readonly namespaceId: string;\n readonly operation: RlsPolicyOperation;\n readonly roles: readonly string[];\n declare readonly using?: string;\n declare readonly withCheck?: string;\n readonly permissive: boolean;\n\n constructor(input: PostgresRlsPolicyInput) {\n super();\n this.name = input.name;\n this.prefix = input.prefix;\n this.tableName = input.tableName;\n this.namespaceId = input.namespaceId;\n this.operation = input.operation;\n this.roles = Object.freeze([...input.roles]);\n if (input.using !== undefined) this.using = input.using;\n if (input.withCheck !== undefined) this.withCheck = input.withCheck;\n this.permissive = input.permissive;\n freezeNode(this);\n }\n}\n","import { freezeNode } from '@prisma-next/framework-components/ir';\nimport { SqlNode } from '@prisma-next/sql-contract/types';\n\n/**\n * Roles are referenced by the contract but never owned — the framework\n * issues no `CREATE`/`DROP ROLE`, so a role's effective governance is always\n * `external`: a missing declared role fails verify, an extra live role is\n * tolerated, and the planner emits zero role DDL. `external` is the only\n * value a role's control can ever carry.\n */\nexport const ROLE_DEFAULT_CONTROL_POLICY = 'external';\n\nexport interface PostgresRoleInput {\n readonly name: string;\n /**\n * Namespace coordinate. Roles are cluster-scoped; pass `UNBOUND_NAMESPACE_ID`\n * from `@prisma-next/framework-components/ir`.\n */\n readonly namespaceId: string;\n /**\n * Defaults to {@link ROLE_DEFAULT_CONTROL_POLICY} when omitted. Roles are\n * referenced but never owned, so `'external'` is the only allowed value.\n */\n readonly control?: 'external';\n}\n\n/**\n * Postgres contract-IR class for a database role (`CREATE ROLE …`).\n *\n * This is an authored, serialized Contract-IR entity — it is registered as an entity\n * kind, extends `SqlNode`, and is stored in `contract.json`. It is NOT a DiffableNode;\n * the schema-diff tree uses `PostgresRoleSchemaNode` for that role.\n *\n * Roles are cluster-scoped, so their namespace coordinate is always\n * `UNBOUND_NAMESPACE_ID`. Target-only concept — no SQL-family abstract.\n * Extends `SqlNode` directly, frozen at construction via `freezeNode(this)`.\n * The `kind: 'role'` discriminant is enumerable so it survives JSON.\n * Matches the entries key (one-string rule).\n *\n * `control` always carries a value (never omitted): it defaults to\n * {@link ROLE_DEFAULT_CONTROL_POLICY} in the constructor, so both a\n * freshly-authored role and one hydrated from an older `contract.json`\n * lacking the field resolve the same way — the control-policy resolver\n * reads it directly off the entity instead of special-casing role issues.\n */\nexport class PostgresRole extends SqlNode {\n override readonly kind = 'role' as const;\n readonly name: string;\n readonly namespaceId: string;\n readonly control: 'external';\n\n constructor(input: PostgresRoleInput) {\n super();\n this.name = input.name;\n this.namespaceId = input.namespaceId;\n this.control = input.control ?? ROLE_DEFAULT_CONTROL_POLICY;\n freezeNode(this);\n }\n}\n","import { type } from 'arktype';\n\nexport const PostgresRoleSchema = type({\n kind: \"'role'\",\n name: 'string',\n namespaceId: 'string',\n 'control?': \"'external'\",\n});\n\nexport const PostgresRlsPolicySchema = type({\n kind: \"'policy'\",\n name: 'string',\n prefix: 'string',\n tableName: 'string',\n namespaceId: 'string',\n operation: \"'select' | 'insert' | 'update' | 'delete' | 'all'\",\n roles: type.string.array().readonly(),\n 'using?': 'string',\n 'withCheck?': 'string',\n permissive: 'boolean',\n});\n\nexport const PostgresRlsEnablementSchema = type({\n kind: \"'rls'\",\n tableName: 'string',\n namespaceId: 'string',\n});\n\nexport const PostgresNativeEnumSchema = type({\n kind: \"'postgres-enum'\",\n typeName: 'string',\n members: type.string.array().readonly(),\n 'control?': \"'managed' | 'tolerated' | 'external' | 'observed'\",\n});\n","import {\n type AnyFromSource,\n type AstRewriter,\n TableSource,\n} from '@prisma-next/sql-relational-core/ast';\n\nexport class PostgresTableSource extends TableSource {\n readonly schema: string | undefined;\n\n constructor(options: {\n readonly name: string;\n readonly schema?: string;\n readonly alias?: string;\n }) {\n super(options.name, options.alias);\n this.schema = options.schema;\n this.freeze();\n }\n\n override rewrite(rewriter: AstRewriter): AnyFromSource {\n return rewriter.tableSource ? rewriter.tableSource(this) : this;\n }\n}\n","import type { EntityKindDescriptor } from '@prisma-next/framework-components/ir';\nimport { PostgresNativeEnum, type PostgresNativeEnumInput } from './postgres-native-enum';\nimport { PostgresRlsEnablement, type PostgresRlsEnablementInput } from './postgres-rls-enablement';\nimport { PostgresRlsPolicy, type PostgresRlsPolicyInput } from './postgres-rls-policy';\nimport { PostgresRole, type PostgresRoleInput } from './postgres-role';\nimport {\n PostgresNativeEnumSchema,\n PostgresRlsEnablementSchema,\n PostgresRlsPolicySchema,\n PostgresRoleSchema,\n} from './postgres-validators';\n\nexport const policyEntityKind: EntityKindDescriptor<PostgresRlsPolicyInput, PostgresRlsPolicy> = {\n kind: 'policy',\n schema: PostgresRlsPolicySchema,\n construct: (input) => new PostgresRlsPolicy(input),\n};\n\nexport const roleEntityKind: EntityKindDescriptor<PostgresRoleInput, PostgresRole> = {\n kind: 'role',\n schema: PostgresRoleSchema,\n construct: (input) => new PostgresRole(input),\n};\n\nexport const rlsEnablementEntityKind: EntityKindDescriptor<\n PostgresRlsEnablementInput,\n PostgresRlsEnablement\n> = {\n kind: 'rls',\n schema: PostgresRlsEnablementSchema,\n construct: (input) => new PostgresRlsEnablement(input),\n};\n\nexport const nativeEnumEntityKind: EntityKindDescriptor<\n PostgresNativeEnumInput,\n PostgresNativeEnum\n> = {\n kind: 'native_enum',\n schema: PostgresNativeEnumSchema,\n construct: (input) => new PostgresNativeEnum(input),\n};\n","import type { Contract } from '@prisma-next/contract/types';\nimport {\n freezeNode,\n hydrateNamespaceEntities,\n UNBOUND_NAMESPACE_ID,\n} from '@prisma-next/framework-components/ir';\nimport { composeSqlEntityKinds } from '@prisma-next/sql-contract/entity-kinds';\nimport {\n SqlNamespaceBase,\n type SqlNamespaceEntries,\n type SqlNamespaceInput,\n type SqlStorage,\n type StorageTable,\n type StorageValueSet,\n} from '@prisma-next/sql-contract/types';\n\nimport { type CfExpr, cfExpr } from '@prisma-next/sql-relational-core/contract-free';\nimport { invariant } from '@prisma-next/utils/assertions';\nimport { blindCast } from '@prisma-next/utils/casts';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { PostgresTableSource } from './ast/table-source';\nimport { PG_TEXT_CODEC_ID } from './codec-ids';\nimport {\n nativeEnumEntityKind,\n policyEntityKind,\n rlsEnablementEntityKind,\n roleEntityKind,\n} from './entity-kinds';\nimport { PostgresNativeEnum } from './postgres-native-enum';\nimport type { PostgresRlsEnablement } from './postgres-rls-enablement';\nimport type { PostgresRlsPolicy } from './postgres-rls-policy';\nimport type { PostgresRole } from './postgres-role';\nimport { escapeLiteral } from './sql-utils';\n\nexport type PostgresContract = Contract<SqlStorage> & { readonly target: 'postgres' };\n\nexport type PostgresNamespaceEntries = SqlNamespaceEntries & {\n readonly policy?: Readonly<Record<string, PostgresRlsPolicy>>;\n readonly role?: Readonly<Record<string, PostgresRole>>;\n readonly rls?: Readonly<Record<string, PostgresRlsEnablement>>;\n readonly native_enum?: Readonly<Record<string, PostgresNativeEnum>>;\n};\n\nexport interface PostgresSchemaInput {\n readonly id: string;\n readonly entries: Readonly<Record<string, Readonly<Record<string, unknown>>>>;\n}\n\n/**\n * Postgres target `Namespace` concretion — a Postgres schema (`CREATE\n * SCHEMA …`). Each Postgres `SqlStorage` carries a\n * `namespaces: Record<NamespaceId, PostgresSchema>` map populated by\n * the Postgres PSL interpreter from `namespace { … }` AST buckets.\n *\n * `entries` holds entity-kind maps (`table`, `valueSet`). Qualifier\n * emission is the rendering seam: DDL / SQL emission asks the namespace\n * for its qualifier (`\"<schema>\"`) or for a qualified table name\n * (`\"<schema>\".\"<table>\"`) and consumes the result polymorphically.\n * The unbound singleton below overrides these methods to elide the\n * prefix entirely — call sites stay polymorphic and never branch on\n * `id === UNBOUND_NAMESPACE_ID`.\n */\nexport class PostgresSchema extends SqlNamespaceBase {\n /**\n * Stable singleton reference for the late-bound slot. Materialised\n * lazily below the singleton subclass declaration so the static\n * initialiser sees the subclass before assigning. Consumers always\n * reach for `PostgresSchema.unbound` (or `PostgresUnboundSchema.instance`\n * — same identity).\n */\n static unbound: PostgresUnboundSchema;\n\n declare readonly kind: 'schema';\n readonly id: string;\n readonly entries: PostgresNamespaceEntries;\n\n constructor(input: PostgresSchemaInput) {\n super();\n this.id = input.id;\n\n const dispatched = hydrateNamespaceEntities(\n input.entries,\n composeSqlEntityKinds([\n policyEntityKind,\n roleEntityKind,\n rlsEnablementEntityKind,\n nativeEnumEntityKind,\n ]),\n 'carry',\n );\n\n // A native enum keys under its PHYSICAL type name in storage `entries`\n // (ADR 221 coordinate `entityName`). The family/authoring layer keys every\n // block by its author handle, so re-key the `native_enum` slot by each\n // entity's `typeName` here — target-local Postgres code that already knows\n // this entity kind. This runs at both authoring and hydration; a serialized\n // contract's key already equals the `typeName`, so the re-key is idempotent.\n const nativeEnumSlot = dispatched['native_enum'];\n if (nativeEnumSlot !== undefined) {\n const rekeyed: Record<string, unknown> = {};\n for (const [handle, entity] of Object.entries(nativeEnumSlot)) {\n const physicalName = PostgresNativeEnum.is(entity) ? entity.typeName : handle;\n invariant(\n !Object.hasOwn(rekeyed, physicalName),\n `PostgresSchema \"${input.id}\": two native_enum entities resolve to the same physical type name \"${physicalName}\". Give them distinct @@map type names.`,\n );\n rekeyed[physicalName] = entity;\n }\n dispatched['native_enum'] = Object.freeze(rekeyed);\n }\n\n // Drop an empty valueSet so presence signals non-emptiness.\n const valueSetRaw = dispatched['valueSet'];\n const withPresence =\n valueSetRaw !== undefined && Object.keys(valueSetRaw).length === 0\n ? { ...dispatched, valueSet: undefined }\n : dispatched;\n\n const entriesInput: Record<string, Readonly<Record<string, unknown>> | undefined> = {\n ...withPresence,\n };\n\n this.entries = Object.freeze(\n blindCast<\n PostgresNamespaceEntries,\n 'composeSqlEntityKinds([policyEntityKind, roleEntityKind, rlsEnablementEntityKind, nativeEnumEntityKind]) supplies table→StorageTable, valueSet→StorageValueSet, policy→PostgresRlsPolicy, role→PostgresRole, rls→PostgresRlsEnablement, native_enum→PostgresNativeEnum descriptors'\n >(entriesInput),\n );\n Object.defineProperty(this, 'kind', {\n value: 'schema',\n writable: false,\n enumerable: false,\n configurable: true,\n });\n freezeNode(this);\n }\n\n get table(): Readonly<Record<string, StorageTable>> {\n return this.entries.table ?? Object.freeze({});\n }\n\n get valueSet(): Readonly<Record<string, StorageValueSet>> | undefined {\n return this.entries.valueSet;\n }\n\n get policy(): Readonly<Record<string, PostgresRlsPolicy>> {\n return this.entries.policy ?? Object.freeze({});\n }\n\n get role(): Readonly<Record<string, PostgresRole>> {\n return this.entries.role ?? Object.freeze({});\n }\n\n get rls(): Readonly<Record<string, PostgresRlsEnablement>> {\n return this.entries.rls ?? Object.freeze({});\n }\n\n /**\n * The bare schema qualifier as it would appear in a rendered SQL\n * fragment (already quoted). The unbound-schema singleton overrides\n * this to return `''`.\n */\n qualifier(): string {\n return `\"${this.id}\"`;\n }\n\n /**\n * Qualify a table name with the schema prefix\n * (`\"<schema>\".\"<table>\"`). The unbound-schema singleton overrides\n * this to emit just `\"<table>\"` so the resolved DDL is unqualified\n * and `search_path` decides where the object lands at runtime.\n */\n qualifyTable(tableName: string): string {\n return `\"${this.id}\".\"${tableName}\"`;\n }\n\n /**\n * Render a SQL string-literal containing the qualified-name form\n * suitable for `to_regclass(...)` arguments (e.g. `'\"public\".\"user\"'`).\n * The unbound singleton overrides this to elide the schema prefix\n * (`'\"user\"'`) so `search_path` resolves the object at runtime.\n */\n regclassLiteral(name: string): string {\n return `'${escapeLiteral(this.qualifyTable(name))}'`;\n }\n\n /**\n * Render a SQL expression that evaluates to this namespace's schema\n * name at runtime, ready to drop into a `WHERE table_schema = …` /\n * `WHERE n.nspname = …` clause. Named schemas emit a quoted SQL\n * literal (`'public'`); the unbound singleton overrides this to emit\n * `current_schema()` so catalog queries match whichever schema the\n * connection's `search_path` resolved at runtime.\n */\n schemaSqlExpression(): string {\n return `'${escapeLiteral(this.id)}'`;\n }\n\n /**\n * Typed-AST counterpart of {@link schemaSqlExpression}: the expression a\n * builder-built catalog check compares `n.nspname` / `table_schema`\n * against. Named schemas bind the schema name as a text parameter; the\n * unbound singleton overrides this to the opaque `current_schema()`\n * expression so the live connection's `search_path` decides at runtime.\n */\n schemaFilterExpression(): CfExpr {\n return cfExpr.param(this.id, PG_TEXT_CODEC_ID);\n }\n\n /**\n * Typed-AST counterpart of {@link qualifyTable}: the FROM source a\n * builder-built check uses to address a user table in this namespace.\n * Named schemas qualify (`\"schema\".\"table\"`); the unbound singleton\n * overrides this to leave the table unqualified so `search_path`\n * resolves it at runtime.\n */\n tableSource(tableName: string, alias?: string): PostgresTableSource {\n return new PostgresTableSource({\n name: tableName,\n schema: this.id,\n ...ifDefined('alias', alias),\n });\n }\n\n /**\n * The bare schema name a DDL planner should target when emitting\n * statements that need to identify this namespace in the live\n * database (e.g. `CREATE TABLE \"<ddlSchemaName>\".\"<table>\" …`,\n * catalog filters, planner conflict lookups). Named schemas resolve\n * to their own id. The `PostgresUnboundSchema` singleton inherits\n * this and returns `UNBOUND_NAMESPACE_ID` — callers that dispatch\n * through `qualifyTableName` route through the polymorphic\n * `PostgresUnboundSchema` overrides and produce unqualified\n * (search-path-resolved) output automatically.\n */\n ddlSchemaName(_storage: SqlStorage): string {\n return this.id;\n }\n}\n\n/**\n * Singleton subclass for the reserved sentinel namespace id\n * (`UNBOUND_NAMESPACE_ID`) — the late-bound Postgres slot whose binding\n * the connection's `search_path` resolves at runtime. Overrides\n * qualifier emission to elide the schema prefix; call sites that consume\n * `qualifier()` / `qualifyTable()` get unqualified output without\n * branching on the namespace id.\n *\n * This is the target-side materialization of \"the framework provides\n * affordances; targets implement specifics\": the framework names the\n * sentinel; Postgres decides what late-bound means here (the table\n * name, naked — the schema is supplied by the live connection's\n * `search_path`).\n *\n * `ddlSchemaName` is inherited from `PostgresSchema` and returns\n * `UNBOUND_NAMESPACE_ID`. Downstream helpers such as `qualifyTableName`\n * route through the polymorphic factory and produce unqualified output\n * automatically.\n */\nexport class PostgresUnboundSchema extends PostgresSchema {\n static readonly instance: PostgresUnboundSchema = new PostgresUnboundSchema();\n\n constructor(input?: PostgresSchemaInput) {\n super(input ?? { id: UNBOUND_NAMESPACE_ID, entries: { table: {} } });\n }\n\n override qualifier(): string {\n return '';\n }\n\n override qualifyTable(tableName: string): string {\n return `\"${tableName}\"`;\n }\n\n override schemaSqlExpression(): string {\n return 'current_schema()';\n }\n\n override schemaFilterExpression(): CfExpr {\n return cfExpr.raw('current_schema()', { codecId: PG_TEXT_CODEC_ID, nullable: false });\n }\n\n override tableSource(tableName: string, alias?: string): PostgresTableSource {\n return new PostgresTableSource({\n name: tableName,\n ...ifDefined('alias', alias),\n });\n }\n}\n\nPostgresSchema.unbound = PostgresUnboundSchema.instance;\n\n/**\n * Narrow an arbitrary namespace (or `undefined`) to `PostgresSchema`\n * so callers can dispatch to the polymorphic emission methods without\n * branching at the call site. Uses the structural `kind` discriminator\n * (`'schema'`) rather than `instanceof` so the check survives realm /\n * bundle / hot-reload boundaries — matching the rest of the IR's\n * narrowing convention. `PostgresUnboundSchema` passes through because\n * it inherits the same `kind: 'schema'` from `PostgresSchema`.\n */\nexport function isPostgresSchema(ns: unknown): ns is PostgresSchema {\n return (ns as { kind?: unknown } | null | undefined)?.kind === 'schema';\n}\n\n/**\n * Target-supplied `Namespace` factory the Postgres target plumbs\n * through `defineContract({ createNamespace })` and the SQL PSL\n * interpreter. Returns the unbound singleton for the framework\n * sentinel and a fresh `PostgresSchema` for any other coordinate.\n *\n * The factory has no per-call state — every named id deterministically\n * maps to a distinct schema instance — so callers can pass it through\n * by reference and trust the resulting `SqlStorage.namespaces` map to\n * be value-stable for a given input set. Native-enum column type names are\n * schema-qualified earlier, at column construction, via the target's\n * `authoring.qualifyColumnType` hook (`postgresQualifyColumnType`), so this\n * factory just materialises the namespace from already-qualified entries.\n */\nexport function postgresCreateNamespace(input: SqlNamespaceInput): PostgresSchema {\n const schemaInput: PostgresSchemaInput = {\n id: input.id,\n entries: {\n ...input.entries,\n table: input.entries['table'] ?? {},\n },\n };\n if (input.id === UNBOUND_NAMESPACE_ID) {\n return new PostgresUnboundSchema(schemaInput);\n }\n return new PostgresSchema(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AAO,IAAI,oBAAoB;GAC7B,MAAM;GACN,QAAQ,KAAK;GACb,GAAG,UAAU,SAAS,KAAK;EAC7B,CAAC;CACH;;;;;;;;;;;;CAaA,cAAc,UAA8B;EAC1C,OAAO,KAAK;CACd;AACF;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,wBAAb,MAAa,8BAA8B,eAAe;CACxD,OAAgB,WAAkC,IAAI,sBAAsB;CAE5E,YAAY,OAA6B;EACvC,MAAM,SAAS;GAAE,IAAI;GAAsB,SAAS,EAAE,OAAO,CAAC,EAAE;EAAE,CAAC;CACrE;CAEA,YAA6B;EAC3B,OAAO;CACT;CAEA,aAAsB,WAA2B;EAC/C,OAAO,IAAI,UAAU;CACvB;CAEA,sBAAuC;EACrC,OAAO;CACT;CAEA,yBAA0C;EACxC,OAAO,OAAO,IAAI,oBAAoB;GAAE,SAAS;GAAkB,UAAU;EAAM,CAAC;CACtF;CAEA,YAAqB,WAAmB,OAAqC;EAC3E,OAAO,IAAI,oBAAoB;GAC7B,MAAM;GACN,GAAG,UAAU,SAAS,KAAK;EAC7B,CAAC;CACH;AACF;AAEA,eAAe,UAAU,sBAAsB;;;;;;;;;;AAW/C,SAAgB,iBAAiB,IAAmC;CAClE,OAAQ,IAA8C,SAAS;AACjE;;;;;;;;;;;;;;;AAgBA,SAAgB,wBAAwB,OAA0C;CAChF,MAAM,cAAmC;EACvC,IAAI,MAAM;EACV,SAAS;GACP,GAAG,MAAM;GACT,OAAO,MAAM,QAAQ,YAAY,CAAC;EACpC;CACF;CACA,IAAI,MAAM,OAAO,sBACf,OAAO,IAAI,sBAAsB,WAAW;CAE9C,OAAO,IAAI,eAAe,WAAW;AACvC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { t as PostgresTableSource } from "./table-source-
|
|
2
|
-
import { t as PostgresRlsPolicy } from "./postgres-rls-policy
|
|
1
|
+
import { t as PostgresTableSource } from "./table-source-D5c2fxAQ.mjs";
|
|
2
|
+
import { t as PostgresRlsPolicy } from "./postgres-rls-policy-CYXdqG9B.mjs";
|
|
3
3
|
import { SqlNamespaceBase, SqlNamespaceEntries, SqlNamespaceInput, SqlNode, SqlStorage, StorageTable, StorageValueSet } from "@prisma-next/sql-contract/types";
|
|
4
4
|
import { CfExpr } from "@prisma-next/sql-relational-core/contract-free";
|
|
5
5
|
import { Contract, ControlPolicy } from "@prisma-next/contract/types";
|
|
6
|
-
|
|
7
6
|
//#region src/core/postgres-native-enum.d.ts
|
|
8
7
|
interface PostgresNativeEnumInput<Members extends readonly string[] = readonly string[]> {
|
|
9
8
|
/** The Postgres type name (`CREATE TYPE <typeName> AS ENUM (…)`). */
|
|
@@ -266,4 +265,4 @@ declare function isPostgresSchema(ns: unknown): ns is PostgresSchema;
|
|
|
266
265
|
declare function postgresCreateNamespace(input: SqlNamespaceInput): PostgresSchema;
|
|
267
266
|
//#endregion
|
|
268
267
|
export { postgresCreateNamespace as a, PostgresRlsEnablement as c, PostgresNativeEnumInput as d, isPostgresSchema as i, PostgresRlsEnablementInput as l, PostgresSchema as n, PostgresRole as o, PostgresUnboundSchema as r, PostgresRoleInput as s, PostgresContract as t, PostgresNativeEnum as u };
|
|
269
|
-
//# sourceMappingURL=postgres-schema-
|
|
268
|
+
//# sourceMappingURL=postgres-schema-FdKRwe7X.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-schema-FdKRwe7X.d.mts","names":[],"sources":["../src/core/postgres-native-enum.ts","../src/core/postgres-rls-enablement.ts","../src/core/postgres-role.ts","../src/core/postgres-schema.ts"],"mappings":";;;;;;UAKiB,wBAAwB;;WAE9B;;WAEA,SAAS;WACT,UAAU;;;;;;;;;;;;;;;;;;;;;cA6BR,mBACX,+DACQ;SACD,GAAG,gBAAgB,QAAQ;WAMhB;WACT;WACA,SAAS;WACD,UAAU;cAEf,OAAO,wBAAwB;;;;UClD5B;;WAEN;;WAEA;;;;;;;;;;;;;;cAeE,8BAA8B;WACvB;WACT;WACA;cAEG,OAAO;;;;UCfJ;WACN;;;;;WAKA;;;;;WAKA;;;;;;;;;;;;;;;;;;;;;cAsBE,qBAAqB;WACd;WACT;WACA;WACA;cAEG,OAAO;;;;KCjBT,mBAAmB,SAAS;WAAyB;;KAErD,2BAA2B;WAC5B,SAAS,SAAS,eAAe;WACjC,OAAO,SAAS,eAAe;WAC/B,MAAM,SAAS,eAAe;WAC9B,cAAc,SAAS,eAAe;;UAGhC;WACN;WACA,SAAS,SAAS,eAAe,SAAS;;;;;;;;;;;;;;;;cAiBxC,uBAAuB;;;;;;;;SAQ3B,SAAS;WAEC;WACR;WACA,SAAS;cAEN,OAAO;MA6Df,SAAS,SAAS,eAAe;MAIjC,YAAY,SAAS,eAAe;MAIpC,UAAU,SAAS,eAAe;MAIlC,QAAQ,SAAS,eAAe;MAIhC,OAAO,SAAS,eAAe;;;;;;EASnC;;;;;;;EAUA,aAAa;;;;;;;EAUb,gBAAgB;;;;;;;;;EAYhB;;;;;;;;EAWA,0BAA0B;;;;;;;;EAW1B,YAAY,mBAAmB,iBAAiB;;;;;;;;;;;;EAmBhD,cAAc,UAAU;;;;;;;;;;;;;;;;;;;;;cAwBb,8BAA8B;kBACzB,UAAU;cAEd,QAAQ;EAIX;EAIA,aAAa;EAIb;EAIA,0BAA0B;EAI1B,YAAY,mBAAmB,iBAAiB;;;;;;;;;;;iBAmB3C,iBAAiB,cAAc,MAAM;;;;;;;;;;;;;;;iBAkBrC,wBAAwB,OAAO,oBAAoB"}
|
package/dist/render-ops.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { t as PostgresPlanTargetDetails } from "./planner-target-details-HkP4RrR
|
|
|
2
2
|
import { SqlMigrationPlanOperation } from "@prisma-next/family-sql/control";
|
|
3
3
|
import { OpFactoryCall } from "@prisma-next/framework-components/control";
|
|
4
4
|
import { ExecuteRequestLowerer } from "@prisma-next/family-sql/control-adapter";
|
|
5
|
-
|
|
6
5
|
//#region src/core/migrations/render-ops.d.ts
|
|
7
6
|
type Op = SqlMigrationPlanOperation<PostgresPlanTargetDetails>;
|
|
8
7
|
declare function renderOps(calls: readonly OpFactoryCall[], lowerer?: ExecuteRequestLowerer): (Op | Promise<Op>)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-ops.d.mts","names":[],"sources":["../src/core/migrations/render-ops.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-ops.d.mts","names":[],"sources":["../src/core/migrations/render-ops.ts"],"mappings":";;;;;KAUK,KAAK,0BAA0B;iBAqBpB,UACd,gBAAgB,iBAChB,UAAU,yBACR,KAAK,QAAQ"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { contractSnapshotJsonSpecifier, contractSnapshotTypesSpecifier } from "@prisma-next/framework-components/control";
|
|
1
2
|
import { renderImports } from "@prisma-next/ts-render";
|
|
2
3
|
import { detectScaffoldRuntime, shebangLineFor } from "@prisma-next/migration-tools/migration-ts";
|
|
3
4
|
//#region src/core/migrations/render-typescript.ts
|
|
4
5
|
/**
|
|
6
|
+
* Polymorphic TypeScript emitter for the Postgres migration IR.
|
|
7
|
+
*
|
|
8
|
+
* Each `OpFactoryCall` renders itself via `renderTypeScript()` and
|
|
9
|
+
* declares its own `importRequirements()`; this file just composes the module
|
|
10
|
+
* source around those contributions. The design mirrors the Mongo target's
|
|
11
|
+
* `render-typescript.ts` deliberately — byte-for-byte alignment isn't required
|
|
12
|
+
* (different factory module specifiers, different base-class name) but the
|
|
13
|
+
* shape is, so future consolidation to a framework-level helper is mechanical.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
5
16
|
* Always-present base imports for the rendered scaffold. Both come from
|
|
6
17
|
* `@prisma-next/postgres/migration` so an authored Postgres
|
|
7
18
|
* `migration.ts` only needs a single dependency for its base class and
|
|
@@ -60,33 +71,34 @@ function buildImports(calls, meta) {
|
|
|
60
71
|
}
|
|
61
72
|
/**
|
|
62
73
|
* The committed contract-JSON imports the scaffold reads its from/to identity
|
|
63
|
-
* from
|
|
64
|
-
*
|
|
65
|
-
*
|
|
74
|
+
* from, resolved to the deduplicated snapshot store under
|
|
75
|
+
* `meta.snapshotsImportPath`. The end snapshot is always present; the start
|
|
76
|
+
* snapshot is added only for a non-baseline migration (`meta.from !== null`).
|
|
77
|
+
* The matching `Contract` type imports (aliased `Start`/`End`) feed the
|
|
66
78
|
* `Migration<Start, End>` generics. Baseline emits `Migration<never, End>` with
|
|
67
79
|
* no start imports — `never` is the honest "no prior contract" Start.
|
|
68
80
|
*/
|
|
69
81
|
function contractImports(meta) {
|
|
70
82
|
const reqs = [{
|
|
71
|
-
moduleSpecifier:
|
|
83
|
+
moduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),
|
|
72
84
|
symbol: "endContract",
|
|
73
85
|
kind: "default",
|
|
74
86
|
attributes: { type: "json" }
|
|
75
87
|
}, {
|
|
76
|
-
moduleSpecifier:
|
|
88
|
+
moduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),
|
|
77
89
|
symbol: "Contract",
|
|
78
90
|
alias: "End",
|
|
79
91
|
typeOnly: true
|
|
80
92
|
}];
|
|
81
93
|
if (meta.from !== null) {
|
|
82
94
|
reqs.push({
|
|
83
|
-
moduleSpecifier:
|
|
95
|
+
moduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),
|
|
84
96
|
symbol: "startContract",
|
|
85
97
|
kind: "default",
|
|
86
98
|
attributes: { type: "json" }
|
|
87
99
|
});
|
|
88
100
|
reqs.push({
|
|
89
|
-
moduleSpecifier:
|
|
101
|
+
moduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),
|
|
90
102
|
symbol: "Contract",
|
|
91
103
|
alias: "Start",
|
|
92
104
|
typeOnly: true
|
|
@@ -101,4 +113,4 @@ function indent(text, spaces) {
|
|
|
101
113
|
//#endregion
|
|
102
114
|
export { renderCallsToTypeScript as t };
|
|
103
115
|
|
|
104
|
-
//# sourceMappingURL=render-typescript-
|
|
116
|
+
//# sourceMappingURL=render-typescript-Ta7_6CGf.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-typescript-Ta7_6CGf.mjs","names":[],"sources":["../src/core/migrations/render-typescript.ts"],"sourcesContent":["/**\n * Polymorphic TypeScript emitter for the Postgres migration IR.\n *\n * Each `OpFactoryCall` renders itself via `renderTypeScript()` and\n * declares its own `importRequirements()`; this file just composes the module\n * source around those contributions. The design mirrors the Mongo target's\n * `render-typescript.ts` deliberately — byte-for-byte alignment isn't required\n * (different factory module specifiers, different base-class name) but the\n * shape is, so future consolidation to a framework-level helper is mechanical.\n */\n\nimport {\n contractSnapshotJsonSpecifier,\n contractSnapshotTypesSpecifier,\n type OpFactoryCall,\n} from '@prisma-next/framework-components/control';\nimport { detectScaffoldRuntime, shebangLineFor } from '@prisma-next/migration-tools/migration-ts';\nimport { type ImportRequirement, renderImports } from '@prisma-next/ts-render';\n\nexport interface RenderMigrationMeta {\n readonly from: string | null;\n readonly to: string;\n /** POSIX-relative path from the migration package dir to `migrations/snapshots`, e.g. '../../snapshots'. */\n readonly snapshotsImportPath: string;\n}\n\n/**\n * Always-present base imports for the rendered scaffold. Both come from\n * `@prisma-next/postgres/migration` so an authored Postgres\n * `migration.ts` only needs a single dependency for its base class and\n * its CLI entrypoint:\n *\n * - `Migration` — the facade re-export fixes the `SqlMigration`\n * generic to `PostgresPlanTargetDetails` and the abstract `targetId`\n * to `'postgres'`, so user-authored migrations don't need to thread\n * target-details or redeclare `targetId`.\n * - `MigrationCLI` — the migration-file CLI entrypoint, re-exported from\n * `@prisma-next/cli/migration-cli`. Loads `prisma-next.config.ts`,\n * assembles a `ControlStack`, and instantiates the migration class.\n * The migration file owns this dependency directly: pulling CLI\n * machinery in at script run time is acceptable because the script's\n * whole purpose is to be invoked from the project that owns the\n * config.\n */\nconst BASE_IMPORTS: readonly ImportRequirement[] = [\n { moduleSpecifier: '@prisma-next/postgres/migration', symbol: 'Migration' },\n { moduleSpecifier: '@prisma-next/postgres/migration', symbol: 'MigrationCLI' },\n];\n\nexport function renderCallsToTypeScript(\n calls: ReadonlyArray<OpFactoryCall>,\n meta: RenderMigrationMeta,\n): string {\n const imports = buildImports(calls, meta);\n const operationsBody = calls.map((c) => renderCall(c)).join(',\\n');\n const hasStart = meta.from !== null;\n const startField = hasStart ? [' override readonly startContractJson = startContract;'] : [];\n\n return [\n shebangLineFor(detectScaffoldRuntime()),\n imports,\n '',\n `export default class M extends Migration<${hasStart ? 'Start' : 'never'}, End> {`,\n ...startField,\n ' override readonly endContractJson = endContract;',\n '',\n ' override get operations() {',\n ' return [',\n indent(operationsBody, 6),\n ' ];',\n ' }',\n '}',\n '',\n 'MigrationCLI.run(import.meta.url, M);',\n '',\n ].join('\\n');\n}\n\nfunction renderCall(call: OpFactoryCall): string {\n return call.renderTypeScript();\n}\n\nfunction buildImports(calls: ReadonlyArray<OpFactoryCall>, meta: RenderMigrationMeta): string {\n const requirements: ImportRequirement[] = [...BASE_IMPORTS, ...contractImports(meta)];\n for (const call of calls) {\n for (const req of call.importRequirements()) {\n requirements.push(req);\n }\n }\n return renderImports(requirements);\n}\n\n/**\n * The committed contract-JSON imports the scaffold reads its from/to identity\n * from, resolved to the deduplicated snapshot store under\n * `meta.snapshotsImportPath`. The end snapshot is always present; the start\n * snapshot is added only for a non-baseline migration (`meta.from !== null`).\n * The matching `Contract` type imports (aliased `Start`/`End`) feed the\n * `Migration<Start, End>` generics. Baseline emits `Migration<never, End>` with\n * no start imports — `never` is the honest \"no prior contract\" Start.\n */\nfunction contractImports(meta: RenderMigrationMeta): readonly ImportRequirement[] {\n const reqs: ImportRequirement[] = [\n {\n moduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.to),\n symbol: 'endContract',\n kind: 'default',\n attributes: { type: 'json' },\n },\n {\n moduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.to),\n symbol: 'Contract',\n alias: 'End',\n typeOnly: true,\n },\n ];\n if (meta.from !== null) {\n reqs.push({\n moduleSpecifier: contractSnapshotJsonSpecifier(meta.snapshotsImportPath, meta.from),\n symbol: 'startContract',\n kind: 'default',\n attributes: { type: 'json' },\n });\n reqs.push({\n moduleSpecifier: contractSnapshotTypesSpecifier(meta.snapshotsImportPath, meta.from),\n symbol: 'Contract',\n alias: 'Start',\n typeOnly: true,\n });\n }\n return reqs;\n}\n\nfunction indent(text: string, spaces: number): string {\n const pad = ' '.repeat(spaces);\n return text\n .split('\\n')\n .map((line) => (line.trim() ? `${pad}${line}` : line))\n .join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAM,eAA6C,CACjD;CAAE,iBAAiB;CAAmC,QAAQ;AAAY,GAC1E;CAAE,iBAAiB;CAAmC,QAAQ;AAAe,CAC/E;AAEA,SAAgB,wBACd,OACA,MACQ;CACR,MAAM,UAAU,aAAa,OAAO,IAAI;CACxC,MAAM,iBAAiB,MAAM,KAAK,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK;CACjE,MAAM,WAAW,KAAK,SAAS;CAC/B,MAAM,aAAa,WAAW,CAAC,wDAAwD,IAAI,CAAC;CAE5F,OAAO;EACL,eAAe,sBAAsB,CAAC;EACtC;EACA;EACA,4CAA4C,WAAW,UAAU,QAAQ;EACzE,GAAG;EACH;EACA;EACA;EACA;EACA,OAAO,gBAAgB,CAAC;EACxB;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;AACb;AAEA,SAAS,WAAW,MAA6B;CAC/C,OAAO,KAAK,iBAAiB;AAC/B;AAEA,SAAS,aAAa,OAAqC,MAAmC;CAC5F,MAAM,eAAoC,CAAC,GAAG,cAAc,GAAG,gBAAgB,IAAI,CAAC;CACpF,KAAK,MAAM,QAAQ,OACjB,KAAK,MAAM,OAAO,KAAK,mBAAmB,GACxC,aAAa,KAAK,GAAG;CAGzB,OAAO,cAAc,YAAY;AACnC;;;;;;;;;;AAWA,SAAS,gBAAgB,MAAyD;CAChF,MAAM,OAA4B,CAChC;EACE,iBAAiB,8BAA8B,KAAK,qBAAqB,KAAK,EAAE;EAChF,QAAQ;EACR,MAAM;EACN,YAAY,EAAE,MAAM,OAAO;CAC7B,GACA;EACE,iBAAiB,+BAA+B,KAAK,qBAAqB,KAAK,EAAE;EACjF,QAAQ;EACR,OAAO;EACP,UAAU;CACZ,CACF;CACA,IAAI,KAAK,SAAS,MAAM;EACtB,KAAK,KAAK;GACR,iBAAiB,8BAA8B,KAAK,qBAAqB,KAAK,IAAI;GAClF,QAAQ;GACR,MAAM;GACN,YAAY,EAAE,MAAM,OAAO;EAC7B,CAAC;EACD,KAAK,KAAK;GACR,iBAAiB,+BAA+B,KAAK,qBAAqB,KAAK,IAAI;GACnF,QAAQ;GACR,OAAO;GACP,UAAU;EACZ,CAAC;CACH;CACA,OAAO;AACT;AAEA,SAAS,OAAO,MAAc,QAAwB;CACpD,MAAM,MAAM,IAAI,OAAO,MAAM;CAC7B,OAAO,KACJ,MAAM,IAAI,CAAC,CACX,KAAK,SAAU,KAAK,KAAK,IAAI,GAAG,MAAM,SAAS,IAAK,CAAC,CACrD,KAAK,IAAI;AACd"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { OpFactoryCall } from "@prisma-next/framework-components/control";
|
|
2
|
-
|
|
3
2
|
//#region src/core/migrations/render-typescript.d.ts
|
|
4
3
|
interface RenderMigrationMeta {
|
|
5
4
|
readonly from: string | null;
|
|
6
5
|
readonly to: string;
|
|
6
|
+
/** POSIX-relative path from the migration package dir to `migrations/snapshots`, e.g. '../../snapshots'. */
|
|
7
|
+
readonly snapshotsImportPath: string;
|
|
7
8
|
}
|
|
8
9
|
declare function renderCallsToTypeScript(calls: ReadonlyArray<OpFactoryCall>, meta: RenderMigrationMeta): string;
|
|
9
10
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-typescript.d.mts","names":[],"sources":["../src/core/migrations/render-typescript.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-typescript.d.mts","names":[],"sources":["../src/core/migrations/render-typescript.ts"],"mappings":";;UAmBiB;WACN;WACA;;WAEA;;iBA0BK,wBACd,OAAO,cAAc,gBACrB,MAAM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as renderCallsToTypeScript } from "./render-typescript-
|
|
1
|
+
import { t as renderCallsToTypeScript } from "./render-typescript-Ta7_6CGf.mjs";
|
|
2
2
|
export { renderCallsToTypeScript };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as DEFAULT_NAMESPACE_ID } from "./namespace-ids-xtp_ZY86.mjs";
|
|
2
|
-
import { r as isPostgresSchema } from "./postgres-schema-
|
|
2
|
+
import { r as isPostgresSchema } from "./postgres-schema-CewLYHB7.mjs";
|
|
3
3
|
import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
|
|
4
4
|
//#region src/core/migrations/resolve-ddl-schema.ts
|
|
5
5
|
/**
|
|
@@ -19,4 +19,4 @@ function resolveDdlSchemaForNamespaceStorage(storage, namespaceId) {
|
|
|
19
19
|
//#endregion
|
|
20
20
|
export { resolveDdlSchemaForNamespaceStorage as t };
|
|
21
21
|
|
|
22
|
-
//# sourceMappingURL=resolve-ddl-schema-
|
|
22
|
+
//# sourceMappingURL=resolve-ddl-schema-D0wi_P9Q.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-ddl-schema-
|
|
1
|
+
{"version":3,"file":"resolve-ddl-schema-D0wi_P9Q.mjs","names":[],"sources":["../src/core/migrations/resolve-ddl-schema.ts"],"sourcesContent":["import { UNBOUND_NAMESPACE_ID } from '@prisma-next/framework-components/ir';\nimport type { SqlStorage } from '@prisma-next/sql-contract/types';\nimport { DEFAULT_NAMESPACE_ID } from '../namespace-ids';\nimport { isPostgresSchema } from '../postgres-schema';\n\n/**\n * Given the contract's storage and a namespace id, returns the live Postgres\n * DDL schema name that namespace maps to. A named Postgres namespace dispatches\n * to its `ddlSchemaName(storage)`; the unbound sentinel resolves to\n * `DEFAULT_NAMESPACE_ID` (the search-path default for offline planning); a\n * bare object payload (used by some tests) falls back to the namespace id\n * itself.\n */\nexport function resolveDdlSchemaForNamespaceStorage(\n storage: SqlStorage,\n namespaceId: string,\n): string {\n if (namespaceId === UNBOUND_NAMESPACE_ID) {\n return DEFAULT_NAMESPACE_ID;\n }\n const namespace = storage.namespaces[namespaceId];\n if (namespace && isPostgresSchema(namespace)) {\n return namespace.ddlSchemaName(storage);\n }\n return namespaceId;\n}\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,oCACd,SACA,aACQ;CACR,IAAI,gBAAgB,sBAClB,OAAO;CAET,MAAM,YAAY,QAAQ,WAAW;CACrC,IAAI,aAAa,iBAAiB,SAAS,GACzC,OAAO,UAAU,cAAc,OAAO;CAExC,OAAO;AACT"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { a as normalizePredicate, i as computeContentHash, n as POLICY_OPERATION_PREDICATES, r as RlsPolicyOperation, t as ContentHashParts } from "./canonicalize-D1F4vUnP.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/core/rls/wire-name.d.ts
|
|
4
3
|
interface RlsPolicyWireName {
|
|
5
4
|
/** The user-supplied part before the `_<8hex>` suffix. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rls-canonicalize.d.mts","names":[],"sources":["../src/core/rls/wire-name.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rls-canonicalize.d.mts","names":[],"sources":["../src/core/rls/wire-name.ts"],"mappings":";;UAAiB;;WAEN;;WAEA;;;;;;;;iBAWK,wBAAwB,gBAAgB;;;;;;;;iBAWxC,uBAAuB,eAAe"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PostgresContractView } from "./postgres-contract-view-
|
|
1
|
+
import { t as PostgresContractView } from "./postgres-contract-view-CeU7FJjW.mjs";
|
|
2
2
|
import { AnyCodecDescriptor } from "@prisma-next/framework-components/codec";
|
|
3
3
|
import { AnyEntityKindDescriptor, Namespace } from "@prisma-next/framework-components/ir";
|
|
4
4
|
import { SqlNamespaceInput, SqlStorage } from "@prisma-next/sql-contract/types";
|
|
@@ -6,7 +6,6 @@ import { SqlContractSerializerBase } from "@prisma-next/family-sql/ir";
|
|
|
6
6
|
import { Contract } from "@prisma-next/contract/types";
|
|
7
7
|
import { RuntimeTargetDescriptor, RuntimeTargetInstance } from "@prisma-next/framework-components/execution";
|
|
8
8
|
import { JsonObject } from "@prisma-next/utils/json";
|
|
9
|
-
|
|
10
9
|
//#region src/core/postgres-contract-serializer.d.ts
|
|
11
10
|
declare class PostgresContractSerializer extends SqlContractSerializerBase<Contract<SqlStorage>> {
|
|
12
11
|
constructor(extraPackEntityKinds?: readonly AnyEntityKindDescriptor[]);
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/postgres-contract-serializer.ts","../src/exports/runtime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/postgres-contract-serializer.ts","../src/exports/runtime.ts"],"mappings":";;;;;;;;;cA0Ea,mCAAmC,0BAA0B,SAAS;cACrE,gCAA+B;YAWxB,yBACjB,cACA,KAAK,0BACJ,YAAY;EAyBN,kBAAkB,UAAU,SAAS,cAAc;;;;UCxG7C,sCAAsC;;;;;;;cAQjD,iCAAiC,2CAGrC;WAES,uBAAuB"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as postgresTargetDescriptorMetaRuntime } from "./descriptor-meta-runtime-UwYdV8fD.mjs";
|
|
2
|
-
import { n as PostgresContractSerializer, t as PostgresContractView } from "./postgres-contract-view-
|
|
2
|
+
import { n as PostgresContractSerializer, t as PostgresContractView } from "./postgres-contract-view-DebHMqGR.mjs";
|
|
3
3
|
//#region src/exports/runtime.ts
|
|
4
4
|
/**
|
|
5
5
|
* Target-postgres deliberately does NOT import `SqlRuntimeTargetDescriptor` from `@prisma-next/sql-runtime`. The target package is a control-plane residence and must not pull the SQL execution-plane package into its dependency closure. The runtime descriptor here is shaped to satisfy the framework's `RuntimeTargetDescriptor` plus the structural `SqlStaticContributions` (`codecs:` returning a descriptor list) that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-ir-annotations.d.mts","names":[],"sources":["../src/core/migrations/resolve-ddl-schema.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-ir-annotations.d.mts","names":[],"sources":["../src/core/migrations/resolve-ddl-schema.ts"],"mappings":";;;;;;;;;;iBAagB,oCACd,SAAS,YACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-
|
|
1
|
+
import { t as resolveDdlSchemaForNamespaceStorage } from "./resolve-ddl-schema-D0wi_P9Q.mjs";
|
|
2
2
|
export { resolveDdlSchemaForNamespaceStorage };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SqlSchemaIRNode } from "@prisma-next/sql-schema-ir/types";
|
|
2
|
+
import { DiffableNode } from "@prisma-next/framework-components/control";
|
|
3
|
+
//#region src/core/schema-ir/schema-node-kinds.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A Postgres schema-diff-tree node: a `SqlSchemaIRNode` that also implements
|
|
6
|
+
* `DiffableNode` (the five `Postgres*SchemaNode` classes). `SqlSchemaIRNode`
|
|
7
|
+
* alone is not a `DiffableNode` — its relational subclasses (`SqlColumnIR`, …)
|
|
8
|
+
* carry no `id`/`isEqualTo`/`children` — so this intersection is the honest node
|
|
9
|
+
* type the differ produces and the planner consumes (`SchemaDiff<SqlSchemaDiffNode>`).
|
|
10
|
+
*/
|
|
11
|
+
type SqlSchemaDiffNode = SqlSchemaIRNode & DiffableNode;
|
|
12
|
+
/**
|
|
13
|
+
* The `nodeKind` discriminant for each Postgres schema-diff node. Each node
|
|
14
|
+
* carries a unique value; the static `is`/`assert` guards compare against these
|
|
15
|
+
* identifiers rather than spelling the string inline or using `instanceof`. The
|
|
16
|
+
* field is an enumerable own property carried on every node instance.
|
|
17
|
+
*/
|
|
18
|
+
declare const PostgresSchemaNodeKind: {
|
|
19
|
+
readonly database: "postgres-database";
|
|
20
|
+
readonly namespace: "postgres-namespace";
|
|
21
|
+
readonly table: "postgres-table";
|
|
22
|
+
readonly policy: "postgres-policy";
|
|
23
|
+
readonly role: "postgres-role";
|
|
24
|
+
readonly nativeEnum: "postgres-native-enum";
|
|
25
|
+
};
|
|
26
|
+
type PostgresSchemaNodeKind = (typeof PostgresSchemaNodeKind)[keyof typeof PostgresSchemaNodeKind];
|
|
27
|
+
//#endregion
|
|
28
|
+
export { SqlSchemaDiffNode as n, PostgresSchemaNodeKind as t };
|
|
29
|
+
//# sourceMappingURL=schema-node-kinds-DxvWh2Ic.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-node-kinds-DxvWh2Ic.d.mts","names":[],"sources":["../src/core/schema-ir/schema-node-kinds.ts"],"mappings":";;;;;;;;;;KAiBY,oBAAoB,kBAAkB;;;;;;;cAQrC;;;;;;;;KASD,iCACF,qCAAqC"}
|
package/dist/sql-utils.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sql-utils.d.mts","names":[],"sources":["../src/core/sql-utils.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sql-utils.d.mts","names":[],"sources":["../src/core/sql-utils.ts"],"mappings":";;;;;;;;;;;;cAYa,uBAAuB;WAGhB;WACA;cAFhB,iBACgB,eACA;;;;;;;;;;;;iBAmBJ,gBAAgB;;;;;;;;;;;;iBA8BhB,cAAc;;;;iBAcd,YAAY,oBAAoB;;;;;;;iBAUhC,mBAAmB;;;;;;;;;;;;iBAkBnB,wBAAwB,eAAe"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AnyFromSource, AstRewriter, TableSource } from "@prisma-next/sql-relational-core/ast";
|
|
2
|
-
|
|
3
2
|
//#region src/core/ast/table-source.d.ts
|
|
4
3
|
declare class PostgresTableSource extends TableSource {
|
|
5
4
|
readonly schema: string | undefined;
|
|
@@ -12,4 +11,4 @@ declare class PostgresTableSource extends TableSource {
|
|
|
12
11
|
}
|
|
13
12
|
//#endregion
|
|
14
13
|
export { PostgresTableSource as t };
|
|
15
|
-
//# sourceMappingURL=table-source-
|
|
14
|
+
//# sourceMappingURL=table-source-D5c2fxAQ.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-source-D5c2fxAQ.d.mts","names":[],"sources":["../src/core/ast/table-source.ts"],"mappings":";;cAMa,4BAA4B;WAC9B;cAEG;aACD;aACA;aACA;;EAOF,QAAQ,UAAU,cAAc"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ColumnDefault } from "@prisma-next/contract/types";
|
|
2
|
-
|
|
3
2
|
//#region src/core/types.d.ts
|
|
4
3
|
type PostgresColumnDefault = ColumnDefault | {
|
|
5
4
|
readonly kind: 'sequence';
|
|
@@ -7,4 +6,4 @@ type PostgresColumnDefault = ColumnDefault | {
|
|
|
7
6
|
};
|
|
8
7
|
//#endregion
|
|
9
8
|
export { PostgresColumnDefault as t };
|
|
10
|
-
//# sourceMappingURL=types-
|
|
9
|
+
//# sourceMappingURL=types-D2MLzLBD.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-D2MLzLBD.d.mts","names":[],"sources":["../src/core/types.ts"],"mappings":";;KAEY,wBACR;WACW;WAA2B"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { a as PostgresNamespaceSchemaNode, c as PostgresTableSchemaNodeInput, d as PostgresNativeEnumSchemaNode, f as PostgresNativeEnumSchemaNodeInput, i as PostgresRoleSchemaNodeInput, l as PostgresPolicySchemaNode, n as PostgresDatabaseSchemaNodeInput, o as PostgresNamespaceSchemaNodeInput, r as PostgresRoleSchemaNode, s as PostgresTableSchemaNode, t as PostgresDatabaseSchemaNode, u as PostgresPolicySchemaNodeInput } from "./postgres-database-schema-node-
|
|
2
|
-
import { n as PostgresRlsPolicyInput, r as RlsPolicyOperation, t as PostgresRlsPolicy } from "./postgres-rls-policy
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { a as PostgresNamespaceSchemaNode, c as PostgresTableSchemaNodeInput, d as PostgresNativeEnumSchemaNode, f as PostgresNativeEnumSchemaNodeInput, i as PostgresRoleSchemaNodeInput, l as PostgresPolicySchemaNode, n as PostgresDatabaseSchemaNodeInput, o as PostgresNamespaceSchemaNodeInput, r as PostgresRoleSchemaNode, s as PostgresTableSchemaNode, t as PostgresDatabaseSchemaNode, u as PostgresPolicySchemaNodeInput } from "./postgres-database-schema-node-DMXsIwAb.mjs";
|
|
2
|
+
import { n as PostgresRlsPolicyInput, r as RlsPolicyOperation, t as PostgresRlsPolicy } from "./postgres-rls-policy-CYXdqG9B.mjs";
|
|
3
|
+
import { t as PostgresSchemaNodeKind } from "./schema-node-kinds-DxvWh2Ic.mjs";
|
|
4
|
+
import { t as PostgresColumnDefault } from "./types-D2MLzLBD.mjs";
|
|
5
|
+
import { a as postgresCreateNamespace, c as PostgresRlsEnablement, d as PostgresNativeEnumInput, i as isPostgresSchema, l as PostgresRlsEnablementInput, n as PostgresSchema, o as PostgresRole, r as PostgresUnboundSchema, s as PostgresRoleInput, t as PostgresContract, u as PostgresNativeEnum } from "./postgres-schema-FdKRwe7X.mjs";
|
|
6
|
+
export { type PostgresColumnDefault, type PostgresContract, PostgresDatabaseSchemaNode, type PostgresDatabaseSchemaNodeInput, PostgresNamespaceSchemaNode, type PostgresNamespaceSchemaNodeInput, PostgresNativeEnum, type PostgresNativeEnumInput, PostgresNativeEnumSchemaNode, type PostgresNativeEnumSchemaNodeInput, PostgresPolicySchemaNode, type PostgresPolicySchemaNodeInput, PostgresRlsEnablement, type PostgresRlsEnablementInput, PostgresRlsPolicy, type PostgresRlsPolicyInput, PostgresRole, type PostgresRoleInput, PostgresRoleSchemaNode, type PostgresRoleSchemaNodeInput, PostgresSchema, PostgresSchemaNodeKind, PostgresTableSchemaNode, type PostgresTableSchemaNodeInput, PostgresUnboundSchema, type RlsPolicyOperation, isPostgresSchema, postgresCreateNamespace };
|
package/dist/types.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as PostgresNativeEnum } from "./postgres-native-enum-BwVNf0Ku.mjs";
|
|
2
|
-
import { _ as PostgresRlsEnablement, g as PostgresRlsPolicy, i as postgresCreateNamespace, m as PostgresRole, n as PostgresUnboundSchema, r as isPostgresSchema, t as PostgresSchema } from "./postgres-schema-
|
|
3
|
-
import { n as PostgresNativeEnumSchemaNode, t as PostgresTableSchemaNode } from "./postgres-table-schema-node-D6LvInCe.mjs";
|
|
4
|
-
import { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from "./postgres-role-schema-node-
|
|
5
|
-
export { PostgresDatabaseSchemaNode, PostgresNamespaceSchemaNode, PostgresNativeEnum, PostgresNativeEnumSchemaNode, PostgresPolicySchemaNode, PostgresRlsEnablement, PostgresRlsPolicy, PostgresRole, PostgresRoleSchemaNode, PostgresSchema, PostgresTableSchemaNode, PostgresUnboundSchema, isPostgresSchema, postgresCreateNamespace };
|
|
2
|
+
import { _ as PostgresRlsEnablement, g as PostgresRlsPolicy, i as postgresCreateNamespace, m as PostgresRole, n as PostgresUnboundSchema, r as isPostgresSchema, t as PostgresSchema } from "./postgres-schema-CewLYHB7.mjs";
|
|
3
|
+
import { n as PostgresNativeEnumSchemaNode, r as PostgresSchemaNodeKind, t as PostgresTableSchemaNode } from "./postgres-table-schema-node-D6LvInCe.mjs";
|
|
4
|
+
import { i as PostgresDatabaseSchemaNode, n as PostgresPolicySchemaNode, r as PostgresNamespaceSchemaNode, t as PostgresRoleSchemaNode } from "./postgres-role-schema-node-bg32e7I-.mjs";
|
|
5
|
+
export { PostgresDatabaseSchemaNode, PostgresNamespaceSchemaNode, PostgresNativeEnum, PostgresNativeEnumSchemaNode, PostgresPolicySchemaNode, PostgresRlsEnablement, PostgresRlsPolicy, PostgresRole, PostgresRoleSchemaNode, PostgresSchema, PostgresSchemaNodeKind, PostgresTableSchemaNode, PostgresUnboundSchema, isPostgresSchema, postgresCreateNamespace };
|
package/package.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/target-postgres",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0-dev.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"description": "Postgres target pack for Prisma Next",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@prisma-next/cli": "0.
|
|
10
|
-
"@prisma-next/contract": "0.
|
|
11
|
-
"@prisma-next/errors": "0.
|
|
12
|
-
"@prisma-next/family-sql": "0.
|
|
13
|
-
"@prisma-next/framework-components": "0.
|
|
14
|
-
"@prisma-next/migration-tools": "0.
|
|
15
|
-
"@prisma-next/psl-parser": "0.
|
|
16
|
-
"@prisma-next/sql-contract": "0.
|
|
17
|
-
"@prisma-next/sql-errors": "0.
|
|
18
|
-
"@prisma-next/sql-operations": "0.
|
|
19
|
-
"@prisma-next/sql-relational-core": "0.
|
|
20
|
-
"@prisma-next/sql-schema-ir": "0.
|
|
21
|
-
"@prisma-next/ts-render": "0.
|
|
22
|
-
"@prisma-next/utils": "0.
|
|
9
|
+
"@prisma-next/cli": "0.16.0-dev.10",
|
|
10
|
+
"@prisma-next/contract": "0.16.0-dev.10",
|
|
11
|
+
"@prisma-next/errors": "0.16.0-dev.10",
|
|
12
|
+
"@prisma-next/family-sql": "0.16.0-dev.10",
|
|
13
|
+
"@prisma-next/framework-components": "0.16.0-dev.10",
|
|
14
|
+
"@prisma-next/migration-tools": "0.16.0-dev.10",
|
|
15
|
+
"@prisma-next/psl-parser": "0.16.0-dev.10",
|
|
16
|
+
"@prisma-next/sql-contract": "0.16.0-dev.10",
|
|
17
|
+
"@prisma-next/sql-errors": "0.16.0-dev.10",
|
|
18
|
+
"@prisma-next/sql-operations": "0.16.0-dev.10",
|
|
19
|
+
"@prisma-next/sql-relational-core": "0.16.0-dev.10",
|
|
20
|
+
"@prisma-next/sql-schema-ir": "0.16.0-dev.10",
|
|
21
|
+
"@prisma-next/ts-render": "0.16.0-dev.10",
|
|
22
|
+
"@prisma-next/utils": "0.16.0-dev.10",
|
|
23
23
|
"@standard-schema/spec": "^1.1.0",
|
|
24
24
|
"arktype": "^2.2.2",
|
|
25
25
|
"pathe": "^2.0.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@prisma-next/psl-printer": "0.
|
|
29
|
-
"@prisma-next/sql-contract-psl": "0.
|
|
30
|
-
"@prisma-next/test-utils": "0.
|
|
31
|
-
"@prisma-next/tsconfig": "0.
|
|
32
|
-
"@prisma-next/tsdown": "0.
|
|
33
|
-
"tsdown": "0.22.
|
|
28
|
+
"@prisma-next/psl-printer": "0.16.0-dev.10",
|
|
29
|
+
"@prisma-next/sql-contract-psl": "0.16.0-dev.10",
|
|
30
|
+
"@prisma-next/test-utils": "0.16.0-dev.10",
|
|
31
|
+
"@prisma-next/tsconfig": "0.16.0-dev.10",
|
|
32
|
+
"@prisma-next/tsdown": "0.16.0-dev.10",
|
|
33
|
+
"tsdown": "0.22.8",
|
|
34
34
|
"typescript": "5.9.3",
|
|
35
35
|
"vitest": "4.1.10"
|
|
36
36
|
},
|
package/src/core/authoring.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
temporalAuthoringPresets,
|
|
3
|
+
temporalCodecPresetWithPrecision,
|
|
4
|
+
} from '@prisma-next/family-sql/control';
|
|
2
5
|
import type {
|
|
3
6
|
AuthoringEntityContext,
|
|
4
7
|
AuthoringEntityTypeFactoryOutput,
|
|
@@ -627,10 +630,20 @@ export const postgresAuthoringFieldPresets = {
|
|
|
627
630
|
nativeType: 'timestamptz',
|
|
628
631
|
},
|
|
629
632
|
},
|
|
630
|
-
temporal:
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
633
|
+
temporal: {
|
|
634
|
+
.../* @__PURE__ */ temporalAuthoringPresets({
|
|
635
|
+
codecId: 'pg/timestamptz@1',
|
|
636
|
+
nativeType: 'timestamptz',
|
|
637
|
+
}),
|
|
638
|
+
timestamp: /* @__PURE__ */ temporalCodecPresetWithPrecision({
|
|
639
|
+
codecId: 'pg/timestamp@1',
|
|
640
|
+
nativeType: 'timestamp',
|
|
641
|
+
}),
|
|
642
|
+
timestamptz: /* @__PURE__ */ temporalCodecPresetWithPrecision({
|
|
643
|
+
codecId: 'pg/timestamptz@1',
|
|
644
|
+
nativeType: 'timestamptz',
|
|
645
|
+
}),
|
|
646
|
+
},
|
|
634
647
|
uuidNative: {
|
|
635
648
|
kind: 'fieldPreset',
|
|
636
649
|
output: {
|