neon 2.1.1 → 2.29.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 (166) hide show
  1. package/LICENSE.md +178 -0
  2. package/README.md +601 -0
  3. package/dist/analytics.js +156 -0
  4. package/dist/api.js +665 -0
  5. package/dist/auth.js +127 -0
  6. package/dist/callback.html +51 -0
  7. package/dist/cli.js +9 -0
  8. package/dist/commands/auth.js +214 -0
  9. package/dist/commands/bootstrap.js +481 -0
  10. package/dist/commands/branches.js +481 -0
  11. package/dist/commands/bucket.js +543 -0
  12. package/dist/commands/checkout.js +289 -0
  13. package/dist/commands/config.js +544 -0
  14. package/dist/commands/connection_string.js +172 -0
  15. package/dist/commands/data_api.js +285 -0
  16. package/dist/commands/databases.js +82 -0
  17. package/dist/commands/deploy.js +26 -0
  18. package/dist/commands/dev.js +698 -0
  19. package/dist/commands/env.js +166 -0
  20. package/dist/commands/functions.js +373 -0
  21. package/dist/commands/index.js +54 -0
  22. package/dist/commands/init.js +73 -0
  23. package/dist/commands/ip_allow.js +137 -0
  24. package/dist/commands/link.js +1121 -0
  25. package/dist/commands/neon_auth.js +1028 -0
  26. package/dist/commands/operations.js +28 -0
  27. package/dist/commands/orgs.js +24 -0
  28. package/dist/commands/projects.js +372 -0
  29. package/dist/commands/psql.js +62 -0
  30. package/dist/commands/roles.js +65 -0
  31. package/dist/commands/schema_diff.js +151 -0
  32. package/dist/commands/set_context.js +29 -0
  33. package/dist/commands/status.js +40 -0
  34. package/dist/commands/user.js +15 -0
  35. package/dist/commands/vpc_endpoints.js +134 -0
  36. package/dist/config.js +11 -0
  37. package/dist/config_format.js +72 -0
  38. package/dist/context.js +177 -0
  39. package/dist/current_branch_fast_path.js +55 -0
  40. package/dist/dev/env.js +240 -0
  41. package/dist/dev/functions.js +70 -0
  42. package/dist/dev/inputs.js +63 -0
  43. package/dist/dev/runtime.js +146 -0
  44. package/dist/env.js +36 -0
  45. package/dist/env_file.js +159 -0
  46. package/dist/errors.js +80 -0
  47. package/dist/functions_api.js +44 -0
  48. package/dist/help.js +146 -0
  49. package/dist/index.js +234 -0
  50. package/dist/log.js +18 -0
  51. package/dist/parameters.gen.js +480 -0
  52. package/dist/pkg.js +25 -0
  53. package/dist/psql/cli.js +53 -0
  54. package/dist/psql/command/cmd_cond.js +437 -0
  55. package/dist/psql/command/cmd_connect.js +820 -0
  56. package/dist/psql/command/cmd_copy.js +1035 -0
  57. package/dist/psql/command/cmd_describe.js +1815 -0
  58. package/dist/psql/command/cmd_format.js +922 -0
  59. package/dist/psql/command/cmd_io.js +2193 -0
  60. package/dist/psql/command/cmd_lo.js +393 -0
  61. package/dist/psql/command/cmd_meta.js +970 -0
  62. package/dist/psql/command/cmd_misc.js +187 -0
  63. package/dist/psql/command/cmd_pipeline.js +1148 -0
  64. package/dist/psql/command/cmd_restrict.js +171 -0
  65. package/dist/psql/command/cmd_show.js +766 -0
  66. package/dist/psql/command/dispatch.js +343 -0
  67. package/dist/psql/command/inputQueue.js +42 -0
  68. package/dist/psql/command/shared.js +71 -0
  69. package/dist/psql/complete/filenames.js +139 -0
  70. package/dist/psql/complete/index.js +104 -0
  71. package/dist/psql/complete/matcher.js +315 -0
  72. package/dist/psql/complete/psqlVars.js +247 -0
  73. package/dist/psql/complete/queries.js +493 -0
  74. package/dist/psql/complete/rules.js +2424 -0
  75. package/dist/psql/core/common.js +1253 -0
  76. package/dist/psql/core/help.js +576 -0
  77. package/dist/psql/core/mainloop.js +1360 -0
  78. package/dist/psql/core/prompt.js +440 -0
  79. package/dist/psql/core/settings.js +684 -0
  80. package/dist/psql/core/sqlHelp.js +1066 -0
  81. package/dist/psql/core/startup.js +846 -0
  82. package/dist/psql/core/syncVars.js +116 -0
  83. package/dist/psql/core/variables.js +287 -0
  84. package/dist/psql/describe/formatters.js +1290 -0
  85. package/dist/psql/describe/processNamePattern.js +270 -0
  86. package/dist/psql/describe/queries.js +2378 -0
  87. package/dist/psql/describe/versionGate.js +43 -0
  88. package/dist/psql/index.js +2030 -0
  89. package/dist/psql/io/history.js +299 -0
  90. package/dist/psql/io/input.js +120 -0
  91. package/dist/psql/io/lineEditor/buffer.js +325 -0
  92. package/dist/psql/io/lineEditor/complete.js +227 -0
  93. package/dist/psql/io/lineEditor/filename.js +159 -0
  94. package/dist/psql/io/lineEditor/index.js +894 -0
  95. package/dist/psql/io/lineEditor/keymap.js +745 -0
  96. package/dist/psql/io/lineEditor/vt100.js +363 -0
  97. package/dist/psql/io/pgpass.js +202 -0
  98. package/dist/psql/io/pgservice.js +194 -0
  99. package/dist/psql/io/psqlrc.js +422 -0
  100. package/dist/psql/print/aligned.js +1765 -0
  101. package/dist/psql/print/asciidoc.js +248 -0
  102. package/dist/psql/print/crosstab.js +463 -0
  103. package/dist/psql/print/csv.js +95 -0
  104. package/dist/psql/print/html.js +258 -0
  105. package/dist/psql/print/json.js +96 -0
  106. package/dist/psql/print/latex.js +396 -0
  107. package/dist/psql/print/pager.js +267 -0
  108. package/dist/psql/print/troff.js +258 -0
  109. package/dist/psql/print/unaligned.js +119 -0
  110. package/dist/psql/print/units.js +135 -0
  111. package/dist/psql/scanner/slash.js +515 -0
  112. package/dist/psql/scanner/sql.js +914 -0
  113. package/dist/psql/scanner/stringutils.js +394 -0
  114. package/dist/psql/types/backslash.js +1 -0
  115. package/dist/psql/types/connection.js +1 -0
  116. package/dist/psql/types/index.js +7 -0
  117. package/dist/psql/types/printer.js +1 -0
  118. package/dist/psql/types/repl.js +1 -0
  119. package/dist/psql/types/scanner.js +24 -0
  120. package/dist/psql/types/settings.js +1 -0
  121. package/dist/psql/types/variables.js +1 -0
  122. package/dist/psql/wire/connection.js +2858 -0
  123. package/dist/psql/wire/copy.js +108 -0
  124. package/dist/psql/wire/notify.js +59 -0
  125. package/dist/psql/wire/pipeline.js +521 -0
  126. package/dist/psql/wire/protocol.js +466 -0
  127. package/dist/psql/wire/sasl.js +296 -0
  128. package/dist/psql/wire/tls.js +602 -0
  129. package/dist/storage_api.js +147 -0
  130. package/dist/test_utils/fixtures.js +122 -0
  131. package/dist/test_utils/oauth_server.js +9 -0
  132. package/dist/types.js +1 -0
  133. package/dist/utils/api_enums.js +33 -0
  134. package/dist/utils/auth.js +5 -0
  135. package/dist/utils/branch_notice.js +22 -0
  136. package/dist/utils/branch_picker.js +103 -0
  137. package/dist/utils/compute_units.js +28 -0
  138. package/dist/utils/enrichers.js +161 -0
  139. package/dist/utils/esbuild.js +158 -0
  140. package/dist/utils/formats.js +18 -0
  141. package/dist/utils/middlewares.js +20 -0
  142. package/dist/utils/package_manager.js +68 -0
  143. package/dist/utils/point_in_time.js +56 -0
  144. package/dist/utils/psql.js +120 -0
  145. package/dist/utils/string.js +5 -0
  146. package/dist/utils/ui.js +59 -0
  147. package/dist/utils/zip.js +4 -0
  148. package/dist/writer.js +97 -0
  149. package/package.json +117 -14
  150. package/.jshintrc +0 -3
  151. package/CHANGELOG.markdown +0 -22
  152. package/LICENSE +0 -21
  153. package/README.markdown +0 -76
  154. package/bower.json +0 -23
  155. package/license.txt +0 -9
  156. package/neon.js +0 -234
  157. package/stdlib/bubbling_support.js +0 -32
  158. package/stdlib/custom_event.js +0 -54
  159. package/stdlib/custom_event_support.js +0 -195
  160. package/stdlib/index.js +0 -7
  161. package/stdlib/node_support.js +0 -123
  162. package/stdlib/widget.js +0 -340
  163. package/test/neon_browser.html +0 -11
  164. package/test/neon_stdlib_browser.html +0 -15
  165. package/test/neon_stdlib_test.js +0 -84
  166. package/test/neon_test.js +0 -64
@@ -0,0 +1,480 @@
1
+ // FILE IS GENERATED, DO NOT EDIT
2
+ export const projectCreateRequest = {
3
+ 'project.settings.quota.active_time_seconds': {
4
+ type: "number",
5
+ description: "The total amount of wall-clock time allowed to be spent by the project's compute endpoints.\n",
6
+ demandOption: false,
7
+ },
8
+ 'project.settings.quota.compute_time_seconds': {
9
+ type: "number",
10
+ description: "The total amount of CPU seconds allowed to be spent by the project's compute endpoints.\n",
11
+ demandOption: false,
12
+ },
13
+ 'project.settings.quota.written_data_bytes': {
14
+ type: "number",
15
+ description: "Total amount of data written to all of a project's branches.\n",
16
+ demandOption: false,
17
+ },
18
+ 'project.settings.quota.data_transfer_bytes': {
19
+ type: "number",
20
+ description: "Total amount of data transferred from all of a project's branches using the proxy.\n",
21
+ demandOption: false,
22
+ },
23
+ 'project.settings.quota.logical_size_bytes': {
24
+ type: "number",
25
+ description: "Limit on the logical size of every project's branch.\n\nIf a branch exceeds its `logical_size_bytes` quota, computes can still be started,\nbut write operations will fail—allowing data to be deleted to free up space.\nComputes on other branches are not affected.\n\nSetting `logical_size_bytes` overrides any lower value set by the `neon.max_cluster_size` Postgres setting.\n",
26
+ demandOption: false,
27
+ },
28
+ 'project.settings.allowed_ips.ips': {
29
+ type: "array",
30
+ description: "A list of IP addresses that are allowed to connect to the endpoint.",
31
+ demandOption: false,
32
+ },
33
+ 'project.settings.allowed_ips.protected_branches_only': {
34
+ type: "boolean",
35
+ description: "If true, the list will be applied only to protected branches.",
36
+ demandOption: false,
37
+ },
38
+ 'project.settings.enable_logical_replication': {
39
+ type: "boolean",
40
+ description: "Sets wal_level=logical for all compute endpoints in this project.\nAll active endpoints will be suspended.\nOnce enabled, logical replication cannot be disabled.\n",
41
+ demandOption: false,
42
+ },
43
+ 'project.settings.maintenance_window.weekdays': {
44
+ type: "array",
45
+ description: "A list of weekdays when the maintenance window is active.\nEncoded as ints, where 1 - Monday, and 7 - Sunday.\n",
46
+ demandOption: true,
47
+ },
48
+ 'project.settings.maintenance_window.start_time': {
49
+ type: "string",
50
+ description: "Start time of the maintenance window, in the format of \"HH:MM\". Uses UTC.\n",
51
+ demandOption: true,
52
+ },
53
+ 'project.settings.maintenance_window.end_time': {
54
+ type: "string",
55
+ description: "End time of the maintenance window, in the format of \"HH:MM\". Uses UTC.\n",
56
+ demandOption: true,
57
+ },
58
+ 'project.settings.block_public_connections': {
59
+ type: "boolean",
60
+ description: "When set, connections from the public internet\nare disallowed. This supersedes the AllowedIPs list.\nThis parameter is under active development and its semantics may change in the future.\n",
61
+ demandOption: false,
62
+ },
63
+ 'project.settings.block_vpc_connections': {
64
+ type: "boolean",
65
+ description: "When set, connections using VPC endpoints are disallowed.\nThis parameter is under active development and its semantics may change in the future.\n",
66
+ demandOption: false,
67
+ },
68
+ 'project.settings.audit_log_level': {
69
+ type: "string",
70
+ description: undefined,
71
+ demandOption: false,
72
+ choices: ["base", "extended", "full"],
73
+ },
74
+ 'project.settings.hipaa': {
75
+ type: "boolean",
76
+ description: undefined,
77
+ demandOption: false,
78
+ },
79
+ 'project.settings.preload_libraries.use_defaults': {
80
+ type: "boolean",
81
+ description: undefined,
82
+ demandOption: false,
83
+ },
84
+ 'project.settings.preload_libraries.enabled_libraries': {
85
+ type: "array",
86
+ description: undefined,
87
+ demandOption: false,
88
+ },
89
+ 'project.name': {
90
+ type: "string",
91
+ description: "The project name. If not specified, the name will be identical to the generated project ID",
92
+ demandOption: false,
93
+ },
94
+ 'project.branch.name': {
95
+ type: "string",
96
+ description: "The default branch name. If not specified, the default branch name, `main`, will be used.\n",
97
+ demandOption: false,
98
+ },
99
+ 'project.branch.role_name': {
100
+ type: "string",
101
+ description: "The role name. If not specified, the default role name, `{database_name}_owner`, will be used.\n",
102
+ demandOption: false,
103
+ },
104
+ 'project.branch.database_name': {
105
+ type: "string",
106
+ description: "The database name. If not specified, the default database name, `neondb`, will be used.\n",
107
+ demandOption: false,
108
+ },
109
+ 'project.provisioner': {
110
+ type: "string",
111
+ description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n\nProvisioner can be one of the following values:\n* k8s-pod\n* k8s-neonvm\n* serverless-platform\n\nClients must expect, that any string value that is not documented in the description above should be treated as a error. UNKNOWN value if safe to treat as an error too.\n",
112
+ demandOption: false,
113
+ },
114
+ 'project.region_id': {
115
+ type: "string",
116
+ description: "The region identifier. Refer to our [Regions](https://neon.com/docs/introduction/regions) documentation for supported regions. Values are specified in this format: `aws-us-east-1`\n",
117
+ demandOption: false,
118
+ },
119
+ 'project.default_endpoint_settings.suspend_timeout_seconds': {
120
+ type: "number",
121
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the default value.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe minimum value is `60` seconds (1 minute).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Scale to zero configuration](https://neon.com/docs/manage/endpoints#scale-to-zero-configuration).\n",
122
+ demandOption: false,
123
+ },
124
+ 'project.pg_version': {
125
+ type: "number",
126
+ description: "The major Postgres version number. Currently supported versions are `14`, `15`, `16`, `17`, and `18`.",
127
+ demandOption: false,
128
+ },
129
+ 'project.store_passwords': {
130
+ type: "boolean",
131
+ description: "Whether or not passwords are stored for roles in the Neon project. Storing passwords facilitates access to Neon features that require authorization.\n",
132
+ demandOption: false,
133
+ },
134
+ 'project.history_retention_seconds': {
135
+ type: "number",
136
+ description: "The number of seconds to retain the shared history for all branches in this project.\nThe default is 1 day (86400 seconds).\n",
137
+ demandOption: false,
138
+ },
139
+ 'project.org_id': {
140
+ type: "string",
141
+ description: "Organization id in case the project created belongs to an organization.\nIf not present, project is owned by a user and not by org.\n",
142
+ demandOption: false,
143
+ },
144
+ };
145
+ export const projectUpdateRequest = {
146
+ 'project.settings.quota.active_time_seconds': {
147
+ type: "number",
148
+ description: "The total amount of wall-clock time allowed to be spent by the project's compute endpoints.\n",
149
+ demandOption: false,
150
+ },
151
+ 'project.settings.quota.compute_time_seconds': {
152
+ type: "number",
153
+ description: "The total amount of CPU seconds allowed to be spent by the project's compute endpoints.\n",
154
+ demandOption: false,
155
+ },
156
+ 'project.settings.quota.written_data_bytes': {
157
+ type: "number",
158
+ description: "Total amount of data written to all of a project's branches.\n",
159
+ demandOption: false,
160
+ },
161
+ 'project.settings.quota.data_transfer_bytes': {
162
+ type: "number",
163
+ description: "Total amount of data transferred from all of a project's branches using the proxy.\n",
164
+ demandOption: false,
165
+ },
166
+ 'project.settings.quota.logical_size_bytes': {
167
+ type: "number",
168
+ description: "Limit on the logical size of every project's branch.\n\nIf a branch exceeds its `logical_size_bytes` quota, computes can still be started,\nbut write operations will fail—allowing data to be deleted to free up space.\nComputes on other branches are not affected.\n\nSetting `logical_size_bytes` overrides any lower value set by the `neon.max_cluster_size` Postgres setting.\n",
169
+ demandOption: false,
170
+ },
171
+ 'project.settings.allowed_ips.ips': {
172
+ type: "array",
173
+ description: "A list of IP addresses that are allowed to connect to the endpoint.",
174
+ demandOption: false,
175
+ },
176
+ 'project.settings.allowed_ips.protected_branches_only': {
177
+ type: "boolean",
178
+ description: "If true, the list will be applied only to protected branches.",
179
+ demandOption: false,
180
+ },
181
+ 'project.settings.enable_logical_replication': {
182
+ type: "boolean",
183
+ description: "Sets wal_level=logical for all compute endpoints in this project.\nAll active endpoints will be suspended.\nOnce enabled, logical replication cannot be disabled.\n",
184
+ demandOption: false,
185
+ },
186
+ 'project.settings.maintenance_window.weekdays': {
187
+ type: "array",
188
+ description: "A list of weekdays when the maintenance window is active.\nEncoded as ints, where 1 - Monday, and 7 - Sunday.\n",
189
+ demandOption: true,
190
+ },
191
+ 'project.settings.maintenance_window.start_time': {
192
+ type: "string",
193
+ description: "Start time of the maintenance window, in the format of \"HH:MM\". Uses UTC.\n",
194
+ demandOption: true,
195
+ },
196
+ 'project.settings.maintenance_window.end_time': {
197
+ type: "string",
198
+ description: "End time of the maintenance window, in the format of \"HH:MM\". Uses UTC.\n",
199
+ demandOption: true,
200
+ },
201
+ 'project.settings.block_public_connections': {
202
+ type: "boolean",
203
+ description: "When set, connections from the public internet\nare disallowed. This supersedes the AllowedIPs list.\nThis parameter is under active development and its semantics may change in the future.\n",
204
+ demandOption: false,
205
+ },
206
+ 'project.settings.block_vpc_connections': {
207
+ type: "boolean",
208
+ description: "When set, connections using VPC endpoints are disallowed.\nThis parameter is under active development and its semantics may change in the future.\n",
209
+ demandOption: false,
210
+ },
211
+ 'project.settings.audit_log_level': {
212
+ type: "string",
213
+ description: undefined,
214
+ demandOption: false,
215
+ choices: ["base", "extended", "full"],
216
+ },
217
+ 'project.settings.hipaa': {
218
+ type: "boolean",
219
+ description: undefined,
220
+ demandOption: false,
221
+ },
222
+ 'project.settings.preload_libraries.use_defaults': {
223
+ type: "boolean",
224
+ description: undefined,
225
+ demandOption: false,
226
+ },
227
+ 'project.settings.preload_libraries.enabled_libraries': {
228
+ type: "array",
229
+ description: undefined,
230
+ demandOption: false,
231
+ },
232
+ 'project.name': {
233
+ type: "string",
234
+ description: "The project name",
235
+ demandOption: false,
236
+ },
237
+ 'project.default_endpoint_settings.suspend_timeout_seconds': {
238
+ type: "number",
239
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the default value.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe minimum value is `60` seconds (1 minute).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Scale to zero configuration](https://neon.com/docs/manage/endpoints#scale-to-zero-configuration).\n",
240
+ demandOption: false,
241
+ },
242
+ 'project.history_retention_seconds': {
243
+ type: "number",
244
+ description: "The number of seconds to retain the shared history for all branches in this project.\nThe default is 1 day (604800 seconds).\n",
245
+ demandOption: false,
246
+ },
247
+ };
248
+ export const branchCreateRequest = {
249
+ 'endpoints': {
250
+ type: "array",
251
+ description: undefined,
252
+ demandOption: false,
253
+ },
254
+ 'branch.parent_id': {
255
+ type: "string",
256
+ description: "The `branch_id` of the parent branch. If omitted or empty, the branch will be created from the project's default branch.\n",
257
+ demandOption: false,
258
+ },
259
+ 'branch.name': {
260
+ type: "string",
261
+ description: "The branch name\n",
262
+ demandOption: false,
263
+ },
264
+ 'branch.parent_lsn': {
265
+ type: "string",
266
+ description: "A Log Sequence Number (LSN) on the parent branch. The branch will be created with data from this LSN.\n",
267
+ demandOption: false,
268
+ },
269
+ 'branch.parent_timestamp': {
270
+ type: "string",
271
+ description: "A timestamp identifying a point in time on the parent branch. The branch will be created with data starting from this point in time.\nThe timestamp must be provided in ISO 8601 format; for example: `2024-02-26T12:00:00Z`.\n",
272
+ demandOption: false,
273
+ },
274
+ 'branch.protected': {
275
+ type: "boolean",
276
+ description: "Whether the branch is protected\n",
277
+ demandOption: false,
278
+ },
279
+ 'branch.archived': {
280
+ type: "boolean",
281
+ description: "Whether to create the branch as archived\n",
282
+ demandOption: false,
283
+ },
284
+ 'branch.init_source': {
285
+ type: "string",
286
+ description: "The source of initialization for the branch. Valid values are `schema-only` and `parent-data` (default).\n * `schema-only` - creates a new root branch containing only the schema. Use `parent_id` to specify the source branch. Optionally, you can provide `parent_lsn` or `parent_timestamp` to branch from a specific point in time or LSN. These fields define which branch to copy the schema from and at what point—they do not establish a parent-child relationship between the `parent_id` branch and the new schema-only branch.\n * `parent-data` - creates the branch with both schema and data from the parent.\n",
287
+ demandOption: false,
288
+ },
289
+ 'branch.expires_at': {
290
+ type: "string",
291
+ description: "The timestamp when the branch is scheduled to expire and be automatically deleted. Must be set by the client following the [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6) format with precision up to seconds (such as 2025-06-09T18:02:16Z). Deletion is performed by a background job and may not occur exactly at the specified time.\n\nAccess to this feature is currently limited to participants in the Early Access Program.\n",
292
+ demandOption: false,
293
+ },
294
+ };
295
+ export const branchCreateRequestEndpointOptions = {
296
+ 'type': {
297
+ type: "string",
298
+ description: "The compute endpoint type. Either `read_write` or `read_only`.\n",
299
+ demandOption: true,
300
+ choices: ["read_only", "read_write"],
301
+ },
302
+ 'settings.preload_libraries.use_defaults': {
303
+ type: "boolean",
304
+ description: undefined,
305
+ demandOption: false,
306
+ },
307
+ 'settings.preload_libraries.enabled_libraries': {
308
+ type: "array",
309
+ description: undefined,
310
+ demandOption: false,
311
+ },
312
+ 'provisioner': {
313
+ type: "string",
314
+ description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n\nProvisioner can be one of the following values:\n* k8s-pod\n* k8s-neonvm\n* serverless-platform\n\nClients must expect, that any string value that is not documented in the description above should be treated as a error. UNKNOWN value if safe to treat as an error too.\n",
315
+ demandOption: false,
316
+ },
317
+ 'suspend_timeout_seconds': {
318
+ type: "number",
319
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the default value.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe minimum value is `60` seconds (1 minute).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Scale to zero configuration](https://neon.com/docs/manage/endpoints#scale-to-zero-configuration).\n",
320
+ demandOption: false,
321
+ },
322
+ };
323
+ export const branchUpdateRequest = {
324
+ 'branch.name': {
325
+ type: "string",
326
+ description: undefined,
327
+ demandOption: false,
328
+ },
329
+ 'branch.protected': {
330
+ type: "boolean",
331
+ description: undefined,
332
+ demandOption: false,
333
+ },
334
+ 'branch.expires_at': {
335
+ type: "string",
336
+ description: "The timestamp when the branch is scheduled to expire and be automatically deleted. Must be set by the client following the [RFC 3339, section 5.6](https://tools.ietf.org/html/rfc3339#section-5.6) format with precision up to seconds (such as 2025-06-09T18:02:16Z). Deletion is performed by a background job and may not occur exactly at the specified time. If this field is set to null, the expiration timestamp is removed.\n\nAccess to this feature is currently limited to participants in the Early Access Program.\n",
337
+ demandOption: false,
338
+ },
339
+ };
340
+ export const endpointCreateRequest = {
341
+ 'endpoint.branch_id': {
342
+ type: "string",
343
+ description: "The ID of the branch the compute endpoint will be associated with\n",
344
+ demandOption: true,
345
+ },
346
+ 'endpoint.region_id': {
347
+ type: "string",
348
+ description: "The region where the compute endpoint will be created. Only the project's `region_id` is permitted.\n",
349
+ demandOption: false,
350
+ },
351
+ 'endpoint.type': {
352
+ type: "string",
353
+ description: "The compute endpoint type. Either `read_write` or `read_only`.\n",
354
+ demandOption: true,
355
+ choices: ["read_only", "read_write"],
356
+ },
357
+ 'endpoint.settings.preload_libraries.use_defaults': {
358
+ type: "boolean",
359
+ description: undefined,
360
+ demandOption: false,
361
+ },
362
+ 'endpoint.settings.preload_libraries.enabled_libraries': {
363
+ type: "array",
364
+ description: undefined,
365
+ demandOption: false,
366
+ },
367
+ 'endpoint.provisioner': {
368
+ type: "string",
369
+ description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n\nProvisioner can be one of the following values:\n* k8s-pod\n* k8s-neonvm\n* serverless-platform\n\nClients must expect, that any string value that is not documented in the description above should be treated as a error. UNKNOWN value if safe to treat as an error too.\n",
370
+ demandOption: false,
371
+ },
372
+ 'endpoint.pooler_enabled': {
373
+ type: "boolean",
374
+ description: "DEPRECATED. Whether to enable connection pooling for the compute endpoint.\nThe recommended way to enable connection pooling is to append `-pooler` to the endpoint ID in the connection string.\nSee [How to use connection pooling](https://neon.com/docs/connect/connection-pooling#how-to-use-connection-pooling)\n",
375
+ demandOption: false,
376
+ },
377
+ 'endpoint.pooler_mode': {
378
+ type: "string",
379
+ description: "DEPRECATED. The connection pooler mode. This field is deprecated and will be removed after 2026-06-20.\n",
380
+ demandOption: false,
381
+ choices: ["transaction"],
382
+ },
383
+ 'endpoint.disabled': {
384
+ type: "boolean",
385
+ description: "Whether to restrict connections to the compute endpoint.\nEnabling this option schedules a suspend compute operation.\nA disabled compute endpoint cannot be enabled by a connection or\nconsole action. However, the compute endpoint is periodically\nenabled by check_availability operations.\n",
386
+ demandOption: false,
387
+ },
388
+ 'endpoint.passwordless_access': {
389
+ type: "boolean",
390
+ description: "NOT YET IMPLEMENTED. Whether to permit passwordless access to the compute endpoint.\n",
391
+ demandOption: false,
392
+ },
393
+ 'endpoint.suspend_timeout_seconds': {
394
+ type: "number",
395
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the default value.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe minimum value is `60` seconds (1 minute).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Scale to zero configuration](https://neon.com/docs/manage/endpoints#scale-to-zero-configuration).\n",
396
+ demandOption: false,
397
+ },
398
+ 'endpoint.name': {
399
+ type: "string",
400
+ description: "Optional name of the compute endpoint\n",
401
+ demandOption: false,
402
+ },
403
+ };
404
+ export const endpointUpdateRequest = {
405
+ 'endpoint.branch_id': {
406
+ type: "string",
407
+ description: "DEPRECATED: This field will be removed in a future release.\nThe destination branch ID. The destination branch must not have an existing read-write endpoint.\n",
408
+ demandOption: false,
409
+ },
410
+ 'endpoint.provisioner': {
411
+ type: "string",
412
+ description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n\nProvisioner can be one of the following values:\n* k8s-pod\n* k8s-neonvm\n* serverless-platform\n\nClients must expect, that any string value that is not documented in the description above should be treated as a error. UNKNOWN value if safe to treat as an error too.\n",
413
+ demandOption: false,
414
+ },
415
+ 'endpoint.settings.preload_libraries.use_defaults': {
416
+ type: "boolean",
417
+ description: undefined,
418
+ demandOption: false,
419
+ },
420
+ 'endpoint.settings.preload_libraries.enabled_libraries': {
421
+ type: "array",
422
+ description: undefined,
423
+ demandOption: false,
424
+ },
425
+ 'endpoint.pooler_enabled': {
426
+ type: "boolean",
427
+ description: "DEPRECATED. Whether to enable connection pooling for the compute endpoint.\nThe recommended way to enable connection pooling is to append `-pooler` to the endpoint ID in the connection string.\nSee [How to use connection pooling](https://neon.com/docs/connect/connection-pooling#how-to-use-connection-pooling)\n",
428
+ demandOption: false,
429
+ },
430
+ 'endpoint.pooler_mode': {
431
+ type: "string",
432
+ description: "DEPRECATED. The connection pooler mode. This field is deprecated and will be removed after 2026-06-20.\n",
433
+ demandOption: false,
434
+ choices: ["transaction"],
435
+ },
436
+ 'endpoint.disabled': {
437
+ type: "boolean",
438
+ description: "Whether to restrict connections to the compute endpoint.\nEnabling this option schedules a suspend compute operation.\nA disabled compute endpoint cannot be enabled by a connection or\nconsole action. However, the compute endpoint is periodically\nenabled by check_availability operations.\n",
439
+ demandOption: false,
440
+ },
441
+ 'endpoint.passwordless_access': {
442
+ type: "boolean",
443
+ description: "NOT YET IMPLEMENTED. Whether to permit passwordless access to the compute endpoint.\n",
444
+ demandOption: false,
445
+ },
446
+ 'endpoint.suspend_timeout_seconds': {
447
+ type: "number",
448
+ description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the default value.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe minimum value is `60` seconds (1 minute).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Scale to zero configuration](https://neon.com/docs/manage/endpoints#scale-to-zero-configuration).\n",
449
+ demandOption: false,
450
+ },
451
+ 'endpoint.name': {
452
+ type: "string",
453
+ description: "Optional name of the compute endpoint\n",
454
+ demandOption: false,
455
+ },
456
+ };
457
+ export const databaseCreateRequest = {
458
+ 'database.name': {
459
+ type: "string",
460
+ description: "The name of the database\n",
461
+ demandOption: true,
462
+ },
463
+ 'database.owner_name': {
464
+ type: "string",
465
+ description: "The name of the role that owns the database\n",
466
+ demandOption: true,
467
+ },
468
+ };
469
+ export const roleCreateRequest = {
470
+ 'role.name': {
471
+ type: "string",
472
+ description: "The role name. Cannot exceed 63 bytes in length.\n",
473
+ demandOption: true,
474
+ },
475
+ 'role.no_login': {
476
+ type: "boolean",
477
+ description: "Whether to create a role that cannot login.\n",
478
+ demandOption: false,
479
+ },
480
+ };
package/dist/pkg.js ADDED
@@ -0,0 +1,25 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ /**
5
+ * Load the CLI's package.json for version metadata. In the built CLI it sits right next to
6
+ * this module (the build copies it into `dist`); when running from source (tests, `tsx`) it
7
+ * does not, so we walk up to the nearest `package.json`. Both layouts resolve to the same
8
+ * file, keeping `pkg.version` correct everywhere without a test-only shim.
9
+ */
10
+ const loadPkg = () => {
11
+ let dir = dirname(fileURLToPath(import.meta.url));
12
+ for (;;) {
13
+ try {
14
+ return JSON.parse(readFileSync(join(dir, "package.json"), "utf-8"));
15
+ }
16
+ catch {
17
+ const parent = dirname(dir);
18
+ if (parent === dir) {
19
+ throw new Error("Could not locate package.json for version detection.");
20
+ }
21
+ dir = parent;
22
+ }
23
+ }
24
+ };
25
+ export default loadPkg();
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Standalone psql shim.
4
+ *
5
+ * Thin wrapper around `runPsql` that lets the conformance harness — and any
6
+ * caller that wants a psql-compatible CLI — invoke our embedded TypeScript
7
+ * psql directly via `node dist/psql/cli.js`, without going through the
8
+ * neonctl yargs entrypoint.
9
+ *
10
+ * Why this exists: `dist/cli.js` is the neonctl entrypoint; yargs eats
11
+ * libpq-style flags (e.g. `-v ON_ERROR_STOP=0` collides with yargs'
12
+ * built-in `--version`). The conformance suite needs to spawn a binary
13
+ * that accepts the upstream psql flag grammar (`-h`/`-p`/`-U`/`-d`/`-X`/
14
+ * `-v VAR=VALUE`/`--no-psqlrc`/`--echo-all`/`--quiet`/etc.) and reads SQL
15
+ * from stdin. This shim wires `process.argv.slice(2)` straight into
16
+ * `runPsql`, which already speaks that grammar via `parseStartupArgs`.
17
+ *
18
+ * Argv shape:
19
+ * - If the first positional looks like a connection URI / conninfo
20
+ * (per `looksLikeConnectionString`), it stays at argv[0] — same shape
21
+ * as the legacy native-psql call site in `src/utils/psql.ts` and the
22
+ * existing `runPsql` API.
23
+ * - Otherwise (the regress harness case: bare libpq flags), we prepend
24
+ * an empty placeholder URI so `runPsql([''] + flags)` falls through to
25
+ * `parseStartupArgs` and resolves the connection from `-h`/`-p`/`-U`/
26
+ * `-d` plus PG* env / pgpass / service via the layered resolver.
27
+ *
28
+ * Exit code: forwarded straight from `runPsql` (matches upstream psql's
29
+ * EXIT_SUCCESS / EXIT_FAILURE / EXIT_USER / EXIT_BADCONN values; see
30
+ * `core/mainloop.ts`).
31
+ */
32
+ import { looksLikeConnectionString, runPsql } from "./index.js";
33
+ const main = async () => {
34
+ const raw = process.argv.slice(2);
35
+ // Detect whether the first arg is a connection URI/conninfo string.
36
+ // libpq's `recognized_connection_string()` covers both `postgres[ql]://…`
37
+ // URIs and bare `key=value` conninfo strings — `looksLikeConnectionString`
38
+ // mirrors that test.
39
+ const argv = raw.length > 0 && looksLikeConnectionString(raw[0])
40
+ ? raw
41
+ : ["", ...raw];
42
+ const code = await runPsql(argv, {
43
+ stdin: process.stdin,
44
+ stdout: process.stdout,
45
+ stderr: process.stderr,
46
+ });
47
+ process.exit(code);
48
+ };
49
+ main().catch((err) => {
50
+ const msg = err instanceof Error ? err.message : String(err);
51
+ process.stderr.write(`psql: fatal: ${msg}\n`);
52
+ process.exit(1);
53
+ });