| name | maintainx-data-handling |
| description | Data synchronization, ETL patterns, and data management for MaintainX.
Use when syncing data between MaintainX and other systems,
building ETL pipelines, or managing data consistency.
Trigger with phrases like "maintainx data sync", "maintainx etl",
"maintainx export", "maintainx data migration", "maintainx data pipeline".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*) |
| version | 1.11.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","maintainx","migration","data-pipeline","etl"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
MaintainX Data Handling
Overview
Patterns for synchronizing, transforming, and exporting data between MaintainX and external systems (databases, data warehouses, ERPs).
Prerequisites
- MaintainX API access configured
- Node.js 18+ with
axios
- Target database or data warehouse available
Instructions
Step 1: Incremental Sync with Cursor Pagination
import { MaintainXClient } from './client';
import { writeFileSync, existsSync, readFileSync } from 'fs';
const SYNC_STATE_FILE = '.maintainx-sync-state.json';
interface SyncState {
lastSyncAt: string;
workOrderCursor?: string;
assetCursor?: string;
}
function loadSyncState(): SyncState {
if (existsSync(SYNC_STATE_FILE)) {
return JSON.parse(readFileSync(SYNC_STATE_FILE, 'utf-8'));
}
return { lastSyncAt: new Date(0).toISOString() };
}
function saveSyncState(state: SyncState) {
(, .(state, , ));
}
() {
state = ();
syncStart = ().();
.();
: | ;
totalWOs = ;
{
response = client.({
: state.,
: ,
cursor,
});
( wo response.) {
(wo);
totalWOs++;
}
cursor = response. ?? ;
} (cursor);
: | ;
totalAssets = ;
{
response = client.({
: state.,
: ,
: assetCursor,
});
( asset response.) {
(asset);
totalAssets++;
}
assetCursor = response. ?? ;
} (assetCursor);
({ : syncStart });
.();
}