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.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.3" : "dev";
|
|
3
3
|
var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
|
|
4
4
|
|
|
5
5
|
// src/version-check.ts
|
|
@@ -1148,6 +1148,15 @@ var functionRollback = (options) => (options.client ?? client).post({
|
|
|
1148
1148
|
...options.headers
|
|
1149
1149
|
}
|
|
1150
1150
|
});
|
|
1151
|
+
var functionConditionalRollback = (options) => (options.client ?? client).post({
|
|
1152
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1153
|
+
url: "/functions/{function_id}/rollback/conditional",
|
|
1154
|
+
...options,
|
|
1155
|
+
headers: {
|
|
1156
|
+
"Content-Type": "application/json",
|
|
1157
|
+
...options.headers
|
|
1158
|
+
}
|
|
1159
|
+
});
|
|
1151
1160
|
var functionScheduleDelete = (options) => (options.client ?? client).delete({
|
|
1152
1161
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1153
1162
|
url: "/functions/{function_id}/schedule",
|
|
@@ -1162,6 +1171,39 @@ var functionScheduleSet = (options) => (options.client ?? client).post({
|
|
|
1162
1171
|
...options.headers
|
|
1163
1172
|
}
|
|
1164
1173
|
});
|
|
1174
|
+
var functionSchedulesList = (options) => (options.client ?? client).get({
|
|
1175
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1176
|
+
url: "/functions/{function_id}/schedules",
|
|
1177
|
+
...options
|
|
1178
|
+
});
|
|
1179
|
+
var functionSchedulesAdd = (options) => (options.client ?? client).post({
|
|
1180
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1181
|
+
url: "/functions/{function_id}/schedules",
|
|
1182
|
+
...options,
|
|
1183
|
+
headers: {
|
|
1184
|
+
"Content-Type": "application/json",
|
|
1185
|
+
...options.headers
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
var functionSchedulesResume = (options) => (options.client ?? client).post({
|
|
1189
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1190
|
+
url: "/functions/{function_id}/schedules/resume",
|
|
1191
|
+
...options
|
|
1192
|
+
});
|
|
1193
|
+
var functionSchedulesRemove = (options) => (options.client ?? client).delete({
|
|
1194
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1195
|
+
url: "/functions/{function_id}/schedules/{schedule_id}",
|
|
1196
|
+
...options
|
|
1197
|
+
});
|
|
1198
|
+
var functionSchedulesUpdate = (options) => (options.client ?? client).patch({
|
|
1199
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1200
|
+
url: "/functions/{function_id}/schedules/{schedule_id}",
|
|
1201
|
+
...options,
|
|
1202
|
+
headers: {
|
|
1203
|
+
"Content-Type": "application/json",
|
|
1204
|
+
...options.headers
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1165
1207
|
var functionRunStart = (options) => (options.client ?? client).post({
|
|
1166
1208
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1167
1209
|
url: "/functions/{function_id}/runs/start",
|
|
@@ -2222,6 +2264,11 @@ function createResources(client2, getApiKey) {
|
|
|
2222
2264
|
}
|
|
2223
2265
|
},
|
|
2224
2266
|
functions: {
|
|
2267
|
+
/** functionSchedulesAdd: /functions/{function_id}/schedules. Returns the API response body. */
|
|
2268
|
+
addSchedule: async (functionId, body, requestOptions = {}) => {
|
|
2269
|
+
const response = await functionSchedulesAdd({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body });
|
|
2270
|
+
return response.data;
|
|
2271
|
+
},
|
|
2225
2272
|
/** functionCreate: /functions. Returns the API response body. */
|
|
2226
2273
|
create: async (body, query = void 0, requestOptions = {}) => {
|
|
2227
2274
|
const response = await functionCreate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body, query });
|
|
@@ -2262,6 +2309,11 @@ function createResources(client2, getApiKey) {
|
|
|
2262
2309
|
const response = await listFunctionRunsByFunctionId({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, query });
|
|
2263
2310
|
return response.data;
|
|
2264
2311
|
},
|
|
2312
|
+
/** functionSchedulesList: /functions/{function_id}/schedules. Returns the API response body. */
|
|
2313
|
+
listSchedules: async (functionId, requestOptions = {}) => {
|
|
2314
|
+
const response = await functionSchedulesList({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId } });
|
|
2315
|
+
return response.data;
|
|
2316
|
+
},
|
|
2265
2317
|
/** functionMetadataUpdate: /functions/{function_id}. Returns the API response body. */
|
|
2266
2318
|
metadataUpdate: async (functionId, body, requestOptions = {}) => {
|
|
2267
2319
|
const response = await functionMetadataUpdate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body });
|
|
@@ -2272,6 +2324,16 @@ function createResources(client2, getApiKey) {
|
|
|
2272
2324
|
const response = await prepareRunPayloadUpload({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId, "run_id": runId, "field": field }, body });
|
|
2273
2325
|
return response.data;
|
|
2274
2326
|
},
|
|
2327
|
+
/** functionSchedulesRemove: /functions/{function_id}/schedules/{schedule_id}. Returns the API response body. */
|
|
2328
|
+
removeSchedule: async (functionId, scheduleId, requestOptions = {}) => {
|
|
2329
|
+
const response = await functionSchedulesRemove({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId, "schedule_id": scheduleId } });
|
|
2330
|
+
return response.data;
|
|
2331
|
+
},
|
|
2332
|
+
/** functionSchedulesResume: /functions/{function_id}/schedules/resume. Returns the API response body. */
|
|
2333
|
+
resumeSchedules: async (functionId, requestOptions = {}) => {
|
|
2334
|
+
const response = await functionSchedulesResume({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId } });
|
|
2335
|
+
return response.data;
|
|
2336
|
+
},
|
|
2275
2337
|
/** functionRollback: /functions/{function_id}/rollback. Returns the API response body. */
|
|
2276
2338
|
rollback: async (functionId, body, query = void 0, requestOptions = {}) => {
|
|
2277
2339
|
const response = await functionRollback({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body, query });
|
|
@@ -2311,6 +2373,11 @@ function createResources(client2, getApiKey) {
|
|
|
2311
2373
|
update: async (functionId, body, query = void 0, requestOptions = {}) => {
|
|
2312
2374
|
const response = await functionUpdate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body, query });
|
|
2313
2375
|
return response.data;
|
|
2376
|
+
},
|
|
2377
|
+
/** functionSchedulesUpdate: /functions/{function_id}/schedules/{schedule_id}. Returns the API response body. */
|
|
2378
|
+
updateSchedule: async (functionId, scheduleId, body, requestOptions = {}) => {
|
|
2379
|
+
const response = await functionSchedulesUpdate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId, "schedule_id": scheduleId }, body });
|
|
2380
|
+
return response.data;
|
|
2314
2381
|
}
|
|
2315
2382
|
},
|
|
2316
2383
|
personas: {
|
|
@@ -3131,7 +3198,7 @@ var CLUSTER_OVERLOAD_RETRY_DELAY_MS = 3e4;
|
|
|
3131
3198
|
var CAPTCHA_SOLVE_TIMEOUT_MS = 1e5;
|
|
3132
3199
|
var OBSERVE_MIGRATION_URL = "https://docs.notte.cc/features/sessions/observe-migration";
|
|
3133
3200
|
var OBSERVE_DEPRECATIONS = {
|
|
3134
|
-
instructions: `\`observe({ instructions })\` is deprecated and will be removed on December 1, 2026;
|
|
3201
|
+
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}`,
|
|
3135
3202
|
deep: `\`perception_type: 'deep'\` is deprecated and will be removed on December 1, 2026; use \`perception_type: 'fast'\` (the default). See ${OBSERVE_MIGRATION_URL}`
|
|
3136
3203
|
};
|
|
3137
3204
|
function observeServerOwnedDialog(_dialog) {
|
|
@@ -3847,7 +3914,9 @@ var Session = class {
|
|
|
3847
3914
|
* Deprecated: `perception_type: 'deep'` and `instructions` are removed on
|
|
3848
3915
|
* December 1, 2026, and each warns once per session. Use `perception_type:
|
|
3849
3916
|
* 'fast'` (the default) instead of `'deep'`. For `instructions`:
|
|
3850
|
-
*
|
|
3917
|
+
* the Python SDK's local sessions replace it with `session.act()`; here, call
|
|
3918
|
+
* `observe()` without it and pick from the returned actions. See
|
|
3919
|
+
* https://docs.notte.cc/features/sessions/observe-migration
|
|
3851
3920
|
*
|
|
3852
3921
|
* @param options - Observation settings, including an optional URL, or a perception-mode string.
|
|
3853
3922
|
* @returns Structured page analysis, available actions, and page metadata.
|
|
@@ -4951,19 +5020,22 @@ var NotteFunction = class {
|
|
|
4951
5020
|
* before execution, then pass it to `run(variables, { functionRunId })`.
|
|
4952
5021
|
* `run()` otherwise creates a new run on its own.
|
|
4953
5022
|
*
|
|
4954
|
-
* @param options - Run-record settings; `local` defaults to false. Node execution remains cloud-only.
|
|
5023
|
+
* @param options - Run-record settings; `local` defaults to false. Node execution remains cloud-only. `version` pins a saved version; omitted means the latest.
|
|
4955
5024
|
* @returns A created run record and its ID. No function code has executed yet.
|
|
4956
5025
|
* @throws NotteAPIError if run creation is rejected.
|
|
4957
5026
|
* @example
|
|
4958
5027
|
* const created = await fn.createRun();
|
|
4959
5028
|
* const result = await fn.run({ url: 'https://example.com' }, { functionRunId: created.function_run_id });
|
|
5029
|
+
*
|
|
5030
|
+
* const { versions } = await fn.get();
|
|
5031
|
+
* const pinned = await fn.createRun({ version: versions[0] });
|
|
4960
5032
|
*/
|
|
4961
5033
|
async createRun(options = {}) {
|
|
4962
5034
|
const functionId = await this.ensureInitialized();
|
|
4963
5035
|
return this.postRunEndpoint({
|
|
4964
5036
|
url: FUNCTION_RUN_ENDPOINTS.create,
|
|
4965
5037
|
path: { function_id: functionId },
|
|
4966
|
-
body: { local: options.local ?? false }
|
|
5038
|
+
body: { local: options.local ?? false, ...options.version !== void 0 ? { version: options.version } : {} }
|
|
4967
5039
|
});
|
|
4968
5040
|
}
|
|
4969
5041
|
/**
|
|
@@ -4996,12 +5068,13 @@ var NotteFunction = class {
|
|
|
4996
5068
|
* Pass `{ stream: false }` to receive the backend's JSON response without
|
|
4997
5069
|
* live logs; execution still blocks until completion. Pass `functionRunId`
|
|
4998
5070
|
* to execute a record returned by `createRun()`; otherwise a new run record
|
|
4999
|
-
* is created first, exactly like Python.
|
|
5071
|
+
* is created first, exactly like Python. Pass `version` to run a saved
|
|
5072
|
+
* version instead of the latest one. A failed execution throws
|
|
5000
5073
|
* `FailedToRunCloudFunctionError` unless `raiseOnFailure` is false, and the
|
|
5001
5074
|
* wait is aborted with `NotteTimeoutError` after `timeoutMs`.
|
|
5002
5075
|
*
|
|
5003
5076
|
* @param variables - JSON-serializable keyword arguments passed to the Python function's `run` entry point.
|
|
5004
|
-
* @param options - Log streaming, failure handling, runtime, run ID, and timeout settings.
|
|
5077
|
+
* @param options - Log streaming, failure handling, runtime, run ID, version, and timeout settings.
|
|
5005
5078
|
* @returns The completed execution response. The function's return value is in `result`. Disabling streaming still waits for completion.
|
|
5006
5079
|
* @throws FailedToRunCloudFunctionError if execution fails and `raiseOnFailure` is true.
|
|
5007
5080
|
* @throws NotteTimeoutError if the execution request exceeds `timeoutMs`.
|
|
@@ -5010,6 +5083,9 @@ var NotteFunction = class {
|
|
|
5010
5083
|
* const result = await fn.run({ url: 'https://example.com' });
|
|
5011
5084
|
* console.log(result.result);
|
|
5012
5085
|
*
|
|
5086
|
+
* const { versions } = await fn.get();
|
|
5087
|
+
* await fn.run({ url: 'https://example.com' }, { version: versions[0] });
|
|
5088
|
+
*
|
|
5013
5089
|
* await fn.run({ url: 'https://example.com' }, { runtime: 'extended', onLog: line => logger.info(line) });
|
|
5014
5090
|
*/
|
|
5015
5091
|
async run(variables = {}, options = {}) {
|
|
@@ -5018,8 +5094,11 @@ var NotteFunction = class {
|
|
|
5018
5094
|
if (!(timeoutMs > 0)) {
|
|
5019
5095
|
throw new InvalidRequestError("timeoutMs must be a positive number");
|
|
5020
5096
|
}
|
|
5097
|
+
if (options.version !== void 0 && options.functionRunId !== void 0) {
|
|
5098
|
+
throw new InvalidRequestError("Pass version to createRun({ version }) instead; a run's version is set when it is created");
|
|
5099
|
+
}
|
|
5021
5100
|
const functionId = await this.ensureInitialized();
|
|
5022
|
-
const functionRunId = options.functionRunId ?? (await this.createRun()).function_run_id;
|
|
5101
|
+
const functionRunId = options.functionRunId ?? (await this.createRun({ version: options.version })).function_run_id;
|
|
5023
5102
|
const body = {
|
|
5024
5103
|
workflow_id: functionId,
|
|
5025
5104
|
variables,
|
|
@@ -6367,6 +6446,7 @@ export {
|
|
|
6367
6446
|
executeSessionFile,
|
|
6368
6447
|
extractProductEndpoint,
|
|
6369
6448
|
fetchSpecializedData,
|
|
6449
|
+
functionConditionalRollback,
|
|
6370
6450
|
functionCreate,
|
|
6371
6451
|
functionDelete,
|
|
6372
6452
|
functionDownloadUrl,
|
|
@@ -6380,6 +6460,11 @@ export {
|
|
|
6380
6460
|
functionRuntimeHealth,
|
|
6381
6461
|
functionScheduleDelete,
|
|
6382
6462
|
functionScheduleSet,
|
|
6463
|
+
functionSchedulesAdd,
|
|
6464
|
+
functionSchedulesList,
|
|
6465
|
+
functionSchedulesRemove,
|
|
6466
|
+
functionSchedulesResume,
|
|
6467
|
+
functionSchedulesUpdate,
|
|
6383
6468
|
functionUpdate,
|
|
6384
6469
|
getPayment,
|
|
6385
6470
|
getPolicy,
|