@vol-a/client 0.0.0-stage → 1.2.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/LICENSE +21 -0
- package/README.md +284 -2
- package/dist/access-tokens.d.ts +21 -0
- package/dist/access-tokens.d.ts.map +1 -0
- package/dist/access-tokens.js +34 -0
- package/dist/access-tokens.js.map +1 -0
- package/dist/body.d.ts +40 -0
- package/dist/body.d.ts.map +1 -0
- package/dist/body.js +112 -0
- package/dist/body.js.map +1 -0
- package/dist/client.d.ts +185 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +311 -0
- package/dist/client.js.map +1 -0
- package/dist/env.d.ts +19 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +52 -0
- package/dist/env.js.map +1 -0
- package/dist/errors.d.ts +43 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +93 -0
- package/dist/errors.js.map +1 -0
- package/dist/files.d.ts +144 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +239 -0
- package/dist/files.js.map +1 -0
- package/dist/folders.d.ts +35 -0
- package/dist/folders.d.ts.map +1 -0
- package/dist/folders.js +62 -0
- package/dist/folders.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/keyrings.d.ts +44 -0
- package/dist/keyrings.d.ts.map +1 -0
- package/dist/keyrings.js +111 -0
- package/dist/keyrings.js.map +1 -0
- package/dist/management.d.ts +47 -0
- package/dist/management.d.ts.map +1 -0
- package/dist/management.js +65 -0
- package/dist/management.js.map +1 -0
- package/dist/shares.d.ts +87 -0
- package/dist/shares.d.ts.map +1 -0
- package/dist/shares.js +144 -0
- package/dist/shares.js.map +1 -0
- package/dist/uploads.d.ts +112 -0
- package/dist/uploads.d.ts.map +1 -0
- package/dist/uploads.js +290 -0
- package/dist/uploads.js.map +1 -0
- package/package.json +48 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Digital Cube
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,285 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vol-a/client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The JSVola SDK: a `fetch`-based client for the `@vol-a/server` API. Runs in **Node 24+ and in
|
|
4
|
+
browsers**, depends on `@vol-a/core` (the protocol: Zod schemas and types) and `@jsudc/core`
|
|
5
|
+
(the UDC client behind `vola.udc`) and on nothing else. `fetch` can be injected.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @vol-a/client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { VolaClient } from "@vol-a/client";
|
|
13
|
+
|
|
14
|
+
const vola = new VolaClient({
|
|
15
|
+
baseUrl: "https://files.example.com/vola", // the mount prefix included
|
|
16
|
+
apiKey: process.env.VOLA_API_KEY, // `Authorization: Bearer …`
|
|
17
|
+
userId: "user-42", // `X-User-Id`: attribution, and the keyring owner
|
|
18
|
+
// tenantSlug: "acme", // `X-Tenant-Slug`, for an ADMIN key
|
|
19
|
+
// fetch: myFetch, // tests, retries, a proxy
|
|
20
|
+
// validate: true, // check every answer against its @vol-a/core schema
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Every answer is typed by the `@vol-a/core` schema of its route (`FileInfo`, `FolderListing`,
|
|
25
|
+
`ShareCreated`, `KeyringStatus`, …). `validate: true` also parses it (a mismatch is a
|
|
26
|
+
`VolaError` with code `invalid_response`); off by default.
|
|
27
|
+
|
|
28
|
+
## Access tokens (a browser of a multi-user host)
|
|
29
|
+
|
|
30
|
+
A page should not hold an API key: a key reads every row of its tenant. The host's backend
|
|
31
|
+
issues an **access token** (`vola_at_…`) for the rows its user may read, and the page uses it
|
|
32
|
+
instead of `apiKey` (never both):
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
// backend, key with `access:grant`
|
|
36
|
+
const { id, token, expires_at } = await backend.accessTokens.create({
|
|
37
|
+
file_ids: [fileId], // or instance: { instance_type, instance_id }
|
|
38
|
+
principal: "user-42", // last_accessed_by and the audit actor
|
|
39
|
+
expires_in: 300, // default 300, at most VOLA_ACCESS_TOKEN_MAX_TTL_S
|
|
40
|
+
});
|
|
41
|
+
await backend.accessTokens.revoke(id); // early, idempotent
|
|
42
|
+
|
|
43
|
+
// page
|
|
44
|
+
const vola = new VolaClient({
|
|
45
|
+
baseUrl: "/vola",
|
|
46
|
+
accessToken: token,
|
|
47
|
+
getAccessToken: () => fetch("/api/vola-token").then((r) => r.text()),
|
|
48
|
+
});
|
|
49
|
+
await vola.files.download("mail", messageId, fileId); // and files.head, files.thumb
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
A token reads `files.download`, `files.head` and `files.thumb` of its rows and nothing else
|
|
53
|
+
(another row is `404`, any other route `401`). After a `401` on those calls the client asks
|
|
54
|
+
`getAccessToken` once (concurrent `401`s share the call) and repeats the request;
|
|
55
|
+
`getAccessToken` alone (no `accessToken`) is asked before the first request.
|
|
56
|
+
[docs/API.md](../../docs/API.md#access-tokens) has every rule.
|
|
57
|
+
|
|
58
|
+
## Errors
|
|
59
|
+
|
|
60
|
+
A non-2xx answer throws a `VolaError` carrying the server's envelope:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { VolaError, VolaLockedError, VolaIntegrityError } from "@vol-a/client";
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
await vola.files.info("tickets", id, fileId);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
if (error instanceof VolaLockedError) {
|
|
69
|
+
// 423 vola_locked: a keyring file without its unlock, a caller file without its key
|
|
70
|
+
} else if (error instanceof VolaIntegrityError) {
|
|
71
|
+
// 409 vola_integrity: a wrong key or secret, or damaged bytes
|
|
72
|
+
} else if (error instanceof VolaError) {
|
|
73
|
+
error.status; // 404
|
|
74
|
+
error.code; // "file_not_found" — snake_case, stable
|
|
75
|
+
error.message;
|
|
76
|
+
error.retryAfter; // seconds, when the server said so (429, lock-outs)
|
|
77
|
+
error.details; // the rest of the envelope: `required` scopes, `attempts`, `reason`…
|
|
78
|
+
error.requestId; // `X-Request-Id`
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Transport failures (no network, a refused connection) throw what `fetch` throws. An aborted
|
|
84
|
+
`signal` rejects with the `AbortError` of the platform.
|
|
85
|
+
|
|
86
|
+
No secret — the API key, an unlock token, a content key, a share secret, a PIN — is ever put
|
|
87
|
+
in a URL, an error message or a log line by the SDK.
|
|
88
|
+
|
|
89
|
+
## Files
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
// Upload: a File/Blob, a Uint8Array/Buffer, an ArrayBuffer, a ReadableStream or any async
|
|
93
|
+
// iterable of bytes (a Node Readable) — streams go up without being buffered.
|
|
94
|
+
const info = await vola.files.upload("tickets", ticketId, file, {
|
|
95
|
+
filename: "Izveštaj.pdf", // required unless the source is a File
|
|
96
|
+
contentType: "application/pdf",
|
|
97
|
+
folderPath: "docs/q4", // created when missing; or folderId
|
|
98
|
+
parentId: previousVersionId, // a new version
|
|
99
|
+
metadata: { year: 2026 },
|
|
100
|
+
encryption: "tenant", // "none" | "tenant" | "keyring" | "caller"
|
|
101
|
+
});
|
|
102
|
+
await vola.files.putSlug("user_profiles", userId, "avatar", blob, { filename: "me.png" });
|
|
103
|
+
|
|
104
|
+
// Download: a streaming Response, never a buffer.
|
|
105
|
+
const response = await vola.files.download("tickets", ticketId, info.id);
|
|
106
|
+
response.body; // ReadableStream
|
|
107
|
+
await response.blob();
|
|
108
|
+
const part = await vola.files.download("tickets", ticketId, info.id, {
|
|
109
|
+
range: { start: 0, end: 1023 }, // 206; also { suffix: 100 } or "bytes=0-99"
|
|
110
|
+
ifNoneMatch: '"<etag>"', // 304 resolves (empty body)
|
|
111
|
+
download: true, // Content-Disposition: attachment
|
|
112
|
+
});
|
|
113
|
+
await vola.files.head("tickets", ticketId, info.id);
|
|
114
|
+
await vola.files.byPath("tickets", ticketId, "docs/q4/Izveštaj.pdf");
|
|
115
|
+
await vola.files.bySlug("user_profiles", userId, "avatar");
|
|
116
|
+
await vola.files.public(fileId); // GET /public/:fileId, no key
|
|
117
|
+
|
|
118
|
+
// Metadata
|
|
119
|
+
const detail = await vola.files.info("tickets", ticketId, info.id, { ocr: "full" });
|
|
120
|
+
detail.processing_status; detail.ocr.text;
|
|
121
|
+
const page = await vola.files.list("tickets", ticketId, { limit: 50, cursor });
|
|
122
|
+
for await (const file of vola.files.iterate("tickets", ticketId)) { /* every page */ }
|
|
123
|
+
await vola.files.versions("tickets", ticketId, info.id);
|
|
124
|
+
await vola.files.patch("tickets", ticketId, info.id, { folder_path: "archive", is_public: true });
|
|
125
|
+
await vola.files.delete("tickets", ticketId, info.id); // soft
|
|
126
|
+
await vola.files.purge("tickets", ticketId, info.id); // rows and blobs
|
|
127
|
+
|
|
128
|
+
// Thumbnails: a 202 is NOT the image.
|
|
129
|
+
const thumb = await vola.files.thumb("tickets", ticketId, info.id, 256, { crop: "fit" });
|
|
130
|
+
if (thumb.status === "ready") img.src = URL.createObjectURL(thumb.blob);
|
|
131
|
+
else if (thumb.status === "generating") setTimeout(retry, 1000); // the worker is on it
|
|
132
|
+
else if (thumb.status === "failed") showPlaceholder(); // the file cannot be rendered
|
|
133
|
+
vola.files.thumbUrl("tickets", ticketId, info.id, 128); // a URL WITHOUT credentials
|
|
134
|
+
vola.files.downloadUrl("tickets", ticketId, info.id);
|
|
135
|
+
vola.files.publicUrl(fileId);
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Folders
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
await vola.folders.create("tickets", ticketId, "docs/q4"); // and missing parents
|
|
142
|
+
const { folder, subfolders, files } = await vola.folders.list("tickets", ticketId, "docs");
|
|
143
|
+
await vola.folders.rename("tickets", ticketId, "docs/q4", "q4-final");
|
|
144
|
+
await vola.folders.move("tickets", ticketId, "docs/q4-final", "archive");
|
|
145
|
+
await vola.folders.setDefaultKeyring("tickets", ticketId, "private", "me"); // encrypted folder
|
|
146
|
+
await vola.folders.delete("tickets", ticketId, "archive", { recursive: true });
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Resumable uploads
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
const { fileId } = await vola.uploads.resumable("tickets", ticketId, file, {
|
|
153
|
+
filename: "video.mp4",
|
|
154
|
+
chunkSize: 8 * 1024 * 1024,
|
|
155
|
+
onProgress: ({ uploaded, total }) => setPercent((100 * uploaded) / total),
|
|
156
|
+
signal: controller.signal,
|
|
157
|
+
// fingerprint: "my-key", store: myStore, folderPath, parentId, slug, metadata, encryption…
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
The source must be sliceable (a `File`/`Blob`, a `Uint8Array`/`Buffer`, an `ArrayBuffer`; in
|
|
162
|
+
Node, `openAsBlob(path)` from `node:fs`). The upload is remembered under a fingerprint
|
|
163
|
+
(`localStorage` in a browser, memory in Node, or any `{get, set, remove}` store you pass): an
|
|
164
|
+
abort or a network failure in the middle of a chunk rejects, and the next call with the same
|
|
165
|
+
source `HEAD`s the server for its offset and `PATCH`es from there. The fingerprint is forgotten
|
|
166
|
+
once the file exists. The steps are available on their own: `uploads.create`, `uploads.status`,
|
|
167
|
+
`uploads.append`, `uploads.abort`, `uploads.protocol`.
|
|
168
|
+
|
|
169
|
+
## Shares
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
const share = await vola.shares.create({
|
|
173
|
+
file_id: info.id, // or folder: { instance_type, instance_id, path }
|
|
174
|
+
password: "lozinka",
|
|
175
|
+
expires_at: "2026-12-31T00:00:00Z",
|
|
176
|
+
max_downloads: 10,
|
|
177
|
+
});
|
|
178
|
+
share.url; // https://files.example.com/vola/s/<token> — for an ENCRYPTED file: …#<secret>
|
|
179
|
+
await vola.shares.list({ fileId: info.id });
|
|
180
|
+
await vola.shares.get(share.id);
|
|
181
|
+
await vola.shares.revoke(share.id);
|
|
182
|
+
|
|
183
|
+
// The recipient's side: anonymous, the fragment becomes `X-Share-Secret`.
|
|
184
|
+
const response = await VolaClient.openShare(share.url, { password: "lozinka", range: { start: 0 } });
|
|
185
|
+
const listing = await vola.shares.listing(folderShareUrl); // a folder share
|
|
186
|
+
await vola.shares.open(folderShareUrl, { path: "sub/report.pdf" }); // a file inside it
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
A `caller`-encrypted file (Node only) can be shared with a grant the caller makes itself,
|
|
190
|
+
since the server never holds that file's key: `vola.shares.createCallerGrant(fileId, fileKey)`
|
|
191
|
+
wraps the file key under a fresh secret with WebCrypto and returns a `url` with the fragment.
|
|
192
|
+
|
|
193
|
+
## Keyrings (PIN) and unlock
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
const { recovery_key } = await vola.keyrings.setup("493817"); // show it ONCE
|
|
197
|
+
const { expires_in } = await vola.keyrings.unlock("493817"); // the token is kept in memory
|
|
198
|
+
await vola.files.upload("tickets", ticketId, file, { filename: "Tajna.pdf", encryption: "keyring" });
|
|
199
|
+
await vola.files.download("tickets", ticketId, fileId); // `X-Vola-Unlock` goes along
|
|
200
|
+
await vola.keyrings.status(); // locked, unlock_expires_in, attempts…
|
|
201
|
+
await vola.lock(); // DELETE the token, forget it
|
|
202
|
+
await vola.keyrings.changePin("493817", "271828"); // every token dies
|
|
203
|
+
await vola.keyrings.recover(recovery_key, "271828"); // a NEW recovery key comes back
|
|
204
|
+
await vola.keyrings.deletePreview();
|
|
205
|
+
await vola.keyrings.reset(); // the crypto-shred — re-authenticate first
|
|
206
|
+
|
|
207
|
+
const other = vola.withUnlock(token); // a second instance that sends a token you obtained elsewhere
|
|
208
|
+
const off = vola.lockOnUnload(); // browser: `navigator.sendBeacon` ends the unlock on pagehide
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The token lives in the instance's memory only; `lock()`, `changePin()`, `recover()` and
|
|
212
|
+
`reset()` clear it. A `423` — `VolaLockedError` — means the request needed an unlock it did not
|
|
213
|
+
have (or the token expired: the server's TTL slides with every request that carries it).
|
|
214
|
+
|
|
215
|
+
## Caller encryption (server-to-server)
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
const contentKey = crypto.getRandomValues(new Uint8Array(32)); // yours to keep; vola stores nothing
|
|
219
|
+
const info = await vola.files.upload("tickets", id, buffer, { filename: "x", encryption: "caller", contentKey });
|
|
220
|
+
await vola.files.download("tickets", id, info.id, { contentKey }); // on EVERY read
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
`contentKey` is refused in a browser (`caller_key_from_browser`, before any request): the
|
|
224
|
+
server rejects every request with an `Origin`, and the key would live in the page.
|
|
225
|
+
|
|
226
|
+
## Stats, keys, admin, lookups, UDC
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
await vola.stats.tenant({ recompute: true });
|
|
230
|
+
await vola.stats.instance("tickets", ticketId);
|
|
231
|
+
await vola.stats.storage();
|
|
232
|
+
await vola.instanceTypes();
|
|
233
|
+
await vola.lookups("sr"); // no key needed
|
|
234
|
+
await vola.live(); await vola.ready();
|
|
235
|
+
await vola.keys.create({ name: "ci", scopes: ["files:read"], env: "test" });
|
|
236
|
+
await vola.keys.list(); await vola.keys.revoke(id);
|
|
237
|
+
await vola.admin.transfer({ from_tenant: "a", to_tenant: "b", instances: [...], dry_run: true });
|
|
238
|
+
|
|
239
|
+
// The UDC collections (`files`, `menu`…) through @jsudc/core's UdcClient, same auth:
|
|
240
|
+
const { rows } = await vola.udc.list({ collection: "files", filter: { field: "kind", op: "eq", value: "image" } });
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
`vola.request(path, options)` and `vola.json(path, schema, options)` are the escape hatch every
|
|
244
|
+
group is built on — for a route this version of the SDK does not wrap yet.
|
|
245
|
+
|
|
246
|
+
## Migration from the vola-spp API
|
|
247
|
+
|
|
248
|
+
The API is new and not compatible with vola-spp (plan decision 1). Old route → SDK method:
|
|
249
|
+
|
|
250
|
+
| vola-spp | `@vol-a/client` |
|
|
251
|
+
|---|---|
|
|
252
|
+
| `POST /api/v1/files/{type}/id/{id}` (multipart, `folder_path` / `folder_id` / `parent_id`) | `vola.files.upload(type, id, source, { folderPath, folderId, parentId })` |
|
|
253
|
+
| `PUT /api/v1/files/{type}/id/{id}/slug/{slug}` | `vola.files.putSlug(type, id, slug, source)` |
|
|
254
|
+
| `GET\|HEAD …/id/{file_id}` (Range / 206) | `vola.files.download(type, id, fileId, { range })`, `vola.files.head(...)` |
|
|
255
|
+
| `GET …/path/{path}` | `vola.files.byPath(type, id, path)` |
|
|
256
|
+
| `GET …/slug/{slug}` | `vola.files.bySlug(type, id, slug)` |
|
|
257
|
+
| `GET …/info` | `vola.files.info(type, id, fileId)` |
|
|
258
|
+
| `GET …/thumb/{size}?crop=` (202 = placeholder) | `vola.files.thumb(type, id, fileId, size, { crop })` → `{status: "ready" \| "generating" \| "failed"}` |
|
|
259
|
+
| `PATCH …/visibility` | `vola.files.patch(type, id, fileId, { is_public, is_global_public })` |
|
|
260
|
+
| `PATCH …/move` | `vola.files.patch(type, id, fileId, { folder_path })` |
|
|
261
|
+
| `DELETE …` (soft) | `vola.files.delete(type, id, fileId)` |
|
|
262
|
+
| `DELETE …/purge` | `vola.files.purge(type, id, fileId)` |
|
|
263
|
+
| `POST /api/v1/folders/{type}/id/{id}/path/{path}` | `vola.folders.create(type, id, path)` |
|
|
264
|
+
| `GET …/folders/…/path/{path}` | `vola.folders.list(type, id, path)` |
|
|
265
|
+
| `PATCH …/folders/…/path/{path}` | `vola.folders.rename(...)`, `vola.folders.move(...)`, `vola.folders.patch(...)` |
|
|
266
|
+
| `DELETE …/folders/…/path/{path}` | `vola.folders.delete(type, id, path, { recursive })` |
|
|
267
|
+
| `POST /api/v1/share` | `vola.shares.create({ file_id \| folder, password, expires_at, max_downloads })` |
|
|
268
|
+
| `DELETE /api/v1/share/id/{id}` | `vola.shares.revoke(id)` |
|
|
269
|
+
| `GET\|HEAD /share/token/{t}[/download\|/path/{p}]` | `VolaClient.openShare(url, { password, path, download })`, `vola.shares.listing(url)` |
|
|
270
|
+
| `GET\|HEAD /public/file/{id}` | `vola.files.public(fileId)`, `vola.files.publicUrl(fileId)` |
|
|
271
|
+
| `GET /api/v1/stats/tenant` | `vola.stats.tenant()` |
|
|
272
|
+
| `GET /api/v1/stats/instance/{type}/id/{id}` | `vola.stats.instance(type, id)` |
|
|
273
|
+
| `GET /api/v1/stats/storage` | `vola.stats.storage()` |
|
|
274
|
+
| `GET /api/v1/instance-types` | `vola.instanceTypes()` |
|
|
275
|
+
| `POST /api/v1/keys` | `vola.keys.create(...)` (and `list`, `revoke`) |
|
|
276
|
+
| `POST /api/v1/admin/transfer` | `vola.admin.transfer(...)` |
|
|
277
|
+
| `POST /udc/list\|describe\|read` | `vola.udc.list(...)`, `vola.udc.describe(...)`, `vola.udc.read(...)` |
|
|
278
|
+
| `GET /api/lookups` | `vola.lookups(locale)` |
|
|
279
|
+
| `X-API-Key` header | `apiKey` option (sent as `Authorization: Bearer`); `X-Tenant-Slug` → `tenantSlug` |
|
|
280
|
+
| — (new) | `vola.uploads.resumable(...)`, `vola.keyrings.*`, `encryption` / `contentKey` on uploads, share grants |
|
|
281
|
+
|
|
282
|
+
What changed beyond the names: the id of an instance is in the path (`/files/:type/:id`, no
|
|
283
|
+
`/id/` segment); visibility and move are one `PATCH` with a JSON body; a share is created with
|
|
284
|
+
a JSON body and followed at `/s/<token>`; the error envelope is `{ error: { code, message } }`
|
|
285
|
+
with stable snake_case codes.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type AccessTokenCreate, type AccessTokenCreated } from "@vol-a/core";
|
|
2
|
+
import type { CallOptions, VolaClient } from "./client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Access tokens (scope `access:grant`) — for the HOST's backend, with its API key: issue a
|
|
5
|
+
* short-lived, read-only token for the rows (or the instance) its user may read, hand it to
|
|
6
|
+
* the browser, revoke it early when needed. The browser builds a `VolaClient` with
|
|
7
|
+
* `accessToken` (and `getAccessToken` to refresh it).
|
|
8
|
+
*/
|
|
9
|
+
export declare class AccessTokensApi {
|
|
10
|
+
private readonly client;
|
|
11
|
+
constructor(client: VolaClient);
|
|
12
|
+
/**
|
|
13
|
+
* `POST /access-tokens {file_ids | instance, principal, expires_in?}` → `201`: `{id, token,
|
|
14
|
+
* expires_at}`, the token in plain text this once. `404 file_not_found` when any file is
|
|
15
|
+
* not a live row of the tenant; `422` for `expires_in` above the server's maximum.
|
|
16
|
+
*/
|
|
17
|
+
create(body: AccessTokenCreate, options?: CallOptions): Promise<AccessTokenCreated>;
|
|
18
|
+
/** `DELETE /access-tokens/:id` → `204`: the token is `401` from now on. Idempotent. */
|
|
19
|
+
revoke(id: string, options?: CallOptions): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=access-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-tokens.d.ts","sourceRoot":"","sources":["../src/access-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EAExB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;GAKG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAE/C;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQvF,uFAAuF;IACjF,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAOnE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AccessTokenCreatedSchema, } from "@vol-a/core";
|
|
2
|
+
/**
|
|
3
|
+
* Access tokens (scope `access:grant`) — for the HOST's backend, with its API key: issue a
|
|
4
|
+
* short-lived, read-only token for the rows (or the instance) its user may read, hand it to
|
|
5
|
+
* the browser, revoke it early when needed. The browser builds a `VolaClient` with
|
|
6
|
+
* `accessToken` (and `getAccessToken` to refresh it).
|
|
7
|
+
*/
|
|
8
|
+
export class AccessTokensApi {
|
|
9
|
+
client;
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `POST /access-tokens {file_ids | instance, principal, expires_in?}` → `201`: `{id, token,
|
|
15
|
+
* expires_at}`, the token in plain text this once. `404 file_not_found` when any file is
|
|
16
|
+
* not a live row of the tenant; `422` for `expires_in` above the server's maximum.
|
|
17
|
+
*/
|
|
18
|
+
create(body, options = {}) {
|
|
19
|
+
return this.client.json("/access-tokens", AccessTokenCreatedSchema, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
json: body,
|
|
22
|
+
...options,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** `DELETE /access-tokens/:id` → `204`: the token is `401` from now on. Idempotent. */
|
|
26
|
+
async revoke(id, options = {}) {
|
|
27
|
+
const response = await this.client.request(`/access-tokens/${encodeURIComponent(id)}`, {
|
|
28
|
+
method: "DELETE",
|
|
29
|
+
...options,
|
|
30
|
+
});
|
|
31
|
+
await response.body?.cancel().catch(() => undefined);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=access-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-tokens.js","sourceRoot":"","sources":["../src/access-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAGrB;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;;;OAIG;IACH,MAAM,CAAC,IAAuB,EAAE,UAAuB,EAAE;QACvD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,wBAAwB,EAAE;YAClE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;YACV,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED,uFAAuF;IACvF,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,UAAuB,EAAE;QAChD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE;YACrF,MAAM,EAAE,QAAQ;YAChB,GAAG,OAAO;SACX,CAAC,CAAC;QACH,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF"}
|
package/dist/body.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Bytes that are all in memory (or in a `Blob`): they can be sized and sliced, so they can be resumed. */
|
|
2
|
+
export type ByteSource = Blob | Uint8Array | ArrayBuffer;
|
|
3
|
+
/** Bytes that arrive over time: a web `ReadableStream`, or anything async-iterable (a Node `Readable`, a generator). */
|
|
4
|
+
export type StreamSource = ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;
|
|
5
|
+
/** What an upload accepts. A Node `Buffer` is a `Uint8Array`; a `File` is a `Blob` that also carries its name. */
|
|
6
|
+
export type UploadSource = ByteSource | StreamSource;
|
|
7
|
+
export declare function isBlob(value: unknown): value is Blob;
|
|
8
|
+
export declare function isStreamSource(value: unknown): value is StreamSource;
|
|
9
|
+
/** The byte length of an in-memory source. */
|
|
10
|
+
export declare function sizeOf(source: ByteSource): number;
|
|
11
|
+
/** `source[start, end)` as something `fetch` sends as a body. */
|
|
12
|
+
export declare function sliceOf(source: ByteSource, start: number, end: number): Blob | Uint8Array;
|
|
13
|
+
/** An in-memory source as a `Blob` of `type`. */
|
|
14
|
+
export declare function toBlob(source: ByteSource, type?: string): Blob;
|
|
15
|
+
/** The name a `File` carries, when the source is one. */
|
|
16
|
+
export declare function nameOf(source: UploadSource): string | undefined;
|
|
17
|
+
/** The MIME type a `Blob` carries, when it has one. */
|
|
18
|
+
export declare function typeOf(source: UploadSource): string | undefined;
|
|
19
|
+
export interface MultipartFile {
|
|
20
|
+
field: string;
|
|
21
|
+
filename: string;
|
|
22
|
+
contentType: string;
|
|
23
|
+
source: UploadSource;
|
|
24
|
+
}
|
|
25
|
+
export interface MultipartBody {
|
|
26
|
+
body: BodyInit;
|
|
27
|
+
/** Set when the body is a stream the SDK framed itself; `undefined` lets `fetch` frame the `FormData`. */
|
|
28
|
+
contentType: string | undefined;
|
|
29
|
+
/** `true`: the body is a `ReadableStream` (the request needs `duplex: "half"`). */
|
|
30
|
+
streaming: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The `multipart/form-data` body of an upload: the text `fields` FIRST, in order (the server
|
|
34
|
+
* reads the encryption mode and the folder before the file part starts), then the one file
|
|
35
|
+
* part. An in-memory source becomes a `FormData` (the platform frames it); a stream is framed
|
|
36
|
+
* here and sent as a `ReadableStream`, so a file of any size goes up without being read into
|
|
37
|
+
* memory (Node; in a browser, give a `File` or a `Blob`).
|
|
38
|
+
*/
|
|
39
|
+
export declare function multipartBody(fields: [string, string][], file: MultipartFile): MultipartBody;
|
|
40
|
+
//# sourceMappingURL=body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../src/body.ts"],"names":[],"mappings":"AAEA,2GAA2G;AAC3G,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,UAAU,GAAG,WAAW,CAAC;AACzD,wHAAwH;AACxH,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;AAClF,kHAAkH;AAClH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAErD,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAUpE;AAED,8CAA8C;AAC9C,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAGjD;AAED,iEAAiE;AACjE,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,UAAU,CAIzF;AAED,iDAAiD;AACjD,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAM9D;AAED,yDAAyD;AACzD,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAG/D;AAED,uDAAuD;AACvD,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAE/D;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,0GAA0G;IAC1G,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,mFAAmF;IACnF,SAAS,EAAE,OAAO,CAAC;CACpB;AAwBD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,aAAa,GAAG,aAAa,CAiC5F"}
|
package/dist/body.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { randomHex } from "./env.js";
|
|
2
|
+
export function isBlob(value) {
|
|
3
|
+
return typeof Blob !== "undefined" && value instanceof Blob;
|
|
4
|
+
}
|
|
5
|
+
export function isStreamSource(value) {
|
|
6
|
+
if (typeof ReadableStream !== "undefined" && value instanceof ReadableStream)
|
|
7
|
+
return true;
|
|
8
|
+
return (typeof value === "object" &&
|
|
9
|
+
value !== null &&
|
|
10
|
+
!isBlob(value) &&
|
|
11
|
+
!(value instanceof Uint8Array) &&
|
|
12
|
+
!(value instanceof ArrayBuffer) &&
|
|
13
|
+
Symbol.asyncIterator in value);
|
|
14
|
+
}
|
|
15
|
+
/** The byte length of an in-memory source. */
|
|
16
|
+
export function sizeOf(source) {
|
|
17
|
+
if (isBlob(source))
|
|
18
|
+
return source.size;
|
|
19
|
+
return source.byteLength;
|
|
20
|
+
}
|
|
21
|
+
/** `source[start, end)` as something `fetch` sends as a body. */
|
|
22
|
+
export function sliceOf(source, start, end) {
|
|
23
|
+
if (isBlob(source))
|
|
24
|
+
return source.slice(start, end);
|
|
25
|
+
if (source instanceof ArrayBuffer)
|
|
26
|
+
return new Uint8Array(source, start, end - start);
|
|
27
|
+
return source.subarray(start, end);
|
|
28
|
+
}
|
|
29
|
+
/** An in-memory source as a `Blob` of `type`. */
|
|
30
|
+
export function toBlob(source, type) {
|
|
31
|
+
if (isBlob(source))
|
|
32
|
+
return type && source.type !== type ? source.slice(0, source.size, type) : source;
|
|
33
|
+
// A fresh copy: `Blob` takes the view as is, and a `Buffer` from a pool would drag its neighbours in.
|
|
34
|
+
const bytes = source instanceof ArrayBuffer ? new Uint8Array(source) : source;
|
|
35
|
+
return new Blob([bytes.slice()], type ? { type } : undefined);
|
|
36
|
+
}
|
|
37
|
+
/** The name a `File` carries, when the source is one. */
|
|
38
|
+
export function nameOf(source) {
|
|
39
|
+
if (isBlob(source) && "name" in source && typeof source.name === "string")
|
|
40
|
+
return source.name;
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
/** The MIME type a `Blob` carries, when it has one. */
|
|
44
|
+
export function typeOf(source) {
|
|
45
|
+
return isBlob(source) && source.type !== "" ? source.type : undefined;
|
|
46
|
+
}
|
|
47
|
+
/** A `"` or a line break in a filename would end the header early; percent-encode them. */
|
|
48
|
+
function quote(value) {
|
|
49
|
+
return value.replace(/["\r\n]/g, (c) => `%${c.charCodeAt(0).toString(16).padStart(2, "0")}`);
|
|
50
|
+
}
|
|
51
|
+
async function* chunksOf(source) {
|
|
52
|
+
if (typeof ReadableStream !== "undefined" && source instanceof ReadableStream) {
|
|
53
|
+
const reader = source.getReader();
|
|
54
|
+
try {
|
|
55
|
+
while (true) {
|
|
56
|
+
const { done, value } = await reader.read();
|
|
57
|
+
if (done)
|
|
58
|
+
return;
|
|
59
|
+
if (value)
|
|
60
|
+
yield value;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
reader.releaseLock();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
for await (const chunk of source)
|
|
69
|
+
yield chunk;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The `multipart/form-data` body of an upload: the text `fields` FIRST, in order (the server
|
|
74
|
+
* reads the encryption mode and the folder before the file part starts), then the one file
|
|
75
|
+
* part. An in-memory source becomes a `FormData` (the platform frames it); a stream is framed
|
|
76
|
+
* here and sent as a `ReadableStream`, so a file of any size goes up without being read into
|
|
77
|
+
* memory (Node; in a browser, give a `File` or a `Blob`).
|
|
78
|
+
*/
|
|
79
|
+
export function multipartBody(fields, file) {
|
|
80
|
+
if (!isStreamSource(file.source)) {
|
|
81
|
+
const form = new FormData();
|
|
82
|
+
for (const [name, value] of fields)
|
|
83
|
+
form.append(name, value);
|
|
84
|
+
form.append(file.field, toBlob(file.source, file.contentType), file.filename);
|
|
85
|
+
return { body: form, contentType: undefined, streaming: false };
|
|
86
|
+
}
|
|
87
|
+
const boundary = `----VolaFormBoundary${randomHex(12)}`;
|
|
88
|
+
const encoder = new TextEncoder();
|
|
89
|
+
const head = fields
|
|
90
|
+
.map(([name, value]) => `--${boundary}\r\nContent-Disposition: form-data; name="${quote(name)}"\r\n\r\n${value}\r\n`)
|
|
91
|
+
.join("") +
|
|
92
|
+
`--${boundary}\r\nContent-Disposition: form-data; name="${quote(file.field)}"; filename="${quote(file.filename)}"\r\nContent-Type: ${file.contentType}\r\n\r\n`;
|
|
93
|
+
const tail = `\r\n--${boundary}--\r\n`;
|
|
94
|
+
const source = file.source;
|
|
95
|
+
const body = new ReadableStream({
|
|
96
|
+
async start(controller) {
|
|
97
|
+
controller.enqueue(encoder.encode(head));
|
|
98
|
+
try {
|
|
99
|
+
for await (const chunk of chunksOf(source))
|
|
100
|
+
controller.enqueue(chunk);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
controller.error(error);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
controller.enqueue(encoder.encode(tail));
|
|
107
|
+
controller.close();
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
return { body, contentType: `multipart/form-data; boundary=${boundary}`, streaming: true };
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=body.js.map
|
package/dist/body.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../src/body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AASrC,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,OAAO,IAAI,KAAK,WAAW,IAAI,KAAK,YAAY,IAAI,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,OAAO,cAAc,KAAK,WAAW,IAAI,KAAK,YAAY,cAAc;QAAE,OAAO,IAAI,CAAC;IAC1F,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,MAAM,CAAC,KAAK,CAAC;QACd,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC;QAC9B,CAAC,CAAC,KAAK,YAAY,WAAW,CAAC;QAC/B,MAAM,CAAC,aAAa,IAAI,KAAK,CAC9B,CAAC;AACJ,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,MAAM,CAAC,MAAkB;IACvC,IAAI,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IACvC,OAAO,MAAM,CAAC,UAAU,CAAC;AAC3B,CAAC;AAED,iEAAiE;AACjE,MAAM,U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