@prisma/orm-target-postgres 8.0.0-rc.22-dev.12 → 8.0.0-rc.22-dev.14

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 (163) hide show
  1. package/dist/{adapter-BTT7mZNb-DgNnM6Fx.mjs → adapter-BgEU4rZ4-CnjkLewL.mjs} +3 -3
  2. package/dist/{adapter-BTT7mZNb-DgNnM6Fx.mjs.map → adapter-BgEU4rZ4-CnjkLewL.mjs.map} +1 -1
  3. package/dist/{adapter-CeOgqN2C.d.mts → adapter-dMZYwONo.d.mts} +2 -2
  4. package/dist/{adapter-CeOgqN2C.d.mts.map → adapter-dMZYwONo.d.mts.map} +1 -1
  5. package/dist/adapter.d.mts +8 -8
  6. package/dist/adapter.mjs +4 -4
  7. package/dist/adapter__adapter.d.mts +1 -1
  8. package/dist/adapter__adapter.mjs +2 -2
  9. package/dist/adapter__column-types.d.mts +2 -2
  10. package/dist/adapter__column-types.mjs +2 -2
  11. package/dist/adapter__control.d.mts +1 -1
  12. package/dist/adapter__control.mjs +2 -2
  13. package/dist/adapter__control.mjs.map +1 -1
  14. package/dist/adapter__runtime.d.mts +1 -1
  15. package/dist/adapter__runtime.mjs +2 -2
  16. package/dist/adapter__runtime.mjs.map +1 -1
  17. package/dist/adapter__sql-renderer.d.mts +1 -1
  18. package/dist/adapter__types.d.mts +2 -2
  19. package/dist/{authoring-BLKmfwFy-DRwqGgGY.mjs → authoring-BD4uEpBM-DIJiGq4e.mjs} +340 -143
  20. package/dist/authoring-BD4uEpBM-DIJiGq4e.mjs.map +1 -0
  21. package/dist/{column-types-0CjA9Eri.d.mts → column-types-DBCLQW1w.d.mts} +6 -6
  22. package/dist/column-types-DBCLQW1w.d.mts.map +1 -0
  23. package/dist/{column-types-B11Mxo9V.mjs → column-types-DpzI37Cl.mjs} +4 -4
  24. package/dist/column-types-DpzI37Cl.mjs.map +1 -0
  25. package/dist/{contract-contributions-OLP0SDpr-eaZpGsZF.mjs → contract-contributions-DpTbtESH-CxVtT7cT.mjs} +20 -8
  26. package/dist/contract-contributions-DpTbtESH-CxVtT7cT.mjs.map +1 -0
  27. package/dist/{control-2DHRXqEz.d.mts → control-C8M0RWE6.d.mts} +6 -4
  28. package/dist/{control-2DHRXqEz.d.mts.map → control-C8M0RWE6.d.mts.map} +1 -1
  29. package/dist/{control-B9PSgbQT.d.mts → control-Ci6kSDEg.d.mts} +461 -165
  30. package/dist/control-Ci6kSDEg.d.mts.map +1 -0
  31. package/dist/{control-policy-K52VpMX0-CateWffI.mjs → control-policy-BUrgZRnC-BI-Yv8NV.mjs} +18 -6
  32. package/dist/control-policy-BUrgZRnC-BI-Yv8NV.mjs.map +1 -0
  33. package/dist/{data-transform-nGy9rz87-CE3DGlgn.d.mts → data-transform-2o0tpMs8-DADYIvEZ.d.mts} +3 -3
  34. package/dist/{data-transform-nGy9rz87-CE3DGlgn.d.mts.map → data-transform-2o0tpMs8-DADYIvEZ.d.mts.map} +1 -1
  35. package/dist/data-transform-DX9I716A.d.mts +1 -0
  36. package/dist/{descriptor-meta-iTcMZFBI-CPsGItUl.mjs → descriptor-meta-Bj9sQhJn-CMP3p6iz.mjs} +3 -3
  37. package/dist/{descriptor-meta-iTcMZFBI-CPsGItUl.mjs.map → descriptor-meta-Bj9sQhJn-CMP3p6iz.mjs.map} +1 -1
  38. package/dist/{descriptor-meta-DDydgB82-Cvv8FtTL.mjs → descriptor-meta-DWKp5Q1s-DplRJE9N.mjs} +5 -5
  39. package/dist/descriptor-meta-DWKp5Q1s-DplRJE9N.mjs.map +1 -0
  40. package/dist/{diff-database-schema-D_vOsC7_-CtLt0OwZ.mjs → diff-database-schema-DPsDQkk4-4hkHTHE_.mjs} +10 -7
  41. package/dist/diff-database-schema-DPsDQkk4-4hkHTHE_.mjs.map +1 -0
  42. package/dist/{diff-database-schema-COp7SqEI.d.mts → diff-database-schema-rhLkiByE.d.mts} +2 -2
  43. package/dist/{diff-database-schema-COp7SqEI.d.mts.map → diff-database-schema-rhLkiByE.d.mts.map} +1 -1
  44. package/dist/{indexes-BYf6nXVv-BXwLw7fO.d.mts → indexes-ooG0J-V8-CTm1QvmZ.d.mts} +3 -3
  45. package/dist/{indexes-BYf6nXVv-BXwLw7fO.d.mts.map → indexes-ooG0J-V8-CTm1QvmZ.d.mts.map} +1 -1
  46. package/dist/{infer-psl-contract-Bn0Qzy4d-D9RlEL5y.mjs → infer-psl-contract-DR0Uie7w-CkaPSdPc.mjs} +9 -7
  47. package/dist/infer-psl-contract-DR0Uie7w-CkaPSdPc.mjs.map +1 -0
  48. package/dist/{issue-planner-CbixMGS1.d.mts → issue-planner-BlN8mK4E.d.mts} +4 -4
  49. package/dist/{issue-planner-CbixMGS1.d.mts.map → issue-planner-BlN8mK4E.d.mts.map} +1 -1
  50. package/dist/migration-Be_iuIpn.mjs.map +1 -1
  51. package/dist/{migration-XqRvlRWn.d.mts → migration-CCE5d6Hu.d.mts} +6 -6
  52. package/dist/{migration-XqRvlRWn.d.mts.map → migration-CCE5d6Hu.d.mts.map} +1 -1
  53. package/dist/{op-factory-call-DQW9c0ec-C3qv_STE.mjs → op-factory-call-Bgxtheqh-CsY_eFlX.mjs} +20 -10
  54. package/dist/op-factory-call-Bgxtheqh-CsY_eFlX.mjs.map +1 -0
  55. package/dist/{op-factory-call-fPC4Yzy6-B6JHyh7J.d.mts → op-factory-call-CG80t74g-D9tjd13N.d.mts} +9 -9
  56. package/dist/{op-factory-call-fPC4Yzy6-B6JHyh7J.d.mts.map → op-factory-call-CG80t74g-D9tjd13N.d.mts.map} +1 -1
  57. package/dist/op-factory-call-DRapuFEI.d.mts +1 -0
  58. package/dist/{pack-CDKbvMvB.d.mts → pack-BjD3oNln.d.mts} +374 -93
  59. package/dist/pack-BjD3oNln.d.mts.map +1 -0
  60. package/dist/{planner-Cw5KV0_B.d.mts → planner-CyyWVHw4.d.mts} +3 -3
  61. package/dist/{planner-Cw5KV0_B.d.mts.map → planner-CyyWVHw4.d.mts.map} +1 -1
  62. package/dist/{planner-produced-postgres-migration-bn60skNP-CKjpb3S_.mjs → planner-produced-postgres-migration-BYDwCSQf-Bjxf5uvj.mjs} +4 -4
  63. package/dist/{planner-produced-postgres-migration-bn60skNP-CKjpb3S_.mjs.map → planner-produced-postgres-migration-BYDwCSQf-Bjxf5uvj.mjs.map} +1 -1
  64. package/dist/{planner-produced-postgres-migration-DgUtdqVh-DEhVIDmO.d.mts → planner-produced-postgres-migration-CDkRlHah-Cknq9LDt.d.mts} +4 -4
  65. package/dist/planner-produced-postgres-migration-CDkRlHah-Cknq9LDt.d.mts.map +1 -0
  66. package/dist/planner-produced-postgres-migration-Davk_RXL.d.mts +1 -0
  67. package/dist/planner-target-details-boDXR2s7-CExrk6rf.d.mts +21 -0
  68. package/dist/planner-target-details-boDXR2s7-CExrk6rf.d.mts.map +1 -0
  69. package/dist/{planner-BsSEbzfm-BrBEb_M1.mjs → planner-xiEt2PZE-CRK1isjH.mjs} +41 -11
  70. package/dist/planner-xiEt2PZE-CRK1isjH.mjs.map +1 -0
  71. package/dist/{postgres-contract-view-pS-iTnm--BIKbQbBd.mjs → postgres-contract-view-yDfay91x-BBinYMBq.mjs} +3 -3
  72. package/dist/{postgres-contract-view-pS-iTnm--BIKbQbBd.mjs.map → postgres-contract-view-yDfay91x-BBinYMBq.mjs.map} +1 -1
  73. package/dist/{postgres-database-schema-node-BjmJ6_Cs-LyZ0n9oj.d.mts → postgres-database-schema-node-CqEX2NPO-Be-Vk1Iw.d.mts} +19 -6
  74. package/dist/postgres-database-schema-node-CqEX2NPO-Be-Vk1Iw.d.mts.map +1 -0
  75. package/dist/{postgres-migration-MVAsm-Co-CcN0UJd7.d.mts → postgres-migration-DUgkNwUR-B3Hr27gY.d.mts} +9 -14
  76. package/dist/postgres-migration-DUgkNwUR-B3Hr27gY.d.mts.map +1 -0
  77. package/dist/{postgres-migration-CVWCygKt-DEXT0FE_.mjs → postgres-migration-DXKKrCKw-CDLugMuf.mjs} +11 -16
  78. package/dist/postgres-migration-DXKKrCKw-CDLugMuf.mjs.map +1 -0
  79. package/dist/{postgres-role-schema-node-DuljIQWp-D6Q5JyEs.mjs → postgres-role-schema-node-yFPLQ6U0-ZCPXs-lG.mjs} +3 -3
  80. package/dist/{postgres-role-schema-node-DuljIQWp-D6Q5JyEs.mjs.map → postgres-role-schema-node-yFPLQ6U0-ZCPXs-lG.mjs.map} +1 -1
  81. package/dist/{postgres-table-schema-node-nY6II-Uv-Bj-lgmSi.mjs → postgres-table-schema-node-OQRI_GIM-DhOVxH8-.mjs} +37 -8
  82. package/dist/postgres-table-schema-node-OQRI_GIM-DhOVxH8-.mjs.map +1 -0
  83. package/dist/{prisma7-binding-BexVc6RM.mjs → prisma7-binding-BA8iSLxQ.mjs} +5 -5
  84. package/dist/prisma7-binding-BA8iSLxQ.mjs.map +1 -0
  85. package/dist/{prisma7-binding-B3uUGwg2.d.mts → prisma7-binding-VYAlkSRR.d.mts} +374 -93
  86. package/dist/prisma7-binding-VYAlkSRR.d.mts.map +1 -0
  87. package/dist/{render-ops-Bl84i7ut.d.mts → render-ops-CEwI8Iyf.d.mts} +2 -2
  88. package/dist/{render-ops-Bl84i7ut.d.mts.map → render-ops-CEwI8Iyf.d.mts.map} +1 -1
  89. package/dist/{render-ops-BKDfKgOJ-DmoHztdY.mjs → render-ops-CXUeDteo-qwmXCohY.mjs} +3 -3
  90. package/dist/{render-ops-BKDfKgOJ-DmoHztdY.mjs.map → render-ops-CXUeDteo-qwmXCohY.mjs.map} +1 -1
  91. package/dist/{resolve-ddl-schema-BZzteXH1-C57Iavtu.mjs → resolve-ddl-schema-DwoTc0nu-CvyB2Tfu.mjs} +3 -8
  92. package/dist/resolve-ddl-schema-DwoTc0nu-CvyB2Tfu.mjs.map +1 -0
  93. package/dist/{runtime-K2strEv6.d.mts → runtime-SZ0CXU1B.d.mts} +2 -2
  94. package/dist/{runtime-K2strEv6.d.mts.map → runtime-SZ0CXU1B.d.mts.map} +1 -1
  95. package/dist/schema-ir-annotations-u590Zxbh.d.mts +10 -0
  96. package/dist/schema-ir-annotations-u590Zxbh.d.mts.map +1 -0
  97. package/dist/{sql-renderer-PT6pQ66O.d.mts → sql-renderer-DAkljp6a.d.mts} +2 -2
  98. package/dist/{sql-renderer-PT6pQ66O.d.mts.map → sql-renderer-DAkljp6a.d.mts.map} +1 -1
  99. package/dist/target.d.mts +20 -20
  100. package/dist/target.mjs +14 -14
  101. package/dist/target__control.d.mts +2 -2
  102. package/dist/target__control.mjs +22 -15
  103. package/dist/target__control.mjs.map +1 -1
  104. package/dist/target__data-transform.d.mts +2 -2
  105. package/dist/target__diff-database-schema.d.mts +1 -1
  106. package/dist/target__diff-database-schema.mjs +1 -1
  107. package/dist/target__issue-planner.d.mts +1 -1
  108. package/dist/target__issue-planner.mjs +1 -1
  109. package/dist/target__migration.d.mts +3 -3
  110. package/dist/target__migration.mjs +2 -2
  111. package/dist/target__op-factory-call.d.mts +2 -2
  112. package/dist/target__op-factory-call.mjs +1 -1
  113. package/dist/target__pack.d.mts +1 -1
  114. package/dist/target__pack.mjs +1 -1
  115. package/dist/target__planner-produced-postgres-migration.d.mts +2 -2
  116. package/dist/target__planner-produced-postgres-migration.mjs +1 -1
  117. package/dist/target__planner-target-details.d.mts +1 -1
  118. package/dist/target__planner.d.mts +1 -1
  119. package/dist/target__planner.mjs +2 -2
  120. package/dist/target__prisma7-binding.d.mts +1 -1
  121. package/dist/target__prisma7-binding.mjs +1 -1
  122. package/dist/target__render-ops.d.mts +1 -1
  123. package/dist/target__render-ops.mjs +1 -1
  124. package/dist/target__runtime.mjs +1 -1
  125. package/dist/target__runtime.mjs.map +1 -1
  126. package/dist/target__schema-ir-annotations.d.mts +1 -1
  127. package/dist/target__schema-ir-annotations.mjs +1 -1
  128. package/dist/target__types.d.mts +2 -2
  129. package/dist/target__types.mjs +2 -2
  130. package/dist/{types-D6p1198n.d.mts → types-BbuQ92k_.d.mts} +2 -2
  131. package/dist/{types-D6p1198n.d.mts.map → types-BbuQ92k_.d.mts.map} +1 -1
  132. package/dist/types-D6WI1IFf.d.mts +2 -0
  133. package/dist/{types-D6lgKhE5-DVHMZPbP.d.mts → types-D6lgKhE5-DEwv-pSi.d.mts} +2 -2
  134. package/dist/{types-D6lgKhE5-DVHMZPbP.d.mts.map → types-D6lgKhE5-DEwv-pSi.d.mts.map} +1 -1
  135. package/package.json +10 -10
  136. package/dist/authoring-BLKmfwFy-DRwqGgGY.mjs.map +0 -1
  137. package/dist/column-types-0CjA9Eri.d.mts.map +0 -1
  138. package/dist/column-types-B11Mxo9V.mjs.map +0 -1
  139. package/dist/contract-contributions-OLP0SDpr-eaZpGsZF.mjs.map +0 -1
  140. package/dist/control-B9PSgbQT.d.mts.map +0 -1
  141. package/dist/control-policy-K52VpMX0-CateWffI.mjs.map +0 -1
  142. package/dist/data-transform-nqkqNIb8.d.mts +0 -1
  143. package/dist/descriptor-meta-DDydgB82-Cvv8FtTL.mjs.map +0 -1
  144. package/dist/diff-database-schema-D_vOsC7_-CtLt0OwZ.mjs.map +0 -1
  145. package/dist/infer-psl-contract-Bn0Qzy4d-D9RlEL5y.mjs.map +0 -1
  146. package/dist/op-factory-call-DO-2Ul_8.d.mts +0 -1
  147. package/dist/op-factory-call-DQW9c0ec-C3qv_STE.mjs.map +0 -1
  148. package/dist/pack-CDKbvMvB.d.mts.map +0 -1
  149. package/dist/planner-BsSEbzfm-BrBEb_M1.mjs.map +0 -1
  150. package/dist/planner-produced-postgres-migration-CoX6OBqo.d.mts +0 -1
  151. package/dist/planner-produced-postgres-migration-DgUtdqVh-DEhVIDmO.d.mts.map +0 -1
  152. package/dist/planner-target-details-HkP4RrRO-D6VtK0jY.d.mts +0 -12
  153. package/dist/planner-target-details-HkP4RrRO-D6VtK0jY.d.mts.map +0 -1
  154. package/dist/postgres-database-schema-node-BjmJ6_Cs-LyZ0n9oj.d.mts.map +0 -1
  155. package/dist/postgres-migration-CVWCygKt-DEXT0FE_.mjs.map +0 -1
  156. package/dist/postgres-migration-MVAsm-Co-CcN0UJd7.d.mts.map +0 -1
  157. package/dist/postgres-table-schema-node-nY6II-Uv-Bj-lgmSi.mjs.map +0 -1
  158. package/dist/prisma7-binding-B3uUGwg2.d.mts.map +0 -1
  159. package/dist/prisma7-binding-BexVc6RM.mjs.map +0 -1
  160. package/dist/resolve-ddl-schema-BZzteXH1-C57Iavtu.mjs.map +0 -1
  161. package/dist/schema-ir-annotations-BygaWBiC.d.mts +0 -15
  162. package/dist/schema-ir-annotations-BygaWBiC.d.mts.map +0 -1
  163. package/dist/types-oaZIR8i0.d.mts +0 -2
@@ -12,104 +12,143 @@ import { assertDefined, invariant } from "@prisma/orm-framework/utils/assertions
12
12
  import { assertWireNamePrefixLength, normalizeSqlBody } from "@prisma/orm-family-sql/schema-ir/naming";
13
13
  import { sqlTargetTypeConstructors } from "@prisma/orm-family-sql/family/pack";
14
14
  import { temporalTypeAliases } from "@prisma/orm-framework/components/authoring";
15
+ import { UNBOUND_PSL_NAMESPACE_NAME } from "@prisma/orm-framework/components/psl-ast";
15
16
  import { blockAttribute, bool, dataTypeValue, entityRef, fieldRef, identifier, leafDiagnostic, list, mapBlock, modelAttribute, oneOf, optional, str, structBlock } from "@prisma/orm-framework/psl-parser";
16
17
  import { generatedIdColumnAliases } from "@prisma/orm-family-sql/contract/generated-id-column-aliases";
17
18
  import { exactNameBodyWarning } from "@prisma/orm-family-sql/contract/index-naming";
18
19
  import { SQL_EXPRESSION_DATA_TYPE_ID, requireSqlExpression, sqlTextFromStored } from "@prisma/orm-family-sql/contract/sql-expression";
19
- //#region ../../../3-targets/postgres/1-target/dist/authoring-BLKmfwFy.mjs
20
+ //#region ../../../3-targets/postgres/1-target/dist/authoring-BD4uEpBM.mjs
20
21
  /** The data type of every size argument on Postgres, such as a length or a precision: a typmod is an `int4`. */
21
22
  const PG_SIZE_TYPE = "pg/int4";
23
+ const length = {
24
+ kind: "value",
25
+ dataType: PG_SIZE_TYPE,
26
+ name: "length",
27
+ optional: true
28
+ };
29
+ const int2 = {
30
+ kind: "typeConstructor",
31
+ documentation: "A signed 16-bit integer stored as PostgreSQL int2 and represented as a JavaScript number.",
32
+ output: { codecId: "pg/int2@1" }
33
+ };
34
+ const int8Number = {
35
+ kind: "typeConstructor",
36
+ documentation: "A signed 64-bit integer stored as PostgreSQL int8 and represented as a JavaScript number within its safe integer range.",
37
+ output: { codecId: "pg/int8number@1" }
38
+ };
39
+ const numericString = {
40
+ kind: "typeConstructor",
41
+ documentation: "An exact decimal value stored as PostgreSQL numeric, with optional precision and scale, and represented as decimal text.",
42
+ args: [{
43
+ kind: "value",
44
+ dataType: PG_SIZE_TYPE,
45
+ name: "precision",
46
+ optional: true
47
+ }, {
48
+ kind: "value",
49
+ dataType: PG_SIZE_TYPE,
50
+ name: "scale",
51
+ optional: true
52
+ }],
53
+ output: {
54
+ codecId: "pg/numeric@1",
55
+ typeParams: {
56
+ precision: {
57
+ kind: "arg",
58
+ index: 0
59
+ },
60
+ scale: {
61
+ kind: "arg",
62
+ index: 1
63
+ }
64
+ }
65
+ }
66
+ };
67
+ const numericBigInt = {
68
+ kind: "typeConstructor",
69
+ documentation: "An arbitrary-precision integer stored as PostgreSQL numeric and represented as a JavaScript bigint.",
70
+ output: { codecId: "pg/unboundedint@1" }
71
+ };
72
+ const float4 = {
73
+ kind: "typeConstructor",
74
+ documentation: "A single-precision floating-point number stored as PostgreSQL float4.",
75
+ output: { codecId: "pg/float4@1" }
76
+ };
77
+ const varchar = {
78
+ kind: "typeConstructor",
79
+ documentation: "Variable-length text stored as PostgreSQL character varying, with an optional maximum character length.",
80
+ args: [length],
81
+ output: {
82
+ codecId: "sql/varchar@1",
83
+ typeParams: { length: {
84
+ kind: "arg",
85
+ index: 0
86
+ } }
87
+ }
88
+ };
89
+ const varbit = {
90
+ kind: "typeConstructor",
91
+ documentation: "A variable-length bit string with an optional maximum length in bits.",
92
+ args: [length],
93
+ output: {
94
+ codecId: "pg/varbit@1",
95
+ typeParams: { length: {
96
+ kind: "arg",
97
+ index: 0
98
+ } }
99
+ }
100
+ };
22
101
  /**
23
- * The base PSL scalars as zero-arg type constructors in the unified authoring
24
- * channel. Each names a codec; the column's database type is its data type's.
25
- *
26
- * The type position is the only storage decider: a mutation-default generator
27
- * (`@onCreate(uuid())`) never re-picks a column's storage.
102
+ * PostgreSQL's explicit types: each names one codec, and is what the contract stores. Each is named after the database type, plus the application value where the database type has more than one codec (ADR 257, ADR 316). `Json` keeps its name until the `Json` convenience type is decided.
28
103
  */
29
- const postgresScalarAuthoringTypes = {
30
- String: {
31
- kind: "typeConstructor",
32
- inferred: true,
33
- documentation: "Variable-length text stored as PostgreSQL text.",
34
- output: { codecId: "pg/text@1" }
35
- },
36
- Boolean: {
37
- kind: "typeConstructor",
38
- inferred: true,
39
- documentation: "A true or false value stored as PostgreSQL boolean.",
40
- output: { codecId: "pg/bool@1" }
104
+ const postgresExplicitTypes = {
105
+ Int2: {
106
+ ...int2,
107
+ inferred: true
41
108
  },
42
- Int: {
109
+ Int4: {
43
110
  kind: "typeConstructor",
44
111
  inferred: true,
45
- documentation: "A signed 32-bit integer represented as a JavaScript number.",
112
+ documentation: "A signed 32-bit integer stored as PostgreSQL int4 and represented as a JavaScript number.",
46
113
  output: { codecId: "pg/int4@1" }
47
114
  },
48
- BigInt: {
115
+ Int8BigInt: {
49
116
  kind: "typeConstructor",
50
117
  inferred: true,
51
- documentation: "A signed 64-bit integer represented as a JavaScript bigint.",
118
+ documentation: "A signed 64-bit integer stored as PostgreSQL int8 and represented as a JavaScript bigint.",
52
119
  output: { codecId: "pg/int8@1" }
53
120
  },
54
- Float: {
55
- kind: "typeConstructor",
56
- inferred: true,
57
- documentation: "A double-precision floating-point number.",
58
- output: { codecId: "pg/float8@1" }
121
+ Int8Number: int8Number,
122
+ NumericString: {
123
+ ...numericString,
124
+ inferred: true
59
125
  },
60
- Decimal: {
61
- kind: "typeConstructor",
62
- documentation: "An exact decimal value stored as PostgreSQL numeric.",
63
- output: { codecId: "pg/numeric@1" }
126
+ NumericBigInt: numericBigInt,
127
+ Float4: {
128
+ ...float4,
129
+ inferred: true
64
130
  },
65
- Json: {
131
+ Float8: {
66
132
  kind: "typeConstructor",
67
133
  inferred: true,
68
- documentation: "A JSON value stored as PostgreSQL json.",
69
- output: { codecId: "pg/json@1" }
134
+ documentation: "A double-precision floating-point number stored as PostgreSQL float8.",
135
+ output: { codecId: "pg/float8@1" }
70
136
  },
71
- Jsonb: {
137
+ Text: {
72
138
  kind: "typeConstructor",
73
139
  inferred: true,
74
- documentation: "A JSON value stored in PostgreSQL binary jsonb format.",
75
- output: { codecId: "pg/jsonb@1" }
140
+ documentation: "Variable-length text stored as PostgreSQL text.",
141
+ output: { codecId: "pg/text@1" }
76
142
  },
77
- Bytes: {
78
- kind: "typeConstructor",
79
- inferred: true,
80
- documentation: "Binary data stored as PostgreSQL bytea.",
81
- output: { codecId: "pg/bytea@1" }
82
- }
83
- };
84
- const postgresNativeAuthoringTypes = {
85
- VarChar: {
86
- kind: "typeConstructor",
87
- inferred: true,
88
- documentation: "Variable-length text with an optional maximum character length.",
89
- args: [{
90
- kind: "value",
91
- dataType: PG_SIZE_TYPE,
92
- name: "length",
93
- optional: true
94
- }],
95
- output: {
96
- codecId: "sql/varchar@1",
97
- typeParams: { length: {
98
- kind: "arg",
99
- index: 0
100
- } }
101
- }
143
+ Varchar: {
144
+ ...varchar,
145
+ inferred: true
102
146
  },
103
147
  Char: {
104
148
  kind: "typeConstructor",
105
149
  inferred: true,
106
- documentation: "Fixed-length, blank-padded text with an optional character length.",
107
- args: [{
108
- kind: "value",
109
- dataType: PG_SIZE_TYPE,
110
- name: "length",
111
- optional: true
112
- }],
150
+ documentation: "Fixed-length, blank-padded text stored as PostgreSQL character, with an optional character length.",
151
+ args: [length],
113
152
  output: {
114
153
  codecId: "sql/char@1",
115
154
  typeParams: { length: {
@@ -118,34 +157,29 @@ const postgresNativeAuthoringTypes = {
118
157
  } }
119
158
  }
120
159
  },
121
- Numeric: {
160
+ Bool: {
122
161
  kind: "typeConstructor",
123
162
  inferred: true,
124
- documentation: "An exact decimal value with optional precision and scale.",
125
- args: [{
126
- kind: "value",
127
- dataType: PG_SIZE_TYPE,
128
- name: "precision",
129
- optional: true
130
- }, {
131
- kind: "value",
132
- dataType: PG_SIZE_TYPE,
133
- name: "scale",
134
- optional: true
135
- }],
136
- output: {
137
- codecId: "pg/numeric@1",
138
- typeParams: {
139
- precision: {
140
- kind: "arg",
141
- index: 0
142
- },
143
- scale: {
144
- kind: "arg",
145
- index: 1
146
- }
147
- }
148
- }
163
+ documentation: "A true or false value stored as PostgreSQL bool.",
164
+ output: { codecId: "pg/bool@1" }
165
+ },
166
+ Bytea: {
167
+ kind: "typeConstructor",
168
+ inferred: true,
169
+ documentation: "Binary data stored as PostgreSQL bytea and represented as a Uint8Array.",
170
+ output: { codecId: "pg/bytea@1" }
171
+ },
172
+ Json: {
173
+ kind: "typeConstructor",
174
+ inferred: true,
175
+ documentation: "A JSON value stored as PostgreSQL json.",
176
+ output: { codecId: "pg/json@1" }
177
+ },
178
+ Jsonb: {
179
+ kind: "typeConstructor",
180
+ inferred: true,
181
+ documentation: "A JSON value stored in PostgreSQL binary jsonb format.",
182
+ output: { codecId: "pg/jsonb@1" }
149
183
  },
150
184
  TimestampTemporal: {
151
185
  kind: "typeConstructor",
@@ -228,18 +262,6 @@ const postgresNativeAuthoringTypes = {
228
262
  documentation: "An IPv4 or IPv6 address with an optional subnet mask.",
229
263
  output: { codecId: "pg/inet@1" }
230
264
  },
231
- SmallInt: {
232
- kind: "typeConstructor",
233
- inferred: true,
234
- documentation: "A signed 16-bit integer represented as a JavaScript number.",
235
- output: { codecId: "pg/int2@1" }
236
- },
237
- Real: {
238
- kind: "typeConstructor",
239
- inferred: true,
240
- documentation: "A single-precision floating-point number.",
241
- output: { codecId: "pg/float4@1" }
242
- },
243
265
  DateTemporal: {
244
266
  kind: "typeConstructor",
245
267
  documentation: "A calendar date represented as Temporal.PlainDate.",
@@ -374,23 +396,9 @@ const postgresNativeAuthoringTypes = {
374
396
  } }
375
397
  }
376
398
  },
377
- VarBit: {
378
- kind: "typeConstructor",
379
- inferred: true,
380
- documentation: "A variable-length bit string with an optional maximum length in bits.",
381
- args: [{
382
- kind: "value",
383
- dataType: PG_SIZE_TYPE,
384
- name: "length",
385
- optional: true
386
- }],
387
- output: {
388
- codecId: "pg/varbit@1",
389
- typeParams: { length: {
390
- kind: "arg",
391
- index: 0
392
- } }
393
- }
399
+ Varbit: {
400
+ ...varbit,
401
+ inferred: true
394
402
  },
395
403
  Xml: {
396
404
  kind: "typeConstructor",
@@ -446,6 +454,39 @@ const postgresNativeAuthoringTypes = {
446
454
  }
447
455
  }
448
456
  };
457
+ /**
458
+ * The explicit types' former names, kept for one release line as deprecated aliases. Each gives the same codec as its replacement, and the PSL interpreter warns where one is written (ADR 257).
459
+ */
460
+ const postgresDeprecatedScalarTypes = {
461
+ SmallInt: {
462
+ ...int2,
463
+ deprecated: { replacement: "Int2" }
464
+ },
465
+ BigIntNumber: {
466
+ ...int8Number,
467
+ deprecated: { replacement: "Int8Number" }
468
+ },
469
+ Numeric: {
470
+ ...numericString,
471
+ deprecated: { replacement: "NumericString" }
472
+ },
473
+ UnboundedInt: {
474
+ ...numericBigInt,
475
+ deprecated: { replacement: "NumericBigInt" }
476
+ },
477
+ Real: {
478
+ ...float4,
479
+ deprecated: { replacement: "Float4" }
480
+ },
481
+ VarChar: {
482
+ ...varchar,
483
+ deprecated: { replacement: "Varchar" }
484
+ },
485
+ VarBit: {
486
+ ...varbit,
487
+ deprecated: { replacement: "Varbit" }
488
+ }
489
+ };
449
490
  const precision = {
450
491
  kind: "value",
451
492
  dataType: PG_SIZE_TYPE,
@@ -637,12 +678,177 @@ const postgresConvenienceDateTimeTypes = {
637
678
  }
638
679
  };
639
680
  /**
640
- * The base scalars and native types as type constructors. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.
681
+ * The convenience types of PostgreSQL's other scalars. Each is a type choice: `storage` chooses the database type and, for `BigInt`, `as` chooses the application value; `precision`, `scale` and `length` are passed on to the explicit type chosen. ADR 279, ADR 316.
682
+ */
683
+ const postgresConvenienceScalarTypes = {
684
+ Int: {
685
+ kind: "typeChoice",
686
+ documentation: "An integer read as a JavaScript number. `storage` is int4, a 32-bit integer, or int2, a 16-bit integer.",
687
+ args: [{
688
+ kind: "option",
689
+ name: "storage",
690
+ values: ["int4", "int2"],
691
+ default: "int4",
692
+ optional: true
693
+ }],
694
+ choices: [{
695
+ when: { storage: "int4" },
696
+ type: "Int4"
697
+ }, {
698
+ when: { storage: "int2" },
699
+ type: "Int2"
700
+ }]
701
+ },
702
+ BigInt: {
703
+ kind: "typeChoice",
704
+ documentation: "An integer that may exceed 32 bits. `as` is what the application reads: bigint, or number within the safe integer range. `storage` is int8, a 64-bit integer, or numeric, an integer of any size, with as: bigint.",
705
+ args: [{
706
+ kind: "option",
707
+ name: "as",
708
+ values: ["bigint", "number"],
709
+ default: "bigint",
710
+ optional: true
711
+ }, {
712
+ kind: "option",
713
+ name: "storage",
714
+ values: ["int8", "numeric"],
715
+ default: "int8",
716
+ optional: true
717
+ }],
718
+ choices: [
719
+ {
720
+ when: {
721
+ as: "bigint",
722
+ storage: "int8"
723
+ },
724
+ type: "Int8BigInt"
725
+ },
726
+ {
727
+ when: {
728
+ as: "number",
729
+ storage: "int8"
730
+ },
731
+ type: "Int8Number"
732
+ },
733
+ {
734
+ when: {
735
+ as: "bigint",
736
+ storage: "numeric"
737
+ },
738
+ type: "NumericBigInt"
739
+ }
740
+ ]
741
+ },
742
+ Float: {
743
+ kind: "typeChoice",
744
+ documentation: "A floating-point number. `storage` is float8, double precision, or float4, single precision.",
745
+ args: [{
746
+ kind: "option",
747
+ name: "storage",
748
+ values: ["float8", "float4"],
749
+ default: "float8",
750
+ optional: true
751
+ }],
752
+ choices: [{
753
+ when: { storage: "float8" },
754
+ type: "Float8"
755
+ }, {
756
+ when: { storage: "float4" },
757
+ type: "Float4"
758
+ }]
759
+ },
760
+ Decimal: {
761
+ kind: "typeChoice",
762
+ documentation: "An exact decimal number, read as decimal text such as \"12.50\". `storage` is numeric, with optional precision and scale.",
763
+ args: [
764
+ {
765
+ kind: "option",
766
+ name: "storage",
767
+ values: ["numeric"],
768
+ default: "numeric",
769
+ optional: true
770
+ },
771
+ precision,
772
+ {
773
+ kind: "value",
774
+ dataType: PG_SIZE_TYPE,
775
+ name: "scale",
776
+ optional: true
777
+ }
778
+ ],
779
+ choices: [{
780
+ when: { storage: "numeric" },
781
+ type: "NumericString"
782
+ }]
783
+ },
784
+ String: {
785
+ kind: "typeChoice",
786
+ documentation: "Text. `storage` is text, of any length, or varchar or char, which take an optional length.",
787
+ args: [{
788
+ kind: "option",
789
+ name: "storage",
790
+ values: [
791
+ "text",
792
+ "varchar",
793
+ "char"
794
+ ],
795
+ default: "text",
796
+ optional: true
797
+ }, length],
798
+ choices: [
799
+ {
800
+ when: { storage: "text" },
801
+ type: "Text"
802
+ },
803
+ {
804
+ when: { storage: "varchar" },
805
+ type: "Varchar"
806
+ },
807
+ {
808
+ when: { storage: "char" },
809
+ type: "Char"
810
+ }
811
+ ]
812
+ },
813
+ Boolean: {
814
+ kind: "typeChoice",
815
+ documentation: "A true or false value. `storage` is bool.",
816
+ args: [{
817
+ kind: "option",
818
+ name: "storage",
819
+ values: ["bool"],
820
+ default: "bool",
821
+ optional: true
822
+ }],
823
+ choices: [{
824
+ when: { storage: "bool" },
825
+ type: "Bool"
826
+ }]
827
+ },
828
+ Bytes: {
829
+ kind: "typeChoice",
830
+ documentation: "Binary data, read as a Uint8Array. `storage` is bytea.",
831
+ args: [{
832
+ kind: "option",
833
+ name: "storage",
834
+ values: ["bytea"],
835
+ default: "bytea",
836
+ optional: true
837
+ }],
838
+ choices: [{
839
+ when: { storage: "bytea" },
840
+ type: "Bytea"
841
+ }]
842
+ }
843
+ };
844
+ /**
845
+ * PostgreSQL's scalar types: the explicit types, the convenience types and the deprecated aliases. It is not the whole `type` namespace: the target contributes it together with `postgresAuthoringTypes`, which adds the namespaced `sql.*`, `temporal.*` and `pg.enum` and the generated-ID aliases such as `UuidString`.
641
846
  */
642
- const postgresScalarAndNativeTypeConstructors = {
643
- ...postgresNativeAuthoringTypes,
644
- ...postgresScalarAuthoringTypes,
645
- ...postgresConvenienceDateTimeTypes
847
+ const postgresScalarTypes = {
848
+ ...postgresExplicitTypes,
849
+ ...postgresConvenienceDateTimeTypes,
850
+ ...postgresConvenienceScalarTypes,
851
+ ...postgresDeprecatedScalarTypes
646
852
  };
647
853
  const PSL_POLICY_INVALID_MAP = "PSL_POLICY_INVALID_MAP";
648
854
  const PSL_FULL_TEXT_INDEX_TOO_MANY_GROUPS = "PSL_FULL_TEXT_INDEX_TOO_MANY_GROUPS";
@@ -666,16 +872,6 @@ const PSL_ROLE_BLOCK_OUTSIDE_UNBOUND_NAMESPACE = "PSL_ROLE_BLOCK_OUTSIDE_UNBOUND
666
872
  const postgresAuthoringTypes = {
667
873
  .../* @__PURE__ */ sqlTargetTypeConstructors({ sizeType: PG_SIZE_TYPE }),
668
874
  ...generatedIdColumnAliases,
669
- BigIntNumber: {
670
- kind: "typeConstructor",
671
- documentation: "A PostgreSQL 64-bit integer represented as a JavaScript number within its safe integer range.",
672
- output: { codecId: "pg/int8number@1" }
673
- },
674
- UnboundedInt: {
675
- kind: "typeConstructor",
676
- documentation: "An arbitrary-precision integer stored as PostgreSQL numeric and represented as bigint.",
677
- output: { codecId: "pg/unboundedint@1" }
678
- },
679
875
  pg: { enum: {
680
876
  kind: "typeConstructor",
681
877
  inferred: true,
@@ -1069,7 +1265,7 @@ const postgresAuthoringPslBlockDescriptors = {
1069
1265
  extension: {
1070
1266
  kind: "pslBlock",
1071
1267
  keyword: "extension",
1072
- documentation: "Declares a PostgreSQL extension the database must have installed, in the schema of the enclosing namespace.",
1268
+ documentation: "Declares a PostgreSQL extension the database must have installed, in the schema of the enclosing namespace. In `namespace unbound`, the extension is found through the connection's search path.",
1073
1269
  discriminator: "extension",
1074
1270
  name: { required: true },
1075
1271
  spec: extensionSpec
@@ -1270,7 +1466,8 @@ function postgresLowerEntityHandles(input) {
1270
1466
  } });
1271
1467
  if (declaredIn !== void 0) {
1272
1468
  const namespaces = [declaredIn, namespaceId].sort();
1273
- throw postgresError("CONTRACT.NAME_DUPLICATE", `defineContract: extension "${extensionHandle.name}" is declared in namespaces ${namespaces.map((id) => `"${id}"`).join(" and ")}; declare it in one namespace only.`, { meta: {
1469
+ const namespaceNames = namespaces.map((id) => id === UNBOUND_NAMESPACE_ID ? UNBOUND_PSL_NAMESPACE_NAME : id);
1470
+ throw postgresError("CONTRACT.NAME_DUPLICATE", `defineContract: extension "${extensionHandle.name}" is declared in namespaces ${namespaceNames.sort().map((name) => `"${name}"`).join(" and ")}; declare it in one namespace only.`, { meta: {
1274
1471
  kind: "extension",
1275
1472
  name: extensionHandle.name,
1276
1473
  namespaces
@@ -1339,6 +1536,6 @@ function postgresLowerEntityHandles(input) {
1339
1536
  return rows;
1340
1537
  }
1341
1538
  //#endregion
1342
- export { postgresAuthoringTypes as a, postgresScalarAndNativeTypeConstructors as c, postgresAuthoringPslBlockDescriptors as i, postgresScalarAuthoringTypes as l, postgresAuthoringEntityTypes as n, postgresLowerEntityHandles as o, postgresAuthoringModelAttributes as r, postgresNativeAuthoringTypes as s, POLICY_BLOCK_KEYWORDS as t };
1539
+ export { postgresAuthoringTypes as a, postgresScalarTypes as c, postgresAuthoringPslBlockDescriptors as i, postgresAuthoringEntityTypes as n, postgresExplicitTypes as o, postgresAuthoringModelAttributes as r, postgresLowerEntityHandles as s, POLICY_BLOCK_KEYWORDS as t };
1343
1540
 
1344
- //# sourceMappingURL=authoring-BLKmfwFy-DRwqGgGY.mjs.map
1541
+ //# sourceMappingURL=authoring-BD4uEpBM-DIJiGq4e.mjs.map