@adonis-agora/durable 0.24.1 → 0.24.3
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 +24 -0
- package/dist/configure.d.ts +2 -2
- package/dist/configure.js +2 -2
- package/dist/src/dashboard/index.d.ts +1 -1
- package/dist/src/dashboard/index.js +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/stubs/config/durable.stub +14 -14
- package/dist/stubs/config/durable_dashboard.stub +7 -7
- package/dist/stubs/database/migrations/create_durable_tables.stub +15 -15
- package/dist/stubs/database/migrations/create_durable_transport_tables.stub +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @adonis-agora/durable
|
|
2
2
|
|
|
3
|
+
## 0.24.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#72](https://github.com/DavideCarvalho/adonis-agora-durable/pull/72) [`fcd35eb`](https://github.com/DavideCarvalho/adonis-agora-durable/commit/fcd35eb02fbc0d66e7140f5c1375d7e51e3b3503) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Restore the stub doc comments that `0.24.2` flattened.
|
|
8
|
+
|
|
9
|
+
`0.24.2` fixed `configure` throwing by removing the backticks from four stub bodies. Removal was not necessary: Tempura accepts an **escaped** backtick, and renders it to a real one. The prose is now restored verbatim and escaped instead, so the generated `config/durable.ts`, `config/durable_dashboard.ts` and both migrations come out byte-identical to what the stubs always intended — with `` `createDurableTables` ``, `` `lucid` `` and the rest reading as code again in an editor tooltip.
|
|
10
|
+
|
|
11
|
+
Those comments are load-bearing: they are what explain why the migration delegates instead of carrying its own DDL, and why `static disableTransactions = true` is required rather than a preference. No behaviour changes; the generated files differ from `0.24.2` only in that comment styling.
|
|
12
|
+
|
|
13
|
+
The `{{{ … }}}` header keeps its unescaped backticks, as it must — it is evaluated as JavaScript.
|
|
14
|
+
|
|
15
|
+
## 0.24.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#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.
|
|
20
|
+
|
|
21
|
+
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**.
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
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.
|
|
26
|
+
|
|
3
27
|
## 0.24.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/configure.d.ts
CHANGED
|
@@ -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 (
|
|
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 (
|
|
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.
|
|
2
|
+
export declare const VERSION = "0.24.3";
|
|
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.
|
|
2
|
+
export const VERSION = '0.24.3';
|
|
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';
|
package/dist/src/index.d.ts
CHANGED
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.
|
|
2
|
+
export const VERSION = '0.24.3';
|
|
3
3
|
// --- engine + core primitives -----------------------------------------------
|
|
4
4
|
export * from './admission.js';
|
|
5
5
|
export * from './control-flow-signal.js';
|
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
import { defineConfig, transports } from '@adonis-agora/durable'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Configuration for @adonis-agora/durable. Pick a
|
|
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
|
|
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
|
|
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
|
-
*
|
|
13
|
+
* \`memory\` transport is test-only.
|
|
14
14
|
*
|
|
15
|
-
* For cross-process / production, select the
|
|
16
|
-
* transport, and the
|
|
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
|
-
*
|
|
18
|
+
* \`\`\`ts
|
|
19
19
|
* import { defineConfig, transports, stores } from '@adonis-agora/durable'
|
|
20
20
|
*
|
|
21
21
|
* export default defineConfig({
|
|
@@ -23,7 +23,7 @@ import { defineConfig, transports } from '@adonis-agora/durable'
|
|
|
23
23
|
* transports: {
|
|
24
24
|
* // single-process production, no external infra:
|
|
25
25
|
* 'event-emitter': transports.eventEmitter(),
|
|
26
|
-
* //
|
|
26
|
+
* // \`connection\` names an adapter from config/queue.ts (configure @adonisjs/queue first):
|
|
27
27
|
* queue: transports.queue({ connection: 'redis', group: 'durable' }),
|
|
28
28
|
* db: transports.db(),
|
|
29
29
|
* },
|
|
@@ -32,7 +32,7 @@ import { defineConfig, transports } from '@adonis-agora/durable'
|
|
|
32
32
|
* lucid: stores.lucid(),
|
|
33
33
|
* },
|
|
34
34
|
* })
|
|
35
|
-
*
|
|
35
|
+
* \`\`\`
|
|
36
36
|
*/
|
|
37
37
|
export default defineConfig({
|
|
38
38
|
transport: 'memory',
|
|
@@ -43,18 +43,18 @@ export default defineConfig({
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* 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
|
|
47
|
-
*
|
|
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
|
|
48
48
|
* step is idempotent (a re-dispatch can double-run a step whose original job was merely slow).
|
|
49
49
|
*/
|
|
50
50
|
// remoteRedispatchMs: 5 * 60 * 1000,
|
|
51
51
|
// remoteRedispatchMax: 10,
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* Recurring workflows fired by the
|
|
54
|
+
* Recurring workflows fired by the \`durable:work\` worker loop on every tick. Each window starts
|
|
55
55
|
* exactly once even with several worker instances racing (idempotent by the schedule's time-bucket
|
|
56
|
-
* run id). Use
|
|
57
|
-
* needs the optional
|
|
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.
|
|
58
58
|
*/
|
|
59
59
|
// schedules: [
|
|
60
60
|
// { 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
|
|
11
|
-
* Replace
|
|
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
|
-
*
|
|
14
|
-
* a signed cookie minted via a built-in login page (Mode B:
|
|
15
|
-
* "open the console from your app" endpoint (Mode A:
|
|
16
|
-
* of the two is required when
|
|
17
|
-
* configured. See
|
|
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
|
|
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 —
|
|
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
|
-
*
|
|
16
|
-
* failed only because the provider's boot-time
|
|
17
|
-
*
|
|
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.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
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
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* supplies the connection NAME, so
|
|
26
|
-
* connection
|
|
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.
|
|
27
27
|
*/
|
|
28
28
|
export default class extends BaseSchema {
|
|
29
29
|
/**
|
|
30
|
-
* REQUIRED, not a preference. The DDL below runs through the
|
|
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
|
|
33
|
-
* would hold the only connection while
|
|
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
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
|
|
35
|
+
* 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
|
|
7
|
+
* Transport tables for the @adonis-agora/durable \`db\` transport: the point-to-point work channels (tasks /
|
|
8
8
|
* results / heartbeats / control) that let durable remote steps run cross-process over the database
|
|
9
9
|
* alone. JSON payloads are stored as TEXT (the transport (de)serializes them) and timestamps as
|
|
10
10
|
* epoch-ms integers, so the schema is portable across SQLite / Postgres / MySQL. Only needed when you
|
|
11
|
-
* select the
|
|
11
|
+
* 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.
|
|
3
|
+
"version": "0.24.3",
|
|
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": {
|