insta 0.0.54 → 0.0.55
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/dist/commands/services.js +6 -4
- package/dist/commands/template.js +7 -5
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -16,11 +16,13 @@ export function assertServiceName(name) {
|
|
|
16
16
|
if (!SERVICE_NAME_RE.test(name))
|
|
17
17
|
throw new Error('service name must be lower-kebab (a-z, 0-9, -)');
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const MAX_COMPUTE_REPLICAS = 10;
|
|
20
|
+
// Parse a replica count inside the compute plane's current safety ceiling.
|
|
20
21
|
export function parseCount(raw) {
|
|
21
22
|
const n = Number(raw);
|
|
22
|
-
if (!Number.isInteger(n) || n < 1)
|
|
23
|
-
throw new Error(`count must be
|
|
23
|
+
if (!Number.isInteger(n) || n < 1 || n > MAX_COMPUTE_REPLICAS) {
|
|
24
|
+
throw new Error(`count must be an integer between 1 and ${MAX_COMPUTE_REPLICAS}, got: ${raw}`);
|
|
25
|
+
}
|
|
24
26
|
return n;
|
|
25
27
|
}
|
|
26
28
|
// Parse a TCP port. Junk fails here rather than reaching the API as NaN (the parseCpu lesson).
|
|
@@ -216,7 +218,7 @@ export async function servicesScale(type, name, number, region, _opts) {
|
|
|
216
218
|
return;
|
|
217
219
|
if (_opts.json)
|
|
218
220
|
return printJson(res.body.service);
|
|
219
|
-
info(`scaled compute ${name} to ${machineCount}
|
|
221
|
+
info(`scaled compute ${name} to ${machineCount} replica(s)${region ? ` in ${region}` : ''}`);
|
|
220
222
|
}
|
|
221
223
|
// insta services upgrade <compute|postgres> <name> <new-spec>
|
|
222
224
|
export async function servicesUpgrade(type, name, spec, _opts) {
|
|
@@ -14,11 +14,13 @@ import { MANIFEST_FILE, collectManifestVariables, loadTemplateManifest } from '.
|
|
|
14
14
|
export function templateListLines(templates) {
|
|
15
15
|
if (!templates.length)
|
|
16
16
|
return ['(no templates published yet)'];
|
|
17
|
-
const head = ['CODE', 'VERSION', 'CATEGORY', '
|
|
17
|
+
const head = ['CODE', 'VERSION', 'CATEGORY', 'PROJECTS', 'SUCCESS', 'NAME'];
|
|
18
18
|
const numeric = [false, false, false, true, true, false];
|
|
19
19
|
const rows = templates.map((t) => [
|
|
20
20
|
t.code, t.version ?? '', t.category ?? '-',
|
|
21
|
-
String(t.
|
|
21
|
+
String(t.totalProjects ?? 0),
|
|
22
|
+
// null = nothing has concluded yet; the platform never sends 0 for that.
|
|
23
|
+
t.successRate == null ? '-' : `${t.successRate}%`,
|
|
22
24
|
t.tagline ? `${t.name} — ${t.tagline}` : (t.name ?? ''),
|
|
23
25
|
]);
|
|
24
26
|
const widths = head.map((h, i) => Math.max(h.length, ...rows.map((r) => r[i].length)));
|
|
@@ -148,12 +150,12 @@ export async function resolveVariables(vars, given, opts = {}) {
|
|
|
148
150
|
return values;
|
|
149
151
|
}
|
|
150
152
|
// The platform's machine-readable "you forgot these" answer to the POST (error=missing_variables,
|
|
151
|
-
// missing: [{name, key, description}]
|
|
152
|
-
//
|
|
153
|
+
// missing: [{name, key, description}]) — turned back into promptable variables. null = some other
|
|
154
|
+
// error, not ours to interpret.
|
|
153
155
|
export function missingVariablesFrom(body) {
|
|
154
156
|
if ((body?.error ?? body?.code) !== 'missing_variables')
|
|
155
157
|
return null;
|
|
156
|
-
const list = body?.missing ??
|
|
158
|
+
const list = body?.missing ?? [];
|
|
157
159
|
if (!Array.isArray(list))
|
|
158
160
|
return [];
|
|
159
161
|
return list.map((v) => ({ name: String(v.name ?? v.key ?? v), required: true, description: v.description }));
|
package/dist/index.js
CHANGED
|
@@ -160,7 +160,7 @@ svc.command('rename <type> <name> <new-name>').description('Rename a service and
|
|
|
160
160
|
.action(guard((type, name, newName, o) => services.servicesRename(type, name, newName, o)));
|
|
161
161
|
svc.command('set-access <type> <name> <access>').description('Set a storage service bucket access mode (access: public|private)')
|
|
162
162
|
.option('--json').action(guard((type, name, access, o) => services.servicesSetAccess(type, name, access, o)));
|
|
163
|
-
svc.command('scale <type> <name> <number> [region]').description('Set a compute service
|
|
163
|
+
svc.command('scale <type> <name> <number> [region]').description('Set a compute service same-region replica count from 1 to 10 (paid plans only)')
|
|
164
164
|
.option('--json').option('--branch <branch>', 'branch (default: current)').action(guard((type, name, number, region, o) => services.servicesScale(type, name, number, region, o)));
|
|
165
165
|
svc.command('upgrade <type> <name> <spec>').description('Change a compute service spec (paid plans only). Postgres upgrades are rejected by the platform — use `insta db limits` instead')
|
|
166
166
|
.option('--json').option('--branch <branch>', 'branch (default: current)').action(guard((type, name, spec, o) => services.servicesUpgrade(type, name, spec, o)));
|