Skip to main content

@getriebe/bpmn

Import BPMN into Getriebe’s workflow model and inspect import diagnostics.

Source revision 49560371f6cd34d30383df5619df46969c594ae4.

export declare const BPMN_NAMESPACE = "http://www.omg.org/spec/BPMN/20100524/MODEL";
export interface BpmnActivityLoop {
readonly testBefore: boolean;
readonly maximum?: number;
readonly condition: BpmnExpression;
}
export interface BpmnBoundaryError {
readonly id: string;
readonly kind: "boundaryError";
readonly attachedTo: string;
readonly errorCode: string;
}
export interface BpmnBoundaryTimer {
readonly id: string;
readonly kind: "boundaryTimer";
readonly attachedTo: string;
readonly interrupting?: false;
readonly duration: BpmnExpression;
readonly durationMs: number;
}
export interface BpmnCallActivity {
readonly id: string;
readonly kind: "callActivity";
readonly target: BpmnProcessReference;
readonly importLocation: string;
readonly inputs: readonly BpmnDataInput[];
readonly outputs: readonly BpmnDataOutput[];
}
export type BpmnCapability = "sequence" | "message-start" | "correlated-messages" | "message-or-timer" | "embedded-subprocess" | "call-activity" | "bpmn-error" | "xor" | "and" | "graph-loop" | "activity-loop" | "user-task" | "boundary-timer" | "non-interrupting-boundary-timer" | "intermediate-timer" | "subprocess-boundary-timer" | "terminate-end" | "parallel-multi-instance" | "sequential-multi-instance" | "multi-instance-fixed-role" | "multi-instance-completion-condition" | "personal-assignment" | "service-task" | "service-operation" | "http-service-fault" | "business-rule-task" | "script-task-expression" | "script-task-javascript" | "typed-data" | "expressions";
export interface BpmnConnectorBinding {
readonly httpFaultRules?: readonly BpmnHttpFaultRule[];
readonly id: string;
readonly version: string;
readonly connection: string;
readonly configuration: Readonly<Record<string, string>>;
}
export interface BpmnDataInput {
readonly name: string;
readonly kind: ValueKind;
readonly source: string;
}
export interface BpmnDataOutput {
readonly name: string;
readonly kind: ValueKind;
readonly target: string;
}
export interface BpmnDecisionTable {
readonly id: string;
readonly xml: string;
readonly rules: readonly DecisionRule[];
}
export interface BpmnDiagnostic {
readonly severity: "error";
readonly code: string;
readonly message: string;
readonly elementId?: string;
readonly scopeId?: string;
readonly line?: number;
readonly column?: number;
}
export interface BpmnErrorEnd {
readonly id: string;
readonly kind: "errorEnd";
readonly errorCode: string;
}
export interface BpmnExpression {
readonly source: string;
readonly language: string;
}
export interface BpmnFlow {
readonly id: string;
readonly source: string;
readonly target: string;
readonly condition?: BpmnExpression;
}
export interface BpmnHttpFaultRule {
readonly status: number;
readonly field: string;
readonly equals: string;
readonly errorCode: string;
}
export interface BpmnImportOptions {
readonly schemaFiles?: Readonly<Record<string, string>>;
readonly scriptEvaluators?: readonly ScriptEvaluator[];
readonly availableCapabilities?: ReadonlySet<BpmnCapability>;
}
export type BpmnImportResult = {
readonly status: "valid";
readonly model: BpmnModel;
readonly diagnostics: readonly [];
} | {
readonly status: "invalid";
readonly diagnostics: readonly BpmnDiagnostic[];
};
export interface BpmnIntermediateTimer {
readonly id: string;
readonly kind: "intermediateTimer";
readonly duration: BpmnExpression;
readonly durationMs: number;
}
export interface BpmnMessageCatch {
readonly id: string;
readonly kind: "messageCatch";
readonly message: MessageContract;
readonly bindings: readonly MessageBinding[];
}
export interface BpmnMessageExchange {
readonly keyId: string;
readonly sendTaskId: string;
readonly catchEventId: string;
readonly outgoingField: string;
readonly incomingField: string;
}
export interface BpmnMessageStart {
readonly id: string;
readonly kind: "messageStart";
readonly message: MessageContract;
readonly bindings: readonly MessageBinding[];
}
export interface BpmnModel extends BpmnScope {
readonly targetNamespace: string;
readonly processId: string;
readonly processInterface?: BpmnProcessInterface;
readonly originalXml: string;
readonly schemaFiles?: Readonly<Record<string, string>>;
readonly messages?: readonly MessageContract[];
readonly messageExchanges?: readonly BpmnMessageExchange[];
readonly hasDiagram: boolean;
readonly resources: readonly {
readonly id: string;
readonly name?: string;
}[];
readonly requiredCapabilities: readonly BpmnCapability[];
}
export type BpmnMultiInstance = {
readonly inputCollection: BpmnDataInput;
readonly outputCollection: BpmnDataOutput;
readonly inputItem: string;
readonly outputItem: string;
readonly completionCondition?: BpmnExpression;
readonly sequential?: true;
} & ({
readonly resourceId: string;
readonly roleByItem?: never;
} | {
readonly resourceId?: never;
readonly roleByItem: Readonly<Record<string, string>>;
});

Display labels from the source associated with an already imported model.

export declare function bpmnNames(model: BpmnModel): ReadonlyMap<string, string>;
export type BpmnNode = BpmnCallActivity | BpmnMessageStart | BpmnSendTask | BpmnMessageCatch | BpmnErrorEnd | BpmnBoundaryError | BpmnBoundaryTimer | BpmnIntermediateTimer | {
readonly id: string;
readonly kind: "terminateEnd";
} | {
readonly id: string;
readonly kind: "subProcess";
readonly scope: BpmnScope;
} | {
readonly id: string;
readonly kind: "start" | "end" | "and";
} | {
readonly id: string;
readonly kind: "eventBasedGateway";
} | {
readonly id: string;
readonly kind: "xor";
readonly defaultFlowId?: string;
} | (BpmnTask & {
readonly kind: "userTask";
readonly resourceId?: string;
readonly recipientField?: string;
readonly multiInstance?: BpmnMultiInstance;
}) | (BpmnTask & {
readonly kind: "serviceTask";
readonly operation?: BpmnOperation;
} & ({
readonly handler: string;
readonly connector?: never;
} | {
readonly connector: BpmnConnectorBinding;
readonly handler?: never;
})) | {
readonly kind: "businessRuleTask";
readonly id: string;
readonly inputs: readonly [BpmnDataInput];
readonly outputs: readonly [BpmnDataOutput];
readonly decision: BpmnDecisionTable;
} | {
readonly kind: "scriptTask";
readonly id: string;
readonly inputs: readonly BpmnDataInput[];
readonly outputs: readonly [BpmnDataOutput];
readonly scriptFormat: string;
readonly script: string;
};
export declare function bpmnNodes(scope: BpmnScope): Generator<BpmnNode, void, undefined>;
export interface BpmnOperation {
readonly id: string;
readonly interfaceId: string;
readonly input: MessageContract;
readonly output?: MessageContract;
readonly errorCodes: readonly string[];
}
export interface BpmnProcessInterface {
readonly inputs: readonly BpmnProcessPort[];
readonly outputs: readonly BpmnProcessPort[];
}
export interface BpmnProcessPort {
readonly id: string;
readonly name: string;
readonly kind: ValueKind;
}
export interface BpmnProcessReference {
readonly targetNamespace: string;
readonly processId: string;
}
export interface BpmnScope {
readonly nodes: readonly BpmnNode[];
readonly flows: readonly BpmnFlow[];
readonly fields: Readonly<Record<string, ValueKind>>;
}
export interface BpmnSendTask {
readonly id: string;
readonly kind: "sendTask";
readonly message: MessageContract;
readonly inputs: readonly BpmnDataInput[];
}
export declare function checkDecisionInterchange(nodes: Iterable<BpmnNode>): Promise<readonly BpmnDiagnostic[]>;
export declare const EXTENSION_NAMESPACE = "https://tokenjanitor.github.io/getriebe/bpmn/extensions/v1";
export declare function findBpmnNode(scope: BpmnScope, id: string): BpmnNode | undefined;
export declare function importBpmn(xml: string, options?: BpmnImportOptions): BpmnImportResult;
export declare function nodeUsesCapability(node: BpmnNode, capability: BpmnCapability): boolean;

The part of a process that can execute through its None Start Event.

export declare function noneStartScope(scope: BpmnScope): BpmnScope;
export declare function scriptTaskCapability(format: string): "script-task-expression" | "script-task-javascript" | undefined;