@omelhorsite/sdk 0.3.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 (70) hide show
  1. package/README.md +112 -130
  2. package/dist/index.js +1045 -1242
  3. package/dist/types/index.d.ts +1 -0
  4. package/dist/types/internal/attachments.d.ts +17 -0
  5. package/dist/types/internal/helpers.d.ts +9 -0
  6. package/dist/types/listing.d.ts +90 -0
  7. package/dist/types/resources/account.d.ts +5 -2
  8. package/dist/types/resources/admin/authorizedApplications.d.ts +133 -0
  9. package/dist/types/resources/admin/chests.d.ts +51 -0
  10. package/dist/types/resources/admin/eventAlerts.d.ts +60 -0
  11. package/dist/types/resources/admin/identities.d.ts +99 -0
  12. package/dist/types/resources/admin/index.d.ts +77 -0
  13. package/dist/types/resources/admin/jobs.d.ts +97 -0
  14. package/dist/types/resources/admin/myOauthApplications.d.ts +282 -0
  15. package/dist/types/resources/admin/notepads.d.ts +49 -0
  16. package/dist/types/resources/admin/oauthApplications.d.ts +309 -0
  17. package/dist/types/resources/admin/quotas.d.ts +114 -0
  18. package/dist/types/resources/admin/shortLinks.d.ts +201 -0
  19. package/dist/types/resources/admin/types.d.ts +222 -0
  20. package/dist/types/resources/admin/vocalSeparations.d.ts +98 -0
  21. package/dist/types/resources/admin.d.ts +17 -13
  22. package/dist/types/resources/auth/sessions.d.ts +6 -9
  23. package/dist/types/resources/content/analysis.d.ts +62 -0
  24. package/dist/types/resources/content/blogs.d.ts +471 -0
  25. package/dist/types/resources/content/feedbacks.d.ts +263 -0
  26. package/dist/types/resources/content/index.d.ts +52 -0
  27. package/dist/types/resources/content/intel/articles.d.ts +230 -0
  28. package/dist/types/resources/content/intel/config.d.ts +135 -0
  29. package/dist/types/resources/content/intel/index.d.ts +53 -0
  30. package/dist/types/resources/content/intel/items.d.ts +91 -0
  31. package/dist/types/resources/content/intel/reports.d.ts +108 -0
  32. package/dist/types/resources/content/intel/scripts.d.ts +152 -0
  33. package/dist/types/resources/content/intel/sources.d.ts +236 -0
  34. package/dist/types/resources/content/intel/stats.d.ts +105 -0
  35. package/dist/types/resources/content/intel/types.d.ts +86 -0
  36. package/dist/types/resources/content/jokes.d.ts +93 -0
  37. package/dist/types/resources/content/notifications.d.ts +147 -0
  38. package/dist/types/resources/content/serviceUsages.d.ts +73 -0
  39. package/dist/types/resources/content/servicesStatus.d.ts +194 -0
  40. package/dist/types/resources/content/siteConfig.d.ts +43 -0
  41. package/dist/types/resources/content/spaceInvaders.d.ts +154 -0
  42. package/dist/types/resources/content.d.ts +41 -236
  43. package/dist/types/resources/jobs.d.ts +7 -4
  44. package/dist/types/resources/library/annotations.d.ts +162 -0
  45. package/dist/types/resources/library/books.d.ts +534 -0
  46. package/dist/types/resources/library/chat.d.ts +259 -0
  47. package/dist/types/resources/library/index.d.ts +39 -0
  48. package/dist/types/resources/library/shelves.d.ts +237 -0
  49. package/dist/types/resources/library/types.d.ts +120 -0
  50. package/dist/types/resources/library.d.ts +20 -22
  51. package/dist/types/resources/movies/addons.d.ts +388 -0
  52. package/dist/types/resources/movies/collections.d.ts +352 -0
  53. package/dist/types/resources/movies/index.d.ts +29 -0
  54. package/dist/types/resources/movies/types.d.ts +50 -0
  55. package/dist/types/resources/movies/watchProgress.d.ts +277 -0
  56. package/dist/types/resources/movies.d.ts +27 -53
  57. package/dist/types/resources/music/artists.d.ts +3 -1
  58. package/dist/types/resources/music/imports.d.ts +9 -8
  59. package/dist/types/resources/music/playlists.d.ts +8 -7
  60. package/dist/types/resources/music/songs.d.ts +5 -21
  61. package/dist/types/resources/shortLinks.d.ts +5 -2
  62. package/dist/types/resources/social/groupChats.d.ts +458 -0
  63. package/dist/types/resources/social/index.d.ts +19 -0
  64. package/dist/types/resources/social/messages.d.ts +424 -0
  65. package/dist/types/resources/social/relationships.d.ts +322 -0
  66. package/dist/types/resources/social/types.d.ts +37 -0
  67. package/dist/types/resources/social.d.ts +21 -3
  68. package/dist/types/resources/storage.d.ts +24 -6
  69. package/dist/types/resources/tickets.d.ts +19 -10
  70. package/package.json +1 -1
@@ -47,14 +47,7 @@
47
47
  * per IP, after a bot pushed roughly 200 notification emails through it in
48
48
  * one burst, plus a three-minute de-duplication window inside the
49
49
  * controller. See {@link FeedbacksNamespace.create}.
50
- * 9. **"Intel" is two unrelated things sharing a prefix.** `GET /intel/*path`
51
- * is a generic forwarder to a sidecar whose routes are not in the backend
52
- * repository, so it stays untyped on purpose ({@link IntelProxyNamespace}).
53
- * The `/intel_articles`, `/intel_reports`, `/intel_sources`,
54
- * `/intel_scripts`, `/intel_items`, `/intel_config` and `/intel_stats`
55
- * routes are ordinary Rails controllers with blueprints, and they are fully
56
- * typed ({@link IntelNamespace}). Reach for the second set.
57
- * 10. **Two blog routes are private by accident.** `allow_unauthenticated_access`
50
+ * 9. **Two blog routes are private by accident.** `allow_unauthenticated_access`
58
51
  * lists `index` and `show` on both blog controllers and nothing else, so the
59
52
  * public PERMALINK (`GET /blogs/:blog/posts/:slug`) rejects anonymous
60
53
  * readers while `GET /blog_posts/:id` serves them the same post, and the
@@ -84,35 +77,25 @@
84
77
  * rather than a throttle. See {@link ServicesStatusNamespace.uptime}.
85
78
  */
86
79
  import { ApiClient, Resource } from "../http";
87
- import type { FileOutput, Id, Json, PageParams, Paginated, QueryParams, QueryValue, RequestOptions, Timestamp } from "../types";
80
+ import type { ListParams } from "../listing";
81
+ import type { FileOutput, Id, Json, Paginated, RequestOptions, Timestamp } from "../types";
88
82
  import type { FsNode } from "./storage";
89
- /**
90
- * Filters accepted by the four listings in this file that really are the list
91
- * DSL. Mirrors the shape the other namespaces use.
92
- *
93
- * `search` is a partial, accent-insensitive match; `exact_search` is equality,
94
- * with an array meaning `IN` and `null` meaning `IS NULL`. Both fail CLOSED:
95
- * a key the controller did not declare is `400 "Unknown search filter: x"`,
96
- * never a silently wider result. The declared keys differ per endpoint and are
97
- * documented on each `list()`; they are much narrower here than you would
98
- * guess, because most of these controllers declare no `search_params` at all
99
- * and inherit only `id`, `created_at` and `updated_at`.
100
- */
101
- export interface ContentListParams extends PageParams {
102
- /** Partial, accent-insensitive match. Only the columns the endpoint declares. */
103
- readonly search?: Record<string, QueryValue>;
104
- /** Exact match. Array means `IN`, `null` means `IS NULL`. */
105
- readonly exactSearch?: Record<string, QueryValue>;
106
- /**
107
- * Ask for rows in random order. Mutually useful with a small `pageSize`.
108
- *
109
- * Two side effects worth knowing: `QueryModifier` applies `RANDOM()` with
110
- * `reorder`, so it REPLACES any `order` the controller set for itself, and
111
- * `CrudActions#resources_stale?` short-circuits for a random listing, so the
112
- * response carries no `ETag` and can never answer `304`.
113
- */
114
- readonly random?: boolean;
115
- }
83
+ /** Filter columns of `GET /notifications`, on top of {@link BASE_FILTER_COLUMNS}. `read` and `kind` are not filterable. */
84
+ export declare const NOTIFICATION_FILTER_COLUMNS: readonly ["user_id"];
85
+ /** Filters for {@link NotificationsNamespace.list}. */
86
+ export type ListNotificationsParams = ListParams<(typeof NOTIFICATION_FILTER_COLUMNS)[number]>;
87
+ /** Filter columns of `GET /feedbacks`, on top of {@link BASE_FILTER_COLUMNS}. */
88
+ export declare const FEEDBACK_FILTER_COLUMNS: readonly ["status", "user_id"];
89
+ /** Filters for {@link FeedbacksNamespace.list}. */
90
+ export type ListFeedbacksParams = ListParams<(typeof FEEDBACK_FILTER_COLUMNS)[number]>;
91
+ /** `GET /jokes` filters on {@link BASE_FILTER_COLUMNS} only. */
92
+ export declare const JOKE_FILTER_COLUMNS: readonly [];
93
+ /** Filters for {@link JokesNamespace.list}. */
94
+ export type ListJokesParams = ListParams<(typeof JOKE_FILTER_COLUMNS)[number]>;
95
+ /** `GET /space_invaders_games` filters on {@link BASE_FILTER_COLUMNS} only; there is no player filter. */
96
+ export declare const SPACE_INVADERS_GAME_FILTER_COLUMNS: readonly [];
97
+ /** Filters for {@link SpaceInvadersNamespace.list}. */
98
+ export type ListSpaceInvadersGamesParams = ListParams<(typeof SPACE_INVADERS_GAME_FILTER_COLUMNS)[number]>;
116
99
  /** Primary key of a blog. An INTEGER: `blogs` kept its auto-increment id. */
117
100
  export type BlogId = number;
118
101
  /** Primary key of a blog post. An integer, like the blog it hangs off. */
@@ -693,7 +676,7 @@ export declare class NotificationsNamespace extends Resource {
693
676
  * Sends an `ETag`, so an unchanged page answers `304` and costs nothing -
694
677
  * except with `random: true`, which disables the check.
695
678
  */
696
- list(params?: ContentListParams, options?: RequestOptions): Promise<Paginated<Notification>>;
679
+ list(params?: ListNotificationsParams, options?: RequestOptions): Promise<Paginated<Notification>>;
697
680
  /**
698
681
  * `GET /notifications/unread_count` - how many unread notifications the
699
682
  * caller has. Unwraps the `{"count": n}` the server sends.
@@ -939,10 +922,10 @@ export declare class FeedbacksNamespace extends Resource {
939
922
  * `created_at`, `updated_at`). Any other key is `400`.
940
923
  *
941
924
  * The scope is ordered `created_at DESC` before the DSL runs, and
942
- * `modifiers[order]` uses `reorder`, so passing {@link ContentListParams.order}
925
+ * `modifiers[order]` uses `reorder`, so passing {@link ListParams.order}
943
926
  * REPLACES that default rather than refining it.
944
927
  */
945
- list(params?: ContentListParams, options?: RequestOptions): Promise<Paginated<Feedback>>;
928
+ list(params?: ListFeedbacksParams, options?: RequestOptions): Promise<Paginated<Feedback>>;
946
929
  /**
947
930
  * `GET /feedbacks/:id` - one report in full. **Admin only**; anybody else
948
931
  * gets `401` with a `null` body.
@@ -1047,7 +1030,7 @@ export declare class JokesNamespace extends Resource {
1047
1030
  * ordering (`"lang:asc:pt,en"` puts those languages first), which the rest
1048
1031
  * of the SDK does not advertise because almost nothing needs it.
1049
1032
  */
1050
- list(params?: ContentListParams, options?: RequestOptions): Promise<Paginated<Joke>>;
1033
+ list(params?: ListJokesParams, options?: RequestOptions): Promise<Paginated<Joke>>;
1051
1034
  /**
1052
1035
  * `POST /jokes` - adds a joke. `201`. **Admin only.**
1053
1036
  *
@@ -1558,7 +1541,7 @@ export declare class SpaceInvadersNamespace extends Resource {
1558
1541
  *
1559
1542
  * No default ordering, so pass one. Sends an `ETag`.
1560
1543
  */
1561
- list(params?: ContentListParams, options?: RequestOptions): Promise<Paginated<SpaceInvadersGame>>;
1544
+ list(params?: ListSpaceInvadersGamesParams, options?: RequestOptions): Promise<Paginated<SpaceInvadersGame>>;
1562
1545
  /**
1563
1546
  * `POST /space_invaders_games` - records a finished run. `201`.
1564
1547
  *
@@ -1593,156 +1576,6 @@ export declare class SpaceInvadersNamespace extends Resource {
1593
1576
  destroy(id: SpaceInvadersGameId, options?: RequestOptions): Promise<void>;
1594
1577
  }
1595
1578
  /**
1596
- * The two path prefixes the proxy will forward. Mirrors
1597
- * `IntelController::ALLOWED_PREFIXES`.
1598
- *
1599
- * `api` is the sidecar's JSON surface; `img` is its image surface. Anything
1600
- * else - and any path containing `..` - is `400 "Invalid intel path."` before
1601
- * a byte leaves the backend.
1602
- */
1603
- export declare const INTEL_ALLOWED_PREFIXES: readonly ["api", "img"];
1604
- /** Connect timeout the backend applies to the sidecar, in milliseconds. */
1605
- export declare const INTEL_UPSTREAM_OPEN_TIMEOUT_MS = 5000;
1606
- /** Read timeout the backend applies to the sidecar, in milliseconds. */
1607
- export declare const INTEL_UPSTREAM_READ_TIMEOUT_MS = 60000;
1608
- /**
1609
- * The `intel` proxy: a read-only passthrough to an internal service.
1610
- *
1611
- * ## Why this namespace has no types
1612
- *
1613
- * `GET /intel/*path` is not an API. It is a generic forwarder:
1614
- * `IntelController#proxy` checks who is asking, refuses anything outside
1615
- * {@link INTEL_ALLOWED_PREFIXES}, joins the rest of the path onto the
1616
- * sidecar's base URL, replays the query string VERBATIM, injects an
1617
- * `X-API-Key` that never reaches the browser, and hands back whatever comes
1618
- * out - the upstream body, the upstream `Content-Type`, the upstream
1619
- * `Cache-Control` and the upstream STATUS CODE, unexamined.
1620
- *
1621
- * The SDK cannot see that service, its routes are not in this repository, and
1622
- * nothing in the backend validates or reshapes its answers. Publishing typed
1623
- * `getStories()` / `getReport()` methods here would be inventing a contract
1624
- * nobody can hold up, and it would rot the first time the sidecar changed. So
1625
- * this namespace offers exactly what the endpoint offers: a path, a query bag,
1626
- * and a caller-supplied result type it is the CALLER's job to justify.
1627
- *
1628
- * If you want typed intel data, use the native Rails endpoints instead -
1629
- * they are real controllers with real blueprints, the web frontend moved onto
1630
- * them and left this proxy behind, and they ARE wrapped, one family per
1631
- * sub-namespace under {@link IntelNamespace}. This class is only for the
1632
- * embedded hub the old page still renders and for its image bytes.
1633
- *
1634
- * ## Access
1635
- *
1636
- * Effectively a single-user endpoint. `Intel::Access.allowed?` is an admin
1637
- * check OR a hard-coded handle allowlist, so every other authenticated caller
1638
- * gets `403 "Intel access is restricted."` and an anonymous one gets the
1639
- * ordinary `401` first. Do not build a shared feature on this.
1640
- *
1641
- * ## Errors are not the API's errors
1642
- *
1643
- * The upstream status is forwarded as-is, so a 4xx or 5xx here carries the
1644
- * SIDECAR's body - which may be JSON, may be HTML, may be empty, and is
1645
- * certainly not this API's usual bare JSON string. Read
1646
- * {@link OmsApiError.body} defensively.
1647
- *
1648
- * When the sidecar cannot be reached at all - refused connection, DNS
1649
- * failure, or a timeout past
1650
- * {@link INTEL_UPSTREAM_OPEN_TIMEOUT_MS} / {@link INTEL_UPSTREAM_READ_TIMEOUT_MS} -
1651
- * the backend answers `502 "Intel service unreachable."`, which is a normal
1652
- * bare-string error.
1653
- *
1654
- * Only `GET` is routed. There is no way to write anything through this proxy.
1655
- *
1656
- * @deprecated Intel now lives ENTIRELY inside Rails. The analysis pipeline
1657
- * moved into Ruby and Solid Queue, and sources became per-user records with
1658
- * sandboxed TS scripts, so the `omelhorsite-intel-analise` sidecar this
1659
- * forwards to is on its way out. The route still answers today, which is why
1660
- * this class is still here rather than deleted, but nothing new should be
1661
- * built on it: when the sidecar goes, every call through here becomes a
1662
- * `502 "Intel service unreachable."` with no deprecation window, because the
1663
- * backend cannot tell a retired sidecar from a broken one.
1664
- *
1665
- * Use the typed families under {@link IntelNamespace} instead: `articles`,
1666
- * `reports`, `sources`, `scripts`, `items`, `config` and `stats` are real
1667
- * controllers with real blueprints over the API's own tables.
1668
- */
1669
- export declare class IntelProxyNamespace extends Resource {
1670
- /**
1671
- * `GET /intel/<path>` - forwards a read and parses the answer as JSON.
1672
- *
1673
- * The type parameter is a PROMISE YOU are making, not one the SDK or the
1674
- * backend can check. Default it to `unknown` and narrow at the call site
1675
- * unless you own the sidecar's route.
1676
- *
1677
- * `path` is relative and must start with `api/` or `img/`
1678
- * (see {@link INTEL_ALLOWED_PREFIXES}). A leading slash is stripped, and
1679
- * each segment is percent-encoded while the separators are kept, so
1680
- * `"api/articles/abc def"` reaches the sidecar as `api/articles/abc%20def`.
1681
- * Pass an unencoded path; passing a pre-encoded one double-encodes it.
1682
- *
1683
- * `query` is encoded by the SDK's normal rules and then replayed to the
1684
- * sidecar untouched, `null` sentinel and all - which is worth knowing,
1685
- * because the sentinel is a Rails convention the sidecar has never heard of.
1686
- * Prefer plain values here.
1687
- *
1688
- * The route is declared `format: false`, so a trailing `.json` stays part of
1689
- * the path instead of being read as a Rails format.
1690
- *
1691
- * If the answer is not JSON it comes back as the raw text (the transport
1692
- * falls back to a string rather than throwing), so a `T` of `unknown`
1693
- * genuinely can be a `string`.
1694
- *
1695
- * Cost: the backend buffers the entire upstream body in memory before
1696
- * sending it on - there is no streaming - and holds a Puma thread for up to
1697
- * {@link INTEL_UPSTREAM_READ_TIMEOUT_MS} while it waits.
1698
- *
1699
- * @throws {OmsApiError} 400 `"Invalid intel path."` for a path outside the
1700
- * allowed prefixes or containing `..`; 403 `"Intel access is restricted."`;
1701
- * 502 `"Intel service unreachable."`; or anything at all, forwarded from
1702
- * the sidecar.
1703
- */
1704
- get<T = unknown>(path: string, query?: QueryParams, options?: RequestOptions): Promise<T>;
1705
- /**
1706
- * `GET /intel/<path>` - forwards a read and keeps the bytes.
1707
- *
1708
- * For the `img/` prefix, and for any `api/` route that answers with
1709
- * something other than JSON. Buffers the whole body, so do not point it at
1710
- * anything large.
1711
- *
1712
- * {@link FileOutput.filename} will be `undefined`: the backend sends
1713
- * `Content-Disposition: inline` with no filename. `contentType` is whatever
1714
- * the sidecar declared.
1715
- */
1716
- fetch(path: string, query?: QueryParams, options?: RequestOptions): Promise<FileOutput>;
1717
- /**
1718
- * The absolute URL of a proxied path, for an `<img src>` or an `<a href>`.
1719
- *
1720
- * Builds the string and makes no request. Useful only for a cookie-session
1721
- * browser client on the API's origin: the proxy requires an authenticated,
1722
- * allowlisted caller, so a bare URL opened without a credential is a `401`.
1723
- */
1724
- url(path: string, query?: QueryParams): string;
1725
- }
1726
- /**
1727
- * ## Why these ARE typed, when the proxy above is not
1728
- *
1729
- * The two halves of "intel" look alike and are nothing alike.
1730
- * {@link IntelProxyNamespace} forwards `GET /intel/*path` to a service whose
1731
- * routes are not in the backend repository, so its answers are genuinely
1732
- * unknowable. Everything below is the opposite: seven ordinary Rails
1733
- * controllers over eight of the backend's own tables, each with a Blueprinter
1734
- * blueprint that names every key it emits. `IntelArticleBlueprint`,
1735
- * `IntelReportBlueprint`, `IntelSourceBlueprint`, `IntelScriptBlueprint`,
1736
- * `IntelItemBlueprint` and `IntelConfigBlueprint` are the contract, and
1737
- * `IntelStatsController#show` hand-writes its hash literally. Nothing here is
1738
- * forwarded, nothing here is opaque, and the SDK types it the way it types any
1739
- * other resource.
1740
- *
1741
- * Where the two meet: the sidecar behind the proxy is the OLD, separate intel
1742
- * product embedded in the web app's `/intel` page. The routes below are the one
1743
- * that replaced it. Reach for these first; the proxy is for the embedded hub
1744
- * and for image bytes.
1745
- *
1746
1579
  * ## Access: this is effectively a one-user feature
1747
1580
  *
1748
1581
  * `IntelAccess` runs `before_action :require_intel_access` on all seven
@@ -2221,8 +2054,10 @@ export interface IntelStats {
2221
2054
  /** Stories touched in the last 24 hours. */
2222
2055
  readonly last24h: number;
2223
2056
  }
2057
+ /** Filter columns of `GET /intel_articles`, on top of {@link BASE_FILTER_COLUMNS}. */
2058
+ export declare const INTEL_ARTICLE_FILTER_COLUMNS: readonly ["title", "summary", "category", "importance", "enriched"];
2224
2059
  /** Filters for {@link IntelArticlesNamespace.list}. */
2225
- export interface ListIntelArticlesParams extends ContentListParams {
2060
+ export interface ListIntelArticlesParams extends ListParams<(typeof INTEL_ARTICLE_FILTER_COLUMNS)[number]> {
2226
2061
  /**
2227
2062
  * Free-text search over `title`, `summary` AND `details`.
2228
2063
  *
@@ -2231,7 +2066,7 @@ export interface ListIntelArticlesParams extends ContentListParams {
2231
2066
  * not in `search_params` at all) and why an unknown-filter 400 cannot
2232
2067
  * happen for it.
2233
2068
  *
2234
- * Three ways it differs from {@link ContentListParams.search}:
2069
+ * Three ways it differs from {@link ListParams.search}:
2235
2070
  *
2236
2071
  * - it is **accent-SENSITIVE**. The controller does `LOWER(col) LIKE
2237
2072
  * LOWER(term)`, with no unaccenting, while the list DSL's `search` strips
@@ -2266,20 +2101,24 @@ export interface ListIntelArticlesParams extends ContentListParams {
2266
2101
  */
2267
2102
  readonly sort?: "recent" | "importance";
2268
2103
  }
2104
+ /** Filter columns of `GET /intel_reports`, on top of {@link BASE_FILTER_COLUMNS}. */
2105
+ export declare const INTEL_REPORT_FILTER_COLUMNS: readonly ["kind"];
2269
2106
  /** Filters for {@link IntelReportsNamespace.list}. */
2270
- export interface ListIntelReportsParams extends ContentListParams {
2107
+ export interface ListIntelReportsParams extends ListParams<(typeof INTEL_REPORT_FILTER_COLUMNS)[number]> {
2271
2108
  /**
2272
2109
  * Narrow to one window, e.g. `"day"`. Sent as `exact_search[kind]`, so it is
2273
2110
  * equality rather than a prefix match - `"6h"` will not also match `"6hx"`.
2274
2111
  *
2275
- * Passing it through {@link ContentListParams.search} instead would be a
2112
+ * Passing it through {@link ListParams.search} instead would be a
2276
2113
  * partial match and would work too; `kind` is on this controller's
2277
2114
  * `search_params` allowlist. Equality is what you want.
2278
2115
  */
2279
2116
  readonly kind?: IntelReportKind;
2280
2117
  }
2118
+ /** Filter columns of `GET /intel_sources`, on top of {@link BASE_FILTER_COLUMNS}. */
2119
+ export declare const INTEL_SOURCE_FILTER_COLUMNS: readonly ["name", "health", "enabled", "intel_script_id"];
2281
2120
  /** Filters for {@link IntelSourcesNamespace.list}. */
2282
- export interface ListIntelSourcesParams extends ContentListParams {
2121
+ export interface ListIntelSourcesParams extends ListParams<(typeof INTEL_SOURCE_FILTER_COLUMNS)[number]> {
2283
2122
  /** Only healthy / only broken feeds. Sent as `exact_search[health]`. */
2284
2123
  readonly health?: IntelSourceHealth;
2285
2124
  /** Only enabled, or only the ones that switched themselves off. */
@@ -2287,8 +2126,10 @@ export interface ListIntelSourcesParams extends ContentListParams {
2287
2126
  /** Every source driven by one script. */
2288
2127
  readonly scriptId?: Id;
2289
2128
  }
2129
+ /** Filter columns of `GET /intel_scripts`, on top of {@link BASE_FILTER_COLUMNS}. */
2130
+ export declare const INTEL_SCRIPT_FILTER_COLUMNS: readonly ["name", "builtin", "slug"];
2290
2131
  /** Filters for {@link IntelScriptsNamespace.list}. */
2291
- export interface ListIntelScriptsParams extends ContentListParams {
2132
+ export interface ListIntelScriptsParams extends ListParams<(typeof INTEL_SCRIPT_FILTER_COLUMNS)[number]> {
2292
2133
  /**
2293
2134
  * `true` for the platform scripts, `false` for yours. Omit for both - the
2294
2135
  * listing scope is `builtin OR mine`, so both populations are mixed by
@@ -2296,8 +2137,10 @@ export interface ListIntelScriptsParams extends ContentListParams {
2296
2137
  */
2297
2138
  readonly builtin?: boolean;
2298
2139
  }
2140
+ /** Filter columns of `GET /intel_items`, on top of {@link BASE_FILTER_COLUMNS}. */
2141
+ export declare const INTEL_ITEM_FILTER_COLUMNS: readonly ["intel_source_id", "external_id", "title", "content", "url"];
2299
2142
  /** Filters for {@link IntelItemsNamespace.list}. */
2300
- export interface ListIntelItemsParams extends ContentListParams {
2143
+ export interface ListIntelItemsParams extends ListParams<(typeof INTEL_ITEM_FILTER_COLUMNS)[number]> {
2301
2144
  /** Only items produced by one source. Sent as `exact_search[intel_source_id]`. */
2302
2145
  readonly sourceId?: Id;
2303
2146
  }
@@ -2864,13 +2707,6 @@ export declare function intelArticleImageUrl(imageUrl: string | null | undefined
2864
2707
  /**
2865
2708
  * The `intel` namespace, reachable as `oms.content.intel`.
2866
2709
  *
2867
- * Seven typed families over the backend's own tables, plus {@link proxy} for
2868
- * the untyped passthrough to the old sidecar. The three proxy methods are also
2869
- * mirrored on this class so that code written against 0.3.0's
2870
- * `oms.content.intel.get(path)` keeps working; new code should say
2871
- * `oms.content.intel.proxy.get(path)`, which cannot be confused with
2872
- * {@link IntelArticlesNamespace.get}.
2873
- *
2874
2710
  * A tour of the data model, because the names do not give it away:
2875
2711
  *
2876
2712
  * 1. a {@link IntelScript} knows HOW to fetch one kind of feed;
@@ -2902,38 +2738,7 @@ export declare class IntelNamespace extends Resource {
2902
2738
  readonly config: IntelConfigNamespace;
2903
2739
  /** Dashboard counters, in one expensive call. */
2904
2740
  readonly stats: IntelStatsNamespace;
2905
- /**
2906
- * The untyped passthrough to the old intel sidecar.
2907
- *
2908
- * @deprecated See {@link IntelProxyNamespace}. Kept only because the route
2909
- * still answers; the typed families above are the intel API now.
2910
- */
2911
- readonly proxy: IntelProxyNamespace;
2912
2741
  constructor(http: ApiClient);
2913
- /**
2914
- * Alias for {@link IntelProxyNamespace.get}. Kept so 0.3.0 call sites still
2915
- * compile; prefer `oms.content.intel.proxy.get(path)`.
2916
- *
2917
- * @deprecated The intel sidecar is being retired: intel now lives entirely
2918
- * inside Rails. See {@link IntelProxyNamespace}.
2919
- */
2920
- get<T = unknown>(path: string, query?: QueryParams, options?: RequestOptions): Promise<T>;
2921
- /**
2922
- * Alias for {@link IntelProxyNamespace.fetch}. Kept so 0.3.0 call sites still
2923
- * compile; prefer `oms.content.intel.proxy.fetch(path)`.
2924
- *
2925
- * @deprecated The intel sidecar is being retired: intel now lives entirely
2926
- * inside Rails. See {@link IntelProxyNamespace}.
2927
- */
2928
- fetch(path: string, query?: QueryParams, options?: RequestOptions): Promise<FileOutput>;
2929
- /**
2930
- * Alias for {@link IntelProxyNamespace.url}. Kept so 0.3.0 call sites still
2931
- * compile; prefer `oms.content.intel.proxy.url(path)`.
2932
- *
2933
- * @deprecated The intel sidecar is being retired: intel now lives entirely
2934
- * inside Rails. See {@link IntelProxyNamespace}.
2935
- */
2936
- url(path: string, query?: QueryParams): string;
2937
2742
  }
2938
2743
  /**
2939
2744
  * The `content` namespace, reachable as `oms.content`.
@@ -44,7 +44,8 @@
44
44
  * that deserves an exception.
45
45
  */
46
46
  import { Resource } from "../http";
47
- import type { BaseRecord, Id, Json, JobStatus, Paginated, PageParams, Progress, RequestOptions, Timestamp, WaitOptions } from "../types";
47
+ import type { ListParams } from "../listing";
48
+ import type { BaseRecord, Id, Json, JobStatus, Paginated, Progress, RequestOptions, Timestamp, WaitOptions } from "../types";
48
49
  /**
49
50
  * The five status strings, spelled the way the backend spells them.
50
51
  *
@@ -143,10 +144,12 @@ export interface JobRef {
143
144
  /** Signed token scoped to this one job. Required when anonymous. */
144
145
  readonly watchToken?: string;
145
146
  }
147
+ /** Filter columns of `GET /jobs`. */
148
+ export declare const JOB_FILTER_COLUMNS: readonly ["id", "job_type", "status", "created_at", "updated_at", "finished_at"];
146
149
  /** Filters for {@link JobsNamespace.list}. */
147
- export interface ListJobsParams extends PageParams {
148
- readonly status?: JobStatus | JobStatus[];
149
- readonly jobType?: string | string[];
150
+ export interface ListJobsParams extends ListParams<(typeof JOB_FILTER_COLUMNS)[number]> {
151
+ readonly status?: JobStatus | readonly JobStatus[];
152
+ readonly jobType?: string | readonly string[];
150
153
  }
151
154
  /** Pause before the second poll, in milliseconds. */
152
155
  export declare const DEFAULT_POLL_INTERVAL_MS = 1000;
@@ -0,0 +1,162 @@
1
+ /** The `library.annotations` namespace, with the inputs and limits only it uses. */
2
+ import { Resource } from "../../http";
3
+ import type { ListParams } from "../../listing";
4
+ import type { Paginated, RequestOptions } from "../../types";
5
+ import type { BookAnnotation, BookAnnotationId, BookAnnotationKind, BookAnnotationLocation, BookId } from "./types";
6
+ /** Longest note accepted. */
7
+ export declare const BOOK_ANNOTATION_NOTE_MAX_LENGTH = 5000;
8
+ /** Longest selected text accepted. */
9
+ export declare const BOOK_ANNOTATION_SELECTED_TEXT_MAX_LENGTH = 8000;
10
+ /** Filter columns of `GET /book_annotations`, on top of {@link BASE_FILTER_COLUMNS}. */
11
+ export declare const BOOK_ANNOTATION_FILTER_COLUMNS: readonly ["book_id", "kind"];
12
+ /** Arguments for {@link LibraryAnnotationsNamespace.list}. */
13
+ export interface ListBookAnnotationsParams extends ListParams<(typeof BOOK_ANNOTATION_FILTER_COLUMNS)[number]> {
14
+ /** Exact book id. The filter every reader screen uses. */
15
+ readonly bookId?: BookId;
16
+ /** Exact kind, or an array of kinds (which becomes `IN (...)`). */
17
+ readonly kind?: BookAnnotationKind | readonly BookAnnotationKind[];
18
+ /** `"column:asc"` / `"column:desc"`. Defaults to `created_at:asc`. */
19
+ readonly order?: string;
20
+ }
21
+ /** Arguments for {@link LibraryAnnotationsNamespace.create}. */
22
+ export interface CreateBookAnnotationInput {
23
+ readonly bookId: BookId;
24
+ readonly kind: BookAnnotationKind;
25
+ /** Omitted or empty becomes `{}`, which is a valid annotation with no anchor. */
26
+ readonly location?: BookAnnotationLocation;
27
+ readonly color?: string | null;
28
+ readonly note?: string | null;
29
+ readonly selectedText?: string | null;
30
+ }
31
+ /**
32
+ * Arguments for {@link LibraryAnnotationsNamespace.update}.
33
+ *
34
+ * `kind`, `book_id` and `selected_text` are NOT updatable: only `color`,
35
+ * `note` and `location` are read. Anything else is dropped in silence - a 200
36
+ * with an unchanged row.
37
+ */
38
+ export interface UpdateBookAnnotationInput {
39
+ readonly color?: string | null;
40
+ readonly note?: string | null;
41
+ /**
42
+ * Only sent when the key is present, because the server tests for the key
43
+ * rather than for a value. Passing `{}` therefore CLEARS the anchor rather
44
+ * than leaving it alone.
45
+ */
46
+ readonly location?: BookAnnotationLocation;
47
+ }
48
+ /** The `library.annotations` namespace, reachable as `oms.library.annotations`. */
49
+ export declare class LibraryAnnotationsNamespace extends Resource {
50
+ /**
51
+ * `GET /book_annotations` - the caller's own highlights, notes, bookmarks and
52
+ * progress markers.
53
+ *
54
+ * There is no owner filter and there does not need to be one: a caller can
55
+ * only ever see its own rows - even on a book a thousand people have public
56
+ * access to.
57
+ *
58
+ * Unlike every read in the other two namespaces, this one needs a session,
59
+ * so an anonymous call is a `401`, not an empty list.
60
+ *
61
+ * Ordered by `created_at` ascending by default (the controller adds the
62
+ * `order(:created_at)` itself), which is reading order for a set of
63
+ * highlights. Override it with `order` for a "recently annotated" view.
64
+ *
65
+ * Filtering by `bookId` is the normal call, and it is what opens a reader:
66
+ * one request per book, not one per highlight.
67
+ *
68
+ * @throws {OmsApiError} 400 naming the offending key when a filter is not
69
+ * one of `book_id`, `kind`, `id`, `created_at`, `updated_at`.
70
+ */
71
+ list(params?: ListBookAnnotationsParams, options?: RequestOptions): Promise<Paginated<BookAnnotation>>;
72
+ /**
73
+ * Every annotation on one book, in reading order, following pages until the
74
+ * book is exhausted.
75
+ *
76
+ * A convenience over {@link list} because this is what a reader does on open
77
+ * and because a heavily annotated book genuinely passes 500 rows - the point
78
+ * at which one page stops being enough and a naive caller silently loses the
79
+ * rest.
80
+ *
81
+ * `kinds` narrows to, say, highlights only. It becomes an `IN (...)`.
82
+ */
83
+ forBook(bookId: BookId, params?: {
84
+ kinds?: readonly BookAnnotationKind[];
85
+ pageSize?: number;
86
+ }, options?: RequestOptions): Promise<BookAnnotation[]>;
87
+ /**
88
+ * The reader's "where I left off" marker for one book, or `null` when they
89
+ * have never opened it.
90
+ *
91
+ * There is at most one, because
92
+ * {@link LibraryBooksNamespace.saveProgress} upserts on
93
+ * `(book, user, kind: "progress")`. This reads it back; that writes it.
94
+ */
95
+ progressFor(bookId: BookId, options?: RequestOptions): Promise<BookAnnotation | null>;
96
+ /**
97
+ * "What am I in the middle of?" - the reader's most recently touched progress
98
+ * markers, newest first.
99
+ *
100
+ * One request for the whole continue-reading shelf, which is the point: the
101
+ * alternative is one request per cover. The rows carry `book_id` and nothing
102
+ * about the book, so pair it with
103
+ * {@link LibraryBooksNamespace.list} filtered by `ids` to get the titles in a
104
+ * second request rather than in N.
105
+ *
106
+ * @param limit rows to return. Clamped to 500 by the server like any page.
107
+ */
108
+ continueReading(limit?: number, options?: RequestOptions): Promise<BookAnnotation[]>;
109
+ /**
110
+ * `POST /book_annotations` - records a highlight, a note or a bookmark.
111
+ *
112
+ * The author is taken from the session, so `user_id` is not sendable. The
113
+ * book additionally has to be visible to the caller, which is what lets a
114
+ * reader annotate somebody else's public book while keeping the annotation
115
+ * entirely private to them.
116
+ *
117
+ * Do NOT use this for reading progress. It would create a SECOND `progress`
118
+ * row - nothing here de-duplicates by kind - and the reader would then have
119
+ * two conflicting "where I left off" markers with no way to tell which is
120
+ * live. {@link LibraryBooksNamespace.saveProgress} upserts; this does not.
121
+ *
122
+ * Not retried by default: a replay after a lost answer duplicates the
123
+ * highlight.
124
+ *
125
+ * @throws {OmsAuthError} 401 twice over, with different bodies: `"Session
126
+ * required to access this resource."` when anonymous, and `"You are not
127
+ * authorized to create this resource"` when the book is not visible to
128
+ * the caller - a 401 rather than the 404 you might expect.
129
+ * @throws {OmsApiError} 400 for a `kind` outside
130
+ * {@link BOOK_ANNOTATION_KINDS}, or a note or selection over its length
131
+ * cap.
132
+ */
133
+ create(input: CreateBookAnnotationInput, options?: RequestOptions): Promise<BookAnnotation>;
134
+ /**
135
+ * `PATCH /book_annotations/:id` - edits the note or the colour of an existing
136
+ * annotation, and optionally moves it.
137
+ *
138
+ * Only `color`, `note` and `location` are writable. `kind`, `book_id` and
139
+ * `selected_text` are dropped in silence - a `200` with an unchanged row,
140
+ * which is the failure mode worth knowing about here. To change a highlight
141
+ * into a note, delete and recreate.
142
+ *
143
+ * `location` is only sent when you pass one, because the server tests for
144
+ * the key: passing `{}` therefore CLEARS the anchor rather than leaving it
145
+ * alone.
146
+ *
147
+ * @throws {OmsAuthError} 401 when the annotation is not yours.
148
+ * @throws {OmsApiError} 404 for an unknown id - and for anyone else's
149
+ * annotation, since nobody else's are ever visible.
150
+ */
151
+ update(id: BookAnnotationId, input: UpdateBookAnnotationInput, options?: RequestOptions): Promise<BookAnnotation>;
152
+ /**
153
+ * `DELETE /book_annotations/:id` - removes one annotation.
154
+ *
155
+ * Deleting a `progress` row is how a reader is put back at the start of a
156
+ * book; there is no other reset.
157
+ *
158
+ * @throws {OmsAuthError} 401 when the annotation is not yours.
159
+ * @throws {OmsApiError} 404 the second time round.
160
+ */
161
+ delete(id: BookAnnotationId, options?: RequestOptions): Promise<void>;
162
+ }