@dotbep/core 0.2.14 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +24 -18
- package/dist/index.js +276 -293
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -219,6 +219,11 @@ export declare const BEPSchema: z.ZodObject<{
|
|
|
219
219
|
description: z.ZodOptional<z.ZodString>;
|
|
220
220
|
image: z.ZodOptional<z.ZodString>;
|
|
221
221
|
websiteUrl: z.ZodOptional<z.ZodURL>;
|
|
222
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
223
|
+
address: z.ZodOptional<z.ZodString>;
|
|
224
|
+
coordinates: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
225
|
+
}, z.core.$strip>>;
|
|
226
|
+
customData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
222
227
|
}, z.core.$strip>;
|
|
223
228
|
deliverableNamingConvention: z.ZodOptional<z.ZodObject<{
|
|
224
229
|
delimiter: z.ZodString;
|
|
@@ -614,6 +619,7 @@ export declare interface BepTypes {
|
|
|
614
619
|
eventId: string;
|
|
615
620
|
} & Record<string, unknown>>;
|
|
616
621
|
resolvers: Record<string, (url: string, ...args: any[]) => unknown>;
|
|
622
|
+
triggers: Record<string, (rawPayload: unknown) => Promise<WorkflowInstance['trackedAsset']>>;
|
|
617
623
|
env: Record<string, string>;
|
|
618
624
|
}
|
|
619
625
|
|
|
@@ -884,7 +890,9 @@ export declare class Engine {
|
|
|
884
890
|
get runtime(): Runtime<any>;
|
|
885
891
|
/** Namespaced workflow instance operations. */
|
|
886
892
|
readonly workflows: {
|
|
887
|
-
create(workflowId: string, trackedAsset: WorkflowInstance['trackedAsset']
|
|
893
|
+
create(workflowId: string, trackedAsset: WorkflowInstance['trackedAsset'] | {
|
|
894
|
+
rawPayload: unknown;
|
|
895
|
+
}, initiatedBy: string): Promise<WorkflowInstance | null>;
|
|
888
896
|
emit(instanceId: string, event: IncomingEvent): Promise<EventResult>;
|
|
889
897
|
get(instanceId: string): Promise<WorkflowInstance | null>;
|
|
890
898
|
list(filter?: InstanceFilter): Promise<WorkflowInstance[]>;
|
|
@@ -1287,21 +1295,6 @@ export declare const FlowDiagramSchema: z.ZodObject<{
|
|
|
1287
1295
|
}, z.core.$strip>]>>;
|
|
1288
1296
|
}, z.core.$strip>;
|
|
1289
1297
|
|
|
1290
|
-
/**
|
|
1291
|
-
* Converts a resolved FlowDiagram to a Mermaid flowchart string.
|
|
1292
|
-
* Node IDs are prefixed with `_` to avoid conflicts with Mermaid reserved words
|
|
1293
|
-
* (e.g. "end", "start"). Quotes in labels are escaped to `#quot;`.
|
|
1294
|
-
*
|
|
1295
|
-
* Node order: start always first, end always last. If topologicalSort is enabled,
|
|
1296
|
-
* intermediate nodes are ordered via BFS from start for better Dagre layout.
|
|
1297
|
-
*/
|
|
1298
|
-
export declare function flowDiagramToMermaid(diagram: FlowDiagramResolved, raciKey?: RaciKey, options?: FlowDiagramToMermaidOptions): string;
|
|
1299
|
-
|
|
1300
|
-
declare interface FlowDiagramToMermaidOptions {
|
|
1301
|
-
raciKey?: RaciKey;
|
|
1302
|
-
topologicalSort?: boolean;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
1298
|
export declare type FlowDirectEdge = z.infer<typeof FlowDirectEdgeSchema>;
|
|
1306
1299
|
|
|
1307
1300
|
export declare const FlowDirectEdgeSchema: z.ZodObject<{
|
|
@@ -2113,6 +2106,11 @@ export declare const ProjectSchema: z.ZodObject<{
|
|
|
2113
2106
|
description: z.ZodOptional<z.ZodString>;
|
|
2114
2107
|
image: z.ZodOptional<z.ZodString>;
|
|
2115
2108
|
websiteUrl: z.ZodOptional<z.ZodURL>;
|
|
2109
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
2110
|
+
address: z.ZodOptional<z.ZodString>;
|
|
2111
|
+
coordinates: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
|
|
2112
|
+
}, z.core.$strip>>;
|
|
2113
|
+
customData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2116
2114
|
}, z.core.$strip>;
|
|
2117
2115
|
|
|
2118
2116
|
export declare type RaciAssignment = {
|
|
@@ -2128,8 +2126,6 @@ export declare type RaciEntry = {
|
|
|
2128
2126
|
members: Member[];
|
|
2129
2127
|
};
|
|
2130
2128
|
|
|
2131
|
-
export declare type RaciKey = 'responsible' | 'accountable' | 'consulted' | 'informed';
|
|
2132
|
-
|
|
2133
2129
|
/**
|
|
2134
2130
|
* Resolved RACI assignment for one letter (R/A/C/I) at a node.
|
|
2135
2131
|
* Three levels of specificity: emails > teams+roles > roles.
|
|
@@ -2234,12 +2230,14 @@ export declare class Runtime<T extends {
|
|
|
2234
2230
|
effects: Record<string, any>;
|
|
2235
2231
|
automations: Record<string, any>;
|
|
2236
2232
|
resolvers: Record<string, any>;
|
|
2233
|
+
triggers: Record<string, any>;
|
|
2237
2234
|
env: Record<string, any>;
|
|
2238
2235
|
} = BepTypes> {
|
|
2239
2236
|
env: T['env'];
|
|
2240
2237
|
readonly effects: Record<string, EffectHandler>;
|
|
2241
2238
|
readonly automations: Record<string, AutomationHandler>;
|
|
2242
2239
|
readonly resolvers: Record<string, ResolverHandler>;
|
|
2240
|
+
readonly triggers: Record<string, TriggerHandler>;
|
|
2243
2241
|
/** Set by Engine.init() — available inside handlers via this.engine */
|
|
2244
2242
|
_engine: EngineRef | null;
|
|
2245
2243
|
get engine(): EngineRef;
|
|
@@ -2247,6 +2245,7 @@ export declare class Runtime<T extends {
|
|
|
2247
2245
|
protected effect<K extends keyof T['effects'] & string>(key: K, handler: (instance: WorkflowInstance, ...args: Parameters<T['effects'][K]>) => Promise<void>): this;
|
|
2248
2246
|
protected automation<K extends keyof T['automations'] & string>(key: K, handler: (instance: WorkflowInstance, ...args: Parameters<T['automations'][K]>) => Promise<ReturnType<T['automations'][K]>>): this;
|
|
2249
2247
|
protected resolver<K extends keyof T['resolvers'] & string>(key: K, handler: (...args: Parameters<T['resolvers'][K]>) => Promise<ReturnType<T['resolvers'][K]>>): this;
|
|
2248
|
+
protected trigger<K extends keyof T['triggers'] & string>(key: K, handler: (rawPayload: unknown) => Promise<WorkflowInstance['trackedAsset']>): this;
|
|
2250
2249
|
/* Excluded from this release type: _runResolver */
|
|
2251
2250
|
}
|
|
2252
2251
|
|
|
@@ -2462,6 +2461,13 @@ export declare interface TransitionStep {
|
|
|
2462
2461
|
toNodeId: string;
|
|
2463
2462
|
}
|
|
2464
2463
|
|
|
2464
|
+
/**
|
|
2465
|
+
* Handler registered for a specific workflow trigger (keyed by Workflow.id).
|
|
2466
|
+
* Receives a raw payload from an external system and returns the trackedAsset
|
|
2467
|
+
* that the engine will use to create the workflow instance.
|
|
2468
|
+
*/
|
|
2469
|
+
export declare type TriggerHandler = (rawPayload: unknown) => Promise<WorkflowInstance['trackedAsset']>;
|
|
2470
|
+
|
|
2465
2471
|
/**
|
|
2466
2472
|
* Validates all token-bearing entity IDs in a BEP against a naming convention.
|
|
2467
2473
|
* Used when setting a new convention to ensure all existing data is compatible.
|