Registry / devops / api-resource-migrator

api-resource-migrator

JSON →
library1.0.4jsnpmunverified

A library for migrating API resources from one endpoint to another. Current version 1.0.4, released in 2018 and not frequently updated. It allows defining source and target URLs with custom headers, and copying specified resource IDs (via array or range). Key differentiator: simple configuration for batch migration with optional transform functions and parallelism control. Uses the `fetch` library under the hood. No TypeScript support.

npm install api-resource-migrator
INSTALL
IMPORT
SIG · API-RESOURCE-MIGRA
A
api-resource-migrator
devopsjavascriptv1.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const migrator = require('api-resource-migrator')();
import migrator from 'api-resource-migrator';
Module uses CommonJS, no ES module exports. Must call the default export as a function.
migrator.add()
migrator.add(migration);
migrator.add(migration).run();
add() returns void; run() is separate.
migrator.run()
migrator.run(5);
migrator.run() without waiting for promise
Returns a Promise; use await or .then() to know when all migrations finish.

Shows basic usage: create migrator, define source/target, add migration, and run.

const migrator = require('api-resource-migrator')(); const migration = { source: { url: 'https://api.source.com/resource/', headers: { 'content-type': 'application/json' } }, target: { url: 'https://api.target.com/resource/', headers: { 'content-type': 'application/json' } }, ids: ['id1', 'id2', 'id3'] }; migrator.add(migration); migrator.run() .then(() => console.log('Done')) .catch(err => console.error(err));
Debug
Known issues
gotchaCommonJS only: cannot import in ES modules.
fix
Use dynamic import() or convert project to CommonJS.
affects: >=1.0.0
gotchaParallelism limit defaults to 1 if not specified; may be slow for many IDs.
fix
Pass a higher number to run(), but beware of rate limits.
affects: >=1.0.0
gotchaNo built-in retry or error handling per resource; one failure may stop the whole batch.
fix
Wrap run() in try/catch or implement custom retry logic.
affects: >=1.0.0
deprecatedPackage hasn't been updated since 2018; dependencies may have vulnerabilities.
fix
Consider alternatives or pin fetch version and audit.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: migrator is not a function
Importing without calling the default export as a function.
fix
Use const migrator = require('api-resource-migrator')();
Cannot find module 'fetch'
The fetch package is a peer dependency or missing from node_modules.
fix
Run npm install fetch
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
fetchrequiredUnderlying HTTP client for making requests to source and target APIs.
Agent activity
13 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources
api-resource-migrator — npm install api-resource-migrator · libregistry