📚 Documentation • 🖥️ Application • 🏠 Home
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.
npm install @lume-ai/typescript-sdk
yarn add @lume-ai/typescript-sdk
pnpm add @lume-ai/typescript-sdk
Create a new pipeline and map data.
import { Lume, PipelineCreatePayload, JobCreatePayload, Job, Pipeline, Result, Mapping } from '@lume-ai/typescript-sdk';
const lume: Lume = new Lume('api_key')
const createPipeline = async () => {
const pipelineCreatePayload: PipelineCreatePayload = {
name: 'pipeline_name3',
description: "description",
target_schema: {
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 createdPipeline = await lume.pipelineService.createPipeline(
pipelineDetails
);
return createdPipeline;
}
const createJob = async (pipelineId: string) => {
const jobCreatePayload: JobCreatePayload = {
data: [
{
first_name: "John",
last_name: "Doe",
},
{
first_name: "Jane",
last_name: "Doe",
},
],
};
const createdJob = await lume.jobsService.createJobForPipeline(
pipelineId,
params
);
return createdJob;
}
const run = async () => {
// create pipeline and job
const pipeline: Pipeline = await createPipeline();
const job: Job = await createJob(pipeline.id);
// trigger the mapping generation
const result: Result = await lume.jobsService.runJob(job.id);
// parse the results and iterate through all mapped records
const mappingsPage = await lume.resultsService.getMappingsForResult(result.id);
const mappings: Mapping[] = mappingsPage.items;
for (const mapping of mappings) {
console.log("mapped record", mapping.mapped_record)
}
}
run();
Please reach out to support if you encounter any bugs, have any questions, or have any feature requests.