notte-sdk 1.10.13 → 1.10.14
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/dist/index.d.mts +2891 -2682
- package/dist/index.d.ts +2891 -2682
- package/dist/index.js +127 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -50
- package/dist/index.mjs.map +1 -1
- package/dist/proxy/core.js +2 -0
- package/dist/proxy/core.js.map +1 -1
- package/dist/proxy/core.mjs +2 -0
- package/dist/proxy/core.mjs.map +1 -1
- package/dist/proxy/next.js +2 -0
- package/dist/proxy/next.js.map +1 -1
- package/dist/proxy/next.mjs +2 -0
- package/dist/proxy/next.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SDK_VERSION = true ? "1.10.
|
|
2
|
+
var SDK_VERSION = true ? "1.10.14" : "dev";
|
|
3
3
|
var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
|
|
4
4
|
|
|
5
5
|
// src/version-check.ts
|
|
@@ -961,6 +961,11 @@ var sessionStatus = (options) => (options.client ?? client).get({
|
|
|
961
961
|
url: "/sessions/{session_id}",
|
|
962
962
|
...options
|
|
963
963
|
});
|
|
964
|
+
var sessionSteps = (options) => (options.client ?? client).get({
|
|
965
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
966
|
+
url: "/sessions/{session_id}/steps",
|
|
967
|
+
...options
|
|
968
|
+
});
|
|
964
969
|
var sessionProfilePreview = (options) => (options.client ?? client).get({
|
|
965
970
|
security: [{ scheme: "bearer", type: "http" }],
|
|
966
971
|
url: "/sessions/{session_id}/profile-preview",
|
|
@@ -1466,49 +1471,6 @@ var profileList = (options) => (options?.client ?? client).get({
|
|
|
1466
1471
|
url: "/profiles",
|
|
1467
1472
|
...options
|
|
1468
1473
|
});
|
|
1469
|
-
var personaCreate = (options) => (options.client ?? client).post({
|
|
1470
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1471
|
-
url: "/personas/create",
|
|
1472
|
-
...options,
|
|
1473
|
-
headers: {
|
|
1474
|
-
"Content-Type": "application/json",
|
|
1475
|
-
...options.headers
|
|
1476
|
-
}
|
|
1477
|
-
});
|
|
1478
|
-
var personaDelete = (options) => (options.client ?? client).delete({
|
|
1479
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1480
|
-
url: "/personas/{persona_id}",
|
|
1481
|
-
...options
|
|
1482
|
-
});
|
|
1483
|
-
var personaGet = (options) => (options.client ?? client).get({
|
|
1484
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1485
|
-
url: "/personas/{persona_id}",
|
|
1486
|
-
...options
|
|
1487
|
-
});
|
|
1488
|
-
var personaUpdate = (options) => (options.client ?? client).patch({
|
|
1489
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1490
|
-
url: "/personas/{persona_id}",
|
|
1491
|
-
...options,
|
|
1492
|
-
headers: {
|
|
1493
|
-
"Content-Type": "application/json",
|
|
1494
|
-
...options.headers
|
|
1495
|
-
}
|
|
1496
|
-
});
|
|
1497
|
-
var personaEmailsList = (options) => (options.client ?? client).get({
|
|
1498
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1499
|
-
url: "/personas/{persona_id}/emails",
|
|
1500
|
-
...options
|
|
1501
|
-
});
|
|
1502
|
-
var listPersonas = (options) => (options?.client ?? client).get({
|
|
1503
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1504
|
-
url: "/personas",
|
|
1505
|
-
...options
|
|
1506
|
-
});
|
|
1507
|
-
var personaSmsList = (options) => (options.client ?? client).get({
|
|
1508
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1509
|
-
url: "/personas/{persona_id}/sms",
|
|
1510
|
-
...options
|
|
1511
|
-
});
|
|
1512
1474
|
var mailboxConnectToken = (options) => (options.client ?? client).post({
|
|
1513
1475
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1514
1476
|
url: "/mailboxes/connect-token",
|
|
@@ -1620,11 +1582,6 @@ var deleteSecret = (options) => (options.client ?? client).delete({
|
|
|
1620
1582
|
url: "/secrets/{secret_id}",
|
|
1621
1583
|
...options
|
|
1622
1584
|
});
|
|
1623
|
-
var listSecretProxyHostPresets = (options) => (options?.client ?? client).get({
|
|
1624
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1625
|
-
url: "/secret-proxy/host-presets",
|
|
1626
|
-
...options
|
|
1627
|
-
});
|
|
1628
1585
|
var healthCheck = (options) => (options?.client ?? client).get({ url: "/health", ...options });
|
|
1629
1586
|
var readyCheck = (options) => (options?.client ?? client).get({ url: "/ready", ...options });
|
|
1630
1587
|
var scrapeWebpage = (options) => (options.client ?? client).post({
|
|
@@ -1868,6 +1825,54 @@ var listAuditEvents = (options) => (options?.client ?? client).get({
|
|
|
1868
1825
|
url: "/audit-events",
|
|
1869
1826
|
...options
|
|
1870
1827
|
});
|
|
1828
|
+
var listPersonas = (options) => (options?.client ?? client).get({
|
|
1829
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1830
|
+
url: "/personas",
|
|
1831
|
+
...options
|
|
1832
|
+
});
|
|
1833
|
+
var personaCreate = (options) => (options.client ?? client).post({
|
|
1834
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1835
|
+
url: "/personas/create",
|
|
1836
|
+
...options,
|
|
1837
|
+
headers: {
|
|
1838
|
+
"Content-Type": "application/json",
|
|
1839
|
+
...options.headers
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
var personaDelete = (options) => (options.client ?? client).delete({
|
|
1843
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1844
|
+
url: "/personas/{persona_id}",
|
|
1845
|
+
...options
|
|
1846
|
+
});
|
|
1847
|
+
var personaGet = (options) => (options.client ?? client).get({
|
|
1848
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1849
|
+
url: "/personas/{persona_id}",
|
|
1850
|
+
...options
|
|
1851
|
+
});
|
|
1852
|
+
var personaUpdate = (options) => (options.client ?? client).patch({
|
|
1853
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1854
|
+
url: "/personas/{persona_id}",
|
|
1855
|
+
...options,
|
|
1856
|
+
headers: {
|
|
1857
|
+
"Content-Type": "application/json",
|
|
1858
|
+
...options.headers
|
|
1859
|
+
}
|
|
1860
|
+
});
|
|
1861
|
+
var personaEmailsList = (options) => (options.client ?? client).get({
|
|
1862
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1863
|
+
url: "/personas/{persona_id}/emails",
|
|
1864
|
+
...options
|
|
1865
|
+
});
|
|
1866
|
+
var personaSmsList = (options) => (options.client ?? client).get({
|
|
1867
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1868
|
+
url: "/personas/{persona_id}/sms",
|
|
1869
|
+
...options
|
|
1870
|
+
});
|
|
1871
|
+
var listSecretProxyHostPresets = (options) => (options?.client ?? client).get({
|
|
1872
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1873
|
+
url: "/secret-proxy/host-presets",
|
|
1874
|
+
...options
|
|
1875
|
+
});
|
|
1871
1876
|
var getUsage = (options) => (options?.client ?? client).get({
|
|
1872
1877
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1873
1878
|
url: "/usage",
|
|
@@ -2447,6 +2452,7 @@ function createResources(client2, getApiKey) {
|
|
|
2447
2452
|
},
|
|
2448
2453
|
/** functionRunStart: /functions/{function_id}/runs/start. Returns the API response body. */
|
|
2449
2454
|
runStart: async (functionId, body, requestOptions = {}) => {
|
|
2455
|
+
if (typeof functionId !== "string" || !functionId.trim()) throw new TypeError("runStart requires a non-empty functionId.");
|
|
2450
2456
|
const response = await functionRunStart({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers, "x-notte-api-key": getApiKey() }, path: { "function_id": functionId }, body });
|
|
2451
2457
|
return response.data;
|
|
2452
2458
|
},
|
|
@@ -3296,6 +3302,25 @@ function abortableSleep(ms, signal) {
|
|
|
3296
3302
|
});
|
|
3297
3303
|
}
|
|
3298
3304
|
|
|
3305
|
+
// src/session-steps.ts
|
|
3306
|
+
async function getSessionSteps(client2, sessionId, options = {}) {
|
|
3307
|
+
const response = await client2.getClient().get({
|
|
3308
|
+
url: `/sessions/${encodeURIComponent(sessionId)}/steps`,
|
|
3309
|
+
query: { cursor: options.cursor, limit: options.limit },
|
|
3310
|
+
throwOnError: true
|
|
3311
|
+
});
|
|
3312
|
+
return { steps: response.data.steps ?? [], next_cursor: response.data.next_cursor ?? null };
|
|
3313
|
+
}
|
|
3314
|
+
async function* iterSessionSteps(client2, sessionId, options = {}) {
|
|
3315
|
+
let cursor;
|
|
3316
|
+
while (true) {
|
|
3317
|
+
const page = await getSessionSteps(client2, sessionId, { cursor, limit: options.limit });
|
|
3318
|
+
yield* page.steps;
|
|
3319
|
+
if (page.next_cursor === null) return;
|
|
3320
|
+
cursor = page.next_cursor;
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3299
3324
|
// src/session.ts
|
|
3300
3325
|
var SESSION_START_TRIES = 3;
|
|
3301
3326
|
var CLUSTER_OVERLOAD_RETRY_DELAY_MS = 3e4;
|
|
@@ -3806,6 +3831,36 @@ var Session = class {
|
|
|
3806
3831
|
});
|
|
3807
3832
|
return response.data;
|
|
3808
3833
|
}
|
|
3834
|
+
/**
|
|
3835
|
+
* Get one page of the session's steps. Each step has the shape of an item of
|
|
3836
|
+
* `status().steps`. Pass the page's `next_cursor` back as `cursor`, as is, to
|
|
3837
|
+
* get the next page; it is `null` on the last page. Works after `stop()`.
|
|
3838
|
+
*
|
|
3839
|
+
* @throws NotteAPIError with status 400 when `cursor` is no longer valid: restart from the first page (no `cursor`).
|
|
3840
|
+
* @example
|
|
3841
|
+
* let page = await session.steps({ limit: 50 });
|
|
3842
|
+
* while (page.next_cursor !== null) {
|
|
3843
|
+
* page = await session.steps({ cursor: page.next_cursor, limit: 50 });
|
|
3844
|
+
* }
|
|
3845
|
+
*/
|
|
3846
|
+
async steps(options = {}) {
|
|
3847
|
+
return getSessionSteps(this.client, this.lastSessionId(), options);
|
|
3848
|
+
}
|
|
3849
|
+
/**
|
|
3850
|
+
* Iterate over all of the session's steps, following `next_cursor` page by page.
|
|
3851
|
+
* A cursor that is no longer valid stops the iteration with a `NotteAPIError`
|
|
3852
|
+
* with status 400, after the steps already yielded; it is not restarted here,
|
|
3853
|
+
* since that would yield those steps again. To read the steps again, start a
|
|
3854
|
+
* new iteration. Works after `stop()`.
|
|
3855
|
+
*
|
|
3856
|
+
* @example
|
|
3857
|
+
* for await (const step of session.iterSteps({ limit: 50 })) {
|
|
3858
|
+
* console.log(step);
|
|
3859
|
+
* }
|
|
3860
|
+
*/
|
|
3861
|
+
async *iterSteps(options = {}) {
|
|
3862
|
+
yield* iterSessionSteps(this.client, this.lastSessionId(), options);
|
|
3863
|
+
}
|
|
3809
3864
|
// #######################################################################
|
|
3810
3865
|
// ############################# Debug / CDP #############################
|
|
3811
3866
|
// #######################################################################
|
|
@@ -6273,7 +6328,27 @@ var NotteClient3 = class {
|
|
|
6273
6328
|
list: async (options = {}) => {
|
|
6274
6329
|
const response = await listSessions({ client: this.getClient(), query: options });
|
|
6275
6330
|
return response.data?.items ?? [];
|
|
6276
|
-
}
|
|
6331
|
+
},
|
|
6332
|
+
/**
|
|
6333
|
+
* One page of the session's steps (`{ steps, next_cursor }`), from
|
|
6334
|
+
* `GET /sessions/{session_id}/steps`. Each step has the shape of an item of
|
|
6335
|
+
* `status().steps`. Pass `next_cursor` back as `cursor`, as is, for the next
|
|
6336
|
+
* page; it is `null` on the last page. A `NotteAPIError` with status 400 means
|
|
6337
|
+
* the cursor is no longer valid: restart from the first page (no `cursor`).
|
|
6338
|
+
*/
|
|
6339
|
+
steps: (sessionId, options = {}) => getSessionSteps(this, sessionId, options),
|
|
6340
|
+
/**
|
|
6341
|
+
* Every step of the session, following `next_cursor` page by page. A cursor
|
|
6342
|
+
* that is no longer valid stops the iteration with the 400 `NotteAPIError`,
|
|
6343
|
+
* after the steps already yielded; start a new iteration to read them again.
|
|
6344
|
+
*
|
|
6345
|
+
* ```ts
|
|
6346
|
+
* for await (const step of client.sessions.iterSteps(sessionId, { limit: 50 })) {
|
|
6347
|
+
* console.log(step);
|
|
6348
|
+
* }
|
|
6349
|
+
* ```
|
|
6350
|
+
*/
|
|
6351
|
+
iterSteps: (sessionId, options = {}) => iterSessionSteps(this, sessionId, options)
|
|
6277
6352
|
};
|
|
6278
6353
|
}
|
|
6279
6354
|
/** Client-bound vault API operations. `list()` retains its array return value. */
|
|
@@ -6705,6 +6780,7 @@ export {
|
|
|
6705
6780
|
sessionResume,
|
|
6706
6781
|
sessionStart,
|
|
6707
6782
|
sessionStatus,
|
|
6783
|
+
sessionSteps,
|
|
6708
6784
|
sessionStop,
|
|
6709
6785
|
startVersionCheck,
|
|
6710
6786
|
storeSecret,
|