Creates a new ManifestStorage instance
Redis cache instance
Time-to-live in seconds (default: 86400 = 24 hours)
Optional logger for dependency injection (defaults to console)
Retrieves a manifest from Redis
Manifest ID to retrieve
Manifest if found, null if not found/expired/error
const manifest = await storage.getManifest('bulk-12345678-...');
if (manifest) {
console.log(`Found ${manifest.succeeded.length} succeeded`);
}
Stores a manifest in Redis
Key pattern: bulk:manifest:{manifestId}
Gracefully degrades if Redis is unavailable (logs warning, doesn't throw).
Bulk manifest to store
await storage.storeManifest({
id: 'bulk-12345678-...',
timestamp: Date.now(),
total: 10,
succeeded: [0, 1, 2],
failed: [3],
created: { '0': 'PROJ-123' },
errors: { '3': { status: 400, errors: { field: 'error' } } }
});
Updates an existing manifest with retry results
Merges new results with existing manifest:
Manifest ID to update
Retry results to merge
// After retry, update manifest with new results
await storage.updateManifest('bulk-12345678-...', {
succeeded: [3], // Previously failed, now succeeded
failed: [4], // Still failed
created: { '3': 'PROJ-124' },
errors: { '4': { status: 400, errors: { field: 'error' } } }
});
Manages bulk operation manifest storage in Redis
Example