@eang/core
Version:
eang - model driven enterprise event processing
50 lines • 1.51 kB
JavaScript
export class FunctionStartContext {
rootObjectId;
entities;
data;
inIds;
outIds;
functionInputMapping;
inEventInstances;
constructor(contextOpts) {
Object.assign(this, contextOpts);
if (contextOpts.rootObjectId !== undefined) {
this.rootObjectId = contextOpts.rootObjectId;
}
this.data = contextOpts.data || {};
this.entities = contextOpts.entities || [];
this.inEventInstances = this.entities.filter((obj) => this.inIds?.includes(obj.id) && obj.typeOf === 'Event_Instance');
}
/**
* Gets the root object that owns this context
* @returns The root object or undefined if not found
*/
getRootObject() {
return this.entities?.find((obj) => obj.id === this.rootObjectId);
}
}
export class FunctionStopContext {
data;
err;
entityEvents;
events;
errEvents;
constructor(contextOpts) {
if (contextOpts.data !== undefined) {
this.data = contextOpts.data;
}
if (contextOpts.err !== undefined) {
this.err = contextOpts.err;
}
if (contextOpts.entityEvents !== undefined) {
this.entityEvents = contextOpts.entityEvents;
}
if (contextOpts.events !== undefined) {
this.events = contextOpts.events;
}
if (contextOpts.errEvents !== undefined) {
this.errEvents = contextOpts.errEvents;
}
}
}
//# sourceMappingURL=context.js.map