notte-sdk 1.10.2 → 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 +287 -5
- package/dist/index.d.ts +287 -5
- package/dist/index.js +84 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -6
- package/dist/index.mjs.map +1 -1
- package/dist/proxy/core.js +6 -0
- package/dist/proxy/core.js.map +1 -1
- package/dist/proxy/core.mjs +6 -0
- package/dist/proxy/core.mjs.map +1 -1
- package/dist/proxy/next.js +6 -0
- package/dist/proxy/next.js.map +1 -1
- package/dist/proxy/next.mjs +6 -0
- package/dist/proxy/next.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -121,6 +121,11 @@ __export(index_exports, {
|
|
|
121
121
|
functionRuntimeHealth: () => functionRuntimeHealth,
|
|
122
122
|
functionScheduleDelete: () => functionScheduleDelete,
|
|
123
123
|
functionScheduleSet: () => functionScheduleSet,
|
|
124
|
+
functionSchedulesAdd: () => functionSchedulesAdd,
|
|
125
|
+
functionSchedulesList: () => functionSchedulesList,
|
|
126
|
+
functionSchedulesRemove: () => functionSchedulesRemove,
|
|
127
|
+
functionSchedulesResume: () => functionSchedulesResume,
|
|
128
|
+
functionSchedulesUpdate: () => functionSchedulesUpdate,
|
|
124
129
|
functionUpdate: () => functionUpdate,
|
|
125
130
|
getPayment: () => getPayment,
|
|
126
131
|
getPolicy: () => getPolicy,
|
|
@@ -233,7 +238,7 @@ __export(index_exports, {
|
|
|
233
238
|
module.exports = __toCommonJS(index_exports);
|
|
234
239
|
|
|
235
240
|
// src/version.ts
|
|
236
|
-
var SDK_VERSION = true ? "1.10.
|
|
241
|
+
var SDK_VERSION = true ? "1.10.3" : "dev";
|
|
237
242
|
var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
|
|
238
243
|
|
|
239
244
|
// src/version-check.ts
|
|
@@ -1405,6 +1410,39 @@ var functionScheduleSet = (options) => (options.client ?? client).post({
|
|
|
1405
1410
|
...options.headers
|
|
1406
1411
|
}
|
|
1407
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
|
+
});
|
|
1408
1446
|
var functionRunStart = (options) => (options.client ?? client).post({
|
|
1409
1447
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1410
1448
|
url: "/functions/{function_id}/runs/start",
|
|
@@ -2465,6 +2503,11 @@ function createResources(client2, getApiKey) {
|
|
|
2465
2503
|
}
|
|
2466
2504
|
},
|
|
2467
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
|
+
},
|
|
2468
2511
|
/** functionCreate: /functions. Returns the API response body. */
|
|
2469
2512
|
create: async (body, query = void 0, requestOptions = {}) => {
|
|
2470
2513
|
const response = await functionCreate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, body, query });
|
|
@@ -2505,6 +2548,11 @@ function createResources(client2, getApiKey) {
|
|
|
2505
2548
|
const response = await listFunctionRunsByFunctionId({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, query });
|
|
2506
2549
|
return response.data;
|
|
2507
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
|
+
},
|
|
2508
2556
|
/** functionMetadataUpdate: /functions/{function_id}. Returns the API response body. */
|
|
2509
2557
|
metadataUpdate: async (functionId, body, requestOptions = {}) => {
|
|
2510
2558
|
const response = await functionMetadataUpdate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body });
|
|
@@ -2515,6 +2563,16 @@ function createResources(client2, getApiKey) {
|
|
|
2515
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 });
|
|
2516
2564
|
return response.data;
|
|
2517
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
|
+
},
|
|
2518
2576
|
/** functionRollback: /functions/{function_id}/rollback. Returns the API response body. */
|
|
2519
2577
|
rollback: async (functionId, body, query = void 0, requestOptions = {}) => {
|
|
2520
2578
|
const response = await functionRollback({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body, query });
|
|
@@ -2554,6 +2612,11 @@ function createResources(client2, getApiKey) {
|
|
|
2554
2612
|
update: async (functionId, body, query = void 0, requestOptions = {}) => {
|
|
2555
2613
|
const response = await functionUpdate({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "function_id": functionId }, body, query });
|
|
2556
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;
|
|
2557
2620
|
}
|
|
2558
2621
|
},
|
|
2559
2622
|
personas: {
|
|
@@ -5196,19 +5259,22 @@ var NotteFunction = class {
|
|
|
5196
5259
|
* before execution, then pass it to `run(variables, { functionRunId })`.
|
|
5197
5260
|
* `run()` otherwise creates a new run on its own.
|
|
5198
5261
|
*
|
|
5199
|
-
* @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.
|
|
5200
5263
|
* @returns A created run record and its ID. No function code has executed yet.
|
|
5201
5264
|
* @throws NotteAPIError if run creation is rejected.
|
|
5202
5265
|
* @example
|
|
5203
5266
|
* const created = await fn.createRun();
|
|
5204
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] });
|
|
5205
5271
|
*/
|
|
5206
5272
|
async createRun(options = {}) {
|
|
5207
5273
|
const functionId = await this.ensureInitialized();
|
|
5208
5274
|
return this.postRunEndpoint({
|
|
5209
5275
|
url: FUNCTION_RUN_ENDPOINTS.create,
|
|
5210
5276
|
path: { function_id: functionId },
|
|
5211
|
-
body: { local: options.local ?? false }
|
|
5277
|
+
body: { local: options.local ?? false, ...options.version !== void 0 ? { version: options.version } : {} }
|
|
5212
5278
|
});
|
|
5213
5279
|
}
|
|
5214
5280
|
/**
|
|
@@ -5241,12 +5307,13 @@ var NotteFunction = class {
|
|
|
5241
5307
|
* Pass `{ stream: false }` to receive the backend's JSON response without
|
|
5242
5308
|
* live logs; execution still blocks until completion. Pass `functionRunId`
|
|
5243
5309
|
* to execute a record returned by `createRun()`; otherwise a new run record
|
|
5244
|
-
* 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
|
|
5245
5312
|
* `FailedToRunCloudFunctionError` unless `raiseOnFailure` is false, and the
|
|
5246
5313
|
* wait is aborted with `NotteTimeoutError` after `timeoutMs`.
|
|
5247
5314
|
*
|
|
5248
5315
|
* @param variables - JSON-serializable keyword arguments passed to the Python function's `run` entry point.
|
|
5249
|
-
* @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.
|
|
5250
5317
|
* @returns The completed execution response. The function's return value is in `result`. Disabling streaming still waits for completion.
|
|
5251
5318
|
* @throws FailedToRunCloudFunctionError if execution fails and `raiseOnFailure` is true.
|
|
5252
5319
|
* @throws NotteTimeoutError if the execution request exceeds `timeoutMs`.
|
|
@@ -5255,6 +5322,9 @@ var NotteFunction = class {
|
|
|
5255
5322
|
* const result = await fn.run({ url: 'https://example.com' });
|
|
5256
5323
|
* console.log(result.result);
|
|
5257
5324
|
*
|
|
5325
|
+
* const { versions } = await fn.get();
|
|
5326
|
+
* await fn.run({ url: 'https://example.com' }, { version: versions[0] });
|
|
5327
|
+
*
|
|
5258
5328
|
* await fn.run({ url: 'https://example.com' }, { runtime: 'extended', onLog: line => logger.info(line) });
|
|
5259
5329
|
*/
|
|
5260
5330
|
async run(variables = {}, options = {}) {
|
|
@@ -5263,8 +5333,11 @@ var NotteFunction = class {
|
|
|
5263
5333
|
if (!(timeoutMs > 0)) {
|
|
5264
5334
|
throw new InvalidRequestError("timeoutMs must be a positive number");
|
|
5265
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
|
+
}
|
|
5266
5339
|
const functionId = await this.ensureInitialized();
|
|
5267
|
-
const functionRunId = options.functionRunId ?? (await this.createRun()).function_run_id;
|
|
5340
|
+
const functionRunId = options.functionRunId ?? (await this.createRun({ version: options.version })).function_run_id;
|
|
5268
5341
|
const body = {
|
|
5269
5342
|
workflow_id: functionId,
|
|
5270
5343
|
variables,
|
|
@@ -6626,6 +6699,11 @@ var createClient2 = (config) => {
|
|
|
6626
6699
|
functionRuntimeHealth,
|
|
6627
6700
|
functionScheduleDelete,
|
|
6628
6701
|
functionScheduleSet,
|
|
6702
|
+
functionSchedulesAdd,
|
|
6703
|
+
functionSchedulesList,
|
|
6704
|
+
functionSchedulesRemove,
|
|
6705
|
+
functionSchedulesResume,
|
|
6706
|
+
functionSchedulesUpdate,
|
|
6629
6707
|
functionUpdate,
|
|
6630
6708
|
getPayment,
|
|
6631
6709
|
getPolicy,
|