@omelhorsite/sdk 0.2.0 → 0.4.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 (96) hide show
  1. package/README.md +112 -130
  2. package/dist/index.js +4800 -610
  3. package/dist/types/client.d.ts +60 -3
  4. package/dist/types/http.d.ts +444 -19
  5. package/dist/types/index.d.ts +5 -1
  6. package/dist/types/internal/attachments.d.ts +17 -0
  7. package/dist/types/internal/helpers.d.ts +9 -0
  8. package/dist/types/listing.d.ts +90 -0
  9. package/dist/types/resources/account.d.ts +71 -5
  10. package/dist/types/resources/admin/authorizedApplications.d.ts +133 -0
  11. package/dist/types/resources/admin/chests.d.ts +51 -0
  12. package/dist/types/resources/admin/eventAlerts.d.ts +60 -0
  13. package/dist/types/resources/admin/identities.d.ts +99 -0
  14. package/dist/types/resources/admin/index.d.ts +77 -0
  15. package/dist/types/resources/admin/jobs.d.ts +97 -0
  16. package/dist/types/resources/admin/myOauthApplications.d.ts +282 -0
  17. package/dist/types/resources/admin/notepads.d.ts +49 -0
  18. package/dist/types/resources/admin/oauthApplications.d.ts +309 -0
  19. package/dist/types/resources/admin/quotas.d.ts +114 -0
  20. package/dist/types/resources/admin/shortLinks.d.ts +201 -0
  21. package/dist/types/resources/admin/types.d.ts +222 -0
  22. package/dist/types/resources/admin/vocalSeparations.d.ts +98 -0
  23. package/dist/types/resources/admin.d.ts +1841 -0
  24. package/dist/types/resources/auth/index.d.ts +39 -0
  25. package/dist/types/resources/auth/passkeys.d.ts +652 -0
  26. package/dist/types/resources/auth/sessions.d.ts +844 -0
  27. package/dist/types/resources/chests.d.ts +54 -3
  28. package/dist/types/resources/content/analysis.d.ts +62 -0
  29. package/dist/types/resources/content/blogs.d.ts +471 -0
  30. package/dist/types/resources/content/feedbacks.d.ts +263 -0
  31. package/dist/types/resources/content/index.d.ts +52 -0
  32. package/dist/types/resources/content/intel/articles.d.ts +230 -0
  33. package/dist/types/resources/content/intel/config.d.ts +135 -0
  34. package/dist/types/resources/content/intel/index.d.ts +53 -0
  35. package/dist/types/resources/content/intel/items.d.ts +91 -0
  36. package/dist/types/resources/content/intel/reports.d.ts +108 -0
  37. package/dist/types/resources/content/intel/scripts.d.ts +152 -0
  38. package/dist/types/resources/content/intel/sources.d.ts +236 -0
  39. package/dist/types/resources/content/intel/stats.d.ts +105 -0
  40. package/dist/types/resources/content/intel/types.d.ts +86 -0
  41. package/dist/types/resources/content/jokes.d.ts +93 -0
  42. package/dist/types/resources/content/notifications.d.ts +147 -0
  43. package/dist/types/resources/content/serviceUsages.d.ts +73 -0
  44. package/dist/types/resources/content/servicesStatus.d.ts +194 -0
  45. package/dist/types/resources/content/siteConfig.d.ts +43 -0
  46. package/dist/types/resources/content/spaceInvaders.d.ts +154 -0
  47. package/dist/types/resources/content.d.ts +2775 -0
  48. package/dist/types/resources/dynamicQrs.d.ts +39 -3
  49. package/dist/types/resources/forms.d.ts +176 -35
  50. package/dist/types/resources/index.d.ts +19 -8
  51. package/dist/types/resources/ipLookup.d.ts +20 -4
  52. package/dist/types/resources/jobs.d.ts +69 -25
  53. package/dist/types/resources/library/annotations.d.ts +162 -0
  54. package/dist/types/resources/library/books.d.ts +534 -0
  55. package/dist/types/resources/library/chat.d.ts +259 -0
  56. package/dist/types/resources/library/index.d.ts +39 -0
  57. package/dist/types/resources/library/shelves.d.ts +237 -0
  58. package/dist/types/resources/library/types.d.ts +120 -0
  59. package/dist/types/resources/library.d.ts +1433 -0
  60. package/dist/types/resources/linkTrees.d.ts +142 -30
  61. package/dist/types/resources/media.d.ts +351 -0
  62. package/dist/types/resources/movies/addons.d.ts +388 -0
  63. package/dist/types/resources/movies/collections.d.ts +352 -0
  64. package/dist/types/resources/movies/index.d.ts +29 -0
  65. package/dist/types/resources/movies/types.d.ts +50 -0
  66. package/dist/types/resources/movies/watchProgress.d.ts +277 -0
  67. package/dist/types/resources/movies.d.ts +1160 -0
  68. package/dist/types/resources/music/artists.d.ts +1068 -0
  69. package/dist/types/resources/music/imports.d.ts +941 -0
  70. package/dist/types/resources/music/index.d.ts +61 -0
  71. package/dist/types/resources/music/playlists.d.ts +1027 -0
  72. package/dist/types/resources/music/social.d.ts +1132 -0
  73. package/dist/types/resources/music/songs.d.ts +1167 -0
  74. package/dist/types/resources/notepads.d.ts +4 -1
  75. package/dist/types/resources/quotas.d.ts +7 -1
  76. package/dist/types/resources/realtime.d.ts +855 -0
  77. package/dist/types/resources/shortLinks.d.ts +49 -5
  78. package/dist/types/resources/social/groupChats.d.ts +458 -0
  79. package/dist/types/resources/social/index.d.ts +19 -0
  80. package/dist/types/resources/social/messages.d.ts +424 -0
  81. package/dist/types/resources/social/relationships.d.ts +322 -0
  82. package/dist/types/resources/social/types.d.ts +37 -0
  83. package/dist/types/resources/social.d.ts +1348 -0
  84. package/dist/types/resources/storage/upload.d.ts +158 -11
  85. package/dist/types/resources/storage.d.ts +111 -27
  86. package/dist/types/resources/tickets.d.ts +101 -13
  87. package/dist/types/resources/tools/backgroundRemoval.d.ts +18 -3
  88. package/dist/types/resources/tools/captions.d.ts +448 -21
  89. package/dist/types/resources/tools/downloader.d.ts +21 -0
  90. package/dist/types/resources/tools/index.d.ts +57 -15
  91. package/dist/types/resources/tools/jumpstyle.d.ts +50 -17
  92. package/dist/types/resources/tools/transcription.d.ts +35 -13
  93. package/dist/types/resources/tools/upscale.d.ts +23 -3
  94. package/dist/types/resources/tools/vocalSeparation.d.ts +30 -13
  95. package/dist/types/types.d.ts +249 -17
  96. package/package.json +2 -1
@@ -0,0 +1,222 @@
1
+ /** Shapes, constants and helpers shared by more than one `admin` module. */
2
+ import type { Id, Timestamp } from "../../types";
3
+ /**
4
+ * Where a client sits in the review queue.
5
+ *
6
+ * There is no fourth state and in particular there is no "suspended": pulling
7
+ * an approved client back off the air is `"rejected"`, which is why
8
+ * {@link AdminOauthApplicationsNamespace.reject} accepts a client that was
9
+ * already approved.
10
+ *
11
+ * A database check constraint pins the column to exactly these three, so this
12
+ * union is closed rather than widened to `string`.
13
+ */
14
+ export type OauthApprovalStatus = "pending" | "approved" | "rejected";
15
+ /** Every value {@link OauthApprovalStatus} can take, for building filters. */
16
+ export declare const OAUTH_APPROVAL_STATUSES: readonly OauthApprovalStatus[];
17
+ /**
18
+ * A person attached to a client: its owner, or the administrator who decided.
19
+ *
20
+ * Three keys and no more. This is not the full user record, precisely so that
21
+ * reviewing a client does not leak an email address or a session count into an
22
+ * admin panel.
23
+ */
24
+ export interface OauthApplicationParty {
25
+ /** User id. A string, like every user id in this API. */
26
+ readonly id: Id;
27
+ readonly handle: string;
28
+ /** Display name. `null` for an account that never set one. */
29
+ readonly name: string | null;
30
+ }
31
+ /**
32
+ * The shape both halves render for a registered OAuth client.
33
+ *
34
+ * The owner routes and the administrator routes emit the same eleven keys on
35
+ * purpose, so one renderer works on both surfaces. The differences are in the
36
+ * VALUES, not the keys, and there are exactly two:
37
+ *
38
+ * - `approved_by` is hardcoded `null` on the owner routes. Which administrator
39
+ * decided what is deliberately withheld from the applicant, so read it as
40
+ * "not disclosed", not as "nobody approved it";
41
+ * - the owner routes only ever show you your own rows, so `owner` there is
42
+ * always you.
43
+ */
44
+ export interface OauthApplicationSummary {
45
+ /**
46
+ * Primary key, and an **integer**: one of the handful of ids in this API that
47
+ * is not a string. Do not compare it against an {@link Id}.
48
+ */
49
+ readonly id: number;
50
+ /** The public `client_id`, i.e. the `uid` column. Not a secret. */
51
+ readonly client_id: string;
52
+ /** What the consent screen renders. At most 60 characters. */
53
+ readonly name: string;
54
+ /**
55
+ * Already split: what arrives here is an array and never needs splitting.
56
+ *
57
+ * An EMPTY array would be dangerous rather than harmless - on the server a
58
+ * blank scopes column means "every scope the server has", not "none" - which
59
+ * is why both write paths refuse to save one.
60
+ */
61
+ readonly scopes: string[];
62
+ /**
63
+ * `true` for a client that holds a secret. Frozen after registration: see
64
+ * {@link MyOauthApplicationsNamespace.update} for why neither direction is
65
+ * editable.
66
+ */
67
+ readonly confidential: boolean;
68
+ /**
69
+ * Every registered redirect URI, in ONE space-separated string, exactly as
70
+ * the server stores it. Use {@link splitRedirectUris} rather than reading it
71
+ * raw.
72
+ *
73
+ * Matching at the authorization endpoint is exact - no wildcards, no prefix
74
+ * match, no fragment - so a URI that looks nearly right matches nothing.
75
+ */
76
+ readonly redirect_uri: string;
77
+ readonly approval_status: OauthApprovalStatus;
78
+ /** When it was approved, `null` while pending or rejected. */
79
+ readonly approved_at: Timestamp | null;
80
+ /** The reason shown to the owner. `null` unless rejected. At most 500 characters. */
81
+ readonly rejection_reason: string | null;
82
+ /**
83
+ * Who registered it. `null` for the clients this project ships itself
84
+ * (`owner_id` is deliberately NULL for those) **and** for a client whose
85
+ * owner deleted their account.
86
+ *
87
+ * Because those two cases are indistinguishable here, `owner === null` is
88
+ * NOT a trust signal. See {@link isShippedClient}.
89
+ */
90
+ readonly owner: OauthApplicationParty | null;
91
+ /**
92
+ * The administrator who approved it, or `null`.
93
+ *
94
+ * Always `null` on {@link MyOauthApplicationsNamespace} regardless of the
95
+ * truth. Populated on {@link AdminOauthApplicationsNamespace}.
96
+ */
97
+ readonly approved_by: OauthApplicationParty | null;
98
+ readonly created_at: Timestamp;
99
+ }
100
+ /** The longest name the server accepts, measured after normalisation. */
101
+ export declare const OAUTH_APP_NAME_MAX_LENGTH = 60;
102
+ /**
103
+ * How many of ONE person's clients may sit in the review queue at once. The
104
+ * sixth answers `429 too_many_pending`, and so does an edit that would send a
105
+ * sixth approved client back into the queue. Deleting a pending client frees
106
+ * its slot immediately.
107
+ */
108
+ export declare const OAUTH_APP_MAX_PENDING = 5;
109
+ /** The most redirect URIs one client may register. More than this is `400 redirect_uri_excessive`. */
110
+ export declare const OAUTH_REDIRECT_URI_MAX_COUNT = 8;
111
+ /** The longest `redirect_uri` value the server accepts, counted across the whole space-separated string. */
112
+ export declare const OAUTH_REDIRECT_URI_MAX_LENGTH = 1024;
113
+ /**
114
+ * What a blank `redirect_uri` registers.
115
+ *
116
+ * RFC 8252 section 7.3. No port, because the client listens on an ephemeral one
117
+ * and the server drops the port from both sides before comparing, so
118
+ * `http://127.0.0.1:49731/callback` matches the first entry.
119
+ *
120
+ * Both literals, because `127.0.0.1` and `[::1]` are two different hosts to
121
+ * that comparison and an IPv6-only machine can only bind the second.
122
+ * `localhost` is deliberately absent and registering it is a mistake: the
123
+ * server does not treat a name as loopback and would then demand an exact port
124
+ * match, which is the one thing an ephemeral port cannot promise.
125
+ */
126
+ export declare const NATIVE_LOOPBACK_REDIRECT_URIS: readonly string[];
127
+ /** {@link NATIVE_LOOPBACK_REDIRECT_URIS} as the single column value the server stores. */
128
+ export declare const NATIVE_LOOPBACK_REDIRECT_VALUE = "http://127.0.0.1/callback http://[::1]/callback";
129
+ /**
130
+ * The `client_id`s this project ships itself.
131
+ *
132
+ * Pinned constants rather than values generated per environment, so matching on
133
+ * them is stable across dev, CI and production.
134
+ */
135
+ export declare const SHIPPED_CLIENT_IDS: readonly string[];
136
+ /**
137
+ * True for a client this project ships, by `client_id`.
138
+ *
139
+ * **Use this, not `owner === null`.** A NULL owner means two very different
140
+ * things - "registered by the operator" and "orphaned when its owner deleted
141
+ * their account" - and calling an orphan official is exactly the lie the whole
142
+ * review gate exists to prevent. The server draws the same distinction, and the
143
+ * consent screen uses the pinned list too.
144
+ */
145
+ export declare function isShippedClient(application: {
146
+ readonly client_id: string;
147
+ }): boolean;
148
+ /**
149
+ * Splits the one space-separated `redirect_uri` column into the URIs it holds.
150
+ *
151
+ * The server keeps every registered redirect URI in a single column. Splitting
152
+ * on whitespace is exactly what the server does on the way in, so what comes
153
+ * back out is what was registered, character for character.
154
+ */
155
+ export declare function splitRedirectUris(value: string | null | undefined): string[];
156
+ /**
157
+ * Normalises a redirect URI list the way the server will store it.
158
+ *
159
+ * Split, trim, de-duplicate, join with single spaces. **Nothing else.** No
160
+ * trailing slash is added or removed, no scheme is upgraded, no case is folded:
161
+ * redirect matching is exact, so quietly "fixing" a URI would register
162
+ * something the client can never match and the failure would only appear at the
163
+ * end of a login attempt.
164
+ *
165
+ * A blank result means the server will register
166
+ * {@link NATIVE_LOOPBACK_REDIRECT_VALUE}, which is what
167
+ * {@link registeredRedirectUris} makes explicit.
168
+ */
169
+ export declare function normalizeRedirectUris(raw: string | null | undefined): string;
170
+ /**
171
+ * What the server will actually store for this input, blank included.
172
+ *
173
+ * Use it to compare a form against a record: an empty field and a field holding
174
+ * the loopback pair register the same value, so comparing the raw strings would
175
+ * report a change that is not one.
176
+ */
177
+ export declare function registeredRedirectUris(raw: string | null | undefined): string;
178
+ /**
179
+ * Predicts whether an edit will send an APPROVED client back to the review
180
+ * queue, before the call is made.
181
+ *
182
+ * Losing an approval without being told is the difference between "I did that"
183
+ * and "this is broken": the client keeps its `client_id`, keeps working for
184
+ * about as long as its live tokens last, and then starts answering
185
+ * `invalid_client` with nothing in the request to explain it. Warn first.
186
+ *
187
+ * The rule reproduced here is:
188
+ *
189
+ * - a client that is not `approved` cannot be sent back to a queue it is
190
+ * already in, so this is always `false` for `pending` and `rejected`;
191
+ * - **any** change of name requeues. The name is what the consent screen shows;
192
+ * - **widening** scopes requeues. Narrowing does not: asking for less than what
193
+ * was already reviewed has nothing left to review;
194
+ * - **any** move of the redirect URI requeues, in either direction. There is no
195
+ * "narrower" destination - a different destination is a different
196
+ * destination, and it is where the authorization code gets delivered.
197
+ *
198
+ * This is a prediction, not the enforcement. The server decides, and the
199
+ * `approval_status` on the response is the answer.
200
+ */
201
+ export declare function editWouldRequeue(application: OauthApplicationSummary, next: {
202
+ readonly name: string;
203
+ readonly scopes: readonly string[];
204
+ readonly redirectUris: string;
205
+ }): boolean;
206
+ /**
207
+ * One day of a 30 day series.
208
+ *
209
+ * Every daily series on the administrator surface has **exactly 30 entries,
210
+ * oldest first, ending today**, with `count: 0` filled in for days that had
211
+ * nothing. The series is safe to plot without gap filling, and the window is
212
+ * fixed server-side: there is no parameter to widen it.
213
+ *
214
+ * Structurally identical to `ShortLinkDailyClicks` from the `shortLinks`
215
+ * namespace, and kept separate because half the series here count creations
216
+ * rather than clicks.
217
+ */
218
+ export interface AdminDailyCount {
219
+ /** `YYYY-MM-DD`. */
220
+ readonly date: string;
221
+ readonly count: number;
222
+ }
@@ -0,0 +1,98 @@
1
+ /** `oms.admin.vocalSeparations` - every separation run on the server. Administrators only. */
2
+ import type { VocalSeparation } from "../tools/vocalSeparation";
3
+ import { Resource } from "../../http";
4
+ import type { ListParams } from "../../listing";
5
+ import type { Id, Paginated, RequestOptions } from "../../types";
6
+ /**
7
+ * A separation run as the admin surface renders it.
8
+ *
9
+ * The same shape the tool namespace reads, so the type is the same:
10
+ * every key of {@link VocalSeparation}, `user_id` and `ip_address` included.
11
+ * What changes is the SCOPE - an administrator sees every run on the server
12
+ * rather than their own.
13
+ */
14
+ export type AdminVocalSeparation = VocalSeparation;
15
+ /** Filter columns of `GET /admin/vocal_separations`. */
16
+ export declare const ADMIN_VOCAL_SEPARATION_FILTER_COLUMNS: readonly ["id", "status", "model_id", "created_at", "finished_at", "user_id", "song_id"];
17
+ /** Filters for {@link AdminVocalSeparationsNamespace.list}. */
18
+ export interface ListAdminVocalSeparationsParams extends ListParams<(typeof ADMIN_VOCAL_SEPARATION_FILTER_COLUMNS)[number]> {
19
+ /** Exact status. An array becomes an `IN`. */
20
+ readonly status?: string | readonly string[];
21
+ /** Exact model id. An array becomes an `IN`. */
22
+ readonly modelId?: string | readonly string[];
23
+ /**
24
+ * `"song"` for runs started from the music library, `"tool"` for uploads.
25
+ *
26
+ * A top-level parameter, not a search bucket: the server turns it into a
27
+ * `song_id IS NOT NULL` test. Omitting it means both.
28
+ */
29
+ readonly source?: "song" | "tool";
30
+ /** `exact_search[user_id]`. */
31
+ readonly userId?: Id;
32
+ /** `modifiers[order]`. Defaults to `"created_at:desc"`. */
33
+ readonly order?: string;
34
+ }
35
+ /**
36
+ * `oms.admin.vocalSeparations` - **administrators only**. Every separation run
37
+ * on the server.
38
+ *
39
+ * The unprivileged half is `oms.tools.vocalSeparation`, which is scoped to the
40
+ * caller's own runs and the songs they own.
41
+ */
42
+ export declare class AdminVocalSeparationsNamespace extends Resource {
43
+ /**
44
+ * `GET /admin/vocal_separations` - every run, newest first.
45
+ *
46
+ * A bare JSON array through the generic list DSL, with ETag and `304`.
47
+ *
48
+ * **This listing is not cheap and the cost is not in the database.** The
49
+ * server computes `progress_percent` by calling the separator sidecar,
50
+ * synchronously, ONCE PER ROW THAT IS `"processing"`. A page with twenty live
51
+ * runs is twenty sidecar round trips inside one request, and if the sidecar
52
+ * is slow or down the whole listing is slow with it. Filter to terminal
53
+ * statuses when you only want history, and keep the page size modest when you
54
+ * are polling a dashboard.
55
+ *
56
+ * @throws {OmsAuthError} 403 for a non-admin.
57
+ */
58
+ list(params?: ListAdminVocalSeparationsParams, options?: RequestOptions): Promise<Paginated<AdminVocalSeparation>>;
59
+ /**
60
+ * `GET /admin/vocal_separations/:id` - one run, anybody's.
61
+ *
62
+ * @throws {OmsApiError} 404 `"Resource not found"`.
63
+ * @throws {OmsAuthError} 403 for a non-admin.
64
+ */
65
+ get(id: Id, options?: RequestOptions): Promise<AdminVocalSeparation>;
66
+ /**
67
+ * `POST /admin/vocal_separations/:id/cancel` - stops a run.
68
+ *
69
+ * **The row lands on `"failed"`, not on a cancelled status, and there is no
70
+ * cancelled status for a separation.** The `error` field is set to
71
+ * `"Canceled by admin"` and that string is the only way to tell an
72
+ * administrative stop from a genuine failure. Anything counting failures will
73
+ * count this, so match on the message if that matters.
74
+ *
75
+ * A run attached to a song also clears that song's
76
+ * `vocal_separation_started_at`, which is what lets the owner start a new
77
+ * separation instead of being told one is already running.
78
+ *
79
+ * Like every cancel in this API, it marks the row rather than reaching into
80
+ * the worker.
81
+ *
82
+ * @throws {OmsApiError} 400 `"Already terminal"`; 404 `"Resource not found"`.
83
+ * @throws {OmsAuthError} 403 for a non-admin.
84
+ */
85
+ cancel(id: Id, options?: RequestOptions): Promise<AdminVocalSeparation>;
86
+ /**
87
+ * `DELETE /admin/vocal_separations/:id` - deletes a run. Answers `204`, empty.
88
+ *
89
+ * The stems go with it: the attached audio is destroyed with the row, and a
90
+ * complete run's download URLs stop working immediately. Deleting a run that
91
+ * is still processing does not stop the worker, it removes the row the worker
92
+ * is going to write to.
93
+ *
94
+ * @throws {OmsApiError} 404 `"Resource not found"`.
95
+ * @throws {OmsAuthError} 403 for a non-admin.
96
+ */
97
+ destroy(id: Id, options?: RequestOptions): Promise<void>;
98
+ }