2.1.0 • Published 11 months ago

@pantomath/sdk-javascript v2.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Pantomath Javascript SDK

Send custom, realtime logs to Pantomath through the Pantomath Javascript SDK

💻 Installation and Setup

  1. Install the Pantomath Javacript SDK:
npm i @pantomath/sdk-javascript
  1. Add configuration ENVs to your runtime:
PANTOMATH_API_BASE_URL = ******,
PANTOMATH_API_KEY = ******

Example

import { PantomathSDK, SqlProcedure, SqlTable } from '@pantomath/sdk-javascript';

export async function main() {
  const sqlProcedure = SqlProcedure.create({
    host: 'localhost',
    port: 5432,
    database: 'postgres',
    schema: 'foo',
    name: 'bar',
  });

  const sourceDataset = SqlTable.create({
    host: 'localhost',
    port: 5432,
    database: 'postgres',
    schema: 'foo',
    name: 'source_table',
  });

  const targetDataset = SqlTable.create({
    host: 'localhost',
    port: 5432,
    database: 'postgres',
    schema: 'foo',
    name: 'target_table',
  });

  const pantomathSDK = PantomathSDK.instance({
    apiKey: '****',
  });

  const jobRun = pantomathSDK.newJobRun<SqlProcedure>({
    job: sqlProcedure,
    sourceDataSets: [sourceDataset],
    targetDataSets: [targetDataset],
  });

  await jobRun.logStart({ message: 'Starting procedure foo' });
  for (let i = 0; i < 5; i++) {
    jobRun.logProgress({ message: `Completed step ${i + 1}`, recordsEffected: i * 100 });
    await new Promise((resolve) => setTimeout(resolve, 2000));
  }
  await jobRun.logSuccess({ message: 'Succeeded!' });
}

main();
2.1.0

11 months ago

1.1.0

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago