@t4h.framework/dev 0.0.0-experimental-20261008135920 → 0.0.0-experimental-20261009202408
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 +4 -50
- package/README.md +19 -95
- package/dist/AppProcess.d.ts +2 -16
- package/dist/AppProcess.js +4 -31
- package/dist/AppProcess.js.map +1 -1
- package/dist/Server.d.ts +0 -5
- package/dist/Server.js +0 -15
- package/dist/Server.js.map +1 -1
- package/dist/constants/server.d.ts +1 -14
- package/dist/constants/server.js +1 -14
- package/dist/constants/server.js.map +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -5
- package/dist/index.js.map +1 -1
- package/dist/integrations/orm.js +1 -12
- package/dist/integrations/orm.js.map +1 -1
- package/dist/models/FrameworkConfig.d.ts +0 -20
- package/dist/models/FrameworkConfig.js +0 -2
- package/dist/models/FrameworkConfig.js.map +1 -1
- package/dist/models/claims/DevCacheClaim.d.ts +1 -2
- package/dist/models/claims/DevCacheClaim.js +6 -17
- package/dist/models/claims/DevCacheClaim.js.map +1 -1
- package/dist/models/claims/DevORMClaim.d.ts +8 -5
- package/dist/models/claims/DevORMClaim.js +55 -22
- package/dist/models/claims/DevORMClaim.js.map +1 -1
- package/dist/services/CallbackToken.service.d.ts +1 -4
- package/dist/services/CallbackToken.service.js +3 -10
- package/dist/services/CallbackToken.service.js.map +1 -1
- package/dist/services/Database.service.d.ts +0 -8
- package/dist/services/Database.service.js +3 -18
- package/dist/services/Database.service.js.map +1 -1
- package/dist/services/WorkflowRunAsyncActivityFacade.service.d.ts +0 -2
- package/dist/services/WorkflowRunAsyncActivityFacade.service.js +0 -6
- package/dist/services/WorkflowRunAsyncActivityFacade.service.js.map +1 -1
- package/dist/services/WorkflowRunEvents.service.d.ts +0 -9
- package/dist/services/WorkflowRunEvents.service.js +2 -13
- package/dist/services/WorkflowRunEvents.service.js.map +1 -1
- package/dist/services/WorkflowRunFacade.service.d.ts +0 -1
- package/dist/services/WorkflowRunFacade.service.js +0 -3
- package/dist/services/WorkflowRunFacade.service.js.map +1 -1
- package/dist/transport/AppProcessJsonRpc.js +4 -17
- package/dist/transport/AppProcessJsonRpc.js.map +1 -1
- package/dist/use-cases/CreateWorkflowRunAsyncActivity.usecase.d.ts +5 -3
- package/dist/use-cases/CreateWorkflowRunAsyncActivity.usecase.js +10 -6
- package/dist/use-cases/CreateWorkflowRunAsyncActivity.usecase.js.map +1 -1
- package/dist/use-cases/EnqueueWorkflowRunNextTick.usecase.d.ts +9 -3
- package/dist/use-cases/EnqueueWorkflowRunNextTick.usecase.js +39 -7
- package/dist/use-cases/EnqueueWorkflowRunNextTick.usecase.js.map +1 -1
- package/dist/use-cases/ExecuteWorkflowRunAsyncActivity.usecase.d.ts +5 -5
- package/dist/use-cases/ExecuteWorkflowRunAsyncActivity.usecase.js +15 -29
- package/dist/use-cases/ExecuteWorkflowRunAsyncActivity.usecase.js.map +1 -1
- package/dist/use-cases/NextTickWorkflowRun.usecase.d.ts +1 -6
- package/dist/use-cases/NextTickWorkflowRun.usecase.js +3 -54
- package/dist/use-cases/NextTickWorkflowRun.usecase.js.map +1 -1
- package/dist/use-cases/ReceiveWorkflowEvent.usecase.d.ts +2 -10
- package/dist/use-cases/ReceiveWorkflowEvent.usecase.js +5 -35
- package/dist/use-cases/ReceiveWorkflowEvent.usecase.js.map +1 -1
- package/dist/workers/app-process.d.ts +0 -8
- package/dist/workers/app-process.js +14 -114
- package/dist/workers/app-process.js.map +1 -1
- package/package.json +3 -5
- package/dist/HeadlessApp.d.ts +0 -65
- package/dist/HeadlessApp.js +0 -166
- package/dist/HeadlessApp.js.map +0 -1
- package/dist/models/DevORMStore.d.ts +0 -18
- package/dist/models/DevORMStore.js +0 -7
- package/dist/models/DevORMStore.js.map +0 -1
- package/dist/models/LocalWorkflowRunJobExecutor.d.ts +0 -10
- package/dist/models/LocalWorkflowRunJobExecutor.js +0 -23
- package/dist/models/LocalWorkflowRunJobExecutor.js.map +0 -1
- package/dist/models/PostgresDevORMStore.d.ts +0 -23
- package/dist/models/PostgresDevORMStore.js +0 -94
- package/dist/models/PostgresDevORMStore.js.map +0 -1
- package/dist/models/RuntimeControlServer.d.ts +0 -32
- package/dist/models/RuntimeControlServer.js +0 -75
- package/dist/models/RuntimeControlServer.js.map +0 -1
- package/dist/models/RuntimeDebugLog.d.ts +0 -10
- package/dist/models/RuntimeDebugLog.js +0 -32
- package/dist/models/RuntimeDebugLog.js.map +0 -1
- package/dist/models/RuntimeEvent.d.ts +0 -95
- package/dist/models/RuntimeEvent.js +0 -2
- package/dist/models/RuntimeEvent.js.map +0 -1
- package/dist/models/SqliteDevORMStore.d.ts +0 -16
- package/dist/models/SqliteDevORMStore.js +0 -69
- package/dist/models/SqliteDevORMStore.js.map +0 -1
- package/dist/models/WorkflowRunJob.d.ts +0 -95
- package/dist/models/WorkflowRunJob.js +0 -2
- package/dist/models/WorkflowRunJob.js.map +0 -1
- package/dist/models/WorkflowWorkerPool.d.ts +0 -39
- package/dist/models/WorkflowWorkerPool.js +0 -154
- package/dist/models/WorkflowWorkerPool.js.map +0 -1
- package/dist/services/RuntimeEvents.service.d.ts +0 -16
- package/dist/services/RuntimeEvents.service.js +0 -35
- package/dist/services/RuntimeEvents.service.js.map +0 -1
- package/dist/services/WorkflowRunScheduler.service.d.ts +0 -62
- package/dist/services/WorkflowRunScheduler.service.js +0 -278
- package/dist/services/WorkflowRunScheduler.service.js.map +0 -1
- package/dist/tools/format-runtime-event.d.ts +0 -3
- package/dist/tools/format-runtime-event.js +0 -51
- package/dist/tools/format-runtime-event.js.map +0 -1
- package/dist/tools/run-workflow-run-job.d.ts +0 -3
- package/dist/tools/run-workflow-run-job.js +0 -25
- package/dist/tools/run-workflow-run-job.js.map +0 -1
- package/dist/tools/runtime-control-client.d.ts +0 -15
- package/dist/tools/runtime-control-client.js +0 -54
- package/dist/tools/runtime-control-client.js.map +0 -1
- package/dist/tools/runtime-registry.d.ts +0 -26
- package/dist/tools/runtime-registry.js +0 -57
- package/dist/tools/runtime-registry.js.map +0 -1
- package/dist/tools/start-runtime-monitor.d.ts +0 -12
- package/dist/tools/start-runtime-monitor.js +0 -69
- package/dist/tools/start-runtime-monitor.js.map +0 -1
- package/dist/tools/to-orm-config.d.ts +0 -3
- package/dist/tools/to-orm-config.js +0 -13
- package/dist/tools/to-orm-config.js.map +0 -1
- package/dist/tools/to-runtime-config.d.ts +0 -3
- package/dist/tools/to-runtime-config.js +0 -13
- package/dist/tools/to-runtime-config.js.map +0 -1
- package/dist/use-cases/RejectAbandonedWorkflowRuns.usecase.d.ts +0 -14
- package/dist/use-cases/RejectAbandonedWorkflowRuns.usecase.js +0 -55
- package/dist/use-cases/RejectAbandonedWorkflowRuns.usecase.js.map +0 -1
- package/dist/workers/workflow-worker.d.ts +0 -1
- package/dist/workers/workflow-worker.js +0 -58
- package/dist/workers/workflow-worker.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,57 +1,11 @@
|
|
|
1
1
|
# @t4h.framework/dev
|
|
2
2
|
|
|
3
|
-
## 0.0.0-experimental-
|
|
3
|
+
## 0.0.0-experimental-20261009202408
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
--input '<json>'` builds the project, runs the workflow, waits for it
|
|
10
|
-
(`--timeout`) and prints the run as JSON — with the activities, logs and child
|
|
11
|
-
runs under `--trace`. It exits with `0` when the run fulfills, `1` when it is
|
|
12
|
-
rejected or the command fails, and `2` on timeout, so scripts and AI agents can
|
|
13
|
-
test workflows headlessly.
|
|
14
|
-
|
|
15
|
-
`@t4h.framework/dev` exports `HeadlessApp`, the API behind it, and the app
|
|
16
|
-
process resolves its bundle root from `file:` URLs.
|
|
17
|
-
|
|
18
|
-
- [#210](https://github.com/tech4humans-brasil/framework/pull/210) [`a93218a`](https://github.com/tech4humans-brasil/framework/commit/a93218ae284d91de7d94a65e8f306ace0db2d733) Thanks [@tony-tsx](https://github.com/tony-tsx)! - The dev ORM claim can store its rows in Postgres instead of `db.sqlite`:
|
|
19
|
-
set `orm: { connectionString: 'postgres://…' }` in `framework.config.ts`.
|
|
20
|
-
Workers write in parallel instead of waiting on the SQLite file lock, each one
|
|
21
|
-
with its own connection pool, and updates lock their row so concurrent updates
|
|
22
|
-
merge. Each entity gets an `(id text, data jsonb)` table, created on first use;
|
|
23
|
-
`where`, `orderBy` and pagination behave as on SQLite. Without the setting
|
|
24
|
-
nothing changes, and the `connectionString` passed to `new ORM()` is still
|
|
25
|
-
ignored in dev.
|
|
26
|
-
|
|
27
|
-
- [#207](https://github.com/tech4humans-brasil/framework/pull/207) [`92db468`](https://github.com/tech4humans-brasil/framework/commit/92db468f819d3c7d01884526598acd5fbef9b4ef) Thanks [@tony-tsx](https://github.com/tony-tsx)! - Workflows run asynchronously on a pool of worker threads. Starting a run,
|
|
28
|
-
delivering a callback, advancing an activity, a timeout and the settlement of a
|
|
29
|
-
parent run only queue work; a scheduler runs it with at most one step per run
|
|
30
|
-
at a time, keeps each run on the worker that started it and serves callbacks
|
|
31
|
-
ahead of background work. `advance` and callbacks still return the status of
|
|
32
|
-
the activity, but no longer wait for the rest of the workflow.
|
|
33
|
-
|
|
34
|
-
The pool defaults to the available CPUs minus one, 4 jobs per worker, and is set
|
|
35
|
-
with `runtime: { workers, concurrency }` in `framework.config.ts` (`workers: 0`
|
|
36
|
-
keeps everything on the app thread). The runtime database moves to a temporary
|
|
37
|
-
SQLite file in WAL mode shared by the workers, and the dev `CacheClaim` is
|
|
38
|
-
stored there so every worker sees the same cache. A worker that dies rejects
|
|
39
|
-
the runs it held and is replaced.
|
|
40
|
-
|
|
41
|
-
- [#210](https://github.com/tech4humans-brasil/framework/pull/210) [`990c074`](https://github.com/tech4humans-brasil/framework/commit/990c074af498cb7610d310e295ad613dce7a9b52) Thanks [@tony-tsx](https://github.com/tony-tsx)! - The dev runtime publishes what it runs: jobs queued, started and finished
|
|
42
|
-
(with the queue counts), runs created and settled, activities started, waiting
|
|
43
|
-
and settled (with the error of a rejected one), timeouts and lost workers.
|
|
44
|
-
- `--debug` on `framework dev` and `framework workflows <workflow> run` prints
|
|
45
|
-
those events on stderr; `--debug-log <file>` appends them to a file as NDJSON.
|
|
46
|
-
- Every app process registers itself and listens on a local socket (named pipe
|
|
47
|
-
on Windows). `framework runtime ls` lists them, `framework runtime status`
|
|
48
|
-
prints the queue, the jobs running and waiting and the runs in progress, and
|
|
49
|
-
`framework runtime watch` follows the events live (`--json` for NDJSON),
|
|
50
|
-
reconnecting across `dev` rebuilds.
|
|
51
|
-
|
|
52
|
-
`@t4h.framework/dev` exports `listRuntimes`, `requestRuntimeStatus`,
|
|
53
|
-
`watchRuntime` and `formatRuntimeEvent`, and takes `debugLog` on `Server` and
|
|
54
|
-
`HeadlessApp.up`.
|
|
7
|
+
- Updated dependencies [[`8221dfe`](https://github.com/tech4humans-brasil/framework/commit/8221dfef3e743d226c8bb458034f85ea4085163d)]:
|
|
8
|
+
- @t4h.framework/orm@0.0.0-experimental-20261009202408
|
|
55
9
|
|
|
56
10
|
## 0.22.6
|
|
57
11
|
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Local development runtime for [T4H Framework](https://github.com/tech4humans-bra
|
|
|
7
7
|
When you run `framework dev` (via `@t4h.framework/cli`), this package powers the experience behind the scenes:
|
|
8
8
|
|
|
9
9
|
1. **TypeScript watch** — compiles your app on every change.
|
|
10
|
-
2. **App process** — forks a child Node process that loads your compiled `App
|
|
10
|
+
2. **App process** — forks a child Node process that loads your compiled `App` and runs the workflow engine on an in-memory SQLite database.
|
|
11
11
|
3. **HTTP server** — a [Hono](https://hono.dev) app that exposes your workflows (create runs, advance pending activities), enforces the workflow authorization and adds `/_dev` routes for tooling.
|
|
12
12
|
4. **Vite** — a Vite dev server in middleware mode serves the built-in panel and anything else that is not an API route.
|
|
13
13
|
5. **Dev claims** — provides local implementations for ORM, HTTP, file system, cache, SMTP, and more.
|
|
@@ -23,20 +23,16 @@ flowchart TB
|
|
|
23
23
|
HTTP --> Auth
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
subgraph child ["Child process (app-process)"]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Queue -->|"jobs"| App
|
|
33
|
-
App -->|"child runs, timeouts, events"| Queue
|
|
34
|
-
Queue --- DB
|
|
35
|
-
App --- DB
|
|
26
|
+
subgraph child ["Child process (app-process worker)"]
|
|
27
|
+
App["User App"]
|
|
28
|
+
Engine["Workflow engine + SQLite :memory:"]
|
|
29
|
+
Claims["Dev claims"]
|
|
30
|
+
App --> Engine
|
|
31
|
+
Claims --> App
|
|
36
32
|
end
|
|
37
33
|
|
|
38
|
-
Fork -->
|
|
39
|
-
HTTP <-->|"IPC / JSON-RPC"|
|
|
34
|
+
Fork --> App
|
|
35
|
+
HTTP <-->|"IPC / JSON-RPC"| Engine
|
|
40
36
|
```
|
|
41
37
|
|
|
42
38
|
## Installation
|
|
@@ -166,64 +162,14 @@ Every `/projects` route requires an authorization: the workflow `authorization`
|
|
|
166
162
|
|
|
167
163
|
Everything else is handed to Vite, which serves the panel that ships with this package: open the base URL to browse the workflows and start runs from their schema, follow runs live with the execution trace of each one (activities as a waterfall, child runs nested, input, output, duration, logs, the activity that failed) and advance waiting activities. Plugins from the project's `vite.config.*` (or `vite.plugins`) are served by the same Vite.
|
|
168
164
|
|
|
169
|
-
## Execution
|
|
170
|
-
|
|
171
|
-
Starting a run, delivering a callback or advancing an activity only queues work; the app process answers right away and a scheduler hands each step (a _job_) to a pool of `worker_threads`. Every worker loads its own copy of your `App`, so a CPU-heavy activity blocks only its worker — the HTTP API, the panel and the other runs keep going. No message broker is involved: the queue lives in the app process, like the rest of the dev state.
|
|
172
|
-
|
|
173
|
-
- **Capacity** — `workers` threads (default: available CPUs − 1) each run up to `concurrency` jobs at once (default: 4). Extra work waits in the queue.
|
|
174
|
-
- **Order** — a run never has two jobs in flight, and all jobs of a run go to the worker that started it. Callbacks and advances jump ahead of background work.
|
|
175
|
-
- **Responses** — `advance` and callbacks still run the activity's `advance` and return its status; the steps after it run in the background (follow them through `run:updated`).
|
|
176
|
-
- **Failures** — if a worker dies, its in-flight jobs fail, the runs it held are rejected (`The workflow worker running this run stopped`) and a new worker takes its place.
|
|
177
|
-
|
|
178
|
-
Tune it in `framework.config.ts`:
|
|
179
|
-
|
|
180
|
-
```typescript
|
|
181
|
-
import { defineConfig } from '@t4h.framework/dev/config'
|
|
182
|
-
|
|
183
|
-
export default defineConfig({
|
|
184
|
-
runtime: {
|
|
185
|
-
workers: 2, // 0 runs workflows on the app process thread
|
|
186
|
-
concurrency: 4,
|
|
187
|
-
},
|
|
188
|
-
})
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Debugging and monitoring
|
|
192
|
-
|
|
193
|
-
The runtime publishes an event for every job it queues, starts and finishes (with the queue counts at that moment), every run created and settled, every activity started, waiting and settled, every timeout and every worker lost.
|
|
194
|
-
|
|
195
|
-
- **Debug log** — `framework dev --debug` / `framework workflows <workflow> run --debug` print them on stderr; `--debug-log <file>` appends them to a file as NDJSON. Programmatically: `debugLog: '-'` or a path on `Server` and `HeadlessApp.up`.
|
|
196
|
-
- **Another process** — each app process registers in `<tmpdir>/t4h-framework/runtimes` and listens on a local socket (named pipe on Windows). `framework runtime ls | status | watch` reads it; from code, `listRuntimes()`, `requestRuntimeStatus(runtime)` and `watchRuntime(runtime, { onEvent })`.
|
|
197
|
-
|
|
198
165
|
## State
|
|
199
166
|
|
|
200
|
-
Workflow runs, activities, pending async activities
|
|
167
|
+
Workflow runs, activities, pending async activities and logs live in an in-memory SQLite database (`node:sqlite`) inside the app process. Every successful build forks a fresh process, so **a rebuild resets all runs, timers and pending activities**; the `manifest` SSE event tells a UI to reload. There is no durability, queue or resume in the dev server by design.
|
|
201
168
|
|
|
202
|
-
Sync activities run
|
|
169
|
+
Sync activities run inline, `sleep` and other timers use `setTimeout`, and child workflows started with `startWorkflow` / `startWorkflowMany` run in parallel.
|
|
203
170
|
|
|
204
171
|
The ORM claim is the exception: its rows live in `db.sqlite` next to your `package.json` and survive rebuilds and restarts (add it to `.gitignore`). Delete the file to start over. The previous `db.json` is no longer read.
|
|
205
172
|
|
|
206
|
-
### ORM on Postgres
|
|
207
|
-
|
|
208
|
-
SQLite takes one write at a time, so with many workers writing through the ORM they wait on each other. Point the ORM claim at a Postgres database instead with `orm.connectionString` in `framework.config.ts`:
|
|
209
|
-
|
|
210
|
-
```typescript
|
|
211
|
-
import { defineConfig } from '@t4h.framework/dev/config'
|
|
212
|
-
|
|
213
|
-
export default defineConfig({
|
|
214
|
-
orm: { connectionString: process.env.DEV_DATABASE_URL },
|
|
215
|
-
})
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
Each entity gets a table `(id text primary key, data jsonb)` in the connection's current schema, created on first use; `where`, `orderBy` and pagination keep the same semantics as on SQLite. Every worker opens its own pool (as many connections as its `concurrency`), and an update locks its row, so concurrent updates from different workers merge instead of overwriting each other. Rows survive rebuilds and restarts; drop the tables (or the schema) to start over.
|
|
219
|
-
|
|
220
|
-
It is opt-in on purpose: the `connectionString` you pass to `new ORM()` is not used, so a `DATABASE_URL` aimed at a shared database never receives dev writes. Use a database (or a schema, with `?options=-c%20search_path%3Dmy_schema`) of its own: a table with the entity's name and another layout is refused. Leaving the value unset (e.g. `DEV_DATABASE_URL` not exported) keeps `db.sqlite`.
|
|
221
|
-
|
|
222
|
-
```bash
|
|
223
|
-
docker run -d --name framework-dev-db -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:17
|
|
224
|
-
export DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
|
|
225
|
-
```
|
|
226
|
-
|
|
227
173
|
## Programmatic usage
|
|
228
174
|
|
|
229
175
|
```typescript
|
|
@@ -263,40 +209,18 @@ await server.down()
|
|
|
263
209
|
|
|
264
210
|
`vite: false` disables Vite; `vite.root` / `vite.configFile` point at another Vite project. The server logs the listening URL, build output and the routes of every workflow through `logger` (default `console`, `false` to silence). A manifest with a workflow that has no authorization (and no app default) emits `error` with a `WorkflowAuthorizationMissingError`; `framework dev` exits with code 1 in that case.
|
|
265
211
|
|
|
266
|
-
### Headless runs
|
|
267
|
-
|
|
268
|
-
`HeadlessApp` builds the project once and loads it without the HTTP server or Vite — what `framework workflows` uses to run a workflow from the terminal:
|
|
269
|
-
|
|
270
|
-
```typescript
|
|
271
|
-
import { HeadlessApp } from '@t4h.framework/dev'
|
|
272
|
-
|
|
273
|
-
const app = await HeadlessApp.up({ entrypoint: './package.json', env: {} })
|
|
274
|
-
|
|
275
|
-
try {
|
|
276
|
-
const { run, timedOut, waiting, trace } = await app.run(
|
|
277
|
-
'create-invoice',
|
|
278
|
-
{ customerId: 'c-1', amount: 100 },
|
|
279
|
-
{ timeoutInMs: 60_000, trace: true },
|
|
280
|
-
)
|
|
281
|
-
} finally {
|
|
282
|
-
await app.down()
|
|
283
|
-
}
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
`run()` resolves once the run settles or the timeout elapses (`timedOut: true`, with the async activities still waiting in `waiting`); `trace` adds the activities, logs and child runs. Unknown workflows, invalid input and build failures throw a `HeadlessAppError` with `status` and `details`. The app's stdout goes to stderr.
|
|
287
|
-
|
|
288
212
|
## Dev claims
|
|
289
213
|
|
|
290
214
|
In production, claims are fulfilled by the runtime (database connections, real HTTP clients, etc.). During local development, `@t4h.framework/dev` registers in-memory substitutes:
|
|
291
215
|
|
|
292
|
-
| Claim | Dev implementation
|
|
293
|
-
| ------------------------ |
|
|
294
|
-
| `ORMClaim` | SQLite file `db.sqlite` in the project directory
|
|
295
|
-
| `HttpClientRequestClaim` | Real HTTP via `undici`
|
|
296
|
-
| `FileSystemClaim` | Local file system with dev binary codec
|
|
297
|
-
| `SmtpSendEmailClaim` | Captures emails in memory (no delivery)
|
|
298
|
-
| `CacheClaim` |
|
|
299
|
-
| `WorkflowClaim` | Runs workflows through the local workflow engine
|
|
216
|
+
| Claim | Dev implementation |
|
|
217
|
+
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
|
|
218
|
+
| `ORMClaim` | SQLite file `db.sqlite` in the project directory; `where` keeps the Mongo-like semantics (`$like`, `$ilike`, `$or`, ...) |
|
|
219
|
+
| `HttpClientRequestClaim` | Real HTTP via `undici` |
|
|
220
|
+
| `FileSystemClaim` | Local file system with dev binary codec |
|
|
221
|
+
| `SmtpSendEmailClaim` | Captures emails in memory (no delivery) |
|
|
222
|
+
| `CacheClaim` | In-memory cache |
|
|
223
|
+
| `WorkflowClaim` | Runs workflows through the local workflow engine |
|
|
300
224
|
|
|
301
225
|
Import the full claim registry:
|
|
302
226
|
|
package/dist/AppProcess.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { fork } from 'node:child_process';
|
|
2
2
|
import { EventEmitter } from 'node:events';
|
|
3
3
|
import type { App } from '@t4h.framework/core';
|
|
4
|
-
import type { FrameworkORMConfig, FrameworkRuntimeConfig } from './models/FrameworkConfig.js';
|
|
5
|
-
import type { RuntimeKind } from './tools/runtime-registry.js';
|
|
6
4
|
export type AppManifest = ReturnType<App['toManifest']>;
|
|
7
5
|
export type AppProcessState = 'idle' | 'starting' | 'ready' | 'exited';
|
|
8
6
|
export declare class AppProcessNotReadyError extends Error {
|
|
@@ -13,38 +11,26 @@ export interface AppProcessOptions {
|
|
|
13
11
|
readyTimeoutInMs?: number;
|
|
14
12
|
killTimeoutInMs?: number;
|
|
15
13
|
fork?: typeof fork;
|
|
16
|
-
/** Where the app writes its stdout; `stderr` keeps the parent stdout clean. */
|
|
17
|
-
stdout?: 'inherit' | 'stderr';
|
|
18
14
|
}
|
|
19
15
|
export interface AppProcessUpOptions {
|
|
20
16
|
/** Public origin of the HTTP server in front of this process; webhooks build callback URLs on it. */
|
|
21
17
|
serverUrl?: string;
|
|
22
|
-
/** How the app runs workflows; see `FrameworkConfig.runtime`. */
|
|
23
|
-
runtime?: FrameworkRuntimeConfig;
|
|
24
|
-
/** Where the ORM claim stores its rows; see `FrameworkConfig.orm`. */
|
|
25
|
-
orm?: FrameworkORMConfig;
|
|
26
|
-
/** Advertised to `framework runtime` so it can tell runtimes apart. */
|
|
27
|
-
kind?: RuntimeKind;
|
|
28
|
-
projectDir?: string;
|
|
29
|
-
/** Logs every runtime event: `-` to stderr, or a file path (NDJSON). */
|
|
30
|
-
debugLog?: string;
|
|
31
18
|
}
|
|
32
19
|
export declare class AppProcess extends EventEmitter {
|
|
33
20
|
private readonly workerPath;
|
|
34
21
|
private readonly readyTimeoutInMs;
|
|
35
22
|
private readonly killTimeoutInMs;
|
|
36
23
|
private readonly forkProcess;
|
|
37
|
-
private readonly stdout;
|
|
38
24
|
private readonly server;
|
|
39
25
|
private child;
|
|
40
26
|
private client;
|
|
41
27
|
private ready;
|
|
42
28
|
private currentManifest;
|
|
43
29
|
private currentState;
|
|
44
|
-
constructor({ workerPath, readyTimeoutInMs, killTimeoutInMs, fork: forkProcess,
|
|
30
|
+
constructor({ workerPath, readyTimeoutInMs, killTimeoutInMs, fork: forkProcess, }?: AppProcessOptions);
|
|
45
31
|
get manifest(): AppManifest | null;
|
|
46
32
|
get state(): AppProcessState;
|
|
47
|
-
up(entrypoint: string, env: Record<string, string>, { serverUrl
|
|
33
|
+
up(entrypoint: string, env: Record<string, string>, { serverUrl }?: AppProcessUpOptions): Promise<AppManifest>;
|
|
48
34
|
down(): Promise<void>;
|
|
49
35
|
private kill;
|
|
50
36
|
whenReady(): Promise<AppManifest>;
|
package/dist/AppProcess.js
CHANGED
|
@@ -3,39 +3,29 @@ import { EventEmitter } from 'node:events';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { styleText } from 'node:util';
|
|
5
5
|
import Type from 'typebox';
|
|
6
|
-
import { APP_KILL_TIMEOUT_IN_MS, APP_READY_TIMEOUT_IN_MS,
|
|
6
|
+
import { APP_KILL_TIMEOUT_IN_MS, APP_READY_TIMEOUT_IN_MS, SERVER_URL_ARG, WORKFLOW_RUN_EVENTS, } from './constants/server.js';
|
|
7
7
|
import { JSONRPCClient } from './models/JSONRPCClient.js';
|
|
8
8
|
import { JSONRPCServer, JSONRPCServerMethod } from './models/JSONRPCServer.js';
|
|
9
9
|
export class AppProcessNotReadyError extends Error {
|
|
10
10
|
name = 'AppProcessNotReadyError';
|
|
11
11
|
}
|
|
12
|
-
/** Only `orm.connectionString` turns Postgres on, never an inherited variable. */
|
|
13
|
-
function appProcessEnv(orm) {
|
|
14
|
-
const env = { ...process.env };
|
|
15
|
-
delete env[ORM_CONNECTION_STRING_ENV];
|
|
16
|
-
if (orm?.connectionString)
|
|
17
|
-
env[ORM_CONNECTION_STRING_ENV] = orm.connectionString;
|
|
18
|
-
return env;
|
|
19
|
-
}
|
|
20
12
|
export class AppProcess extends EventEmitter {
|
|
21
13
|
workerPath;
|
|
22
14
|
readyTimeoutInMs;
|
|
23
15
|
killTimeoutInMs;
|
|
24
16
|
forkProcess;
|
|
25
|
-
stdout;
|
|
26
17
|
server;
|
|
27
18
|
child = null;
|
|
28
19
|
client = null;
|
|
29
20
|
ready = null;
|
|
30
21
|
currentManifest = null;
|
|
31
22
|
currentState = 'idle';
|
|
32
|
-
constructor({ workerPath = path.join(import.meta.dirname, 'workers', 'app-process.js'), readyTimeoutInMs = APP_READY_TIMEOUT_IN_MS, killTimeoutInMs = APP_KILL_TIMEOUT_IN_MS, fork: forkProcess = fork,
|
|
23
|
+
constructor({ workerPath = path.join(import.meta.dirname, 'workers', 'app-process.js'), readyTimeoutInMs = APP_READY_TIMEOUT_IN_MS, killTimeoutInMs = APP_KILL_TIMEOUT_IN_MS, fork: forkProcess = fork, } = {}) {
|
|
33
24
|
super();
|
|
34
25
|
this.workerPath = workerPath;
|
|
35
26
|
this.readyTimeoutInMs = readyTimeoutInMs;
|
|
36
27
|
this.killTimeoutInMs = killTimeoutInMs;
|
|
37
28
|
this.forkProcess = forkProcess;
|
|
38
|
-
this.stdout = stdout;
|
|
39
29
|
this.server = new JSONRPCServer([
|
|
40
30
|
new JSONRPCServerMethod('manifest', { schema: [Type.Any()] }, (manifest) => this.onManifest(manifest)),
|
|
41
31
|
...WORKFLOW_RUN_EVENTS.map(event => new JSONRPCServerMethod(event, { schema: [Type.Any()] }, (payload) => void this.emit(event, payload))),
|
|
@@ -49,7 +39,7 @@ export class AppProcess extends EventEmitter {
|
|
|
49
39
|
get state() {
|
|
50
40
|
return this.currentState;
|
|
51
41
|
}
|
|
52
|
-
async up(entrypoint, env, { serverUrl
|
|
42
|
+
async up(entrypoint, env, { serverUrl } = {}) {
|
|
53
43
|
const previous = this.child;
|
|
54
44
|
this.child = null;
|
|
55
45
|
this.client?.rejectPending(new AppProcessNotReadyError('App process is restarting'));
|
|
@@ -61,25 +51,8 @@ export class AppProcess extends EventEmitter {
|
|
|
61
51
|
const child = this.forkProcess(this.workerPath, [
|
|
62
52
|
entrypoint,
|
|
63
53
|
...(serverUrl ? [`${SERVER_URL_ARG}${serverUrl}`] : []),
|
|
64
|
-
...(runtime?.workers !== undefined
|
|
65
|
-
? [`${RUNTIME_WORKERS_ARG}${runtime.workers}`]
|
|
66
|
-
: []),
|
|
67
|
-
...(runtime?.concurrency !== undefined
|
|
68
|
-
? [`${RUNTIME_CONCURRENCY_ARG}${runtime.concurrency}`]
|
|
69
|
-
: []),
|
|
70
|
-
...(kind ? [`${RUNTIME_KIND_ARG}${kind}`] : []),
|
|
71
|
-
...(projectDir ? [`${PROJECT_DIR_ARG}${projectDir}`] : []),
|
|
72
|
-
...(debugLog ? [`${DEBUG_LOG_ARG}${debugLog}`] : []),
|
|
73
54
|
...Object.entries(env).map(([name, value]) => `${name}=${value}`),
|
|
74
|
-
], {
|
|
75
|
-
env: appProcessEnv(orm),
|
|
76
|
-
stdio: [
|
|
77
|
-
'ignore',
|
|
78
|
-
this.stdout === 'stderr' ? process.stderr : 'inherit',
|
|
79
|
-
'inherit',
|
|
80
|
-
'ipc',
|
|
81
|
-
],
|
|
82
|
-
});
|
|
55
|
+
], { stdio: ['ignore', 'inherit', 'inherit', 'ipc'] });
|
|
83
56
|
const client = new JSONRPCClient(message => {
|
|
84
57
|
child.send(message);
|
|
85
58
|
});
|
package/dist/AppProcess.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppProcess.js","sourceRoot":"","sources":["../src/AppProcess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAqB,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAGrC,OAAO,IAAI,MAAM,SAAS,CAAA;AAE1B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"AppProcess.js","sourceRoot":"","sources":["../src/AppProcess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAqB,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAGrC,OAAO,IAAI,MAAM,SAAS,CAAA;AAE1B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EACd,mBAAmB,GACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAM9E,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvB,IAAI,GAAG,yBAAyB,CAAA;CAC1D;AAcD,MAAM,OAAO,UAAW,SAAQ,YAAY;IACzB,UAAU,CAAQ;IAClB,gBAAgB,CAAQ;IACxB,eAAe,CAAQ;IACvB,WAAW,CAAa;I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AG,MAAM,CAAC,CAAA;IAC5C,CAAC;IAEO,UAAU,CAAC,QAAqB;QACtC,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAA;QAC/B,IAAI,CAAC,YAAY,GAAG,OAAO,CAAA;QAE3B,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;QAE7B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IACjC,CAAC;IAEO,MAAM,CAAC,KAAmB,EAAE,IAAmB;QACrD,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK;YAAE,OAAM;QAEhC,MAAM,KAAK,GAAG,IAAI,uBAAuB,CACvC,gCAAgC,IAAI,EAAE,CACvC,CAAA;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAA;QAE5B,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAA;QACjC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAElB,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAA;QAEzB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACzB,CAAC;CACF"}
|
package/dist/Server.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ export interface ServerOptions {
|
|
|
14
14
|
host?: string;
|
|
15
15
|
vite?: ServerViteOptions | false;
|
|
16
16
|
logger?: ServerLogger | false;
|
|
17
|
-
/** Logs every runtime event: `-` to stderr, or a file path (NDJSON). */
|
|
18
|
-
debugLog?: string;
|
|
19
17
|
}
|
|
20
18
|
export interface ServerAddress {
|
|
21
19
|
host: string;
|
|
@@ -33,9 +31,6 @@ export declare class Server extends EventEmitter {
|
|
|
33
31
|
private currentAddress;
|
|
34
32
|
private packageJsonPath;
|
|
35
33
|
private outDir;
|
|
36
|
-
private runtime;
|
|
37
|
-
private orm;
|
|
38
|
-
private projectDir;
|
|
39
34
|
constructor(options: ServerOptions);
|
|
40
35
|
get manifest(): AppManifest | null;
|
|
41
36
|
get address(): ServerAddress;
|
package/dist/Server.js
CHANGED
|
@@ -11,12 +11,9 @@ import { createApp } from './http/create-app.js';
|
|
|
11
11
|
import { WorkflowAuthorizationMissingError } from './models/WorkflowAuthorizationMissingError.js';
|
|
12
12
|
import { findFreePort } from './tools/find-free-port.js';
|
|
13
13
|
import { formatRoutes } from './tools/format-routes.js';
|
|
14
|
-
import { loadFrameworkConfig } from './tools/load-framework-config.js';
|
|
15
14
|
import { mkdirOutDirProjectFromTsConfigPathAndJsonPackagePath } from './tools/mkdir-out-dir-project-from-ts-config-path-and-json-package-path.js';
|
|
16
15
|
import { resolvePackageJsonPath } from './tools/resolve-package-json-path.js';
|
|
17
16
|
import { resolveTsconfigFromPackageJsonPath } from './tools/resolve-tsconfig-path-from-package-json-path.js';
|
|
18
|
-
import { toORMConfig } from './tools/to-orm-config.js';
|
|
19
|
-
import { toRuntimeConfig } from './tools/to-runtime-config.js';
|
|
20
17
|
import { tsBuildWatch } from './tools/ts-build-watch.js';
|
|
21
18
|
function isApiPath(pathname) {
|
|
22
19
|
return [PROJECTS_ROUTES_PREFIX, DEV_ROUTES_PREFIX].some(prefix => pathname === prefix || pathname.startsWith(`${prefix}/`));
|
|
@@ -37,9 +34,6 @@ export class Server extends EventEmitter {
|
|
|
37
34
|
currentAddress = null;
|
|
38
35
|
packageJsonPath = null;
|
|
39
36
|
outDir = null;
|
|
40
|
-
runtime = undefined;
|
|
41
|
-
orm = undefined;
|
|
42
|
-
projectDir = null;
|
|
43
37
|
constructor(options) {
|
|
44
38
|
super();
|
|
45
39
|
this.options = options;
|
|
@@ -69,10 +63,6 @@ export class Server extends EventEmitter {
|
|
|
69
63
|
const project = await mkdirOutDirProjectFromTsConfigPathAndJsonPackagePath(tsConfigPath, this.packageJsonPath);
|
|
70
64
|
this.outDir = project.outDir;
|
|
71
65
|
const projectDir = path.dirname(this.packageJsonPath);
|
|
72
|
-
this.projectDir = projectDir;
|
|
73
|
-
const config = await loadFrameworkConfig(projectDir);
|
|
74
|
-
this.runtime = toRuntimeConfig(config.runtime);
|
|
75
|
-
this.orm = toORMConfig(config.orm);
|
|
76
66
|
const app = createApp({
|
|
77
67
|
appProcess: this.appProcess,
|
|
78
68
|
events: this,
|
|
@@ -149,11 +139,6 @@ export class Server extends EventEmitter {
|
|
|
149
139
|
try {
|
|
150
140
|
manifest = await this.appProcess.up(entrypoint, this.options.env, {
|
|
151
141
|
serverUrl: this.currentAddress?.url,
|
|
152
|
-
runtime: this.runtime,
|
|
153
|
-
orm: this.orm,
|
|
154
|
-
kind: 'dev',
|
|
155
|
-
projectDir: this.projectDir ?? undefined,
|
|
156
|
-
debugLog: this.options.debugLog,
|
|
157
142
|
});
|
|
158
143
|
}
|
|
159
144
|
catch (error) {
|
package/dist/Server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.js","sourceRoot":"","sources":["../src/Server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAItD,OAAO,EAAE,UAAU,EAAoB,MAAM,iBAAiB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"Server.js","sourceRoot":"","sources":["../src/Server.ts"],"names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AAK,CAAC,OAAO,EAAE,EAAE;gBAC5C,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB,CAAC,CACH,CAAA;YAED,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;YAEzB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAE/B,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,cAAc;YACpC,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,YAAY,CAAC;gBACX,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG;gBAChC,QAAQ;gBACR,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB,CAAC,CACH,CAAA;IACL,CAAC;IAEO,KAAK,CAAC,UAAU,CACtB,UAAuB,EACvB,UAAkB,EAClB,EAAE,IAAI,GAAG,UAAU,EAAE,UAAU,EAAE,OAAO,EAAqB;QAE7D,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAA;QAE7C,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAA;QAE3E,OAAO,YAAY,CAAC;YAClB,IAAI;YACJ,UAAU;YACV,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;YAC7D,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;SAC/D,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -10,17 +10,4 @@ export declare const PROJECTS_ROUTES_PREFIX = "/projects";
|
|
|
10
10
|
export declare const DEV_ROUTES_PREFIX = "/_dev";
|
|
11
11
|
export declare const SERVER_URL_ARG = "--server-url=";
|
|
12
12
|
export declare const WORKFLOW_RUN_EVENTS: readonly ["run:created", "run:updated"];
|
|
13
|
-
|
|
14
|
-
export declare const WORKFLOW_RUN_JOB_CONCURRENCY = 4;
|
|
15
|
-
export declare const RUNTIME_WORKERS_ARG = "--runtime-workers=";
|
|
16
|
-
export declare const RUNTIME_CONCURRENCY_ARG = "--runtime-concurrency=";
|
|
17
|
-
export declare const RUNTIME_KIND_ARG = "--runtime-kind=";
|
|
18
|
-
export declare const PROJECT_DIR_ARG = "--project-dir=";
|
|
19
|
-
/**
|
|
20
|
-
* Hands `orm.connectionString` to the app process and its workers through the
|
|
21
|
-
* environment, so it never shows up in the process arguments.
|
|
22
|
-
*/
|
|
23
|
-
export declare const ORM_CONNECTION_STRING_ENV = "T4H_DEV_ORM_CONNECTION_STRING";
|
|
24
|
-
/** `-` for readable lines on stderr, or a file path for NDJSON. */
|
|
25
|
-
export declare const DEBUG_LOG_ARG = "--debug-log=";
|
|
26
|
-
export declare const WORKFLOW_WORKER_READY_TIMEOUT_IN_MS = 30000;
|
|
13
|
+
export declare const WORKFLOW_RUN_NEXT_TICK_CONCURRENCY = 10;
|
package/dist/constants/server.js
CHANGED
|
@@ -10,18 +10,5 @@ export const PROJECTS_ROUTES_PREFIX = '/projects';
|
|
|
10
10
|
export const DEV_ROUTES_PREFIX = '/_dev';
|
|
11
11
|
export const SERVER_URL_ARG = '--server-url=';
|
|
12
12
|
export const WORKFLOW_RUN_EVENTS = ['run:created', 'run:updated'];
|
|
13
|
-
|
|
14
|
-
export const WORKFLOW_RUN_JOB_CONCURRENCY = 4;
|
|
15
|
-
export const RUNTIME_WORKERS_ARG = '--runtime-workers=';
|
|
16
|
-
export const RUNTIME_CONCURRENCY_ARG = '--runtime-concurrency=';
|
|
17
|
-
export const RUNTIME_KIND_ARG = '--runtime-kind=';
|
|
18
|
-
export const PROJECT_DIR_ARG = '--project-dir=';
|
|
19
|
-
/**
|
|
20
|
-
* Hands `orm.connectionString` to the app process and its workers through the
|
|
21
|
-
* environment, so it never shows up in the process arguments.
|
|
22
|
-
*/
|
|
23
|
-
export const ORM_CONNECTION_STRING_ENV = 'T4H_DEV_ORM_CONNECTION_STRING';
|
|
24
|
-
/** `-` for readable lines on stderr, or a file path for NDJSON. */
|
|
25
|
-
export const DEBUG_LOG_ARG = '--debug-log=';
|
|
26
|
-
export const WORKFLOW_WORKER_READY_TIMEOUT_IN_MS = 30_000;
|
|
13
|
+
export const WORKFLOW_RUN_NEXT_TICK_CONCURRENCY = 10;
|
|
27
14
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/constants/server.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAA;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAA;AAEvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,GAAG,IAAI,CAAA;AAElD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvD,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,GAAG,IAAI,CAAA;AAEzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAA;AAE7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAA;AAE3C,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAA;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAA;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAA;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAA;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,aAAa,CAAU,CAAA;AAE1E,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/constants/server.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAA;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAA;AAEvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,GAAG,IAAI,CAAA;AAElD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvD,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,GAAG,IAAI,CAAA;AAEzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAA;AAE7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAA;AAE3C,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAA;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAA;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAA;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAA;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,aAAa,CAAU,CAAA;AAE1E,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
export * from './Server.js';
|
|
2
2
|
export * from './models/WorkflowAuthorizationMissingError.js';
|
|
3
3
|
export type { AppManifest, AppProcessState } from './AppProcess.js';
|
|
4
|
-
export * from './HeadlessApp.js';
|
|
5
|
-
export { DEBUG_LOG_STDERR } from './models/RuntimeDebugLog.js';
|
|
6
|
-
export type * from './models/RuntimeEvent.js';
|
|
7
|
-
export { formatRuntimeEvent } from './tools/format-runtime-event.js';
|
|
8
|
-
export * from './tools/runtime-control-client.js';
|
|
9
|
-
export { listRuntimes, type RuntimeInfo, type RuntimeKind, type RuntimeStatus, } from './tools/runtime-registry.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
export * from './Server.js';
|
|
2
2
|
export * from './models/WorkflowAuthorizationMissingError.js';
|
|
3
|
-
export * from './HeadlessApp.js';
|
|
4
|
-
export { DEBUG_LOG_STDERR } from './models/RuntimeDebugLog.js';
|
|
5
|
-
export { formatRuntimeEvent } from './tools/format-runtime-event.js';
|
|
6
|
-
export * from './tools/runtime-control-client.js';
|
|
7
|
-
export { listRuntimes, } from './tools/runtime-registry.js';
|
|
8
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,+CAA+C,CAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,+CAA+C,CAAA"}
|
package/dist/integrations/orm.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { MapCollection, ORM, ORMClaim, Ref, RefCollection, } from '@t4h.framework/orm';
|
|
2
|
-
import { ORM_CONNECTION_STRING_ENV } from '../constants/server.js';
|
|
3
2
|
import { DevORMClaim } from '../models/claims/DevORMClaim.js';
|
|
4
3
|
import { JSONCodecKindFrameworkSerializableClass as Kind } from '../models/JSONCodecKindFrameworkSerializableClass.js';
|
|
5
|
-
|
|
6
|
-
import { SqliteDevORMStore } from '../models/SqliteDevORMStore.js';
|
|
7
|
-
const connectionString = process.env[ORM_CONNECTION_STRING_ENV];
|
|
8
|
-
export const claims = [
|
|
9
|
-
{
|
|
10
|
-
provide: ORMClaim,
|
|
11
|
-
value: new DevORMClaim(connectionString
|
|
12
|
-
? new PostgresDevORMStore(connectionString)
|
|
13
|
-
: new SqliteDevORMStore()),
|
|
14
|
-
},
|
|
15
|
-
];
|
|
4
|
+
export const claims = [{ provide: ORMClaim, value: new DevORMClaim() }];
|
|
16
5
|
export const kinds = [
|
|
17
6
|
new Kind('orm', ORM),
|
|
18
7
|
new Kind('orm:ref', Ref),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orm.js","sourceRoot":"","sources":["../../src/integrations/orm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,GAAG,EACH,QAAQ,EACR,GAAG,EACH,aAAa,GACd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"orm.js","sourceRoot":"","sources":["../../src/integrations/orm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,GAAG,EACH,QAAQ,EACR,GAAG,EACH,aAAa,GACd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC7D,OAAO,EAAE,uCAAuC,IAAI,IAAI,EAAE,MAAM,sDAAsD,CAAA;AAEtH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,WAAW,EAAE,EAAE,CAAC,CAAA;AAEvE,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC;IACpB,IAAI,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC;IACxB,IAAI,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC;IAC7C,IAAI,IAAI,CAAC,oBAAoB,EAAE,aAAa,CAAC;CAC9C,CAAA"}
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
export type FrameworkBuildConfig = {
|
|
2
2
|
assets?: readonly string[];
|
|
3
3
|
};
|
|
4
|
-
export type FrameworkRuntimeConfig = {
|
|
5
|
-
/**
|
|
6
|
-
* Worker threads that run workflows in `t4h dev`. Defaults to the available
|
|
7
|
-
* CPUs minus one; `0` runs them on the app thread.
|
|
8
|
-
*/
|
|
9
|
-
workers?: number;
|
|
10
|
-
/** Jobs each worker (or the app thread) runs at once. Defaults to 4. */
|
|
11
|
-
concurrency?: number;
|
|
12
|
-
};
|
|
13
|
-
export type FrameworkORMConfig = {
|
|
14
|
-
/**
|
|
15
|
-
* Postgres URL (`postgres://user:password@host:5432/database`) where the dev
|
|
16
|
-
* ORM claim stores its rows instead of `db.sqlite`. Unset keeps SQLite.
|
|
17
|
-
*/
|
|
18
|
-
connectionString?: string;
|
|
19
|
-
};
|
|
20
4
|
export type FrameworkConfig = {
|
|
21
5
|
build?: FrameworkBuildConfig;
|
|
22
|
-
runtime?: FrameworkRuntimeConfig;
|
|
23
|
-
orm?: FrameworkORMConfig;
|
|
24
6
|
};
|
|
25
7
|
/**
|
|
26
8
|
* Identity helper that types a `framework.config.ts` default export.
|
|
@@ -31,8 +13,6 @@ export type FrameworkConfig = {
|
|
|
31
13
|
*
|
|
32
14
|
* export default defineConfig({
|
|
33
15
|
* build: { assets: ['assets/**'] },
|
|
34
|
-
* runtime: { workers: 2, concurrency: 4 },
|
|
35
|
-
* orm: { connectionString: process.env.DEV_DATABASE_URL },
|
|
36
16
|
* })
|
|
37
17
|
*/
|
|
38
18
|
export declare function defineConfig(config: FrameworkConfig): FrameworkConfig;
|