@elaraai/e3-api-server 1.0.84 → 1.0.86
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/README.md +88 -11
- package/dist/src/errors.d.ts +15 -0
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +22 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/handlers/dataflow.d.ts +89 -18
- package/dist/src/handlers/dataflow.d.ts.map +1 -1
- package/dist/src/handlers/dataflow.js +198 -123
- package/dist/src/handlers/dataflow.js.map +1 -1
- package/dist/src/handlers/dataflow.spec.js +257 -7
- package/dist/src/handlers/dataflow.spec.js.map +1 -1
- package/dist/src/handlers/datasets.d.ts +56 -15
- package/dist/src/handlers/datasets.d.ts.map +1 -1
- package/dist/src/handlers/datasets.js +200 -122
- package/dist/src/handlers/datasets.js.map +1 -1
- package/dist/src/handlers/datasets.spec.js +92 -2
- package/dist/src/handlers/datasets.spec.js.map +1 -1
- package/dist/src/handlers/functions.d.ts +11 -2
- package/dist/src/handlers/functions.d.ts.map +1 -1
- package/dist/src/handlers/functions.js +50 -20
- package/dist/src/handlers/functions.js.map +1 -1
- package/dist/src/handlers/functions.spec.js +12 -1
- package/dist/src/handlers/functions.spec.js.map +1 -1
- package/dist/src/handlers/index.d.ts +2 -2
- package/dist/src/handlers/index.d.ts.map +1 -1
- package/dist/src/handlers/index.js +2 -2
- package/dist/src/handlers/index.js.map +1 -1
- package/dist/src/handlers/packages.d.ts +1 -1
- package/dist/src/handlers/packages.d.ts.map +1 -1
- package/dist/src/handlers/packages.js +1 -1
- package/dist/src/handlers/packages.js.map +1 -1
- package/dist/src/handlers/records.d.ts +27 -7
- package/dist/src/handlers/records.d.ts.map +1 -1
- package/dist/src/handlers/records.js +36 -16
- package/dist/src/handlers/records.js.map +1 -1
- package/dist/src/handlers/records.spec.js +160 -26
- package/dist/src/handlers/records.spec.js.map +1 -1
- package/dist/src/handlers/repository.d.ts +9 -1
- package/dist/src/handlers/repository.d.ts.map +1 -1
- package/dist/src/handlers/repository.js +14 -5
- package/dist/src/handlers/repository.js.map +1 -1
- package/dist/src/handlers/tasks.d.ts +18 -6
- package/dist/src/handlers/tasks.d.ts.map +1 -1
- package/dist/src/handlers/tasks.js +31 -22
- package/dist/src/handlers/tasks.js.map +1 -1
- package/dist/src/handlers/tasks.spec.js +61 -12
- package/dist/src/handlers/tasks.spec.js.map +1 -1
- package/dist/src/handlers/workspaces.d.ts +11 -6
- package/dist/src/handlers/workspaces.d.ts.map +1 -1
- package/dist/src/handlers/workspaces.js +14 -8
- package/dist/src/handlers/workspaces.js.map +1 -1
- package/dist/src/handlers/workspaces.spec.js +24 -8
- package/dist/src/handlers/workspaces.spec.js.map +1 -1
- package/dist/src/identity.d.ts +22 -0
- package/dist/src/identity.d.ts.map +1 -0
- package/dist/src/identity.js +6 -0
- package/dist/src/identity.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/local-dataflow.d.ts +14 -1
- package/dist/src/local-dataflow.d.ts.map +1 -1
- package/dist/src/local-dataflow.js +12 -7
- package/dist/src/local-dataflow.js.map +1 -1
- package/dist/src/middleware/auth.d.ts +1 -11
- package/dist/src/middleware/auth.d.ts.map +1 -1
- package/dist/src/middleware/auth.js.map +1 -1
- package/dist/src/middleware/repository.d.ts +1 -1
- package/dist/src/middleware/repository.d.ts.map +1 -1
- package/dist/src/middleware/repository.js +4 -10
- package/dist/src/middleware/repository.js.map +1 -1
- package/dist/src/middleware/repository.spec.js +7 -6
- package/dist/src/middleware/repository.spec.js.map +1 -1
- package/dist/src/portable.d.ts +47 -0
- package/dist/src/portable.d.ts.map +1 -0
- package/dist/src/portable.js +79 -0
- package/dist/src/portable.js.map +1 -0
- package/dist/src/portable.spec.d.ts +6 -0
- package/dist/src/portable.spec.d.ts.map +1 -0
- package/dist/src/portable.spec.js +325 -0
- package/dist/src/portable.spec.js.map +1 -0
- package/dist/src/routes/dataset-path.d.ts +28 -0
- package/dist/src/routes/dataset-path.d.ts.map +1 -0
- package/dist/src/routes/dataset-path.js +52 -0
- package/dist/src/routes/dataset-path.js.map +1 -0
- package/dist/src/routes/datasets.d.ts +7 -1
- package/dist/src/routes/datasets.d.ts.map +1 -1
- package/dist/src/routes/datasets.js +5 -11
- package/dist/src/routes/datasets.js.map +1 -1
- package/dist/src/routes/executions.d.ts +4 -2
- package/dist/src/routes/executions.d.ts.map +1 -1
- package/dist/src/routes/executions.js +31 -10
- package/dist/src/routes/executions.js.map +1 -1
- package/dist/src/routes/functions.d.ts +16 -8
- package/dist/src/routes/functions.d.ts.map +1 -1
- package/dist/src/routes/functions.js +21 -11
- package/dist/src/routes/functions.js.map +1 -1
- package/dist/src/routes/index.d.ts +4 -3
- package/dist/src/routes/index.d.ts.map +1 -1
- package/dist/src/routes/index.js +1 -0
- package/dist/src/routes/index.js.map +1 -1
- package/dist/src/routes/objects.d.ts +4 -2
- package/dist/src/routes/objects.d.ts.map +1 -1
- package/dist/src/routes/objects.js +5 -8
- package/dist/src/routes/objects.js.map +1 -1
- package/dist/src/routes/package-transfer.d.ts +1 -1
- package/dist/src/routes/package-transfer.d.ts.map +1 -1
- package/dist/src/routes/package-transfer.js +19 -22
- package/dist/src/routes/package-transfer.js.map +1 -1
- package/dist/src/routes/packages.d.ts +1 -1
- package/dist/src/routes/packages.d.ts.map +1 -1
- package/dist/src/routes/query.d.ts +53 -0
- package/dist/src/routes/query.d.ts.map +1 -0
- package/dist/src/routes/query.js +86 -0
- package/dist/src/routes/query.js.map +1 -0
- package/dist/src/routes/query.spec.d.ts +6 -0
- package/dist/src/routes/query.spec.d.ts.map +1 -0
- package/dist/src/routes/query.spec.js +49 -0
- package/dist/src/routes/query.spec.js.map +1 -0
- package/dist/src/routes/records.d.ts +32 -3
- package/dist/src/routes/records.d.ts.map +1 -1
- package/dist/src/routes/records.js +34 -7
- package/dist/src/routes/records.js.map +1 -1
- package/dist/src/routes/repositories.d.ts +1 -1
- package/dist/src/routes/repositories.d.ts.map +1 -1
- package/dist/src/routes/repository.d.ts +6 -1
- package/dist/src/routes/repository.d.ts.map +1 -1
- package/dist/src/routes/repository.js +5 -0
- package/dist/src/routes/repository.js.map +1 -1
- package/dist/src/routes/repository.spec.d.ts +6 -0
- package/dist/src/routes/repository.spec.d.ts.map +1 -0
- package/dist/src/routes/repository.spec.js +84 -0
- package/dist/src/routes/repository.spec.js.map +1 -0
- package/dist/src/routes/tasks.d.ts +1 -1
- package/dist/src/routes/tasks.d.ts.map +1 -1
- package/dist/src/routes/tasks.js +16 -4
- package/dist/src/routes/tasks.js.map +1 -1
- package/dist/src/routes/transfer.d.ts +1 -1
- package/dist/src/routes/transfer.d.ts.map +1 -1
- package/dist/src/routes/transfer.js +7 -27
- package/dist/src/routes/transfer.js.map +1 -1
- package/dist/src/routes/workspaces.d.ts +1 -1
- package/dist/src/routes/workspaces.d.ts.map +1 -1
- package/dist/src/routes/workspaces.js +34 -22
- package/dist/src/routes/workspaces.js.map +1 -1
- package/dist/src/server.js +1 -1
- package/dist/src/server.js.map +1 -1
- package/dist/src/types.d.ts +63 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +7 -5
- package/dist/src/types.js.map +1 -1
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -160,8 +160,15 @@ of the run in the request's host, and a poll and a cancel read the latest run
|
|
|
160
160
|
from that store, whichever instance answers them. The dataset transfer routes
|
|
161
161
|
(`createTransferRoutes`) take the transfer backend, whose upload store takes a
|
|
162
162
|
delivery in on the runner it was given: an init adopts only what takes nothing
|
|
163
|
-
in, and answers at once. A
|
|
164
|
-
|
|
163
|
+
in, and answers at once. A poll reads the latest run's summary from the store
|
|
164
|
+
(`readLatestSummary`), and its events only past the poll's cursor, a page of
|
|
165
|
+
its limit at a time, from the run's events, which the store keeps apart from
|
|
166
|
+
its state, so a store whose reads cost by the byte answers a caught-up poll
|
|
167
|
+
cheaply, and any poll by what it serves; the waits and
|
|
168
|
+
split progress it serves are the orchestrator's (`getProgress`), which has none
|
|
169
|
+
of a run another instance runs. A route answers for the repository in its URL
|
|
170
|
+
alone: a job, an upload or a run another repository started is not found
|
|
171
|
+
through it.
|
|
165
172
|
|
|
166
173
|
```typescript
|
|
167
174
|
import { Hono } from 'hono';
|
|
@@ -182,18 +189,77 @@ leaves the steps to a job of its own. Given `applyUpgrades: false`, the gate
|
|
|
182
189
|
applies none: it answers every request to a repository that owes them `503`
|
|
183
190
|
`repository_upgrade_pending` — but a running dataflow's cancel and poll — until
|
|
184
191
|
the steps are applied, and calls `onUpgradePending` for each, where the host
|
|
185
|
-
starts its job, once. The job
|
|
186
|
-
`
|
|
187
|
-
|
|
192
|
+
starts its job, once. The job applies them with e3-core's
|
|
193
|
+
`repositoryUpgradeStep`, a part at a time, each running for the budget it is
|
|
194
|
+
given, until none is owed. A part takes the step up where the last one stopped,
|
|
195
|
+
whichever process ran it, and waits for work running in the repository as an
|
|
196
|
+
open does. No route applies a step itself: the record route (`getRecord`) only
|
|
197
|
+
reads, and refuses a repository that owes one as the gate does, gate or no.
|
|
188
198
|
|
|
189
199
|
```typescript
|
|
190
200
|
app.use('/api/repos/:repo/*', createRepositoryGate(storage, getRepoPath, {
|
|
191
201
|
applyUpgrades: false,
|
|
192
|
-
//
|
|
202
|
+
// Each run of the job applies a part, under its time limit, and the job
|
|
203
|
+
// runs again while any step is owed:
|
|
204
|
+
// repositoryUpgradeStep(storage, getRepoPath(repo), { budgetMs: 10 * 60_000 })
|
|
193
205
|
onUpgradePending: (repo) => startUpgradeJob(repo),
|
|
194
206
|
}));
|
|
195
207
|
```
|
|
196
208
|
|
|
209
|
+
A host's own routes answer their errors as these do, with the mapping every
|
|
210
|
+
route uses, so no host keeps a copy of it that falls behind as it grows:
|
|
211
|
+
|
|
212
|
+
- `errorToVariant` gives an e3-core error as the API's `ErrorType`, which
|
|
213
|
+
`sendError` answers in BEAST2;
|
|
214
|
+
- `errorToHttpStatus` and `sendJsonError` answer it as JSON, as the gate
|
|
215
|
+
answers its refusals;
|
|
216
|
+
- `sendUpgradePending` answers a repository that owes upgrades as the gate
|
|
217
|
+
does.
|
|
218
|
+
|
|
219
|
+
A host's own routes over records answer as the record and dataset routes do:
|
|
220
|
+
|
|
221
|
+
- `mutationResultOf` gives the outcome of a record operation as the
|
|
222
|
+
`MutationResultType` value the mutation and compact routes answer with,
|
|
223
|
+
such as a rollback's through e3-core's `recordSystemCommit`;
|
|
224
|
+
- `getValuePage` answers a window of a collection the host names by hash,
|
|
225
|
+
such as a record's state at a past commit, with the body, the `X-*` headers
|
|
226
|
+
and the refusals of a dataset's page (`getDatasetPage`).
|
|
227
|
+
|
|
228
|
+
Each is exported from the root and the portable entries, and each handler from
|
|
229
|
+
`./handlers` too. e3-api-client reads what they answer: `parsePage` a page,
|
|
230
|
+
`parseErrorBody` a JSON refusal, and `objectGet` and `collectionGetStream` a
|
|
231
|
+
value by its hash.
|
|
232
|
+
|
|
233
|
+
A host whose requests have a time limit gives it to the routes that run a
|
|
234
|
+
program for a request, so that each answers its typed outcome before the host
|
|
235
|
+
cuts it off: the function and one-shot routes take `syncDeadlineMs`, and so do
|
|
236
|
+
the record routes, whose mutation and compaction answer `timed_out` or
|
|
237
|
+
`conflict` 2 s under it. The record routes' `historyLimit` is how many commits
|
|
238
|
+
a history request that names no `limit` is answered with; the client pages on
|
|
239
|
+
from the last one's parent. Unset, as on this server, neither is bounded. A
|
|
240
|
+
limit no request could meet is refused when the routes are mounted.
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
app.route('/api/repos/:repo/workspaces/:ws/records', createWorkspaceRecordRoutes(storage, getRepoPath, getRunner, {
|
|
244
|
+
syncDeadlineMs: 29_000, // under a 30 s gateway
|
|
245
|
+
historyLimit: 1_000,
|
|
246
|
+
}));
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
A dataset page or key search pinned to the value's hash (`hash=`) never
|
|
250
|
+
changes, so it is answered `Cache-Control: private, max-age=31536000,
|
|
251
|
+
immutable`: the caller's own cache keeps it for good, and no cache between
|
|
252
|
+
keeps a workspace's rows for whoever asks next. A host whose data any caller may
|
|
253
|
+
read lets those caches keep it too, a CDN's among them, with the dataset
|
|
254
|
+
routes' `cache: 'public'`; `getDatasetPage`, `getValuePage` and
|
|
255
|
+
`findDatasetKey` take the same. An answer not pinned is `no-store`.
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
app.route('/api/repos/:repo/workspaces/:ws/datasets', createDatasetRoutes(storage, getRepoPath, transferBackend, {
|
|
259
|
+
cache: 'public', // every caller may read every workspace this host serves
|
|
260
|
+
}));
|
|
261
|
+
```
|
|
262
|
+
|
|
197
263
|
## API Endpoints
|
|
198
264
|
|
|
199
265
|
All endpoints are prefixed with `/api/repos/:repo` where `:repo` is:
|
|
@@ -208,6 +274,7 @@ All endpoints are prefixed with `/api/repos/:repo` where `:repo` is:
|
|
|
208
274
|
| PUT | `/api/repos/:repo` | Create repository (multi-repo mode) |
|
|
209
275
|
| DELETE | `/api/repos/:repo` | Remove repository (multi-repo mode): marked as being removed first, so a request to it is refused from then on |
|
|
210
276
|
| GET | `/api/repos/:repo/status` | Repository status (counts) |
|
|
277
|
+
| GET | `/api/repos/:repo/record` | The repository's record: the release that last wrote it, and the upgrades it has had. A read, which applies none it owes: without the gate ahead of it, a repository that owes one is refused as the gate refuses it, 503 `repository_upgrade_pending` with `Retry-After` |
|
|
211
278
|
| POST | `/api/repos/:repo/gc` | Start garbage collection (async) |
|
|
212
279
|
| GET | `/api/repos/:repo/gc/:id` | Get GC status |
|
|
213
280
|
|
|
@@ -231,7 +298,7 @@ All endpoints are prefixed with `/api/repos/:repo` where `:repo` is:
|
|
|
231
298
|
| GET | `/api/repos/:repo/workspaces` | List all workspaces |
|
|
232
299
|
| POST | `/api/repos/:repo/workspaces` | Create workspace |
|
|
233
300
|
| GET | `/api/repos/:repo/workspaces/:ws` | Get workspace info |
|
|
234
|
-
| GET | `/api/repos/:repo/workspaces/:ws/status` | Get workspace status (datasets, tasks, summary) |
|
|
301
|
+
| GET | `/api/repos/:repo/workspaces/:ws/status` | Get workspace status (datasets, tasks, summary). With `?path=` (repeated, each a dataset's keypath, `.inputs.x`), only those datasets and the tasks producing them, each as the whole status gives it: a path that names no dataset is left out, and one that is no keypath is refused 400 `bad_request` |
|
|
235
302
|
| POST | `/api/repos/:repo/workspaces/:ws/deploy` | Start deploying a package to the workspace, as a job: answers the job's id |
|
|
236
303
|
| GET | `/api/repos/:repo/workspaces/:ws/deploy/:id` | Poll a deploy job: `processing` with how far it has got, what the deploy did for each record and index, or why it failed |
|
|
237
304
|
| GET | `/api/repos/:repo/workspaces/:ws/lock` | What holds the workspace exclusively, and how far it says it has got; none when nothing does |
|
|
@@ -271,7 +338,7 @@ through the objects route and splices them itself, as e3-api-client's
|
|
|
271
338
|
|
|
272
339
|
| Method | Endpoint | Description |
|
|
273
340
|
|--------|----------|-------------|
|
|
274
|
-
| GET | `/api/repos/:repo/objects/:hash` | An object's bytes; one over 1 MB answers JSON `{ url }` to download it from |
|
|
341
|
+
| GET | `/api/repos/:repo/objects/:hash` | An object's bytes; one over 1 MB answers JSON `{ url }` to download it from; a hash that is no SHA-256 in lowercase hex is refused 400 `invalid_name` |
|
|
275
342
|
| GET | `/api/downloads/:id` | A download a `{ url }` answer names (no `Authorization`) |
|
|
276
343
|
|
|
277
344
|
### Dataset transfer
|
|
@@ -316,10 +383,10 @@ and its commit takes it in.
|
|
|
316
383
|
|--------|----------|-------------|
|
|
317
384
|
| GET | `/api/repos/:repo/packages/:pkg/:version/functions` | A package's functions and their signatures |
|
|
318
385
|
| GET | `/api/repos/:repo/packages/:pkg/:version/functions/:fn` | One function's signature |
|
|
319
|
-
| POST | `/api/repos/:repo/packages/:pkg/:version/functions/:fn` | Call a package's function: its result, inline |
|
|
386
|
+
| POST | `/api/repos/:repo/packages/:pkg/:version/functions/:fn` | Call a package's function with values: its result, inline. A dataset argument is `invalid` here, with no workspace to read it from |
|
|
320
387
|
| GET | `/api/repos/:repo/workspaces/:ws/functions` | The deployed package's functions |
|
|
321
388
|
| GET | `/api/repos/:repo/workspaces/:ws/functions/:fn` | One function's signature |
|
|
322
|
-
| POST | `/api/repos/:repo/workspaces/:ws/functions/:fn` | Call one of them |
|
|
389
|
+
| POST | `/api/repos/:repo/workspaces/:ws/functions/:fn` | Call one of them: each argument a value, or one of the workspace's datasets, pinned at its hash when the call starts; the result names the datasets it read (`inputs`) |
|
|
323
390
|
| POST | `/api/repos/:repo/workspaces/:ws/one-shot` | Run a caller's program over the workspace's datasets: its result, naming the datasets it read (`inputs`) |
|
|
324
391
|
| POST | `/api/repos/:repo/workspaces/:ws/one-shot/split` | Launch a split call — a caller's program over a dataset's pieces — as a job: answers the job's id; with `?explain=1` the job plans the pieces the call would run, and runs nothing |
|
|
325
392
|
| GET | `/api/repos/:repo/workspaces/:ws/one-shot/split/:id` | Poll a split call: how far it has got, its result, the pieces an explain planned, or why it failed |
|
|
@@ -345,13 +412,22 @@ for the whole job, counted from its launch. A call is polled only through the
|
|
|
345
412
|
repository and workspace that launched it, and a caller with a platform-free
|
|
346
413
|
grant polls only a platform-free call, or one such a caller launched.
|
|
347
414
|
|
|
415
|
+
### Records
|
|
416
|
+
|
|
417
|
+
| Method | Endpoint | Description |
|
|
418
|
+
|--------|----------|-------------|
|
|
419
|
+
| GET | `/api/repos/:repo/workspaces/:ws/records/:rec` | The record's mutations, indexes and migrations, with their types: whether each index is built for the head's state, and when each migration was applied and by which commit, read from the record's ref and state, never its history |
|
|
420
|
+
| GET | `/api/repos/:repo/workspaces/:ws/records/:rec/history` | Its commits, newest first: `?limit=` of them from `?from=`, the head when absent; with no limit, the whole chain, or the host's page (`historyLimit`). Each previews its arguments: the arguments' object, and each argument's type, size and East text, cut at 256 characters, the text of one over 64 KiB left out, and no argument of an object over 1 MiB, which the objects route serves whole |
|
|
421
|
+
| POST | `/api/repos/:repo/workspaces/:ws/records/:rec/mutations/:mut` | Apply a mutation: `committed`, `invalid`, `failed`, `timed_out` or `conflict`; with an `Idempotency-Key`, a retry answers the first call's commit |
|
|
422
|
+
| POST | `/api/repos/:repo/workspaces/:ws/records/:rec/compact` | Collapse the history to a `$compact` root, the state kept (an elevated role when auth is on) |
|
|
423
|
+
|
|
348
424
|
### Execution
|
|
349
425
|
|
|
350
426
|
| Method | Endpoint | Description |
|
|
351
427
|
|--------|----------|-------------|
|
|
352
428
|
| POST | `/api/repos/:repo/workspaces/:ws/dataflow` | Start a run of the dataflow (answers 202 once it has started) |
|
|
353
429
|
| GET | `/api/repos/:repo/workspaces/:ws/dataflow` | Get workspace status (for polling) |
|
|
354
|
-
| GET | `/api/repos/:repo/workspaces/:ws/dataflow/execution` | The latest run's state and
|
|
430
|
+
| GET | `/api/repos/:repo/workspaces/:ws/dataflow/execution` | The latest run's state, its id (`runId`) and the sequence number of its last event (`lastSeq`), and its events past the poll's cursor (`since`, the `nextSeq` the poll before answered; at most `limit` of them, and never more than 1,000, the default: a `nextSeq` before `lastSeq` left some for the next poll), with the server's budget in use; while the run is in flight, the tasks and units waiting for room and each split task's progress, as the orchestrator running it answers them |
|
|
355
431
|
| GET | `/api/repos/:repo/workspaces/:ws/dataflow/budget` | The budget a run gets: the server's cores and memory, and what its runners hold now (`none` from a host whose runners hold none) |
|
|
356
432
|
| POST | `/api/repos/:repo/workspaces/:ws/dataflow/cancel` | Cancel the run in progress |
|
|
357
433
|
| GET | `/api/repos/:repo/workspaces/:ws/dataflow/graph` | Get dependency graph |
|
|
@@ -366,6 +442,7 @@ Response bodies are wrapped in a variant type:
|
|
|
366
442
|
- `{ type: 'error', value: <error> }` - Operation failed
|
|
367
443
|
|
|
368
444
|
Error variants include:
|
|
445
|
+
- `invalid_name` - A name, hash or id is not of its form: its kind (a workspace's name, an object's hash, a run's id, …), the value, and why, whichever backend the server runs over
|
|
369
446
|
- `workspace_not_found` - Workspace doesn't exist
|
|
370
447
|
- `workspace_not_deployed` - No package deployed to workspace
|
|
371
448
|
- `workspace_locked` - Workspace is locked by another process
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
+
import { RepositoryUpgradePendingError } from '@elaraai/e3-core/portable';
|
|
5
6
|
import type { Error } from './types.js';
|
|
6
7
|
/**
|
|
7
8
|
* Map an e3-core error to an HTTP status code.
|
|
@@ -14,6 +15,20 @@ export declare function errorToHttpStatus(err: unknown): number;
|
|
|
14
15
|
* on success, so errors need a different content type and status code.
|
|
15
16
|
*/
|
|
16
17
|
export declare function sendJsonError(err: unknown): Response;
|
|
18
|
+
/**
|
|
19
|
+
* The answer to a request of a repository that owes store upgrades: 503 JSON
|
|
20
|
+
* `repository_upgrade_pending`, naming the steps and why they wait, with a
|
|
21
|
+
* `Retry-After`.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* The repository gate answers so, and so does a route that opens the
|
|
25
|
+
* repository itself, whatever its success's type: a client retries the
|
|
26
|
+
* request, and then raises `repository_upgrade_pending`.
|
|
27
|
+
*
|
|
28
|
+
* @param err - The open's refusal
|
|
29
|
+
* @returns The response
|
|
30
|
+
*/
|
|
31
|
+
export declare function sendUpgradePending(err: RepositoryUpgradePendingError): Response;
|
|
17
32
|
/**
|
|
18
33
|
* Convert an e3-core error to an API error variant.
|
|
19
34
|
*/
|
package/dist/src/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEL,6BAA6B,EAiB9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAsBtD;AA2BD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,CAQpD;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,6BAA6B,GAAG,QAAQ,CAI/E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CA+ElD"}
|
package/dist/src/errors.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
5
|
import { variant, some, none } from '@elaraai/east';
|
|
6
|
-
import { RepoNotFoundError, RepositoryUpgradePendingError, InvalidNameError, WorkspaceNotFoundError, WorkspaceNotDeployedError, WorkspaceExistsError, WorkspaceLockError, PackageNotFoundError, PackageExistsError, PackageInvalidError, DatasetNotFoundError, DatasetTypeMismatchError, TaskNotFoundError, ExecutionNotFoundError, ObjectNotFoundError, DataflowError, DataflowAbortedError, PermissionDeniedError, } from '@elaraai/e3-core';
|
|
6
|
+
import { RepoNotFoundError, RepositoryUpgradePendingError, InvalidNameError, WorkspaceNotFoundError, WorkspaceNotDeployedError, WorkspaceExistsError, WorkspaceLockError, PackageNotFoundError, PackageExistsError, PackageInvalidError, DatasetNotFoundError, DatasetTypeMismatchError, TaskNotFoundError, ExecutionNotFoundError, ObjectNotFoundError, DataflowError, DataflowAbortedError, PermissionDeniedError, } from '@elaraai/e3-core/portable';
|
|
7
7
|
/**
|
|
8
8
|
* Map an e3-core error to an HTTP status code.
|
|
9
9
|
*/
|
|
@@ -105,6 +105,27 @@ export function sendJsonError(err) {
|
|
|
105
105
|
headers: { 'Content-Type': 'application/json' },
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
+
/** How long, in seconds, a client is told to wait before it asks again of a
|
|
109
|
+
* repository an upgrade waits on. */
|
|
110
|
+
const UPGRADE_RETRY_AFTER_S = 5;
|
|
111
|
+
/**
|
|
112
|
+
* The answer to a request of a repository that owes store upgrades: 503 JSON
|
|
113
|
+
* `repository_upgrade_pending`, naming the steps and why they wait, with a
|
|
114
|
+
* `Retry-After`.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* The repository gate answers so, and so does a route that opens the
|
|
118
|
+
* repository itself, whatever its success's type: a client retries the
|
|
119
|
+
* request, and then raises `repository_upgrade_pending`.
|
|
120
|
+
*
|
|
121
|
+
* @param err - The open's refusal
|
|
122
|
+
* @returns The response
|
|
123
|
+
*/
|
|
124
|
+
export function sendUpgradePending(err) {
|
|
125
|
+
const refused = sendJsonError(err);
|
|
126
|
+
refused.headers.set('Retry-After', String(UPGRADE_RETRY_AFTER_S));
|
|
127
|
+
return refused;
|
|
128
|
+
}
|
|
108
129
|
/**
|
|
109
130
|
* Convert an e3-core error to an API error variant.
|
|
110
131
|
*/
|
package/dist/src/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,gBAAgB,EAChB,sBAAsB,EACtB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAG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,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,IAAI,GAAG,YAAY,sBAAsB,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,GAAG,YAAY,mBAAmB,EAAE,CAAC;QACvC,OAAO,OAAO,CAAC,kBAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,GAAG,YAAY,aAAa,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,IAAI,GAAG,YAAY,oBAAoB,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,GAAG,YAAY,qBAAqB,EAAE,CAAC;QACzC,OAAO,OAAO,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,8BAA8B;IAC9B,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,OAAO,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -2,7 +2,27 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { DataflowOrchestrator, ExecutionStateStore, StorageBackend, TaskRunner } from '@elaraai/e3-core/portable';
|
|
6
|
+
/**
|
|
7
|
+
* The budget a host's runners take from, as the dataflow routes serve it: its
|
|
8
|
+
* capacity, and what the runners hold of it now.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* e3-core's `Budget`, which a local server's runners hold, is one. The routes
|
|
12
|
+
* read no more of it than this, so they take it from a host whose budget is
|
|
13
|
+
* its own.
|
|
14
|
+
*/
|
|
15
|
+
export interface RunnerBudget {
|
|
16
|
+
/** Runner processes at once. */
|
|
17
|
+
readonly cores: number;
|
|
18
|
+
/** Bytes of memory the runners may reserve between them. */
|
|
19
|
+
readonly memory: number;
|
|
20
|
+
/** Runner processes holding the budget now. */
|
|
21
|
+
readonly inFlight: number;
|
|
22
|
+
/** Bytes the runners hold now, each at the larger of its reservation and
|
|
23
|
+
* what it was last measured using. */
|
|
24
|
+
readonly used: number;
|
|
25
|
+
}
|
|
6
26
|
/**
|
|
7
27
|
* Start dataflow execution (non-blocking).
|
|
8
28
|
*
|
|
@@ -13,20 +33,27 @@ import type { Budget, DataflowOrchestrator, ExecutionStateStore, StorageBackend,
|
|
|
13
33
|
* where it starts the run — a local one in its own process — so this never
|
|
14
34
|
* waits on it.
|
|
15
35
|
*
|
|
36
|
+
* The workspace's name is checked before the orchestrator is asked, so a name
|
|
37
|
+
* no workspace can have is refused alike whichever orchestrator runs the
|
|
38
|
+
* repository's dataflows, and no lock named for it is taken.
|
|
39
|
+
*
|
|
16
40
|
* @param storage - Storage backend
|
|
17
41
|
* @param orchestrator - The orchestrator that runs the repository's dataflows
|
|
18
42
|
* @param repoPath - The repository's path
|
|
19
43
|
* @param workspace - The workspace whose dataflow runs
|
|
20
44
|
* @param options - The runner the run's tasks and units run on, which holds
|
|
21
45
|
* the server's budget; the tasks and units the loop keeps in flight, the
|
|
22
|
-
* orchestrator's own default when absent;
|
|
23
|
-
* verbosity
|
|
24
|
-
* @returns 202 once the run has started, or the error that stopped it
|
|
46
|
+
* orchestrator's own default when absent; what the run forces — `true` for
|
|
47
|
+
* every task, or the tasks' names — its filter and its verbosity
|
|
48
|
+
* @returns 202 once the run has started, or the error that stopped it: a name
|
|
49
|
+
* no workspace can have is `invalid_name`, a forced task the graph does not
|
|
50
|
+
* have `task_not_found`, and one the filter's run set leaves out
|
|
51
|
+
* `dataflow_error`
|
|
25
52
|
*/
|
|
26
53
|
export declare function startDataflow(storage: StorageBackend, orchestrator: DataflowOrchestrator, repoPath: string, workspace: string, options: {
|
|
27
54
|
runner: TaskRunner;
|
|
28
55
|
width?: number;
|
|
29
|
-
force: boolean;
|
|
56
|
+
force: boolean | readonly string[];
|
|
30
57
|
filter?: string;
|
|
31
58
|
verbose?: boolean;
|
|
32
59
|
}): Promise<Response>;
|
|
@@ -46,31 +73,73 @@ export declare function getDataflowStatus(storage: StorageBackend, runner: TaskR
|
|
|
46
73
|
*/
|
|
47
74
|
export declare function getDataflowGraph(storage: StorageBackend, repoPath: string, workspace: string): Promise<Response>;
|
|
48
75
|
/**
|
|
49
|
-
* Get task
|
|
76
|
+
* Get a chunk of a task's log: of its current execution — the latest over its
|
|
77
|
+
* current inputs, or its latest run ({@link executionFindCurrent}) — or of the
|
|
78
|
+
* execution the request names. The chunk names the execution it was read from
|
|
79
|
+
* and whether it has ended, so a client polling the log reads on from its
|
|
80
|
+
* offset, starts over when the execution changes, and stops reading once it
|
|
81
|
+
* has ended and its log is read. A poll costs the same however long the task
|
|
82
|
+
* has run.
|
|
83
|
+
*
|
|
84
|
+
* @param storage - Storage backend
|
|
85
|
+
* @param repoPath - The repository's path
|
|
86
|
+
* @param workspace - The workspace
|
|
87
|
+
* @param taskName - The task
|
|
88
|
+
* @param stream - The log stream
|
|
89
|
+
* @param offset - The byte the chunk starts at
|
|
90
|
+
* @param limit - The most bytes it holds
|
|
91
|
+
* @param execution - The execution to read, by its inputs hash and id; the
|
|
92
|
+
* task's current execution when absent
|
|
93
|
+
* @returns The chunk, or `execution_not_found` when the task records none
|
|
50
94
|
*/
|
|
51
|
-
export declare function getTaskLogs(storage: StorageBackend, repoPath: string, workspace: string, taskName: string, stream: 'stdout' | 'stderr', offset: number, limit: number
|
|
95
|
+
export declare function getTaskLogs(storage: StorageBackend, repoPath: string, workspace: string, taskName: string, stream: 'stdout' | 'stderr', offset: number, limit: number, execution?: {
|
|
96
|
+
inputsHash: string;
|
|
97
|
+
executionId: string;
|
|
98
|
+
}): Promise<Response>;
|
|
52
99
|
/**
|
|
53
100
|
* Get dataflow execution state (for polling).
|
|
54
101
|
*
|
|
55
102
|
* Returns the state of the workspace's latest run, as the state store keeps
|
|
56
|
-
* it,
|
|
57
|
-
* process runs it, or the last to end.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
103
|
+
* it, and its events past the poll's cursor: the run in flight, whichever
|
|
104
|
+
* process runs it, or the last to end. While the run is in flight, it carries
|
|
105
|
+
* the tasks and units waiting for room and each split task's progress, which
|
|
106
|
+
* the orchestrator running it keeps in memory; and it carries the server's
|
|
107
|
+
* budget when it has one.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* The poll reads the run's summary, not its whole state, and reads its events
|
|
111
|
+
* only when the summary's last is past the cursor, so a poll that has every
|
|
112
|
+
* event, or asks for none (`limit` 0), reads none. It reads them from the
|
|
113
|
+
* run's events, which the store keeps apart from its state, a page of `limit`
|
|
114
|
+
* at a time until it has served `limit`, and at most eight pages, so a poll
|
|
115
|
+
* costs what it serves and the events between. The cursor is the stored
|
|
116
|
+
* sequence number of the last event the client has (`since`, 0 for none). The
|
|
117
|
+
* response's `nextSeq` is the cursor past what the poll went through: the API
|
|
118
|
+
* events it served and the events the API does not show between them, or
|
|
119
|
+
* `since` when it went through none. The waits and the split tasks' progress
|
|
120
|
+
* come from the orchestrator's memory, which holds none of a run another
|
|
121
|
+
* process or instance runs.
|
|
122
|
+
*
|
|
123
|
+
* A poll is served at most `limit` events, and never more than
|
|
124
|
+
* {@link DATAFLOW_POLL_EVENTS_MAX}, which is its limit when it names none, so
|
|
125
|
+
* an answer stays within what a host's response may hold however long the
|
|
126
|
+
* run. The response names the run (`runId`) and the sequence number of its
|
|
127
|
+
* last event (`lastSeq`) as its summary read them, and goes through no event
|
|
128
|
+
* past that one: a poll whose `nextSeq` is before `lastSeq` left events for
|
|
129
|
+
* the next.
|
|
61
130
|
*
|
|
62
131
|
* @param stateStore - The store the repository's runs keep their state in
|
|
63
132
|
* @param orchestrator - The orchestrator that runs the repository's dataflows
|
|
64
133
|
* @param repoPath - The repository's path
|
|
65
134
|
* @param workspace - The workspace
|
|
66
|
-
* @param options - The
|
|
135
|
+
* @param options - The poll's cursor, and the most events it is served
|
|
67
136
|
* @param budget - The server's budget, which its runners hold, if any
|
|
68
137
|
* @returns The execution state, or `execution_not_found`
|
|
69
138
|
*/
|
|
70
139
|
export declare function getDataflowExecution(stateStore: ExecutionStateStore, orchestrator: DataflowOrchestrator, repoPath: string, workspace: string, options?: {
|
|
71
|
-
|
|
140
|
+
since?: number;
|
|
72
141
|
limit?: number;
|
|
73
|
-
}, budget?:
|
|
142
|
+
}, budget?: RunnerBudget): Promise<Response>;
|
|
74
143
|
/**
|
|
75
144
|
* The budget a run of the dataflow gets: the server's, which it shares with
|
|
76
145
|
* everything else the server runs.
|
|
@@ -79,16 +148,18 @@ export declare function getDataflowExecution(stateStore: ExecutionStateStore, or
|
|
|
79
148
|
* @returns The budget with what its runners hold now, or `none` for a server
|
|
80
149
|
* whose runners hold none
|
|
81
150
|
*/
|
|
82
|
-
export declare function getDataflowBudget(budget:
|
|
151
|
+
export declare function getDataflowBudget(budget: RunnerBudget | undefined): Response;
|
|
83
152
|
/**
|
|
84
153
|
* Cancel a running dataflow execution: the workspace's latest run, when its
|
|
85
|
-
*
|
|
154
|
+
* summary says it is running.
|
|
86
155
|
*
|
|
87
156
|
* @param stateStore - The store the repository's runs keep their state in
|
|
88
157
|
* @param orchestrator - The orchestrator that runs the repository's dataflows
|
|
89
158
|
* @param repoPath - The repository's path
|
|
90
159
|
* @param workspace - The workspace
|
|
91
|
-
* @returns The response: null once the run is cancelled
|
|
160
|
+
* @returns The response: null once the run is cancelled; `dataflow_error`
|
|
161
|
+
* when no run is running, the request meeting the workspace's state rather
|
|
162
|
+
* than a fault of the server's; or why else it is not
|
|
92
163
|
*/
|
|
93
164
|
export declare function cancelDataflow(stateStore: ExecutionStateStore, orchestrator: DataflowOrchestrator, repoPath: string, workspace: string): Promise<Response>;
|
|
94
165
|
//# sourceMappingURL=dataflow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../../../src/handlers/dataflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../../../src/handlers/dataflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AA8FvH;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;2CACuC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAmDD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,oBAAoB,EAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,G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