@lume-ai/typescript-sdk
TypeScript icon, indicating that this package has built-in type declarations

3.9.0 • Public • Published

📚 Documentation   •   🖥️ Application   •   🏠 Home

Status

The Lume Typescript SDK is currently in beta. Please reach out to support if you have any questions, encounter any bugs, or have any feature requests.

Installation

npm install @lume-ai/typescript-sdk
yarn add @lume-ai/typescript-sdk
pnpm add @lume-ai/typescript-sdk

Quickstart

Retrieve your input data and target schema.

const targetSchema = {
    type: "object",
    properties: {
        f_name: {
            type: "string",
            description: "The first name of the user",
        },
        l_name: {
            type: "string",
            description: "The last name of the user",
        },
    },
    required: ["f_name", "l_name"],
}

const sourceData = [
    { first_name: "John", last_name: "Doe" },
    { first_name: "Jane", last_name: "Smith" }
]

Create a new pipeline and map data.

import { Lume, Mapping, Pipeline } from '@lume-ai/typescript-sdk';

const lume: Lume = new Lume('api_key')

const createPipeline = async () => {
    const createdPipeline = await lume.pipelineService.createPipeline(
        {
            name: 'sourceX_to_destinationY',
            description: "my_description",
            target_schema: targetSchema
        }
    );
    return createdPipeline;
}


export async function run() {

    // create pipeline and execute job
    const pipeline: Pipeline = await createPipeline(lume);
    const { result, jobId } = await lume.jobsService.createAndRunJob(pipeline.id, sourceData)

    // parse the results and iterate through all mapped records. Note this method is paginated.
    const mappingsPage = await lume.resultsService.getMappingsForResult(result.id, 1, 50);
    const mappings: Mapping[] = mappingsPage.items;

    // use the mappings to access the mapped records
}

run()

Documentation

See the full documentation.

Issues / Questions

Please reach out to support if you encounter any bugs, have any questions, or have any feature requests.

Package Sidebar

Install

npm i @lume-ai/typescript-sdk

Homepage

www.lume.ai/

Weekly Downloads

84

Version

3.9.0

License

MIT

Unpacked Size

291 kB

Total Files

9

Last publish

Collaborators

  • guilherme-lume
  • nmachado1