notte-sdk 1.10.1 → 1.10.3
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 +358 -7
- package/dist/index.d.ts +358 -7
- package/dist/index.js +99 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -8
- package/dist/index.mjs.map +1 -1
- package/dist/proxy/core.js +8 -0
- package/dist/proxy/core.js.map +1 -1
- package/dist/proxy/core.mjs +8 -0
- package/dist/proxy/core.mjs.map +1 -1
- package/dist/proxy/next.js +8 -0
- package/dist/proxy/next.js.map +1 -1
- package/dist/proxy/next.mjs +8 -0
- package/dist/proxy/next.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -107,6 +107,7 @@ __export(index_exports, {
|
|
|
107
107
|
executeSessionFile: () => executeSessionFile,
|
|
108
108
|
extractProductEndpoint: () => extractProductEndpoint,
|
|
109
109
|
fetchSpecializedData: () => fetchSpecializedData,
|
|
110
|
+
functionConditionalRollback: () => functionConditionalRollback,
|
|
110
111
|
functionCreate: () => functionCreate,
|
|
111
112
|
functionDelete: () => functionDelete,
|
|
112
113
|
functionDownloadUrl: () => functionDownloadUrl,
|
|
@@ -120,6 +121,11 @@ __export(index_exports, {
|
|
|
120
121
|
functionRuntimeHealth: () => functionRuntimeHealth,
|
|
121
122
|
functionScheduleDelete: () => functionScheduleDelete,
|
|
122
123
|
functionScheduleSet: () => functionScheduleSet,
|
|
124
|
+
functionSchedulesAdd: () => functionSchedulesAdd,
|
|
125
|
+
functionSchedulesList: () => functionSchedulesList,
|
|
126
|
+
functionSchedulesRemove: () => functionSchedulesRemove,
|
|
127
|
+
functionSchedulesResume: () => functionSchedulesResume,
|
|
128
|
+
functionSchedulesUpdate: () => functionSchedulesUpdate,
|
|
123
129
|
functionUpdate: () => functionUpdate,
|
|
124
130
|
getPayment: () => getPayment,
|
|
125
131
|
getPolicy: () => getPolicy,
|
|
@@ -232,7 +238,7 @@ __export(index_exports, {
|
|
|
232
238
|
module.exports = __toCommonJS(index_exports);
|
|
233
239
|
|
|
234
240
|
// src/version.ts
|
|
235
|
-
var SDK_VERSION = true ? "1.10.
|
|
241
|
+
var SDK_VERSION = true ? "1.10.3" : "dev";
|
|
236
242
|
var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
|
|
237
243
|
|
|
238
244
|
// src/version-check.ts
|
|
@@ -1381,6 +1387,15 @@ var functionRollback = (options) => (options.client ?? client).post({
|
|
|
1381
1387
|
...options.headers
|
|
1382
1388
|
}
|
|
1383
1389
|
});
|
|
1390
|
+
var functionConditionalRollback = (options) => (options.client ?? client).post({
|
|
1391
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1392
|
+
url: "/functions/{function_id}/rollback/conditional",
|
|
1393
|
+
...options,
|
|
1394
|
+
headers: {
|
|
1395
|
+
"Content-Type": "application/json",
|
|
1396
|
+
...options.headers
|
|
1397
|
+
}
|
|
1398
|
+
});
|
|
1384
1399
|
var functionScheduleDelete = (options) => (options.client ?? client).delete({
|
|
1385
1400
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1386
1401
|
url: "/functions/{function_id}/schedule",
|
|
@@ -1395,6 +1410,39 @@ var functionScheduleSet = (options) => (options.client ?? client).post({
|
|
|
1395
1410
|
...options.headers
|
|
1396
1411
|
}
|
|
1397
1412
|
});
|
|
1413
|
+
var functionSchedulesList = (options) => (options.client ?? client).get({
|
|
1414
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1415
|
+
url: "/functions/{function_id}/schedules",
|
|
1416
|
+
...options
|
|
1417
|
+
});
|
|
1418
|
+
var functionSchedulesAdd = (options) => (options.client ?? client).post({
|
|
1419
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1420
|
+
url: "/functions/{function_id}/schedules",
|
|
1421
|
+
...options,
|
|
1422
|
+
headers: {
|
|
1423
|
+
"Content-Type": "application/json",
|
|
1424
|
+
...options.headers
|
|
1425
|
+
}
|
|
1426
|
+
});
|
|
1427
|
+
var functionSchedulesResume = (options) => (options.client ?? client).post({
|
|
1428
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1429
|
+
url: "/functions/{function_id}/schedules/resume",
|
|
1430
|
+
...options
|
|
1431
|
+
});
|
|
1432
|
+
var functionSchedulesRemove = (options) => (options.client ?? client).delete({
|
|
1433
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1434
|
+
url: "/functions/{function_id}/schedules/{schedule_id}",
|
|
1435
|
+
...options
|
|
1436
|
+
});
|
|
1437
|
+
var functionSchedulesUpdate = (options) => (options.client ?? client).patch({
|
|
1438
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1439
|
+
url: "/functions/{function_id}/schedules/{schedule_id}",
|
|
1440
|
+
...options,
|
|
1441
|
+
headers: {
|
|
1442
|
+
"Content-Type": "application/json",
|
|
1443
|
+
...options.headers
|
|
1444
|
+
}
|
|
1445
|
+
});
|
|
1398
1446
|
var functionRunStart = (options) => (options.client ?? client).post({
|
|
1399
1447
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1400
1448
|
url: "/functions/{function_id}/runs/start",
|
|
@@ -2455,6 +2503,11 @@ function createResources(client2, getApiKey) {
|
|
|
2455
2503
|
}
|
|
2456
2504
|
},
|
|
2457
2505
|
functions: {
|
|
2506
|
+
/** functionSchedulesAdd: /functions/{function_id}/schedules. Returns the API response body. */
|
|
2507
|
+
addSchedule: async (functionId, body, requestOptions = {}) => {
|
|
2508
|
+
const response = await functionSchedulesAdd({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body });
|
|
2509
|
+
return response.data;
|
|
2510
|
+
},
|
|
2458
2511
|
/** functionCreate: /functions. Returns the API response body. */
|
|
2459
2512
|
create: async (body, query = void 0, requestOptions = {}) => {
|
|
2460
2513
|
const response = await functionCreate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body, query });
|
|
@@ -2495,6 +2548,11 @@ function createResources(client2, getApiKey) {
|
|
|
2495
2548
|
const response = await listFunctionRunsByFunctionId({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, query });
|
|
2496
2549
|
return response.data;
|
|
2497
2550
|
},
|
|
2551
|
+
/** functionSchedulesList: /functions/{function_id}/schedules. Returns the API response body. */
|
|
2552
|
+
listSchedules: async (functionId, requestOptions = {}) => {
|
|
2553
|
+
const response = await functionSchedulesList({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId } });
|
|
2554
|
+
return response.data;
|
|
2555
|
+
},
|
|
2498
2556
|
/** functionMetadataUpdate: /functions/{function_id}. Returns the API response body. */
|
|
2499
2557
|
metadataUpdate: async (functionId, body, requestOptions = {}) => {
|
|
2500
2558
|
const response = await functionMetadataUpdate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body });
|
|
@@ -2505,6 +2563,16 @@ function createResources(client2, getApiKey) {
|
|
|
2505
2563
|
const response = await prepareRunPayloadUpload({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId, "run_id": runId, "field": field }, body });
|
|
2506
2564
|
return response.data;
|
|
2507
2565
|
},
|
|
2566
|
+
/** functionSchedulesRemove: /functions/{function_id}/schedules/{schedule_id}. Returns the API response body. */
|
|
2567
|
+
removeSchedule: async (functionId, scheduleId, requestOptions = {}) => {
|
|
2568
|
+
const response = await functionSchedulesRemove({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId, "schedule_id": scheduleId } });
|
|
2569
|
+
return response.data;
|
|
2570
|
+
},
|
|
2571
|
+
/** functionSchedulesResume: /functions/{function_id}/schedules/resume. Returns the API response body. */
|
|
2572
|
+
resumeSchedules: async (functionId, requestOptions = {}) => {
|
|
2573
|
+
const response = await functionSchedulesResume({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId } });
|
|
2574
|
+
return response.data;
|
|
2575
|
+
},
|
|
2508
2576
|
/** functionRollback: /functions/{function_id}/rollback. Returns the API response body. */
|
|
2509
2577
|
rollback: async (functionId, body, query = void 0, requestOptions = {}) => {
|
|
2510
2578
|
const response = await functionRollback({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body, query });
|
|
@@ -2544,6 +2612,11 @@ function createResources(client2, getApiKey) {
|
|
|
2544
2612
|
update: async (functionId, body, query = void 0, requestOptions = {}) => {
|
|
2545
2613
|
const response = await functionUpdate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body, query });
|
|
2546
2614
|
return response.data;
|
|
2615
|
+
},
|
|
2616
|
+
/** functionSchedulesUpdate: /functions/{function_id}/schedules/{schedule_id}. Returns the API response body. */
|
|
2617
|
+
updateSchedule: async (functionId, scheduleId, body, requestOptions = {}) => {
|
|
2618
|
+
const response = await functionSchedulesUpdate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId, "schedule_id": scheduleId }, body });
|
|
2619
|
+
return response.data;
|
|
2547
2620
|
}
|
|
2548
2621
|
},
|
|
2549
2622
|
personas: {
|
|
@@ -3364,7 +3437,7 @@ var CLUSTER_OVERLOAD_RETRY_DELAY_MS = 3e4;
|
|
|
3364
3437
|
var CAPTCHA_SOLVE_TIMEOUT_MS = 1e5;
|
|
3365
3438
|
var OBSERVE_MIGRATION_URL = "https://docs.notte.cc/features/sessions/observe-migration";
|
|
3366
3439
|
var OBSERVE_DEPRECATIONS = {
|
|
3367
|
-
instructions: `\`observe({ instructions })\` is deprecated and will be removed on December 1, 2026;
|
|
3440
|
+
instructions: `\`observe({ instructions })\` is deprecated and will be removed on December 1, 2026; the Python SDK's local sessions replace it with session.act(); here, call observe() without it and pick from the returned actions. See ${OBSERVE_MIGRATION_URL}`,
|
|
3368
3441
|
deep: `\`perception_type: 'deep'\` is deprecated and will be removed on December 1, 2026; use \`perception_type: 'fast'\` (the default). See ${OBSERVE_MIGRATION_URL}`
|
|
3369
3442
|
};
|
|
3370
3443
|
function observeServerOwnedDialog(_dialog) {
|
|
@@ -4080,7 +4153,9 @@ var Session = class {
|
|
|
4080
4153
|
* Deprecated: `perception_type: 'deep'` and `instructions` are removed on
|
|
4081
4154
|
* December 1, 2026, and each warns once per session. Use `perception_type:
|
|
4082
4155
|
* 'fast'` (the default) instead of `'deep'`. For `instructions`:
|
|
4083
|
-
*
|
|
4156
|
+
* the Python SDK's local sessions replace it with `session.act()`; here, call
|
|
4157
|
+
* `observe()` without it and pick from the returned actions. See
|
|
4158
|
+
* https://docs.notte.cc/features/sessions/observe-migration
|
|
4084
4159
|
*
|
|
4085
4160
|
* @param options - Observation settings, including an optional URL, or a perception-mode string.
|
|
4086
4161
|
* @returns Structured page analysis, available actions, and page metadata.
|
|
@@ -5184,19 +5259,22 @@ var NotteFunction = class {
|
|
|
5184
5259
|
* before execution, then pass it to `run(variables, { functionRunId })`.
|
|
5185
5260
|
* `run()` otherwise creates a new run on its own.
|
|
5186
5261
|
*
|
|
5187
|
-
* @param options - Run-record settings; `local` defaults to false. Node execution remains cloud-only.
|
|
5262
|
+
* @param options - Run-record settings; `local` defaults to false. Node execution remains cloud-only. `version` pins a saved version; omitted means the latest.
|
|
5188
5263
|
* @returns A created run record and its ID. No function code has executed yet.
|
|
5189
5264
|
* @throws NotteAPIError if run creation is rejected.
|
|
5190
5265
|
* @example
|
|
5191
5266
|
* const created = await fn.createRun();
|
|
5192
5267
|
* const result = await fn.run({ url: 'https://example.com' }, { functionRunId: created.function_run_id });
|
|
5268
|
+
*
|
|
5269
|
+
* const { versions } = await fn.get();
|
|
5270
|
+
* const pinned = await fn.createRun({ version: versions[0] });
|
|
5193
5271
|
*/
|
|
5194
5272
|
async createRun(options = {}) {
|
|
5195
5273
|
const functionId = await this.ensureInitialized();
|
|
5196
5274
|
return this.postRunEndpoint({
|
|
5197
5275
|
url: FUNCTION_RUN_ENDPOINTS.create,
|
|
5198
5276
|
path: { function_id: functionId },
|
|
5199
|
-
body: { local: options.local ?? false }
|
|
5277
|
+
body: { local: options.local ?? false, ...options.version !== void 0 ? { version: options.version } : {} }
|
|
5200
5278
|
});
|
|
5201
5279
|
}
|
|
5202
5280
|
/**
|
|
@@ -5229,12 +5307,13 @@ var NotteFunction = class {
|
|
|
5229
5307
|
* Pass `{ stream: false }` to receive the backend's JSON response without
|
|
5230
5308
|
* live logs; execution still blocks until completion. Pass `functionRunId`
|
|
5231
5309
|
* to execute a record returned by `createRun()`; otherwise a new run record
|
|
5232
|
-
* is created first, exactly like Python.
|
|
5310
|
+
* is created first, exactly like Python. Pass `version` to run a saved
|
|
5311
|
+
* version instead of the latest one. A failed execution throws
|
|
5233
5312
|
* `FailedToRunCloudFunctionError` unless `raiseOnFailure` is false, and the
|
|
5234
5313
|
* wait is aborted with `NotteTimeoutError` after `timeoutMs`.
|
|
5235
5314
|
*
|
|
5236
5315
|
* @param variables - JSON-serializable keyword arguments passed to the Python function's `run` entry point.
|
|
5237
|
-
* @param options - Log streaming, failure handling, runtime, run ID, and timeout settings.
|
|
5316
|
+
* @param options - Log streaming, failure handling, runtime, run ID, version, and timeout settings.
|
|
5238
5317
|
* @returns The completed execution response. The function's return value is in `result`. Disabling streaming still waits for completion.
|
|
5239
5318
|
* @throws FailedToRunCloudFunctionError if execution fails and `raiseOnFailure` is true.
|
|
5240
5319
|
* @throws NotteTimeoutError if the execution request exceeds `timeoutMs`.
|
|
@@ -5243,6 +5322,9 @@ var NotteFunction = class {
|
|
|
5243
5322
|
* const result = await fn.run({ url: 'https://example.com' });
|
|
5244
5323
|
* console.log(result.result);
|
|
5245
5324
|
*
|
|
5325
|
+
* const { versions } = await fn.get();
|
|
5326
|
+
* await fn.run({ url: 'https://example.com' }, { version: versions[0] });
|
|
5327
|
+
*
|
|
5246
5328
|
* await fn.run({ url: 'https://example.com' }, { runtime: 'extended', onLog: line => logger.info(line) });
|
|
5247
5329
|
*/
|
|
5248
5330
|
async run(variables = {}, options = {}) {
|
|
@@ -5251,8 +5333,11 @@ var NotteFunction = class {
|
|
|
5251
5333
|
if (!(timeoutMs > 0)) {
|
|
5252
5334
|
throw new InvalidRequestError("timeoutMs must be a positive number");
|
|
5253
5335
|
}
|
|
5336
|
+
if (options.version !== void 0 && options.functionRunId !== void 0) {
|
|
5337
|
+
throw new InvalidRequestError("Pass version to createRun({ version }) instead; a run's version is set when it is created");
|
|
5338
|
+
}
|
|
5254
5339
|
const functionId = await this.ensureInitialized();
|
|
5255
|
-
const functionRunId = options.functionRunId ?? (await this.createRun()).function_run_id;
|
|
5340
|
+
const functionRunId = options.functionRunId ?? (await this.createRun({ version: options.version })).function_run_id;
|
|
5256
5341
|
const body = {
|
|
5257
5342
|
workflow_id: functionId,
|
|
5258
5343
|
variables,
|
|
@@ -6600,6 +6685,7 @@ var createClient2 = (config) => {
|
|
|
6600
6685
|
executeSessionFile,
|
|
6601
6686
|
extractProductEndpoint,
|
|
6602
6687
|
fetchSpecializedData,
|
|
6688
|
+
functionConditionalRollback,
|
|
6603
6689
|
functionCreate,
|
|
6604
6690
|
functionDelete,
|
|
6605
6691
|
functionDownloadUrl,
|
|
@@ -6613,6 +6699,11 @@ var createClient2 = (config) => {
|
|
|
6613
6699
|
functionRuntimeHealth,
|
|
6614
6700
|
functionScheduleDelete,
|
|
6615
6701
|
functionScheduleSet,
|
|
6702
|
+
functionSchedulesAdd,
|
|
6703
|
+
functionSchedulesList,
|
|
6704
|
+
functionSchedulesRemove,
|
|
6705
|
+
functionSchedulesResume,
|
|
6706
|
+
functionSchedulesUpdate,
|
|
6616
6707
|
functionUpdate,
|
|
6617
6708
|
getPayment,
|
|
6618
6709
|
getPolicy,
|