@adonis-agora/durable 0.24.2 → 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 +12 -0
- 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 +28 -26
- package/dist/stubs/config/durable_dashboard.stub +7 -7
- package/dist/stubs/database/migrations/create_durable_tables.stub +16 -16
- package/dist/stubs/database/migrations/create_durable_transport_tables.stub +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
3
15
|
## 0.24.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -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,33 +4,35 @@
|
|
|
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
|
|
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
|
+
* import { defineConfig, transports, stores } from '@adonis-agora/durable'
|
|
19
20
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
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
|
+
* \`\`\`
|
|
34
36
|
*/
|
|
35
37
|
export default defineConfig({
|
|
36
38
|
transport: 'memory',
|
|
@@ -41,18 +43,18 @@ export default defineConfig({
|
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
45
|
* Opt-in self-heal net for a remote step whose dispatched job was LOST (worker crashed mid-step, or
|
|
44
|
-
* the transport dropped it) and has no per-step timeoutMs
|
|
45
|
-
* remoteRedispatchMs comfortably exceeds the longest legitimate run of any such step, and every
|
|
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
|
|
46
48
|
* step is idempotent (a re-dispatch can double-run a step whose original job was merely slow).
|
|
47
49
|
*/
|
|
48
50
|
// remoteRedispatchMs: 5 * 60 * 1000,
|
|
49
51
|
// remoteRedispatchMax: 10,
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
|
-
* Recurring workflows fired by the durable:work worker loop on every tick. Each window starts
|
|
54
|
+
* Recurring workflows fired by the \`durable:work\` worker loop on every tick. Each window starts
|
|
53
55
|
* exactly once even with several worker instances racing (idempotent by the schedule's time-bucket
|
|
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.
|
|
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.
|
|
56
58
|
*/
|
|
57
59
|
// schedules: [
|
|
58
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 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
|
|
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
|
|
16
|
-
* failed only because the provider's boot-time ensureSchema() silently
|
|
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 \`ALTER\`ed 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
|
-
*
|
|
23
|
-
* createDurableTables needs db.connection(name).schema
|
|
24
|
-
* QueryClientContract — one already-resolved client, with no
|
|
25
|
-
* supplies the connection NAME, so
|
|
26
|
-
* connection x and not on the default.
|
|
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 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
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
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
|
|
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
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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.
|
|
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": {
|