@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.
Files changed (45) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +4957 -515
  3. package/dist/types/client.d.ts +75 -3
  4. package/dist/types/http.d.ts +462 -19
  5. package/dist/types/index.d.ts +4 -1
  6. package/dist/types/resources/account.d.ts +72 -6
  7. package/dist/types/resources/admin.d.ts +1837 -0
  8. package/dist/types/resources/auth/index.d.ts +39 -0
  9. package/dist/types/resources/auth/passkeys.d.ts +652 -0
  10. package/dist/types/resources/auth/sessions.d.ts +847 -0
  11. package/dist/types/resources/chests.d.ts +54 -3
  12. package/dist/types/resources/content.d.ts +2970 -0
  13. package/dist/types/resources/dynamicQrs.d.ts +39 -3
  14. package/dist/types/resources/forms.d.ts +176 -35
  15. package/dist/types/resources/index.d.ts +20 -8
  16. package/dist/types/resources/ipLookup.d.ts +20 -4
  17. package/dist/types/resources/jobs.d.ts +62 -21
  18. package/dist/types/resources/library.d.ts +1435 -0
  19. package/dist/types/resources/linkTrees.d.ts +142 -30
  20. package/dist/types/resources/media.d.ts +351 -0
  21. package/dist/types/resources/movies.d.ts +1186 -0
  22. package/dist/types/resources/music/artists.d.ts +1066 -0
  23. package/dist/types/resources/music/imports.d.ts +940 -0
  24. package/dist/types/resources/music/index.d.ts +61 -0
  25. package/dist/types/resources/music/playlists.d.ts +1026 -0
  26. package/dist/types/resources/music/social.d.ts +1132 -0
  27. package/dist/types/resources/music/songs.d.ts +1183 -0
  28. package/dist/types/resources/notepads.d.ts +4 -1
  29. package/dist/types/resources/quotas.d.ts +128 -0
  30. package/dist/types/resources/realtime.d.ts +855 -0
  31. package/dist/types/resources/shortLinks.d.ts +45 -4
  32. package/dist/types/resources/social.d.ts +1330 -0
  33. package/dist/types/resources/storage/upload.d.ts +158 -11
  34. package/dist/types/resources/storage.d.ts +88 -22
  35. package/dist/types/resources/tickets.d.ts +82 -3
  36. package/dist/types/resources/tools/backgroundRemoval.d.ts +18 -3
  37. package/dist/types/resources/tools/captions.d.ts +448 -21
  38. package/dist/types/resources/tools/downloader.d.ts +21 -0
  39. package/dist/types/resources/tools/index.d.ts +60 -16
  40. package/dist/types/resources/tools/jumpstyle.d.ts +50 -17
  41. package/dist/types/resources/tools/transcription.d.ts +35 -13
  42. package/dist/types/resources/tools/upscale.d.ts +23 -3
  43. package/dist/types/resources/tools/vocalSeparation.d.ts +30 -13
  44. package/dist/types/types.d.ts +249 -17
  45. package/package.json +6 -5
@@ -126,9 +126,12 @@ export interface AccountStorageUsage {
126
126
  /**
127
127
  * `GET /account/usage`: what the account has spent, per area.
128
128
  *
129
- * This is a bespoke report, not the daily tool quotas - each metered tool
130
- * reports its own ceiling through its `quota()` call. There is also a row
131
- * ceiling (250 000 nodes) that this report does not carry.
129
+ * This is a bespoke report, not a quota answer: it carries breakdowns nothing
130
+ * else has (the biggest files, the extension histogram) and it does NOT carry
131
+ * every ceiling - the row ceiling on the file tree and the music byte ceiling
132
+ * are absent from it. For ceilings, ask `oms.quotas.list()`, which answers all
133
+ * of them in one call; each metered tool also still reports its own through
134
+ * its `quota()`.
132
135
  */
133
136
  export interface AccountUsage {
134
137
  readonly user: {
@@ -280,11 +283,74 @@ export declare class AccountNamespace extends Resource {
280
283
  /**
281
284
  * `GET /users/:id/picture` - the avatar bytes.
282
285
  *
283
- * Answers 302 towards object storage and `fetch` follows it; the platform
284
- * drops `Authorization` on the cross-origin hop, so the credential never
285
- * reaches the storage host. Answers 404 when the user has no avatar.
286
+ * SENT WITH NO CREDENTIAL AT ALL, and that is the point of this method rather
287
+ * than an oversight.
288
+ *
289
+ * The endpoint is anonymous by design: `UsersController` lists `picture` in
290
+ * `allow_unauthenticated_access`, and `User.viewable_by` is `->(user) { all }`,
291
+ * so a signed-in caller and a stranger resolve the same row and get the same
292
+ * bytes. Sending a credential buys nothing, and it is what breaks the call.
293
+ *
294
+ * Why it breaks. The action answers `302` to `minio.omelhorsite.pt` with a
295
+ * presigned URL, and `fetch` follows that hop. Per the Fetch standard, when a
296
+ * CORS request is redirected cross-origin and the request's origin already
297
+ * differs from the current URL's origin, the origin is replaced by an opaque
298
+ * one - so the second hop reaches the store with `Origin: null`. MinIO
299
+ * answers a null origin with `Access-Control-Allow-Origin: *`. A wildcard is
300
+ * illegal for a credentialed request no matter what
301
+ * `Access-Control-Allow-Credentials` says, so a client built with
302
+ * `sessionCookie: true` - the production web app - would have the browser
303
+ * reject the response before any JavaScript saw it. Every avatar on the page
304
+ * would fail, and fail as an opaque "Failed to fetch".
305
+ *
306
+ * Dropping the credential removes the wildcard problem entirely: an
307
+ * uncredentialed request accepts `*`, so this behaves identically in a
308
+ * browser, in Bun and in a Worker, in cookie mode and in token mode.
309
+ *
310
+ * Going around the transport costs the usual thing, the same trade
311
+ * `storage.download` makes: no retry, no per-call deadline, and only the
312
+ * caller's `signal` is honoured.
313
+ *
314
+ * Prefer {@link pictureUrl} when the avatar is going into an `<img>`. This
315
+ * method is for when the bytes themselves are wanted - a re-upload, a cache,
316
+ * a file written to disk.
317
+ *
318
+ * @throws {OmsApiError} 404 when the user does not exist OR has no avatar
319
+ * attached. The two are not distinguishable from the status alone.
286
320
  */
287
321
  picture(id: Id, options?: RequestOptions): Promise<Blob>;
322
+ /**
323
+ * Absolute URL of a user's avatar, for an `<img>`, a CSS `background-image`,
324
+ * or anywhere else the platform fetches the bytes for you.
325
+ *
326
+ * Synchronous, and it has to stay that way. This gets called once per row
327
+ * while rendering a friends list, a member picker or a message thread; an
328
+ * async URL would turn every avatar into a state update and a second paint.
329
+ *
330
+ * It can be synchronous because the route carries no credential: `picture` is
331
+ * in `allow_unauthenticated_access` and `User.viewable_by` is `all`, so there
332
+ * is nothing to resolve and nothing to leak. The URL is safe to put in
333
+ * markup, to log, and to hand to someone else.
334
+ *
335
+ * ```tsx
336
+ * <img src={oms.account.pictureUrl(user.id)} alt={user.handle} />
337
+ * ```
338
+ *
339
+ * Do NOT add a `crossorigin` attribute. Without one the element makes a
340
+ * no-cors request and the `302` to the object store is followed with no CORS
341
+ * check at all, which is why this path has always worked in the web app.
342
+ * `crossorigin="use-credentials"` re-creates exactly the failure
343
+ * {@link picture} documents, and `crossorigin="anonymous"` only buys the
344
+ * ability to read the pixels back out of a canvas.
345
+ *
346
+ * A user with no avatar answers 404, so give the element an `onError` that
347
+ * falls back to initials rather than assuming every id has an image.
348
+ *
349
+ * The `302` itself carries `Cache-Control: private, max-age=300` while the
350
+ * presigned target is good for six hours, so a re-render inside five minutes
351
+ * costs nothing and a cached redirect can never outlive its signature.
352
+ */
353
+ pictureUrl(id: Id): string;
288
354
  /** `POST /users/:id/follow` - returns the followed user's updated profile. */
289
355
  follow(id: Id, options?: RequestOptions): Promise<UserProfile>;
290
356
  /**