@getstrata/cli 2.2.15 → 2.2.17

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @getstrata/cli changelog
2
2
 
3
+ ## 2.2.17
4
+
5
+ Add explicit development-only migration reset context while preserving guarded rollback and encryption archival; align generated fresh entries and reject production/staging or unsupported reset arguments before provisioning. Replace CSP-blocked error-page JavaScript navigation with safe same-origin links, and correct ambiguous Postgres/SQLite foreign-key messages without changing their HTTP status.
6
+
7
+ ## 2.2.16
8
+
9
+ Allow managed outbox workers to reuse a configured instance, preserving application tenant resolution, listener registration and delivery settings. Keep generated listeners-only defaults compatible, reject ambiguous worker sources, and cover configured SQL delivery, cancellation, cleanup and TypeScript contracts.
10
+
3
11
  ## 2.2.15
4
12
 
5
13
  - Batch legacy list-queue priority polling while retaining recovery and ownership contracts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/cli",
3
- "version": "2.2.15",
3
+ "version": "2.2.17",
4
4
  "description": "Strata CLI: framework commands for Bun apps (dev, start, migrate, run)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -54,8 +54,8 @@
54
54
  ],
55
55
  "scripts": {},
56
56
  "peerDependencies": {
57
- "@getstrata/bootstrap": "^2.2.15",
58
- "@getstrata/core": "^2.2.15"
57
+ "@getstrata/bootstrap": "^2.2.17",
58
+ "@getstrata/core": "^2.2.17"
59
59
  },
60
60
  "publishConfig": {
61
61
  "access": "public"
@@ -1,4 +1,5 @@
1
1
  import { pathToFileURL } from "node:url";
2
+ import { isProductionEnv } from "@getstrata/core/runtime/appEnv";
2
3
  import type { StrataAppConfig } from "../types.ts";
3
4
 
4
5
  type MigrateModule = {
@@ -50,6 +51,9 @@ async function migrateCommand(app: StrataAppConfig, args: string[]): Promise<voi
50
51
  }
51
52
 
52
53
  async function migrateFreshCommand(app: StrataAppConfig, args: string[]): Promise<void> {
54
+ if (args.some((arg) => arg !== "--seed")) throw new Error("migrate:fresh supports only --seed.");
55
+ if (isProductionEnv())
56
+ throw new Error("migrate:fresh is only available in development/test environments.");
53
57
  if (app.fresh) {
54
58
  const entry = await importEntry(app.fresh);
55
59
  if (typeof entry.fresh !== "function") {
@@ -7,15 +7,22 @@ import {
7
7
 
8
8
  type OutboxWorkerBoot = () => unknown | Promise<unknown>;
9
9
  type OutboxWorkerClose = () => unknown | Promise<unknown>;
10
-
11
- async function runOutboxWorkerCommand(options: {
10
+ type OutboxWorkerSource =
11
+ | { listeners: readonly DurableListener[]; outbox?: never }
12
+ | { outbox: Pick<SqlOutbox, "work">; listeners?: never };
13
+ type OutboxWorkerOptions = OutboxWorkerSource & {
12
14
  boot: OutboxWorkerBoot;
13
- listeners: readonly DurableListener[];
14
15
  close?: OutboxWorkerClose;
15
16
  flush?: OutboxWorkerClose;
16
17
  drain?: OutboxWorkerClose;
17
18
  lifecycle?: LifecycleCoordinator;
18
- }): Promise<void> {
19
+ };
20
+
21
+ async function runOutboxWorkerCommand(options: OutboxWorkerOptions): Promise<void> {
22
+ if ((options.outbox !== undefined) === (options.listeners !== undefined))
23
+ throw new TypeError("Select exactly one outbox worker source: outbox or listeners.");
24
+ if (options.outbox !== undefined && typeof options.outbox?.work !== "function")
25
+ throw new TypeError("Configured outbox must provide work().");
19
26
  const lifecycle = options.lifecycle ?? new LifecycleCoordinator();
20
27
  if (lifecycle.isShuttingDown) throw new Error("Cannot start an outbox worker during shutdown.");
21
28
  const admission = new AbortController();
@@ -61,7 +68,7 @@ async function runOutboxWorkerCommand(options: {
61
68
  booting = Promise.resolve(options.boot());
62
69
  await booting;
63
70
  if (!stopping && !lifecycle.isShuttingDown) {
64
- const outbox = new SqlOutbox({ listeners: options.listeners });
71
+ const outbox = options.outbox ?? new SqlOutbox({ listeners: options.listeners ?? [] });
65
72
  running = outbox.work({ signal: admission.signal });
66
73
  await running;
67
74
  }
@@ -79,5 +86,5 @@ async function runOutboxWorkerCommand(options: {
79
86
  if (failed) throw failure;
80
87
  }
81
88
 
82
- export type { OutboxWorkerBoot, OutboxWorkerClose };
89
+ export type { OutboxWorkerBoot, OutboxWorkerClose, OutboxWorkerOptions, OutboxWorkerSource };
83
90
  export { runOutboxWorkerCommand };