neonctl 2.27.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.
- package/README.md +35 -3
- package/dist/analytics.js +52 -34
- package/dist/api.js +643 -13
- package/dist/auth.js +50 -44
- package/dist/cli.js +8 -1
- package/dist/commands/auth.js +64 -51
- package/dist/commands/bootstrap.js +115 -157
- package/dist/commands/branches.js +160 -150
- package/dist/commands/bucket.js +183 -146
- package/dist/commands/checkout.js +51 -51
- package/dist/commands/config.js +228 -82
- package/dist/commands/connection_string.js +62 -62
- package/dist/commands/data_api.js +100 -101
- package/dist/commands/databases.js +29 -26
- package/dist/commands/deploy.js +12 -12
- package/dist/commands/dev.js +114 -114
- package/dist/commands/env.js +43 -43
- package/dist/commands/functions.js +101 -104
- package/dist/commands/index.js +27 -25
- package/dist/commands/init.js +23 -22
- package/dist/commands/ip_allow.js +29 -29
- package/dist/commands/link.js +232 -182
- package/dist/commands/neon_auth.js +385 -370
- package/dist/commands/operations.js +11 -11
- package/dist/commands/orgs.js +8 -8
- package/dist/commands/projects.js +103 -101
- package/dist/commands/psql.js +31 -31
- package/dist/commands/roles.js +27 -24
- package/dist/commands/schema_diff.js +25 -26
- package/dist/commands/set_context.js +17 -17
- package/dist/commands/status.js +40 -0
- package/dist/commands/user.js +5 -5
- package/dist/commands/vpc_endpoints.js +50 -50
- package/dist/config.js +7 -7
- package/dist/config_format.js +5 -5
- package/dist/context.js +37 -14
- package/dist/current_branch_fast_path.js +55 -0
- package/dist/dev/env.js +33 -33
- package/dist/dev/functions.js +4 -4
- package/dist/dev/inputs.js +6 -6
- package/dist/dev/runtime.js +25 -25
- package/dist/env.js +14 -14
- package/dist/env_file.js +13 -13
- package/dist/errors.js +68 -5
- package/dist/functions_api.js +10 -10
- package/dist/help.js +15 -15
- package/dist/index.js +110 -107
- package/dist/log.js +2 -2
- package/dist/parameters.gen.js +14 -14
- package/dist/pkg.js +5 -5
- package/dist/psql/cli.js +4 -2
- package/dist/psql/command/cmd_cond.js +61 -61
- package/dist/psql/command/cmd_connect.js +159 -154
- package/dist/psql/command/cmd_copy.js +107 -97
- package/dist/psql/command/cmd_describe.js +368 -363
- package/dist/psql/command/cmd_format.js +276 -263
- package/dist/psql/command/cmd_io.js +269 -263
- package/dist/psql/command/cmd_lo.js +74 -66
- package/dist/psql/command/cmd_meta.js +148 -148
- package/dist/psql/command/cmd_misc.js +17 -17
- package/dist/psql/command/cmd_pipeline.js +142 -135
- package/dist/psql/command/cmd_restrict.js +25 -25
- package/dist/psql/command/cmd_show.js +183 -168
- package/dist/psql/command/dispatch.js +26 -26
- package/dist/psql/command/shared.js +14 -14
- package/dist/psql/complete/filenames.js +16 -16
- package/dist/psql/complete/index.js +4 -4
- package/dist/psql/complete/matcher.js +33 -32
- package/dist/psql/complete/psqlVars.js +173 -173
- package/dist/psql/complete/queries.js +5 -3
- package/dist/psql/complete/rules.js +900 -863
- package/dist/psql/core/common.js +136 -133
- package/dist/psql/core/help.js +343 -343
- package/dist/psql/core/mainloop.js +160 -153
- package/dist/psql/core/prompt.js +126 -123
- package/dist/psql/core/settings.js +111 -111
- package/dist/psql/core/sqlHelp.js +150 -150
- package/dist/psql/core/startup.js +211 -205
- package/dist/psql/core/syncVars.js +14 -14
- package/dist/psql/core/variables.js +24 -24
- package/dist/psql/describe/formatters.js +302 -289
- package/dist/psql/describe/processNamePattern.js +28 -28
- package/dist/psql/describe/queries.js +656 -651
- package/dist/psql/index.js +436 -411
- package/dist/psql/io/history.js +36 -36
- package/dist/psql/io/input.js +15 -15
- package/dist/psql/io/lineEditor/buffer.js +27 -25
- package/dist/psql/io/lineEditor/complete.js +15 -15
- package/dist/psql/io/lineEditor/filename.js +22 -22
- package/dist/psql/io/lineEditor/index.js +65 -62
- package/dist/psql/io/lineEditor/keymap.js +325 -318
- package/dist/psql/io/lineEditor/vt100.js +60 -60
- package/dist/psql/io/pgpass.js +18 -18
- package/dist/psql/io/pgservice.js +14 -14
- package/dist/psql/io/psqlrc.js +46 -46
- package/dist/psql/print/aligned.js +175 -166
- package/dist/psql/print/asciidoc.js +51 -51
- package/dist/psql/print/crosstab.js +34 -31
- package/dist/psql/print/csv.js +25 -22
- package/dist/psql/print/html.js +54 -54
- package/dist/psql/print/json.js +12 -12
- package/dist/psql/print/latex.js +118 -118
- package/dist/psql/print/pager.js +28 -26
- package/dist/psql/print/troff.js +48 -48
- package/dist/psql/print/unaligned.js +15 -14
- package/dist/psql/print/units.js +17 -17
- package/dist/psql/scanner/slash.js +48 -46
- package/dist/psql/scanner/sql.js +88 -84
- package/dist/psql/scanner/stringutils.js +21 -17
- package/dist/psql/types/index.js +7 -7
- package/dist/psql/types/scanner.js +8 -8
- package/dist/psql/wire/connection.js +341 -327
- package/dist/psql/wire/copy.js +7 -7
- package/dist/psql/wire/pipeline.js +26 -24
- package/dist/psql/wire/protocol.js +102 -102
- package/dist/psql/wire/sasl.js +62 -62
- package/dist/psql/wire/tls.js +79 -73
- package/dist/storage_api.js +22 -23
- package/dist/test_utils/fixtures.js +74 -41
- package/dist/test_utils/oauth_server.js +5 -5
- package/dist/utils/api_enums.js +33 -0
- package/dist/utils/branch_notice.js +5 -5
- package/dist/utils/branch_picker.js +26 -26
- package/dist/utils/compute_units.js +4 -4
- package/dist/utils/enrichers.js +28 -16
- package/dist/utils/esbuild.js +28 -28
- package/dist/utils/formats.js +1 -1
- package/dist/utils/middlewares.js +3 -3
- package/dist/utils/package_manager.js +68 -0
- package/dist/utils/point_in_time.js +12 -12
- package/dist/utils/psql.js +30 -30
- package/dist/utils/string.js +2 -2
- package/dist/utils/ui.js +9 -9
- package/dist/utils/zip.js +1 -1
- package/dist/writer.js +17 -17
- package/package.json +10 -12
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
* identifiers are stored as-typed and case-folding only happens for
|
|
40
40
|
* unquoted user input (which is restricted to lower-case anyway).
|
|
41
41
|
*/
|
|
42
|
-
const toLower = (ch) => ch >=
|
|
43
|
-
const REGEX_SPECIALS =
|
|
42
|
+
const toLower = (ch) => ch >= "A" && ch <= "Z" ? String.fromCharCode(ch.charCodeAt(0) + 32) : ch;
|
|
43
|
+
const REGEX_SPECIALS = "|*+?()[]{}.^$\\";
|
|
44
44
|
/**
|
|
45
45
|
* Translate a shell-style pattern into one or more regex strings, one
|
|
46
46
|
* per `.`-separated component. Mirrors upstream `patternToSQLRegex()`.
|
|
@@ -58,8 +58,8 @@ const patternToSQLRegex = (pattern, forceLower, wantSchema, wantDb) => {
|
|
|
58
58
|
// dbnamevar column; the dispatcher validates it against the current DB
|
|
59
59
|
// (review item #23).
|
|
60
60
|
const maxComponents = wantSchema || wantDb ? 3 : 1;
|
|
61
|
-
const buffers = [
|
|
62
|
-
let leftLiteral =
|
|
61
|
+
const buffers = ["^("];
|
|
62
|
+
let leftLiteral = "";
|
|
63
63
|
// Upstream's `want_literal_dbname`: track the first component's
|
|
64
64
|
// literal text unconditionally so the dispatcher can detect
|
|
65
65
|
// cross-database references and emit the canonical error message.
|
|
@@ -84,7 +84,7 @@ const patternToSQLRegex = (pattern, forceLower, wantSchema, wantDb) => {
|
|
|
84
84
|
cp++;
|
|
85
85
|
continue;
|
|
86
86
|
}
|
|
87
|
-
if (!inQuotes && ch >=
|
|
87
|
+
if (!inQuotes && ch >= "A" && ch <= "Z") {
|
|
88
88
|
const lo = toLower(ch);
|
|
89
89
|
buffers[buffers.length - 1] += lo;
|
|
90
90
|
if (trackingLeft)
|
|
@@ -92,59 +92,59 @@ const patternToSQLRegex = (pattern, forceLower, wantSchema, wantDb) => {
|
|
|
92
92
|
cp++;
|
|
93
93
|
continue;
|
|
94
94
|
}
|
|
95
|
-
if (!inQuotes && ch ===
|
|
96
|
-
buffers[buffers.length - 1] +=
|
|
95
|
+
if (!inQuotes && ch === "*") {
|
|
96
|
+
buffers[buffers.length - 1] += ".*";
|
|
97
97
|
if (trackingLeft)
|
|
98
|
-
leftLiteral +=
|
|
98
|
+
leftLiteral += "*";
|
|
99
99
|
cp++;
|
|
100
100
|
continue;
|
|
101
101
|
}
|
|
102
|
-
if (!inQuotes && ch ===
|
|
103
|
-
buffers[buffers.length - 1] +=
|
|
102
|
+
if (!inQuotes && ch === "?") {
|
|
103
|
+
buffers[buffers.length - 1] += ".";
|
|
104
104
|
if (trackingLeft)
|
|
105
|
-
leftLiteral +=
|
|
105
|
+
leftLiteral += "?";
|
|
106
106
|
cp++;
|
|
107
107
|
continue;
|
|
108
108
|
}
|
|
109
|
-
if (!inQuotes && ch ===
|
|
109
|
+
if (!inQuotes && ch === ".") {
|
|
110
110
|
dotCount++;
|
|
111
111
|
trackingLeft = false;
|
|
112
112
|
if (buffers.length < maxComponents) {
|
|
113
|
-
buffers[buffers.length - 1] +=
|
|
114
|
-
buffers.push(
|
|
113
|
+
buffers[buffers.length - 1] += ")$";
|
|
114
|
+
buffers.push("^(");
|
|
115
115
|
}
|
|
116
116
|
else {
|
|
117
|
-
buffers[buffers.length - 1] +=
|
|
117
|
+
buffers[buffers.length - 1] += ".";
|
|
118
118
|
}
|
|
119
119
|
cp++;
|
|
120
120
|
continue;
|
|
121
121
|
}
|
|
122
|
-
if (ch ===
|
|
122
|
+
if (ch === "$") {
|
|
123
123
|
// Always quote $ — upstream rationale: identifiers may legitimately
|
|
124
124
|
// contain $ (e.g. function-language names) so the literal sense wins.
|
|
125
|
-
buffers[buffers.length - 1] +=
|
|
125
|
+
buffers[buffers.length - 1] += "\\$";
|
|
126
126
|
if (trackingLeft)
|
|
127
|
-
leftLiteral +=
|
|
127
|
+
leftLiteral += "$";
|
|
128
128
|
cp++;
|
|
129
129
|
continue;
|
|
130
130
|
}
|
|
131
131
|
// Ordinary data character.
|
|
132
|
-
let prefix =
|
|
132
|
+
let prefix = "";
|
|
133
133
|
if (inQuotes || forceLower) {
|
|
134
134
|
if (REGEX_SPECIALS.includes(ch))
|
|
135
|
-
prefix =
|
|
135
|
+
prefix = "\\";
|
|
136
136
|
}
|
|
137
|
-
else if (ch ===
|
|
137
|
+
else if (ch === "[" && pattern[cp + 1] === "]") {
|
|
138
138
|
// Special: array-type bracket pair is always escaped to avoid
|
|
139
139
|
// psql users hitting an empty-character-class regex error.
|
|
140
|
-
prefix =
|
|
140
|
+
prefix = "\\";
|
|
141
141
|
}
|
|
142
142
|
buffers[buffers.length - 1] += prefix + ch;
|
|
143
143
|
if (trackingLeft)
|
|
144
144
|
leftLiteral += ch;
|
|
145
145
|
cp++;
|
|
146
146
|
}
|
|
147
|
-
buffers[buffers.length - 1] +=
|
|
147
|
+
buffers[buffers.length - 1] += ")$";
|
|
148
148
|
// Upstream emits buffers in *reverse* assignment order: namebuf gets
|
|
149
149
|
// the *last* component, schemabuf the second-to-last, dbnamebuf the
|
|
150
150
|
// first. So we reverse for downstream consumption.
|
|
@@ -190,7 +190,7 @@ export const processSQLNamePattern = (opts) => {
|
|
|
190
190
|
const schemaRegex = parts.regexes[1] ?? null;
|
|
191
191
|
const dbRegex = parts.regexes[2] ?? null;
|
|
192
192
|
// Name constraint
|
|
193
|
-
if (nameRegex && nameRegex !==
|
|
193
|
+
if (nameRegex && nameRegex !== "^(.*)$") {
|
|
194
194
|
const placeholder = `$${result.params.length + 1}`;
|
|
195
195
|
if (altnamevar) {
|
|
196
196
|
result.nameConditions.push(`(${namevar} OPERATOR(pg_catalog.~) ${placeholder} OR ${altnamevar} OPERATOR(pg_catalog.~) ${placeholder})`);
|
|
@@ -201,7 +201,7 @@ export const processSQLNamePattern = (opts) => {
|
|
|
201
201
|
result.params.push(nameRegex);
|
|
202
202
|
}
|
|
203
203
|
// Schema constraint
|
|
204
|
-
if (schemavar && schemaRegex && schemaRegex !==
|
|
204
|
+
if (schemavar && schemaRegex && schemaRegex !== "^(.*)$") {
|
|
205
205
|
const placeholder = `$${result.params.length + 1}`;
|
|
206
206
|
result.schemaConditions.push(`${schemavar} OPERATOR(pg_catalog.~) ${placeholder}`);
|
|
207
207
|
result.params.push(schemaRegex);
|
|
@@ -211,7 +211,7 @@ export const processSQLNamePattern = (opts) => {
|
|
|
211
211
|
result.visibilityConditions.push(visibilityrule);
|
|
212
212
|
}
|
|
213
213
|
// Database constraint (rarely used; \l)
|
|
214
|
-
if (dbnamevar && dbRegex && dbRegex !==
|
|
214
|
+
if (dbnamevar && dbRegex && dbRegex !== "^(.*)$") {
|
|
215
215
|
const placeholder = `$${result.params.length + 1}`;
|
|
216
216
|
result.schemaConditions.push(`${dbnamevar} OPERATOR(pg_catalog.~) ${placeholder}`);
|
|
217
217
|
result.params.push(dbRegex);
|
|
@@ -234,7 +234,7 @@ export const processSQLNamePattern = (opts) => {
|
|
|
234
234
|
* to be unique across the substituted query.
|
|
235
235
|
*/
|
|
236
236
|
export const applyPattern = (sql, result, baseParams = []) => {
|
|
237
|
-
const placeholder =
|
|
237
|
+
const placeholder = "true /* TODO(WP-20): pattern matching */";
|
|
238
238
|
if (!sql.includes(placeholder)) {
|
|
239
239
|
return { sql, params: baseParams };
|
|
240
240
|
}
|
|
@@ -257,7 +257,7 @@ export const applyPattern = (sql, result, baseParams = []) => {
|
|
|
257
257
|
const slotOffset = params.length;
|
|
258
258
|
const conds = conditions.map((c) => c.replace(/\$(\d+)/g, (_, n) => `$${Number(n) + slotOffset}`));
|
|
259
259
|
params.push(...result.params);
|
|
260
|
-
const replacement = `(${conds.join(
|
|
260
|
+
const replacement = `(${conds.join(" AND ")})`;
|
|
261
261
|
// Replace just the first remaining occurrence (others stay until
|
|
262
262
|
// their iteration).
|
|
263
263
|
const idx = renumbered.indexOf(placeholder);
|