@dotbep/core 0.2.16 → 0.2.17

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 CHANGED
@@ -619,7 +619,10 @@ export declare interface BepTypes {
619
619
  eventId: string;
620
620
  } & Record<string, unknown>>;
621
621
  resolvers: Record<string, (url: string, ...args: any[]) => unknown>;
622
- triggers: Record<string, (rawPayload: unknown) => Promise<WorkflowInstance['trackedAsset']>>;
622
+ triggers: Record<string, (rawPayload: unknown) => Promise<{
623
+ trackedAsset: WorkflowInstance['trackedAsset'];
624
+ workflowId: string;
625
+ }>>;
623
626
  env: Record<string, string>;
624
627
  }
625
628
 
@@ -890,7 +893,7 @@ export declare class Engine {
890
893
  get runtime(): Runtime<any>;
891
894
  /** Namespaced workflow instance operations. */
892
895
  readonly workflows: {
893
- create(workflowId: string, trackedAsset: WorkflowInstance['trackedAsset'] | {
896
+ create(id: string, trackedAsset: WorkflowInstance['trackedAsset'] | {
894
897
  rawPayload: unknown;
895
898
  }, initiatedBy: string): Promise<WorkflowInstance | null>;
896
899
  emit(instanceId: string, event: IncomingEvent): Promise<EventResult>;
@@ -2245,7 +2248,7 @@ export declare class Runtime<T extends {
2245
2248
  protected effect<K extends keyof T['effects'] & string>(key: K, handler: (instance: WorkflowInstance, ...args: Parameters<T['effects'][K]>) => Promise<void>): this;
2246
2249
  protected automation<K extends keyof T['automations'] & string>(key: K, handler: (instance: WorkflowInstance, ...args: Parameters<T['automations'][K]>) => Promise<ReturnType<T['automations'][K]>>): this;
2247
2250
  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;
2251
+ protected trigger<K extends keyof T['triggers'] & string>(key: K, handler: (...args: Parameters<T['triggers'][K]>) => ReturnType<T['triggers'][K]>): this;
2249
2252
  /* Excluded from this release type: _runResolver */
2250
2253
  }
2251
2254
 
@@ -2462,11 +2465,14 @@ export declare interface TransitionStep {
2462
2465
  }
2463
2466
 
2464
2467
  /**
2465
- * Handler registered for a specific workflow trigger (keyed by Workflow.id).
2468
+ * Handler registered for a specific software trigger (keyed by Software.id).
2466
2469
  * Receives a raw payload from an external system and returns the trackedAsset
2467
- * that the engine will use to create the workflow instance.
2470
+ * plus the workflowId the engine will use to create the workflow instance.
2468
2471
  */
2469
- export declare type TriggerHandler = (rawPayload: unknown) => Promise<WorkflowInstance['trackedAsset']>;
2472
+ export declare type TriggerHandler = (rawPayload: unknown) => Promise<{
2473
+ trackedAsset: WorkflowInstance['trackedAsset'];
2474
+ workflowId: string;
2475
+ }>;
2470
2476
 
2471
2477
  /**
2472
2478
  * Validates all token-bearing entity IDs in a BEP against a naming convention.