Documentation / @etherfold/core / instantiateProcessor
Function: instantiateProcessor() ​
instantiateProcessor<
ABI,ProcessResultType,EntityProcessorType>(processorModule,options):EntityProcessorType
Defined in: packages/core/src/processorArtifact.ts:220
Resolve the createProcessor factory from the module and hand back what it made: the AUTHORING object, declarations plus handlers.
- if
createProcessoris a function, call it (withprocessorConfigif provided, else no args). - if
createProcessoris already a processor object, use it as-is.
Throws when no factory is found, when the factory produced nothing, and when the module still carries the retired KIND TAG (below).
What comes back is the authoring object and NOT an EventProcessor, because WHERE the state lives is the deployment's choice: a module that picked a store would have picked for every host that loads it. The host builds the runtime (new EntityEventProcessor(store, processor)) around what this returns. It is typed by the CALLER, through EntityProcessorType, so a host that owns an entity runtime gets its own type at the wiring site while this package keeps naming none of them; it defaults to unknown, the honest type for a caller that has not said.
It lives in core, beside the identity, because it is the ONE answer to "what is a processor module" for every runtime that turns a module into a fold: the Node loaders in @etherfold/utils and the browser's bundle arrival both ask it.
Type Parameters ​
ABI ​
ABI extends Abi
ProcessResultType ​
ProcessResultType
EntityProcessorType ​
EntityProcessorType = unknown
Parameters ​
processorModule ​
ProcessorModule<ABI, ProcessResultType>
options ​
Returns ​
EntityProcessorType