@shipdit/cli 0.2.2 → 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 +65 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -473,7 +473,13 @@ function T$1(e) {
|
|
|
473
473
|
projectSummary: (e) => w$1(P.evaluationFact.projectSummary.$post, e),
|
|
474
474
|
simulate: (e) => w$1(P.evaluationFact.simulate.$post, e)
|
|
475
475
|
},
|
|
476
|
-
snapshot: {
|
|
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
|
+
},
|
|
477
483
|
device: { authorize: (e) => w$1(I.device.authorize.$post, e) },
|
|
478
484
|
billing: {
|
|
479
485
|
get: (e = {}) => w$1(L.billing.get.$post, e),
|
|
@@ -5089,7 +5095,8 @@ function registerPushCommand(program) {
|
|
|
5089
5095
|
//#endregion
|
|
5090
5096
|
//#region src/commands/snapshots.ts
|
|
5091
5097
|
function registerSnapshotsCommands(program) {
|
|
5092
|
-
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) => {
|
|
5093
5100
|
const runtime = getRuntime(command);
|
|
5094
5101
|
const client = await createCliApiClient(runtime);
|
|
5095
5102
|
const { environmentId } = await resolveIds(client, runtime);
|
|
@@ -5100,6 +5107,62 @@ function registerSnapshotsCommands(program) {
|
|
|
5100
5107
|
}
|
|
5101
5108
|
console.log(`Published ${result.environmentKey} v${result.version} (${result.flagCount} flags) → ${result.keys.current}`);
|
|
5102
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
|
+
});
|
|
5103
5166
|
}
|
|
5104
5167
|
|
|
5105
5168
|
//#endregion
|