@omelhorsite/sdk 0.15.1 → 0.16.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.
- package/README.md +26 -3
- package/dist/index.js +372 -146
- package/dist/types/auth/tokens.d.ts +1 -1
- package/dist/types/client.d.ts +3 -0
- package/dist/types/resources/admin/llm.d.ts +9 -1
- package/dist/types/resources/admin/quotas.d.ts +14 -0
- package/dist/types/resources/content/blogs.d.ts +111 -31
- package/dist/types/resources/content/index.d.ts +4 -4
- package/dist/types/resources/content/news/feeds.d.ts +56 -0
- package/dist/types/resources/content/news/index.d.ts +36 -0
- package/dist/types/resources/content/news/items.d.ts +115 -0
- package/dist/types/resources/content/{intel → news}/scripts.d.ts +35 -35
- package/dist/types/resources/content/{intel → news}/sources.d.ts +62 -59
- package/dist/types/resources/content/notifications.d.ts +2 -2
- package/dist/types/resources/cron.d.ts +209 -0
- package/dist/types/resources/index.d.ts +1 -0
- package/dist/types/resources/llm.d.ts +71 -0
- package/dist/types/resources/quotas.d.ts +8 -5
- package/dist/types/resources/search.d.ts +36 -0
- package/package.json +1 -1
- package/dist/types/resources/content/intel/articles.d.ts +0 -230
- package/dist/types/resources/content/intel/config.d.ts +0 -135
- package/dist/types/resources/content/intel/index.d.ts +0 -53
- package/dist/types/resources/content/intel/items.d.ts +0 -91
- package/dist/types/resources/content/intel/reports.d.ts +0 -108
- package/dist/types/resources/content/intel/stats.d.ts +0 -105
- package/dist/types/resources/content/intel/types.d.ts +0 -86
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** News scripts: the fetchers. */
|
|
2
2
|
import { Resource } from "../../../http";
|
|
3
3
|
import type { ListParams } from "../../../listing";
|
|
4
4
|
import type { Id, Paginated, RequestOptions, Timestamp } from "../../../types";
|
|
5
5
|
/** Largest script body the server will store. */
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const NEWS_SCRIPT_MAX_CODE_BYTES: number;
|
|
7
7
|
/**
|
|
8
8
|
* A TypeScript fetcher that knows how to pull items out of one kind of feed.
|
|
9
9
|
*
|
|
10
|
-
* Runs in the
|
|
10
|
+
* Runs in the runner sidecar, inside a V8 isolate with nothing but the
|
|
11
11
|
* injected `ctx`. Two populations share this table:
|
|
12
12
|
*
|
|
13
13
|
* - **built-ins** (`builtin: true`, `user_id: null`, `slug` set) are managed by
|
|
14
|
-
* `
|
|
14
|
+
* `the built-in registry`, visible to everyone, and immutable over HTTP;
|
|
15
15
|
* - **user scripts** (`builtin: false`, `user_id` set, `slug: null`) are yours.
|
|
16
16
|
*
|
|
17
17
|
* `viewable_by` is `builtin OR mine`, so a listing mixes the two. Check
|
|
18
18
|
* {@link builtin} before offering an edit affordance - see
|
|
19
|
-
* {@link
|
|
19
|
+
* {@link NewsScriptsNamespace.update} for what happens if you do not.
|
|
20
20
|
*/
|
|
21
|
-
export interface
|
|
21
|
+
export interface NewsScript {
|
|
22
22
|
readonly id: Id;
|
|
23
23
|
readonly created_at: Timestamp;
|
|
24
24
|
readonly updated_at: Timestamp;
|
|
@@ -42,10 +42,10 @@ export interface IntelScript {
|
|
|
42
42
|
*/
|
|
43
43
|
readonly code?: string;
|
|
44
44
|
}
|
|
45
|
-
/** Filter columns of `GET /
|
|
46
|
-
export declare const
|
|
47
|
-
/** Filters for {@link
|
|
48
|
-
export interface
|
|
45
|
+
/** Filter columns of `GET /news_scripts`, on top of {@link BASE_FILTER_COLUMNS}. */
|
|
46
|
+
export declare const NEWS_SCRIPT_FILTER_COLUMNS: readonly ["name", "builtin", "slug"];
|
|
47
|
+
/** Filters for {@link NewsScriptsNamespace.list}. */
|
|
48
|
+
export interface ListNewsScriptsParams extends ListParams<(typeof NEWS_SCRIPT_FILTER_COLUMNS)[number]> {
|
|
49
49
|
/**
|
|
50
50
|
* `true` for the platform scripts, `false` for yours. Omit for both - the
|
|
51
51
|
* listing scope is `builtin OR mine`, so both populations are mixed by
|
|
@@ -53,73 +53,73 @@ export interface ListIntelScriptsParams extends ListParams<(typeof INTEL_SCRIPT_
|
|
|
53
53
|
*/
|
|
54
54
|
readonly builtin?: boolean;
|
|
55
55
|
}
|
|
56
|
-
/** Arguments for {@link
|
|
57
|
-
export interface
|
|
56
|
+
/** Arguments for {@link NewsScriptsNamespace.create}. */
|
|
57
|
+
export interface CreateNewsScriptInput {
|
|
58
58
|
/** Up to 120 characters. */
|
|
59
59
|
readonly name: string;
|
|
60
|
-
/** The body. Up to {@link
|
|
60
|
+
/** The body. Up to {@link NEWS_SCRIPT_MAX_CODE_BYTES}. */
|
|
61
61
|
readonly code: string;
|
|
62
62
|
readonly description?: string;
|
|
63
63
|
}
|
|
64
|
-
/** Arguments for {@link
|
|
65
|
-
export interface
|
|
64
|
+
/** Arguments for {@link NewsScriptsNamespace.update}. */
|
|
65
|
+
export interface UpdateNewsScriptInput {
|
|
66
66
|
readonly name?: string;
|
|
67
67
|
readonly code?: string;
|
|
68
68
|
readonly description?: string;
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
* `/
|
|
71
|
+
* `/news_scripts` - the fetchers. Full CRUD over YOUR scripts, read-only over
|
|
72
72
|
* the platform's.
|
|
73
73
|
*/
|
|
74
|
-
export declare class
|
|
74
|
+
export declare class NewsScriptsNamespace extends Resource {
|
|
75
75
|
/**
|
|
76
|
-
* `GET /
|
|
76
|
+
* `GET /news_scripts` - the built-ins plus yours, mixed.
|
|
77
77
|
*
|
|
78
78
|
* **No `code`.** The body is on the `:extended` view only, so every row here
|
|
79
|
-
* has `code: undefined`. See {@link
|
|
79
|
+
* has `code: undefined`. See {@link NewsScript.code}.
|
|
80
80
|
*
|
|
81
81
|
* Declared filters: `name`, `builtin`, `slug`, plus the inherited three.
|
|
82
82
|
* The controller sets no ordering, so the SDK sends `created_at:desc`.
|
|
83
83
|
*
|
|
84
84
|
* @throws {OmsApiError} 403 outside the allowlist.
|
|
85
85
|
*/
|
|
86
|
-
list(params?:
|
|
86
|
+
list(params?: ListNewsScriptsParams, options?: RequestOptions): Promise<Paginated<NewsScript>>;
|
|
87
87
|
/**
|
|
88
|
-
* `GET /
|
|
88
|
+
* `GET /news_scripts/:id` - the script WITH its body.
|
|
89
89
|
*
|
|
90
|
-
* This is the only read that carries {@link
|
|
90
|
+
* This is the only read that carries {@link NewsScript.code}. Works for a
|
|
91
91
|
* built-in too: they are visible to everyone, so this is how you read one
|
|
92
92
|
* before forking it.
|
|
93
93
|
*
|
|
94
94
|
* @throws {OmsApiError} 404 when the id is neither a built-in nor yours.
|
|
95
95
|
*/
|
|
96
|
-
get(id: Id, options?: RequestOptions): Promise<
|
|
96
|
+
get(id: Id, options?: RequestOptions): Promise<NewsScript>;
|
|
97
97
|
/**
|
|
98
|
-
* `POST /
|
|
98
|
+
* `POST /news_scripts` - saves a fetcher. `201`, with `code`.
|
|
99
99
|
*
|
|
100
|
-
* The controller transpiles the body in the
|
|
100
|
+
* The controller transpiles the body in the runner sidecar BEFORE
|
|
101
101
|
* saving, so a syntax error surfaces here rather than at the first poll:
|
|
102
102
|
* `400 "Invalid script: <the compiler's message>"`.
|
|
103
103
|
*
|
|
104
104
|
* **The check is best-effort and fails OPEN.** `check_script!` rescues
|
|
105
|
-
*
|
|
105
|
+
* the failure and returns nothing, so when the runner is down
|
|
106
106
|
* or unreachable the script saves unchecked and a `201` means only "stored".
|
|
107
107
|
* There is nothing on the response that distinguishes a checked save from an
|
|
108
108
|
* unchecked one. Treat a successful create as "it parses, probably", and
|
|
109
|
-
* confirm with {@link
|
|
109
|
+
* confirm with {@link NewsSourcesNamespace.run} on a throwaway source.
|
|
110
110
|
*
|
|
111
111
|
* The check is a transpile, not an execution: it proves the code parses, not
|
|
112
112
|
* that it fetches anything.
|
|
113
113
|
*
|
|
114
114
|
* The created script is always yours - `builtin` is not on `create_params`,
|
|
115
115
|
* so it cannot be set - and up to
|
|
116
|
-
* {@link
|
|
116
|
+
* {@link NEWS_SCRIPT_MAX_CODE_BYTES} long.
|
|
117
117
|
*
|
|
118
118
|
* Not retried by default: a replay creates a second script.
|
|
119
119
|
*/
|
|
120
|
-
create(input:
|
|
120
|
+
create(input: CreateNewsScriptInput, options?: RequestOptions): Promise<NewsScript>;
|
|
121
121
|
/**
|
|
122
|
-
* `PATCH /
|
|
122
|
+
* `PATCH /news_scripts/:id` - edits one of YOUR scripts. Answers with `code`.
|
|
123
123
|
*
|
|
124
124
|
* Same best-effort transpile check as {@link create}, and only when `code` is
|
|
125
125
|
* present in the body.
|
|
@@ -128,7 +128,7 @@ export declare class IntelScriptsNamespace extends Resource {
|
|
|
128
128
|
* `"You are not authorized to update this resource"` under a 401 status. That
|
|
129
129
|
* is an authorisation refusal wearing an authentication status code: do NOT
|
|
130
130
|
* let a generic 401 handler log the user out over it. Check
|
|
131
|
-
* {@link
|
|
131
|
+
* {@link NewsScript.builtin} first and fork instead of editing.
|
|
132
132
|
*
|
|
133
133
|
* A live edit takes effect on the next poll of every source using this
|
|
134
134
|
* script; there is no versioning and no rollback.
|
|
@@ -136,13 +136,13 @@ export declare class IntelScriptsNamespace extends Resource {
|
|
|
136
136
|
* @throws {OmsApiError} 404 when the id is not visible to you; 401 for a
|
|
137
137
|
* built-in; 400 for a syntax error or an over-long body.
|
|
138
138
|
*/
|
|
139
|
-
update(id: Id, input:
|
|
139
|
+
update(id: Id, input: UpdateNewsScriptInput, options?: RequestOptions): Promise<NewsScript>;
|
|
140
140
|
/**
|
|
141
|
-
* `DELETE /
|
|
141
|
+
* `DELETE /news_scripts/:id`. `204`, empty body.
|
|
142
142
|
*
|
|
143
143
|
* Refuses while any source still uses it, with
|
|
144
|
-
* `400 "Cannot delete record because dependent
|
|
145
|
-
* or repoint the sources first - {@link
|
|
144
|
+
* `400 "Cannot delete record because dependent news sources exist"`. Delete
|
|
145
|
+
* or repoint the sources first - {@link NewsSourcesNamespace.list} with
|
|
146
146
|
* `scriptId` finds them in one call.
|
|
147
147
|
*
|
|
148
148
|
* A built-in answers `401` with `"You are not authorized to destroy this
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** News sources: the feeds you follow. */
|
|
2
2
|
import { Resource } from "../../../http";
|
|
3
3
|
import type { ListParams } from "../../../listing";
|
|
4
4
|
import type { Id, Json, Paginated, RequestOptions, Timestamp } from "../../../types";
|
|
5
5
|
/** The three values a source's health can take. */
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const NEWS_SOURCE_HEALTHS: readonly ["unknown", "ok", "error"];
|
|
7
7
|
/** Health of a source's last run. `"unknown"` until it has ever run. */
|
|
8
|
-
export type
|
|
8
|
+
export type NewsSourceHealth = (typeof NEWS_SOURCE_HEALTHS)[number];
|
|
9
9
|
/**
|
|
10
10
|
* Consecutive failures after which a source flips `enabled` to `false` by
|
|
11
11
|
* itself.
|
|
12
12
|
*
|
|
13
13
|
* Nothing turns it back on: a source that hit this stays off until someone
|
|
14
14
|
* `update()`s `enabled` back to `true`. That is what
|
|
15
|
-
* {@link
|
|
15
|
+
* {@link NewsSource.consecutive_failures} is for - watch it, do not wait for
|
|
16
16
|
* an alert.
|
|
17
17
|
*/
|
|
18
|
-
export declare const
|
|
18
|
+
export declare const NEWS_SOURCE_DISABLE_AFTER_FAILURES = 20;
|
|
19
19
|
/**
|
|
20
20
|
* A configured feed: a script plus the settings that script needs.
|
|
21
21
|
*
|
|
22
22
|
* A source is polled by `PollDispatcherJob` once every
|
|
23
|
-
* {@link poll_interval_minutes}, and each poll writes {@link
|
|
23
|
+
* {@link poll_interval_minutes}, and each poll writes {@link NewsItem} rows
|
|
24
24
|
* that the analysis pipeline later turns into stories.
|
|
25
25
|
*/
|
|
26
|
-
export interface
|
|
26
|
+
export interface NewsSource {
|
|
27
27
|
readonly id: Id;
|
|
28
28
|
readonly created_at: Timestamp;
|
|
29
29
|
readonly updated_at: Timestamp;
|
|
@@ -36,15 +36,17 @@ export interface IntelSource {
|
|
|
36
36
|
* documented by the script, not by this API.
|
|
37
37
|
*/
|
|
38
38
|
readonly config: Record<string, Json>;
|
|
39
|
-
/**
|
|
40
|
-
readonly
|
|
39
|
+
/** The {@link NewsFeed} it belongs to. */
|
|
40
|
+
readonly news_feed_id: Id;
|
|
41
|
+
/** Which {@link NewsScript} fetches this source. */
|
|
42
|
+
readonly news_script_id: Id;
|
|
41
43
|
/** Minutes between polls. Validated `in: 5..1440`. */
|
|
42
44
|
readonly poll_interval_minutes: number;
|
|
43
45
|
/**
|
|
44
46
|
* Whether the dispatcher will poll it.
|
|
45
47
|
*
|
|
46
48
|
* Can flip to `false` WITHOUT anyone asking: see
|
|
47
|
-
* {@link
|
|
49
|
+
* {@link NEWS_SOURCE_DISABLE_AFTER_FAILURES}.
|
|
48
50
|
*/
|
|
49
51
|
readonly enabled: boolean;
|
|
50
52
|
/**
|
|
@@ -54,38 +56,42 @@ export interface IntelSource {
|
|
|
54
56
|
*/
|
|
55
57
|
readonly cursor: string | null;
|
|
56
58
|
/** Result of the last run. `"unknown"` until it has run once. */
|
|
57
|
-
readonly health:
|
|
59
|
+
readonly health: NewsSourceHealth;
|
|
58
60
|
/** Failure message from the last failed run, truncated to 1000 characters. */
|
|
59
61
|
readonly last_error: string | null;
|
|
60
62
|
/** When the source last ran, successfully or not. */
|
|
61
63
|
readonly last_run_at: Timestamp | null;
|
|
62
64
|
/** When it last SUCCEEDED. A gap between the two is the thing to alert on. */
|
|
63
65
|
readonly last_success_at: Timestamp | null;
|
|
64
|
-
/** Reset to 0 on any success. See {@link
|
|
66
|
+
/** Reset to 0 on any success. See {@link NEWS_SOURCE_DISABLE_AFTER_FAILURES}. */
|
|
65
67
|
readonly consecutive_failures: number;
|
|
66
68
|
}
|
|
67
|
-
/** Filter columns of `GET /
|
|
68
|
-
export declare const
|
|
69
|
-
/** Filters for {@link
|
|
70
|
-
export interface
|
|
71
|
-
/** Only healthy / only broken
|
|
72
|
-
readonly health?:
|
|
69
|
+
/** Filter columns of `GET /news_sources`, on top of {@link BASE_FILTER_COLUMNS}. */
|
|
70
|
+
export declare const NEWS_SOURCE_FILTER_COLUMNS: readonly ["name", "health", "enabled", "news_feed_id", "news_script_id"];
|
|
71
|
+
/** Filters for {@link NewsSourcesNamespace.list}. */
|
|
72
|
+
export interface ListNewsSourcesParams extends ListParams<(typeof NEWS_SOURCE_FILTER_COLUMNS)[number]> {
|
|
73
|
+
/** Only healthy / only broken sources. Sent as `exact_search[health]`. */
|
|
74
|
+
readonly health?: NewsSourceHealth;
|
|
73
75
|
/** Only enabled, or only the ones that switched themselves off. */
|
|
74
76
|
readonly enabled?: boolean;
|
|
77
|
+
/** The sources of one feed. */
|
|
78
|
+
readonly feedId?: Id;
|
|
75
79
|
/** Every source driven by one script. */
|
|
76
80
|
readonly scriptId?: Id;
|
|
77
81
|
}
|
|
78
|
-
/** Arguments for {@link
|
|
79
|
-
export interface
|
|
80
|
-
/** Up to 200 characters, and unique
|
|
82
|
+
/** Arguments for {@link NewsSourcesNamespace.create}. */
|
|
83
|
+
export interface CreateNewsSourceInput {
|
|
84
|
+
/** Up to 200 characters, and unique within the feed - a clash is a 400. */
|
|
81
85
|
readonly name: string;
|
|
86
|
+
/** Which of your feeds it joins. Omitted, the default (oldest) feed, created on the spot if you have none. */
|
|
87
|
+
readonly newsFeedId?: Id;
|
|
82
88
|
/**
|
|
83
89
|
* The script that fetches it. Must be a built-in or one of yours;
|
|
84
90
|
* `script_visible_to_owner` rejects anything else with
|
|
85
|
-
* `400 "
|
|
91
|
+
* `400 "News script is not accessible"` rather than a 404, so this also
|
|
86
92
|
* tells you the id exists. Do not use it as an existence oracle.
|
|
87
93
|
*/
|
|
88
|
-
readonly
|
|
94
|
+
readonly scriptId: Id;
|
|
89
95
|
/** Whatever that script reads. Free-form; the API validates nothing in it. */
|
|
90
96
|
readonly config?: Record<string, Json>;
|
|
91
97
|
/** 5-1440. Defaults to 15 server-side. */
|
|
@@ -94,13 +100,15 @@ export interface CreateIntelSourceInput {
|
|
|
94
100
|
readonly enabled?: boolean;
|
|
95
101
|
}
|
|
96
102
|
/**
|
|
97
|
-
* Arguments for {@link
|
|
103
|
+
* Arguments for {@link NewsSourcesNamespace.update}.
|
|
98
104
|
*
|
|
99
105
|
* One key wider than the create form: `cursor` is updatable and not creatable.
|
|
100
106
|
*/
|
|
101
|
-
export interface
|
|
107
|
+
export interface UpdateNewsSourceInput {
|
|
102
108
|
readonly name?: string;
|
|
103
|
-
|
|
109
|
+
/** Moves the source (and nothing else: its items stay where they were written) to another of your feeds. */
|
|
110
|
+
readonly newsFeedId?: Id;
|
|
111
|
+
readonly scriptId?: Id;
|
|
104
112
|
/**
|
|
105
113
|
* REPLACES the whole object; there is no merge. `assign_attributes` writes
|
|
106
114
|
* the JSON column wholesale, so sending `{ url: "..." }` to a source that
|
|
@@ -119,32 +127,30 @@ export interface UpdateIntelSourceInput {
|
|
|
119
127
|
*/
|
|
120
128
|
readonly cursor?: string | null;
|
|
121
129
|
}
|
|
122
|
-
/** What `POST /
|
|
123
|
-
export interface
|
|
130
|
+
/** What `POST /news_sources/:id/run` answers with. The whole body. */
|
|
131
|
+
export interface NewsSourceRunAccepted {
|
|
124
132
|
/** Always `true`. The job was enqueued; nothing has been fetched yet. */
|
|
125
133
|
readonly queued: boolean;
|
|
126
134
|
}
|
|
127
135
|
/**
|
|
128
|
-
* `/
|
|
136
|
+
* `/news_sources` - the feeds you have configured. Full CRUD, plus a manual
|
|
129
137
|
* run.
|
|
130
138
|
*/
|
|
131
|
-
export declare class
|
|
139
|
+
export declare class NewsSourcesNamespace extends Resource {
|
|
132
140
|
/**
|
|
133
|
-
* `GET /
|
|
141
|
+
* `GET /news_sources` - your feeds.
|
|
134
142
|
*
|
|
135
|
-
* Declared filters: `name`, `health`, `enabled`, `
|
|
143
|
+
* Declared filters: `name`, `health`, `enabled`, `news_script_id`, plus the
|
|
136
144
|
* inherited `id`, `created_at`, `updated_at`. The controller sets NO ordering
|
|
137
145
|
* of its own, so a listing with no `order` is in whatever order Postgres
|
|
138
146
|
* returns rows - which is not stable across pages. The SDK therefore sends
|
|
139
147
|
* `created_at:desc` unless you say otherwise.
|
|
140
148
|
*
|
|
141
149
|
* A good health check in one call: `list({ health: "error" })`.
|
|
142
|
-
*
|
|
143
|
-
* @throws {OmsApiError} 403 outside the allowlist.
|
|
144
150
|
*/
|
|
145
|
-
list(params?:
|
|
151
|
+
list(params?: ListNewsSourcesParams, options?: RequestOptions): Promise<Paginated<NewsSource>>;
|
|
146
152
|
/**
|
|
147
|
-
* `GET /
|
|
153
|
+
* `GET /news_sources/:id`.
|
|
148
154
|
*
|
|
149
155
|
* There are no `:extended` extras, so this is exactly the shape a listing
|
|
150
156
|
* row has. Fetching one adds nothing but a round trip;
|
|
@@ -152,9 +158,9 @@ export declare class IntelSourcesNamespace extends Resource {
|
|
|
152
158
|
*
|
|
153
159
|
* @throws {OmsApiError} 404 when the source is not yours.
|
|
154
160
|
*/
|
|
155
|
-
get(id: Id, options?: RequestOptions): Promise<
|
|
161
|
+
get(id: Id, options?: RequestOptions): Promise<NewsSource>;
|
|
156
162
|
/**
|
|
157
|
-
* `POST /
|
|
163
|
+
* `POST /news_sources` - configures a feed. `201`.
|
|
158
164
|
*
|
|
159
165
|
* The source starts `health: "unknown"` and is not polled immediately: the
|
|
160
166
|
* dispatcher picks it up on its next pass, or you can force it with
|
|
@@ -162,21 +168,21 @@ export declare class IntelSourcesNamespace extends Resource {
|
|
|
162
168
|
*
|
|
163
169
|
* Three ways this fails with a 400 and a bare-string body:
|
|
164
170
|
*
|
|
165
|
-
* - `"Name has already been taken"` - names are unique
|
|
166
|
-
* - `"
|
|
171
|
+
* - `"Name has already been taken"` - names are unique within a feed;
|
|
172
|
+
* - `"News script is not accessible"` - the script is neither a built-in nor
|
|
167
173
|
* yours. This is a 400 rather than a 404, so it does not tell you whether
|
|
168
174
|
* the id exists;
|
|
169
|
-
* - `"
|
|
170
|
-
*
|
|
171
|
-
*
|
|
175
|
+
* - `"News feed is not yours"` - the feed belongs to somebody else;
|
|
176
|
+
* - `"Source limit reached (N)"` - you are at the `news_sources` ceiling of
|
|
177
|
+
* `oms.quotas.list()`, which only an administrator raises.
|
|
172
178
|
*
|
|
173
179
|
* Not retried by default: a replayed `POST` after a lost response would fail
|
|
174
180
|
* the uniqueness check rather than duplicate the row, but it would report
|
|
175
181
|
* that failure as if the first attempt had never worked.
|
|
176
182
|
*/
|
|
177
|
-
create(input:
|
|
183
|
+
create(input: CreateNewsSourceInput, options?: RequestOptions): Promise<NewsSource>;
|
|
178
184
|
/**
|
|
179
|
-
* `PATCH /
|
|
185
|
+
* `PATCH /news_sources/:id`.
|
|
180
186
|
*
|
|
181
187
|
* Note what is NOT writable: `health`, `last_error`, `last_run_at`,
|
|
182
188
|
* `last_success_at` and `consecutive_failures` are not on `update_params`, so
|
|
@@ -185,38 +191,35 @@ export declare class IntelSourcesNamespace extends Resource {
|
|
|
185
191
|
* therefore leaves `consecutive_failures` at 20 until the next success - do
|
|
186
192
|
* not read that field as "currently failing".
|
|
187
193
|
*
|
|
188
|
-
* {@link
|
|
194
|
+
* {@link UpdateNewsSourceInput.config} replaces the whole object.
|
|
189
195
|
*
|
|
190
196
|
* @throws {OmsApiError} 404 when the source is not yours; 400 with the
|
|
191
197
|
* validation sentence otherwise.
|
|
192
198
|
*/
|
|
193
|
-
update(id: Id, input:
|
|
199
|
+
update(id: Id, input: UpdateNewsSourceInput, options?: RequestOptions): Promise<NewsSource>;
|
|
194
200
|
/**
|
|
195
|
-
* `DELETE /
|
|
201
|
+
* `DELETE /news_sources/:id`. `204`, empty body.
|
|
196
202
|
*
|
|
197
|
-
* Destructive well beyond the row:
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* ({@link IntelArticleDetail.sources} shrinks, {@link IntelArticle.n_sources}
|
|
201
|
-
* with it) while the stories themselves stay. Disabling is almost always what
|
|
202
|
-
* you meant: `update(id, { enabled: false })`.
|
|
203
|
+
* Destructive well beyond the row: every raw item this source ever produced
|
|
204
|
+
* goes with it. Disabling is almost always what you meant:
|
|
205
|
+
* `update(id, { enabled: false })`.
|
|
203
206
|
*
|
|
204
207
|
* @throws {OmsApiError} 404 when the source is not yours.
|
|
205
208
|
*/
|
|
206
209
|
delete(id: Id, options?: RequestOptions): Promise<void>;
|
|
207
210
|
/**
|
|
208
|
-
* `POST /
|
|
211
|
+
* `POST /news_sources/:id/run` - polls the source now instead of waiting
|
|
209
212
|
* for its interval. `202 {"queued":true}`.
|
|
210
213
|
*
|
|
211
214
|
* **It enqueues; it does not fetch.** The answer arrives before anything has
|
|
212
215
|
* happened, and it says nothing about whether the poll will succeed. To see
|
|
213
|
-
* the outcome, re-read the source and watch {@link
|
|
214
|
-
* {@link
|
|
216
|
+
* the outcome, re-read the source and watch {@link NewsSource.last_run_at},
|
|
217
|
+
* {@link NewsSource.health} and {@link NewsSource.last_error}. There is no
|
|
215
218
|
* job id and nothing to wait on.
|
|
216
219
|
*
|
|
217
220
|
* Three sharp edges:
|
|
218
221
|
*
|
|
219
|
-
* - it runs a source even when {@link
|
|
222
|
+
* - it runs a source even when {@link NewsSource.enabled} is `false`. The
|
|
220
223
|
* action does not look at the flag, so this is also how you test a feed you
|
|
221
224
|
* have deliberately switched off;
|
|
222
225
|
* - it is authorised by VISIBILITY only. The action does its own `find_by`
|
|
@@ -232,5 +235,5 @@ export declare class IntelSourcesNamespace extends Resource {
|
|
|
232
235
|
* @throws {OmsApiError} 404 `"Resource not found"` when the source is not
|
|
233
236
|
* yours.
|
|
234
237
|
*/
|
|
235
|
-
run(id: Id, options?: RequestOptions): Promise<
|
|
238
|
+
run(id: Id, options?: RequestOptions): Promise<NewsSourceRunAccepted>;
|
|
236
239
|
}
|
|
@@ -9,7 +9,7 @@ export type ListNotificationsParams = ListParams<(typeof NOTIFICATION_FILTER_COL
|
|
|
9
9
|
/** Primary key of a notification. An INTEGER. */
|
|
10
10
|
export type NotificationId = number;
|
|
11
11
|
/** Every notification category, in presentation order. */
|
|
12
|
-
export declare const NOTIFICATION_CATEGORIES: readonly ["security", "social", "storage", "tools", "music", "library", "forms", "tickets", "
|
|
12
|
+
export declare const NOTIFICATION_CATEGORIES: readonly ["security", "social", "storage", "tools", "music", "library", "forms", "tickets", "news", "oauth", "admin"];
|
|
13
13
|
/** One of {@link NOTIFICATION_CATEGORIES}. */
|
|
14
14
|
export type NotificationCategory = (typeof NOTIFICATION_CATEGORIES)[number];
|
|
15
15
|
/**
|
|
@@ -20,7 +20,7 @@ export type NotificationCategory = (typeof NOTIFICATION_CATEGORIES)[number];
|
|
|
20
20
|
* `admin_*` kinds only ever reach administrators. The `_done` / `_failed`
|
|
21
21
|
* pairs of the media tools only reach the account that started the job.
|
|
22
22
|
*/
|
|
23
|
-
export declare const NOTIFICATION_KINDS: readonly ["security_new_session", "security_password_changed", "security_email_changed", "security_passkey_added", "security_app_authorized", "friendship_request", "friendship_accepted", "user_followed", "message_received", "group_chat_message", "jam_invite", "fs_grant_received", "chest_expires_soon", "vocal_separation_done", "vocal_separation_failed", "transcription_done", "transcription_failed", "upscale_done", "upscale_failed", "background_removal_done", "background_removal_failed", "caption_job_done", "caption_job_failed", "jumpstyle_job_done", "jumpstyle_job_failed", "song_import_done", "song_import_failed", "spotify_sync_done", "spotify_sync_failed", "artist_import_done", "blog_new_post", "form_submission_received", "ticket_reply", "ticket_status_changed", "
|
|
23
|
+
export declare const NOTIFICATION_KINDS: readonly ["security_new_session", "security_password_changed", "security_email_changed", "security_passkey_added", "security_app_authorized", "friendship_request", "friendship_accepted", "user_followed", "message_received", "group_chat_message", "jam_invite", "fs_grant_received", "chest_expires_soon", "vocal_separation_done", "vocal_separation_failed", "transcription_done", "transcription_failed", "upscale_done", "upscale_failed", "background_removal_done", "background_removal_failed", "caption_job_done", "caption_job_failed", "jumpstyle_job_done", "jumpstyle_job_failed", "song_import_done", "song_import_failed", "spotify_sync_done", "spotify_sync_failed", "artist_import_done", "blog_new_post", "form_submission_received", "ticket_reply", "ticket_status_changed", "news_source_failing", "cron_run_failed", "cron_run_done", "oauth_application_approved", "oauth_application_rejected", "admin_oauth_application_submitted", "admin_ticket_created", "admin_feedback_received"];
|
|
24
24
|
/**
|
|
25
25
|
* One of {@link NOTIFICATION_KINDS}.
|
|
26
26
|
*
|