@omelhorsite/sdk 0.2.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 (44) hide show
  1. package/dist/index.js +4939 -552
  2. package/dist/types/client.d.ts +60 -3
  3. package/dist/types/http.d.ts +444 -19
  4. package/dist/types/index.d.ts +4 -1
  5. package/dist/types/resources/account.d.ts +66 -3
  6. package/dist/types/resources/admin.d.ts +1837 -0
  7. package/dist/types/resources/auth/index.d.ts +39 -0
  8. package/dist/types/resources/auth/passkeys.d.ts +652 -0
  9. package/dist/types/resources/auth/sessions.d.ts +847 -0
  10. package/dist/types/resources/chests.d.ts +54 -3
  11. package/dist/types/resources/content.d.ts +2970 -0
  12. package/dist/types/resources/dynamicQrs.d.ts +39 -3
  13. package/dist/types/resources/forms.d.ts +176 -35
  14. package/dist/types/resources/index.d.ts +19 -8
  15. package/dist/types/resources/ipLookup.d.ts +20 -4
  16. package/dist/types/resources/jobs.d.ts +62 -21
  17. package/dist/types/resources/library.d.ts +1435 -0
  18. package/dist/types/resources/linkTrees.d.ts +142 -30
  19. package/dist/types/resources/media.d.ts +351 -0
  20. package/dist/types/resources/movies.d.ts +1186 -0
  21. package/dist/types/resources/music/artists.d.ts +1066 -0
  22. package/dist/types/resources/music/imports.d.ts +940 -0
  23. package/dist/types/resources/music/index.d.ts +61 -0
  24. package/dist/types/resources/music/playlists.d.ts +1026 -0
  25. package/dist/types/resources/music/social.d.ts +1132 -0
  26. package/dist/types/resources/music/songs.d.ts +1183 -0
  27. package/dist/types/resources/notepads.d.ts +4 -1
  28. package/dist/types/resources/quotas.d.ts +7 -1
  29. package/dist/types/resources/realtime.d.ts +855 -0
  30. package/dist/types/resources/shortLinks.d.ts +45 -4
  31. package/dist/types/resources/social.d.ts +1330 -0
  32. package/dist/types/resources/storage/upload.d.ts +158 -11
  33. package/dist/types/resources/storage.d.ts +88 -22
  34. package/dist/types/resources/tickets.d.ts +82 -3
  35. package/dist/types/resources/tools/backgroundRemoval.d.ts +18 -3
  36. package/dist/types/resources/tools/captions.d.ts +448 -21
  37. package/dist/types/resources/tools/downloader.d.ts +21 -0
  38. package/dist/types/resources/tools/index.d.ts +57 -15
  39. package/dist/types/resources/tools/jumpstyle.d.ts +50 -17
  40. package/dist/types/resources/tools/transcription.d.ts +35 -13
  41. package/dist/types/resources/tools/upscale.d.ts +23 -3
  42. package/dist/types/resources/tools/vocalSeparation.d.ts +30 -13
  43. package/dist/types/types.d.ts +249 -17
  44. package/package.json +2 -1
@@ -283,11 +283,74 @@ export declare class AccountNamespace extends Resource {
283
283
  /**
284
284
  * `GET /users/:id/picture` - the avatar bytes.
285
285
  *
286
- * Answers 302 towards object storage and `fetch` follows it; the platform
287
- * drops `Authorization` on the cross-origin hop, so the credential never
288
- * 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.
289
320
  */
290
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;
291
354
  /** `POST /users/:id/follow` - returns the followed user's updated profile. */
292
355
  follow(id: Id, options?: RequestOptions): Promise<UserProfile>;
293
356
  /**