Guide
Sync related application data
Create or recover one stable custom dataset. Replace current source state when rows can change or disappear; append only for additive sources.
Workflow
- 1Get or create by stable key
- 2Replace current state or append new rows
- 3Keep stable table identities
- 4Resolve the dataset by key later
Complete example
import { CONTEXT, PermuteClient } from '@permute/sdk';
const orgClient = new PermuteClient({
apiKey: process.env.PERMUTE_API_KEY!,
});
const client = orgClient.withWorkspace(process.env.PERMUTE_WORKSPACE_ID!);
const dataset = await client.datasets.create({
type: 'custom',
key: 'quickbooks',
name: 'QuickBooks',
context: [CONTEXT.QuickBooks],
});
await dataset.replace({
orders: [{ id: 1, customerId: 10, amount: 100 }],
customers: [{ id: 10, name: 'Acme' }],
});
// The SDK uploads chunked NDJSON to S3 and waits for processing.
// OR: replace one complete named table without changing the others.
await dataset.replaceTable('payments', [{ id: 500, orderId: 1, amount: 100 }]);
// OR: append only for an additive table. Reuse batchId when retrying this batch.
await dataset.appendTable('events', [{ id: 'evt_501', type: 'payment.created', orderId: 2 }], {
batchId: 'events-2026-07-15-2',
});
const sameDataset = await client.datasets.getByKey('quickbooks');
console.log(sameDataset.id, sameDataset.data.tables);