@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.
Files changed (92) hide show
  1. package/README.md +113 -131
  2. package/dist/index.js +1049 -1246
  3. package/dist/types/auth/device.d.ts +1 -1
  4. package/dist/types/auth/index.d.ts +2 -2
  5. package/dist/types/auth/tokens.d.ts +15 -15
  6. package/dist/types/client.d.ts +10 -10
  7. package/dist/types/errors.d.ts +12 -15
  8. package/dist/types/http.d.ts +74 -118
  9. package/dist/types/index.d.ts +2 -2
  10. package/dist/types/internal/attachments.d.ts +17 -0
  11. package/dist/types/internal/helpers.d.ts +9 -0
  12. package/dist/types/listing.d.ts +90 -0
  13. package/dist/types/local/qr.d.ts +1 -1
  14. package/dist/types/local/wordlist.d.ts +2 -3
  15. package/dist/types/resources/account.d.ts +19 -19
  16. package/dist/types/resources/admin/authorizedApplications.d.ts +133 -0
  17. package/dist/types/resources/admin/chests.d.ts +51 -0
  18. package/dist/types/resources/admin/eventAlerts.d.ts +60 -0
  19. package/dist/types/resources/admin/identities.d.ts +99 -0
  20. package/dist/types/resources/admin/index.d.ts +77 -0
  21. package/dist/types/resources/admin/jobs.d.ts +97 -0
  22. package/dist/types/resources/admin/myOauthApplications.d.ts +282 -0
  23. package/dist/types/resources/admin/notepads.d.ts +49 -0
  24. package/dist/types/resources/admin/oauthApplications.d.ts +309 -0
  25. package/dist/types/resources/admin/quotas.d.ts +114 -0
  26. package/dist/types/resources/admin/shortLinks.d.ts +201 -0
  27. package/dist/types/resources/admin/types.d.ts +222 -0
  28. package/dist/types/resources/admin/vocalSeparations.d.ts +98 -0
  29. package/dist/types/resources/admin.d.ts +17 -13
  30. package/dist/types/resources/auth/index.d.ts +1 -1
  31. package/dist/types/resources/auth/passkeys.d.ts +127 -163
  32. package/dist/types/resources/auth/sessions.d.ts +116 -161
  33. package/dist/types/resources/chests.d.ts +27 -31
  34. package/dist/types/resources/content/analysis.d.ts +62 -0
  35. package/dist/types/resources/content/blogs.d.ts +471 -0
  36. package/dist/types/resources/content/feedbacks.d.ts +263 -0
  37. package/dist/types/resources/content/index.d.ts +52 -0
  38. package/dist/types/resources/content/intel/articles.d.ts +230 -0
  39. package/dist/types/resources/content/intel/config.d.ts +135 -0
  40. package/dist/types/resources/content/intel/index.d.ts +53 -0
  41. package/dist/types/resources/content/intel/items.d.ts +91 -0
  42. package/dist/types/resources/content/intel/reports.d.ts +108 -0
  43. package/dist/types/resources/content/intel/scripts.d.ts +152 -0
  44. package/dist/types/resources/content/intel/sources.d.ts +236 -0
  45. package/dist/types/resources/content/intel/stats.d.ts +105 -0
  46. package/dist/types/resources/content/intel/types.d.ts +86 -0
  47. package/dist/types/resources/content/jokes.d.ts +93 -0
  48. package/dist/types/resources/content/notifications.d.ts +147 -0
  49. package/dist/types/resources/content/serviceUsages.d.ts +73 -0
  50. package/dist/types/resources/content/servicesStatus.d.ts +194 -0
  51. package/dist/types/resources/content/siteConfig.d.ts +43 -0
  52. package/dist/types/resources/content/spaceInvaders.d.ts +154 -0
  53. package/dist/types/resources/content.d.ts +41 -236
  54. package/dist/types/resources/dynamicQrs.d.ts +29 -45
  55. package/dist/types/resources/forms.d.ts +37 -58
  56. package/dist/types/resources/jobs.d.ts +35 -44
  57. package/dist/types/resources/library/annotations.d.ts +162 -0
  58. package/dist/types/resources/library/books.d.ts +534 -0
  59. package/dist/types/resources/library/chat.d.ts +259 -0
  60. package/dist/types/resources/library/index.d.ts +39 -0
  61. package/dist/types/resources/library/shelves.d.ts +237 -0
  62. package/dist/types/resources/library/types.d.ts +120 -0
  63. package/dist/types/resources/library.d.ts +20 -22
  64. package/dist/types/resources/media.d.ts +48 -61
  65. package/dist/types/resources/movies/addons.d.ts +388 -0
  66. package/dist/types/resources/movies/collections.d.ts +352 -0
  67. package/dist/types/resources/movies/index.d.ts +29 -0
  68. package/dist/types/resources/movies/types.d.ts +50 -0
  69. package/dist/types/resources/movies/watchProgress.d.ts +277 -0
  70. package/dist/types/resources/movies.d.ts +27 -53
  71. package/dist/types/resources/music/artists.d.ts +182 -246
  72. package/dist/types/resources/music/imports.d.ts +190 -218
  73. package/dist/types/resources/music/index.d.ts +8 -7
  74. package/dist/types/resources/music/playlists.d.ts +85 -117
  75. package/dist/types/resources/music/social.d.ts +153 -228
  76. package/dist/types/resources/music/songs.d.ts +165 -227
  77. package/dist/types/resources/realtime.d.ts +75 -88
  78. package/dist/types/resources/shortLinks.d.ts +38 -47
  79. package/dist/types/resources/social/groupChats.d.ts +458 -0
  80. package/dist/types/resources/social/index.d.ts +19 -0
  81. package/dist/types/resources/social/messages.d.ts +424 -0
  82. package/dist/types/resources/social/relationships.d.ts +322 -0
  83. package/dist/types/resources/social/types.d.ts +37 -0
  84. package/dist/types/resources/social.d.ts +21 -3
  85. package/dist/types/resources/storage/upload.d.ts +42 -56
  86. package/dist/types/resources/storage.d.ts +94 -109
  87. package/dist/types/resources/tickets.d.ts +19 -10
  88. package/dist/types/resources/tools/backgroundRemoval.d.ts +11 -13
  89. package/dist/types/resources/tools/captions.d.ts +107 -135
  90. package/dist/types/resources/tools/upscale.d.ts +12 -16
  91. package/dist/types/types.d.ts +29 -38
  92. package/package.json +1 -1
@@ -4,7 +4,7 @@
4
4
  * Nothing here touches the platform: no `node:*`, no `process`, no `console`.
5
5
  * Files are normally values (Blob / Uint8Array / ReadableStream), never paths -
6
6
  * the core has no filesystem, and turning a path into a {@link FileInput} is the
7
- * CLI's job.
7
+ * host's job.
8
8
  *
9
9
  * React Native is the one exception, and it is the platform's exception rather
10
10
  * than a relaxation of ours: a file the user picked there is a
@@ -31,9 +31,8 @@ export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>
31
31
  /**
32
32
  * A file picked on React Native, exactly as the platform hands it over.
33
33
  *
34
- * This is the shape `expo-file-system`'s picker returns and the shape the app
35
- * already builds by hand (`oms-music/src/features/settings/pickers.ts`,
36
- * `features/playlist/artworkPicker.ts`), and it is a DESCRIPTOR, not bytes: the
34
+ * This is the shape `expo-file-system`'s picker returns, and it is a
35
+ * DESCRIPTOR, not bytes: the
37
36
  * URI is a `file://`, `content://` or `ph://` handle into the device, and
38
37
  * nothing in JavaScript can turn it into a `Blob` without a native module.
39
38
  *
@@ -66,10 +65,9 @@ export interface NativeFile {
66
65
  /** Filename the server should store. RN sends it as the part's `filename`. */
67
66
  readonly name: string;
68
67
  /**
69
- * MIME type. Pickers report `""` for some `content://` URIs, which is why the
70
- * app falls back to a per-kind constant before it gets here; do the same, as
71
- * Rails infers the container format from the part's content type for several
72
- * of the tools.
68
+ * MIME type. Pickers report `""` for some `content://` URIs; fall back to a
69
+ * per-kind constant before it gets here, as the server infers the container
70
+ * format from the part's content type for several of the tools.
73
71
  */
74
72
  readonly type?: string;
75
73
  /** Byte length when the picker reported one. Ignored by RN, used by the SDK. */
@@ -97,7 +95,7 @@ export declare function isNativeFile(value: unknown): value is NativeFile;
97
95
  * multipart form bodies have to be materialised: {@link readFileInput} buffers
98
96
  * a stream into a Blob before it can be appended to a `FormData`. For anything
99
97
  * large, prefer the storage direct-upload path, which streams straight to the
100
- * object store and never passes through Rails.
98
+ * object store.
101
99
  *
102
100
  * On React Native there is no need to wrap a picked file in one of these at
103
101
  * all: pass the picked `{ uri, name, type }` object straight into the form bag
@@ -171,10 +169,8 @@ export declare function file(data: Blob | Uint8Array | ReadableStream<Uint8Array
171
169
  *
172
170
  * It ticks once per COMPLETED transfer, never per byte, and that is a property
173
171
  * of `fetch` rather than a decision this SDK is free to revisit. No `fetch` -
174
- * browser, React Native or Worker - exposes request-body progress. The web
175
- * frontend gets a real byte counter in its 36 `onUploadProgress` call sites
176
- * because axios is XHR underneath, and XHR is the only API that has ever
177
- * reported bytes as they leave.
172
+ * browser, React Native or Worker - exposes request-body progress. XHR is the
173
+ * only API that has ever reported bytes as they leave.
178
174
  *
179
175
  * There is therefore ONE mechanism in this SDK, not two: `resources/storage/upload.ts`
180
176
  * ticks per finished transfer (one per 32 MiB part on the multipart tier, one
@@ -282,17 +278,17 @@ export declare const DEFAULT_RETRY: ResolvedRetry;
282
278
  /**
283
279
  * One value in a query string.
284
280
  *
285
- * Nested objects and arrays are encoded the way Rails reads them
281
+ * Nested objects and arrays are encoded the way the API reads them
286
282
  * (`search[status]=open`, `ids[]=1&ids[]=2`). Three values do NOT encode
287
283
  * literally, and `encodeQuery` in `http.ts` carries the full argument:
288
284
  *
289
285
  * - `undefined` is dropped. It means "I am not filtering on this column".
290
- * - `null` is sent as the backend's `\b` null sentinel and comes back out of
291
- * `CrudActions` as SQL `NULL`. It means "filter where this column IS NULL".
292
- * The two are not interchangeable, and getting them the wrong way round is
293
- * the difference between one folder and somebody's entire tree.
294
- * - a `Date` is sent as its ISO-8601 string, which is the only shape the Rails
295
- * date filters parse (`String#to_date_safe`).
286
+ * - `null` is sent as the API's `\b` null sentinel and is read as SQL `NULL`.
287
+ * It means "filter where this column IS NULL". The two are not
288
+ * interchangeable, and getting them the wrong way round is the difference
289
+ * between one folder and somebody's entire tree.
290
+ * - a `Date` is sent as its ISO-8601 string, which is the only shape the date
291
+ * filters parse.
296
292
  */
297
293
  export type QueryValue = string | number | boolean | Date | null | undefined | QueryValue[] | {
298
294
  [key: string]: QueryValue;
@@ -300,11 +296,10 @@ export type QueryValue = string | number | boolean | Date | null | undefined | Q
300
296
  /** A bag of query parameters. */
301
297
  export type QueryParams = Record<string, QueryValue>;
302
298
  /**
303
- * Hard ceiling the backend applies to a page size, mirroring
304
- * `QueryModifier::MAX_PAGE_SIZE`.
299
+ * Hard ceiling the API applies to a page size.
305
300
  *
306
- * The server clamps silently - `size = [size, MAX_PAGE_SIZE].min` - so asking
307
- * for 1200 returns 500 rows and no indication that a ceiling was hit. The SDK
301
+ * The server clamps silently, so asking for 1200 returns 500 rows and no
302
+ * indication that a ceiling was hit. The SDK
308
303
  * therefore clamps to the same number BEFORE the request, so that the size it
309
304
  * reports back in {@link Paginated.pageSize} is the size the rows were actually
310
305
  * counted against. See {@link resolvePageSize}.
@@ -316,8 +311,7 @@ export declare const MAX_PAGE_SIZE = 500;
316
311
  * Deliberately below {@link MAX_PAGE_SIZE}: a `list()` is usually the first
317
312
  * screen of something, and 500 rows of expanded records is a slow first paint.
318
313
  * Note this is NOT the server's own default - a request with no page modifier
319
- * at all gets `QueryModifier::DEFAULT_PAGE_SIZE` (500) forced on it by
320
- * `CrudActions#index_modifiers_params` - but the SDK always sends one.
314
+ * at all gets 500 - but the SDK always sends one.
321
315
  */
322
316
  export declare const DEFAULT_PAGE_SIZE = 100;
323
317
  /**
@@ -332,11 +326,9 @@ export declare const DEFAULT_PAGE_SIZE = 100;
332
326
  * `hasMore: false`, dropping 700 rows without a word.
333
327
  * - **not a usable size at all** (`NaN`, `Infinity`, zero, negative) throws.
334
328
  * There is nothing sensible to clamp such a value to, and it is not merely
335
- * wrong on the client: `pageModifier` would put `"1:NaN"` on the wire,
336
- * `QueryModifier#apply_pagination` reads that as size `0`, bails out before
337
- * `limit`/`offset` are applied, and the endpoint answers with the WHOLE
338
- * table. A typo would turn a listing into an unbounded scan holding a Puma
339
- * thread and a DB connection.
329
+ * wrong on the client: `pageModifier` would put `"1:NaN"` on the wire, the
330
+ * server reads that as size `0`, skips pagination, and the endpoint answers
331
+ * with the WHOLE table. A typo would turn a listing into an unbounded scan.
340
332
  *
341
333
  * @throws {TypeError} when `pageSize` is not a finite number of at least 1.
342
334
  */
@@ -370,11 +362,10 @@ export interface PageParams {
370
362
  * A size the server could not parse is NOT clamped, it throws: `0`, a
371
363
  * negative, `NaN` and `Infinity` all raise a `TypeError` before the request
372
364
  * is built. This is deliberate and it is not defensive tidiness. `"1:NaN"`
373
- * on the wire makes `QueryModifier#apply_pagination` read the size as zero
374
- * and bail out before `limit`/`offset` are applied, so the endpoint answers
375
- * with the WHOLE table: one typo turns a listing into an unbounded scan
376
- * holding a Puma thread and a database connection. Failing at the call site
377
- * is the only place that mistake is still cheap.
365
+ * on the wire is read as size zero and disables pagination, so the endpoint
366
+ * answers with the WHOLE table: one typo turns a listing into an unbounded
367
+ * scan. Failing at the call site is the only place that mistake is still
368
+ * cheap.
378
369
  *
379
370
  * Narrower than 0.2.0, which clamped `0` to 1 and let `NaN` through onto
380
371
  * the wire. See {@link resolvePageSize}.
@@ -459,8 +450,8 @@ export interface QuotaStatus {
459
450
  /**
460
451
  * How a long-running server-side job reports itself.
461
452
  *
462
- * These are the five strings `Job::STATUSES` holds, spelled exactly as the
463
- * backend spells them: `"complete"` and `"canceled"`, not `"completed"` and
453
+ * These are the five strings the API uses, spelled exactly as it spells
454
+ * them: `"complete"` and `"canceled"`, not `"completed"` and
464
455
  * `"cancelled"`. Compare against `JOB_STATUS` / `isJobTerminal` from the jobs
465
456
  * namespace rather than against a literal you typed from memory - a wait loop
466
457
  * that tests for `"completed"` never ends.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omelhorsite/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "TypeScript SDK for the omelhorsite API. Isolate-safe: no node builtins, no environment access, no stdout.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",