@prisma-next/target-postgres 0.10.0 → 0.11.0

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 (63) hide show
  1. package/dist/control.mjs +4 -4
  2. package/dist/descriptor-meta-DLA2xV6B.mjs +126 -0
  3. package/dist/descriptor-meta-DLA2xV6B.mjs.map +1 -0
  4. package/dist/{issue-planner-qalHRCI2.mjs → issue-planner-OthDciOe.mjs} +5 -5
  5. package/dist/{issue-planner-qalHRCI2.mjs.map → issue-planner-OthDciOe.mjs.map} +1 -1
  6. package/dist/issue-planner.mjs +1 -1
  7. package/dist/migration.d.mts +1 -1
  8. package/dist/migration.mjs +2 -2
  9. package/dist/{op-factory-call-Zsrdty3k.mjs → op-factory-call-Bgb_ghPb.mjs} +3 -3
  10. package/dist/op-factory-call-Bgb_ghPb.mjs.map +1 -0
  11. package/dist/op-factory-call.mjs +1 -1
  12. package/dist/pack.d.mts +7 -0
  13. package/dist/pack.d.mts.map +1 -1
  14. package/dist/pack.mjs +1 -1
  15. package/dist/{planner-C8yhbXOq.mjs → planner-DZG1dsSW.mjs} +4 -4
  16. package/dist/{planner-C8yhbXOq.mjs.map → planner-DZG1dsSW.mjs.map} +1 -1
  17. package/dist/{planner-ddl-builders-DINYrbJ3.mjs → planner-ddl-builders-DYMuN0w1.mjs} +2 -2
  18. package/dist/{planner-ddl-builders-DINYrbJ3.mjs.map → planner-ddl-builders-DYMuN0w1.mjs.map} +1 -1
  19. package/dist/planner-ddl-builders.mjs +1 -1
  20. package/dist/{planner-produced-postgres-migration-BqGLw7VT.mjs → planner-produced-postgres-migration-TJWH2m_x.mjs} +3 -3
  21. package/dist/{planner-produced-postgres-migration-BqGLw7VT.mjs.map → planner-produced-postgres-migration-TJWH2m_x.mjs.map} +1 -1
  22. package/dist/{planner-produced-postgres-migration-c9lpjPv1.d.mts → planner-produced-postgres-migration-p-VKkCia.d.mts} +2 -2
  23. package/dist/{planner-produced-postgres-migration-c9lpjPv1.d.mts.map → planner-produced-postgres-migration-p-VKkCia.d.mts.map} +1 -1
  24. package/dist/planner-produced-postgres-migration.d.mts +1 -1
  25. package/dist/planner-produced-postgres-migration.mjs +1 -1
  26. package/dist/{planner-sql-checks-BM4sD6Xc.mjs → planner-sql-checks-K-mTBJDi.mjs} +2 -2
  27. package/dist/{planner-sql-checks-BM4sD6Xc.mjs.map → planner-sql-checks-K-mTBJDi.mjs.map} +1 -1
  28. package/dist/planner-sql-checks.mjs +1 -1
  29. package/dist/planner.d.mts +1 -1
  30. package/dist/planner.mjs +1 -1
  31. package/dist/{postgres-contract-serializer-CcZO9ukP.mjs → postgres-contract-serializer-CrET5Ov0.mjs} +41 -19
  32. package/dist/postgres-contract-serializer-CrET5Ov0.mjs.map +1 -0
  33. package/dist/{postgres-migration-jvsKgUDM.d.mts → postgres-migration-Fd4fQkBw.d.mts} +4 -4
  34. package/dist/{postgres-migration-jvsKgUDM.d.mts.map → postgres-migration-Fd4fQkBw.d.mts.map} +1 -1
  35. package/dist/{postgres-migration-C5os-tkl.mjs → postgres-migration-uADmx0dW.mjs} +4 -4
  36. package/dist/postgres-migration-uADmx0dW.mjs.map +1 -0
  37. package/dist/{postgres-schema-BosNxhWq.mjs → postgres-schema-CK82EuWq.mjs} +7 -2
  38. package/dist/postgres-schema-CK82EuWq.mjs.map +1 -0
  39. package/dist/{render-typescript-nRHbqLbI.mjs → render-typescript-CI1wbgUc.mjs} +5 -5
  40. package/dist/render-typescript-CI1wbgUc.mjs.map +1 -0
  41. package/dist/render-typescript.mjs +1 -1
  42. package/dist/runtime.d.mts.map +1 -1
  43. package/dist/runtime.mjs +2 -2
  44. package/dist/{tables-DZ-5Yxi0.mjs → tables-CWxZgD0H.mjs} +2 -2
  45. package/dist/{tables-DZ-5Yxi0.mjs.map → tables-CWxZgD0H.mjs.map} +1 -1
  46. package/dist/types.d.mts +1 -1
  47. package/dist/types.d.mts.map +1 -1
  48. package/dist/types.mjs +1 -1
  49. package/package.json +17 -17
  50. package/src/core/authoring.ts +2 -0
  51. package/src/core/migrations/op-factory-call.ts +1 -1
  52. package/src/core/migrations/postgres-migration.ts +3 -3
  53. package/src/core/migrations/render-typescript.ts +4 -4
  54. package/src/core/postgres-contract-serializer.ts +76 -41
  55. package/src/core/postgres-schema.ts +7 -1
  56. package/src/exports/migration.ts +4 -4
  57. package/dist/descriptor-meta-zrZzWmJF.mjs +0 -91
  58. package/dist/descriptor-meta-zrZzWmJF.mjs.map +0 -1
  59. package/dist/op-factory-call-Zsrdty3k.mjs.map +0 -1
  60. package/dist/postgres-contract-serializer-CcZO9ukP.mjs.map +0 -1
  61. package/dist/postgres-migration-C5os-tkl.mjs.map +0 -1
  62. package/dist/postgres-schema-BosNxhWq.mjs.map +0 -1
  63. package/dist/render-typescript-nRHbqLbI.mjs.map +0 -1
package/dist/control.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-zrZzWmJF.mjs";
1
+ import { t as postgresTargetDescriptorMeta } from "./descriptor-meta-DLA2xV6B.mjs";
2
2
  import { t as parsePostgresDefault } from "./default-normalizer-DHCsbfjc.mjs";
3
3
  import { t as normalizeSchemaNativeType } from "./native-type-normalizer-DMikJJ1V.mjs";
4
4
  import { r as readExistingEnumValues } from "./enum-planning-Bqp96iIw.mjs";
5
- import { o as renderDefaultLiteral } from "./planner-ddl-builders-DINYrbJ3.mjs";
6
- import { t as createPostgresMigrationPlanner } from "./planner-C8yhbXOq.mjs";
5
+ import { o as renderDefaultLiteral } from "./planner-ddl-builders-DYMuN0w1.mjs";
6
+ import { t as createPostgresMigrationPlanner } from "./planner-DZG1dsSW.mjs";
7
7
  import { a as ensureMarkerTableStatement, i as ensureLedgerTableStatement, n as buildLedgerInsertStatement, o as ensurePrismaContractSchemaStatement, r as buildMergeMarkerStatements } from "./statement-builders-vImtdfmM.mjs";
8
- import { t as PostgresContractSerializer } from "./postgres-contract-serializer-CcZO9ukP.mjs";
8
+ import { t as PostgresContractSerializer } from "./postgres-contract-serializer-CrET5Ov0.mjs";
9
9
  import { contractToSchemaIR, extractCodecControlHooks, runnerFailure, runnerSuccess } from "@prisma-next/family-sql/control";
10
10
  import { ifDefined } from "@prisma-next/utils/defined";
11
11
  import { verifySqlSchema } from "@prisma-next/family-sql/schema-verify";
@@ -0,0 +1,126 @@
1
+ import { t as PostgresEnumType } from "./postgres-enum-type-DS-KLVRH.mjs";
2
+ import { temporalAuthoringPresets } from "@prisma-next/family-sql/control";
3
+ import { PostgresEnumTypeSchema } from "@prisma-next/sql-contract/validators";
4
+ //#region src/core/authoring.ts
5
+ const postgresAuthoringTypes = {};
6
+ /**
7
+ * Entity type contributions surface as top-level helpers on the
8
+ * composed-helpers shape (e.g. `helpers.enum({...})`), flattened
9
+ * alongside the built-in `model` / `rel` helpers. Pack contributions
10
+ * still ship via the contribution data structure
11
+ * `authoring.entityTypes.<name>`; the composed-helpers template
12
+ * performs the rename in the type system.
13
+ *
14
+ * `enum` is the first real consumer of the entities-namespace mechanism:
15
+ * the factory constructs a `PostgresEnumType` IR-class instance from
16
+ * the user-supplied input. Both authoring runtimes (TS DSL and PSL)
17
+ * dispatch through this single contribution — PSL `enum Status { … }`
18
+ * declarations are lowered by the interpreter into a factory call
19
+ * with the parsed name + value list; TS DSL `helpers.enum({...})`
20
+ * resolves through the same path. Removing this contribution makes
21
+ * both surfaces fail with a "no entity helper named `enum`" type
22
+ * error at the contract-definition site.
23
+ */
24
+ /**
25
+ * The factory constructs a `PostgresEnumType` instance natively — the
26
+ * `SqlStorage.types` slot accepts polymorphic IR (the framework
27
+ * `StorageType` alphabet), so no cast is needed at the contribution
28
+ * surface. The declared return type is the structural
29
+ * `PostgresEnumStorageEntry` so the inferred contract type stays
30
+ * portable (it names a type exported from
31
+ * `@prisma-next/sql-contract/types`, a public surface every consumer
32
+ * already imports). Sharpening the inferred contract type to surface
33
+ * enum-specific narrowing through `EntityHelperFunction` is a
34
+ * separable refinement and lives outside this PR.
35
+ */
36
+ const postgresAuthoringEntityTypes = { enum: {
37
+ kind: "entity",
38
+ discriminator: "postgres-enum",
39
+ validatorSchema: PostgresEnumTypeSchema,
40
+ output: { factory: (input) => new PostgresEnumType(input) }
41
+ } };
42
+ const postgresTargetDescriptorMeta = {
43
+ kind: "target",
44
+ familyId: "sql",
45
+ targetId: "postgres",
46
+ id: "postgres",
47
+ version: "0.0.1",
48
+ capabilities: {},
49
+ authoring: {
50
+ type: postgresAuthoringTypes,
51
+ field: {
52
+ text: {
53
+ kind: "fieldPreset",
54
+ output: {
55
+ codecId: "pg/text@1",
56
+ nativeType: "text"
57
+ }
58
+ },
59
+ int: {
60
+ kind: "fieldPreset",
61
+ output: {
62
+ codecId: "pg/int4@1",
63
+ nativeType: "int4"
64
+ }
65
+ },
66
+ bigint: {
67
+ kind: "fieldPreset",
68
+ output: {
69
+ codecId: "pg/int8@1",
70
+ nativeType: "int8"
71
+ }
72
+ },
73
+ float: {
74
+ kind: "fieldPreset",
75
+ output: {
76
+ codecId: "pg/float8@1",
77
+ nativeType: "float8"
78
+ }
79
+ },
80
+ decimal: {
81
+ kind: "fieldPreset",
82
+ output: {
83
+ codecId: "pg/numeric@1",
84
+ nativeType: "numeric"
85
+ }
86
+ },
87
+ boolean: {
88
+ kind: "fieldPreset",
89
+ output: {
90
+ codecId: "pg/bool@1",
91
+ nativeType: "bool"
92
+ }
93
+ },
94
+ json: {
95
+ kind: "fieldPreset",
96
+ output: {
97
+ codecId: "pg/jsonb@1",
98
+ nativeType: "jsonb"
99
+ }
100
+ },
101
+ bytes: {
102
+ kind: "fieldPreset",
103
+ output: {
104
+ codecId: "pg/bytea@1",
105
+ nativeType: "bytea"
106
+ }
107
+ },
108
+ dateTime: {
109
+ kind: "fieldPreset",
110
+ output: {
111
+ codecId: "pg/timestamptz@1",
112
+ nativeType: "timestamptz"
113
+ }
114
+ },
115
+ temporal: temporalAuthoringPresets({
116
+ codecId: "pg/timestamptz@1",
117
+ nativeType: "timestamptz"
118
+ })
119
+ },
120
+ entityTypes: postgresAuthoringEntityTypes
121
+ }
122
+ };
123
+ //#endregion
124
+ export { postgresAuthoringEntityTypes as n, postgresTargetDescriptorMeta as t };
125
+
126
+ //# sourceMappingURL=descriptor-meta-DLA2xV6B.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-DLA2xV6B.mjs","names":[],"sources":["../src/core/authoring.ts","../src/core/descriptor-meta.ts"],"sourcesContent":["import { temporalAuthoringPresets } from '@prisma-next/family-sql/control';\nimport type {\n AuthoringEntityTypeNamespace,\n AuthoringFieldNamespace,\n AuthoringTypeNamespace,\n} from '@prisma-next/framework-components/authoring';\nimport type { PostgresEnumStorageEntry } from '@prisma-next/sql-contract/types';\nimport { PostgresEnumTypeSchema } from '@prisma-next/sql-contract/validators';\nimport { PostgresEnumType, type PostgresEnumTypeInput } from './postgres-enum-type';\n\nexport const postgresAuthoringTypes = {} as const satisfies AuthoringTypeNamespace;\n\n/**\n * Entity type contributions surface as top-level helpers on the\n * composed-helpers shape (e.g. `helpers.enum({...})`), flattened\n * alongside the built-in `model` / `rel` helpers. Pack contributions\n * still ship via the contribution data structure\n * `authoring.entityTypes.<name>`; the composed-helpers template\n * performs the rename in the type system.\n *\n * `enum` is the first real consumer of the entities-namespace mechanism:\n * the factory constructs a `PostgresEnumType` IR-class instance from\n * the user-supplied input. Both authoring runtimes (TS DSL and PSL)\n * dispatch through this single contribution — PSL `enum Status { … }`\n * declarations are lowered by the interpreter into a factory call\n * with the parsed name + value list; TS DSL `helpers.enum({...})`\n * resolves through the same path. Removing this contribution makes\n * both surfaces fail with a \"no entity helper named `enum`\" type\n * error at the contract-definition site.\n */\n/**\n * The factory constructs a `PostgresEnumType` instance natively — the\n * `SqlStorage.types` slot accepts polymorphic IR (the framework\n * `StorageType` alphabet), so no cast is needed at the contribution\n * surface. The declared return type is the structural\n * `PostgresEnumStorageEntry` so the inferred contract type stays\n * portable (it names a type exported from\n * `@prisma-next/sql-contract/types`, a public surface every consumer\n * already imports). Sharpening the inferred contract type to surface\n * enum-specific narrowing through `EntityHelperFunction` is a\n * separable refinement and lives outside this PR.\n */\nexport const postgresAuthoringEntityTypes = {\n enum: {\n kind: 'entity',\n discriminator: 'postgres-enum',\n validatorSchema: PostgresEnumTypeSchema,\n output: {\n factory: (input: PostgresEnumTypeInput): PostgresEnumStorageEntry =>\n new PostgresEnumType(input),\n },\n },\n} as const satisfies AuthoringEntityTypeNamespace;\n\n/**\n * Field presets contributed by the Postgres target pack.\n *\n * These mirror the PSL scalar-to-codec mapping used by the Postgres adapter\n * (see `createPostgresPslScalarTypeDescriptors`), so that authoring a field\n * via the TS callback surface (e.g. `field.int()`) and via the PSL scalar\n * surface (e.g. `Int`) lowers to byte-identical contracts.\n */\nexport const postgresAuthoringFieldPresets = {\n text: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/text@1',\n nativeType: 'text',\n },\n },\n int: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/int4@1',\n nativeType: 'int4',\n },\n },\n bigint: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/int8@1',\n nativeType: 'int8',\n },\n },\n float: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/float8@1',\n nativeType: 'float8',\n },\n },\n decimal: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/numeric@1',\n nativeType: 'numeric',\n },\n },\n boolean: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/bool@1',\n nativeType: 'bool',\n },\n },\n json: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/jsonb@1',\n nativeType: 'jsonb',\n },\n },\n bytes: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/bytea@1',\n nativeType: 'bytea',\n },\n },\n dateTime: {\n kind: 'fieldPreset',\n output: {\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n },\n },\n temporal: temporalAuthoringPresets({\n codecId: 'pg/timestamptz@1',\n nativeType: 'timestamptz',\n }),\n} as const satisfies AuthoringFieldNamespace;\n","import type { CodecTypes } from '../exports/codec-types';\nimport {\n postgresAuthoringEntityTypes,\n postgresAuthoringFieldPresets,\n postgresAuthoringTypes,\n} from './authoring';\n\nconst postgresTargetDescriptorMetaBase = {\n kind: 'target',\n familyId: 'sql',\n targetId: 'postgres',\n id: 'postgres',\n version: '0.0.1',\n capabilities: {},\n authoring: {\n type: postgresAuthoringTypes,\n field: postgresAuthoringFieldPresets,\n entityTypes: postgresAuthoringEntityTypes,\n },\n} as const;\n\nexport const postgresTargetDescriptorMeta: typeof postgresTargetDescriptorMetaBase & {\n readonly __codecTypes?: CodecTypes;\n} = postgresTargetDescriptorMetaBase;\n"],"mappings":";;;;AAUA,MAAa,yBAAyB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCxC,MAAa,+BAA+B,EAC1C,MAAM;CACJ,MAAM;CACN,eAAe;CACf,iBAAiB;CACjB,QAAQ,EACN,UAAU,UACR,IAAI,iBAAiB,MAAM,EAC9B;CACF,EACF;AC/BD,MAAa,+BAET;CAfF,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,EAAE;CAChB,WAAW;EACT,MAAM;EACN,OAAO;GD+CT,MAAM;IACJ,MAAM;IACN,QAAQ;KACN,SAAS;KACT,YAAY;KACb;IACF;GACD,KAAK;IACH,MAAM;IACN,QAAQ;KACN,SAAS;KACT,YAAY;KACb;IACF;GACD,QAAQ;IACN,MAAM;IACN,QAAQ;KACN,SAAS;KACT,YAAY;KACb;IACF;GACD,OAAO;IACL,MAAM;IACN,QAAQ;KACN,SAAS;KACT,YAAY;KACb;IACF;GACD,SAAS;IACP,MAAM;IACN,QAAQ;KACN,SAAS;KACT,YAAY;KACb;IACF;GACD,SAAS;IACP,MAAM;IACN,QAAQ;KACN,SAAS;KACT,YAAY;KACb;IACF;GACD,MAAM;IACJ,MAAM;IACN,QAAQ;KACN,SAAS;KACT,YAAY;KACb;IACF;GACD,OAAO;IACL,MAAM;IACN,QAAQ;KACN,SAAS;KACT,YAAY;KACb;IACF;GACD,UAAU;IACR,MAAM;IACN,QAAQ;KACN,SAAS;KACT,YAAY;KACb;IACF;GACD,UAAU,yBAAyB;IACjC,SAAS;IACT,YAAY;IACb,CAAC;GCjHO;EACP,aAAa;EACd;CAKC"}
@@ -1,10 +1,10 @@
1
1
  import { t as PostgresEnumType } from "./postgres-enum-type-DS-KLVRH.mjs";
2
2
  import { r as readExistingEnumValues, t as determineEnumDiff } from "./enum-planning-Bqp96iIw.mjs";
3
3
  import { i as quoteIdentifier } from "./sql-utils-BewXAnsG.mjs";
4
- import { r as isPostgresSchema } from "./postgres-schema-BosNxhWq.mjs";
5
- import { a as columnNullabilityCheck, c as qualifyTableName, i as columnHasNoDefaultCheck, r as columnExistsCheck, t as buildExpectedFormatType, u as tableIsEmptyCheck } from "./planner-sql-checks-BM4sD6Xc.mjs";
6
- import { C as SetNotNullCall, S as SetDefaultCall, _ as DropIndexCall, a as AddUniqueCall, b as RawSqlCall, d as CreateTableCall, f as DataTransformCall, g as DropEnumTypeCall, h as DropDefaultCall, i as AddPrimaryKeyCall, l as CreateIndexCall, m as DropConstraintCall, n as AddEnumValuesCall, o as AlterColumnTypeCall, p as DropColumnCall, r as AddForeignKeyCall, s as CreateEnumTypeCall, t as AddColumnCall, u as CreateSchemaCall, v as DropNotNullCall, x as RenameTypeCall, y as DropTableCall } from "./op-factory-call-Zsrdty3k.mjs";
7
- import { n as buildColumnDefaultSql, r as buildColumnTypeSql, t as buildAddColumnSql } from "./planner-ddl-builders-DINYrbJ3.mjs";
4
+ import { r as isPostgresSchema } from "./postgres-schema-CK82EuWq.mjs";
5
+ import { a as columnNullabilityCheck, c as qualifyTableName, i as columnHasNoDefaultCheck, r as columnExistsCheck, t as buildExpectedFormatType, u as tableIsEmptyCheck } from "./planner-sql-checks-K-mTBJDi.mjs";
6
+ import { C as SetNotNullCall, S as SetDefaultCall, _ as DropIndexCall, a as AddUniqueCall, b as RawSqlCall, d as CreateTableCall, f as DataTransformCall, g as DropEnumTypeCall, h as DropDefaultCall, i as AddPrimaryKeyCall, l as CreateIndexCall, m as DropConstraintCall, n as AddEnumValuesCall, o as AlterColumnTypeCall, p as DropColumnCall, r as AddForeignKeyCall, s as CreateEnumTypeCall, t as AddColumnCall, u as CreateSchemaCall, v as DropNotNullCall, x as RenameTypeCall, y as DropTableCall } from "./op-factory-call-Bgb_ghPb.mjs";
7
+ import { n as buildColumnDefaultSql, r as buildColumnTypeSql, t as buildAddColumnSql } from "./planner-ddl-builders-DYMuN0w1.mjs";
8
8
  import { n as resolveIdentityValue } from "./planner-identity-values-ojX-6cPV.mjs";
9
9
  import { i as hasUniqueConstraint, n as hasForeignKey, t as buildSchemaLookupMap } from "./planner-schema-lookup-BGyukuzG.mjs";
10
10
  import { ifDefined } from "@prisma-next/utils/defined";
@@ -976,4 +976,4 @@ function planIssues(options) {
976
976
  //#endregion
977
977
  export { postgresPlannerStrategies as n, planIssues as t };
978
978
 
979
- //# sourceMappingURL=issue-planner-qalHRCI2.mjs.map
979
+ //# sourceMappingURL=issue-planner-OthDciOe.mjs.map