@omelhorsite/sdk 0.3.0 → 0.4.1
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 +113 -131
- package/dist/index.js +1049 -1246
- package/dist/types/auth/device.d.ts +1 -1
- package/dist/types/auth/index.d.ts +2 -2
- package/dist/types/auth/tokens.d.ts +15 -15
- package/dist/types/client.d.ts +10 -10
- package/dist/types/errors.d.ts +12 -15
- package/dist/types/http.d.ts +74 -118
- package/dist/types/index.d.ts +2 -2
- package/dist/types/internal/attachments.d.ts +17 -0
- package/dist/types/internal/helpers.d.ts +9 -0
- package/dist/types/listing.d.ts +90 -0
- package/dist/types/local/qr.d.ts +1 -1
- package/dist/types/local/wordlist.d.ts +2 -3
- package/dist/types/resources/account.d.ts +19 -19
- package/dist/types/resources/admin/authorizedApplications.d.ts +133 -0
- package/dist/types/resources/admin/chests.d.ts +51 -0
- package/dist/types/resources/admin/eventAlerts.d.ts +60 -0
- package/dist/types/resources/admin/identities.d.ts +99 -0
- package/dist/types/resources/admin/index.d.ts +77 -0
- package/dist/types/resources/admin/jobs.d.ts +97 -0
- package/dist/types/resources/admin/myOauthApplications.d.ts +282 -0
- package/dist/types/resources/admin/notepads.d.ts +49 -0
- package/dist/types/resources/admin/oauthApplications.d.ts +309 -0
- package/dist/types/resources/admin/quotas.d.ts +114 -0
- package/dist/types/resources/admin/shortLinks.d.ts +201 -0
- package/dist/types/resources/admin/types.d.ts +222 -0
- package/dist/types/resources/admin/vocalSeparations.d.ts +98 -0
- package/dist/types/resources/admin.d.ts +17 -13
- package/dist/types/resources/auth/index.d.ts +1 -1
- package/dist/types/resources/auth/passkeys.d.ts +127 -163
- package/dist/types/resources/auth/sessions.d.ts +116 -161
- package/dist/types/resources/chests.d.ts +27 -31
- package/dist/types/resources/content/analysis.d.ts +62 -0
- package/dist/types/resources/content/blogs.d.ts +471 -0
- package/dist/types/resources/content/feedbacks.d.ts +263 -0
- package/dist/types/resources/content/index.d.ts +52 -0
- package/dist/types/resources/content/intel/articles.d.ts +230 -0
- package/dist/types/resources/content/intel/config.d.ts +135 -0
- package/dist/types/resources/content/intel/index.d.ts +53 -0
- package/dist/types/resources/content/intel/items.d.ts +91 -0
- package/dist/types/resources/content/intel/reports.d.ts +108 -0
- package/dist/types/resources/content/intel/scripts.d.ts +152 -0
- package/dist/types/resources/content/intel/sources.d.ts +236 -0
- package/dist/types/resources/content/intel/stats.d.ts +105 -0
- package/dist/types/resources/content/intel/types.d.ts +86 -0
- package/dist/types/resources/content/jokes.d.ts +93 -0
- package/dist/types/resources/content/notifications.d.ts +147 -0
- package/dist/types/resources/content/serviceUsages.d.ts +73 -0
- package/dist/types/resources/content/servicesStatus.d.ts +194 -0
- package/dist/types/resources/content/siteConfig.d.ts +43 -0
- package/dist/types/resources/content/spaceInvaders.d.ts +154 -0
- package/dist/types/resources/content.d.ts +41 -236
- package/dist/types/resources/dynamicQrs.d.ts +29 -45
- package/dist/types/resources/forms.d.ts +37 -58
- package/dist/types/resources/jobs.d.ts +35 -44
- package/dist/types/resources/library/annotations.d.ts +162 -0
- package/dist/types/resources/library/books.d.ts +534 -0
- package/dist/types/resources/library/chat.d.ts +259 -0
- package/dist/types/resources/library/index.d.ts +39 -0
- package/dist/types/resources/library/shelves.d.ts +237 -0
- package/dist/types/resources/library/types.d.ts +120 -0
- package/dist/types/resources/library.d.ts +20 -22
- package/dist/types/resources/media.d.ts +48 -61
- package/dist/types/resources/movies/addons.d.ts +388 -0
- package/dist/types/resources/movies/collections.d.ts +352 -0
- package/dist/types/resources/movies/index.d.ts +29 -0
- package/dist/types/resources/movies/types.d.ts +50 -0
- package/dist/types/resources/movies/watchProgress.d.ts +277 -0
- package/dist/types/resources/movies.d.ts +27 -53
- package/dist/types/resources/music/artists.d.ts +182 -246
- package/dist/types/resources/music/imports.d.ts +190 -218
- package/dist/types/resources/music/index.d.ts +8 -7
- package/dist/types/resources/music/playlists.d.ts +85 -117
- package/dist/types/resources/music/social.d.ts +153 -228
- package/dist/types/resources/music/songs.d.ts +165 -227
- package/dist/types/resources/realtime.d.ts +75 -88
- package/dist/types/resources/shortLinks.d.ts +38 -47
- package/dist/types/resources/social/groupChats.d.ts +458 -0
- package/dist/types/resources/social/index.d.ts +19 -0
- package/dist/types/resources/social/messages.d.ts +424 -0
- package/dist/types/resources/social/relationships.d.ts +322 -0
- package/dist/types/resources/social/types.d.ts +37 -0
- package/dist/types/resources/social.d.ts +21 -3
- package/dist/types/resources/storage/upload.d.ts +42 -56
- package/dist/types/resources/storage.d.ts +94 -109
- package/dist/types/resources/tickets.d.ts +19 -10
- package/dist/types/resources/tools/backgroundRemoval.d.ts +11 -13
- package/dist/types/resources/tools/captions.d.ts +107 -135
- package/dist/types/resources/tools/upscale.d.ts +12 -16
- package/dist/types/types.d.ts +29 -38
- package/package.json +1 -1
|
@@ -1,48 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `storage` namespace: the virtual filesystem.
|
|
3
3
|
*
|
|
4
|
-
* A node is a file or a directory, identified by an opaque id.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Never build or parse a path string.
|
|
4
|
+
* A node is a file or a directory, identified by an opaque id. The id IS the
|
|
5
|
+
* address: a node carries no path, and navigation goes parent id -> children,
|
|
6
|
+
* with `ancestors()` for a breadcrumb. Never build or parse a path string.
|
|
8
7
|
*
|
|
9
8
|
* {@link StorageNamespace.resolvePath} exists for humans typing `docs/a.pdf`,
|
|
10
9
|
* and it is exactly what it looks like: one request per segment, walking
|
|
11
|
-
* `name` + `parent_id` down
|
|
12
|
-
* client instance so a
|
|
13
|
-
*
|
|
10
|
+
* `name` + `parent_id` down a filtered listing. It memoises what it learns per
|
|
11
|
+
* client instance so a second walk down the same prefix is free, but the cheap
|
|
12
|
+
* call is always the one that already has an id.
|
|
14
13
|
*
|
|
15
14
|
* Uploads do NOT stream through this namespace. Bytes go straight to object
|
|
16
|
-
* storage with a presigned URL;
|
|
15
|
+
* storage with a presigned URL; the API only mints the plan and, at the end,
|
|
17
16
|
* binds the blob. That whole dance lives in `storage/upload.ts` and is reached
|
|
18
17
|
* through {@link StorageNamespace.upload}.
|
|
19
18
|
*
|
|
20
|
-
*
|
|
19
|
+
* Three rate limits bound what this namespace can do, and two are far tighter
|
|
21
20
|
* than the API's general ceiling:
|
|
22
21
|
*
|
|
23
|
-
* -
|
|
22
|
+
* - 300 requests a minute for the whole upload control plane. Paced by
|
|
24
23
|
* {@link UploadManager}.
|
|
25
|
-
* -
|
|
26
|
-
*
|
|
27
|
-
* - the general 600
|
|
28
|
-
*
|
|
24
|
+
* - TWELVE a minute for `copy`, `createDirectories`, `emptyTrash` and `trash`
|
|
25
|
+
* together. Paced by {@link StorageNamespace.bulkGate}.
|
|
26
|
+
* - the general 600 a minute for everything else.
|
|
27
|
+
*
|
|
28
|
+
* The direct PUTs at the object store are not rate limited by the API.
|
|
29
29
|
*/
|
|
30
30
|
/**
|
|
31
31
|
* The server's null sentinel: U+0008, a literal backspace.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* exactly what is wanted: `where(parent_id: nil)`, the root nodes.
|
|
33
|
+
* The server reads any filter value equal to it as `null`, in every option
|
|
34
|
+
* bag. Through `exact_search[parent_id]` that is exactly what is wanted: the
|
|
35
|
+
* nodes with no parent, i.e. the roots.
|
|
37
36
|
*
|
|
38
|
-
* Through `extra_options` the same
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* around that difference; do not collapse the two filters back together.
|
|
37
|
+
* Through `extra_options[parent_id]` the same value is a trap: a `null` there
|
|
38
|
+
* counts as no filter at all, and the filter is dropped without a word.
|
|
39
|
+
* {@link StorageNamespace.list} is built around that difference; do not
|
|
40
|
+
* collapse the two filters back together.
|
|
43
41
|
*/
|
|
44
42
|
import { type ApiClient, Resource } from "../http";
|
|
45
|
-
import type {
|
|
43
|
+
import type { ListParams } from "../listing";
|
|
44
|
+
import type { BaseRecord, FileOutput, Id, OperationOptions, Paginated, RequestOptions } from "../types";
|
|
46
45
|
import type { User } from "./account";
|
|
47
46
|
import { StorageRateGate, UploadManager } from "./storage/upload";
|
|
48
47
|
import type { UploadInput } from "./storage/upload";
|
|
@@ -51,27 +50,14 @@ export type FsNodeKind = "file" | "directory";
|
|
|
51
50
|
/**
|
|
52
51
|
* A node in the virtual filesystem.
|
|
53
52
|
*
|
|
54
|
-
* This is the WHOLE record
|
|
55
|
-
*
|
|
56
|
-
* `FsNodeBlueprint` declares `name`, `parent_id`, `kind`, `size`,
|
|
57
|
-
* `max_size`; it extends `ApplicationBlueprint`, which contributes `id`,
|
|
58
|
-
* `created_at` and `updated_at`; and its `:extended` view has an EMPTY body,
|
|
59
|
-
* which in Blueprinter inherits the base fields rather than emitting nothing.
|
|
60
|
-
* So `list`, `get`, `create` and `update` all answer the same eight fields.
|
|
61
|
-
* Reading a view name and assuming it adds something has already produced bugs
|
|
62
|
-
* in this repo - follow the `<` before deciding a field does or does not exist.
|
|
63
|
-
*
|
|
64
|
-
* The `fs_nodes` TABLE is wider than that, and the difference is never sent:
|
|
65
|
-
* `creator_id`, `updater_id`, `destroyer_id`, `signed_url_generated`,
|
|
66
|
-
* `is_vault_root` and the `id_path` ltree are all real columns that appear in
|
|
67
|
-
* no view. Declaring them client-side is worse than leaving them out, because
|
|
68
|
-
* every later reader then believes they arrive.
|
|
53
|
+
* This is the WHOLE record: `list`, `get`, `create` and `update` all answer
|
|
54
|
+
* the same eight fields.
|
|
69
55
|
*
|
|
70
|
-
* There is no `data` and no `url` field
|
|
56
|
+
* There is no `data` and no `url` field: bytes are reached through
|
|
71
57
|
* {@link StorageNamespace.download}, {@link StorageNamespace.downloadStream} or
|
|
72
58
|
* {@link StorageNamespace.downloadUrl}, never off the record. And no
|
|
73
59
|
* `content_type` and no `path` - the type is decided from the name at download
|
|
74
|
-
* time, and
|
|
60
|
+
* time, and a node is addressed by id.
|
|
75
61
|
*/
|
|
76
62
|
export interface FsNode extends BaseRecord {
|
|
77
63
|
readonly name: string;
|
|
@@ -100,10 +86,8 @@ export interface FsRoots {
|
|
|
100
86
|
* A bulk operation the server runs in the background.
|
|
101
87
|
*
|
|
102
88
|
* `copy`, `createDirectories`, `trash` and `emptyTrash` all answer with nothing
|
|
103
|
-
* but a job id: the
|
|
104
|
-
*
|
|
105
|
-
* access to the jobs namespace and deliberately does not grow a second polling
|
|
106
|
-
* loop.
|
|
89
|
+
* but a job id: the response says only that the work was enqueued. Poll it
|
|
90
|
+
* with `oms.jobs.wait(jobId)`.
|
|
107
91
|
*/
|
|
108
92
|
export interface FsBulkJob {
|
|
109
93
|
/** Feed this to `oms.jobs.get` / `oms.jobs.wait`. */
|
|
@@ -124,13 +108,27 @@ export interface FsStream {
|
|
|
124
108
|
/** Byte length when the server sent one. Always `undefined` for a zip. */
|
|
125
109
|
readonly size: number | undefined;
|
|
126
110
|
}
|
|
111
|
+
/** Filter columns of `GET /fs_nodes`. */
|
|
112
|
+
export declare const FS_NODE_FILTER_COLUMNS: readonly ["id", "created_at", "updated_at", "name", "parent_id"];
|
|
113
|
+
/** `extra_options` keys of `GET /fs_nodes`. */
|
|
114
|
+
export declare const FS_NODE_EXTRA_OPTION_KEYS: readonly ["parent_id", "include_pending"];
|
|
115
|
+
/**
|
|
116
|
+
* `extra_options` of `GET /fs_nodes`. `parent_id` here returns the folder's
|
|
117
|
+
* children AND the folder itself; the `parent_id` column in `exactSearch`
|
|
118
|
+
* returns the children only, and is the only one that can say `null`.
|
|
119
|
+
*/
|
|
120
|
+
export interface FsNodeExtraOptions {
|
|
121
|
+
readonly parent_id?: Id;
|
|
122
|
+
readonly include_pending?: boolean;
|
|
123
|
+
}
|
|
127
124
|
/** Filters for {@link StorageNamespace.list}. */
|
|
128
|
-
export interface ListFsNodesParams extends
|
|
125
|
+
export interface ListFsNodesParams extends ListParams<(typeof FS_NODE_FILTER_COLUMNS)[number], FsNodeExtraOptions> {
|
|
129
126
|
/**
|
|
130
127
|
* Directory to list. `null` lists the caller's ROOT nodes (home, trash,
|
|
131
|
-
* vault),
|
|
128
|
+
* vault). Omitted, no parent filter is applied and the listing spans the
|
|
129
|
+
* caller's whole tree, which is what a name search across folders wants.
|
|
132
130
|
*/
|
|
133
|
-
readonly parentId
|
|
131
|
+
readonly parentId?: Id | null;
|
|
134
132
|
/**
|
|
135
133
|
* Include nodes whose bytes never landed. Off by default, because a
|
|
136
134
|
* half-finished upload is not something a user wants to see - and because a
|
|
@@ -141,10 +139,9 @@ export interface ListFsNodesParams extends PageParams {
|
|
|
141
139
|
* Also return the parent itself, so one call gets both the folder's metadata
|
|
142
140
|
* and its children. It occupies a slot on the page like any other row.
|
|
143
141
|
*
|
|
144
|
-
* IGNORED when `parentId` is `null
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* tree. The roots have no folder to fold in anyway. The detail is on
|
|
142
|
+
* IGNORED when `parentId` is `null`: the server-side filter behind this flag
|
|
143
|
+
* cannot express "no parent", and asking it to answers with the caller's
|
|
144
|
+
* whole tree. The roots have no folder to fold in anyway. The detail is on
|
|
148
145
|
* {@link StorageNamespace.list}.
|
|
149
146
|
*/
|
|
150
147
|
readonly includeSelf?: boolean;
|
|
@@ -165,6 +162,8 @@ export interface CopyFsNodesInput {
|
|
|
165
162
|
readonly ids: Id[];
|
|
166
163
|
readonly newParentId: Id;
|
|
167
164
|
}
|
|
165
|
+
/** `GET /fs_grants` filters on {@link BASE_FILTER_COLUMNS} only. */
|
|
166
|
+
export type ListFsGrantsParams = ListParams<never>;
|
|
168
167
|
/**
|
|
169
168
|
* A sharing grant on a node.
|
|
170
169
|
*
|
|
@@ -179,7 +178,7 @@ export interface FsGrant extends BaseRecord {
|
|
|
179
178
|
readonly grantee_id: Id | null;
|
|
180
179
|
/** Write access. Always `false` on a public grant - the server validates it. */
|
|
181
180
|
readonly editable: boolean;
|
|
182
|
-
/** Only
|
|
181
|
+
/** Only from `get`, `create` and `update`; absent in listings. */
|
|
183
182
|
readonly fs_node?: FsNode;
|
|
184
183
|
readonly grantor?: User;
|
|
185
184
|
readonly grantee?: User | null;
|
|
@@ -214,22 +213,22 @@ export interface SharedFsNodeView {
|
|
|
214
213
|
*
|
|
215
214
|
* Creating one with a `granteeId` notifies that user. Creating one WITHOUT a
|
|
216
215
|
* grantee mints a public link: the server also creates a short link in the `ss`
|
|
217
|
-
* namespace whose endpoint is the grant's own id
|
|
218
|
-
*
|
|
216
|
+
* namespace whose endpoint is the grant's own id. Deleting the grant deletes
|
|
217
|
+
* that link.
|
|
219
218
|
*/
|
|
220
219
|
export declare class FsGrantsNamespace extends Resource {
|
|
221
220
|
/**
|
|
222
221
|
* `GET /fs_grants` - the grants you hold: issued by you, or issued to you.
|
|
223
222
|
*
|
|
224
|
-
* There is no server-side filter for the node. The
|
|
225
|
-
* `id`, `created_at` and `updated_at
|
|
226
|
-
*
|
|
227
|
-
*
|
|
223
|
+
* There is no server-side filter for the node. The only search keys accepted
|
|
224
|
+
* are `id`, `created_at` and `updated_at`, and an unknown key is a 400, not a
|
|
225
|
+
* wider result - so narrowing to one node is a client-side filter over this
|
|
226
|
+
* listing. {@link StorageNamespace.shared} is the cheap way to ask
|
|
228
227
|
* "how is THIS node shared".
|
|
229
228
|
*
|
|
230
229
|
* @throws {OmsAuthError} 401 when anonymous.
|
|
231
230
|
*/
|
|
232
|
-
list(params?:
|
|
231
|
+
list(params?: ListFsGrantsParams, options?: RequestOptions): Promise<Paginated<FsGrant>>;
|
|
233
232
|
/** `GET /fs_grants/:id` - one grant, with its node, grantor and grantee expanded. */
|
|
234
233
|
get(id: Id, options?: RequestOptions): Promise<FsGrant>;
|
|
235
234
|
/**
|
|
@@ -259,9 +258,9 @@ export declare class StorageNamespace extends Resource {
|
|
|
259
258
|
/** Sharing grants. */
|
|
260
259
|
readonly grants: FsGrantsNamespace;
|
|
261
260
|
/**
|
|
262
|
-
* Paces the four bulk-job endpoints against
|
|
263
|
-
*
|
|
264
|
-
*
|
|
261
|
+
* Paces the four bulk-job endpoints against their shared limit of twelve
|
|
262
|
+
* requests a minute. A loop that trashes files one at a time waits here
|
|
263
|
+
* rather than collecting 429s.
|
|
265
264
|
*/
|
|
266
265
|
readonly bulkGate: StorageRateGate;
|
|
267
266
|
/**
|
|
@@ -300,40 +299,29 @@ export declare class StorageNamespace extends Resource {
|
|
|
300
299
|
* TWO server-side filters address a directory and they are NOT
|
|
301
300
|
* interchangeable. That asymmetry is the whole subtlety of this method:
|
|
302
301
|
*
|
|
303
|
-
* - `exact_search[parent_id]`
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
* the
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* - `extra_options[parent_id]` reaches `QueryExtraOptions::FsNodes`, which
|
|
311
|
-
* runs `where(parent_id: x).or(where(id: x))` and so folds the folder
|
|
312
|
-
* itself back into its own listing. Convenient - and guarded by
|
|
313
|
-
* `return unless params[:parent_id].present?`, with that same `\b` -> `nil`
|
|
314
|
-
* rewrite happening first. Hand it the sentinel and the guard drops the
|
|
315
|
-
* filter IN SILENCE. The request still answers 200; it just answers with
|
|
316
|
-
* the caller's ENTIRE listable tree, page after page, instead of three
|
|
317
|
-
* rows. It is the same failure shape as the `inside_path` incident that
|
|
318
|
-
* `reject_unknown_filter_keys!` was written for, except this key IS known,
|
|
319
|
-
* so nothing rejects it.
|
|
302
|
+
* - `exact_search[parent_id]` selects the children only. A `\b` value is
|
|
303
|
+
* read as `null` and selects the nodes with no parent, so this is the only
|
|
304
|
+
* filter in the API that can say "the roots".
|
|
305
|
+
* - `extra_options[parent_id]` selects the children AND the folder itself.
|
|
306
|
+
* Hand it the sentinel and the filter is dropped IN SILENCE. The request
|
|
307
|
+
* still answers 200; it just answers with the caller's ENTIRE listable
|
|
308
|
+
* tree, page after page, instead of three rows.
|
|
320
309
|
*
|
|
321
310
|
* Hence `includeSelf` is honoured under a real directory and ignored at the
|
|
322
311
|
* top of the tree. Not client-side taste: it is the only combination the
|
|
323
312
|
* server can actually express.
|
|
324
313
|
*
|
|
325
|
-
* The endpoint
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
314
|
+
* The endpoint answers 304 to a matching `If-None-Match`. The SDK never
|
|
315
|
+
* sends one, and asks the runtime not to revalidate on its own, because a
|
|
316
|
+
* 304 has no body and would surface here as an error rather than as an
|
|
317
|
+
* empty page.
|
|
329
318
|
*/
|
|
330
|
-
list(params
|
|
319
|
+
list(params?: ListFsNodesParams, options?: RequestOptions): Promise<Paginated<FsNode>>;
|
|
331
320
|
/**
|
|
332
321
|
* `GET /fs_nodes/:id` - one node.
|
|
333
322
|
*
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
* {@link list}.
|
|
323
|
+
* Visibility is wider than {@link list}'s: a node reached through a public
|
|
324
|
+
* share link answers here even though it never appears in a listing.
|
|
337
325
|
*
|
|
338
326
|
* @throws {OmsApiError} 404 when the node does not exist or is not visible.
|
|
339
327
|
*/
|
|
@@ -352,11 +340,10 @@ export declare class StorageNamespace extends Resource {
|
|
|
352
340
|
* Resolves a slash-separated path under a starting node, walking children one
|
|
353
341
|
* level at a time.
|
|
354
342
|
*
|
|
355
|
-
* A convenience for humans
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
* but the cheap call is always the one that already has an id.
|
|
343
|
+
* A convenience for humans, NOT how the API works. Nothing on the server
|
|
344
|
+
* accepts a path string, so each segment costs one filtered listing. Results
|
|
345
|
+
* are memoised per client instance, which makes a second walk down the same
|
|
346
|
+
* prefix free, but the cheap call is always the one that already has an id.
|
|
360
347
|
*
|
|
361
348
|
* `.` is skipped and `..` climbs to the parent. A leading `/` means "from the
|
|
362
349
|
* home root" and ignores `from`.
|
|
@@ -376,9 +363,9 @@ export declare class StorageNamespace extends Resource {
|
|
|
376
363
|
* blobs and reads the finished nodes back.
|
|
377
364
|
*
|
|
378
365
|
* Files at or above `MULTIPART_THRESHOLD` (32 MiB, exported from this
|
|
379
|
-
* package) take the multipart path automatically, and that is not tuning:
|
|
380
|
-
* the object store
|
|
381
|
-
*
|
|
366
|
+
* package) take the multipart path automatically, and that is not tuning: a
|
|
367
|
+
* single request to the object store is capped at roughly 100 MB, so it is
|
|
368
|
+
* the only way a large file gets in at all.
|
|
382
369
|
*
|
|
383
370
|
* A per-file rejection - a quota that ran out, a name that collides with a
|
|
384
371
|
* directory - does not throw. It comes back in
|
|
@@ -404,7 +391,7 @@ export declare class StorageNamespace extends Resource {
|
|
|
404
391
|
* job's result is the list of directories that were created. Existing levels
|
|
405
392
|
* are reused, so re-running the same paths is a no-op that creates nothing.
|
|
406
393
|
*
|
|
407
|
-
*
|
|
394
|
+
* Counts against the twelve bulk-job requests a minute. Pass every path in
|
|
408
395
|
* one call rather than looping.
|
|
409
396
|
*
|
|
410
397
|
* @throws {OmsApiError} 400 when `paths` is empty or the parent is not a
|
|
@@ -471,10 +458,10 @@ export declare class StorageNamespace extends Resource {
|
|
|
471
458
|
* `GET /fs_nodes/:id/zip` - a directory and every file under it that the
|
|
472
459
|
* caller can see, as a zip archive.
|
|
473
460
|
*
|
|
474
|
-
* Streamed, and streamed for real: the server generates it
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
461
|
+
* Streamed, and streamed for real: the server generates the archive as it
|
|
462
|
+
* sends it, so there is no `Content-Length` and no way to know the size in
|
|
463
|
+
* advance. Never retried automatically either - a retry restarts the whole
|
|
464
|
+
* archive from zero.
|
|
478
465
|
*
|
|
479
466
|
* @throws {OmsApiError} 400 when the node is not a directory, 404 when it is
|
|
480
467
|
* not visible.
|
|
@@ -483,8 +470,8 @@ export declare class StorageNamespace extends Resource {
|
|
|
483
470
|
/**
|
|
484
471
|
* `PATCH /fs_nodes/:id` with a new name.
|
|
485
472
|
*
|
|
486
|
-
* The returned node is checked against what was asked for. The
|
|
487
|
-
* silently drops any field
|
|
473
|
+
* The returned node is checked against what was asked for. The server
|
|
474
|
+
* silently drops any field it does not accept on update, so a 200 alone
|
|
488
475
|
* proves nothing about the write having happened.
|
|
489
476
|
*
|
|
490
477
|
* @throws {OmsApiError} 400 when the name collides with a sibling or contains
|
|
@@ -494,9 +481,7 @@ export declare class StorageNamespace extends Resource {
|
|
|
494
481
|
/**
|
|
495
482
|
* `PATCH /fs_nodes/:id` with a new parent.
|
|
496
483
|
*
|
|
497
|
-
* The server refuses a move that would make a node its own ancestor
|
|
498
|
-
* cycle check is the fix for the 2026-07-27 copy outage and must not be
|
|
499
|
-
* second-guessed client-side.
|
|
484
|
+
* The server refuses a move that would make a node its own ancestor.
|
|
500
485
|
*
|
|
501
486
|
* Like {@link rename}, the answer is verified rather than assumed.
|
|
502
487
|
*
|
|
@@ -515,7 +500,7 @@ export declare class StorageNamespace extends Resource {
|
|
|
515
500
|
* filters the index does, so a copy with NO selection would resolve to the
|
|
516
501
|
* caller's entire listable tree and duplicate it.
|
|
517
502
|
*
|
|
518
|
-
*
|
|
503
|
+
* Counts against the twelve bulk-job requests a minute.
|
|
519
504
|
*/
|
|
520
505
|
copy(input: CopyFsNodesInput, options?: RequestOptions): Promise<FsBulkJob>;
|
|
521
506
|
/**
|
|
@@ -528,7 +513,7 @@ export declare class StorageNamespace extends Resource {
|
|
|
528
513
|
* Refuses an empty id list for the same reason {@link copy} does: with no
|
|
529
514
|
* selection the endpoint resolves to the caller's whole listable tree.
|
|
530
515
|
*
|
|
531
|
-
*
|
|
516
|
+
* Counts against the twelve bulk-job requests a minute, so trash the whole
|
|
532
517
|
* selection in one call.
|
|
533
518
|
*/
|
|
534
519
|
trash(ids: Id[], options?: RequestOptions): Promise<FsBulkJob>;
|
|
@@ -587,7 +572,7 @@ export declare class StorageNamespace extends Resource {
|
|
|
587
572
|
/**
|
|
588
573
|
* Fetches an object-storage URL on the injected transport with no credential
|
|
589
574
|
* of ours attached. The presigned signature in the URL IS the credential, and
|
|
590
|
-
*
|
|
575
|
+
* the store rejects a request that carries a bearer header alongside it.
|
|
591
576
|
*/
|
|
592
577
|
private fetchObject;
|
|
593
578
|
}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* in the same request.
|
|
12
12
|
*/
|
|
13
13
|
import { type ApiClient, Resource } from "../http";
|
|
14
|
-
import type {
|
|
14
|
+
import type { ListParams } from "../listing";
|
|
15
|
+
import type { FileInput, Id, Paginated, RequestOptions, Timestamp } from "../types";
|
|
15
16
|
/** Lifecycle of a ticket. */
|
|
16
17
|
export type TicketStatus = "open" | "closed";
|
|
17
18
|
/**
|
|
@@ -99,29 +100,37 @@ export interface CreateTicketInput {
|
|
|
99
100
|
readonly initialMessage?: string;
|
|
100
101
|
readonly context?: TicketContext;
|
|
101
102
|
/**
|
|
102
|
-
* Files to attach
|
|
103
|
-
*
|
|
103
|
+
* Files to attach, as bytes or as an already-encoded data URL. Bytes are
|
|
104
|
+
* base64-encoded here, so every attachment is buffered in memory.
|
|
104
105
|
*
|
|
105
|
-
*
|
|
106
|
+
* Server caps: {@link TICKET_MAX_ATTACHMENTS} files,
|
|
106
107
|
* {@link TICKET_MAX_ATTACHMENT_BYTES} in total, `image/*` and `video/*`
|
|
107
|
-
* only
|
|
108
|
-
*
|
|
109
|
-
* sending and raises rather than let a screenshot disappear.
|
|
108
|
+
* only. An attachment over a cap is dropped server-side with the ticket
|
|
109
|
+
* still answering 201, so the SDK validates first and throws instead.
|
|
110
110
|
*/
|
|
111
|
-
readonly attachments?: FileInput
|
|
111
|
+
readonly attachments?: ReadonlyArray<FileInput | TicketAttachmentDataUrl>;
|
|
112
|
+
}
|
|
113
|
+
/** An attachment that is already a `data:<mime>;base64,...` URL. */
|
|
114
|
+
export interface TicketAttachmentDataUrl {
|
|
115
|
+
readonly dataUrl: string;
|
|
116
|
+
readonly filename: string;
|
|
112
117
|
}
|
|
113
118
|
/** Fields that can change after a ticket exists. */
|
|
114
119
|
export interface UpdateTicketInput {
|
|
115
120
|
readonly status?: TicketStatus;
|
|
116
121
|
}
|
|
122
|
+
/** Filter columns of `GET /tickets`, on top of {@link BASE_FILTER_COLUMNS}. */
|
|
123
|
+
export declare const TICKET_FILTER_COLUMNS: readonly ["status", "user_id"];
|
|
117
124
|
/** Filters for {@link TicketsNamespace.list}. */
|
|
118
|
-
export interface ListTicketsParams extends
|
|
125
|
+
export interface ListTicketsParams extends ListParams<(typeof TICKET_FILTER_COLUMNS)[number]> {
|
|
119
126
|
readonly status?: TicketStatus;
|
|
120
127
|
/** Administrators only: someone else's tickets. */
|
|
121
128
|
readonly userId?: Id;
|
|
122
129
|
}
|
|
130
|
+
/** Filter columns of `GET /ticket_messages`, on top of {@link BASE_FILTER_COLUMNS}. */
|
|
131
|
+
export declare const TICKET_MESSAGE_FILTER_COLUMNS: readonly ["ticket_id", "sender_id", "created_at"];
|
|
123
132
|
/** Filters for {@link TicketMessagesNamespace.list}. */
|
|
124
|
-
export interface ListTicketMessagesParams extends
|
|
133
|
+
export interface ListTicketMessagesParams extends ListParams<(typeof TICKET_MESSAGE_FILTER_COLUMNS)[number]> {
|
|
125
134
|
readonly ticketId: TicketId;
|
|
126
135
|
}
|
|
127
136
|
/** Arguments for replying to a ticket. */
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Background removal: cuts the subject out of an image.
|
|
3
3
|
*
|
|
4
|
-
* `POST /background_removals` enqueues a
|
|
5
|
-
*
|
|
4
|
+
* `POST /background_removals` enqueues a job and answers immediately with a
|
|
5
|
+
* row plus a `job_id` and, for an anonymous caller, a `watch_token`. Poll
|
|
6
6
|
* through `oms.jobs` with that handle, or use {@link BackgroundRemovalNamespace.run}.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Limits: 15 MiB, and an image bomb (absurd pixel count for its byte size) is
|
|
9
|
+
* rejected with a 400 before any work starts.
|
|
10
10
|
*
|
|
11
|
-
* This tool has no daily quota
|
|
12
|
-
* catalogue does not meter - so there is no `quota()` here to call first.
|
|
11
|
+
* This tool has no daily quota, so there is no `quota()` here to call first.
|
|
13
12
|
*/
|
|
14
13
|
import { Resource } from "../../http";
|
|
15
14
|
import type { FileInput, Id, RequestOptions } from "../../types";
|
|
@@ -18,12 +17,12 @@ import { type ToolCaptcha, type ToolJobHandle, type ToolRecord, type ToolRunOpti
|
|
|
18
17
|
* A background removal run.
|
|
19
18
|
*
|
|
20
19
|
* Both routes that answer with one - `POST /background_removals` and
|
|
21
|
-
* `GET /background_removals/:id` -
|
|
22
|
-
*
|
|
20
|
+
* `GET /background_removals/:id` - answer the same shape, so `result_url` is
|
|
21
|
+
* always PRESENT and simply `null` until the run completes.
|
|
23
22
|
*
|
|
24
23
|
* `progress_percent`, inherited from {@link ToolRecord}, is never sent for this
|
|
25
|
-
* tool
|
|
26
|
-
* {@link
|
|
24
|
+
* tool. Progress lives on the {@link Job} row that
|
|
25
|
+
* {@link BackgroundRemovalCreated.job_id} names.
|
|
27
26
|
*/
|
|
28
27
|
export interface BackgroundRemoval extends ToolRecord {
|
|
29
28
|
/**
|
|
@@ -38,7 +37,7 @@ export interface BackgroundRemoval extends ToolRecord {
|
|
|
38
37
|
export type BackgroundRemovalCreated = BackgroundRemoval & ToolJobHandle;
|
|
39
38
|
/** Arguments for starting a run. */
|
|
40
39
|
export interface CreateBackgroundRemovalInput extends ToolCaptcha {
|
|
41
|
-
/** The image.
|
|
40
|
+
/** The image. Cap: 15 MiB. */
|
|
42
41
|
readonly file: FileInput;
|
|
43
42
|
}
|
|
44
43
|
/** The `backgroundRemoval` tool, reachable as `oms.tools.backgroundRemoval`. */
|
|
@@ -56,8 +55,7 @@ export declare class BackgroundRemovalNamespace extends Resource {
|
|
|
56
55
|
*
|
|
57
56
|
* NOT retried by default, unlike most of the SDK. The transport's policy
|
|
58
57
|
* replays a `POST` that died with a 502, and here that would re-upload the
|
|
59
|
-
* image and start a second run
|
|
60
|
-
* `retry: {}` to opt back in.
|
|
58
|
+
* image and start a second run. Pass `retry: {}` to opt back in.
|
|
61
59
|
*
|
|
62
60
|
* @throws {OmsApiError} 400 when the image is too large or looks like a bomb.
|
|
63
61
|
* @throws {OmsAuthError} 401 when anonymous and the captcha is missing or bad.
|