Skip to content

@memberjunction/record-set-processor-base

Client-safe foundation for the MemberJunction Record Set Processing substrate: the shared types, the three pluggable seams, and the built-in source adapters. The server engine that drives these lives in @memberjunction/record-set-processor.

ExportKindPurpose
IRecordSetSourceseamyields the record set in cursor-paginated batches
IRecordProcessorseamdoes the work for a single record
IProcessRunTrackerseampersists run lifecycle, per-record detail, checkpoints, pause/cancel
RecordSetProcessOptionstypethe engine’s per-run options
RecordRef, RecordBatch, ProcessCursor, RecordResult, ProcessRunResult, …typesthe data shapes shared across the seams
ArraySource, ViewSource, ListSource, FilterSource, KeysetSourcesourcesthe built-in record-set sources

A processing job is a composition of three independent choices:

  • Sourcewhat records to iterate (a User View, a List, an ad-hoc filter, an in-memory array, or a keyset sweep). Sources paginate themselves and hand back an opaque ProcessCursor the engine round-trips for resume.
  • Processorwhat to do with each record (an Action, an Agent, an Infer-&-Write-Back step, or a function), returning a RecordResult (Succeeded / Failed / Skipped).
  • Trackerwhere to persist run + per-record audit. The default writes the generic MJ: Process Runs / MJ: Process Run Details tables; domain consumers can supply their own.
SourcePaginationNotes
ArraySourceoffset (in-memory)a fixed list of RecordRef; also use for SingleRecord scopes
ViewSourceoffsetresolves a saved User View; views may carry arbitrary order/filter so offset is used
ListSourceoffsetiterates a List’s members via MJ: List Details
FilterSourcekeyset → offsetentity + ad-hoc WHERE; keyset when the entity has a single orderable PK
KeysetSourcekeyset (required)like FilterSource but asserts keyset eligibility — for large background sweeps
import { IRecordSetSource, RecordBatch, ProcessCursor, SourceDescriptor } from '@memberjunction/record-set-processor-base';
export class MySource implements IRecordSetSource {
Describe(): SourceDescriptor { return { SourceType: 'Filter', SourceFilter: '...' }; }
async NextBatch(cursor: ProcessCursor | undefined, batchSize: number, contextUser, provider): Promise<RecordBatch> {
// fetch up to `batchSize` records after `cursor`, return them plus the next cursor + exhausted flag
}
}

This package carries no server-only dependencies and is safe to import on the client.