@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
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
*/
|
|
70
70
|
import { OmsError } from "../errors";
|
|
71
71
|
import { Resource } from "../http";
|
|
72
|
-
import type {
|
|
72
|
+
import type { ListParams } from "../listing";
|
|
73
|
+
import type { FileInput, FileOutput, Id, NativeFile, Paginated, RequestOptions, Timestamp } from "../types";
|
|
73
74
|
/**
|
|
74
75
|
* Primary key of a book. A NUMBER: `books` never moved to the opaque string
|
|
75
76
|
* ids the account-side tables use, even though its `user_id` and its three
|
|
@@ -418,7 +419,17 @@ export declare function isBookChatBusy(error: unknown): boolean;
|
|
|
418
419
|
* a polyfill after the SDK is imported.
|
|
419
420
|
*/
|
|
420
421
|
export declare function bookChatIsIncremental(): boolean;
|
|
421
|
-
/**
|
|
422
|
+
/** Filter columns of `GET /books`, on top of {@link BASE_FILTER_COLUMNS}. */
|
|
423
|
+
export declare const BOOK_FILTER_COLUMNS: readonly ["title", "author", "format", "user_id"];
|
|
424
|
+
/** `extra_options` keys of `GET /books`. */
|
|
425
|
+
export declare const BOOK_EXTRA_OPTION_KEYS: readonly ["scope", "owner_handle", "tags"];
|
|
426
|
+
/** `extra_options` of `GET /books`. {@link ListBooksParams} has camelCased shortcuts for each key. */
|
|
427
|
+
export interface BookExtraOptions {
|
|
428
|
+
readonly scope?: "mine" | "explore";
|
|
429
|
+
readonly owner_handle?: string;
|
|
430
|
+
readonly tags?: readonly string[];
|
|
431
|
+
}
|
|
432
|
+
/** Shortcuts over the filter columns of `GET /books`. */
|
|
422
433
|
export interface BookFilters {
|
|
423
434
|
/** Partial, accent-insensitive match on the title (`search[title]`). */
|
|
424
435
|
readonly title?: string;
|
|
@@ -430,13 +441,9 @@ export interface BookFilters {
|
|
|
430
441
|
readonly userId?: Id;
|
|
431
442
|
/** Exact ids. An array becomes `IN (...)`. */
|
|
432
443
|
readonly ids?: readonly BookId[];
|
|
433
|
-
/** Escape hatch: extra `search[...]` keys. Unknown keys are a 400. */
|
|
434
|
-
readonly search?: Record<string, QueryValue>;
|
|
435
|
-
/** Escape hatch: extra `exact_search[...]` keys. Unknown keys are a 400. */
|
|
436
|
-
readonly exactSearch?: Record<string, QueryValue>;
|
|
437
444
|
}
|
|
438
445
|
/** Arguments for {@link LibraryBooksNamespace.list}. */
|
|
439
|
-
export interface ListBooksParams extends BookFilters,
|
|
446
|
+
export interface ListBooksParams extends BookFilters, ListParams<(typeof BOOK_FILTER_COLUMNS)[number], BookExtraOptions> {
|
|
440
447
|
/**
|
|
441
448
|
* `"mine"` narrows to the caller's own books, `"explore"` to everybody
|
|
442
449
|
* else's. Omitted, the listing is own + all public, mixed together.
|
|
@@ -525,8 +532,10 @@ export interface UpdateBookInput {
|
|
|
525
532
|
*/
|
|
526
533
|
readonly cover?: FileInput | NativeFile;
|
|
527
534
|
}
|
|
535
|
+
/** Filter columns of `GET /book_shelves`, on top of {@link BASE_FILTER_COLUMNS}. */
|
|
536
|
+
export declare const BOOK_SHELF_FILTER_COLUMNS: readonly ["user_id", "visibility"];
|
|
528
537
|
/** Arguments for {@link LibraryShelvesNamespace.list}. */
|
|
529
|
-
export interface ListBookShelvesParams extends
|
|
538
|
+
export interface ListBookShelvesParams extends ListParams<(typeof BOOK_SHELF_FILTER_COLUMNS)[number]> {
|
|
530
539
|
/** Exact owner id. The only way to ask for one person's shelves. */
|
|
531
540
|
readonly userId?: Id;
|
|
532
541
|
/** Exact visibility. */
|
|
@@ -535,10 +544,6 @@ export interface ListBookShelvesParams extends PageParams {
|
|
|
535
544
|
readonly ids?: readonly BookShelfId[];
|
|
536
545
|
/** `"column:asc"` / `"column:desc"`. Defaults to the endpoint's own ordering. */
|
|
537
546
|
readonly order?: string;
|
|
538
|
-
/** Escape hatch: extra `search[...]` keys. Unknown keys are a 400. */
|
|
539
|
-
readonly search?: Record<string, QueryValue>;
|
|
540
|
-
/** Escape hatch: extra `exact_search[...]` keys. Unknown keys are a 400. */
|
|
541
|
-
readonly exactSearch?: Record<string, QueryValue>;
|
|
542
547
|
}
|
|
543
548
|
/** Arguments for {@link LibraryShelvesNamespace.create}. */
|
|
544
549
|
export interface CreateBookShelfInput {
|
|
@@ -560,18 +565,16 @@ export interface UpdateBookShelfInput {
|
|
|
560
565
|
readonly visibility?: BookVisibility;
|
|
561
566
|
readonly position?: number;
|
|
562
567
|
}
|
|
568
|
+
/** Filter columns of `GET /book_annotations`, on top of {@link BASE_FILTER_COLUMNS}. */
|
|
569
|
+
export declare const BOOK_ANNOTATION_FILTER_COLUMNS: readonly ["book_id", "kind"];
|
|
563
570
|
/** Arguments for {@link LibraryAnnotationsNamespace.list}. */
|
|
564
|
-
export interface ListBookAnnotationsParams extends
|
|
571
|
+
export interface ListBookAnnotationsParams extends ListParams<(typeof BOOK_ANNOTATION_FILTER_COLUMNS)[number]> {
|
|
565
572
|
/** Exact book id. The filter every reader screen uses. */
|
|
566
573
|
readonly bookId?: BookId;
|
|
567
574
|
/** Exact kind, or an array of kinds (which becomes `IN (...)`). */
|
|
568
575
|
readonly kind?: BookAnnotationKind | readonly BookAnnotationKind[];
|
|
569
576
|
/** `"column:asc"` / `"column:desc"`. Defaults to `created_at:asc`. */
|
|
570
577
|
readonly order?: string;
|
|
571
|
-
/** Escape hatch: extra `search[...]` keys. Unknown keys are a 400. */
|
|
572
|
-
readonly search?: Record<string, QueryValue>;
|
|
573
|
-
/** Escape hatch: extra `exact_search[...]` keys. Unknown keys are a 400. */
|
|
574
|
-
readonly exactSearch?: Record<string, QueryValue>;
|
|
575
578
|
}
|
|
576
579
|
/** Arguments for {@link LibraryAnnotationsNamespace.create}. */
|
|
577
580
|
export interface CreateBookAnnotationInput {
|
|
@@ -984,7 +987,6 @@ export declare class LibraryBooksNamespace extends Resource {
|
|
|
984
987
|
* allowlist - `BooksController` declares only those three, so any other key
|
|
985
988
|
* there is a 400.
|
|
986
989
|
*/
|
|
987
|
-
private bookQuery;
|
|
988
990
|
/** JSON body for an update. `null` stays `null`; the transport does not touch a body. */
|
|
989
991
|
private updateBody;
|
|
990
992
|
/**
|
|
@@ -1152,8 +1154,6 @@ export declare class LibraryShelvesNamespace extends Resource {
|
|
|
1152
1154
|
* @throws {OmsApiError} 404 `"Shelf not found"`; 403 `"Not your shelf"`.
|
|
1153
1155
|
*/
|
|
1154
1156
|
reorder(id: BookShelfId, bookIds: readonly BookId[], options?: RequestOptions): Promise<BookShelf>;
|
|
1155
|
-
/** Builds the query for {@link list}. Both filterable columns are exact-match. */
|
|
1156
|
-
private shelfQuery;
|
|
1157
1157
|
}
|
|
1158
1158
|
/** The `library.annotations` namespace, reachable as `oms.library.annotations`. */
|
|
1159
1159
|
export declare class LibraryAnnotationsNamespace extends Resource {
|
|
@@ -1273,8 +1273,6 @@ export declare class LibraryAnnotationsNamespace extends Resource {
|
|
|
1273
1273
|
* @throws {OmsApiError} 404 the second time round.
|
|
1274
1274
|
*/
|
|
1275
1275
|
delete(id: BookAnnotationId, options?: RequestOptions): Promise<void>;
|
|
1276
|
-
/** Builds the query for {@link list}. Both filterable columns are exact-match. */
|
|
1277
|
-
private annotationQuery;
|
|
1278
1276
|
}
|
|
1279
1277
|
/** Options for {@link BookChatNamespace.stream} and {@link BookChatNamespace.ask}. */
|
|
1280
1278
|
export interface BookChatStreamOptions extends RequestOptions {
|
|
@@ -9,43 +9,37 @@
|
|
|
9
9
|
* ## Two routes, and which one is the real one
|
|
10
10
|
*
|
|
11
11
|
* - `GET /media/:id/data` and `GET /media/:id/data_url` are the CANONICAL
|
|
12
|
-
* routes.
|
|
13
|
-
* them.
|
|
12
|
+
* routes. Every new client should use them.
|
|
14
13
|
* - `GET /fs_nodes/:id/data` and `GET /fs_nodes/:id/data_url` are a TEMPORARY
|
|
15
|
-
* ALIAS
|
|
16
|
-
*
|
|
17
|
-
* `
|
|
18
|
-
* numeric id to the same `MusicMediaServing` concern; a storage UUID keeps
|
|
19
|
-
* the old filesystem behaviour. The alias exists because the web frontend
|
|
20
|
-
* still builds those URLs, and it is scheduled to go together with the
|
|
21
|
-
* `*_fs_node_id` blueprint twins.
|
|
14
|
+
* ALIAS. An all-digit id there is served as media; a storage UUID keeps the
|
|
15
|
+
* filesystem behaviour. The alias is scheduled to go, together with the
|
|
16
|
+
* `*_fs_node_id` twins on the music records.
|
|
22
17
|
*
|
|
23
18
|
* {@link MediaNamespace.aliasUrl} and {@link MediaNamespace.aliasDataUrl} are
|
|
24
|
-
* here
|
|
19
|
+
* here for code that still spells the old routes, and for the one case where
|
|
25
20
|
* the alias is genuinely more capable (see the OAuth note below). Reach for
|
|
26
21
|
* {@link MediaNamespace.url} and {@link MediaNamespace.dataUrl} in new code.
|
|
27
22
|
*
|
|
28
23
|
* ## A media id is not a storage node id
|
|
29
24
|
*
|
|
30
|
-
* It is
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* described above. {@link isMediaId} exists to keep that straight.
|
|
25
|
+
* It is a STRING whose characters happen to all be digits (`"48211"`).
|
|
26
|
+
* Storage node ids are uuids. The two id spaces are not interchangeable, and
|
|
27
|
+
* the only reason a media id works on the `fs_nodes` path at all is the
|
|
28
|
+
* numeric branch described above. {@link isMediaId} exists to keep that
|
|
29
|
+
* straight.
|
|
36
30
|
*
|
|
37
31
|
* ## 404 NEVER 401, and why that will empty somebody's library
|
|
38
32
|
*
|
|
39
|
-
* `
|
|
40
|
-
*
|
|
33
|
+
* The server answers `404 "Not found"` for every one of these, deliberately
|
|
34
|
+
* indistinguishable:
|
|
41
35
|
*
|
|
42
36
|
* - the id does not exist;
|
|
43
37
|
* - it exists but belongs to a book, a tool output, another user;
|
|
44
38
|
* - the caller sent no credential at all;
|
|
45
39
|
* - the caller sent a credential that no longer resolves to a live session.
|
|
46
40
|
*
|
|
47
|
-
* The routes
|
|
48
|
-
*
|
|
41
|
+
* The routes accept anonymous callers, so authentication never gets a chance
|
|
42
|
+
* to answer `401`. That is correct for the server:
|
|
49
43
|
* existence must not leak. It is a TRAP for the client.
|
|
50
44
|
*
|
|
51
45
|
* A client that reads `404` as "this file is gone" will, the moment a session
|
|
@@ -59,8 +53,8 @@
|
|
|
59
53
|
*
|
|
60
54
|
* ## The rate ceilings are not the same on the two routes, and that is the point
|
|
61
55
|
*
|
|
62
|
-
*
|
|
63
|
-
* `/fs_nodes/:id/(data|zip)`, and
|
|
56
|
+
* The general rate-limit exemption covers `/media/:id/data` and
|
|
57
|
+
* `/fs_nodes/:id/(data|zip)`, and NEITHER `data_url`:
|
|
64
58
|
*
|
|
65
59
|
* - **`data` is EXEMPT** from the 600/min authenticated and 120/min anonymous
|
|
66
60
|
* ceilings, on both the canonical route and the alias. An artwork grid, a
|
|
@@ -79,12 +73,12 @@
|
|
|
79
73
|
*
|
|
80
74
|
* ## An OAuth access token cannot reach `/media/*` at all
|
|
81
75
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
76
|
+
* The canonical routes accept no OAuth scope at all: an OAuth token gets
|
|
77
|
+
* `403 {"error":"insufficient_scope"}` whatever it carries. The `/fs_nodes`
|
|
78
|
+
* alias DOES accept `storage:read` on `data`/`data_url`, so - until the
|
|
79
|
+
* canonical routes gain a scope - a token holding `storage:read` can reach
|
|
80
|
+
* music bytes through the temporary alias and not through the canonical
|
|
81
|
+
* route. That inversion is a server-side gap rather
|
|
88
82
|
* than a design decision; it is the single reason to prefer the alias, and it
|
|
89
83
|
* is expected to close. A session token or the browser cookie reaches both.
|
|
90
84
|
*
|
|
@@ -102,8 +96,7 @@
|
|
|
102
96
|
import { Resource } from "../http";
|
|
103
97
|
import type { FileOutput, RequestOptions } from "../types";
|
|
104
98
|
/**
|
|
105
|
-
*
|
|
106
|
-
* of digits.
|
|
99
|
+
* A media id: a string of digits.
|
|
107
100
|
*
|
|
108
101
|
* Typed as a plain `string` rather than a branded type because that is what
|
|
109
102
|
* every `*_media_id` field on a song, an artist and a playlist already is, and
|
|
@@ -112,7 +105,7 @@ import type { FileOutput, RequestOptions } from "../types";
|
|
|
112
105
|
export type MediaId = string;
|
|
113
106
|
/**
|
|
114
107
|
* How long a presigned URL from {@link MediaNamespace.dataUrl} stays valid:
|
|
115
|
-
* six hours
|
|
108
|
+
* six hours.
|
|
116
109
|
*
|
|
117
110
|
* The window is long because it has to be, not out of generosity. A media
|
|
118
111
|
* element re-requests the object on every seek and whenever it resumes a
|
|
@@ -123,8 +116,7 @@ export type MediaId = string;
|
|
|
123
116
|
export declare const MEDIA_URL_TTL_MS: number;
|
|
124
117
|
/**
|
|
125
118
|
* How long a browser may reuse the `302` from `GET /media/:id/data`:
|
|
126
|
-
* five minutes
|
|
127
|
-
* private`.
|
|
119
|
+
* five minutes, `Cache-Control: private`.
|
|
128
120
|
*
|
|
129
121
|
* It exists because a redirect with no `Cache-Control` is never cached, so
|
|
130
122
|
* every `<img>` re-followed the hop on every mount and artwork visibly
|
|
@@ -149,7 +141,7 @@ export declare class MediaNamespace extends Resource {
|
|
|
149
141
|
* {@link MEDIA_REDIRECT_CACHE_TTL_MS}. Do NOT put `crossorigin` on the
|
|
150
142
|
* element: it turns a no-cors load into a CORS one and re-creates exactly
|
|
151
143
|
* the failure the split between `data` and `data_url` exists to avoid.
|
|
152
|
-
* - **token mode
|
|
144
|
+
* - **token mode**: this URL alone is a `404`,
|
|
153
145
|
* because no credential reaches the server. Use
|
|
154
146
|
* {@link authenticatedUrl} instead.
|
|
155
147
|
*
|
|
@@ -166,11 +158,9 @@ export declare class MediaNamespace extends Resource {
|
|
|
166
158
|
* be a getter. In cookie mode there is no token and it returns the bare URL,
|
|
167
159
|
* which is the correct answer there.
|
|
168
160
|
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* host, it is not a redirect-injection risk here because there is no page to
|
|
173
|
-
* render as somebody else.
|
|
161
|
+
* The server reads the `Authorization` header, then the `token` query
|
|
162
|
+
* parameter, then the cookie, so a query token is a first-class credential
|
|
163
|
+
* on this route.
|
|
174
164
|
*
|
|
175
165
|
* **THE RESULT IS A LIVE CREDENTIAL.** It goes into the DOM, into the server
|
|
176
166
|
* access log, into `Referer` and into anything that records URLs; anyone
|
|
@@ -220,8 +210,8 @@ export declare class MediaNamespace extends Resource {
|
|
|
220
210
|
* @throws {OmsApiError} 404 `"Not found"` - which does NOT mean the media is
|
|
221
211
|
* gone. See {@link isMediaMissing} and the namespace notes.
|
|
222
212
|
* @throws {OmsAuthError} 403 `insufficient_scope` when the client
|
|
223
|
-
* authenticated with an OAuth access token;
|
|
224
|
-
*
|
|
213
|
+
* authenticated with an OAuth access token; the route accepts no scope, so
|
|
214
|
+
* no OAuth token reaches it.
|
|
225
215
|
*/
|
|
226
216
|
dataUrl(id: MediaId, options?: RequestOptions): Promise<string>;
|
|
227
217
|
/**
|
|
@@ -240,9 +230,8 @@ export declare class MediaNamespace extends Resource {
|
|
|
240
230
|
* to a native downloader instead, both of which stream to disk. This method
|
|
241
231
|
* is for artwork and for the odd file a host really does need in memory.
|
|
242
232
|
*
|
|
243
|
-
* The server
|
|
244
|
-
*
|
|
245
|
-
* which is what dev and test look like; both shapes arrive here identically.
|
|
233
|
+
* The server may also send the bytes inline (with a `Content-Disposition`
|
|
234
|
+
* filename) instead of redirecting; both shapes arrive here identically.
|
|
246
235
|
*
|
|
247
236
|
* The runtime follows the redirect, and every conformant one drops the
|
|
248
237
|
* `Authorization` header on the cross-origin hop. That is not a limitation to
|
|
@@ -260,18 +249,17 @@ export declare class MediaNamespace extends Resource {
|
|
|
260
249
|
* `GET /fs_nodes/:id/data` - the TEMPORARY numeric-id alias for {@link url}.
|
|
261
250
|
*
|
|
262
251
|
* Identical bytes, identical owner-or-404 rule, identical rate-limit
|
|
263
|
-
* exemption
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* carrying `storage:read` can reach (see the namespace notes).
|
|
252
|
+
* exemption. It is here for two reasons and no others: code that still
|
|
253
|
+
* spells the old route, and it is currently the only media route an OAuth
|
|
254
|
+
* token carrying `storage:read` can reach (see the namespace notes).
|
|
267
255
|
*
|
|
268
|
-
* The id must be all digits.
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
256
|
+
* The id must be all digits. The alias only serves media for an all-digit
|
|
257
|
+
* id; anything else is looked up as a storage node, which for a media id
|
|
258
|
+
* means a 404 with a completely different cause. {@link isMediaId} checks
|
|
259
|
+
* that before you spend a request finding out.
|
|
272
260
|
*
|
|
273
|
-
* @deprecated Prefer {@link url}. The
|
|
274
|
-
*
|
|
261
|
+
* @deprecated Prefer {@link url}. The alias is temporary and will be removed
|
|
262
|
+
* together with the `*_fs_node_id` twins.
|
|
275
263
|
*/
|
|
276
264
|
aliasUrl(id: MediaId): string;
|
|
277
265
|
/**
|
|
@@ -305,9 +293,9 @@ export declare function isMediaId(value: unknown): value is MediaId;
|
|
|
305
293
|
* Whether an error is a media `404`.
|
|
306
294
|
*
|
|
307
295
|
* **Read the name as "the server would not serve this", never as "this does
|
|
308
|
-
* not exist".** The media routes
|
|
309
|
-
*
|
|
310
|
-
*
|
|
296
|
+
* not exist".** The media routes accept anonymous callers and collapse five
|
|
297
|
+
* different situations into the same `404`, on purpose, so that the existence
|
|
298
|
+
* of a file never leaks: unknown id,
|
|
311
299
|
* wrong owner, non-music attachment, no credential, and a credential that has
|
|
312
300
|
* expired.
|
|
313
301
|
*
|
|
@@ -335,16 +323,15 @@ export declare function isMediaMissing(error: unknown): boolean;
|
|
|
335
323
|
*
|
|
336
324
|
* Every music record offers the same choice twice over: a compressed twin and
|
|
337
325
|
* an original, either of which may be `null`. The compressed one is what a
|
|
338
|
-
* client should reach for - the originals are lossless files
|
|
339
|
-
*
|
|
340
|
-
* fallback chain is written out by hand in every client today.
|
|
326
|
+
* client should reach for - the originals are lossless files and an album
|
|
327
|
+
* grid that asks for them takes seconds per tile.
|
|
341
328
|
*
|
|
342
329
|
* ```ts
|
|
343
330
|
* const artwork = firstMediaId(song.compressed_artwork_media_id, song.artwork_media_id);
|
|
344
331
|
* const audio = firstMediaId(song.compressed_audio_media_id, song.audio_media_id);
|
|
345
332
|
* ```
|
|
346
333
|
*
|
|
347
|
-
* Empty strings are treated as absent:
|
|
334
|
+
* Empty strings are treated as absent: the field is `null` when there
|
|
348
335
|
* is no attachment, but a form round-trip through a URL or a database can turn
|
|
349
336
|
* that into `""`, and an empty id would build a request for `/media//data`.
|
|
350
337
|
*/
|