neonctl 1.24.0 → 1.24.3
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/callback.html +134 -40
- package/commands/projects.js +28 -4
- package/commands/projects.test.js +31 -2
- package/commands/set_context.js +1 -3
- package/index.js +10 -2
- package/package.json +9 -5
- package/parameters.gen.js +93 -21
- package/utils/formats.js +1 -1
- package/utils/formats.test.js +32 -0
package/callback.html
CHANGED
|
@@ -1,45 +1,139 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8"
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
5
|
<title>Neon</title>
|
|
6
|
-
<style>
|
|
7
|
-
body,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
6
|
+
<style>
|
|
7
|
+
body,
|
|
8
|
+
html {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
margin: 0;
|
|
12
|
+
text-align: center;
|
|
13
|
+
font-family: 'Open Sans', sans-serif;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
background-color: #ffffff;
|
|
19
|
+
color: #2d374c;
|
|
20
|
+
}
|
|
21
|
+
@media (prefers-color-scheme: dark) {
|
|
22
|
+
body,
|
|
23
|
+
html {
|
|
24
|
+
background-color: #191919;
|
|
25
|
+
color: #bfbfbf;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
.logo {
|
|
29
|
+
display: inline-block;
|
|
30
|
+
width: 100px;
|
|
31
|
+
height: 100px;
|
|
32
|
+
margin: 0 auto;
|
|
33
|
+
}
|
|
34
|
+
svg {
|
|
35
|
+
overflow: visible;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
38
|
+
</head>
|
|
39
|
+
<body>
|
|
38
40
|
<div class="logo">
|
|
39
|
-
<svg
|
|
41
|
+
<svg
|
|
42
|
+
id="eBsErktH1941"
|
|
43
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
45
|
+
viewBox="0 0 42 42"
|
|
46
|
+
shape-rendering="geometricPrecision"
|
|
47
|
+
text-rendering="geometricPrecision"
|
|
48
|
+
>
|
|
49
|
+
<style>
|
|
50
|
+
<![CDATA[#eBsErktH1945 {animation: eBsErktH1945__fl 3000ms linear infinite normal forwards}@keyframes eBsErktH1945__fl { 0% {filter: drop-shadow(0px 0px 0px #5cff61)} 13.666667% {filter: drop-shadow(0px 0px 0px #5cff61)} 15% {filter: drop-shadow(0px 0px 4.242641px #5cff61)} 34% {filter: drop-shadow(0px 0px 4.242641px #5cff61)} 34.333333% {filter: drop-shadow(0px 0px 0px #5cff61)} 37.333333% {filter: drop-shadow(0px 0px 0px #5cff61)} 37.666667% {filter: drop-shadow(0px 0px 4.242641px #5cff61)} 43.666667% {filter: drop-shadow(0px 0px 4.242641px #5cff61)} 44% {filter: drop-shadow(0px 0px 0px #5cff61)} 47% {filter: drop-shadow(0px 0px 0px #5cff61)} 47.333333% {filter: drop-shadow(0px 0px 4.242641px #5cff61)} 51% {filter: drop-shadow(0px 0px 4.242641px #5cff61)} 51.333333% {filter: drop-shadow(0px 0px 0px #5cff61)} 53.666667% {filter: drop-shadow(0px 0px 0px #5cff61)} 54% {filter: drop-shadow(0px 0px 4.242641px #5cff61)} 100% {filter: drop-shadow(0px 0px 4.242641px #5cff61)}} #eBsErktH1946 {animation: eBsErktH1946__fl 3000ms linear infinite normal forwards}@keyframes eBsErktH1946__fl { 0% {filter: drop-shadow(0px 0px 0px #5cff61)} 13.666667% {filter: drop-shadow(0px 0px 0px #5cff61)} 15% {filter: drop-shadow(0px 0px 2.828427px #5cff61)} 34% {filter: drop-shadow(0px 0px 2.828427px #5cff61)} 34.333333% {filter: drop-shadow(0px 0px 0px #5cff61)} 37.333333% {filter: drop-shadow(0px 0px 0px #5cff61)} 37.666667% {filter: drop-shadow(0px 0px 2.828427px #5cff61)} 43.666667% {filter: drop-shadow(0px 0px 2.828427px #5cff61)} 44% {filter: drop-shadow(0px 0px 0px #5cff61)} 47% {filter: drop-shadow(0px 0px 0px #5cff61)} 47.333333% {filter: drop-shadow(0px 0px 2.828427px #5cff61)} 51% {filter: drop-shadow(0px 0px 2.828427px #5cff61)} 51.333333% {filter: drop-shadow(0px 0px 0px #5cff61)} 53.666667% {filter: drop-shadow(0px 0px 0px #5cff61)} 54% {filter: drop-shadow(0px 0px 2.828427px #5cff61)} 100% {filter: drop-shadow(0px 0px 2.828427px #5cff61)}} #eBsErktH1947 {animation: eBsErktH1947__fl 3000ms linear infinite normal forwards}@keyframes eBsErktH1947__fl { 0% {filter: drop-shadow(0px 0px 0px #5cff61)} 13.666667% {filter: drop-shadow(0px 0px 0px #5cff61)} 15% {filter: drop-shadow(0px 0px 1.414214px #5cff61)} 34% {filter: drop-shadow(0px 0px 1.414214px #5cff61)} 34.333333% {filter: drop-shadow(0px 0px 0px #5cff61)} 37.333333% {filter: drop-shadow(0px 0px 0px #5cff61)} 37.666667% {filter: drop-shadow(0px 0px 1.414214px #5cff61)} 43.666667% {filter: drop-shadow(0px 0px 1px #5cff61)} 44% {filter: drop-shadow(0px 0px 0px #5cff61)} 47% {filter: drop-shadow(0px 0px 0px #5cff61)} 47.333333% {filter: drop-shadow(0px 0px 1.414214px #5cff61)} 51% {filter: drop-shadow(0px 0px 1.414214px #5cff61)} 51.333333% {filter: drop-shadow(0px 0px 0px #5cff61)} 53.666667% {filter: drop-shadow(0px 0px 0px #5cff61)} 54% {filter: drop-shadow(0px 0px 1.414214px #5cff61)} 100% {filter: drop-shadow(0px 0px 1.414214px #5cff61)}}]]>
|
|
51
|
+
</style>
|
|
52
|
+
<defs>
|
|
53
|
+
<linearGradient
|
|
54
|
+
id="eBsErktH1943-fill"
|
|
55
|
+
x1="36"
|
|
56
|
+
y1="36"
|
|
57
|
+
x2="4.345"
|
|
58
|
+
y2="0"
|
|
59
|
+
spreadMethod="pad"
|
|
60
|
+
gradientUnits="userSpaceOnUse"
|
|
61
|
+
gradientTransform="translate(0 0)"
|
|
62
|
+
>
|
|
63
|
+
<stop id="eBsErktH1943-fill-0" offset="0%" stop-color="#b9ffb3" />
|
|
64
|
+
<stop
|
|
65
|
+
id="eBsErktH1943-fill-1"
|
|
66
|
+
offset="100%"
|
|
67
|
+
stop-color="rgba(185,255,179,0)"
|
|
68
|
+
/>
|
|
69
|
+
</linearGradient>
|
|
70
|
+
<linearGradient
|
|
71
|
+
id="eBsErktH1944-fill"
|
|
72
|
+
x1="36"
|
|
73
|
+
y1="36"
|
|
74
|
+
x2="14.617"
|
|
75
|
+
y2="27.683"
|
|
76
|
+
spreadMethod="pad"
|
|
77
|
+
gradientUnits="userSpaceOnUse"
|
|
78
|
+
gradientTransform="translate(0 0)"
|
|
79
|
+
>
|
|
80
|
+
<stop
|
|
81
|
+
id="eBsErktH1944-fill-0"
|
|
82
|
+
offset="0%"
|
|
83
|
+
stop-color="rgba(26,26,26,0.9)"
|
|
84
|
+
/>
|
|
85
|
+
<stop
|
|
86
|
+
id="eBsErktH1944-fill-1"
|
|
87
|
+
offset="100%"
|
|
88
|
+
stop-color="rgba(26,26,26,0)"
|
|
89
|
+
/>
|
|
90
|
+
</linearGradient>
|
|
91
|
+
</defs>
|
|
92
|
+
<path
|
|
93
|
+
d="M0,6.207c0-1.646199.65395-3.224973,1.817988-4.389012C2.982026,0.65395,4.560801,0,6.207,0h23.586c1.646199,0,3.224973.65395,4.389012,1.817988s1.817988,2.742813,1.817988,4.389012v20.06c0,3.546-4.488,5.085-6.664,2.286l-6.805-8.754v10.615c0,3.085063-2.500937,5.586-5.586,5.586h-10.738c-1.646199,0-3.224973-.65395-4.389012-1.817988s-1.817988-2.742813-1.817988-4.389012L0,6.207ZM6.207,4.966c-.686,0-1.241.555-1.241,1.24v23.587c0,.686.555,1.242,1.24,1.242h10.925c.343,0,.434-.278.434-.621v-14.234c0-3.547,4.488-5.086,6.665-2.286l6.805,8.753v-16.44c0-.686.064-1.241-.621-1.241h-24.207Z"
|
|
94
|
+
transform="translate(3 3)"
|
|
95
|
+
clip-rule="evenodd"
|
|
96
|
+
fill="#12fff7"
|
|
97
|
+
fill-rule="evenodd"
|
|
98
|
+
/>
|
|
99
|
+
<path
|
|
100
|
+
d="M0,6.207c0-1.646199.65395-3.224973,1.817988-4.389012C2.982026,0.65395,4.560801,0,6.207,0h23.586c1.646199,0,3.224973.65395,4.389012,1.817988s1.817988,2.742813,1.817988,4.389012v20.06c0,3.546-4.488,5.085-6.664,2.286l-6.805-8.754v10.615c0,3.085063-2.500937,5.586-5.586,5.586h-10.738c-1.646199,0-3.224973-.65395-4.389012-1.817988s-1.817988-2.742813-1.817988-4.389012L0,6.207ZM6.207,4.966c-.686,0-1.241.555-1.241,1.24v23.587c0,.686.555,1.242,1.24,1.242h10.925c.343,0,.434-.278.434-.621v-14.234c0-3.547,4.488-5.086,6.665-2.286l6.805,8.753v-16.44c0-.686.064-1.241-.621-1.241h-24.207Z"
|
|
101
|
+
transform="translate(3 3)"
|
|
102
|
+
clip-rule="evenodd"
|
|
103
|
+
fill="url(#eBsErktH1943-fill)"
|
|
104
|
+
fill-rule="evenodd"
|
|
105
|
+
/>
|
|
106
|
+
<path
|
|
107
|
+
d="M0,6.207c0-1.646199.65395-3.224973,1.817988-4.389012C2.982026,0.65395,4.560801,0,6.207,0h23.586c1.646199,0,3.224973.65395,4.389012,1.817988s1.817988,2.742813,1.817988,4.389012v20.06c0,3.546-4.488,5.085-6.664,2.286l-6.805-8.754v10.615c0,3.085063-2.500937,5.586-5.586,5.586h-10.738c-1.646199,0-3.224973-.65395-4.389012-1.817988s-1.817988-2.742813-1.817988-4.389012L0,6.207ZM6.207,4.966c-.686,0-1.241.555-1.241,1.24v23.587c0,.686.555,1.242,1.24,1.242h10.925c.343,0,.434-.278.434-.621v-14.234c0-3.547,4.488-5.086,6.665-2.286l6.805,8.753v-16.44c0-.686.064-1.241-.621-1.241h-24.207Z"
|
|
108
|
+
transform="translate(3 3)"
|
|
109
|
+
clip-rule="evenodd"
|
|
110
|
+
fill="url(#eBsErktH1944-fill)"
|
|
111
|
+
fill-rule="evenodd"
|
|
112
|
+
/>
|
|
113
|
+
<path
|
|
114
|
+
id="eBsErktH1945"
|
|
115
|
+
style="filter: drop-shadow(0px 0px 0px #5cff61)"
|
|
116
|
+
d="M29.793,0c1.646199,0,3.224973.65395,4.389012,1.817988s1.817988,2.742813,1.817988,4.389012v20.06c0,3.546-4.488,5.085-6.664,2.286l-6.805-8.754v10.615c0,3.085063-2.500937,5.586-5.586,5.586.342417,0,.62-.277583.62-.62v-19.2c0-3.547,4.488-5.086,6.665-2.286l6.805,8.753v-21.406c0-.685-.556-1.241-1.242-1.241Z"
|
|
117
|
+
transform="translate(3 3)"
|
|
118
|
+
fill="#b9ffb3"
|
|
119
|
+
/>
|
|
120
|
+
<path
|
|
121
|
+
id="eBsErktH1946"
|
|
122
|
+
style="filter: drop-shadow(0px 0px 0px #5cff61)"
|
|
123
|
+
d="M29.793,0c1.646199,0,3.224973.65395,4.389012,1.817988s1.817988,2.742813,1.817988,4.389012v20.06c0,3.546-4.488,5.085-6.664,2.286l-6.805-8.754v10.615c0,3.085063-2.500937,5.586-5.586,5.586.342417,0,.62-.277583.62-.62v-19.2c0-3.547,4.488-5.086,6.665-2.286l6.805,8.753v-21.406c0-.685-.556-1.241-1.242-1.241Z"
|
|
124
|
+
transform="translate(3 3)"
|
|
125
|
+
fill="#b9ffb3"
|
|
126
|
+
/>
|
|
127
|
+
<path
|
|
128
|
+
id="eBsErktH1947"
|
|
129
|
+
style="filter: drop-shadow(0px 0px 0px #5cff61)"
|
|
130
|
+
d="M29.793,0c1.646199,0,3.224973.65395,4.389012,1.817988s1.817988,2.742813,1.817988,4.389012v20.06c0,3.546-4.488,5.085-6.664,2.286l-6.805-8.754v10.615c0,3.085063-2.500937,5.586-5.586,5.586.342417,0,.62-.277583.62-.62v-19.2c0-3.547,4.488-5.086,6.665-2.286l6.805,8.753v-21.406c0-.685-.556-1.241-1.242-1.241Z"
|
|
131
|
+
transform="translate(3 3)"
|
|
132
|
+
fill="#b9ffb3"
|
|
133
|
+
/>
|
|
134
|
+
</svg>
|
|
40
135
|
</div>
|
|
41
136
|
<h1>Thank you for using Neon</h1>
|
|
42
|
-
<p>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</body>
|
|
137
|
+
<p>You may close this page now</p>
|
|
138
|
+
</body>
|
|
139
|
+
</html>
|
package/commands/projects.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from '../log.js';
|
|
2
|
-
import { projectCreateRequest } from '../parameters.gen.js';
|
|
2
|
+
import { projectCreateRequest, projectUpdateRequest, } from '../parameters.gen.js';
|
|
3
3
|
import { writer } from '../writer.js';
|
|
4
4
|
import { psql } from '../utils/psql.js';
|
|
5
5
|
import { updateContextFile } from '../context.js';
|
|
@@ -49,6 +49,16 @@ export const builder = (argv) => {
|
|
|
49
49
|
describe: projectCreateRequest['project.name'].description,
|
|
50
50
|
type: 'string',
|
|
51
51
|
},
|
|
52
|
+
'ip-allow': {
|
|
53
|
+
describe: projectUpdateRequest['project.settings.allowed_ips.ips']
|
|
54
|
+
.description,
|
|
55
|
+
type: 'string',
|
|
56
|
+
array: true,
|
|
57
|
+
},
|
|
58
|
+
'ip-primary-only': {
|
|
59
|
+
describe: projectUpdateRequest['project.settings.allowed_ips.primary_branch_only'].description,
|
|
60
|
+
type: 'boolean',
|
|
61
|
+
},
|
|
52
62
|
}), async (args) => {
|
|
53
63
|
await update(args);
|
|
54
64
|
})
|
|
@@ -117,10 +127,24 @@ const deleteProject = async (props) => {
|
|
|
117
127
|
});
|
|
118
128
|
};
|
|
119
129
|
const update = async (props) => {
|
|
130
|
+
const project = {};
|
|
131
|
+
if (props.name) {
|
|
132
|
+
project.name = props.name;
|
|
133
|
+
}
|
|
134
|
+
if (props.ipAllow || props.ipPrimaryOnly != undefined) {
|
|
135
|
+
const { data } = await props.apiClient.getProject(props.id);
|
|
136
|
+
const existingAllowedIps = data.project.settings?.allowed_ips;
|
|
137
|
+
project.settings = {
|
|
138
|
+
allowed_ips: {
|
|
139
|
+
ips: props.ipAllow ?? existingAllowedIps?.ips ?? [],
|
|
140
|
+
primary_branch_only: props.ipPrimaryOnly ??
|
|
141
|
+
existingAllowedIps?.primary_branch_only ??
|
|
142
|
+
false,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
120
146
|
const { data } = await props.apiClient.updateProject(props.id, {
|
|
121
|
-
project
|
|
122
|
-
name: props.name,
|
|
123
|
-
},
|
|
147
|
+
project,
|
|
124
148
|
});
|
|
125
149
|
writer(props).end(data.project, { fields: PROJECT_FIELDS });
|
|
126
150
|
};
|
|
@@ -71,8 +71,37 @@ describe('projects', () => {
|
|
|
71
71
|
},
|
|
72
72
|
});
|
|
73
73
|
testCliCommand({
|
|
74
|
-
name: 'update',
|
|
75
|
-
args: ['projects', 'update', 'test', '--name', '
|
|
74
|
+
name: 'update name',
|
|
75
|
+
args: ['projects', 'update', 'test', '--name', 'test_project_new_name'],
|
|
76
|
+
expected: {
|
|
77
|
+
snapshot: true,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
testCliCommand({
|
|
81
|
+
name: 'update ip allow',
|
|
82
|
+
args: [
|
|
83
|
+
'projects',
|
|
84
|
+
'update',
|
|
85
|
+
'test',
|
|
86
|
+
'--ip-allow',
|
|
87
|
+
'127.0.0.1',
|
|
88
|
+
'192.168.1.2/22',
|
|
89
|
+
'--ip-primary-only',
|
|
90
|
+
],
|
|
91
|
+
expected: {
|
|
92
|
+
snapshot: true,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
testCliCommand({
|
|
96
|
+
name: 'update ip allow primary only flag',
|
|
97
|
+
args: ['projects', 'update', 'test', '--ip-primary-only', 'false'],
|
|
98
|
+
expected: {
|
|
99
|
+
snapshot: true,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
testCliCommand({
|
|
103
|
+
name: 'update ip allow remove',
|
|
104
|
+
args: ['projects', 'update', 'test', '--ip-allow'],
|
|
76
105
|
expected: {
|
|
77
106
|
snapshot: true,
|
|
78
107
|
},
|
package/commands/set_context.js
CHANGED
|
@@ -2,9 +2,7 @@ import { updateContextFile } from '../context.js';
|
|
|
2
2
|
import { branchIdFromProps } from '../utils/enrichers.js';
|
|
3
3
|
export const command = 'set-context';
|
|
4
4
|
export const describe = 'Set the current context';
|
|
5
|
-
export const builder = (argv) => argv
|
|
6
|
-
.usage('$0 set-context [options]')
|
|
7
|
-
.options({
|
|
5
|
+
export const builder = (argv) => argv.usage('$0 set-context [options]').options({
|
|
8
6
|
'project-id': {
|
|
9
7
|
describe: 'Project ID',
|
|
10
8
|
type: 'string',
|
package/index.js
CHANGED
|
@@ -25,7 +25,13 @@ import { isAxiosError } from 'axios';
|
|
|
25
25
|
import { matchErrorCode } from './errors.js';
|
|
26
26
|
import { showHelp } from './help.js';
|
|
27
27
|
import { currentContextFile, enrichFromContext } from './context.js';
|
|
28
|
-
const NO_SUBCOMMANDS_VERBS = [
|
|
28
|
+
const NO_SUBCOMMANDS_VERBS = [
|
|
29
|
+
'auth',
|
|
30
|
+
'me',
|
|
31
|
+
'cs',
|
|
32
|
+
'connection-string',
|
|
33
|
+
'set-context',
|
|
34
|
+
];
|
|
29
35
|
let builder = yargs(hideBin(process.argv));
|
|
30
36
|
builder = builder
|
|
31
37
|
.scriptName(pkg.name)
|
|
@@ -101,7 +107,9 @@ builder = builder
|
|
|
101
107
|
})
|
|
102
108
|
.alias('help', 'h')
|
|
103
109
|
.middleware(async (args) => {
|
|
104
|
-
if (args.help ||
|
|
110
|
+
if (args.help ||
|
|
111
|
+
(args._.length === 1 &&
|
|
112
|
+
!NO_SUBCOMMANDS_VERBS.includes(args._[0]))) {
|
|
105
113
|
await showHelp(builder);
|
|
106
114
|
}
|
|
107
115
|
})
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "git@github.com:neondatabase/neonctl.git"
|
|
6
6
|
},
|
|
7
7
|
"type": "module",
|
|
8
|
-
"version": "1.24.
|
|
8
|
+
"version": "1.24.3",
|
|
9
9
|
"description": "CLI tool for NeonDB Cloud management",
|
|
10
10
|
"main": "index.js",
|
|
11
11
|
"author": "NeonDB",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"lint-staged": "^13.0.3",
|
|
45
45
|
"oauth2-mock-server": "^6.0.0",
|
|
46
46
|
"pkg": "^5.8.1",
|
|
47
|
-
"prettier": "^
|
|
47
|
+
"prettier": "^3.1.0",
|
|
48
48
|
"rollup": "^3.26.2",
|
|
49
49
|
"semantic-release": "^21.0.2",
|
|
50
50
|
"strip-ansi": "^7.1.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"typescript": "^4.7.4"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@neondatabase/api-client": "1.1
|
|
56
|
+
"@neondatabase/api-client": "1.4.1",
|
|
57
57
|
"@segment/analytics-node": "^1.0.0-beta.26",
|
|
58
58
|
"axios": "^1.4.0",
|
|
59
59
|
"axios-debug-log": "^1.0.0",
|
|
@@ -85,14 +85,18 @@
|
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"watch": "tsc --watch",
|
|
88
|
-
"lint": "tsc --noEmit && eslint src --ext .ts",
|
|
88
|
+
"lint": "tsc --noEmit && eslint src --ext .ts && prettier --check .",
|
|
89
89
|
"build": "npm run generateParams && npm run clean && tsc && cp src/*.html package*.json README.md ./dist",
|
|
90
90
|
"clean": "rm -rf dist",
|
|
91
91
|
"generateParams": "node --loader ts-node/esm ./generateOptionsFromSpec.ts",
|
|
92
92
|
"start": "node src/index.js",
|
|
93
|
-
"test": "node --experimental-vm-modules node_modules/.bin/jest"
|
|
93
|
+
"test": "node --experimental-vm-modules node_modules/.bin/jest",
|
|
94
|
+
"prepare": "test -d .git && husky install || true"
|
|
94
95
|
},
|
|
95
96
|
"lint-staged": {
|
|
97
|
+
".{cjs,js,json,md,html}": [
|
|
98
|
+
"prettier --write"
|
|
99
|
+
],
|
|
96
100
|
"*.ts": [
|
|
97
101
|
"eslint --cache --fix",
|
|
98
102
|
"prettier --write"
|
package/parameters.gen.js
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
export const projectCreateRequest = {
|
|
3
3
|
'project.settings.quota.active_time_seconds': {
|
|
4
4
|
type: "number",
|
|
5
|
-
description: "The total amount of wall-clock time allowed to be spent by project's compute endpoints.\n",
|
|
5
|
+
description: "The total amount of wall-clock time allowed to be spent by the project's compute endpoints.\n",
|
|
6
6
|
demandOption: false,
|
|
7
7
|
},
|
|
8
8
|
'project.settings.quota.compute_time_seconds': {
|
|
9
9
|
type: "number",
|
|
10
|
-
description: "The total amount of CPU seconds allowed to be spent by project's compute endpoints.\n",
|
|
10
|
+
description: "The total amount of CPU seconds allowed to be spent by the project's compute endpoints.\n",
|
|
11
11
|
demandOption: false,
|
|
12
12
|
},
|
|
13
13
|
'project.settings.quota.written_data_bytes': {
|
|
14
14
|
type: "number",
|
|
15
|
-
description: "Total amount of data written to all project's branches.\n",
|
|
15
|
+
description: "Total amount of data written to all of a project's branches.\n",
|
|
16
16
|
demandOption: false,
|
|
17
17
|
},
|
|
18
18
|
'project.settings.quota.data_transfer_bytes': {
|
|
19
19
|
type: "number",
|
|
20
|
-
description: "Total amount of data transferred from all project's branches using proxy.\n",
|
|
20
|
+
description: "Total amount of data transferred from all of a project's branches using the proxy.\n",
|
|
21
21
|
demandOption: false,
|
|
22
22
|
},
|
|
23
23
|
'project.settings.quota.logical_size_bytes': {
|
|
@@ -25,6 +25,16 @@ export const projectCreateRequest = {
|
|
|
25
25
|
description: "Limit on the logical size of every project's branch.\n",
|
|
26
26
|
demandOption: false,
|
|
27
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: true,
|
|
32
|
+
},
|
|
33
|
+
'project.settings.allowed_ips.primary_branch_only': {
|
|
34
|
+
type: "boolean",
|
|
35
|
+
description: "If true, the list will be applied only to the primary branch.",
|
|
36
|
+
demandOption: true,
|
|
37
|
+
},
|
|
28
38
|
'project.name': {
|
|
29
39
|
type: "string",
|
|
30
40
|
description: "The project name",
|
|
@@ -47,18 +57,23 @@ export const projectCreateRequest = {
|
|
|
47
57
|
},
|
|
48
58
|
'project.provisioner': {
|
|
49
59
|
type: "string",
|
|
50
|
-
description: "The Neon compute provisioner.\n",
|
|
60
|
+
description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n",
|
|
51
61
|
demandOption: false,
|
|
52
|
-
choices: ["k8s-pod", "k8s-neonvm"
|
|
62
|
+
choices: ["k8s-pod", "k8s-neonvm"],
|
|
53
63
|
},
|
|
54
64
|
'project.region_id': {
|
|
55
65
|
type: "string",
|
|
56
|
-
description: "The region identifier.
|
|
66
|
+
description: "The region identifier. Refer to our [Regions](https://neon.tech/docs/introduction/regions) documentation for supported regions. Values are specified in this format: `aws-us-east-1`\n",
|
|
67
|
+
demandOption: false,
|
|
68
|
+
},
|
|
69
|
+
'project.default_endpoint_settings.suspend_timeout_seconds': {
|
|
70
|
+
type: "number",
|
|
71
|
+
description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
57
72
|
demandOption: false,
|
|
58
73
|
},
|
|
59
74
|
'project.pg_version': {
|
|
60
75
|
type: "number",
|
|
61
|
-
description: "The major PostgreSQL version number. Currently supported
|
|
76
|
+
description: "The major PostgreSQL version number. Currently supported versions are `14`, `15` and `16`.",
|
|
62
77
|
demandOption: false,
|
|
63
78
|
},
|
|
64
79
|
'project.store_passwords': {
|
|
@@ -68,14 +83,71 @@ export const projectCreateRequest = {
|
|
|
68
83
|
},
|
|
69
84
|
'project.history_retention_seconds': {
|
|
70
85
|
type: "number",
|
|
71
|
-
description: "The number of seconds to retain PITR backup history for this project
|
|
86
|
+
description: "The number of seconds to retain the point-in-time restore (PITR) backup history for this project.\nThe default is 604800 seconds (7 days).\n",
|
|
87
|
+
demandOption: false,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
export const projectUpdateRequest = {
|
|
91
|
+
'project.settings.quota.active_time_seconds': {
|
|
92
|
+
type: "number",
|
|
93
|
+
description: "The total amount of wall-clock time allowed to be spent by the project's compute endpoints.\n",
|
|
94
|
+
demandOption: false,
|
|
95
|
+
},
|
|
96
|
+
'project.settings.quota.compute_time_seconds': {
|
|
97
|
+
type: "number",
|
|
98
|
+
description: "The total amount of CPU seconds allowed to be spent by the project's compute endpoints.\n",
|
|
99
|
+
demandOption: false,
|
|
100
|
+
},
|
|
101
|
+
'project.settings.quota.written_data_bytes': {
|
|
102
|
+
type: "number",
|
|
103
|
+
description: "Total amount of data written to all of a project's branches.\n",
|
|
104
|
+
demandOption: false,
|
|
105
|
+
},
|
|
106
|
+
'project.settings.quota.data_transfer_bytes': {
|
|
107
|
+
type: "number",
|
|
108
|
+
description: "Total amount of data transferred from all of a project's branches using the proxy.\n",
|
|
109
|
+
demandOption: false,
|
|
110
|
+
},
|
|
111
|
+
'project.settings.quota.logical_size_bytes': {
|
|
112
|
+
type: "number",
|
|
113
|
+
description: "Limit on the logical size of every project's branch.\n",
|
|
114
|
+
demandOption: false,
|
|
115
|
+
},
|
|
116
|
+
'project.settings.allowed_ips.ips': {
|
|
117
|
+
type: "array",
|
|
118
|
+
description: "A list of IP addresses that are allowed to connect to the endpoint.",
|
|
119
|
+
demandOption: true,
|
|
120
|
+
},
|
|
121
|
+
'project.settings.allowed_ips.primary_branch_only': {
|
|
122
|
+
type: "boolean",
|
|
123
|
+
description: "If true, the list will be applied only to the primary branch.",
|
|
124
|
+
demandOption: true,
|
|
125
|
+
},
|
|
126
|
+
'project.name': {
|
|
127
|
+
type: "string",
|
|
128
|
+
description: "The project name",
|
|
129
|
+
demandOption: false,
|
|
130
|
+
},
|
|
131
|
+
'project.default_endpoint_settings.suspend_timeout_seconds': {
|
|
132
|
+
type: "number",
|
|
133
|
+
description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
134
|
+
demandOption: false,
|
|
135
|
+
},
|
|
136
|
+
'project.history_retention_seconds': {
|
|
137
|
+
type: "number",
|
|
138
|
+
description: "The number of seconds to retain the point-in-time restore (PITR) backup history for this project.\nThe default is 604800 seconds (7 days).\n",
|
|
72
139
|
demandOption: false,
|
|
73
140
|
},
|
|
74
141
|
};
|
|
75
142
|
export const branchCreateRequest = {
|
|
143
|
+
'endpoints': {
|
|
144
|
+
type: "array",
|
|
145
|
+
description: undefined,
|
|
146
|
+
demandOption: false,
|
|
147
|
+
},
|
|
76
148
|
'branch.parent_id': {
|
|
77
149
|
type: "string",
|
|
78
|
-
description: "The `branch_id` of the parent branch
|
|
150
|
+
description: "The `branch_id` of the parent branch. If omitted or empty, the branch will be created from the project's primary branch.\n",
|
|
79
151
|
demandOption: false,
|
|
80
152
|
},
|
|
81
153
|
'branch.name': {
|
|
@@ -103,13 +175,13 @@ export const branchCreateRequestEndpointOptions = {
|
|
|
103
175
|
},
|
|
104
176
|
'provisioner': {
|
|
105
177
|
type: "string",
|
|
106
|
-
description: "The Neon compute provisioner.\n",
|
|
178
|
+
description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n",
|
|
107
179
|
demandOption: false,
|
|
108
|
-
choices: ["k8s-pod", "k8s-neonvm"
|
|
180
|
+
choices: ["k8s-pod", "k8s-neonvm"],
|
|
109
181
|
},
|
|
110
182
|
'suspend_timeout_seconds': {
|
|
111
183
|
type: "number",
|
|
112
|
-
description: "Duration of inactivity in seconds after which endpoint
|
|
184
|
+
description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
113
185
|
demandOption: false,
|
|
114
186
|
},
|
|
115
187
|
};
|
|
@@ -139,9 +211,9 @@ export const endpointCreateRequest = {
|
|
|
139
211
|
},
|
|
140
212
|
'endpoint.provisioner': {
|
|
141
213
|
type: "string",
|
|
142
|
-
description: "The Neon compute provisioner.\n",
|
|
214
|
+
description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n",
|
|
143
215
|
demandOption: false,
|
|
144
|
-
choices: ["k8s-pod", "k8s-neonvm"
|
|
216
|
+
choices: ["k8s-pod", "k8s-neonvm"],
|
|
145
217
|
},
|
|
146
218
|
'endpoint.pooler_enabled': {
|
|
147
219
|
type: "boolean",
|
|
@@ -156,7 +228,7 @@ export const endpointCreateRequest = {
|
|
|
156
228
|
},
|
|
157
229
|
'endpoint.disabled': {
|
|
158
230
|
type: "boolean",
|
|
159
|
-
description: "Whether to restrict connections to the compute endpoint\n",
|
|
231
|
+
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",
|
|
160
232
|
demandOption: false,
|
|
161
233
|
},
|
|
162
234
|
'endpoint.passwordless_access': {
|
|
@@ -166,7 +238,7 @@ export const endpointCreateRequest = {
|
|
|
166
238
|
},
|
|
167
239
|
'endpoint.suspend_timeout_seconds': {
|
|
168
240
|
type: "number",
|
|
169
|
-
description: "Duration of inactivity in seconds after which endpoint
|
|
241
|
+
description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
170
242
|
demandOption: false,
|
|
171
243
|
},
|
|
172
244
|
};
|
|
@@ -178,9 +250,9 @@ export const endpointUpdateRequest = {
|
|
|
178
250
|
},
|
|
179
251
|
'endpoint.provisioner': {
|
|
180
252
|
type: "string",
|
|
181
|
-
description: "The Neon compute provisioner.\n",
|
|
253
|
+
description: "The Neon compute provisioner.\nSpecify the `k8s-neonvm` provisioner to create a compute endpoint that supports Autoscaling.\n",
|
|
182
254
|
demandOption: false,
|
|
183
|
-
choices: ["k8s-pod", "k8s-neonvm"
|
|
255
|
+
choices: ["k8s-pod", "k8s-neonvm"],
|
|
184
256
|
},
|
|
185
257
|
'endpoint.pooler_enabled': {
|
|
186
258
|
type: "boolean",
|
|
@@ -195,7 +267,7 @@ export const endpointUpdateRequest = {
|
|
|
195
267
|
},
|
|
196
268
|
'endpoint.disabled': {
|
|
197
269
|
type: "boolean",
|
|
198
|
-
description: "Whether to restrict connections to the compute endpoint\n",
|
|
270
|
+
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",
|
|
199
271
|
demandOption: false,
|
|
200
272
|
},
|
|
201
273
|
'endpoint.passwordless_access': {
|
|
@@ -205,7 +277,7 @@ export const endpointUpdateRequest = {
|
|
|
205
277
|
},
|
|
206
278
|
'endpoint.suspend_timeout_seconds': {
|
|
207
279
|
type: "number",
|
|
208
|
-
description: "Duration of inactivity in seconds after which endpoint
|
|
280
|
+
description: "Duration of inactivity in seconds after which the compute endpoint is\nautomatically suspended. The value `0` means use the global default.\nThe value `-1` means never suspend. The default value is `300` seconds (5 minutes).\nThe maximum value is `604800` seconds (1 week). For more information, see\n[Auto-suspend configuration](https://neon.tech/docs/manage/endpoints#auto-suspend-configuration).\n",
|
|
209
281
|
demandOption: false,
|
|
210
282
|
},
|
|
211
283
|
};
|
package/utils/formats.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const HAIKU_REGEX = /^[a-z]+-[a-z]
|
|
1
|
+
const HAIKU_REGEX = /^[a-z]+-[a-z]+-[a-z0-9]+$/;
|
|
2
2
|
export const looksLikeBranchId = (branch) => branch.startsWith('br-') && HAIKU_REGEX.test(branch.substring(3));
|
|
3
3
|
const LSN_REGEX = /^[a-fA-F0-9]{1,8}\/[a-fA-F0-9]{1,8}$/;
|
|
4
4
|
export const looksLikeLSN = (lsn) => LSN_REGEX.test(lsn);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { test, describe, expect } from '@jest/globals';
|
|
2
|
+
import { looksLikeBranchId, looksLikeLSN, looksLikeTimestamp } from './formats';
|
|
3
|
+
describe('branch formats', () => {
|
|
4
|
+
test('branch name', () => {
|
|
5
|
+
expect(looksLikeBranchId('master')).toBe(false);
|
|
6
|
+
});
|
|
7
|
+
test('initial short', () => {
|
|
8
|
+
expect(looksLikeBranchId('br-flower-sunshine-123456')).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
test('update 1, longer version', () => {
|
|
11
|
+
expect(looksLikeBranchId('br-flower-sunshine-12345678')).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
test('update 2, includes region', () => {
|
|
14
|
+
expect(looksLikeBranchId('br-bold-recipe-a13oexw7')).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
describe('timestamp formats', () => {
|
|
18
|
+
test('valid', () => {
|
|
19
|
+
expect(looksLikeTimestamp('2021-03-13T19:47:33.000Z')).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
test('invalid', () => {
|
|
22
|
+
expect(looksLikeTimestamp('branch_name')).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe('LSN formats', () => {
|
|
26
|
+
test('valid', () => {
|
|
27
|
+
expect(looksLikeLSN('0/1F56000')).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
test('invalid', () => {
|
|
30
|
+
expect(looksLikeLSN('branch_name')).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
});
|