@omelhorsite/sdk 0.1.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.
Files changed (36) hide show
  1. package/README.md +321 -0
  2. package/dist/index.js +11589 -0
  3. package/dist/types/auth/device.d.ts +156 -0
  4. package/dist/types/auth/index.d.ts +127 -0
  5. package/dist/types/auth/tokens.d.ts +356 -0
  6. package/dist/types/client.d.ts +133 -0
  7. package/dist/types/errors.d.ts +202 -0
  8. package/dist/types/http.d.ts +204 -0
  9. package/dist/types/index.d.ts +33 -0
  10. package/dist/types/local/index.d.ts +42 -0
  11. package/dist/types/local/password.d.ts +169 -0
  12. package/dist/types/local/qr.d.ts +127 -0
  13. package/dist/types/local/wordlist.d.ts +26 -0
  14. package/dist/types/resources/account.d.ts +296 -0
  15. package/dist/types/resources/chests.d.ts +194 -0
  16. package/dist/types/resources/dynamicQrs.d.ts +172 -0
  17. package/dist/types/resources/forms.d.ts +331 -0
  18. package/dist/types/resources/index.d.ts +30 -0
  19. package/dist/types/resources/ipLookup.d.ts +63 -0
  20. package/dist/types/resources/jobs.d.ts +233 -0
  21. package/dist/types/resources/linkTrees.d.ts +249 -0
  22. package/dist/types/resources/notepads.d.ts +96 -0
  23. package/dist/types/resources/shortLinks.d.ts +248 -0
  24. package/dist/types/resources/storage/upload.d.ts +459 -0
  25. package/dist/types/resources/storage.d.ts +527 -0
  26. package/dist/types/resources/tickets.d.ts +236 -0
  27. package/dist/types/resources/tools/backgroundRemoval.d.ts +99 -0
  28. package/dist/types/resources/tools/captions.d.ts +318 -0
  29. package/dist/types/resources/tools/downloader.d.ts +397 -0
  30. package/dist/types/resources/tools/index.d.ts +215 -0
  31. package/dist/types/resources/tools/jumpstyle.d.ts +194 -0
  32. package/dist/types/resources/tools/transcription.d.ts +178 -0
  33. package/dist/types/resources/tools/upscale.d.ts +94 -0
  34. package/dist/types/resources/tools/vocalSeparation.d.ts +183 -0
  35. package/dist/types/types.d.ts +245 -0
  36. package/package.json +37 -0
@@ -0,0 +1,527 @@
1
+ /**
2
+ * The `storage` namespace: the virtual filesystem.
3
+ *
4
+ * A node is a file or a directory, identified by an opaque id. Since the ltree
5
+ * migration the id IS the address: there is no `path` column any more, and
6
+ * navigation goes parent id -> children, with `ancestors()` for a breadcrumb.
7
+ * Never build or parse a path string.
8
+ *
9
+ * {@link StorageNamespace.resolvePath} exists for humans typing `docs/a.pdf`,
10
+ * and it is exactly what it looks like: one request per segment, walking
11
+ * `name` + `parent_id` down the filtered index. It memoises what it learns per
12
+ * client instance so a CLI session does not re-walk the same prefix, but the
13
+ * cheap call is always the one that already has an id.
14
+ *
15
+ * Uploads do NOT stream through this namespace. Bytes go straight to object
16
+ * storage with a presigned URL; Rails only mints the plan and, at the end,
17
+ * binds the blob. That whole dance lives in `storage/upload.ts` and is reached
18
+ * through {@link StorageNamespace.upload}.
19
+ *
20
+ * Four throttles bound what this namespace can do, and they are far tighter
21
+ * than the API's general ceiling:
22
+ *
23
+ * - `fs_upload` - 300/min for the whole upload control plane. Paced by
24
+ * {@link UploadManager}.
25
+ * - `fs_bulk_job` - TWELVE a minute for `copy`, `createDirectories`,
26
+ * `emptyTrash` and `trash` together. Paced by {@link StorageNamespace.bulkGate}.
27
+ * - the general 600/min for everything else.
28
+ * - the direct PUTs at the object store, which rack-attack never sees at all.
29
+ */
30
+ import { Resource, type ApiClient } from "../http";
31
+ import type { BaseRecord, FileInput, FileOutput, Id, OperationOptions, Paginated, PageParams, RequestOptions } from "../types";
32
+ import type { User } from "./account";
33
+ import { StorageRateGate, UploadManager } from "./storage/upload";
34
+ /** What a node is. */
35
+ export type FsNodeKind = "file" | "directory";
36
+ /**
37
+ * A node in the virtual filesystem.
38
+ *
39
+ * These are exactly the fields the server's blueprint emits - `id`,
40
+ * `created_at`, `updated_at`, `name`, `parent_id`, `kind`, `size`, `max_size` -
41
+ * and the `:extended` view adds nothing. In particular there is no
42
+ * `content_type` and no `path`: the type of a file is decided from its name at
43
+ * download time, and the path is gone.
44
+ */
45
+ export interface FsNode extends BaseRecord {
46
+ readonly name: string;
47
+ readonly kind: FsNodeKind;
48
+ /** `null` only for a root (home, trash, vault). */
49
+ readonly parent_id: Id | null;
50
+ /** Bytes. For a directory, the recursive total. */
51
+ readonly size: number;
52
+ /** Quota ceiling. Set on roots only; `null` means no ceiling. */
53
+ readonly max_size: number | null;
54
+ }
55
+ /** One link in a breadcrumb chain. */
56
+ export interface FsBreadcrumb {
57
+ readonly id: Id;
58
+ readonly name: string;
59
+ readonly kind: FsNodeKind;
60
+ }
61
+ /** `GET /fs_nodes/roots` - the ids a client needs to bootstrap navigation. */
62
+ export interface FsRoots {
63
+ readonly home: Id | null;
64
+ readonly trash: Id | null;
65
+ /** `null` until the encrypted vault is used for the first time. */
66
+ readonly vault: Id | null;
67
+ }
68
+ /**
69
+ * A bulk operation the server runs in the background.
70
+ *
71
+ * `copy`, `createDirectories`, `trash` and `emptyTrash` all answer with nothing
72
+ * but a job id: the work happens in a worker and the response says only that it
73
+ * was enqueued. Poll it with `oms.jobs.wait(jobId)`; this namespace has no
74
+ * access to the jobs namespace and deliberately does not grow a second polling
75
+ * loop.
76
+ */
77
+ export interface FsBulkJob {
78
+ /** Feed this to `oms.jobs.get` / `oms.jobs.wait`. */
79
+ readonly jobId: Id;
80
+ }
81
+ /**
82
+ * A response body streamed rather than buffered.
83
+ *
84
+ * The zip endpoint has no `Content-Length` (it is generated as it is sent) and
85
+ * a stored file can be larger than any sane heap, so both are handed over as a
86
+ * stream. The caller owns it and must consume or cancel it.
87
+ */
88
+ export interface FsStream {
89
+ readonly stream: ReadableStream<Uint8Array>;
90
+ /** Filename the server suggested, from `Content-Disposition`. */
91
+ readonly filename: string | undefined;
92
+ readonly contentType: string | undefined;
93
+ /** Byte length when the server sent one. Always `undefined` for a zip. */
94
+ readonly size: number | undefined;
95
+ }
96
+ /** Filters for {@link StorageNamespace.list}. */
97
+ export interface ListFsNodesParams extends PageParams {
98
+ /**
99
+ * Directory to list. `null` lists the caller's ROOT nodes (home, trash,
100
+ * vault), which the server selects through its `\b` null sentinel.
101
+ */
102
+ readonly parentId: Id | null;
103
+ /**
104
+ * Include nodes whose bytes never landed. Off by default, because a
105
+ * half-finished upload is not something a user wants to see - and because a
106
+ * node's absence from a normal listing is the only proof its blob is bound.
107
+ */
108
+ readonly includePending?: boolean;
109
+ /**
110
+ * Also return the parent itself, so one call gets both the folder's metadata
111
+ * and its children. It occupies a slot on the page like any other row.
112
+ */
113
+ readonly includeSelf?: boolean;
114
+ }
115
+ /** Arguments for creating directories. */
116
+ export interface CreateDirectoriesInput {
117
+ /** Directory to create under. */
118
+ readonly parentId: Id;
119
+ /**
120
+ * Relative paths, e.g. `["fotos", "fotos/2024"]`. Intermediate levels are
121
+ * created as needed and an existing level is reused, so this is idempotent.
122
+ * A `..` segment is rejected by the server.
123
+ */
124
+ readonly paths: string[];
125
+ }
126
+ /** Arguments for copying nodes. */
127
+ export interface CopyFsNodesInput {
128
+ readonly ids: Id[];
129
+ readonly newParentId: Id;
130
+ }
131
+ /**
132
+ * A sharing grant on a node.
133
+ *
134
+ * There is no expiry and no read/write enum: access is the single `editable`
135
+ * boolean, and a grant lives until someone deletes it.
136
+ */
137
+ export interface FsGrant extends BaseRecord {
138
+ readonly fs_node_id: Id;
139
+ /** Who issued it. Always a real user. */
140
+ readonly grantor_id: Id;
141
+ /** Grantee, or `null` for a public link grant that anyone with the URL may read. */
142
+ readonly grantee_id: Id | null;
143
+ /** Write access. Always `false` on a public grant - the server validates it. */
144
+ readonly editable: boolean;
145
+ /** Only on the `:extended` view, i.e. from `get`, `create` and `update`. */
146
+ readonly fs_node?: FsNode;
147
+ readonly grantor?: User;
148
+ readonly grantee?: User | null;
149
+ }
150
+ /** Arguments for sharing a node. */
151
+ export interface CreateFsGrantInput {
152
+ readonly fsNodeId: Id;
153
+ /**
154
+ * Grantee's user id. Omit it (or pass `null`) for a public link grant, which
155
+ * must be read-only.
156
+ */
157
+ readonly granteeId?: Id | null;
158
+ /** Write access. Rejected with `editable` on a public grant. */
159
+ readonly editable?: boolean;
160
+ }
161
+ /** The scoped view behind a share link, from `GET /fs_nodes/:id/shared`. */
162
+ export interface SharedFsNodeView {
163
+ readonly node: FsNode;
164
+ /** Every descendant when `node` is a directory, and nothing else - never siblings, never ancestors. */
165
+ readonly descendants: FsNode[];
166
+ /** The grant that authorised the view, when one was found. */
167
+ readonly grant: {
168
+ readonly id: Id;
169
+ readonly editable: boolean;
170
+ readonly grantor_id: Id;
171
+ readonly public: boolean;
172
+ } | null;
173
+ readonly scope_root_id: Id;
174
+ }
175
+ /**
176
+ * Sharing grants, reachable as `oms.storage.grants`.
177
+ *
178
+ * Creating one with a `granteeId` notifies that user. Creating one WITHOUT a
179
+ * grantee mints a public link: the server also creates a short link in the `ss`
180
+ * namespace whose endpoint is the grant's own id, pointing at the frontend's
181
+ * `/storage/shared?id=<node>` page. Deleting the grant deletes that link.
182
+ */
183
+ export declare class FsGrantsNamespace extends Resource {
184
+ /**
185
+ * `GET /fs_grants` - the grants you hold: issued by you, or issued to you.
186
+ *
187
+ * There is no server-side filter for the node. The controller allows only
188
+ * `id`, `created_at` and `updated_at` as search keys, and an unknown key is a
189
+ * 400, not a wider result - so narrowing to one node is a client-side filter
190
+ * over this listing. {@link StorageNamespace.shared} is the cheap way to ask
191
+ * "how is THIS node shared".
192
+ *
193
+ * @throws {OmsAuthError} 401 when anonymous.
194
+ */
195
+ list(params?: PageParams, options?: RequestOptions): Promise<Paginated<FsGrant>>;
196
+ /** `GET /fs_grants/:id` - one grant, with its node, grantor and grantee expanded. */
197
+ get(id: Id, options?: RequestOptions): Promise<FsGrant>;
198
+ /**
199
+ * `POST /fs_grants` - shares a node.
200
+ *
201
+ * @throws {OmsApiError} 400 when a public grant asks for `editable: true`,
202
+ * 401 when the caller cannot edit the node.
203
+ */
204
+ create(input: CreateFsGrantInput, options?: RequestOptions): Promise<FsGrant>;
205
+ /**
206
+ * `PATCH /fs_grants/:id` - changes the grantee or the write flag.
207
+ *
208
+ * Only the grantor may do this. There is nothing else to change: a grant has
209
+ * no expiry.
210
+ */
211
+ update(id: Id, input: {
212
+ granteeId?: Id | null;
213
+ editable?: boolean;
214
+ }, options?: RequestOptions): Promise<FsGrant>;
215
+ /** `DELETE /fs_grants/:id` - revokes a share and destroys its short link. */
216
+ delete(id: Id, options?: RequestOptions): Promise<void>;
217
+ }
218
+ /** The `storage` namespace, reachable as `oms.storage`. */
219
+ export declare class StorageNamespace extends Resource {
220
+ /** The presigned direct-upload driver. */
221
+ readonly uploads: UploadManager;
222
+ /** Sharing grants. */
223
+ readonly grants: FsGrantsNamespace;
224
+ /**
225
+ * Paces the four bulk-job endpoints against the `fs_bulk_job` throttle, which
226
+ * is twelve requests a minute for all of them together. A loop that trashes
227
+ * files one at a time waits here rather than collecting 429s.
228
+ */
229
+ readonly bulkGate: StorageRateGate;
230
+ /**
231
+ * Memoised `(parentId, name) -> id` lookups, plus the roots.
232
+ *
233
+ * Positive results only: caching a miss would hide a file created a second
234
+ * later. Invalidated whenever this client moves, renames, trashes or deletes
235
+ * a node - never when ANOTHER client does, which is the cache's one real
236
+ * limitation and the reason {@link clearCache} is public.
237
+ */
238
+ private readonly children;
239
+ private rootsCache;
240
+ private readonly transport;
241
+ /** Entries kept before the oldest is evicted. Bounds a long-lived isolate. */
242
+ private static readonly CACHE_LIMIT;
243
+ constructor(http: ApiClient);
244
+ /**
245
+ * `GET /fs_nodes/roots` - the home, trash and vault node ids. Call this once
246
+ * and navigate from there; there is no path to build.
247
+ *
248
+ * Memoised, because roots do not move. `vault` is `null` until the encrypted
249
+ * vault is used for the first time - {@link vaultRoot} creates it.
250
+ *
251
+ * @throws {OmsAuthError} 401 when anonymous.
252
+ */
253
+ roots(options?: RequestOptions): Promise<FsRoots>;
254
+ /**
255
+ * `GET /fs_nodes` - the children of a directory.
256
+ *
257
+ * Anonymous callers get an empty listing, always: the listing scope is the
258
+ * caller's own tree plus what was explicitly shared with them, and a public
259
+ * grant is deliberately NOT enumerable. Reach a publicly-shared node by id
260
+ * with {@link get} or {@link shared} instead.
261
+ *
262
+ * The endpoint is conditional-GET aware and answers 304 to a matching
263
+ * `If-None-Match`. The SDK never sends one, and asks the runtime not to
264
+ * revalidate on its own, because a 304 has no body and would surface here as
265
+ * an error rather than as an empty page.
266
+ */
267
+ list(params: ListFsNodesParams, options?: RequestOptions): Promise<Paginated<FsNode>>;
268
+ /**
269
+ * `GET /fs_nodes/:id` - one node.
270
+ *
271
+ * Resolves against the broader `viewable_by` scope, so a node reached through
272
+ * a public share link answers here even though it never appears in
273
+ * {@link list}.
274
+ *
275
+ * @throws {OmsApiError} 404 when the node does not exist or is not visible.
276
+ */
277
+ get(id: Id, options?: RequestOptions): Promise<FsNode>;
278
+ /** Alias for {@link get}, for callers who think in filesystem verbs. */
279
+ stat(id: Id, options?: RequestOptions): Promise<FsNode>;
280
+ /**
281
+ * `GET /fs_nodes/:id/ancestors` - the breadcrumb chain, root first, the node
282
+ * itself last. Ancestors the caller may not list are omitted, so a shared
283
+ * node never leaks the names of its parents - which also means the chain can
284
+ * be shorter than the real depth, and its first entry is not necessarily a
285
+ * root.
286
+ */
287
+ ancestors(id: Id, options?: RequestOptions): Promise<FsBreadcrumb[]>;
288
+ /**
289
+ * Resolves a slash-separated path under a starting node, walking children one
290
+ * level at a time.
291
+ *
292
+ * A convenience for humans and CLIs, NOT how the API works. The `path` column
293
+ * was dropped in the ltree migration and nothing on the server accepts a path
294
+ * string, so each segment costs one filtered listing. Results are memoised
295
+ * per client instance, which makes a second walk down the same prefix free,
296
+ * but the cheap call is always the one that already has an id.
297
+ *
298
+ * `.` is skipped and `..` climbs to the parent. A leading `/` means "from the
299
+ * home root" and ignores `from`.
300
+ *
301
+ * @param options.from Node to start at. Defaults to the home root.
302
+ * @param options.includePending Resolve through nodes whose bytes never
303
+ * landed. Off by default.
304
+ * @throws {OmsApiError} 404 naming the segment that did not resolve.
305
+ */
306
+ resolvePath(path: string, options?: RequestOptions & {
307
+ from?: Id;
308
+ includePending?: boolean;
309
+ }): Promise<FsNode>;
310
+ /**
311
+ * Uploads files. Delegates to {@link UploadManager}, which batches the
312
+ * intake, presigns, sends the bytes straight to object storage, binds the
313
+ * blobs and reads the finished nodes back.
314
+ *
315
+ * Files at or above 32 MiB take the multipart path automatically, and that is
316
+ * not tuning: the object store sits behind Cloudflare with a request-body cap
317
+ * around 100 MB, so it is the only way a large file gets in.
318
+ *
319
+ * A per-file rejection - a quota that ran out, a name that collides with a
320
+ * directory - does not throw. It comes back in
321
+ * {@link UploadManager.upload}'s results, which is why that method is the one
322
+ * to call when partial success matters; this wrapper returns only the nodes
323
+ * that landed.
324
+ *
325
+ * Progress arrives per finished part or file, not per byte: `fetch` exposes
326
+ * no upload-progress event.
327
+ */
328
+ upload(input: {
329
+ parentId: Id;
330
+ files: FileInput[];
331
+ relativePaths?: string[];
332
+ concurrency?: number;
333
+ }, options?: OperationOptions): Promise<FsNode[]>;
334
+ /**
335
+ * `POST /fs_nodes/create_directories` - creates a subtree in one call.
336
+ *
337
+ * Asynchronous like every bulk operation: the answer is a job id, and the
338
+ * job's result is the list of directories that were created. Existing levels
339
+ * are reused, so re-running the same paths is a no-op that creates nothing.
340
+ *
341
+ * Costs one of the twelve `fs_bulk_job` requests a minute. Pass every path in
342
+ * one call rather than looping.
343
+ *
344
+ * @throws {OmsApiError} 400 when `paths` is empty or the parent is not a
345
+ * writable directory.
346
+ */
347
+ createDirectories(input: CreateDirectoriesInput, options?: RequestOptions): Promise<FsBulkJob>;
348
+ /** Alias for {@link createDirectories}, for callers who think in filesystem verbs. */
349
+ mkdir(input: CreateDirectoriesInput, options?: RequestOptions): Promise<FsBulkJob>;
350
+ /**
351
+ * `POST /fs_nodes` - creates ONE empty directory, synchronously, and returns
352
+ * it.
353
+ *
354
+ * The counterpart to {@link createDirectories}: that one is a bulk job on the
355
+ * twelve-a-minute bucket and answers with a job id, this one is a plain
356
+ * create on the general bucket and answers with the node. Use this when you
357
+ * want the id back immediately; use the other one for a subtree.
358
+ *
359
+ * @throws {OmsApiError} 400 when the name collides with a sibling or contains
360
+ * a `/`.
361
+ */
362
+ createDirectory(input: {
363
+ name: string;
364
+ parentId: Id;
365
+ }, options?: RequestOptions): Promise<FsNode>;
366
+ /**
367
+ * Downloads a file's bytes into memory.
368
+ *
369
+ * Goes through `data_url` and NOT through `GET /fs_nodes/:id/data`, on
370
+ * purpose. `data` answers 302 to the object store, and that redirect cannot
371
+ * be followed with a credential attached: the store answers
372
+ * `Access-Control-Allow-Origin: *`, which is illegal for a credentialed
373
+ * request, while dropping the credential makes `data` 404 before it ever
374
+ * redirects. Asking for the URL and fetching it anonymously separates the two
375
+ * concerns and works in every runtime.
376
+ *
377
+ * Buffers the whole file. Use {@link downloadStream} for anything that should
378
+ * not sit in memory.
379
+ *
380
+ * @throws {OmsApiError} 404 when the node has no data attached - which
381
+ * includes a directory and an upload whose bytes never landed.
382
+ */
383
+ download(id: Id, options?: RequestOptions): Promise<FileOutput>;
384
+ /**
385
+ * Streams a file's bytes without buffering them.
386
+ *
387
+ * Same `data_url` hop as {@link download} and the same reason for it. The
388
+ * caller owns the stream and must consume or cancel it.
389
+ */
390
+ downloadStream(id: Id, options?: RequestOptions): Promise<FsStream>;
391
+ /**
392
+ * `GET /fs_nodes/:id/data_url` - a short-lived signed URL for the bytes, for
393
+ * a host that would rather hand the URL to a player or a browser than move
394
+ * the bytes itself.
395
+ *
396
+ * Good for six hours. That window is not generous, it is necessary: a media
397
+ * element re-requests the object on every seek, and a five-minute URL dies
398
+ * mid-playback with no way to recover.
399
+ *
400
+ * The URL is a credential. Anyone holding it can read the bytes until it
401
+ * expires, so do not log it or put it somewhere durable.
402
+ */
403
+ downloadUrl(id: Id, options?: RequestOptions): Promise<string>;
404
+ /**
405
+ * `GET /fs_nodes/:id/zip` - a directory and every file under it that the
406
+ * caller can see, as a zip archive.
407
+ *
408
+ * Streamed, and streamed for real: the server generates it with
409
+ * `ActionController::Live`, so there is no `Content-Length` and no way to
410
+ * know the size in advance. Never retried automatically either - a retry
411
+ * restarts the whole archive from zero.
412
+ *
413
+ * @throws {OmsApiError} 400 when the node is not a directory, 404 when it is
414
+ * not visible.
415
+ */
416
+ zip(id: Id, options?: RequestOptions): Promise<FsStream>;
417
+ /**
418
+ * `PATCH /fs_nodes/:id` with a new name.
419
+ *
420
+ * The returned node is checked against what was asked for. The controller
421
+ * silently drops any field outside its update allowlist, so a 200 alone
422
+ * proves nothing about the write having happened.
423
+ *
424
+ * @throws {OmsApiError} 400 when the name collides with a sibling or contains
425
+ * a `/`; 401 when the caller cannot edit the node.
426
+ */
427
+ rename(id: Id, name: string, options?: RequestOptions): Promise<FsNode>;
428
+ /**
429
+ * `PATCH /fs_nodes/:id` with a new parent.
430
+ *
431
+ * The server refuses a move that would make a node its own ancestor; that
432
+ * cycle check is the fix for the 2026-07-27 copy outage and must not be
433
+ * second-guessed client-side.
434
+ *
435
+ * Like {@link rename}, the answer is verified rather than assumed.
436
+ *
437
+ * @throws {OmsApiError} 400 on a cycle or a name collision in the target;
438
+ * 401 when the caller cannot edit both ends.
439
+ */
440
+ move(id: Id, newParentId: Id, options?: RequestOptions): Promise<FsNode>;
441
+ /**
442
+ * `POST /fs_nodes/copy` - copies nodes into another directory.
443
+ *
444
+ * Asynchronous: the answer is a job id. Copying a directory copies its whole
445
+ * subtree, so this is the operation most worth watching to completion.
446
+ *
447
+ * The selection is sent as an explicit id list and this method refuses an
448
+ * empty one. That is not defensive tidiness: the endpoint runs the same
449
+ * filters the index does, so a copy with NO selection would resolve to the
450
+ * caller's entire listable tree and duplicate it.
451
+ *
452
+ * Costs one of the twelve `fs_bulk_job` requests a minute.
453
+ */
454
+ copy(input: CopyFsNodesInput, options?: RequestOptions): Promise<FsBulkJob>;
455
+ /**
456
+ * `POST /fs_nodes/move_to_trash` - the reversible delete. Prefer it over
457
+ * {@link delete}.
458
+ *
459
+ * Asynchronous: the answer is a job id. The nodes move into the trash root,
460
+ * keep their bytes and keep spending quota until {@link emptyTrash} runs.
461
+ *
462
+ * Refuses an empty id list for the same reason {@link copy} does: with no
463
+ * selection the endpoint resolves to the caller's whole listable tree.
464
+ *
465
+ * Costs one of the twelve `fs_bulk_job` requests a minute, so trash the whole
466
+ * selection in one call.
467
+ */
468
+ trash(ids: Id[], options?: RequestOptions): Promise<FsBulkJob>;
469
+ /**
470
+ * `POST /fs_nodes/empty_trash` - permanent, and it frees the quota.
471
+ *
472
+ * Asynchronous: the answer is a job id. Nothing survives it.
473
+ */
474
+ emptyTrash(options?: RequestOptions): Promise<FsBulkJob>;
475
+ /**
476
+ * `DELETE /fs_nodes/:id` - permanent, skipping the trash, and synchronous.
477
+ *
478
+ * Destroys the whole subtree under a directory. {@link trash} is the
479
+ * reversible one; reach for this only when the caller asked for exactly this.
480
+ */
481
+ delete(id: Id, options?: RequestOptions): Promise<void>;
482
+ /**
483
+ * `GET /fs_nodes/:id/shared` - the scoped view behind a share link: the node,
484
+ * its descendants when it is a directory, and the grant that authorised the
485
+ * view. Never siblings, never ancestors, never the rest of the owner's tree.
486
+ *
487
+ * Works anonymously for a public grant, which is what makes it the right call
488
+ * for "what is behind this share link" - {@link list} would answer nothing.
489
+ *
490
+ * @throws {OmsApiError} 404 both when the node does not exist and when no
491
+ * grant covers it, on purpose: existence is not leaked.
492
+ */
493
+ shared(id: Id, options?: RequestOptions): Promise<SharedFsNodeView>;
494
+ /**
495
+ * `GET /fs_nodes/vault_root` - the encrypted vault root, created on first
496
+ * use. The SDK does no cryptography: the vault's manifest and its contents
497
+ * are the host's to encrypt and decrypt.
498
+ *
499
+ * Unlike {@link roots}, this one creates the root if it is missing, which is
500
+ * why `roots().vault` can be `null` while this still succeeds.
501
+ *
502
+ * @throws {OmsAuthError} 401 when anonymous.
503
+ */
504
+ vaultRoot(options?: RequestOptions): Promise<FsNode>;
505
+ /**
506
+ * Empties the path cache and the memoised roots.
507
+ *
508
+ * The cache only knows about changes THIS client made. Call this when
509
+ * something else may have moved things - another session, a share that was
510
+ * revoked, a bulk job that has just finished.
511
+ */
512
+ clearCache(): void;
513
+ /** Records a resolved child, evicting the oldest entry when the cache is full. */
514
+ private remember;
515
+ /**
516
+ * Drops everything the cache knows about a node: the entry pointing AT it,
517
+ * and - since it may have been a directory - every entry that resolved
518
+ * THROUGH it.
519
+ */
520
+ private forget;
521
+ /**
522
+ * Fetches an object-storage URL on the injected transport with no credential
523
+ * of ours attached. The presigned signature in the URL IS the credential, and
524
+ * a bearer header alongside it is what makes MinIO reject the request.
525
+ */
526
+ private fetchObject;
527
+ }