@omelhorsite/sdk 0.1.0 → 0.3.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/README.md +1 -0
- package/dist/index.js +4957 -515
- package/dist/types/client.d.ts +75 -3
- package/dist/types/http.d.ts +462 -19
- package/dist/types/index.d.ts +4 -1
- package/dist/types/resources/account.d.ts +72 -6
- package/dist/types/resources/admin.d.ts +1837 -0
- package/dist/types/resources/auth/index.d.ts +39 -0
- package/dist/types/resources/auth/passkeys.d.ts +652 -0
- package/dist/types/resources/auth/sessions.d.ts +847 -0
- package/dist/types/resources/chests.d.ts +54 -3
- package/dist/types/resources/content.d.ts +2970 -0
- package/dist/types/resources/dynamicQrs.d.ts +39 -3
- package/dist/types/resources/forms.d.ts +176 -35
- package/dist/types/resources/index.d.ts +20 -8
- package/dist/types/resources/ipLookup.d.ts +20 -4
- package/dist/types/resources/jobs.d.ts +62 -21
- package/dist/types/resources/library.d.ts +1435 -0
- package/dist/types/resources/linkTrees.d.ts +142 -30
- package/dist/types/resources/media.d.ts +351 -0
- package/dist/types/resources/movies.d.ts +1186 -0
- package/dist/types/resources/music/artists.d.ts +1066 -0
- package/dist/types/resources/music/imports.d.ts +940 -0
- package/dist/types/resources/music/index.d.ts +61 -0
- package/dist/types/resources/music/playlists.d.ts +1026 -0
- package/dist/types/resources/music/social.d.ts +1132 -0
- package/dist/types/resources/music/songs.d.ts +1183 -0
- package/dist/types/resources/notepads.d.ts +4 -1
- package/dist/types/resources/quotas.d.ts +128 -0
- package/dist/types/resources/realtime.d.ts +855 -0
- package/dist/types/resources/shortLinks.d.ts +45 -4
- package/dist/types/resources/social.d.ts +1330 -0
- package/dist/types/resources/storage/upload.d.ts +158 -11
- package/dist/types/resources/storage.d.ts +88 -22
- package/dist/types/resources/tickets.d.ts +82 -3
- package/dist/types/resources/tools/backgroundRemoval.d.ts +18 -3
- package/dist/types/resources/tools/captions.d.ts +448 -21
- package/dist/types/resources/tools/downloader.d.ts +21 -0
- package/dist/types/resources/tools/index.d.ts +60 -16
- package/dist/types/resources/tools/jumpstyle.d.ts +50 -17
- package/dist/types/resources/tools/transcription.d.ts +35 -13
- package/dist/types/resources/tools/upscale.d.ts +23 -3
- package/dist/types/resources/tools/vocalSeparation.d.ts +30 -13
- package/dist/types/types.d.ts +249 -17
- package/package.json +6 -5
package/dist/types/client.d.ts
CHANGED
|
@@ -14,14 +14,25 @@ import type { TokenSet } from "./auth/tokens";
|
|
|
14
14
|
import { ApiClient, type TokenProvider } from "./http";
|
|
15
15
|
import { type LocalNamespace } from "./local/index";
|
|
16
16
|
import { AccountNamespace } from "./resources/account";
|
|
17
|
+
import { AdminNamespace } from "./resources/admin";
|
|
18
|
+
import { PasskeysNamespace } from "./resources/auth/passkeys";
|
|
19
|
+
import { AuthSessionsNamespace } from "./resources/auth/sessions";
|
|
17
20
|
import { ChestsNamespace } from "./resources/chests";
|
|
21
|
+
import { ContentNamespace } from "./resources/content";
|
|
18
22
|
import { DynamicQrsNamespace } from "./resources/dynamicQrs";
|
|
19
23
|
import { FormsNamespace } from "./resources/forms";
|
|
20
24
|
import { IpLookupNamespace } from "./resources/ipLookup";
|
|
21
25
|
import { JobsNamespace } from "./resources/jobs";
|
|
26
|
+
import { LibraryNamespace } from "./resources/library";
|
|
22
27
|
import { LinkTreesNamespace } from "./resources/linkTrees";
|
|
28
|
+
import { MediaNamespace } from "./resources/media";
|
|
29
|
+
import { MoviesNamespace } from "./resources/movies";
|
|
30
|
+
import { MusicNamespace } from "./resources/music/index";
|
|
23
31
|
import { NotepadsNamespace } from "./resources/notepads";
|
|
32
|
+
import { QuotasNamespace } from "./resources/quotas";
|
|
33
|
+
import { RealtimeNamespace } from "./resources/realtime";
|
|
24
34
|
import { ShortLinksNamespace } from "./resources/shortLinks";
|
|
35
|
+
import { SocialNamespace } from "./resources/social";
|
|
25
36
|
import { StorageNamespace } from "./resources/storage";
|
|
26
37
|
import { TicketsNamespace } from "./resources/tickets";
|
|
27
38
|
import { ToolsNamespace } from "./resources/tools/index";
|
|
@@ -48,6 +59,18 @@ export interface OmsOptions {
|
|
|
48
59
|
* passing both throws. Build one with `refreshingTokenProvider`.
|
|
49
60
|
*/
|
|
50
61
|
readonly tokens?: TokenProvider;
|
|
62
|
+
/**
|
|
63
|
+
* Authenticate with the browser's httpOnly session cookie instead of a
|
|
64
|
+
* token. First-party pages only, and never the default: see
|
|
65
|
+
* {@link ApiClientOptions.sessionCookie} for why it has to be asked for
|
|
66
|
+
* by name.
|
|
67
|
+
*
|
|
68
|
+
* ```ts
|
|
69
|
+
* // in the omelhorsite web app, served from the same site as the API
|
|
70
|
+
* const oms = new Oms({ sessionCookie: true });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
readonly sessionCookie?: boolean;
|
|
51
74
|
/** API root. Defaults to `https://backend.omelhorsite.pt`. */
|
|
52
75
|
readonly baseUrl?: string;
|
|
53
76
|
/**
|
|
@@ -74,10 +97,32 @@ export interface OmsOptions {
|
|
|
74
97
|
* const oms = new Oms({ token: "..." });
|
|
75
98
|
* const me = await oms.account.me();
|
|
76
99
|
* const link = await oms.shortLinks.create({ url: "https://example.com" });
|
|
100
|
+
* const songs = await oms.music.songs.list({ artist: "Nina Simone" });
|
|
101
|
+
* const cable = oms.realtime.connect({ token, socket: (u) => new WebSocket(u) });
|
|
77
102
|
* ```
|
|
78
103
|
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
104
|
+
* ## Two credentials, two namespaces
|
|
105
|
+
*
|
|
106
|
+
* `oms.sessions` mints the opaque `Session` token the website and the mobile
|
|
107
|
+
* apps use, which carries the whole account. `oms.auth` runs OAuth, whose
|
|
108
|
+
* tokens are scoped and, because `enforce_oauth_scope!` denies by omission,
|
|
109
|
+
* cannot reach most of the API at all. `oms.realtime` accepts only the first
|
|
110
|
+
* kind. Picking the wrong one shows up as a `403 insufficient_scope`, or on the
|
|
111
|
+
* cable as a connection that is silently anonymous.
|
|
112
|
+
*
|
|
113
|
+
* ## Isolate-safe
|
|
114
|
+
*
|
|
115
|
+
* No `node:*`, no environment, no stdout, and `fetch` is injectable. A file is
|
|
116
|
+
* normally a VALUE (`Blob` / `Uint8Array` / `ReadableStream`), never a path,
|
|
117
|
+
* because turning a path into bytes is the host's job.
|
|
118
|
+
*
|
|
119
|
+
* The one exception is React Native, which cannot produce a usable `Blob` from
|
|
120
|
+
* a picked file: there, pass the picker's `{ uri, name, type }`
|
|
121
|
+
* ({@link NativeFile}) straight into a form bag and the transport appends it
|
|
122
|
+
* verbatim for RN's networking layer to stream off disk. That works on
|
|
123
|
+
* multipart endpoints only - the storage direct-upload path has to read and MD5
|
|
124
|
+
* the bytes, so it rejects a `NativeFile` with a message saying so rather than
|
|
125
|
+
* failing at the object store.
|
|
81
126
|
*/
|
|
82
127
|
export declare class Oms {
|
|
83
128
|
/**
|
|
@@ -86,8 +131,12 @@ export declare class Oms {
|
|
|
86
131
|
* the SDK to add one call.
|
|
87
132
|
*/
|
|
88
133
|
readonly http: ApiClient;
|
|
89
|
-
/**
|
|
134
|
+
/** OAuth: refreshing, revoking, the RFC 8628 device grant, OIDC discovery. */
|
|
90
135
|
readonly auth: AuthNamespace;
|
|
136
|
+
/** Password sign-in, sign-up, and the emailed six-digit ceremonies. */
|
|
137
|
+
readonly sessions: AuthSessionsNamespace;
|
|
138
|
+
/** WebAuthn credentials: register one, sign in with one, list, revoke. */
|
|
139
|
+
readonly passkeys: PasskeysNamespace;
|
|
91
140
|
/** The signed-in user, their profile, and their usage report. */
|
|
92
141
|
readonly account: AccountNamespace;
|
|
93
142
|
/** Support tickets and their message threads. */
|
|
@@ -110,8 +159,31 @@ export declare class Oms {
|
|
|
110
159
|
readonly linkTrees: LinkTreesNamespace;
|
|
111
160
|
/** Background jobs: listing, polling and watching. There is no cancel. */
|
|
112
161
|
readonly jobs: JobsNamespace;
|
|
162
|
+
/** Every ceiling on the account - tools, storage and music - in one call. */
|
|
163
|
+
readonly quotas: QuotasNamespace;
|
|
113
164
|
/** The metered media tools, each with its own daily quota. */
|
|
114
165
|
readonly tools: ToolsNamespace;
|
|
166
|
+
/** Songs, artists, playlists, imports, jams and the music assistant. */
|
|
167
|
+
readonly music: MusicNamespace;
|
|
168
|
+
/** The canonical bytes of the music library, by media id. */
|
|
169
|
+
readonly media: MediaNamespace;
|
|
170
|
+
/** Direct messages, friendships and blocks, group chats. */
|
|
171
|
+
readonly social: SocialNamespace;
|
|
172
|
+
/** The book library: uploads, shelves, annotations, the study assistant. */
|
|
173
|
+
readonly library: LibraryNamespace;
|
|
174
|
+
/** Stremio addons, collections and watch progress. Session credential only. */
|
|
175
|
+
readonly movies: MoviesNamespace;
|
|
176
|
+
/** Blogs, notifications, feedback, jokes, site config and the status page. */
|
|
177
|
+
readonly content: ContentNamespace;
|
|
178
|
+
/** OAuth client registration for anyone, plus the `/admin/*` routes. */
|
|
179
|
+
readonly admin: AdminNamespace;
|
|
180
|
+
/**
|
|
181
|
+
* The ActionCable connection: playback handoff, jams, notifications, job
|
|
182
|
+
* progress. Opens nothing until {@link RealtimeNamespace.connect} is called,
|
|
183
|
+
* and wants a `Session` token rather than the client's own credential - see
|
|
184
|
+
* that method for why.
|
|
185
|
+
*/
|
|
186
|
+
readonly realtime: RealtimeNamespace;
|
|
115
187
|
/**
|
|
116
188
|
* Pure client-side helpers that touch no network and need no credential
|
|
117
189
|
* (password generation, QR encoding). Also exported standalone as `local`,
|