@adonis-agora/durable 0.24.1 → 0.24.2

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,17 @@
1
1
  # @adonis-agora/durable
2
2
 
3
+ ## 0.24.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#70](https://github.com/DavideCarvalho/adonis-agora-durable/pull/70) [`c3cadf2`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/c3cadf2f0d24ec8b8f63509688b92cfd680c358e) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Fix `node ace configure @adonis-agora/durable` aborting without writing any files.
8
+
9
+ Adonis compiles a stub's body with Tempura, which builds it into a JavaScript template literal — so a backtick or a `${` anywhere in the body terminates that literal early and the stub throws at generation time. Four of the five published stubs carried backticks in their doc comments (the ordinary `` `memory` `` / `` `lucid` `` prose style), and `configure` throws on the first one it renders. Every published version therefore updated `adonisrc.ts` and then died with `Unexpected identifier 'transport'`, leaving the user with **no `config/durable.ts`, no `config/durable_dashboard.ts` and no migrations**.
10
+
11
+ The four stub bodies now use plain identifiers instead. Nothing in the generated output changed except that comment styling, and `make:workflow` was already unaffected. The `{{{ … }}}` header keeps its backticks: it is evaluated as JavaScript, so `` app.migrationsPath(`${new Date().getTime()}_create_durable_tables.ts`) `` is both legitimate and required there.
12
+
13
+ Two specs now guard it, both driving the real `app.stubs` pipeline that `codemods.makeUsingStub` runs: one asserts every stub renders to a non-empty file, the other that no body contains a backtick or `${`. The text assertion is deliberately scoped to the body so it never flags the header's legitimate use.
14
+
3
15
  ## 0.24.1
4
16
 
5
17
  ### Patch Changes
@@ -3,8 +3,8 @@ import type Configure from '@adonisjs/core/commands/configure';
3
3
  * `node ace configure @adonis-agora/durable` — auto-wires the package:
4
4
  *
5
5
  * 1. registers the core service provider in `adonisrc.ts`;
6
- * 2. registers the ace commands barrel (four commands: `durable:work`,
7
- * `durable:runs`, `durable:retry`, `make:workflow`);
6
+ * 2. registers the ace commands barrel (five commands: `durable:work`,
7
+ * `durable:worker`, `durable:runs`, `durable:retry`, `make:workflow`);
8
8
  * 3. registers the optional dashboard provider;
9
9
  * 4. registers the Assembler `init` hooks that generate the typed `app/workflows`
10
10
  * and `app/steps` barrels at build/dev time (the provider imports them instead
package/dist/configure.js CHANGED
@@ -3,8 +3,8 @@ import { stubsRoot } from './stubs/main.js';
3
3
  * `node ace configure @adonis-agora/durable` — auto-wires the package:
4
4
  *
5
5
  * 1. registers the core service provider in `adonisrc.ts`;
6
- * 2. registers the ace commands barrel (four commands: `durable:work`,
7
- * `durable:runs`, `durable:retry`, `make:workflow`);
6
+ * 2. registers the ace commands barrel (five commands: `durable:work`,
7
+ * `durable:worker`, `durable:runs`, `durable:retry`, `make:workflow`);
8
8
  * 3. registers the optional dashboard provider;
9
9
  * 4. registers the Assembler `init` hooks that generate the typed `app/workflows`
10
10
  * and `app/steps` barrels at build/dev time (the provider imports them instead
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export declare const VERSION = "0.24.1";
2
+ export declare const VERSION = "0.24.2";
3
3
  export { defineConfig, defaultAuthorize, resolveConfig } from './define_config.js';
4
4
  export type { AuthorizeHook, DurableDashboardConfig, ResolvedDurableDashboardConfig, } from './define_config.js';
5
5
  export { listRuns, getRun, retryRun, retryWithInputRun, continueRun, redispatchPendingRun, cancelRun, bulkAction, health, workers, topology, ok, } from './handlers.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export const VERSION = '0.24.1';
2
+ export const VERSION = '0.24.2';
3
3
  export { defineConfig, defaultAuthorize, resolveConfig } from './define_config.js';
4
4
  export { listRuns, getRun, retryRun, retryWithInputRun, continueRun, redispatchPendingRun, cancelRun, bulkAction, health, workers, topology, ok, } from './handlers.js';
5
5
  export { renderDashboard } from './html.js';
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export declare const VERSION = "0.24.1";
2
+ export declare const VERSION = "0.24.2";
3
3
  export * from './admission.js';
4
4
  export * from './control-flow-signal.js';
5
5
  export * from './duration.js';
package/dist/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Keep in sync with this package's `version` in package.json. */
2
- export const VERSION = '0.24.1';
2
+ export const VERSION = '0.24.2';
3
3
  // --- engine + core primitives -----------------------------------------------
4
4
  export * from './admission.js';
5
5
  export * from './control-flow-signal.js';
@@ -4,35 +4,33 @@
4
4
  import { defineConfig, transports } from '@adonis-agora/durable'
5
5
 
6
6
  /**
7
- * Configuration for @adonis-agora/durable. Pick a `transport` (and optionally a `store`) by name from the
7
+ * Configuration for @adonis-agora/durable. Pick a transport (and optionally a store) by name from the
8
8
  * maps below; each driver's peer dependency is imported lazily, only when selected. The default is
9
- * the in-process `memory` transport + the in-memory store — single-process, no extra infrastructure.
9
+ * the in-process 'memory' transport + the in-memory store — single-process, no extra infrastructure.
10
10
  *
11
- * For a single-process PRODUCTION app with NO external infra, select the `event-emitter` transport:
11
+ * For a single-process PRODUCTION app with NO external infra, select the 'event-emitter' transport:
12
12
  * step handlers run in this same process over a Node EventEmitter (no DB, no Redis, no broker). The
13
- * `memory` transport is test-only.
13
+ * 'memory' transport is test-only.
14
14
  *
15
- * For cross-process / production, select the `queue` (@adonisjs/queue) or `db` (@adonisjs/lucid)
16
- * transport, and the `lucid` store, then run `node ace migration:run`:
15
+ * For cross-process / production, select the 'queue' (@adonisjs/queue) or 'db' (@adonisjs/lucid)
16
+ * transport, and the 'lucid' store, then run: node ace migration:run
17
17
  *
18
- * ```ts
19
- * import { defineConfig, transports, stores } from '@adonis-agora/durable'
18
+ * import { defineConfig, transports, stores } from '@adonis-agora/durable'
20
19
  *
21
- * export default defineConfig({
22
- * transport: 'queue',
23
- * transports: {
24
- * // single-process production, no external infra:
25
- * 'event-emitter': transports.eventEmitter(),
26
- * // `connection` names an adapter from config/queue.ts (configure @adonisjs/queue first):
27
- * queue: transports.queue({ connection: 'redis', group: 'durable' }),
28
- * db: transports.db(),
29
- * },
30
- * store: 'lucid',
31
- * stores: {
32
- * lucid: stores.lucid(),
33
- * },
34
- * })
35
- * ```
20
+ * export default defineConfig({
21
+ * transport: 'queue',
22
+ * transports: {
23
+ * // single-process production, no external infra:
24
+ * 'event-emitter': transports.eventEmitter(),
25
+ * // connection names an adapter from config/queue.ts (configure @adonisjs/queue first):
26
+ * queue: transports.queue({ connection: 'redis', group: 'durable' }),
27
+ * db: transports.db(),
28
+ * },
29
+ * store: 'lucid',
30
+ * stores: {
31
+ * lucid: stores.lucid(),
32
+ * },
33
+ * })
36
34
  */
37
35
  export default defineConfig({
38
36
  transport: 'memory',
@@ -43,18 +41,18 @@ export default defineConfig({
43
41
 
44
42
  /**
45
43
  * Opt-in self-heal net for a remote step whose dispatched job was LOST (worker crashed mid-step, or
46
- * the transport dropped it) and has no per-step `timeoutMs`. Off by default — turn it on only once
47
- * `remoteRedispatchMs` comfortably exceeds the longest legitimate run of any such step, and every
44
+ * the transport dropped it) and has no per-step timeoutMs. Off by default — turn it on only once
45
+ * remoteRedispatchMs comfortably exceeds the longest legitimate run of any such step, and every
48
46
  * step is idempotent (a re-dispatch can double-run a step whose original job was merely slow).
49
47
  */
50
48
  // remoteRedispatchMs: 5 * 60 * 1000,
51
49
  // remoteRedispatchMax: 10,
52
50
 
53
51
  /**
54
- * Recurring workflows fired by the `durable:work` worker loop on every tick. Each window starts
52
+ * Recurring workflows fired by the durable:work worker loop on every tick. Each window starts
55
53
  * exactly once even with several worker instances racing (idempotent by the schedule's time-bucket
56
- * run id). Use `everyMs` for a fixed interval, or `cron` + `timezone` for a calendar schedule (cron
57
- * needs the optional `cron-parser` peer dependency). See docs/authoring/scheduling.
54
+ * run id). Use everyMs for a fixed interval, or cron + timezone for a calendar schedule (cron
55
+ * needs the optional cron-parser peer dependency). See docs/authoring/scheduling.
58
56
  */
59
57
  // schedules: [
60
58
  // { key: 'nightly-report', workflow: 'daily-report', cron: '0 2 * * *', timezone: 'America/Sao_Paulo' },
@@ -7,14 +7,14 @@ import { defineConfig } from '@adonis-agora/durable/dashboard'
7
7
  * Configuration for the @adonis-agora/durable dashboard.
8
8
  *
9
9
  * By default the dashboard is open OUTSIDE production, and in production it
10
- * requires a bearer token equal to `DURABLE_DASHBOARD_TOKEN` (deny if unset).
11
- * Replace `authorize` with your own guard (session, role, IP allow-list, …).
10
+ * requires a bearer token equal to DURABLE_DASHBOARD_TOKEN (deny if unset).
11
+ * Replace authorize with your own guard (session, role, IP allow-list, …).
12
12
  *
13
- * `dashboardAuth` is an ADDITIVE, optional session gate on top of `authorize` —
14
- * a signed cookie minted via a built-in login page (Mode B: `login`) and/or a
15
- * "open the console from your app" endpoint (Mode A: `session`). At least one
16
- * of the two is required when `dashboardAuth` is set; either or both may be
17
- * configured. See `docs/observability/dashboard-auth.mdx`.
13
+ * dashboardAuth is an ADDITIVE, optional session gate on top of authorize —
14
+ * a signed cookie minted via a built-in login page (Mode B: login) and/or a
15
+ * "open the console from your app" endpoint (Mode A: session). At least one
16
+ * of the two is required when dashboardAuth is set; either or both may be
17
+ * configured. See docs/observability/dashboard-auth.mdx.
18
18
  */
19
19
  export default defineConfig({
20
20
  // enabled: true,
@@ -6,33 +6,33 @@ import db from '@adonisjs/lucid/services/db'
6
6
  import { createDurableTables, dropDurableTables } from '@adonis-agora/durable'
7
7
 
8
8
  /**
9
- * Durable workflow tables for the @adonis-agora/durable `lucid` state store: runs, step checkpoints,
9
+ * Durable workflow tables for the @adonis-agora/durable 'lucid' state store: runs, step checkpoints,
10
10
  * the search-attribute side-table, signal waiters, buffered signals and buffered events.
11
11
  *
12
12
  * This migration DELEGATES to the library instead of reproducing its DDL. The schema belongs to the
13
- * library — `LucidStateStore` decides what columns it reads and writes — so a hand-copied snapshot
13
+ * library — LucidStateStore decides what columns it reads and writes — so a hand-copied snapshot
14
14
  * here can only ever be right until the next release. It was wrong before: the stub shipped without
15
- * `last_heartbeat_at` / `heartbeat_progress`, which the store writes on every step beat, and nothing
16
- * failed only because the provider's boot-time `ensureSchema()` silently `ALTER`ed them in. Calling
17
- * `createDurableTables` makes that drift impossible rather than merely tested for.
15
+ * last_heartbeat_at / heartbeat_progress, which the store writes on every step beat, and nothing
16
+ * failed only because the provider's boot-time ensureSchema() silently ALTERed them in. Calling
17
+ * createDurableTables makes that drift impossible rather than merely tested for.
18
18
  *
19
- * `createDurableTables` is idempotent (`hasTable` / `hasColumn` guarded) and additive-only, so it is
19
+ * createDurableTables is idempotent (hasTable / hasColumn guarded) and additive-only, so it is
20
20
  * safe to run against a database that already has some or all of the tables.
21
21
  *
22
- * `db` (the `Database` manager from `@adonisjs/lucid/services/db`) rather than `this.db`:
23
- * `createDurableTables` needs `db.connection(name).schema`, and the `this.db` a migration gets is a
24
- * `QueryClientContract` — one already-resolved client, with no `.connection()`. `this.db` still
25
- * supplies the connection NAME, so `node ace migration:run --connection=x` provisions the tables on
26
- * connection `x` and not on the default.
22
+ * It takes db (the Database manager from @adonisjs/lucid/services/db) rather than this.db:
23
+ * createDurableTables needs db.connection(name).schema, and the this.db a migration gets is a
24
+ * QueryClientContract — one already-resolved client, with no .connection() of its own. this.db still
25
+ * supplies the connection NAME, so "node ace migration:run --connection=x" provisions the tables on
26
+ * connection x and not on the default.
27
27
  */
28
28
  export default class extends BaseSchema {
29
29
  /**
30
- * REQUIRED, not a preference. The DDL below runs through the `Database` manager, which checks out
30
+ * REQUIRED, not a preference. The DDL below runs through the Database manager, which checks out
31
31
  * its OWN connection from the pool — it is not part of the transaction the migrator would otherwise
32
- * open for this migration. With `pool: { max: 1 }` (Adonis's own SQLite guidance) that transaction
33
- * would hold the only connection while `createDurableTables` waited for a free one, and the
34
- * migration would hang until the acquire timeout. Nothing is lost by opting out: the statements were
35
- * never inside that transaction anyway, and re-running an interrupted `createDurableTables` is a
32
+ * open for this migration. With a pool capped at 1 connection (Adonis's own SQLite guidance) that
33
+ * transaction would hold the only connection while createDurableTables waited for a free one, and
34
+ * the migration would hang until the acquire timeout. Nothing is lost by opting out: the statements
35
+ * were never inside that transaction anyway, and re-running an interrupted createDurableTables is a
36
36
  * no-op.
37
37
  */
38
38
  static disableTransactions = true
@@ -4,11 +4,11 @@
4
4
  import { BaseSchema } from '@adonisjs/lucid/schema'
5
5
 
6
6
  /**
7
- * Transport tables for the @adonis-agora/durable `db` transport: the point-to-point work channels (tasks /
8
- * results / heartbeats / control) that let durable remote steps run cross-process over the database
9
- * alone. JSON payloads are stored as TEXT (the transport (de)serializes them) and timestamps as
10
- * epoch-ms integers, so the schema is portable across SQLite / Postgres / MySQL. Only needed when you
11
- * select the `db` transport in config/durable.ts.
7
+ * Transport tables for the @adonis-agora/durable 'db' transport: the point-to-point work channels
8
+ * (tasks / results / heartbeats / control) that let durable remote steps run cross-process over the
9
+ * database alone. JSON payloads are stored as TEXT (the transport (de)serializes them) and timestamps
10
+ * as epoch-ms integers, so the schema is portable across SQLite / Postgres / MySQL. Only needed when
11
+ * you select the 'db' transport in config/durable.ts.
12
12
  */
13
13
  export default class extends BaseSchema {
14
14
  async up() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/durable",
3
- "version": "0.24.1",
3
+ "version": "0.24.2",
4
4
  "description": "Durable cross-app workflows for AdonisJS — deterministic replay engine, AdonisJS binding, ace commands, dashboard, OpenTelemetry, Telescope, testing harness and Redis admission, all in one package. Part of the Agora ecosystem.",
5
5
  "license": "MIT",
6
6
  "repository": {