@lucidtech/las-sdk-core
Advanced tools
Comparing version 3.8.0 to 3.9.0
/// <reference types="node" /> | ||
import { Credentials } from './credentials'; | ||
import { AppClient, AppClientList, Asset, AssetList, Batch, BatchList, ContentType, DeleteDocumentOptions, LasDocument, LasDocumentList, ListAppClientsOptions, ListAssetsOptions, ListBatchesOptions, ListDocumentsOptions, ListSecretsOptions, ListTransitionOptions, ListUsersOptions, ListWorkflowExecutionsOptions, ListWorkflowOptions, UpdateAssetOptions, UpdateDocumentOptions, UpdateSecretOptions, UpdateTransitionExecution, UpdateTransitionOptions, UpdateWorkflowOptions, CreateBatchOptions, CreateDocumentOptions, CreatePredictionsOptions, CreateSecretOptions, CreateTransitionOptions, CreateWorkflowOptions, PredictionResponse, Secret, SecretList, Transition, TransitionExecution, TransitionExecutionList, TransitionExecutionListOptions, TransitionList, TransitionType, User, UserList, Workflow, WorkflowExecution, WorkflowExecutionList, WorkflowList, WorkflowSpecification, ListModelsOptions, ModelList, ListPredictionsOptions, PredictionList, Log, UpdateUserOptions, CreateUserOptions } from './types'; | ||
import { AppClient, AppClientList, Asset, AssetList, Batch, BatchList, ContentType, DeleteDocumentOptions, LasDocument, LasDocumentList, ListAppClientsOptions, ListAssetsOptions, ListBatchesOptions, ListDocumentsOptions, ListSecretsOptions, ListTransitionOptions, ListUsersOptions, ListWorkflowExecutionsOptions, ListWorkflowOptions, UpdateAssetOptions, UpdateDocumentOptions, UpdateSecretOptions, UpdateTransitionExecution, UpdateTransitionOptions, UpdateWorkflowOptions, CreateBatchOptions, CreateDocumentOptions, CreatePredictionsOptions, CreateSecretOptions, CreateTransitionOptions, CreateWorkflowOptions, PredictionResponse, Secret, SecretList, Transition, TransitionExecution, TransitionExecutionList, TransitionExecutionListOptions, TransitionList, TransitionType, User, UserList, Workflow, WorkflowExecution, WorkflowExecutionList, WorkflowList, WorkflowSpecification, ListModelsOptions, ModelList, ListPredictionsOptions, PredictionList, Log, UpdateUserOptions, CreateUserOptions, UpdateWorkflowExecutionOptions } from './types'; | ||
/** | ||
@@ -131,4 +131,12 @@ * A high-level http client for communicating with the Lucidtech REST API | ||
/** | ||
* Get an execution of a transition, calls the GET /transitions/{transitionId}/executions/{executionId} endpoint | ||
* | ||
* @param transitionId Id of the transition | ||
* @param transitionExecutionId Id of the execution | ||
* @returns Transition execution responses from REST API | ||
*/ | ||
getTransitionExecution(transitionId: string, transitionExecutionId: string): Promise<TransitionExecution>; | ||
/** | ||
* Ends the processing of the transition execution, calls the | ||
* PATCH /transitions/{transition_id}/executions/{executionId} endpoint. | ||
* PATCH /transitions/{transitionId}/executions/{executionId} endpoint. | ||
* | ||
@@ -225,3 +233,22 @@ * @param transitionId Id of the transition that performs the execution | ||
/** | ||
* Deletes the execution with the provided execution_id from workflow_id, | ||
* Get a workflow execution, calls the GET /workflows/{workflowId}/executions/{executionId} endpoint. | ||
* | ||
* @param workflowId Id of the workflow that performs the execution | ||
* @param executionId Id of the execution to get | ||
* @returns Workflow execution response from REST API | ||
*/ | ||
getWorkflowExecution(workflowId: string, executionId: string): Promise<WorkflowExecution>; | ||
/** | ||
* Retry or end the processing of a workflow execution, | ||
* calls the PATCH /workflows/{workflowId}/executions/{executionId} endpoint. | ||
* | ||
* @param workflowId Id of the workflow that performs the execution | ||
* @param executionId Id of the execution to update | ||
* @param data.nextTransitionId The next transition to transition into. To end the workflow-execution, | ||
* use: las:transition:commons-failed. | ||
* @returns Workflow execution response from REST API | ||
*/ | ||
updateWorkflowExecution(workflowId: string, executionId: string, data: UpdateWorkflowExecutionOptions): Promise<WorkflowExecution>; | ||
/** | ||
* Deletes the execution with the provided executionId from workflowId, | ||
* calls the DELETE /workflows/{workflowId}/executions/{executionId} endpoint. | ||
@@ -228,0 +255,0 @@ * |
@@ -290,4 +290,18 @@ "use strict"; | ||
/** | ||
* Get an execution of a transition, calls the GET /transitions/{transitionId}/executions/{executionId} endpoint | ||
* | ||
* @param transitionId Id of the transition | ||
* @param transitionExecutionId Id of the execution | ||
* @returns Transition execution responses from REST API | ||
*/ | ||
Client.prototype.getTransitionExecution = function (transitionId, transitionExecutionId) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.makeGetRequest("/transitions/" + transitionId + "/executions/" + transitionExecutionId)]; | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Ends the processing of the transition execution, calls the | ||
* PATCH /transitions/{transition_id}/executions/{executionId} endpoint. | ||
* PATCH /transitions/{transitionId}/executions/{executionId} endpoint. | ||
* | ||
@@ -456,3 +470,34 @@ * @param transitionId Id of the transition that performs the execution | ||
/** | ||
* Deletes the execution with the provided execution_id from workflow_id, | ||
* Get a workflow execution, calls the GET /workflows/{workflowId}/executions/{executionId} endpoint. | ||
* | ||
* @param workflowId Id of the workflow that performs the execution | ||
* @param executionId Id of the execution to get | ||
* @returns Workflow execution response from REST API | ||
*/ | ||
Client.prototype.getWorkflowExecution = function (workflowId, executionId) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.makeGetRequest("/workflows/" + workflowId + "/executions/" + executionId)]; | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Retry or end the processing of a workflow execution, | ||
* calls the PATCH /workflows/{workflowId}/executions/{executionId} endpoint. | ||
* | ||
* @param workflowId Id of the workflow that performs the execution | ||
* @param executionId Id of the execution to update | ||
* @param data.nextTransitionId The next transition to transition into. To end the workflow-execution, | ||
* use: las:transition:commons-failed. | ||
* @returns Workflow execution response from REST API | ||
*/ | ||
Client.prototype.updateWorkflowExecution = function (workflowId, executionId, data) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.makePatchRequest("/workflows/" + workflowId + "/executions/" + executionId, data)]; | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Deletes the execution with the provided executionId from workflowId, | ||
* calls the DELETE /workflows/{workflowId}/executions/{executionId} endpoint. | ||
@@ -620,2 +665,3 @@ * | ||
case 3: | ||
// eslint-disable-next-line no-await-in-loop | ||
response = _a.sent(); | ||
@@ -622,0 +668,0 @@ return [3 /*break*/, 2]; |
@@ -105,2 +105,3 @@ /// <reference types="node" /> | ||
endTime: string | null; | ||
logId: string | null; | ||
}; | ||
@@ -133,2 +134,5 @@ export declare type WorkflowSpecification = { | ||
} | ||
export interface UpdateWorkflowExecutionOptions { | ||
nextTransitionId: string; | ||
} | ||
export declare type WorkflowList = { | ||
@@ -142,5 +146,6 @@ workflows: Array<Workflow>; | ||
output: Record<any, any>; | ||
status?: 'succeeded' | 'failed' | 'running' | 'rejected'; | ||
status: 'succeeded' | 'failed' | 'running' | 'rejected' | 'retry' | 'error'; | ||
startTime: string | null; | ||
endTime: string | null; | ||
logId: string | null; | ||
transitionExecutions: Record<string, Array<string>> | null; | ||
@@ -147,0 +152,0 @@ completedBy: Array<string>; |
{ | ||
"name": "@lucidtech/las-sdk-core", | ||
"version": "3.8.0", | ||
"version": "3.9.0", | ||
"author": "Lucidtech AS <hello@lucidtech.ai>", | ||
@@ -32,3 +32,3 @@ "maintainers": [ | ||
}, | ||
"gitHead": "d0374f814f72f53ce2449438b0f43cf94e8bafcc" | ||
"gitHead": "78291a904d3ece7c50639dfb59805e3918dd8bd4" | ||
} |
@@ -22,2 +22,3 @@ /** | ||
const transitionExecutionId = () => `las:transition-execution:${uuidWithoutDashes()}`; | ||
const workflowExecutionId = () => `las:workflow-execution:${uuidWithoutDashes()}`; | ||
const consentId = () => `las:consent:${uuidWithoutDashes()}`; | ||
@@ -207,2 +208,17 @@ const batchId = () => `las:batch:${uuidWithoutDashes()}`; | ||
describe('getTransitionExecution', () => { | ||
test('valid request', async () => { | ||
const testTransitionId = transitionId(); | ||
const testTransitionExecutionId = transitionExecutionId(); | ||
const getTransitionExecutionPromise = client.getTransitionExecution(testTransitionId, testTransitionExecutionId); | ||
await expect(getTransitionExecutionPromise).resolves.toHaveProperty('executionId'); | ||
await expect(getTransitionExecutionPromise).resolves.toHaveProperty('status'); | ||
await expect(getTransitionExecutionPromise).resolves.toHaveProperty('transitionId'); | ||
await expect(getTransitionExecutionPromise).resolves.toHaveProperty('completedBy'); | ||
await expect(getTransitionExecutionPromise).resolves.toHaveProperty('input'); | ||
await expect(getTransitionExecutionPromise).resolves.toHaveProperty('startTime'); | ||
await expect(getTransitionExecutionPromise).resolves.toHaveProperty('endTime'); | ||
}); | ||
}); | ||
describe('updateTransitionExecution', () => { | ||
@@ -320,2 +336,38 @@ test.each<UpdateTransitionExecution>([ | ||
describe('getWorkflowExecution', () => { | ||
test('valid request', async () => { | ||
const testWorkflowId = workflowId(); | ||
const testWorkflowExecutionId = workflowExecutionId(); | ||
const getWorkflowExecutionPromise = client.getWorkflowExecution(testWorkflowId, testWorkflowExecutionId); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('executionId'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('completedBy'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('endTime'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('input'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('output'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('startTime'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('status'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('transitionExecutions'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('workflowId'); | ||
}); | ||
}); | ||
describe('updateWorkflowExecution', () => { | ||
test('valid request', async () => { | ||
const testWorkflowId = workflowId(); | ||
const testWorkflowExecutionId = workflowExecutionId(); | ||
const nextTransitionId = transitionId(); | ||
const data = { nextTransitionId } | ||
const getWorkflowExecutionPromise = client.updateWorkflowExecution(testWorkflowId, testWorkflowExecutionId, data); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('executionId'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('completedBy'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('endTime'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('input'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('output'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('startTime'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('status'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('transitionExecutions'); | ||
await expect(getWorkflowExecutionPromise).resolves.toHaveProperty('workflowId'); | ||
}); | ||
}); | ||
describe('listWorkflowExecutions', () => { | ||
@@ -322,0 +374,0 @@ test.each([undefined, 'test'])('status: %s', async (status) => { |
@@ -63,2 +63,3 @@ import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'; | ||
CreateUserOptions, | ||
UpdateWorkflowExecutionOptions, | ||
} from './types'; | ||
@@ -267,4 +268,15 @@ import { buildURL } from './utils'; | ||
/** | ||
* Get an execution of a transition, calls the GET /transitions/{transitionId}/executions/{executionId} endpoint | ||
* | ||
* @param transitionId Id of the transition | ||
* @param transitionExecutionId Id of the execution | ||
* @returns Transition execution responses from REST API | ||
*/ | ||
async getTransitionExecution(transitionId: string, transitionExecutionId: string): Promise<TransitionExecution> { | ||
return this.makeGetRequest(`/transitions/${transitionId}/executions/${transitionExecutionId}`); | ||
} | ||
/** | ||
* Ends the processing of the transition execution, calls the | ||
* PATCH /transitions/{transition_id}/executions/{executionId} endpoint. | ||
* PATCH /transitions/{transitionId}/executions/{executionId} endpoint. | ||
* | ||
@@ -418,3 +430,32 @@ * @param transitionId Id of the transition that performs the execution | ||
/** | ||
* Deletes the execution with the provided execution_id from workflow_id, | ||
* Get a workflow execution, calls the GET /workflows/{workflowId}/executions/{executionId} endpoint. | ||
* | ||
* @param workflowId Id of the workflow that performs the execution | ||
* @param executionId Id of the execution to get | ||
* @returns Workflow execution response from REST API | ||
*/ | ||
async getWorkflowExecution(workflowId: string, executionId: string): Promise<WorkflowExecution> { | ||
return this.makeGetRequest(`/workflows/${workflowId}/executions/${executionId}`); | ||
} | ||
/** | ||
* Retry or end the processing of a workflow execution, | ||
* calls the PATCH /workflows/{workflowId}/executions/{executionId} endpoint. | ||
* | ||
* @param workflowId Id of the workflow that performs the execution | ||
* @param executionId Id of the execution to update | ||
* @param data.nextTransitionId The next transition to transition into. To end the workflow-execution, | ||
* use: las:transition:commons-failed. | ||
* @returns Workflow execution response from REST API | ||
*/ | ||
async updateWorkflowExecution( | ||
workflowId: string, | ||
executionId: string, | ||
data: UpdateWorkflowExecutionOptions, | ||
): Promise<WorkflowExecution> { | ||
return this.makePatchRequest(`/workflows/${workflowId}/executions/${executionId}`, data); | ||
} | ||
/** | ||
* Deletes the execution with the provided executionId from workflowId, | ||
* calls the DELETE /workflows/{workflowId}/executions/{executionId} endpoint. | ||
@@ -544,7 +585,8 @@ * | ||
*/ | ||
async deleteBatch(batchId: string, deleteDocuments: boolean = false): Promise<Batch> { | ||
async deleteBatch(batchId: string, deleteDocuments = false): Promise<Batch> { | ||
if (deleteDocuments) { | ||
let response = await this.deleteDocuments({batchId}); | ||
let response = await this.deleteDocuments({ batchId }); | ||
while (response.nextToken) { | ||
response = await this.deleteDocuments({batchId, nextToken: response.nextToken}) | ||
// eslint-disable-next-line no-await-in-loop | ||
response = await this.deleteDocuments({ batchId, nextToken: response.nextToken }); | ||
} | ||
@@ -551,0 +593,0 @@ } |
@@ -124,2 +124,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
endTime: string | null; | ||
logId: string | null; | ||
}; | ||
@@ -157,2 +158,6 @@ | ||
export interface UpdateWorkflowExecutionOptions { | ||
nextTransitionId: string; | ||
} | ||
export type WorkflowList = { | ||
@@ -167,5 +172,6 @@ workflows: Array<Workflow>; | ||
output: Record<any, any>; | ||
status?: 'succeeded' | 'failed' | 'running' | 'rejected'; | ||
status: 'succeeded' | 'failed' | 'running' | 'rejected' | 'retry' | 'error'; | ||
startTime: string | null; | ||
endTime: string | null; | ||
logId: string | null; | ||
transitionExecutions: Record<string, Array<string>> | null; | ||
@@ -172,0 +178,0 @@ completedBy: Array<string>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165433
3678