JavaScript SDK for Lucidtech AI Services API
Installation
Browser version
$ yarn add @lucidtech/las-sdk-browser
$ npm install @lucidtech/las-sdk-browser
Node version
$ yarn add @lucidtech/las-sdk-node
$ npm install @lucidtech/las-sdk-node
Usage
import { Client } from '@lucidtech/las-sdk-core';
import { ClientCredentials } from '@lucidtech/las-sdk-node';
import { readFile } from 'fs/promises'
const fileBuffer = await readFile('...path/file.jpg')
const credentials = new ClientCredentials('<apiEndpoint>', '<clientId>', '<clientSecret>', '<authEndpoint>');
const client = new Client(credentials);
const documentResponse = await client.createDocument(fileBuffer, 'image/jpeg');
Contributing
Install dependencies
$ npm install && npm run upgrade-lucidtech
Build
$ npm run build
Run tests
$ npm run test test
Class: Client
A high-level http client for communicating with the Lucidtech REST API
Constructors
constructor
• new Client(credentials)
Parameters
| Name | Type |
|---|---|
credentials | Credentials |
Properties
credentials
• credentials: Credentials
Methods
createAppClient
▸ createAppClient(options): Promise<AppClient>
Creates an app client, calls the POST /appClients endpoint.
Parameters
| Name | Type |
|---|---|
options | CreateAppClientOptions |
Returns
Promise<AppClient>
AppClient response from REST API
createAsset
▸ createAsset(content): Promise<Asset>
Creates an asset, calls the POST /assets endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
content | string | Content to POST (base64-encoded string | Buffer) |
Returns
Promise<Asset>
Asset response from REST API
createBatch
▸ createBatch(options): Promise<Batch>
deprecated Use the new Client.createDataset method instead.
Creates a batch, calls the POST /batches endpoint.
Parameters
| Name | Type |
|---|---|
options | CreateBatchOptions |
Returns
Promise<Batch>
Batch response from REST API
createDataBundle
▸ createDataBundle(modelId, datasetIds, options): Promise<DataBundle>
Creates a dataBundle, calls the POST /models/{modelId}/dataBundles endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
modelId | string | Id of the model to create dataBundle for |
datasetIds | string[] | Ids of the datasets to create dataBundle with |
options | CreateDataBundleOptions | - |
Returns
Promise<DataBundle>
DataBundle response from REST API
createDataset
▸ createDataset(options): Promise<Dataset>
Creates a dataset, calls the POST /datasets endpoint.
Parameters
| Name | Type |
|---|---|
options | CreateDatasetOptions |
Returns
Promise<Dataset>
Dataset response from REST API
createDocument
▸ createDocument(content, contentType, options?): Promise<Pick<LasDocument, "batchId" | "consentId" | "contentType" | "datasetId" | "documentId" | "groundTruth" | "retentionInDays" | "createdTime" | "updatedTime" | "createdBy" | "updatedBy">>
Creates a document, calls the POST /documents endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
content | string | Buffer | Content to POST (base64 string | Buffer) |
contentType | ContentType | MIME type for the document |
options? | CreateDocumentOptions | - |
Returns
Promise<Pick<LasDocument, "batchId" | "consentId" | "contentType" | "datasetId" | "documentId" | "groundTruth" | "retentionInDays" | "createdTime" | "updatedTime" | "createdBy" | "updatedBy">>
Document response from REST API
createModel
▸ createModel(fieldConfig, width, height, options?): Promise<Model>
Creates a model, calls the POST /models endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
fieldConfig | Record<string, Field> | Specification of the fields that the model is going to predict |
width | number | The number of pixels to be used for the input image width of your model |
height | number | The number of pixels to be used for the input image height of your model |
options? | CreateModelOptions | - |
Returns
Promise<Model>
Model response from REST API
createPrediction
▸ createPrediction(documentId, modelId, options?): Promise<PredictionResponse>
Create a prediction on a document using specified model, calls the POST /predictions endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
documentId | string | Id of the document to run inference and create a prediction on |
modelId | string | Id of the model to use for inference |
options? | CreatePredictionsOptions | - |
Returns
Promise<PredictionResponse>
Predicion response from REST API
createSecret
▸ createSecret(data, options?): Promise<Secret>
Creates a secret, calls the POST /secrets endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
data | Record<any, any> | Object containing the data you want to keep secret |
options? | CreateSecretOptions | - |
Returns
Promise<Secret>
Secret response from REST API
createTransition
▸ createTransition(transitionType, options?): Promise<Transition>
Creates a transition, calls the POST /transitions endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
transitionType | TransitionType | Type of transition "docker"|"manual" |
options? | CreateTransitionOptions | - |
Returns
Promise<Transition>
Transition response from REST API
createUser
▸ createUser(email, data?): Promise<User>
Creates a new user, calls the POST /users endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
email | string | Email to the new user |
data? | CreateUserOptions | - |
Returns
Promise<User>
User response from REST API
createWorkflow
▸ createWorkflow(name, specification, options?): Promise<Workflow>
Creates a new workflow, calls the POST /workflows endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
name | string | Name of the workflow |
specification | WorkflowSpecification | Specification of the workflow |
options? | CreateWorkflowOptions | - |
Returns
Promise<Workflow>
Workflow response from REST API
deleteAppClient
▸ deleteAppClient(appClientId): Promise<AppClient>
Delete the app client, calls the DELETE /appClients/{appClientId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
appClientId | string | of the app client |
Returns
Promise<AppClient>
AppClient response from REST API
deleteAsset
▸ deleteAsset(assetId): Promise<Asset>
Delete an asset, calls the DELETE /assets/{assetId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
assetId | string | of the app client |
Returns
Promise<Asset>
Asset response from REST API
deleteBatch
▸ deleteBatch(batchId, deleteDocuments?): Promise<Batch>
Deletes a batch, calls the DELETE /batches/{batchId} endpoint.
deprecated Use the new Client.deleteDataset method instead.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
batchId | string | undefined | Id of the batch |
deleteDocuments | boolean | false | Set to true to delete documents in batch before deleting batch |
Returns
Promise<Batch>
Batch response from REST API
deleteDataBundle
▸ deleteDataBundle(modelId, dataBundleId): Promise<DataBundle>
Delete a dataBundle, calls the DELETE /dataBundles/{dataBundleId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
modelId | string | of the model |
dataBundleId | string | of the dataBundle |
Returns
Promise<DataBundle>
DataBundle response from REST API
deleteDataset
▸ deleteDataset(datasetId, deleteDocuments?): Promise<Dataset>
Deletes a dataset, calls the DELETE /datasets/{datasetId} endpoint.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
datasetId | string | undefined | Id of the dataset |
deleteDocuments | boolean | false | Set to true to delete documents in dataset before deleting dataset |
Returns
Promise<Dataset>
Dataset response from REST API
deleteDocument
▸ deleteDocument(documentId): Promise<LasDocument>
Delete an document, calls the DELETE /documents/{documentId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
documentId | string | of the document |
Returns
Promise<LasDocument>
Document response from REST API
deleteDocuments
▸ deleteDocuments(options?): Promise<LasDocumentList>
Delete documents with the provided consentId, calls the DELETE /documents endpoint. Will delete all documents when no consentId is provided.
Parameters
| Name | Type |
|---|---|
options? | DeleteDocumentOptions |
Returns
Promise<LasDocumentList>
Documents response from REST API
deleteModel
▸ deleteModel(modelId): Promise<Model>
Delete an model, calls the DELETE /models/{modelId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
modelId | string | of the app client |
Returns
Promise<Model>
Model response from REST API
deleteTransition
▸ deleteTransition(transitionId): Promise<Transition>
Delete the transition with the provided transitionId, calls the DELETE /transitions/{transitionId} endpoint. Will fail if transition is in use by one or more workflows.
Parameters
| Name | Type | Description |
|---|---|---|
transitionId | string | Id of the transition |
Returns
Promise<Transition>
Transition response from REST API
deleteUser
▸ deleteUser(userId): Promise<User>
Delete a user, calls the DELETE /users/{userId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
userId | string | Id of the user |
Returns
Promise<User>
User response from REST API
deleteWorkflow
▸ deleteWorkflow(workflowId): Promise<Workflow>
Delete the workflow with the provided workflowId, calls the DELETE /workflows/{workflowId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | string | Id of the workflow |
Returns
Promise<Workflow>
Workflow response from REST API
deleteWorkflowExecution
▸ deleteWorkflowExecution(workflowId, executionId): Promise<WorkflowExecution>
Deletes the execution with the provided executionId from workflowId, calls the DELETE /workflows/{workflowId}/executions/{executionId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | string | Id of the workflow |
executionId | string | Id of the execution |
Returns
Promise<WorkflowExecution>
WorkflowExecution response from REST API
executeTransition
▸ executeTransition(transitionId): Promise<TransitionExecution>
Start executing a manual transition, calls the POST /transitions/{transitionId}/executions endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
transitionId | string | Id of the transition |
Returns
Promise<TransitionExecution>
Transition execution response from REST API
executeWorkflow
▸ executeWorkflow(workflowId, input): Promise<WorkflowExecution>
Start a workflow execution, calls the POST /workflows/{workflowId}/executions endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | string | Id of the workflow |
input | object | Input to the first step of the workflow |
Returns
Promise<WorkflowExecution>
Workflow execution response from REST API
getAsset
▸ getAsset(assetId): Promise<Asset>
Get asset from the REST API, calls the GET /assets/{assetId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
assetId | string | Id of the asset |
Returns
Promise<Asset>
Asset response from REST API
getDataset
▸ getDataset(datasetId): Promise<Dataset>
Get dataset from the REST API, calls the GET /datasets/{datasetId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
datasetId | string | Id of the dataset |
Returns
Promise<Dataset>
Dataset response from REST API
getDocument
▸ getDocument(documentId): Promise<LasDocument>
Get document from the REST API, calls the GET /documents/{documentId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
documentId | string | Id of the document |
Returns
Promise<LasDocument>
Document response from REST API
getLog
▸ getLog(logId): Promise<Log>
Get log, calls the GET /logs/{logId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
logId | string | Id of the log |
Returns
Promise<Log>
Log response from REST API
getModel
▸ getModel(modelId): Promise<Model>
Get model from the REST API, calls the GET /models/{modelId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
modelId | string | Id of the model |
Returns
Promise<Model>
Model response from REST API
getOrganization
▸ getOrganization(organizationId): Promise<Organization>
Get organization from the REST API, calls the GET /organizations/{organizationId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
organizationId | string | Id of the organization |
Returns
Promise<Organization>
Organization response from REST API
getTransition
▸ getTransition(transitionId): Promise<Transition>
Get the transition with the provided transitionId, calls the GET /transitions/{transitionId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
transitionId | string | Id of the transition |
Returns
Promise<Transition>
Transition response from REST API
getTransitionExecution
▸ getTransitionExecution(transitionId, transitionExecutionId): Promise<TransitionExecution>
Get an execution of a transition, calls the GET /transitions/{transitionId}/executions/{executionId} endpoint
Parameters
| Name | Type | Description |
|---|---|---|
transitionId | string | Id of the transition |
transitionExecutionId | string | Id of the execution |
Returns
Promise<TransitionExecution>
Transition execution responses from REST API
getUser
▸ getUser(userId): Promise<User>
Get information about a specific user, calls the GET /users/{userId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
userId | string | Id of the user |
Returns
Promise<User>
User response from REST API
getWorkflow
▸ getWorkflow(workflowId): Promise<Workflow>
Get the workflow with the provided workflowId, calls the GET /workflows/{workflowId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | string | Id of the workflow |
Returns
Promise<Workflow>
Workflow response from REST API
getWorkflowExecution
▸ getWorkflowExecution(workflowId, executionId): Promise<WorkflowExecution>
Get a workflow execution, calls the GET /workflows/{workflowId}/executions/{executionId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | string | Id of the workflow that performs the execution |
executionId | string | Id of the execution to get |
Returns
Promise<WorkflowExecution>
Workflow execution response from REST API
listAppClients
▸ listAppClients(options?): Promise<AppClientList>
List app clients, calls the GET /appClients endpoint.
Parameters
| Name | Type |
|---|---|
options? | PaginationOptions |
Returns
Promise<AppClientList>
AppClientList response from REST API
listAssets
▸ listAssets(options?): Promise<AssetList>
List assets available, calls the GET /assets endpoint.
Parameters
| Name | Type |
|---|---|
options? | PaginationOptions |
Returns
Promise<AssetList>
Assets response from REST API without the content of each asset
listBatches
▸ listBatches(options?): Promise<BatchList>
List batches, calls the GET /batches endpoint.
deprecated Use the new Client.listDatasets method instead.
Parameters
| Name | Type |
|---|---|
options? | PaginationOptions |
Returns
Promise<BatchList>
BatchList response from REST API
listDataBundles
▸ listDataBundles(modelId, options?): Promise<DataBundleList>
List dataBundles available, calls the GET /dataBundles endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
modelId | string | of the model |
options? | PaginationOptions | - |
Returns
Promise<DataBundleList>
DataBundles response from REST API
listDatasets
▸ listDatasets(options?): Promise<DatasetList>
List datasets, calls the GET /datasets endpoint.
Parameters
| Name | Type |
|---|---|
options? | PaginationOptions |
Returns
Promise<DatasetList>
DatasetList response from REST API
listDocuments
▸ listDocuments(options?): Promise<LasDocumentList>
List documents available for inference, calls the GET /documents endpoint.
Parameters
| Name | Type |
|---|---|
options? | ListDocumentsOptions |
Returns
Promise<LasDocumentList>
Documents response from REST API
listModels
▸ listModels(options?): Promise<ModelList>
List models available, calls the GET /models endpoint.
Parameters
| Name | Type |
|---|---|
options? | PaginationOptions |
Returns
Promise<ModelList>
Models response from the REST API
listPredictions
▸ listPredictions(options?): Promise<PredictionList>
Parameters
| Name | Type |
|---|---|
options? | PaginationOptions |
Returns
Promise<PredictionList>
listSecrets
▸ listSecrets(options?): Promise<SecretList>
List secrets available, calls the GET /secrets endpoint.
Parameters
| Name | Type |
|---|---|
options? | PaginationOptions |
Returns
Promise<SecretList>
Secrets response from REST API without the username of each secret
listTransitionExecutions
▸ listTransitionExecutions(transitionId, options?): Promise<TransitionExecutionList>
List executions in a transition, calls the GET /transitions/{transitionId}/executions endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
transitionId | string | Id of the transition |
options? | TransitionExecutionListOptions | - |
Returns
Promise<TransitionExecutionList>
Transition executions responses from REST API
listTransitions
▸ listTransitions(options?): Promise<TransitionList>
List transitions, calls the GET /transitions endpoint.
Parameters
| Name | Type |
|---|---|
options? | ListTransitionOptions |
Returns
Promise<TransitionList>
Transitions response from REST API
listUsers
▸ listUsers(options?): Promise<UserList>
List users, calls the GET /users endpoint.
Parameters
| Name | Type |
|---|---|
options? | PaginationOptions |
Returns
Promise<UserList>
User response from REST API
listWorkflowExecutions
▸ listWorkflowExecutions(workflowId, options?): Promise<WorkflowExecutionList>
List executions in a workflow, calls the GET /workflows/{workflowId}/executions endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | string | Id of the workflow |
options? | ListWorkflowExecutionsOptions | - |
Returns
Promise<WorkflowExecutionList>
Workflow executions responses from REST API
listWorkflows
▸ listWorkflows(options?): Promise<WorkflowList>
List workflows, calls the GET /workflows endpoint.
Parameters
| Name | Type |
|---|---|
options? | PaginationOptions |
Returns
Promise<WorkflowList>
Workflows response from REST API
makeDeleteRequest
▸ makeDeleteRequest<T>(path, query?): Promise<T>
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
path | string |
query? | any |
Returns
Promise<T>
makeGetRequest
▸ makeGetRequest<T>(path, query?): Promise<T>
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
path | string |
query? | any |
Returns
Promise<T>
makePatchRequest
▸ makePatchRequest<T>(path, body): Promise<T>
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
path | string |
body | any |
Returns
Promise<T>
makePostRequest
▸ makePostRequest<T>(path, body): Promise<T>
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type |
|---|---|
path | string |
body | any |
Returns
Promise<T>
sendHeartbeat
▸ sendHeartbeat(transitionId, transitionExecutionId): Promise<unknown>
Send heartbeat for a manual execution to signal that we are still working on it. Must be done at minimum once every 60 seconds or the transition execution will time out. Calls the POST /transitions/{transitionId}/executions/{executionId}/heartbeats endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
transitionId | string | Id of the transition |
transitionExecutionId | string | Id of the transition execution |
Returns
Promise<unknown>
Empty response
updateAppClient
▸ updateAppClient(appClientId, options): Promise<AppClient>
Updates an appClient, calls the PATCH /appClients/{appClientId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
appClientId | string | Id of the appClient |
options | UpdateAppClientOptions | - |
Returns
Promise<AppClient>
AppClient response from REST API with content
updateAsset
▸ updateAsset(assetId, data): Promise<Asset>
Updates an asset, calls the PATCH /assets/{assetId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
assetId | string | Id of the asset |
data | UpdateAssetOptions | - |
Returns
Promise<Asset>
Asset response from REST API with content
updateBatch
▸ updateBatch(batchId, options): Promise<Batch>
Updates an batch, calls the PATCH /batches/{batchId} endpoint.
deprecated Use the new Client.updateDataset method instead.
Parameters
| Name | Type | Description |
|---|---|---|
batchId | string | Id of the batch |
options | UpdateBatchOptions | - |
Returns
Promise<Batch>
Batch response from REST API with content
updateDataBundle
▸ updateDataBundle(modelId, dataBundleId, options): Promise<DataBundle>
Updates a dataBundle, calls the PATCH /dataBundles/{dataBundleId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
modelId | string | of the model |
dataBundleId | string | Id of the dataBundle |
options | UpdateDataBundleOptions | - |
Returns
Promise<DataBundle>
DataBundle response from REST API
updateDataset
▸ updateDataset(datasetId, options): Promise<Dataset>
Updates a dataset, calls the PATCH /datasets/{datasetId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
datasetId | string | Id of the dataset |
options | UpdateDatasetOptions | - |
Returns
Promise<Dataset>
Dataset response from REST API with content
updateDocument
▸ updateDocument(documentId, data): Promise<LasDocument>
Post ground truth to the REST API, calls the PATCH /documents/{documentId} endpoint. Posting ground truth means posting the ground truth data for the particular document. This enables the API to learn from past mistakes.
Parameters
| Name | Type | Description |
|---|---|---|
documentId | string | Id of the document |
data | UpdateDocumentOptions | - |
Returns
Promise<LasDocument>
Document response from REST API
updateModel
▸ updateModel(modelId, options): Promise<Model>
Updates a model, calls the PATCH /models/{modelId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
modelId | string | Id of the model |
options | UpdateModelOptions | - |
Returns
Promise<Model>
Model response from REST API
updateOrganization
▸ updateOrganization(organizationId, options): Promise<Organization>
Updates an organization, calls the PATCH /organizations/{organizationId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
organizationId | string | Id of the organization |
options | UpdateOrganizationOptions | - |
Returns
Promise<Organization>
Organization response from REST API with content
updateSecret
▸ updateSecret(secretId, data): Promise<Secret>
Updates a secret, calls the PATCH /secrets/{secretId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
secretId | string | Id of the secret |
data | UpdateSecretOptions | - |
Returns
Promise<Secret>
updateTransition
▸ updateTransition(transitionId, data): Promise<Transition>
Updates a transition, calls the PATCH /transitions/{transitionId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
transitionId | string | Id of the transition |
data | UpdateTransitionOptions | Transition fields to PATCH |
Returns
Promise<Transition>
Transition response from REST API
updateTransitionExecution
▸ updateTransitionExecution(transitionId, executionId, data): Promise<TransitionExecution>
Ends the processing of the transition execution, calls the PATCH /transitions/{transitionId}/executions/{executionId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
transitionId | string | Id of the transition that performs the execution |
executionId | string | Id of the execution to update |
data | UpdateTransitionExecution | - |
Returns
Promise<TransitionExecution>
Transition execution response from REST API
updateUser
▸ updateUser(userId, data): Promise<User>
Updates a user, calls the PATCH /users/{userId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
userId | string | Id of the user |
data | UpdateUserOptions | - |
Returns
Promise<User>
User response from REST API
updateWorkflow
▸ updateWorkflow(workflowId, data): Promise<Workflow>
Updates a workflow, calls the PATCH /workflows/{workflowId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | string | Id of the workflow |
data | UpdateWorkflowOptions | Workflow fields to PATCH |
Returns
Promise<Workflow>
Workflow response from REST API
updateWorkflowExecution
▸ updateWorkflowExecution(workflowId, executionId, data): Promise<WorkflowExecution>
Retry or end the processing of a workflow execution, calls the PATCH /workflows/{workflowId}/executions/{executionId} endpoint.
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | string | Id of the workflow that performs the execution |
executionId | string | Id of the execution to update |
data | UpdateWorkflowExecutionOptions | - |
Returns
Promise<WorkflowExecution>
Workflow execution response from REST API
Class: Credentials
Use to fetch and store credentials and to generate/cache an access token
Properties
apiEndpoint
• Readonly apiEndpoint: string
Methods
getAccessToken
▸ getAccessToken(): Promise<string>
Method used to get and cache an access token. Algorithm used:
- Look for a valid token in memory.
- Look for a valid token in the storage (if provided);
- Fetch a new token from server and cache it (both in memory and in storage).
Returns
Promise<string>
Class: Token
Wrapper class for an AWS Cognito token
Constructors
constructor
• new Token(accessToken, expiration, refreshToken?)
Parameters
| Name | Type |
|---|---|
accessToken | string |
expiration | number |
refreshToken? | string |
Properties
accessToken
• Readonly accessToken: string
expiration
• Readonly expiration: number
refreshToken
• Optional Readonly refreshToken: string
Methods
isValid
▸ isValid(): boolean
Checks if current timestamp is larger than token expiration time
Returns
boolean
Interface: CreateDocumentOptions
Properties
batchId
• Optional batchId: string
consentId
• Optional consentId: string
datasetId
• Optional datasetId: string
groundTruth
• Optional groundTruth: GroundTruth[]
retentionInDays
• Optional retentionInDays: number
Interface: CreatePredictionsOptions
Properties
autoRotate
• Optional autoRotate: boolean
imageQuality
• Optional imageQuality: "LOW" | "HIGH"
maxPages
• Optional maxPages: number
Interface: CreateSecretOptions
Properties
description
• Optional description: string
Interface: CreateTransitionOptions
Properties
description
• Optional description: null | string
inputJsonSchema
• Optional inputJsonSchema: Record<any, any>
name
• Optional name: null | string
outputJsonSchema
• Optional outputJsonSchema: Record<any, any>
parameters
• Optional parameters: CreateTransitionDockerParams | CreateTransitionManualParams
Interface: PaginationOptions
Properties
maxResults
• Optional maxResults: number
nextToken
• Optional nextToken: string
Interface: TokenStorage<T>
Type parameters
| Name | Type |
|---|---|
T | extends Token |
Methods
getPersistentToken
▸ getPersistentToken(): null | T
Returns
null | T
setPersistentToken
▸ setPersistentToken(value): void
Parameters
| Name | Type |
|---|---|
value | T |
Returns
void
Interface: UpdateAssetOptions
Properties
content
• Optional content: string | Buffer
Interface: UpdateDocumentOptions
Properties
groundTruth
• Optional groundTruth: GroundTruth[]
retentionInDays
• Optional retentionInDays: number
Interface: UpdateSecretOptions
Properties
data
• Optional data: Record<any, any>
description
• Optional description: null | string
name
• Optional name: null | string
Interface: UpdateTransitionExecution
Properties
error
• Optional error: Object
Type declaration
| Name | Type |
|---|---|
message | string |
output
• Optional output: Record<any, any>
startTime
• Optional startTime: string
status
• status: "succeeded" | "failed" | "retry" | "rejected"
Interface: UpdateWorkflowExecutionOptions
Properties
nextTransitionId
• nextTransitionId: string
Interface: UpdateWorkflowOptions
Properties
completedConfig
• Optional completedConfig: WorkflowCompletedConfig
description
• Optional description: null | string
errorConfig
• Optional errorConfig: WorkflowErrorConfig
name
• Optional name: null | string
@lucidtech/las-sdk-core
Classes
Interfaces
- CreateDocumentOptions
- CreatePredictionsOptions
- CreateSecretOptions
- CreateTransitionOptions
- PaginationOptions
- TokenStorage
- UpdateAssetOptions
- UpdateDocumentOptions
- UpdateSecretOptions
- UpdateTransitionExecution
- UpdateWorkflowExecutionOptions
- UpdateWorkflowOptions
Type aliases
AppClient
Ƭ AppClient: Object
Type declaration
| Name | Type |
|---|---|
appClientId | string |
callbackUrls | string[] | null |
clientId | string |
clientSecret? | string |
createdBy | string | null |
createdTime | string | null |
defaultLoginUrl | string | null |
description | string | null |
hasSecret | boolean |
loginUrls | string[] | null |
logoutUrls | string[] | null |
name | string | null |
updatedBy | string | null |
updatedTime | string | null |
AppClientList
Ƭ AppClientList: Object
Type declaration
| Name | Type |
|---|---|
appClients | AppClient[] |
nextToken | string | null |
Asset
Ƭ Asset: Object
Type declaration
| Name | Type |
|---|---|
assetId | string |
content | string |
AssetList
Ƭ AssetList: Object
Type declaration
| Name | Type |
|---|---|
assets | AssetWithoutContent[] |
nextToken | string | null |
AssetWithoutContent
Ƭ AssetWithoutContent: Omit<Asset, "content">
AuthorizationHeaders
Ƭ AuthorizationHeaders: Object
Type declaration
| Name | Type |
|---|---|
Authorization | string |
AxiosFn
Ƭ AxiosFn: <T, R>(url: string, body?: any, config?: AxiosRequestConfig) => Promise<R>
Type declaration
▸ <T, R>(url, body?, config?): Promise<R>
Type parameters
| Name | Type |
|---|---|
T | any |
R | AxiosResponse<T> |
Parameters
| Name | Type |
|---|---|
url | string |
body? | any |
config? | AxiosRequestConfig |
Returns
Promise<R>
Batch
Ƭ Batch: Object
Type declaration
| Name | Type |
|---|---|
batchId | string |
containsPersonallyIdentifiableInformation | boolean |
createdTime | string |
description | string |
name | string |
numDocuments | number |
retentionInDays | number |
storageLocation | "EU" |
BatchList
Ƭ BatchList: Object
Type declaration
| Name | Type |
|---|---|
batches | Batch[] |
nextToken | string | null |
ContentType
Ƭ ContentType: "application/pdf" | "image/jpeg" | "image/png" | "image/tiff"
CreateAppClientOptions
Ƭ CreateAppClientOptions: Object
Type declaration
| Name | Type |
|---|---|
callbackUrls? | string[] |
defaultLoginUrl? | string |
description? | string |
generateSecret? | boolean |
loginUrls? | string[] |
logoutUrls? | string[] |
name? | string |
CreateBatchOptions
Ƭ CreateBatchOptions: Object
Type declaration
| Name | Type |
|---|---|
containsPersonallyIdentifiableInformation? | boolean |
description? | string |
name? | string |
CreateDataBundleOptions
Ƭ CreateDataBundleOptions: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
name? | string |
CreateDatasetOptions
Ƭ CreateDatasetOptions: Object
Type declaration
| Name | Type |
|---|---|
containsPersonallyIdentifiableInformation? | boolean |
description? | string |
name? | string |
CreateModelOptions
Ƭ CreateModelOptions: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
name? | string |
preprocessConfig? | PreprocessConfig |
CreateTransitionDockerParams
Ƭ CreateTransitionDockerParams: Object
Type declaration
| Name | Type |
|---|---|
cpu? | 256 |
credentials? | Object |
credentials.password | string |
credentials.username | string |
environment? | object |
imageUrl | string |
memory? | 512 | 1024 | 2048 |
CreateTransitionManualParams
Ƭ CreateTransitionManualParams: Object
Type declaration
| Name | Type |
|---|---|
assets? | { jsRemoteComponent?: string } & Record<string, string> |
CreateTransitionParams
Ƭ CreateTransitionParams: CreateTransitionDockerParams | CreateTransitionManualParams
CreateUserOptions
Ƭ CreateUserOptions: Object
Type declaration
| Name | Type |
|---|---|
appClientId? | string |
avatar? | string |
name? | string |
CreateWorkflowOptions
Ƭ CreateWorkflowOptions: Object
Type declaration
| Name | Type |
|---|---|
completedConfig? | WorkflowCompletedConfig |
description? | string | null |
errorConfig? | WorkflowErrorConfig |
DataBundle
Ƭ DataBundle: Object
Type declaration
| Name | Type |
|---|---|
createdBy | string | null |
createdTime | string |
dataBundleId | string |
datasets | Dataset[] |
description | string | null |
modelId | string |
name | string | null |
status | "ready" | "processing" | "failed" |
summary | Record<string, any> |
updatedBy | string | null |
updatedTime | string |
DataBundleList
Ƭ DataBundleList: Object
Type declaration
| Name | Type |
|---|---|
dataBundles | DataBundle[] |
nextToken | string | null |
Dataset
Ƭ Dataset: Object
Type declaration
| Name | Type |
|---|---|
containsPersonallyIdentifiableInformation | boolean |
createdBy | string | null |
createdTime | string |
datasetId | string |
description | string |
groundTruthSummary | Record<string, number> |
name | string |
numberOfDocuments | number |
retentionInDays | number |
storageLocation | "EU" |
updatedBy | string | null |
updatedTime | string |
version | number |
DatasetList
Ƭ DatasetList: Object
Type declaration
| Name | Type |
|---|---|
datasets | Dataset[] |
nextToken | string | null |
DeleteDocumentOptions
Ƭ DeleteDocumentOptions: PaginationOptions & { batchId?: string | string[] ; consentId?: string | string[] ; datasetId?: string | string[] }
Field
Ƭ Field: Object
Type declaration
| Name | Type |
|---|---|
description | string |
maxLength | number |
type | "all" | "alphanum" | "alphanumext" | "amount" | "date" | "letter" | "number" | "phone" | "string" | "digits" |
FieldConfig
Ƭ FieldConfig: Record<string, Field>
GroundTruth
Ƭ GroundTruth: Object
Type declaration
| Name | Type | Description |
|---|---|---|
label | string | maxLength: 36, minLength: 1, pattern: ^[0-9A-Za-z_]+$ |
value | string | boolean | null | maxLength: 64, minLength: 1 |
LasDocument
Ƭ LasDocument: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
consentId? | string |
content | string |
contentType | ContentType |
createdBy | string | null |
createdTime | string | null |
datasetId? | string |
documentId | string |
groundTruth? | GroundTruth[] |
retentionInDays | number |
updatedBy | string | null |
updatedTime | string | null |
LasDocumentList
Ƭ LasDocumentList: Object
Type declaration
| Name | Type |
|---|---|
batchId? | string |
documents | LasDocumentWithoutContent[] |
nextToken | string | null |
LasDocumentWithoutContent
Ƭ LasDocumentWithoutContent: Omit<LasDocument, "content">
ListAppClientsOptions
Ƭ ListAppClientsOptions: PaginationOptions
ListAssetsOptions
Ƭ ListAssetsOptions: PaginationOptions
ListBatchesOptions
Ƭ ListBatchesOptions: PaginationOptions
ListDataBundleOptions
Ƭ ListDataBundleOptions: PaginationOptions
ListDatasetsOptions
Ƭ ListDatasetsOptions: PaginationOptions
ListDocumentsOptions
Ƭ ListDocumentsOptions: PaginationOptions & { batchId?: string | string[] ; consentId?: string | string[] ; datasetId?: string | string[] }
ListModelsOptions
Ƭ ListModelsOptions: PaginationOptions
ListPredictionsOptions
Ƭ ListPredictionsOptions: PaginationOptions
ListSecretsOptions
Ƭ ListSecretsOptions: PaginationOptions
ListTransitionOptions
Ƭ ListTransitionOptions: PaginationOptions & { transitionType?: string | string[] }
ListUsersOptions
Ƭ ListUsersOptions: PaginationOptions
ListWorkflowExecutionsOptions
Ƭ ListWorkflowExecutionsOptions: PaginationOptions & { order?: "ascending" | "descending" ; sortBy?: "startTime" | "endTime" ; status?: string | string[] }
ListWorkflowOptions
Ƭ ListWorkflowOptions: PaginationOptions
Log
Ƭ Log: Object
Type declaration
| Name | Type |
|---|---|
events | Record<any, any>[] |
logId | string |
transitionId? | string | null |
Model
Ƭ Model: Object
Type declaration
| Name | Type |
|---|---|
createdBy | string | null |
createdTime | string | null |
description | string | null |
fieldConfig | FieldConfig | null |
height | number |
modelId | string |
name | string | null |
preprocessConfig | PreprocessConfig |
status | "active" | "inactive" | "training" |
updatedBy | string | null |
updatedTime | string | null |
width | number |
ModelList
Ƭ ModelList: Object
Type declaration
| Name | Type |
|---|---|
models | Model[] |
nextToken | string | null |
Organization
Ƭ Organization: Object
Type declaration
| Name | Type |
|---|---|
description | string | null |
monthlyNumberOfDataBundlesAllowed | number |
monthlyNumberOfDataBundlesCreated | number |
monthlyNumberOfDocumentsAllowed | number |
monthlyNumberOfDocumentsCreated | number |
monthlyNumberOfPredictionsAllowed | number |
monthlyNumberOfPredictionsCreated | number |
monthlyNumberOfTransitionExecutionsAllowed | number |
monthlyNumberOfTransitionExecutionsCreated | number |
monthlyNumberOfWorkflowExecutionsAllowed | number |
monthlyNumberOfWorkflowExecutionsCreated | number |
monthlyUsageSummary | Record<string, any> |
name | string | null |
numberOfAppClientsAllowed | number |
numberOfAppClientsCreated | number |
numberOfAssetsAllowed | number |
numberOfAssetsCreated | number |
numberOfBatchesAllowed | number |
numberOfBatchesCreated | number |
numberOfDatasetsAllowed | number |
numberOfDatasetsCreated | number |
numberOfModelsAllowed | number |
numberOfModelsCreated | number |
numberOfSecretsAllowed | number |
numberOfSecretsCreated | number |
numberOfTransitionsAllowed | number |
numberOfTransitionsCreated | number |
numberOfUsersAllowed | number |
numberOfUsersCreated | number |
numberOfWorkflowsAllowed | number |
numberOfWorkflowsCreated | number |
organizationId | string |
PostPredictions
Ƭ PostPredictions: CreatePredictionsOptions & { documentId: string ; modelId: string }
Prediction
Ƭ Prediction: GroundTruth & { confidence: number }
PredictionList
Ƭ PredictionList: Object
Type declaration
| Name | Type |
|---|---|
nextToken | string | null |
predictions | PredictionResponse[] |
PredictionResponse
Ƭ PredictionResponse: Object
Type declaration
| Name | Type |
|---|---|
documentId | string |
inferenceTime | number |
modelId | string |
predictionId | string |
predictions | Prediction[] |
timestamp | number |
PreprocessConfig
Ƭ PreprocessConfig: Object
Type declaration
| Name | Type |
|---|---|
autoRotate | boolean |
imageQuality | "LOW" | "HIGH" |
maxPages | number |
Secret
Ƭ Secret: Object
Type declaration
| Name | Type |
|---|---|
description | string | null |
name | string | null |
secredId | string |
SecretList
Ƭ SecretList: Object
Type declaration
| Name | Type |
|---|---|
nextToken | string | null |
secrets | Secret[] |
Transition
Ƭ Transition: Object
Type declaration
| Name | Type |
|---|---|
assets? | Record<string, string> |
description | string |
inputJsonSchema | unknown |
name | string |
outputJsonSchema? | unknown |
parameters | Record<string, any> |
transitionId | string |
transitionType | TransitionType |
TransitionExecution
Ƭ TransitionExecution: Object
Type declaration
| Name | Type |
|---|---|
completedBy | string | null |
endTime | string | null |
executionId | string |
input | Record<any, any> |
logId | string | null |
startTime | string | null |
status | TransitionExecutionStatus |
transitionId | string |
TransitionExecutionList
Ƭ TransitionExecutionList: Object
Type declaration
| Name | Type |
|---|---|
executions | TransitionExecution[] |
nextToken | string | null |
transitionId | string |
TransitionExecutionListOptions
Ƭ TransitionExecutionListOptions: PaginationOptions & { executionId?: string | string[] ; order?: "ascending" | "descending" ; sortBy?: "startTime" | "endTime" ; status?: TransitionExecutionStatus | TransitionExecutionStatus[] }
TransitionExecutionStatus
Ƭ TransitionExecutionStatus: "succeeded" | "failed" | "retry" | "running" | "rejected"
TransitionList
Ƭ TransitionList: Object
Type declaration
| Name | Type |
|---|---|
nextToken | string | null |
transitions | Transition[] |
TransitionType
Ƭ TransitionType: "docker" | "manual"
UpdateAppClientOptions
Ƭ UpdateAppClientOptions: Object
Type declaration
| Name | Type |
|---|---|
defaultLoginUrl? | string |
description? | string |
loginUrls? | string[] |
name? | string |
UpdateBatchOptions
Ƭ UpdateBatchOptions: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
name? | string |
UpdateDataBundleOptions
Ƭ UpdateDataBundleOptions: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
name? | string |
UpdateDatasetOptions
Ƭ UpdateDatasetOptions: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
name? | string |
UpdateModelOptions
Ƭ UpdateModelOptions: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
fieldConfig? | FieldConfig |
height? | number |
name? | string |
preprocessConfig? | PreprocessConfig |
status? | "training" |
width? | number |
UpdateOrganizationOptions
Ƭ UpdateOrganizationOptions: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
name? | string |
UpdateTransitionOptions
Ƭ UpdateTransitionOptions: Object
Type declaration
| Name | Type |
|---|---|
description? | string |
inputJsonSchema? | Record<any, any> |
name? | string |
outputJsonSchema? | Record<any, any> |
UpdateUserOptions
Ƭ UpdateUserOptions: Object
Type declaration
| Name | Type |
|---|---|
avatar? | string | null |
name? | string | null |
User
Ƭ User: Object
Type declaration
| Name | Type |
|---|---|
avatar | string | null |
createdBy | string | null |
createdTime | string | null |
email | string |
name | string | null |
updatedBy | string | null |
updatedTime | string | null |
userId | string |
UserList
Ƭ UserList: Object
Type declaration
| Name | Type |
|---|---|
nextToken | string | null |
users | User[] |
Workflow
Ƭ Workflow: Object
Type declaration
| Name | Type |
|---|---|
completedConfig | WorkflowCompletedConfig |
description | string | null |
errorConfig | WorkflowErrorConfig |
name | string | null |
numberOfRunningExecutions | number |
workflowId | string |
WorkflowCompletedConfig
Ƭ WorkflowCompletedConfig: Object
Type declaration
| Name | Type |
|---|---|
environment? | Record<string, string> |
environmentSecrets? | string[] |
imageUrl | string |
secretId? | string |
WorkflowErrorConfig
Ƭ WorkflowErrorConfig: Object
Type declaration
| Name | Type |
|---|---|
email? | string |
manualRetry? | boolean |
WorkflowExecution
Ƭ WorkflowExecution: Object
Type declaration
| Name | Type |
|---|---|
completedBy | string[] |
endTime | string | null |
executionId | string |
input | Record<any, any> |
logId | string | null |
output | Record<any, any> |
startTime | string | null |
status | "succeeded" | "failed" | "running" | "rejected" | "retry" | "error" |
transitionExecutions | Record<string, string[]> | null |
workflowId | string |
WorkflowExecutionList
Ƭ WorkflowExecutionList: Object
Type declaration
| Name | Type |
|---|---|
executions | Required<WorkflowExecution>[] |
nextToken | string | null |
status? | "succeeded" | "failed" | "running" | "rejected" |
workflowId | string |
WorkflowList
Ƭ WorkflowList: Object
Type declaration
| Name | Type |
|---|---|
workflows | Workflow[] |
WorkflowSpecification
Ƭ WorkflowSpecification: Object
Type declaration
| Name | Type |
|---|---|
definition | object |
language? | "ASL" |
version? | "1.0.0" |