Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lucidtech/las-sdk-core

Package Overview
Dependencies
Maintainers
2
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lucidtech/las-sdk-core - npm Package Compare versions

Comparing version 5.1.3 to 6.0.0

41

lib/client.d.ts
/// <reference types="node" />
import { Credentials } from './credentials';
import { AppClient, AppClientList, Asset, AssetList, Batch, BatchList, ContentType, CreateAppClientOptions, CreateBatchOptions, CreateDataBundleOptions, CreateDatasetOptions, CreateDocumentOptions, CreateModelOptions, CreatePredictionsOptions, CreateSecretOptions, CreateTransitionOptions, CreateUserOptions, CreateWorkflowOptions, DataBundle, DataBundleList, Dataset, DatasetList, DeleteDocumentOptions, FieldConfig, LasDocument, LasDocumentList, LasDocumentWithoutContent, ListAppClientsOptions, ListAssetsOptions, ListBatchesOptions, ListDataBundleOptions, ListDatasetsOptions, ListDocumentsOptions, ListModelsOptions, ListPredictionsOptions, ListSecretsOptions, ListTransitionOptions, ListUsersOptions, ListWorkflowExecutionsOptions, ListWorkflowOptions, Log, Model, ModelList, Organization, PredictionList, PredictionResponse, Secret, SecretList, Transition, TransitionExecution, TransitionExecutionList, TransitionExecutionListOptions, TransitionList, TransitionType, UpdateAppClientOptions, UpdateAssetOptions, UpdateBatchOptions, UpdateDataBundleOptions, UpdateDatasetOptions, UpdateDocumentOptions, UpdateModelOptions, UpdateOrganizationOptions, UpdateSecretOptions, UpdateTransitionExecution, UpdateTransitionOptions, UpdateUserOptions, UpdateWorkflowExecutionOptions, UpdateWorkflowOptions, User, UserList, Workflow, WorkflowExecution, WorkflowExecutionList, WorkflowList, WorkflowSpecification } from './types';
import { AppClient, AppClientList, Asset, AssetList, ContentType, CreateAppClientOptions, CreateDataBundleOptions, CreateDatasetOptions, CreateDocumentOptions, CreateModelOptions, CreatePredictionsOptions, CreateSecretOptions, CreateTransitionOptions, CreateUserOptions, CreateWorkflowOptions, DataBundle, DataBundleList, Dataset, DatasetList, DeleteDocumentOptions, FieldConfig, LasDocument, LasDocumentList, LasDocumentWithoutContent, ListAppClientsOptions, ListAssetsOptions, ListDataBundleOptions, ListDatasetsOptions, ListDocumentsOptions, ListModelsOptions, ListPredictionsOptions, ListSecretsOptions, ListTransitionOptions, ListUsersOptions, ListWorkflowExecutionsOptions, ListWorkflowOptions, Log, Model, ModelList, Organization, PredictionList, PredictionResponse, Secret, SecretList, Transition, TransitionExecution, TransitionExecutionList, TransitionExecutionListOptions, TransitionList, TransitionType, UpdateAppClientOptions, UpdateAssetOptions, UpdateDataBundleOptions, UpdateDatasetOptions, UpdateDocumentOptions, UpdateModelOptions, UpdateOrganizationOptions, UpdateSecretOptions, UpdateTransitionExecution, UpdateTransitionOptions, UpdateUserOptions, UpdateWorkflowExecutionOptions, UpdateWorkflowOptions, User, UserList, Workflow, WorkflowExecution, WorkflowExecutionList, WorkflowList, WorkflowSpecification } from './types';
/**

@@ -67,3 +67,2 @@ * A high-level http client for communicating with the Lucidtech REST API

* @param options.consentId Id of the consent that marks the owner of the document
* @param options.batchId Id of the associated batch
* @param options.groundTruth List of GroundTruth items representing the ground truth values for the document

@@ -83,3 +82,2 @@ * @returns Document response from REST API

*
* @param options.batchId Ids of the batches that contains the documents of interest
* @param options.consentId Ids of the consents that marks the owner of the document

@@ -426,39 +424,2 @@ * @param options.maxResults Maximum number of results to be returned

/**
* @deprecated Use the new {@link Client.createDataset} method instead.
* Creates a batch, calls the POST /batches endpoint.
*
* @param options.name Name of the batch
* @param options.description Description of the batch
* @returns Batch response from REST API
*/
createBatch(options: CreateBatchOptions): Promise<Batch>;
/**
* Updates an batch, calls the PATCH /batches/{batchId} endpoint.
*
* @deprecated Use the new {@link Client.updateDataset} method instead.
* @param batchId Id of the batch
* @param options.description Description of batch
* @param options.name Name of batch
* @returns Batch response from REST API with content
*/
updateBatch(batchId: string, options: UpdateBatchOptions): Promise<Batch>;
/**
* List batches, calls the GET /batches endpoint.
*
* @deprecated Use the new {@link Client.listDatasets} method instead.
* @param options.maxResults Maximum number of results to be returned
* @param options.nextToken A unique token for each page, use the returned token to retrieve the next page.
* @returns BatchList response from REST API
*/
listBatches(options?: ListBatchesOptions): Promise<BatchList>;
/**
* Deletes a batch, calls the DELETE /batches/{batchId} endpoint.
*
* @deprecated Use the new {@link Client.deleteDataset} method instead.
* @param batchId Id of the batch
* @param deleteDocuments Set to true to delete documents in batch before deleting batch
* @returns Batch response from REST API
*/
deleteBatch(batchId: string, deleteDocuments?: boolean): Promise<Batch>;
/**
* Creates a new user, calls the POST /users endpoint.

@@ -465,0 +426,0 @@ *

@@ -157,3 +157,2 @@ "use strict";

* @param options.consentId Id of the consent that marks the owner of the document
* @param options.batchId Id of the associated batch
* @param options.groundTruth List of GroundTruth items representing the ground truth values for the document

@@ -194,3 +193,2 @@ * @returns Document response from REST API

*
* @param options.batchId Ids of the batches that contains the documents of interest
* @param options.consentId Ids of the consents that marks the owner of the document

@@ -864,80 +862,2 @@ * @param options.maxResults Maximum number of results to be returned

/**
* @deprecated Use the new {@link Client.createDataset} method instead.
* Creates a batch, calls the POST /batches endpoint.
*
* @param options.name Name of the batch
* @param options.description Description of the batch
* @returns Batch response from REST API
*/
Client.prototype.createBatch = function (options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.makePostRequest('/batches', options)];
});
});
};
/**
* Updates an batch, calls the PATCH /batches/{batchId} endpoint.
*
* @deprecated Use the new {@link Client.updateDataset} method instead.
* @param batchId Id of the batch
* @param options.description Description of batch
* @param options.name Name of batch
* @returns Batch response from REST API with content
*/
Client.prototype.updateBatch = function (batchId, options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.makePatchRequest("/batches/" + batchId, options)];
});
});
};
/**
* List batches, calls the GET /batches endpoint.
*
* @deprecated Use the new {@link Client.listDatasets} method instead.
* @param options.maxResults Maximum number of results to be returned
* @param options.nextToken A unique token for each page, use the returned token to retrieve the next page.
* @returns BatchList response from REST API
*/
Client.prototype.listBatches = function (options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.makeGetRequest('/batches', options)];
});
});
};
/**
* Deletes a batch, calls the DELETE /batches/{batchId} endpoint.
*
* @deprecated Use the new {@link Client.deleteDataset} method instead.
* @param batchId Id of the batch
* @param deleteDocuments Set to true to delete documents in batch before deleting batch
* @returns Batch response from REST API
*/
Client.prototype.deleteBatch = function (batchId, deleteDocuments) {
if (deleteDocuments === void 0) { deleteDocuments = false; }
return __awaiter(this, void 0, void 0, function () {
var response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!deleteDocuments) return [3 /*break*/, 4];
return [4 /*yield*/, this.deleteDocuments({ batchId: batchId })];
case 1:
response = _a.sent();
_a.label = 2;
case 2:
if (!response.nextToken) return [3 /*break*/, 4];
return [4 /*yield*/, this.deleteDocuments({ batchId: batchId, nextToken: response.nextToken })];
case 3:
// eslint-disable-next-line no-await-in-loop
response = _a.sent();
return [3 /*break*/, 2];
case 4: return [2 /*return*/, this.makeDeleteRequest("/batches/" + batchId)];
}
});
});
};
/**
* Creates a new user, calls the POST /users endpoint.

@@ -944,0 +864,0 @@ *

@@ -0,0 +0,0 @@ import { TokenStorage } from './storage';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Credentials, Token } from './credentials';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export { Credentials, Token } from './credentials';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Token } from './credentials';

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

43

lib/types.d.ts

@@ -11,3 +11,2 @@ /// <reference types="node" />

export declare type LasDocument = {
batchId?: string;
consentId?: string;

@@ -27,3 +26,2 @@ content: string;

export interface CreateDocumentOptions {
batchId?: string;
consentId?: string;

@@ -39,3 +37,2 @@ datasetId?: string;

export declare type DeleteDocumentOptions = PaginationOptions & {
batchId?: string | Array<string>;
consentId?: string | Array<string>;

@@ -45,3 +42,2 @@ datasetId?: string | Array<string>;

export declare type ListDocumentsOptions = PaginationOptions & {
batchId?: string | Array<string>;
consentId?: string | Array<string>;

@@ -52,5 +48,15 @@ datasetId?: string | Array<string>;

documents: Array<LasDocumentWithoutContent>;
batchId?: string;
nextToken: string | null;
};
export declare type BestFirst = {
strategy: 'BEST_FIRST';
};
export declare type BestNPages = {
strategy: 'BEST_N_PAGES';
parameters: {
n: 1 | 2 | 3;
collapse?: boolean;
};
};
export declare type PostprocessConfig = BestFirst | BestNPages;
export interface CreatePredictionsOptions {

@@ -60,2 +66,3 @@ maxPages?: number;

imageQuality?: 'LOW' | 'HIGH';
postprocessConfig?: PostprocessConfig;
}

@@ -229,26 +236,2 @@ export interface PaginationOptions {

};
export declare type Batch = {
batchId: string;
containsPersonallyIdentifiableInformation: boolean;
createdTime: string;
description: string;
name: string;
numDocuments: number;
retentionInDays: number;
storageLocation: 'EU';
};
export declare type CreateBatchOptions = {
name?: string;
description?: string;
containsPersonallyIdentifiableInformation?: boolean;
};
export declare type UpdateBatchOptions = {
description?: string;
name?: string;
};
export declare type BatchList = {
batches: Array<Batch>;
nextToken: string | null;
};
export declare type ListBatchesOptions = PaginationOptions;
export declare type Dataset = {

@@ -375,4 +358,2 @@ containsPersonallyIdentifiableInformation: boolean;

numberOfAssetsCreated: number;
numberOfBatchesAllowed: number;
numberOfBatchesCreated: number;
numberOfDatasetsAllowed: number;

@@ -379,0 +360,0 @@ numberOfDatasetsCreated: number;

"use strict";
/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", { value: true });
export declare type BuildURLParams = Record<string, undefined | string | Array<string> | number>;
export declare function buildURL(url: string, params?: BuildURLParams): string;
export declare function wait(ms: number): Promise<void>;

@@ -0,0 +0,0 @@ "use strict";

{
"name": "@lucidtech/las-sdk-core",
"version": "5.1.3",
"version": "6.0.0",
"author": "Lucidtech AS <hello@lucidtech.ai>",

@@ -33,3 +33,3 @@ "maintainers": [

},
"gitHead": "55d40295564000d2def654f9408c66d1562007a2"
"gitHead": "e68c66ac9d22e53a4b58065c399da643c165cfd3"
}

@@ -28,3 +28,2 @@ /**

const createAssetId = () => `las:asset:${uuidWithoutDashes()}`;
const createBatchId = () => `las:batch:${uuidWithoutDashes()}`;
const createConsentId = () => `las:consent:${uuidWithoutDashes()}`;

@@ -66,4 +65,2 @@ const createDataBundleId = () => `las:model-data-bundle:${uuidWithoutDashes()}`;

await expect(getOrganizationPromise).resolves.toHaveProperty('numberOfAssetsCreated');
await expect(getOrganizationPromise).resolves.toHaveProperty('numberOfBatchesAllowed');
await expect(getOrganizationPromise).resolves.toHaveProperty('numberOfBatchesCreated');
await expect(getOrganizationPromise).resolves.toHaveProperty('numberOfModelsAllowed');

@@ -105,4 +102,2 @@ await expect(getOrganizationPromise).resolves.toHaveProperty('numberOfModelsCreated');

await expect(updateOrganizationPromise).resolves.toHaveProperty('numberOfAssetsCreated');
await expect(updateOrganizationPromise).resolves.toHaveProperty('numberOfBatchesAllowed');
await expect(updateOrganizationPromise).resolves.toHaveProperty('numberOfBatchesCreated');
await expect(updateOrganizationPromise).resolves.toHaveProperty('numberOfModelsAllowed');

@@ -129,10 +124,7 @@ await expect(updateOrganizationPromise).resolves.toHaveProperty('numberOfModelsCreated');

const consentId = createConsentId();
const batchId = createBatchId();
const datasetId = createDatasetId();
const createDocumentPromise = client.createDocument(content, contentType, {
batchId,
consentId,
datasetId,
});
await expect(createDocumentPromise).resolves.toHaveProperty('batchId');
await expect(createDocumentPromise).resolves.toHaveProperty('consentId');

@@ -212,8 +204,2 @@ await expect(createDocumentPromise).resolves.toHaveProperty('contentType');

describe('deleteDocuments', () => {
test('with batchId', async () => {
const batchId = createBatchId();
const deleteDocumentsPromise = client.deleteDocuments({ batchId });
await expect(deleteDocumentsPromise).resolves.toHaveProperty('documents');
});
test('with consentId', async () => {

@@ -240,3 +226,2 @@ const consentId = createConsentId();

test.each<[ListDocumentsOptions]>([
[{ batchId: createBatchId() }],
[{ consentId: createConsentId() }],

@@ -629,2 +614,8 @@ [{ datasetId: createDatasetId() }],

maxPages: 2,
postprocessConfig: {
strategy: 'BEST_N_PAGES',
parameters: {
n: 2
}
}
});

@@ -805,78 +796,2 @@ await expect(createPredictionPromise).resolves.toHaveProperty('documentId');

describe('Batches', () => {
describe('createBatch', () => {
test('valid request', async () => {
const description = 'I am going to create a new batch, give me a batch ID!';
const name = 'my batch name';
const containsPersonallyIdentifiableInformation = false;
const options = { description, name, containsPersonallyIdentifiableInformation };
const createBatchPromise = client.createBatch(options);
await expect(createBatchPromise).resolves.toHaveProperty('batchId');
await expect(createBatchPromise).resolves.toHaveProperty('containsPersonallyIdentifiableInformation');
await expect(createBatchPromise).resolves.toHaveProperty('createdTime');
await expect(createBatchPromise).resolves.toHaveProperty('description');
await expect(createBatchPromise).resolves.toHaveProperty('numDocuments');
await expect(createBatchPromise).resolves.toHaveProperty('retentionInDays');
await expect(createBatchPromise).resolves.toHaveProperty('storageLocation');
});
});
describe('updateBatch', () => {
test('valid request', async () => {
const batchId = createBatchId();
const description = 'I am going to create a new batch, give me a batch ID!';
const name = 'my batch name';
const options = { description, name };
const updateBatchPromise = client.updateBatch(batchId, options);
await expect(updateBatchPromise).resolves.toHaveProperty('batchId');
await expect(updateBatchPromise).resolves.toHaveProperty('containsPersonallyIdentifiableInformation');
await expect(updateBatchPromise).resolves.toHaveProperty('createdTime');
await expect(updateBatchPromise).resolves.toHaveProperty('description');
await expect(updateBatchPromise).resolves.toHaveProperty('numDocuments');
await expect(updateBatchPromise).resolves.toHaveProperty('retentionInDays');
await expect(updateBatchPromise).resolves.toHaveProperty('storageLocation');
});
});
describe('deleteBatch', () => {
test('valid request', async () => {
const batchId = createBatchId();
const deleteBatchPromise = client.deleteBatch(batchId);
await expect(deleteBatchPromise).resolves.toHaveProperty('batchId');
await expect(deleteBatchPromise).resolves.toHaveProperty('containsPersonallyIdentifiableInformation');
await expect(deleteBatchPromise).resolves.toHaveProperty('createdTime');
await expect(deleteBatchPromise).resolves.toHaveProperty('description');
await expect(deleteBatchPromise).resolves.toHaveProperty('numDocuments');
await expect(deleteBatchPromise).resolves.toHaveProperty('retentionInDays');
await expect(deleteBatchPromise).resolves.toHaveProperty('storageLocation');
});
test('with documents', async () => {
const batchId = createBatchId();
const deleteBatchPromise = client.deleteBatch(batchId, true);
await expect(deleteBatchPromise).resolves.toHaveProperty('batchId');
await expect(deleteBatchPromise).resolves.toHaveProperty('containsPersonallyIdentifiableInformation');
await expect(deleteBatchPromise).resolves.toHaveProperty('createdTime');
await expect(deleteBatchPromise).resolves.toHaveProperty('description');
await expect(deleteBatchPromise).resolves.toHaveProperty('numDocuments');
await expect(deleteBatchPromise).resolves.toHaveProperty('retentionInDays');
await expect(deleteBatchPromise).resolves.toHaveProperty('storageLocation');
});
});
describe('listBatches', () => {
test('valid request', async () => {
const listBatchesPromise = client.listBatches();
await expect(listBatchesPromise).resolves.toHaveProperty('batches');
});
test('accepts pagination params', async () => {
const maxResults = 1;
const nextToken = uuidv4();
const listBatchesPromise = client.listBatches({ maxResults, nextToken });
await expect(listBatchesPromise).resolves.toHaveProperty('nextToken');
});
});
});
describe('Models', () => {

@@ -883,0 +798,0 @@ describe('createModel', () => {

@@ -12,7 +12,4 @@ import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';

AxiosFn,
Batch,
BatchList,
ContentType,
CreateAppClientOptions,
CreateBatchOptions,
CreateDataBundleOptions,

@@ -38,3 +35,2 @@ CreateDatasetOptions,

ListAssetsOptions,
ListBatchesOptions,
ListDataBundleOptions,

@@ -67,3 +63,2 @@ ListDatasetsOptions,

UpdateAssetOptions,
UpdateBatchOptions,
UpdateDataBundleOptions,

@@ -175,3 +170,2 @@ UpdateDatasetOptions,

* @param options.consentId Id of the consent that marks the owner of the document
* @param options.batchId Id of the associated batch
* @param options.groundTruth List of GroundTruth items representing the ground truth values for the document

@@ -211,3 +205,2 @@ * @returns Document response from REST API

*
* @param options.batchId Ids of the batches that contains the documents of interest
* @param options.consentId Ids of the consents that marks the owner of the document

@@ -774,59 +767,2 @@ * @param options.maxResults Maximum number of results to be returned

/**
* @deprecated Use the new {@link Client.createDataset} method instead.
* Creates a batch, calls the POST /batches endpoint.
*
* @param options.name Name of the batch
* @param options.description Description of the batch
* @returns Batch response from REST API
*/
async createBatch(options: CreateBatchOptions): Promise<Batch> {
return this.makePostRequest<Batch>('/batches', options);
}
/**
* Updates an batch, calls the PATCH /batches/{batchId} endpoint.
*
* @deprecated Use the new {@link Client.updateDataset} method instead.
* @param batchId Id of the batch
* @param options.description Description of batch
* @param options.name Name of batch
* @returns Batch response from REST API with content
*/
async updateBatch(batchId: string, options: UpdateBatchOptions): Promise<Batch> {
return this.makePatchRequest(`/batches/${batchId}`, options);
}
/**
* List batches, calls the GET /batches endpoint.
*
* @deprecated Use the new {@link Client.listDatasets} method instead.
* @param options.maxResults Maximum number of results to be returned
* @param options.nextToken A unique token for each page, use the returned token to retrieve the next page.
* @returns BatchList response from REST API
*/
async listBatches(options?: ListBatchesOptions): Promise<BatchList> {
return this.makeGetRequest<BatchList>('/batches', options);
}
/**
* Deletes a batch, calls the DELETE /batches/{batchId} endpoint.
*
* @deprecated Use the new {@link Client.deleteDataset} method instead.
* @param batchId Id of the batch
* @param deleteDocuments Set to true to delete documents in batch before deleting batch
* @returns Batch response from REST API
*/
async deleteBatch(batchId: string, deleteDocuments = false): Promise<Batch> {
if (deleteDocuments) {
let response = await this.deleteDocuments({ batchId });
while (response.nextToken) {
// eslint-disable-next-line no-await-in-loop
response = await this.deleteDocuments({ batchId, nextToken: response.nextToken });
}
}
return this.makeDeleteRequest<Batch>(`/batches/${batchId}`);
}
/**
* Creates a new user, calls the POST /users endpoint.

@@ -833,0 +769,0 @@ *

@@ -15,3 +15,2 @@ /* eslint-disable @typescript-eslint/no-explicit-any */

export type LasDocument = {
batchId?: string;
consentId?: string;

@@ -33,3 +32,2 @@ content: string;

export interface CreateDocumentOptions {
batchId?: string;
consentId?: string;

@@ -47,3 +45,2 @@ datasetId?: string;

export type DeleteDocumentOptions = PaginationOptions & {
batchId?: string | Array<string>;
consentId?: string | Array<string>;

@@ -54,3 +51,2 @@ datasetId?: string | Array<string>;

export type ListDocumentsOptions = PaginationOptions & {
batchId?: string | Array<string>;
consentId?: string | Array<string>;

@@ -62,6 +58,19 @@ datasetId?: string | Array<string>;

documents: Array<LasDocumentWithoutContent>;
batchId?: string;
nextToken: string | null;
};
export type BestFirst = {
strategy: 'BEST_FIRST';
}
export type BestNPages = {
strategy: 'BEST_N_PAGES';
parameters: {
n: 1 | 2 | 3;
collapse?: boolean;
}
}
export type PostprocessConfig = BestFirst | BestNPages;
export interface CreatePredictionsOptions {

@@ -71,2 +80,3 @@ maxPages?: number;

imageQuality?: 'LOW' | 'HIGH';
postprocessConfig?: PostprocessConfig;
}

@@ -271,31 +281,2 @@

export type Batch = {
batchId: string;
containsPersonallyIdentifiableInformation: boolean;
createdTime: string;
description: string;
name: string;
numDocuments: number;
retentionInDays: number;
storageLocation: 'EU';
};
export type CreateBatchOptions = {
name?: string;
description?: string;
containsPersonallyIdentifiableInformation?: boolean;
}
export type UpdateBatchOptions = {
description?: string;
name?: string;
}
export type BatchList = {
batches: Array<Batch>;
nextToken: string | null;
};
export type ListBatchesOptions = PaginationOptions;
export type Dataset = {

@@ -443,4 +424,2 @@ containsPersonallyIdentifiableInformation: boolean;

numberOfAssetsCreated: number;
numberOfBatchesAllowed: number;
numberOfBatchesCreated: number;
numberOfDatasetsAllowed: number;

@@ -447,0 +426,0 @@ numberOfDatasetsCreated: number;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc