migrating-nango-deletion-detection
SKILL.md
Migrating Nango Deletion Detection
Do this
- Find legacy usage:
deleteRecordsFromPreviousExecutions(trackDeletes:/track_deletes
- For each sync + model that needs automatic deletion detection:
- Add
await nango.trackDeletesStart('ModelName')at the start ofexec(before fetching/saving). - Replace
await nango.deleteRecordsFromPreviousExecutions('ModelName')withawait nango.trackDeletesEnd('ModelName'). - Keep
trackDeletesEndafter allbatchSave/batchUpdate/batchDeletecalls.
- Add
- Safety:
- Only call
trackDeletesEndif the full dataset was fetched + saved betweentrackDeletesStartandtrackDeletesEnd(otherwise you can cause false deletions). - Prefer letting exceptions bubble. If you
catch, re-throw when data is incomplete.
- Only call
Checkpointed full refresh (multi-execution)
- Call
trackDeletesStart('ModelName')at the beginning of each execution in the refresh window (it is safe/idempotent while the window is open). - Call
trackDeletesEnd('ModelName')only in the execution that finishes saving the full dataset.
Tests
- Re-record mocks after code changes:
nango dryrun <sync-name> <connection-id> --validate -e dev --no-interactive --auto-confirmnango dryrun <sync-name> <connection-id> --save -e dev --no-interactive --auto-confirmnango generate:tests && npm test
- Never hand-edit
*.test.json.
Before/after
// Before
for await (const page of nango.paginate(cfg)) {
await nango.batchSave(page, 'Ticket');
}
await nango.deleteRecordsFromPreviousExecutions('Ticket');
// After
await nango.trackDeletesStart('Ticket');
for await (const page of nango.paginate(cfg)) {
await nango.batchSave(page, 'Ticket');
}
await nango.trackDeletesEnd('Ticket');
Weekly Installs
28
Repository
nangohq/skillsFirst Seen
11 days ago
Security Audits
Installed on
opencode28
gemini-cli27
github-copilot27
amp27
cline27
codex27