neonctl 1.32.1 → 1.34.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/parameters.gen.js CHANGED
@@ -37,7 +37,7 @@ export const projectCreateRequest = {
37
37
  },
38
38
  'project.settings.allowed_ips.primary_branch_only': {
39
39
  type: "boolean",
40
- description: "If true, the list will be applied only to the default branch.",
40
+ description: "DEPRECATED: Use `protected_branches_only`.\nIf true, the list will be applied only to the default branch.\n",
41
41
  demandOption: false,
42
42
  },
43
43
  'project.settings.enable_logical_replication': {
@@ -140,7 +140,7 @@ export const projectUpdateRequest = {
140
140
  },
141
141
  'project.settings.allowed_ips.primary_branch_only': {
142
142
  type: "boolean",
143
- description: "If true, the list will be applied only to the default branch.",
143
+ description: "DEPRECATED: Use `protected_branches_only`.\nIf true, the list will be applied only to the default branch.\n",
144
144
  demandOption: false,
145
145
  },
146
146
  'project.settings.enable_logical_replication': {
@@ -199,7 +199,7 @@ export const branchCreateRequest = {
199
199
  export const branchCreateRequestEndpointOptions = {
200
200
  'type': {
201
201
  type: "string",
202
- description: "The compute endpoint type. Either `read_write` or `read_only`.\nThe `read_only` compute endpoint type is not yet supported.\n",
202
+ description: "The compute endpoint type. Either `read_write` or `read_only`.\n",
203
203
  demandOption: true,
204
204
  choices: ["read_only", "read_write"],
205
205
  },
@@ -240,7 +240,7 @@ export const endpointCreateRequest = {
240
240
  },
241
241
  'endpoint.type': {
242
242
  type: "string",
243
- description: "The compute endpoint type. Either `read_write` or `read_only`.\nThe `read_only` compute endpoint type is not yet supported.\n",
243
+ description: "The compute endpoint type. Either `read_write` or `read_only`.\n",
244
244
  demandOption: true,
245
245
  choices: ["read_only", "read_write"],
246
246
  },
@@ -0,0 +1,84 @@
1
+ import { fork } from 'node:child_process';
2
+ import { join } from 'node:path';
3
+ import { expect, test as originalTest } from 'vitest';
4
+ import strip from 'strip-ansi';
5
+ import emocks from 'emocks';
6
+ import express from 'express';
7
+ import { log } from '../log';
8
+ export const test = originalTest.extend({
9
+ // eslint-disable-next-line no-empty-pattern
10
+ runMockServer: async ({}, use) => {
11
+ let server;
12
+ await use(async (mockDir) => {
13
+ const app = express();
14
+ app.use(express.json());
15
+ app.use('/', emocks(join(process.cwd(), 'mocks', mockDir), {
16
+ '404': (_req, res) => res.status(404).send({ message: 'Not Found' }),
17
+ }));
18
+ await new Promise((resolve) => {
19
+ server = app.listen(0, () => {
20
+ resolve();
21
+ log.debug('Mock server listening at %d', server.address().port);
22
+ });
23
+ });
24
+ return server;
25
+ });
26
+ await new Promise((resolve, reject) => server.close((err) => {
27
+ if (err) {
28
+ reject(err instanceof Error ? err : new Error(String(err)));
29
+ }
30
+ else {
31
+ resolve();
32
+ }
33
+ }));
34
+ },
35
+ testCliCommand: async ({ runMockServer }, use) => {
36
+ await use(async (args, options = {}) => {
37
+ const server = await runMockServer(options.mockDir || 'main');
38
+ let output = '';
39
+ let error = '';
40
+ const cp = fork(join(process.cwd(), './dist/index.js'), [
41
+ '--api-host',
42
+ `http://localhost:${server.address().port}`,
43
+ '--output',
44
+ 'yaml',
45
+ '--api-key',
46
+ 'test-key',
47
+ '--no-analytics',
48
+ ...args,
49
+ ], {
50
+ stdio: 'pipe',
51
+ env: {
52
+ PATH: `mocks/bin:${process.env.PATH}`,
53
+ },
54
+ });
55
+ return new Promise((resolve, reject) => {
56
+ cp.stdout?.on('data', (data) => {
57
+ output += data.toString();
58
+ });
59
+ cp.stderr?.on('data', (data) => {
60
+ error += data.toString();
61
+ log.error(data.toString());
62
+ });
63
+ cp.on('error', (err) => {
64
+ throw err;
65
+ });
66
+ cp.on('close', (code) => {
67
+ try {
68
+ expect(code).toBe(options?.code ?? 0);
69
+ expect(output).toMatchSnapshot();
70
+ if (options.stderr !== undefined) {
71
+ expect(strip(error).replace(/\s+/g, ' ').trim()).toEqual(typeof options.stderr === 'string'
72
+ ? options.stderr.toString().replace(/\s+/g, ' ')
73
+ : options.stderr);
74
+ }
75
+ resolve();
76
+ }
77
+ catch (err) {
78
+ reject(err instanceof Error ? err : new Error(String(err)));
79
+ }
80
+ });
81
+ });
82
+ });
83
+ },
84
+ });
package/writer.js CHANGED
@@ -84,7 +84,7 @@ export const writer = (props) => {
84
84
  if (props.output == 'json') {
85
85
  return out.write(writeJson(chunks));
86
86
  }
87
- return writeTable(chunks, out);
87
+ writeTable(chunks, out);
88
88
  },
89
89
  };
90
90
  };
@@ -1,16 +0,0 @@
1
- import emocks from 'emocks';
2
- import express from 'express';
3
- import { join } from 'node:path';
4
- import { log } from '../log';
5
- export const runMockServer = async (mockDir) => new Promise((resolve) => {
6
- const app = express();
7
- app.use(express.json());
8
- app.use('/', emocks(join(process.cwd(), 'mocks', mockDir), {
9
- '404': (req, res) => res.status(404).send({ message: 'Not Found' }),
10
- }));
11
- const server = app.listen(0);
12
- server.on('listening', () => {
13
- resolve(server);
14
- log.debug('Mock server listening at %d', server.address().port);
15
- });
16
- });
@@ -1,80 +0,0 @@
1
- import { test, expect, describe, beforeAll, afterAll } from 'vitest';
2
- import { fork } from 'node:child_process';
3
- import { join } from 'node:path';
4
- import { log } from '../log.js';
5
- import strip from 'strip-ansi';
6
- import { runMockServer } from './mock_server.js';
7
- export const testCliCommand = ({ args, name, expected, before, after, mockDir = 'main', }) => {
8
- let server;
9
- describe(name, () => {
10
- beforeAll(async () => {
11
- if (before) {
12
- await before();
13
- }
14
- server = await runMockServer(mockDir);
15
- });
16
- afterAll(async () => {
17
- if (after) {
18
- await after();
19
- }
20
- return new Promise((resolve) => {
21
- server.close(() => {
22
- resolve();
23
- });
24
- });
25
- });
26
- test('test', async () => {
27
- let output = '';
28
- let error = '';
29
- const cp = fork(join(process.cwd(), './dist/index.js'), [
30
- '--api-host',
31
- `http://localhost:${server.address().port}`,
32
- '--output',
33
- 'yaml',
34
- '--api-key',
35
- 'test-key',
36
- '--no-analytics',
37
- ...args,
38
- ], {
39
- stdio: 'pipe',
40
- env: {
41
- PATH: `mocks/bin:${process.env.PATH}`,
42
- },
43
- });
44
- return new Promise((resolve, reject) => {
45
- cp.stdout?.on('data', (data) => {
46
- output += data.toString();
47
- });
48
- cp.stderr?.on('data', (data) => {
49
- error += data.toString();
50
- log.error(data.toString());
51
- });
52
- cp.on('error', (err) => {
53
- throw err;
54
- });
55
- cp.on('close', (code) => {
56
- try {
57
- expect(code).toBe(expected?.code ?? 0);
58
- if (expected) {
59
- if (expected.snapshot) {
60
- expect(output).toMatchSnapshot();
61
- }
62
- if (expected.stdout !== undefined) {
63
- expect(strip(output)).toEqual(expected.stdout);
64
- }
65
- if (expected.stderr !== undefined) {
66
- expect(strip(error).replace(/\s+/g, ' ').trim()).toEqual(typeof expected.stderr === 'string'
67
- ? expected.stderr.toString().replace(/\s+/g, ' ')
68
- : expected.stderr);
69
- }
70
- }
71
- resolve();
72
- }
73
- catch (err) {
74
- reject(err);
75
- }
76
- });
77
- });
78
- });
79
- });
80
- };