@telemai/sdk 0.3.0 → 0.3.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.
- package/README.md +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -204,7 +204,7 @@ A monitor runs a query on a schedule. Poll it to get the results that are new si
|
|
|
204
204
|
your last poll. `poll` returns a `SearchResponse`:
|
|
205
205
|
|
|
206
206
|
```ts
|
|
207
|
-
const monitor = await telem.monitors.create("Nvidia files a new 8-K with the SEC", { frequency: "1h" })
|
|
207
|
+
const monitor = await telem.monitors.create("Nvidia files a new 8-K with the SEC", { frequency: "1h", ttl: "7d" })
|
|
208
208
|
const response = await telem.monitors.poll(monitor.id)
|
|
209
209
|
await telem.monitors.update(monitor.id, { status: "paused" })
|
|
210
210
|
await telem.monitors.delete(monitor.id)
|
package/dist/index.cjs
CHANGED
|
@@ -60,7 +60,7 @@ var TimeoutError = class extends TelemError {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
// src/version.ts
|
|
63
|
-
var VERSION = "0.3.
|
|
63
|
+
var VERSION = "0.3.1";
|
|
64
64
|
|
|
65
65
|
// src/config.ts
|
|
66
66
|
var DEFAULT_BASE_URL = "https://router.telem.ai";
|
|
@@ -707,6 +707,7 @@ function monitorFrom(body) {
|
|
|
707
707
|
sessionId: String(data.session_id ?? ""),
|
|
708
708
|
createdAt: data.created_at ?? "",
|
|
709
709
|
lastPolledAt: data.last_polled_at ?? null,
|
|
710
|
+
expiresAt: data.expires_at ?? null,
|
|
710
711
|
webhookUrl: data.webhook_url ?? null,
|
|
711
712
|
webhookSecret: data.webhook_secret ?? null,
|
|
712
713
|
raw: data
|
|
@@ -723,6 +724,7 @@ function createMonitors(config) {
|
|
|
723
724
|
const body = { query, options: { frequency: options.frequency } };
|
|
724
725
|
if (options.metadata !== void 0) body.metadata = options.metadata;
|
|
725
726
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
727
|
+
if (options.ttl !== void 0) body.ttl = options.ttl;
|
|
726
728
|
const data = await request(config, "POST", "/v1/monitors", body, options.signal, "rate_limit");
|
|
727
729
|
return monitorFrom(data);
|
|
728
730
|
},
|
package/dist/index.d.cts
CHANGED
|
@@ -230,6 +230,8 @@ type MonitorCreateOptions = {
|
|
|
230
230
|
metadata?: Json;
|
|
231
231
|
/** An `https` URL that receives the new results. */
|
|
232
232
|
webhookUrl?: string;
|
|
233
|
+
/** Delete the monitor after this long, such as `"12h"` or `"7d"` (at most `"30d"`). Without it, the monitor never expires. */
|
|
234
|
+
ttl?: string;
|
|
233
235
|
signal?: AbortSignal;
|
|
234
236
|
};
|
|
235
237
|
/** Options for `monitors.update`. Send at least one field. */
|
|
@@ -259,6 +261,8 @@ type Monitor = {
|
|
|
259
261
|
sessionId: string;
|
|
260
262
|
createdAt: string;
|
|
261
263
|
lastPolledAt: string | null;
|
|
264
|
+
/** When Telem deletes the monitor; `null`: never. */
|
|
265
|
+
expiresAt: string | null;
|
|
262
266
|
webhookUrl: string | null;
|
|
263
267
|
/** Signs the webhook deliveries. Only in the response that set `webhookUrl`. */
|
|
264
268
|
webhookSecret: string | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -230,6 +230,8 @@ type MonitorCreateOptions = {
|
|
|
230
230
|
metadata?: Json;
|
|
231
231
|
/** An `https` URL that receives the new results. */
|
|
232
232
|
webhookUrl?: string;
|
|
233
|
+
/** Delete the monitor after this long, such as `"12h"` or `"7d"` (at most `"30d"`). Without it, the monitor never expires. */
|
|
234
|
+
ttl?: string;
|
|
233
235
|
signal?: AbortSignal;
|
|
234
236
|
};
|
|
235
237
|
/** Options for `monitors.update`. Send at least one field. */
|
|
@@ -259,6 +261,8 @@ type Monitor = {
|
|
|
259
261
|
sessionId: string;
|
|
260
262
|
createdAt: string;
|
|
261
263
|
lastPolledAt: string | null;
|
|
264
|
+
/** When Telem deletes the monitor; `null`: never. */
|
|
265
|
+
expiresAt: string | null;
|
|
262
266
|
webhookUrl: string | null;
|
|
263
267
|
/** Signs the webhook deliveries. Only in the response that set `webhookUrl`. */
|
|
264
268
|
webhookSecret: string | null;
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "./chunk-DKTEG7EY.js";
|
|
23
23
|
|
|
24
24
|
// src/version.ts
|
|
25
|
-
var VERSION = "0.3.
|
|
25
|
+
var VERSION = "0.3.1";
|
|
26
26
|
|
|
27
27
|
// src/config.ts
|
|
28
28
|
var DEFAULT_BASE_URL = "https://router.telem.ai";
|
|
@@ -340,6 +340,7 @@ function monitorFrom(body) {
|
|
|
340
340
|
sessionId: String(data.session_id ?? ""),
|
|
341
341
|
createdAt: data.created_at ?? "",
|
|
342
342
|
lastPolledAt: data.last_polled_at ?? null,
|
|
343
|
+
expiresAt: data.expires_at ?? null,
|
|
343
344
|
webhookUrl: data.webhook_url ?? null,
|
|
344
345
|
webhookSecret: data.webhook_secret ?? null,
|
|
345
346
|
raw: data
|
|
@@ -356,6 +357,7 @@ function createMonitors(config) {
|
|
|
356
357
|
const body = { query, options: { frequency: options.frequency } };
|
|
357
358
|
if (options.metadata !== void 0) body.metadata = options.metadata;
|
|
358
359
|
if (options.webhookUrl !== void 0) body.webhook_url = options.webhookUrl;
|
|
360
|
+
if (options.ttl !== void 0) body.ttl = options.ttl;
|
|
359
361
|
const data = await request(config, "POST", "/v1/monitors", body, options.signal, "rate_limit");
|
|
360
362
|
return monitorFrom(data);
|
|
361
363
|
},
|