neonctl 2.22.0 → 2.23.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 (116) hide show
  1. package/README.md +242 -16
  2. package/analytics.js +5 -2
  3. package/commands/branches.js +9 -1
  4. package/commands/checkout.js +249 -0
  5. package/commands/connection_string.js +15 -2
  6. package/commands/data_api.js +286 -0
  7. package/commands/functions.js +277 -0
  8. package/commands/index.js +12 -0
  9. package/commands/link.js +667 -0
  10. package/commands/neon_auth.js +1013 -0
  11. package/commands/projects.js +9 -1
  12. package/commands/psql.js +62 -0
  13. package/commands/set_context.js +7 -2
  14. package/context.js +86 -14
  15. package/functions_api.js +44 -0
  16. package/index.js +3 -0
  17. package/package.json +60 -51
  18. package/psql/cli.js +51 -0
  19. package/psql/command/cmd_cond.js +437 -0
  20. package/psql/command/cmd_connect.js +815 -0
  21. package/psql/command/cmd_copy.js +1025 -0
  22. package/psql/command/cmd_describe.js +1810 -0
  23. package/psql/command/cmd_format.js +909 -0
  24. package/psql/command/cmd_io.js +2187 -0
  25. package/psql/command/cmd_lo.js +385 -0
  26. package/psql/command/cmd_meta.js +970 -0
  27. package/psql/command/cmd_misc.js +187 -0
  28. package/psql/command/cmd_pipeline.js +1141 -0
  29. package/psql/command/cmd_restrict.js +171 -0
  30. package/psql/command/cmd_show.js +751 -0
  31. package/psql/command/dispatch.js +343 -0
  32. package/psql/command/inputQueue.js +42 -0
  33. package/psql/command/shared.js +71 -0
  34. package/psql/complete/filenames.js +139 -0
  35. package/psql/complete/index.js +104 -0
  36. package/psql/complete/matcher.js +314 -0
  37. package/psql/complete/psqlVars.js +247 -0
  38. package/psql/complete/queries.js +491 -0
  39. package/psql/complete/rules.js +2387 -0
  40. package/psql/core/common.js +1250 -0
  41. package/psql/core/help.js +576 -0
  42. package/psql/core/mainloop.js +1353 -0
  43. package/psql/core/prompt.js +437 -0
  44. package/psql/core/settings.js +684 -0
  45. package/psql/core/sqlHelp.js +1066 -0
  46. package/psql/core/startup.js +840 -0
  47. package/psql/core/syncVars.js +116 -0
  48. package/psql/core/variables.js +287 -0
  49. package/psql/describe/formatters.js +1277 -0
  50. package/psql/describe/processNamePattern.js +270 -0
  51. package/psql/describe/queries.js +2373 -0
  52. package/psql/describe/versionGate.js +43 -0
  53. package/psql/index.js +2005 -0
  54. package/psql/io/history.js +299 -0
  55. package/psql/io/input.js +120 -0
  56. package/psql/io/lineEditor/buffer.js +323 -0
  57. package/psql/io/lineEditor/complete.js +227 -0
  58. package/psql/io/lineEditor/filename.js +159 -0
  59. package/psql/io/lineEditor/index.js +891 -0
  60. package/psql/io/lineEditor/keymap.js +738 -0
  61. package/psql/io/lineEditor/vt100.js +363 -0
  62. package/psql/io/pgpass.js +202 -0
  63. package/psql/io/pgservice.js +194 -0
  64. package/psql/io/psqlrc.js +422 -0
  65. package/psql/print/aligned.js +1756 -0
  66. package/psql/print/asciidoc.js +248 -0
  67. package/psql/print/crosstab.js +460 -0
  68. package/psql/print/csv.js +92 -0
  69. package/psql/print/html.js +258 -0
  70. package/psql/print/json.js +96 -0
  71. package/psql/print/latex.js +396 -0
  72. package/psql/print/pager.js +265 -0
  73. package/psql/print/troff.js +258 -0
  74. package/psql/print/unaligned.js +118 -0
  75. package/psql/print/units.js +135 -0
  76. package/psql/scanner/slash.js +513 -0
  77. package/psql/scanner/sql.js +910 -0
  78. package/psql/scanner/stringutils.js +390 -0
  79. package/psql/types/backslash.js +1 -0
  80. package/psql/types/connection.js +1 -0
  81. package/psql/types/index.js +7 -0
  82. package/psql/types/printer.js +1 -0
  83. package/psql/types/repl.js +1 -0
  84. package/psql/types/scanner.js +24 -0
  85. package/psql/types/settings.js +1 -0
  86. package/psql/types/variables.js +1 -0
  87. package/psql/wire/connection.js +2844 -0
  88. package/psql/wire/copy.js +108 -0
  89. package/psql/wire/notify.js +59 -0
  90. package/psql/wire/pipeline.js +519 -0
  91. package/psql/wire/protocol.js +466 -0
  92. package/psql/wire/sasl.js +296 -0
  93. package/psql/wire/tls.js +596 -0
  94. package/test_utils/fixtures.js +1 -0
  95. package/utils/enrichers.js +18 -1
  96. package/utils/esbuild.js +147 -0
  97. package/utils/middlewares.js +1 -1
  98. package/utils/psql.js +107 -11
  99. package/utils/zip.js +4 -0
  100. package/writer.js +1 -1
  101. package/commands/auth.test.js +0 -211
  102. package/commands/branches.test.js +0 -460
  103. package/commands/connection_string.test.js +0 -196
  104. package/commands/databases.test.js +0 -39
  105. package/commands/help.test.js +0 -9
  106. package/commands/init.test.js +0 -56
  107. package/commands/ip_allow.test.js +0 -59
  108. package/commands/operations.test.js +0 -7
  109. package/commands/orgs.test.js +0 -7
  110. package/commands/projects.test.js +0 -144
  111. package/commands/roles.test.js +0 -37
  112. package/commands/set_context.test.js +0 -159
  113. package/commands/vpc_endpoints.test.js +0 -69
  114. package/env.test.js +0 -55
  115. package/utils/formats.test.js +0 -32
  116. package/writer.test.js +0 -104
package/writer.test.js DELETED
@@ -1,104 +0,0 @@
1
- import { PassThrough } from 'node:stream';
2
- import { describe, it, expect } from 'vitest';
3
- import { writer } from './writer.js';
4
- const getMockWritable = () => {
5
- const chunks = [];
6
- const stream = new PassThrough();
7
- stream.on('data', (chunk) => {
8
- chunks.push(chunk.toString());
9
- });
10
- return {
11
- stream,
12
- getData: () => {
13
- return chunks.join('');
14
- },
15
- };
16
- };
17
- describe('writer', () => {
18
- describe('outputs yaml', () => {
19
- it('outputs single data', () => {
20
- const { stream, getData } = getMockWritable();
21
- const out = writer({ output: 'yaml', out: stream });
22
- out.end({ foo: 'bar' }, { fields: ['foo'] });
23
- expect(getData()).toMatchSnapshot();
24
- });
25
- it('outputs single data with title', () => {
26
- const { stream, getData } = getMockWritable();
27
- const out = writer({ output: 'yaml', out: stream });
28
- out.end({ foo: 'bar' }, { fields: ['foo'], title: 'baz' });
29
- expect(getData()).toMatchSnapshot();
30
- });
31
- it('outputs multiple data', () => {
32
- const { stream, getData } = getMockWritable();
33
- const out = writer({ output: 'yaml', out: stream });
34
- out
35
- .write({ foo: 'bar' }, { fields: ['foo'], title: 'T1' })
36
- .write({ baz: 'xyz' }, { fields: ['baz'], title: 'T2' })
37
- .end();
38
- expect(getData()).toMatchSnapshot();
39
- });
40
- });
41
- describe('outputs json', () => {
42
- it('outputs single data', () => {
43
- const { stream, getData } = getMockWritable();
44
- const out = writer({ output: 'json', out: stream });
45
- out.end({ foo: 'bar' }, { fields: ['foo'] });
46
- expect(getData()).toMatchSnapshot();
47
- });
48
- it('outputs single data with title', () => {
49
- const { stream, getData } = getMockWritable();
50
- const out = writer({ output: 'json', out: stream });
51
- out.end({ foo: 'bar' }, { fields: ['foo'], title: 'baz' });
52
- expect(getData()).toMatchSnapshot();
53
- });
54
- it('outputs multiple data', () => {
55
- const { stream, getData } = getMockWritable();
56
- const out = writer({ output: 'json', out: stream });
57
- out
58
- .write({ foo: 'bar' }, { fields: ['foo'], title: 'T1' })
59
- .write({ baz: 'xyz' }, { fields: ['baz'], title: 'T2' })
60
- .end();
61
- expect(getData()).toMatchSnapshot();
62
- });
63
- });
64
- describe('outputs table', () => {
65
- it('outputs single data', () => {
66
- const { stream, getData } = getMockWritable();
67
- const out = writer({ output: 'table', out: stream });
68
- out.end({ foo: 'bar', extra: 'extra' }, { fields: ['foo'] });
69
- expect(getData()).toMatchSnapshot();
70
- });
71
- it('outputs single data with title', () => {
72
- const { stream, getData } = getMockWritable();
73
- const out = writer({ output: 'table', out: stream });
74
- out.end({ foo: 'bar', extra: 'extra' }, { fields: ['foo'], title: 'baz' });
75
- expect(getData()).toMatchSnapshot();
76
- });
77
- it('outputs multiple data', () => {
78
- const { stream, getData } = getMockWritable();
79
- const out = writer({ output: 'table', out: stream });
80
- out
81
- .write({ foo: 'bar', extra: 'extra' }, { fields: ['foo'], title: 'T1' })
82
- .write({ baz: 'xyz', extra: 'extra' }, { fields: ['baz'], title: 'T2' })
83
- .end();
84
- expect(getData()).toMatchSnapshot();
85
- });
86
- it('outputs table with custom renderer', () => {
87
- const { stream, getData } = getMockWritable();
88
- const out = writer({
89
- output: 'table',
90
- out: stream,
91
- });
92
- out
93
- .write({ foo: 'bar' }, {
94
- fields: ['foo'],
95
- title: 'T1',
96
- renderColumns: {
97
- foo: ({ foo }) => `Here is: ${foo}`,
98
- },
99
- })
100
- .end();
101
- expect(getData()).toMatchSnapshot();
102
- });
103
- });
104
- });