esoul-sdk 0.21.1 → 0.22.0
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 +48 -0
- package/README.md +2 -1
- package/api-reference.md +559 -16
- package/dist/failed-requests.d.ts +2 -0
- package/dist/failed-requests.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/manifest.d.ts +49 -16
- package/dist/manifest.js +16 -0
- package/dist/react.d.ts +20 -0
- package/dist/react.js +9 -0
- package/dist/server.d.ts +73 -3
- package/dist/testing/files.d.ts +44 -1
- package/dist/testing/files.js +277 -19
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/transfer-world.d.ts +213 -0
- package/dist/testing/transfer-world.js +593 -0
- package/dist/transfer-core.d.ts +397 -0
- package/dist/transfer-core.js +844 -0
- package/dist/transfers.d.ts +192 -0
- package/dist/transfers.js +172 -0
- package/dist/types.d.ts +7 -0
- package/docs/02-manifest.md +1 -0
- package/docs/07-background-tasks.md +3 -0
- package/docs/09-files.md +110 -8
- package/llms-full.txt +116 -9
- package/package.json +1 -1
- package/schemas/plugin.schema.json +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
Releases before 0.20.0 are recorded in the repository history only.
|
|
4
4
|
|
|
5
|
+
## 0.22.0
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **File transfers: a LIST of files into a workspace folder, as one durable platform job.**
|
|
10
|
+
`files.transfer({ requestKey?, title?, to: { sourceId: "workspace", path }, items, onConflict?, dedupe? })`
|
|
11
|
+
→ `Transfer` (`snapshot()`, `wait({ timeoutMs })`, `retry({ items? })`, `cancel()`); `getTransfer(id)`,
|
|
12
|
+
`listTransfers()`. Items are `{ from }` (any readable mount, by ref or address), `{ producer, key }`
|
|
13
|
+
(the app's own bytes), or `{ staged, name }`; each takes an optional `name` and `subPath`. At most 200
|
|
14
|
+
items and 100 MB a file. The person sees it in the tasks pane ("Saving 37 files to Mail/Quotes —
|
|
15
|
+
12/37 · 140 MB of 380 MB") with Stop and Retry. **Retry is clean**: it re-runs only failed and
|
|
16
|
+
stopped items, pressing it twice is one retry, and a crash at any step followed by a retry leaves
|
|
17
|
+
exactly what one clean run leaves — no stray bytes, no second file, no second `file_added`, no
|
|
18
|
+
empty folder the transfer made. Consent is checked when asked (the whole request refused, naming
|
|
19
|
+
the item) and again as each item runs. See `docs/09-files.md` → "Moving a list of files".
|
|
20
|
+
- **Producers: `fileProducers` in `plugin.json` + `pluginServer.fileProducers[key]`** (`identity(key)`,
|
|
21
|
+
`open(ctx, key)`, `describe?`) — the app's own bytes (a mail attachment) as a transfer source,
|
|
22
|
+
opened by the platform inside the item's step, as the app; the bytes never cross an op body.
|
|
23
|
+
Types: `PluginFileProducer`. Schema: `fileProducers: [{ key, label }]`.
|
|
24
|
+
- **Addresses: `"<sourceId>:/<path>"`** (`"workspace:/Mail/Quotes/a.pdf"`, `"google-drive:/Reports/q3.pdf"`).
|
|
25
|
+
`read`, `readMany` and the new `stat(addr)` take a ref or an address. `parseFileAddress` (pure).
|
|
26
|
+
- **`files.save(addr, bytes, { onConflict?, key?, contentType? })`** — one file to a path, folders
|
|
27
|
+
made. **`files.stage({ name, bytes })`** — bytes handed over ahead of a transfer (24 h).
|
|
28
|
+
- **`ctx.files` on a task context** — the same `FilesApi` as `filesForOp(ctx)` (app.tsx cannot import
|
|
29
|
+
`esoul-sdk/server`).
|
|
30
|
+
- **`useTransfer(transferId)`** in `esoul-sdk/react` — `{ transfer, loading, error, retry(), cancel() }`,
|
|
31
|
+
polled while it moves and on the platform's nudge; a failed press is named on the failed-request
|
|
32
|
+
banner with Try again. Works in a Forge preview.
|
|
33
|
+
- **Testing: `memoryFiles` runs transfers and saves on the platform's own protocol** (the same code):
|
|
34
|
+
`files.producers({...})`, `files.failItem(index, error, { times })`, `files.crashAt(point, { index })`,
|
|
35
|
+
`transfer.wait()` runs the items in the test, and `files.residue()` →
|
|
36
|
+
`{ orphanBlobs, duplicateFiles, extraEvents, emptyCreatedFolders }` — assert it is empty after a retry.
|
|
37
|
+
- Pure helpers and types exported from `esoul-sdk`: `TransferRequest`, `TransferSnapshot`,
|
|
38
|
+
`TransferStatus`, `describeTransferProgress`, `deriveTransferCounts`, `settledTransferStatus`,
|
|
39
|
+
`pickFreeFileName`, `normaliseTransferPath`, `validateTransferName`, `TRANSFER_*` caps.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- **`saveWorkspaceFile` and `importToWorkspace` are idempotent and crash-safe.** They take `key?`
|
|
44
|
+
and `onConflict?` (`saveWorkspaceFile`). The same key — or, without one, the same bytes and name —
|
|
45
|
+
into the same folder is the same file (`deduped: true`); a different file with a name already
|
|
46
|
+
there is saved as `"name (2).ext"` (`renamedFrom`) unless `onConflict` is `"skip"` or `"fail"`.
|
|
47
|
+
The call throws when its `workspace/file_added` could not be appended (it used to succeed
|
|
48
|
+
silently with no event), and indexing is started before it returns.
|
|
49
|
+
- In a Forge box, a save or stage through the files door is refused past 3 MB with a sentence
|
|
50
|
+
(it was an opaque 413 past ≈3.3 MB).
|
|
51
|
+
- Workspace folders in a path walk match case-insensitively, the way `folderPath` makes them.
|
|
52
|
+
|
|
5
53
|
## 0.21.1
|
|
6
54
|
|
|
7
55
|
### Fixed
|
package/README.md
CHANGED
|
@@ -499,7 +499,7 @@ Platform columns on every table: `id`, `workspaceId`, `nodeId`, `ownerId`, `crea
|
|
|
499
499
|
| `listAppRoles(ctx)` | `{ people, roles, custom, envelope }`. |
|
|
500
500
|
| `defineAppRole(ctx, definition)`, `removeAppRole(ctx, name)` | The owner composes or removes a role inside `roles.custom`. |
|
|
501
501
|
| `getPluginConnectionCredentials(ctx)` | The credentials of the instance's bound connection. |
|
|
502
|
-
| `pluginFiles(ctx)`, `filesForOp(ctx)` | Workspace files and file sources from server code. |
|
|
502
|
+
| `pluginFiles(ctx)`, `filesForOp(ctx)` | Workspace files and file sources from server code: read by ref or address (`"workspace:/Mail/a.pdf"`), `save` to a path, and `transfer` a list of files into a folder with platform progress, Stop and a clean Retry (docs/09). |
|
|
503
503
|
|
|
504
504
|
### `esoul-sdk/react`
|
|
505
505
|
|
|
@@ -512,6 +512,7 @@ Platform columns on every table: `id`, `workspaceId`, `nodeId`, `ownerId`, `crea
|
|
|
512
512
|
| `usePluginRealtime({ channel, workspaceId, nodeId, topics, enabled? })` | Subscribes to the instance's channel. Returns `{ data, latestData, error, state }`. |
|
|
513
513
|
| `useWorkspaceTools(identity)` | Lists and calls tools of other applications from the UI, subject to `workspaceTools`. |
|
|
514
514
|
| `usePluginWorkspaceFiles()`, `usePluginFileUpload()`, `useFileSources()`, `useFileSourceEntries()` | Workspace files, upload, and file sources (workspace, Google Drive, providers). |
|
|
515
|
+
| `useTransfer(transferId)` | A file transfer's progress, with `retry()` and `cancel()`. |
|
|
515
516
|
|
|
516
517
|
### `esoul-sdk/testing`
|
|
517
518
|
|