@shipdit/cli 0.2.1 → 0.3.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/dist/index.mjs +212 -98
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -378,10 +378,11 @@ const _$1 = (...t) => hc(...t);
|
|
|
378
378
|
const v$1 = (...t) => hc(...t);
|
|
379
379
|
const y$1 = (...t) => hc(...t);
|
|
380
380
|
const b$1 = (...t) => hc(...t);
|
|
381
|
-
|
|
381
|
+
const x$1 = (...t) => hc(...t);
|
|
382
|
+
function S$1(e) {
|
|
382
383
|
return `${e.replace(/\/+$/, ``)}/api/v1/rpc`;
|
|
383
384
|
}
|
|
384
|
-
function
|
|
385
|
+
function C$1(e) {
|
|
385
386
|
return {
|
|
386
387
|
...e.fetch ? { fetch: e.fetch } : {},
|
|
387
388
|
init: { credentials: e.client === `dashboard` ? `include` : `same-origin` },
|
|
@@ -391,129 +392,148 @@ function S$1(e) {
|
|
|
391
392
|
}
|
|
392
393
|
};
|
|
393
394
|
}
|
|
394
|
-
async function
|
|
395
|
+
async function w$1(e, t) {
|
|
395
396
|
return i$1(await e({ json: t }));
|
|
396
397
|
}
|
|
397
|
-
function
|
|
398
|
-
let t =
|
|
398
|
+
function T$1(e) {
|
|
399
|
+
let t = S$1(e.baseUrl), n = C$1(e), r = a$1(t, n), i = o$1(t, n), T = s$1(t, n), E = c$1(t, n), D = l$1(t, n), O = u$1(t, n), k = d$2(t, n), A = f$2(t, n), j = g$1(t, n), M = h$1(t, n), N = p$1(t, n), P = m$1(t, n), F = _$1(t, n), I = v$1(t, n), L = y$1(t, n), R = b$1(t, n), z = x$1(t, n);
|
|
399
400
|
return {
|
|
400
401
|
me: {
|
|
401
|
-
get: (e = {}) =>
|
|
402
|
-
feedback: (e) =>
|
|
402
|
+
get: (e = {}) => w$1(r.me.$post, e),
|
|
403
|
+
feedback: (e) => w$1(r.me.feedback.$post, e)
|
|
403
404
|
},
|
|
404
405
|
project: {
|
|
405
|
-
list: (e = {}) =>
|
|
406
|
-
create: (e) =>
|
|
407
|
-
update: (e) =>
|
|
408
|
-
archive: (e) =>
|
|
409
|
-
listTeams: (e) =>
|
|
410
|
-
setTeams: (e) =>
|
|
406
|
+
list: (e = {}) => w$1(i.project.list.$post, e),
|
|
407
|
+
create: (e) => w$1(i.project.create.$post, e),
|
|
408
|
+
update: (e) => w$1(i.project.update.$post, e),
|
|
409
|
+
archive: (e) => w$1(i.project.archive.$post, e),
|
|
410
|
+
listTeams: (e) => w$1(i.project.listTeams.$post, e),
|
|
411
|
+
setTeams: (e) => w$1(i.project.setTeams.$post, e)
|
|
411
412
|
},
|
|
412
|
-
team: { listMembers: (e) =>
|
|
413
|
+
team: { listMembers: (e) => w$1(R.team.listMembers.$post, e) },
|
|
413
414
|
environment: {
|
|
414
|
-
list: (e) =>
|
|
415
|
-
create: (e) =>
|
|
416
|
-
update: (e) =>
|
|
417
|
-
archive: (e) =>
|
|
415
|
+
list: (e) => w$1(T.environment.list.$post, e),
|
|
416
|
+
create: (e) => w$1(T.environment.create.$post, e),
|
|
417
|
+
update: (e) => w$1(T.environment.update.$post, e),
|
|
418
|
+
archive: (e) => w$1(T.environment.archive.$post, e)
|
|
418
419
|
},
|
|
419
420
|
flag: {
|
|
420
|
-
list: (e) =>
|
|
421
|
-
get: (e) =>
|
|
422
|
-
create: (e) =>
|
|
423
|
-
update: (e) =>
|
|
424
|
-
archive: (e) =>
|
|
425
|
-
updateEnvironment: (e) =>
|
|
426
|
-
toggleEnvironment: (e) =>
|
|
427
|
-
listEnvironmentStates: (e) =>
|
|
428
|
-
pull: (e) =>
|
|
429
|
-
diff: (e) =>
|
|
430
|
-
push: (e) =>
|
|
421
|
+
list: (e) => w$1(E.flag.list.$post, e),
|
|
422
|
+
get: (e) => w$1(E.flag.get.$post, e),
|
|
423
|
+
create: (e) => w$1(E.flag.create.$post, e),
|
|
424
|
+
update: (e) => w$1(E.flag.update.$post, e),
|
|
425
|
+
archive: (e) => w$1(E.flag.archive.$post, e),
|
|
426
|
+
updateEnvironment: (e) => w$1(E.flag.updateEnvironment.$post, e),
|
|
427
|
+
toggleEnvironment: (e) => w$1(E.flag.toggleEnvironment.$post, e),
|
|
428
|
+
listEnvironmentStates: (e) => w$1(E.flag.listEnvironmentStates.$post, e),
|
|
429
|
+
pull: (e) => w$1(E.flag.pull.$post, e),
|
|
430
|
+
diff: (e) => w$1(E.flag.diff.$post, e),
|
|
431
|
+
push: (e) => w$1(E.flag.push.$post, e)
|
|
431
432
|
},
|
|
432
433
|
apiKey: {
|
|
433
|
-
list: (e = {}) =>
|
|
434
|
-
create: (e) =>
|
|
435
|
-
revoke: (e) =>
|
|
434
|
+
list: (e = {}) => w$1(D.apiKey.list.$post, e),
|
|
435
|
+
create: (e) => w$1(D.apiKey.create.$post, e),
|
|
436
|
+
revoke: (e) => w$1(D.apiKey.revoke.$post, e)
|
|
436
437
|
},
|
|
437
438
|
sdkKey: {
|
|
438
|
-
list: (e = {}) =>
|
|
439
|
-
create: (e) =>
|
|
440
|
-
revoke: (e) =>
|
|
439
|
+
list: (e = {}) => w$1(A.sdkKey.list.$post, e),
|
|
440
|
+
create: (e) => w$1(A.sdkKey.create.$post, e),
|
|
441
|
+
revoke: (e) => w$1(A.sdkKey.revoke.$post, e)
|
|
442
|
+
},
|
|
443
|
+
serviceAccount: {
|
|
444
|
+
list: (e = {}) => w$1(j.serviceAccount.list.$post, e),
|
|
445
|
+
get: (e) => w$1(j.serviceAccount.get.$post, e),
|
|
446
|
+
create: (e) => w$1(j.serviceAccount.create.$post, e),
|
|
447
|
+
update: (e) => w$1(j.serviceAccount.update.$post, e),
|
|
448
|
+
disable: (e) => w$1(j.serviceAccount.disable.$post, e),
|
|
449
|
+
enable: (e) => w$1(j.serviceAccount.enable.$post, e),
|
|
450
|
+
delete: (e) => w$1(j.serviceAccount.delete.$post, e),
|
|
451
|
+
createToken: (e) => w$1(j.serviceAccount.createToken.$post, e),
|
|
452
|
+
listTokens: (e) => w$1(j.serviceAccount.listTokens.$post, e),
|
|
453
|
+
revokeToken: (e) => w$1(j.serviceAccount.revokeToken.$post, e)
|
|
441
454
|
},
|
|
442
455
|
segment: {
|
|
443
|
-
list: (e) =>
|
|
444
|
-
get: (e) =>
|
|
445
|
-
create: (e) =>
|
|
446
|
-
update: (e) =>
|
|
447
|
-
archive: (e) =>
|
|
448
|
-
listEnvironmentStates: (e) =>
|
|
449
|
-
updateEnvironment: (e) =>
|
|
456
|
+
list: (e) => w$1(M.segment.list.$post, e),
|
|
457
|
+
get: (e) => w$1(M.segment.get.$post, e),
|
|
458
|
+
create: (e) => w$1(M.segment.create.$post, e),
|
|
459
|
+
update: (e) => w$1(M.segment.update.$post, e),
|
|
460
|
+
archive: (e) => w$1(M.segment.archive.$post, e),
|
|
461
|
+
listEnvironmentStates: (e) => w$1(M.segment.listEnvironmentStates.$post, e),
|
|
462
|
+
updateEnvironment: (e) => w$1(M.segment.updateEnvironment.$post, e)
|
|
450
463
|
},
|
|
451
464
|
evaluatedEntity: {
|
|
452
|
-
list: (e) =>
|
|
453
|
-
get: (e) =>
|
|
454
|
-
delete: (e) =>
|
|
465
|
+
list: (e) => w$1(N.evaluatedEntity.list.$post, e),
|
|
466
|
+
get: (e) => w$1(N.evaluatedEntity.get.$post, e),
|
|
467
|
+
delete: (e) => w$1(N.evaluatedEntity.delete.$post, e)
|
|
455
468
|
},
|
|
456
469
|
evaluationFact: {
|
|
457
|
-
list: (e) =>
|
|
458
|
-
byRule: (e) =>
|
|
459
|
-
orgSummary: (e = {}) =>
|
|
460
|
-
projectSummary: (e) =>
|
|
461
|
-
simulate: (e) =>
|
|
470
|
+
list: (e) => w$1(P.evaluationFact.list.$post, e),
|
|
471
|
+
byRule: (e) => w$1(P.evaluationFact.byRule.$post, e),
|
|
472
|
+
orgSummary: (e = {}) => w$1(P.evaluationFact.orgSummary.$post, e),
|
|
473
|
+
projectSummary: (e) => w$1(P.evaluationFact.projectSummary.$post, e),
|
|
474
|
+
simulate: (e) => w$1(P.evaluationFact.simulate.$post, e)
|
|
462
475
|
},
|
|
463
|
-
snapshot: {
|
|
464
|
-
|
|
476
|
+
snapshot: {
|
|
477
|
+
publish: (e) => w$1(F.snapshot.publish.$post, e),
|
|
478
|
+
listOutbox: (e = {}) => w$1(F.snapshot.outbox.list.$post, e),
|
|
479
|
+
requeue: (e) => w$1(F.snapshot.outbox.requeue.$post, e),
|
|
480
|
+
rebuild: (e) => w$1(F.snapshot.rebuild.$post, e),
|
|
481
|
+
listPublications: (e) => w$1(F.snapshot.publications.list.$post, e)
|
|
482
|
+
},
|
|
483
|
+
device: { authorize: (e) => w$1(I.device.authorize.$post, e) },
|
|
465
484
|
billing: {
|
|
466
|
-
get: (e = {}) =>
|
|
467
|
-
attach: (e) =>
|
|
468
|
-
openPortal: (e) =>
|
|
485
|
+
get: (e = {}) => w$1(L.billing.get.$post, e),
|
|
486
|
+
attach: (e) => w$1(L.billing.attach.$post, e),
|
|
487
|
+
openPortal: (e) => w$1(L.billing.openPortal.$post, e)
|
|
469
488
|
},
|
|
470
489
|
approval: {
|
|
471
|
-
listPolicies: (e = {}) =>
|
|
472
|
-
createPolicy: (e) =>
|
|
473
|
-
updatePolicy: (e) =>
|
|
474
|
-
deletePolicy: (e) =>
|
|
475
|
-
listRequests: (e = {}) =>
|
|
476
|
-
get: (e) =>
|
|
477
|
-
approve: (e) =>
|
|
478
|
-
reject: (e) =>
|
|
479
|
-
cancel: (e) =>
|
|
490
|
+
listPolicies: (e = {}) => w$1(O.approval.listPolicies.$post, e),
|
|
491
|
+
createPolicy: (e) => w$1(O.approval.createPolicy.$post, e),
|
|
492
|
+
updatePolicy: (e) => w$1(O.approval.updatePolicy.$post, e),
|
|
493
|
+
deletePolicy: (e) => w$1(O.approval.deletePolicy.$post, e),
|
|
494
|
+
listRequests: (e = {}) => w$1(O.approval.listRequests.$post, e),
|
|
495
|
+
get: (e) => w$1(O.approval.get.$post, e),
|
|
496
|
+
approve: (e) => w$1(O.approval.approve.$post, e),
|
|
497
|
+
reject: (e) => w$1(O.approval.reject.$post, e),
|
|
498
|
+
cancel: (e) => w$1(O.approval.cancel.$post, e)
|
|
480
499
|
},
|
|
481
500
|
audit: {
|
|
482
|
-
list: (e = {}) =>
|
|
483
|
-
get: (e) =>
|
|
484
|
-
actions: (e = {}) =>
|
|
485
|
-
export: (e) =>
|
|
486
|
-
getSettings: (e = {}) =>
|
|
487
|
-
updateSettings: (e) =>
|
|
488
|
-
listDestinations: (e = {}) =>
|
|
489
|
-
createDestination: (e) =>
|
|
490
|
-
updateDestination: (e) =>
|
|
491
|
-
deleteDestination: (e) =>
|
|
492
|
-
testDestination: (e) =>
|
|
501
|
+
list: (e = {}) => w$1(k.audit.list.$post, e),
|
|
502
|
+
get: (e) => w$1(k.audit.get.$post, e),
|
|
503
|
+
actions: (e = {}) => w$1(k.audit.actions.$post, e),
|
|
504
|
+
export: (e) => w$1(k.audit.export.$post, e),
|
|
505
|
+
getSettings: (e = {}) => w$1(k.audit.getSettings.$post, e),
|
|
506
|
+
updateSettings: (e) => w$1(k.audit.updateSettings.$post, e),
|
|
507
|
+
listDestinations: (e = {}) => w$1(k.audit.listDestinations.$post, e),
|
|
508
|
+
createDestination: (e) => w$1(k.audit.createDestination.$post, e),
|
|
509
|
+
updateDestination: (e) => w$1(k.audit.updateDestination.$post, e),
|
|
510
|
+
deleteDestination: (e) => w$1(k.audit.deleteDestination.$post, e),
|
|
511
|
+
testDestination: (e) => w$1(k.audit.testDestination.$post, e)
|
|
493
512
|
},
|
|
494
513
|
sso: {
|
|
495
|
-
getSettings: (e = {}) =>
|
|
496
|
-
listProviders: (e = {}) =>
|
|
497
|
-
updateAllowedDomains: (e) =>
|
|
498
|
-
setEnforcement: (e) =>
|
|
514
|
+
getSettings: (e = {}) => w$1(z.sso.getSettings.$post, e),
|
|
515
|
+
listProviders: (e = {}) => w$1(z.sso.listProviders.$post, e),
|
|
516
|
+
updateAllowedDomains: (e) => w$1(z.sso.updateAllowedDomains.$post, e),
|
|
517
|
+
setEnforcement: (e) => w$1(z.sso.setEnforcement.$post, e)
|
|
499
518
|
},
|
|
500
519
|
raw: {
|
|
501
520
|
me: r,
|
|
502
521
|
project: i,
|
|
503
|
-
environment:
|
|
504
|
-
flag:
|
|
505
|
-
apiKey:
|
|
506
|
-
approval:
|
|
507
|
-
audit:
|
|
508
|
-
sdkKey:
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
522
|
+
environment: T,
|
|
523
|
+
flag: E,
|
|
524
|
+
apiKey: D,
|
|
525
|
+
approval: O,
|
|
526
|
+
audit: k,
|
|
527
|
+
sdkKey: A,
|
|
528
|
+
serviceAccount: j,
|
|
529
|
+
segment: M,
|
|
530
|
+
evaluatedEntity: N,
|
|
531
|
+
evaluationFact: P,
|
|
532
|
+
snapshot: F,
|
|
533
|
+
device: I,
|
|
534
|
+
billing: L,
|
|
535
|
+
team: R,
|
|
536
|
+
sso: z
|
|
517
537
|
}
|
|
518
538
|
};
|
|
519
539
|
}
|
|
@@ -1860,6 +1880,18 @@ const t$1 = createAccessControl({
|
|
|
1860
1880
|
`read`,
|
|
1861
1881
|
`manage`,
|
|
1862
1882
|
`enforce`
|
|
1883
|
+
],
|
|
1884
|
+
service_account: [
|
|
1885
|
+
`create`,
|
|
1886
|
+
`read`,
|
|
1887
|
+
`update`,
|
|
1888
|
+
`disable`,
|
|
1889
|
+
`delete`
|
|
1890
|
+
],
|
|
1891
|
+
service_account_token: [
|
|
1892
|
+
`create`,
|
|
1893
|
+
`read`,
|
|
1894
|
+
`revoke`
|
|
1863
1895
|
]
|
|
1864
1896
|
});
|
|
1865
1897
|
const n$1 = {
|
|
@@ -1944,7 +1976,19 @@ const n$1 = {
|
|
|
1944
1976
|
],
|
|
1945
1977
|
evaluated_entity: [`read`, `delete`],
|
|
1946
1978
|
billing: [`read`, `manage`],
|
|
1947
|
-
sso: [`read`, `manage`]
|
|
1979
|
+
sso: [`read`, `manage`],
|
|
1980
|
+
service_account: [
|
|
1981
|
+
`create`,
|
|
1982
|
+
`read`,
|
|
1983
|
+
`update`,
|
|
1984
|
+
`disable`,
|
|
1985
|
+
`delete`
|
|
1986
|
+
],
|
|
1987
|
+
service_account_token: [
|
|
1988
|
+
`create`,
|
|
1989
|
+
`read`,
|
|
1990
|
+
`revoke`
|
|
1991
|
+
]
|
|
1948
1992
|
}),
|
|
1949
1993
|
owner: t$1.newRole({
|
|
1950
1994
|
organization: [`update`, `delete`],
|
|
@@ -2002,6 +2046,18 @@ const n$1 = {
|
|
|
2002
2046
|
`read`,
|
|
2003
2047
|
`manage`,
|
|
2004
2048
|
`enforce`
|
|
2049
|
+
],
|
|
2050
|
+
service_account: [
|
|
2051
|
+
`create`,
|
|
2052
|
+
`read`,
|
|
2053
|
+
`update`,
|
|
2054
|
+
`disable`,
|
|
2055
|
+
`delete`
|
|
2056
|
+
],
|
|
2057
|
+
service_account_token: [
|
|
2058
|
+
`create`,
|
|
2059
|
+
`read`,
|
|
2060
|
+
`revoke`
|
|
2005
2061
|
]
|
|
2006
2062
|
})
|
|
2007
2063
|
};
|
|
@@ -4036,7 +4092,7 @@ async function createCliApiClient(runtime) {
|
|
|
4036
4092
|
sessionToken,
|
|
4037
4093
|
orgSlug: runtime.org
|
|
4038
4094
|
});
|
|
4039
|
-
const client =
|
|
4095
|
+
const client = T$1({
|
|
4040
4096
|
baseUrl: runtime.apiUrl,
|
|
4041
4097
|
client: "cli",
|
|
4042
4098
|
getHeaders: () => {
|
|
@@ -4073,7 +4129,7 @@ async function resolveProjectId(client, runtime) {
|
|
|
4073
4129
|
if (!match) throw new CliError("not_found", `Project not found: ${runtime.project}`);
|
|
4074
4130
|
projectId = match.id;
|
|
4075
4131
|
}
|
|
4076
|
-
if (!projectId) throw new CliError("validation_error", "Project is required. Pass --project, set SHIPD_PROJECT, or use
|
|
4132
|
+
if (!projectId) throw new CliError("validation_error", "Project is required. Pass --project, set SHIPD_PROJECT, or use a management key / service-account token bound to a project.");
|
|
4077
4133
|
return {
|
|
4078
4134
|
organizationId: me.organization.id,
|
|
4079
4135
|
projectId
|
|
@@ -4087,7 +4143,7 @@ async function resolveIds(client, runtime) {
|
|
|
4087
4143
|
if (!match) throw new CliError("not_found", `Environment not found: ${runtime.env}`);
|
|
4088
4144
|
environmentId = match.id;
|
|
4089
4145
|
}
|
|
4090
|
-
if (!environmentId) throw new CliError("validation_error", "Environment is required. Pass --env, set SHIPD_ENV, or use
|
|
4146
|
+
if (!environmentId) throw new CliError("validation_error", "Environment is required. Pass --env, set SHIPD_ENV, or use a management key / service-account token bound to an environment.");
|
|
4091
4147
|
return {
|
|
4092
4148
|
organizationId,
|
|
4093
4149
|
projectId,
|
|
@@ -4213,6 +4269,7 @@ function registerAuthCommands(program) {
|
|
|
4213
4269
|
return;
|
|
4214
4270
|
}
|
|
4215
4271
|
if (me.auth.type === "user") console.log(`User: ${me.auth.name} <${me.auth.email}>`);
|
|
4272
|
+
else if (me.auth.type === "service_account") console.log(`Service account: ${me.auth.serviceAccountId} (token ${me.auth.tokenId})`);
|
|
4216
4273
|
else console.log(`API key: ${me.auth.keyId}`);
|
|
4217
4274
|
console.log(`Organization: ${me.organization.slug} (${me.organization.id})`);
|
|
4218
4275
|
if (me.project) console.log(`Project: ${me.project.slug} (${me.project.id})`);
|
|
@@ -5038,7 +5095,8 @@ function registerPushCommand(program) {
|
|
|
5038
5095
|
//#endregion
|
|
5039
5096
|
//#region src/commands/snapshots.ts
|
|
5040
5097
|
function registerSnapshotsCommands(program) {
|
|
5041
|
-
program.command("snapshots").description("Data-plane snapshot operations")
|
|
5098
|
+
const snapshots = program.command("snapshots").description("Data-plane snapshot operations");
|
|
5099
|
+
snapshots.command("publish").description("Materialize the environment snapshot from Postgres and publish to the data plane").action(async (_opts, command) => {
|
|
5042
5100
|
const runtime = getRuntime(command);
|
|
5043
5101
|
const client = await createCliApiClient(runtime);
|
|
5044
5102
|
const { environmentId } = await resolveIds(client, runtime);
|
|
@@ -5049,6 +5107,62 @@ function registerSnapshotsCommands(program) {
|
|
|
5049
5107
|
}
|
|
5050
5108
|
console.log(`Published ${result.environmentKey} v${result.version} (${result.flagCount} flags) → ${result.keys.current}`);
|
|
5051
5109
|
});
|
|
5110
|
+
snapshots.command("outbox").description("List snapshot outbox rows").option("--status <status>", "Filter by status (pending, failed, dead_lettered, …)").action(async (opts, command) => {
|
|
5111
|
+
const runtime = getRuntime(command);
|
|
5112
|
+
const client = await createCliApiClient(runtime);
|
|
5113
|
+
const { environmentId } = await resolveIds(client, runtime);
|
|
5114
|
+
const result = await client.snapshot.listOutbox({
|
|
5115
|
+
environmentId,
|
|
5116
|
+
status: opts.status
|
|
5117
|
+
}).catch(mapApiError);
|
|
5118
|
+
if (runtime.json) {
|
|
5119
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5120
|
+
return;
|
|
5121
|
+
}
|
|
5122
|
+
const rows = Array.isArray(result) ? result : [];
|
|
5123
|
+
if (rows.length === 0) {
|
|
5124
|
+
console.log("No outbox rows.");
|
|
5125
|
+
return;
|
|
5126
|
+
}
|
|
5127
|
+
for (const row of rows) console.log(`#${row.id} v${row.snapshotVersion} ${row.status} attempts=${row.attempts}${row.lastError ? ` — ${row.lastError}` : ""}`);
|
|
5128
|
+
});
|
|
5129
|
+
snapshots.command("requeue").description("Requeue dead-lettered snapshot outbox rows for this environment").action(async (_opts, command) => {
|
|
5130
|
+
const runtime = getRuntime(command);
|
|
5131
|
+
const client = await createCliApiClient(runtime);
|
|
5132
|
+
const { environmentId } = await resolveIds(client, runtime);
|
|
5133
|
+
const result = await client.snapshot.requeue({ environmentId }).catch(mapApiError);
|
|
5134
|
+
if (runtime.json) {
|
|
5135
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5136
|
+
return;
|
|
5137
|
+
}
|
|
5138
|
+
console.log(`Requeued ${result.requeued} dead-lettered row(s).`);
|
|
5139
|
+
});
|
|
5140
|
+
snapshots.command("rebuild").description("Enqueue a snapshot rebuild from Postgres (does not bump version)").option("--project", "Rebuild every environment in the current project").action(async (opts, command) => {
|
|
5141
|
+
const runtime = getRuntime(command);
|
|
5142
|
+
const client = await createCliApiClient(runtime);
|
|
5143
|
+
const result = await (opts.project ? resolveProjectId(client, runtime).then(({ projectId }) => client.snapshot.rebuild({ projectId })) : resolveIds(client, runtime).then(({ environmentId }) => client.snapshot.rebuild({ environmentId }))).catch(mapApiError);
|
|
5144
|
+
if (runtime.json) {
|
|
5145
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5146
|
+
return;
|
|
5147
|
+
}
|
|
5148
|
+
console.log(`Enqueued ${result.enqueued} rebuild job(s).`);
|
|
5149
|
+
});
|
|
5150
|
+
snapshots.command("publications").description("List recorded snapshot publications for this environment").action(async (_opts, command) => {
|
|
5151
|
+
const runtime = getRuntime(command);
|
|
5152
|
+
const client = await createCliApiClient(runtime);
|
|
5153
|
+
const { environmentId } = await resolveIds(client, runtime);
|
|
5154
|
+
const result = await client.snapshot.listPublications({ environmentId }).catch(mapApiError);
|
|
5155
|
+
if (runtime.json) {
|
|
5156
|
+
console.log(JSON.stringify(result, null, 2));
|
|
5157
|
+
return;
|
|
5158
|
+
}
|
|
5159
|
+
const rows = Array.isArray(result) ? result : [];
|
|
5160
|
+
if (rows.length === 0) {
|
|
5161
|
+
console.log("No publications.");
|
|
5162
|
+
return;
|
|
5163
|
+
}
|
|
5164
|
+
for (const row of rows) console.log(`#${row.id} v${row.snapshotVersion} notify=${row.notifyStatus} ${row.contentHash.slice(0, 12)} ${row.createdAt}`);
|
|
5165
|
+
});
|
|
5052
5166
|
}
|
|
5053
5167
|
|
|
5054
5168
|
//#endregion
|