@anduril-industries/lattice-sdk 4.1.0 → 4.2.0
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/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/index.d.ts +1 -0
- package/dist/cjs/api/resources/index.js +1 -0
- package/dist/cjs/api/resources/objects/client/Client.js +7 -17
- package/dist/cjs/api/resources/tasks/client/Client.d.ts +29 -0
- package/dist/cjs/api/resources/tasks/client/Client.js +133 -0
- package/dist/cjs/api/resources/tasks/client/requests/AgentStreamRequest.d.ts +11 -0
- package/dist/cjs/api/resources/tasks/client/requests/AgentStreamRequest.js +3 -0
- package/dist/cjs/api/resources/tasks/client/requests/TaskStreamRequest.d.ts +30 -0
- package/dist/cjs/api/resources/tasks/client/requests/TaskStreamRequest.js +3 -0
- package/dist/cjs/api/resources/tasks/client/requests/index.d.ts +3 -1
- package/dist/cjs/api/resources/tasks/client/requests/index.js +3 -0
- package/dist/cjs/api/resources/tasks/index.d.ts +1 -0
- package/dist/cjs/api/resources/tasks/index.js +1 -0
- package/dist/cjs/api/resources/tasks/types/StreamAsAgentResponse.d.ts +13 -0
- package/dist/cjs/api/resources/tasks/types/StreamAsAgentResponse.js +3 -0
- package/dist/cjs/api/resources/tasks/types/StreamTasksResponse.d.ts +13 -0
- package/dist/cjs/api/resources/tasks/types/StreamTasksResponse.js +3 -0
- package/dist/cjs/api/resources/tasks/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/tasks/types/index.js +18 -0
- package/dist/cjs/api/types/AgentStreamEvent.d.ts +3 -0
- package/dist/cjs/api/types/AgentStreamEvent.js +3 -0
- package/dist/cjs/api/types/AgentTaskRequest.d.ts +9 -0
- package/dist/cjs/api/types/AgentTaskRequest.js +3 -0
- package/dist/cjs/api/types/HeartbeatObject.d.ts +1 -1
- package/dist/cjs/api/types/StreamHeartbeat.d.ts +3 -0
- package/dist/cjs/api/types/StreamHeartbeat.js +3 -0
- package/dist/cjs/api/types/TaskEventData.d.ts +29 -0
- package/dist/cjs/api/types/TaskEventData.js +17 -0
- package/dist/cjs/api/types/TaskStreamEvent.d.ts +3 -0
- package/dist/cjs/api/types/TaskStreamEvent.js +3 -0
- package/dist/cjs/api/types/index.d.ts +5 -0
- package/dist/cjs/api/types/index.js +5 -0
- package/dist/cjs/auth/OAuthAuthProvider.d.ts +29 -25
- package/dist/cjs/auth/OAuthAuthProvider.js +68 -51
- package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +2 -2
- package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -2
- package/dist/cjs/core/headers.d.ts +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/index.d.mts +1 -0
- package/dist/esm/api/resources/index.mjs +1 -0
- package/dist/esm/api/resources/objects/client/Client.mjs +7 -17
- package/dist/esm/api/resources/tasks/client/Client.d.mts +29 -0
- package/dist/esm/api/resources/tasks/client/Client.mjs +133 -0
- package/dist/esm/api/resources/tasks/client/requests/AgentStreamRequest.d.mts +11 -0
- package/dist/esm/api/resources/tasks/client/requests/AgentStreamRequest.mjs +2 -0
- package/dist/esm/api/resources/tasks/client/requests/TaskStreamRequest.d.mts +30 -0
- package/dist/esm/api/resources/tasks/client/requests/TaskStreamRequest.mjs +2 -0
- package/dist/esm/api/resources/tasks/client/requests/index.d.mts +3 -1
- package/dist/esm/api/resources/tasks/client/requests/index.mjs +1 -1
- package/dist/esm/api/resources/tasks/index.d.mts +1 -0
- package/dist/esm/api/resources/tasks/index.mjs +1 -0
- package/dist/esm/api/resources/tasks/types/StreamAsAgentResponse.d.mts +13 -0
- package/dist/esm/api/resources/tasks/types/StreamAsAgentResponse.mjs +2 -0
- package/dist/esm/api/resources/tasks/types/StreamTasksResponse.d.mts +13 -0
- package/dist/esm/api/resources/tasks/types/StreamTasksResponse.mjs +2 -0
- package/dist/esm/api/resources/tasks/types/index.d.mts +2 -0
- package/dist/esm/api/resources/tasks/types/index.mjs +2 -0
- package/dist/esm/api/types/AgentStreamEvent.d.mts +3 -0
- package/dist/esm/api/types/AgentStreamEvent.mjs +2 -0
- package/dist/esm/api/types/AgentTaskRequest.d.mts +9 -0
- package/dist/esm/api/types/AgentTaskRequest.mjs +2 -0
- package/dist/esm/api/types/HeartbeatObject.d.mts +1 -1
- package/dist/esm/api/types/StreamHeartbeat.d.mts +3 -0
- package/dist/esm/api/types/StreamHeartbeat.mjs +2 -0
- package/dist/esm/api/types/TaskEventData.d.mts +29 -0
- package/dist/esm/api/types/TaskEventData.mjs +14 -0
- package/dist/esm/api/types/TaskStreamEvent.d.mts +3 -0
- package/dist/esm/api/types/TaskStreamEvent.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +5 -0
- package/dist/esm/api/types/index.mjs +5 -0
- package/dist/esm/auth/OAuthAuthProvider.d.mts +29 -25
- package/dist/esm/auth/OAuthAuthProvider.mjs +68 -51
- package/dist/esm/core/fetcher/EndpointSupplier.d.mts +2 -2
- package/dist/esm/core/fetcher/Fetcher.d.mts +1 -2
- package/dist/esm/core/headers.d.mts +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +2 -2
- package/reference.md +153 -2
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@anduril-industries/lattice-sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "4.
|
|
47
|
-
"User-Agent": "@anduril-industries/lattice-sdk/4.
|
|
46
|
+
"X-Fern-SDK-Version": "4.2.0",
|
|
47
|
+
"User-Agent": "@anduril-industries/lattice-sdk/4.2.0",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -51,3 +51,4 @@ __exportStar(require("./objects/types/index.js"), exports);
|
|
|
51
51
|
exports.task = __importStar(require("./task/index.js"));
|
|
52
52
|
__exportStar(require("./tasks/client/requests/index.js"), exports);
|
|
53
53
|
exports.tasks = __importStar(require("./tasks/index.js"));
|
|
54
|
+
__exportStar(require("./tasks/types/index.js"), exports);
|
|
@@ -76,19 +76,12 @@ class ObjectsClient {
|
|
|
76
76
|
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
77
77
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
78
78
|
const { prefix, sinceTimestamp, pageToken, allObjectsInMesh } = request;
|
|
79
|
-
const _queryParams = {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
if (pageToken != null) {
|
|
87
|
-
_queryParams.pageToken = pageToken;
|
|
88
|
-
}
|
|
89
|
-
if (allObjectsInMesh != null) {
|
|
90
|
-
_queryParams.allObjectsInMesh = allObjectsInMesh.toString();
|
|
91
|
-
}
|
|
79
|
+
const _queryParams = {
|
|
80
|
+
prefix,
|
|
81
|
+
sinceTimestamp,
|
|
82
|
+
pageToken,
|
|
83
|
+
allObjectsInMesh,
|
|
84
|
+
};
|
|
92
85
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
93
86
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
94
87
|
const _response = yield core.fetcher({
|
|
@@ -151,10 +144,7 @@ class ObjectsClient {
|
|
|
151
144
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
152
145
|
const { objectPath, "Accept-Encoding": acceptEncoding, Priority: priority } = request;
|
|
153
146
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
154
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
155
|
-
"Accept-Encoding": acceptEncoding != null ? acceptEncoding : undefined,
|
|
156
|
-
Priority: priority != null ? priority : undefined,
|
|
157
|
-
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
147
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Accept-Encoding": acceptEncoding, Priority: priority }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
158
148
|
const _response = yield core.fetcher({
|
|
159
149
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, `api/v1/objects/${core.url.encodePathParam(objectPath)}`),
|
|
160
150
|
method: "GET",
|
|
@@ -114,6 +114,14 @@ export declare class TasksClient {
|
|
|
114
114
|
*/
|
|
115
115
|
queryTasks(request?: Lattice.TaskQuery, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<Lattice.TaskQueryResults>;
|
|
116
116
|
private __queryTasks;
|
|
117
|
+
/**
|
|
118
|
+
* Establishes a server streaming connection that delivers task updates in real-time using Server-Sent Events (SSE).
|
|
119
|
+
*
|
|
120
|
+
* The stream delivers all existing non-terminal tasks when first connected, followed by real-time
|
|
121
|
+
* updates for task creation and status changes. Additionally, heartbeat messages are sent periodically to maintain the connection.
|
|
122
|
+
*/
|
|
123
|
+
streamTasks(request?: Lattice.TaskStreamRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<core.Stream<Lattice.StreamTasksResponse>>;
|
|
124
|
+
private __streamTasks;
|
|
117
125
|
/**
|
|
118
126
|
* Establishes a server streaming connection that delivers tasks to taskable agents for execution.
|
|
119
127
|
*
|
|
@@ -147,4 +155,25 @@ export declare class TasksClient {
|
|
|
147
155
|
*/
|
|
148
156
|
listenAsAgent(request?: Lattice.AgentListener, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<Lattice.AgentRequest>;
|
|
149
157
|
private __listenAsAgent;
|
|
158
|
+
/**
|
|
159
|
+
* Establishes a server streaming connection that delivers tasks to taskable agents for execution
|
|
160
|
+
* using Server-Sent Events (SSE).
|
|
161
|
+
*
|
|
162
|
+
* This method creates a connection from the Tasks API to an agent that streams relevant tasks to the listener agent. The agent receives a stream of tasks that match the entities specified by the tasks' selector criteria.
|
|
163
|
+
*
|
|
164
|
+
* The stream delivers three types of requests:
|
|
165
|
+
* - `ExecuteRequest`: Contains a new task for the agent to execute
|
|
166
|
+
* - `CancelRequest`: Indicates a task should be canceled
|
|
167
|
+
* - `CompleteRequest`: Indicates a task should be completed
|
|
168
|
+
*
|
|
169
|
+
* Additionally, heartbeat messages are sent periodically to maintain the connection.
|
|
170
|
+
*
|
|
171
|
+
* This is recommended method for taskable agents to receive and process tasks in real-time.
|
|
172
|
+
* Agents should maintain connection to this stream and process incoming tasks according to their capabilities.
|
|
173
|
+
*
|
|
174
|
+
* When an agent receives a task, it should update the task status using the `UpdateStatus` endpoint
|
|
175
|
+
* to provide progress information back to Tasks API.
|
|
176
|
+
*/
|
|
177
|
+
streamAsAgent(request?: Lattice.AgentStreamRequest, requestOptions?: TasksClient.RequestOptions): core.HttpResponsePromise<core.Stream<Lattice.StreamAsAgentResponse>>;
|
|
178
|
+
private __streamAsAgent;
|
|
150
179
|
}
|
|
@@ -335,6 +335,66 @@ class TasksClient {
|
|
|
335
335
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/v1/tasks/query");
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* Establishes a server streaming connection that delivers task updates in real-time using Server-Sent Events (SSE).
|
|
340
|
+
*
|
|
341
|
+
* The stream delivers all existing non-terminal tasks when first connected, followed by real-time
|
|
342
|
+
* updates for task creation and status changes. Additionally, heartbeat messages are sent periodically to maintain the connection.
|
|
343
|
+
*/
|
|
344
|
+
streamTasks(request = {}, requestOptions) {
|
|
345
|
+
return core.HttpResponsePromise.fromPromise(this.__streamTasks(request, requestOptions));
|
|
346
|
+
}
|
|
347
|
+
__streamTasks() {
|
|
348
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
349
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
350
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
351
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
352
|
+
const _response = yield core.fetcher({
|
|
353
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, "api/v1/tasks/stream"),
|
|
354
|
+
method: "POST",
|
|
355
|
+
headers: _headers,
|
|
356
|
+
contentType: "application/json",
|
|
357
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
358
|
+
requestType: "json",
|
|
359
|
+
body: request,
|
|
360
|
+
responseType: "sse",
|
|
361
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
362
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
363
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
364
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
365
|
+
logging: this._options.logging,
|
|
366
|
+
});
|
|
367
|
+
if (_response.ok) {
|
|
368
|
+
return {
|
|
369
|
+
data: new core.Stream({
|
|
370
|
+
stream: _response.body,
|
|
371
|
+
parse: (data) => data,
|
|
372
|
+
signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
373
|
+
eventShape: {
|
|
374
|
+
type: "sse",
|
|
375
|
+
streamTerminator: "[DONE]",
|
|
376
|
+
},
|
|
377
|
+
}),
|
|
378
|
+
rawResponse: _response.rawResponse,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
if (_response.error.reason === "status-code") {
|
|
382
|
+
switch (_response.error.statusCode) {
|
|
383
|
+
case 400:
|
|
384
|
+
throw new Lattice.BadRequestError(_response.error.body, _response.rawResponse);
|
|
385
|
+
case 401:
|
|
386
|
+
throw new Lattice.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
387
|
+
default:
|
|
388
|
+
throw new errors.LatticeError({
|
|
389
|
+
statusCode: _response.error.statusCode,
|
|
390
|
+
body: _response.error.body,
|
|
391
|
+
rawResponse: _response.rawResponse,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/v1/tasks/stream");
|
|
396
|
+
});
|
|
397
|
+
}
|
|
338
398
|
/**
|
|
339
399
|
* Establishes a server streaming connection that delivers tasks to taskable agents for execution.
|
|
340
400
|
*
|
|
@@ -408,5 +468,78 @@ class TasksClient {
|
|
|
408
468
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/v1/agent/listen");
|
|
409
469
|
});
|
|
410
470
|
}
|
|
471
|
+
/**
|
|
472
|
+
* Establishes a server streaming connection that delivers tasks to taskable agents for execution
|
|
473
|
+
* using Server-Sent Events (SSE).
|
|
474
|
+
*
|
|
475
|
+
* This method creates a connection from the Tasks API to an agent that streams relevant tasks to the listener agent. The agent receives a stream of tasks that match the entities specified by the tasks' selector criteria.
|
|
476
|
+
*
|
|
477
|
+
* The stream delivers three types of requests:
|
|
478
|
+
* - `ExecuteRequest`: Contains a new task for the agent to execute
|
|
479
|
+
* - `CancelRequest`: Indicates a task should be canceled
|
|
480
|
+
* - `CompleteRequest`: Indicates a task should be completed
|
|
481
|
+
*
|
|
482
|
+
* Additionally, heartbeat messages are sent periodically to maintain the connection.
|
|
483
|
+
*
|
|
484
|
+
* This is recommended method for taskable agents to receive and process tasks in real-time.
|
|
485
|
+
* Agents should maintain connection to this stream and process incoming tasks according to their capabilities.
|
|
486
|
+
*
|
|
487
|
+
* When an agent receives a task, it should update the task status using the `UpdateStatus` endpoint
|
|
488
|
+
* to provide progress information back to Tasks API.
|
|
489
|
+
*/
|
|
490
|
+
streamAsAgent(request = {}, requestOptions) {
|
|
491
|
+
return core.HttpResponsePromise.fromPromise(this.__streamAsAgent(request, requestOptions));
|
|
492
|
+
}
|
|
493
|
+
__streamAsAgent() {
|
|
494
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
495
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
496
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
497
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
498
|
+
const _response = yield core.fetcher({
|
|
499
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LatticeEnvironment.Default, "api/v1/agent/stream"),
|
|
500
|
+
method: "POST",
|
|
501
|
+
headers: _headers,
|
|
502
|
+
contentType: "application/json",
|
|
503
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
504
|
+
requestType: "json",
|
|
505
|
+
body: request,
|
|
506
|
+
responseType: "sse",
|
|
507
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
508
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
509
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
510
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
511
|
+
logging: this._options.logging,
|
|
512
|
+
});
|
|
513
|
+
if (_response.ok) {
|
|
514
|
+
return {
|
|
515
|
+
data: new core.Stream({
|
|
516
|
+
stream: _response.body,
|
|
517
|
+
parse: (data) => data,
|
|
518
|
+
signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
519
|
+
eventShape: {
|
|
520
|
+
type: "sse",
|
|
521
|
+
streamTerminator: "[DONE]",
|
|
522
|
+
},
|
|
523
|
+
}),
|
|
524
|
+
rawResponse: _response.rawResponse,
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
if (_response.error.reason === "status-code") {
|
|
528
|
+
switch (_response.error.statusCode) {
|
|
529
|
+
case 400:
|
|
530
|
+
throw new Lattice.BadRequestError(_response.error.body, _response.rawResponse);
|
|
531
|
+
case 401:
|
|
532
|
+
throw new Lattice.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
533
|
+
default:
|
|
534
|
+
throw new errors.LatticeError({
|
|
535
|
+
statusCode: _response.error.statusCode,
|
|
536
|
+
body: _response.error.body,
|
|
537
|
+
rawResponse: _response.rawResponse,
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/v1/agent/stream");
|
|
542
|
+
});
|
|
543
|
+
}
|
|
411
544
|
}
|
|
412
545
|
exports.TasksClient = TasksClient;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as Lattice from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface AgentStreamRequest {
|
|
7
|
+
/** The selector criteria to determine which tasks the agent receives. */
|
|
8
|
+
agentSelector?: Lattice.EntityIdsSelector;
|
|
9
|
+
/** The time interval, defined in seconds, that determines the frequency at which to send heartbeat events. Defaults to 30s. */
|
|
10
|
+
heartbeatIntervalMs?: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {}
|
|
4
|
+
*/
|
|
5
|
+
export interface TaskStreamRequest {
|
|
6
|
+
/** The time interval, in milliseconds, that determines the frequency at which to send heartbeat events. Defaults to 30000 (30 seconds). */
|
|
7
|
+
heartbeatIntervalMs?: number;
|
|
8
|
+
/**
|
|
9
|
+
* The time interval, in milliseconds, after an update for a given task before another one will be sent for the same task.
|
|
10
|
+
* If set, value must be >= 250.
|
|
11
|
+
*/
|
|
12
|
+
rateLimit?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Optional flag to only include tasks created or updated after the stream is initiated, and not any previous preexisting tasks.
|
|
15
|
+
* If unset or false, the stream will include any new tasks and task updates, as well as all preexisting tasks.
|
|
16
|
+
*/
|
|
17
|
+
excludePreexistingTasks?: boolean;
|
|
18
|
+
/** Optional filter that only returns tasks with specific types. If not provided, all task types will be streamed. */
|
|
19
|
+
taskType?: TaskStreamRequest.TaskType;
|
|
20
|
+
}
|
|
21
|
+
export declare namespace TaskStreamRequest {
|
|
22
|
+
/**
|
|
23
|
+
* Optional filter that only returns tasks with specific types. If not provided, all task types will be streamed.
|
|
24
|
+
*/
|
|
25
|
+
type TaskType = {
|
|
26
|
+
taskTypeUrls: string[];
|
|
27
|
+
} | {
|
|
28
|
+
taskTypePrefix: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { AgentListener } from "./AgentListener.js";
|
|
2
|
+
export type { AgentStreamRequest } from "./AgentStreamRequest.js";
|
|
2
3
|
export type { GetTaskRequest } from "./GetTaskRequest.js";
|
|
3
4
|
export type { TaskCreation } from "./TaskCreation.js";
|
|
4
|
-
export
|
|
5
|
+
export { TaskQuery } from "./TaskQuery.js";
|
|
5
6
|
export type { TaskStatusUpdate } from "./TaskStatusUpdate.js";
|
|
7
|
+
export type { TaskStreamRequest } from "./TaskStreamRequest.js";
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskQuery = void 0;
|
|
4
|
+
var TaskQuery_js_1 = require("./TaskQuery.js");
|
|
5
|
+
Object.defineProperty(exports, "TaskQuery", { enumerable: true, get: function () { return TaskQuery_js_1.TaskQuery; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as Lattice from "../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The stream event response.
|
|
4
|
+
*/
|
|
5
|
+
export type StreamAsAgentResponse = Lattice.StreamAsAgentResponse.Heartbeat | Lattice.StreamAsAgentResponse.AgentRequest;
|
|
6
|
+
export declare namespace StreamAsAgentResponse {
|
|
7
|
+
interface Heartbeat extends Lattice.StreamHeartbeat {
|
|
8
|
+
event: "heartbeat";
|
|
9
|
+
}
|
|
10
|
+
interface AgentRequest extends Lattice.AgentStreamEvent {
|
|
11
|
+
event: "agent_request";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as Lattice from "../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The stream event response.
|
|
4
|
+
*/
|
|
5
|
+
export type StreamTasksResponse = Lattice.StreamTasksResponse.Heartbeat | Lattice.StreamTasksResponse.TaskEvent;
|
|
6
|
+
export declare namespace StreamTasksResponse {
|
|
7
|
+
interface Heartbeat extends Lattice.StreamHeartbeat {
|
|
8
|
+
event: "heartbeat";
|
|
9
|
+
}
|
|
10
|
+
interface TaskEvent extends Lattice.TaskStreamEvent {
|
|
11
|
+
event: "task_event";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./StreamAsAgentResponse.js"), exports);
|
|
18
|
+
__exportStar(require("./StreamTasksResponse.js"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type * as Lattice from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The wrapper for a task's action requests: execute, cancel, or complete.
|
|
4
|
+
*/
|
|
5
|
+
export interface AgentTaskRequest {
|
|
6
|
+
executeRequest?: Lattice.ExecuteRequest;
|
|
7
|
+
cancelRequest?: Lattice.CancelRequest;
|
|
8
|
+
completeRequest?: Lattice.CompleteRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type * as Lattice from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Contains information about a task event.
|
|
4
|
+
*/
|
|
5
|
+
export interface TaskEventData {
|
|
6
|
+
/** The task event that occurred. */
|
|
7
|
+
taskEvent?: TaskEventData.TaskEvent;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace TaskEventData {
|
|
10
|
+
/**
|
|
11
|
+
* The task event that occurred.
|
|
12
|
+
*/
|
|
13
|
+
interface TaskEvent {
|
|
14
|
+
/** The type of event that occurred for this task. */
|
|
15
|
+
eventType?: TaskEvent.EventType;
|
|
16
|
+
/** The task associated with this event. */
|
|
17
|
+
task?: Lattice.Task;
|
|
18
|
+
}
|
|
19
|
+
namespace TaskEvent {
|
|
20
|
+
/** The type of event that occurred for this task. */
|
|
21
|
+
const EventType: {
|
|
22
|
+
readonly EventTypeInvalid: "EVENT_TYPE_INVALID";
|
|
23
|
+
readonly EventTypeCreated: "EVENT_TYPE_CREATED";
|
|
24
|
+
readonly EventTypeUpdate: "EVENT_TYPE_UPDATE";
|
|
25
|
+
readonly EventTypePreexisting: "EVENT_TYPE_PREEXISTING";
|
|
26
|
+
};
|
|
27
|
+
type EventType = (typeof EventType)[keyof typeof EventType];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TaskEventData = void 0;
|
|
5
|
+
var TaskEventData;
|
|
6
|
+
(function (TaskEventData) {
|
|
7
|
+
let TaskEvent;
|
|
8
|
+
(function (TaskEvent) {
|
|
9
|
+
/** The type of event that occurred for this task. */
|
|
10
|
+
TaskEvent.EventType = {
|
|
11
|
+
EventTypeInvalid: "EVENT_TYPE_INVALID",
|
|
12
|
+
EventTypeCreated: "EVENT_TYPE_CREATED",
|
|
13
|
+
EventTypeUpdate: "EVENT_TYPE_UPDATE",
|
|
14
|
+
EventTypePreexisting: "EVENT_TYPE_PREEXISTING",
|
|
15
|
+
};
|
|
16
|
+
})(TaskEvent = TaskEventData.TaskEvent || (TaskEventData.TaskEvent = {}));
|
|
17
|
+
})(TaskEventData || (exports.TaskEventData = TaskEventData = {}));
|
|
@@ -2,6 +2,8 @@ export * from "./AcmDetails.js";
|
|
|
2
2
|
export * from "./ActiveTarget.js";
|
|
3
3
|
export * from "./Agent.js";
|
|
4
4
|
export * from "./AgentRequest.js";
|
|
5
|
+
export * from "./AgentStreamEvent.js";
|
|
6
|
+
export * from "./AgentTaskRequest.js";
|
|
5
7
|
export * from "./Alert.js";
|
|
6
8
|
export * from "./AlertCondition.js";
|
|
7
9
|
export * from "./Aliases.js";
|
|
@@ -119,6 +121,7 @@ export * from "./Sensor.js";
|
|
|
119
121
|
export * from "./Sensors.js";
|
|
120
122
|
export * from "./Signal.js";
|
|
121
123
|
export * from "./Status.js";
|
|
124
|
+
export * from "./StreamHeartbeat.js";
|
|
122
125
|
export * from "./Supplies.js";
|
|
123
126
|
export * from "./Symbology.js";
|
|
124
127
|
export * from "./System.js";
|
|
@@ -128,8 +131,10 @@ export * from "./TaskCatalog.js";
|
|
|
128
131
|
export * from "./TaskDefinition.js";
|
|
129
132
|
export * from "./TaskEntity.js";
|
|
130
133
|
export * from "./TaskError.js";
|
|
134
|
+
export * from "./TaskEventData.js";
|
|
131
135
|
export * from "./TaskQueryResults.js";
|
|
132
136
|
export * from "./TaskStatus.js";
|
|
137
|
+
export * from "./TaskStreamEvent.js";
|
|
133
138
|
export * from "./TaskVersion.js";
|
|
134
139
|
export * from "./Team.js";
|
|
135
140
|
export * from "./Threat.js";
|
|
@@ -18,6 +18,8 @@ __exportStar(require("./AcmDetails.js"), exports);
|
|
|
18
18
|
__exportStar(require("./ActiveTarget.js"), exports);
|
|
19
19
|
__exportStar(require("./Agent.js"), exports);
|
|
20
20
|
__exportStar(require("./AgentRequest.js"), exports);
|
|
21
|
+
__exportStar(require("./AgentStreamEvent.js"), exports);
|
|
22
|
+
__exportStar(require("./AgentTaskRequest.js"), exports);
|
|
21
23
|
__exportStar(require("./Alert.js"), exports);
|
|
22
24
|
__exportStar(require("./AlertCondition.js"), exports);
|
|
23
25
|
__exportStar(require("./Aliases.js"), exports);
|
|
@@ -135,6 +137,7 @@ __exportStar(require("./Sensor.js"), exports);
|
|
|
135
137
|
__exportStar(require("./Sensors.js"), exports);
|
|
136
138
|
__exportStar(require("./Signal.js"), exports);
|
|
137
139
|
__exportStar(require("./Status.js"), exports);
|
|
140
|
+
__exportStar(require("./StreamHeartbeat.js"), exports);
|
|
138
141
|
__exportStar(require("./Supplies.js"), exports);
|
|
139
142
|
__exportStar(require("./Symbology.js"), exports);
|
|
140
143
|
__exportStar(require("./System.js"), exports);
|
|
@@ -144,8 +147,10 @@ __exportStar(require("./TaskCatalog.js"), exports);
|
|
|
144
147
|
__exportStar(require("./TaskDefinition.js"), exports);
|
|
145
148
|
__exportStar(require("./TaskEntity.js"), exports);
|
|
146
149
|
__exportStar(require("./TaskError.js"), exports);
|
|
150
|
+
__exportStar(require("./TaskEventData.js"), exports);
|
|
147
151
|
__exportStar(require("./TaskQueryResults.js"), exports);
|
|
148
152
|
__exportStar(require("./TaskStatus.js"), exports);
|
|
153
|
+
__exportStar(require("./TaskStreamEvent.js"), exports);
|
|
149
154
|
__exportStar(require("./TaskVersion.js"), exports);
|
|
150
155
|
__exportStar(require("./Team.js"), exports);
|
|
151
156
|
__exportStar(require("./Threat.js"), exports);
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import type { BaseClientOptions } from "../BaseClient.js";
|
|
2
2
|
import * as core from "../core/index.js";
|
|
3
|
+
declare const CLIENT_ID_PARAM: "clientId";
|
|
4
|
+
declare const CLIENT_SECRET_PARAM: "clientSecret";
|
|
5
|
+
declare const TOKEN_PARAM: "token";
|
|
3
6
|
export declare class OAuthAuthProvider implements core.AuthProvider {
|
|
4
|
-
private readonly
|
|
5
|
-
private readonly
|
|
6
|
-
private
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
getAuthRequest(
|
|
7
|
+
private readonly options;
|
|
8
|
+
private readonly authClient;
|
|
9
|
+
private accessToken;
|
|
10
|
+
private expiresAt;
|
|
11
|
+
private refreshPromise;
|
|
12
|
+
constructor(options: OAuthAuthProvider.Options & OAuthAuthProvider.ClientCredentials);
|
|
13
|
+
static canCreate(options?: Partial<OAuthAuthProvider.ClientCredentials & BaseClientOptions>): boolean;
|
|
14
|
+
private clientIdSupplier;
|
|
15
|
+
private clientSecretSupplier;
|
|
16
|
+
getAuthRequest({ endpointMetadata, }?: {
|
|
14
17
|
endpointMetadata?: core.EndpointMetadata;
|
|
15
18
|
}): Promise<core.AuthRequest>;
|
|
16
19
|
private getToken;
|
|
@@ -18,24 +21,25 @@ export declare class OAuthAuthProvider implements core.AuthProvider {
|
|
|
18
21
|
private getExpiresAt;
|
|
19
22
|
}
|
|
20
23
|
export declare class OAuthTokenOverrideAuthProvider implements core.AuthProvider {
|
|
21
|
-
private readonly
|
|
22
|
-
constructor(options: OAuthAuthProvider.
|
|
23
|
-
static canCreate(options
|
|
24
|
-
getAuthRequest(
|
|
24
|
+
private readonly options;
|
|
25
|
+
constructor(options: OAuthAuthProvider.TokenOverride);
|
|
26
|
+
static canCreate(options?: Partial<OAuthAuthProvider.TokenOverride & BaseClientOptions>): options is OAuthAuthProvider.TokenOverride;
|
|
27
|
+
getAuthRequest({ endpointMetadata, }?: {
|
|
25
28
|
endpointMetadata?: core.EndpointMetadata;
|
|
26
29
|
}): Promise<core.AuthRequest>;
|
|
27
30
|
}
|
|
28
31
|
export declare namespace OAuthAuthProvider {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
type Options = BaseClientOptions;
|
|
32
|
+
const AUTH_SCHEME: "OAuth";
|
|
33
|
+
const AUTH_CONFIG_ERROR_MESSAGE: string;
|
|
34
|
+
type ClientCredentials = {
|
|
35
|
+
[CLIENT_ID_PARAM]: core.Supplier<string>;
|
|
36
|
+
[CLIENT_SECRET_PARAM]: core.Supplier<string>;
|
|
37
|
+
};
|
|
38
|
+
type TokenOverride = {
|
|
39
|
+
[TOKEN_PARAM]: core.Supplier<string>;
|
|
40
|
+
};
|
|
41
|
+
type AuthOptions = ClientCredentials | TokenOverride;
|
|
42
|
+
type Options = BaseClientOptions & AuthOptions;
|
|
40
43
|
function createInstance(options: Options): core.AuthProvider;
|
|
41
44
|
}
|
|
45
|
+
export {};
|