@dotbep/core 0.2.16 → 0.2.18

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +19 -24
  2. package/dist/index.js +1037 -1030
  3. package/package.json +1 -1
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
 
@@ -877,7 +880,6 @@ export declare class Effects extends Entity<FlowEffect> {
877
880
 
878
881
  export declare class Engine {
879
882
  private readonly getBep;
880
- private readonly getHistoricalBep?;
881
883
  private _runtime;
882
884
  private storage;
883
885
  private skipRaci;
@@ -890,7 +892,7 @@ export declare class Engine {
890
892
  get runtime(): Runtime<any>;
891
893
  /** Namespaced workflow instance operations. */
892
894
  readonly workflows: {
893
- create(workflowId: string, trackedAsset: WorkflowInstance['trackedAsset'] | {
895
+ create(id: string, trackedAsset: WorkflowInstance['trackedAsset'] | {
894
896
  rawPayload: unknown;
895
897
  }, initiatedBy: string): Promise<WorkflowInstance | null>;
896
898
  emit(instanceId: string, event: IncomingEvent): Promise<EventResult>;
@@ -907,7 +909,7 @@ export declare class Engine {
907
909
  onEffectFailed(listener: EffectFailedListener): Engine;
908
910
  onAutomationFailed(listener: AutomationFailedListener): Engine;
909
911
  };
910
- constructor(getBep: () => BEP, getHistoricalBep?: (version: string) => Promise<BEP>);
912
+ constructor(getBep: () => BEP);
911
913
  /**
912
914
  * Configures the engine with a runtime and storage backend.
913
915
  * Must be called before any operations (workflows.create, workflows.emit, etc.).
@@ -924,7 +926,6 @@ export declare class Engine {
924
926
  private _getStatus;
925
927
  private _resolveContext;
926
928
  private _assertInit;
927
- private _resolveBep;
928
929
  private _fire;
929
930
  private _executeAutomationNode;
930
931
  private _executeEffect;
@@ -1648,9 +1649,7 @@ export declare interface InstanceFilter {
1648
1649
  status?: InstanceStatus;
1649
1650
  /** Member.email — returns instances where this actor has a pending RACI action. */
1650
1651
  pendingActionFor?: string;
1651
- /** ref AssetType.id */
1652
- trackedAssetTypeId?: string;
1653
- /** ID of the asset in the external system. */
1652
+ /** ref internal asset id (e.g. Deliverable.id) — only matches source: 'internal' instances. */
1654
1653
  trackedAssetId?: string;
1655
1654
  }
1656
1655
 
@@ -2245,7 +2244,7 @@ export declare class Runtime<T extends {
2245
2244
  protected effect<K extends keyof T['effects'] & string>(key: K, handler: (instance: WorkflowInstance, ...args: Parameters<T['effects'][K]>) => Promise<void>): this;
2246
2245
  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
2246
  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;
2247
+ protected trigger<K extends keyof T['triggers'] & string>(key: K, handler: (...args: Parameters<T['triggers'][K]>) => ReturnType<T['triggers'][K]>): this;
2249
2248
  /* Excluded from this release type: _runResolver */
2250
2249
  }
2251
2250
 
@@ -2462,11 +2461,14 @@ export declare interface TransitionStep {
2462
2461
  }
2463
2462
 
2464
2463
  /**
2465
- * Handler registered for a specific workflow trigger (keyed by Workflow.id).
2464
+ * Handler registered for a specific software trigger (keyed by Software.id).
2466
2465
  * Receives a raw payload from an external system and returns the trackedAsset
2467
- * that the engine will use to create the workflow instance.
2466
+ * plus the workflowId the engine will use to create the workflow instance.
2468
2467
  */
2469
- export declare type TriggerHandler = (rawPayload: unknown) => Promise<WorkflowInstance['trackedAsset']>;
2468
+ export declare type TriggerHandler = (rawPayload: unknown) => Promise<{
2469
+ trackedAsset: WorkflowInstance['trackedAsset'];
2470
+ workflowId: string;
2471
+ }>;
2470
2472
 
2471
2473
  /**
2472
2474
  * Validates all token-bearing entity IDs in a BEP against a naming convention.
@@ -2496,21 +2498,14 @@ export declare interface WorkflowInstance {
2496
2498
  id: string;
2497
2499
  /** ref Workflow.id */
2498
2500
  workflowId: string;
2499
- /** BEP version at the time this instance was created — used to load the correct workflow definition. */
2500
- bepVersion: string;
2501
2501
  /** The asset this instance is tracking. */
2502
2502
  trackedAsset: {
2503
- /** ref AssetType.id */
2504
- assetTypeId: string;
2505
- /**
2506
- * Namespace that identifies where the asset lives.
2507
- * Format: "bep:<entityName>" for BEP-internal entities (e.g. "bep:deliverables"),
2508
- * or "external:<softwareId>" for assets in external systems (e.g. "external:software-acc").
2509
- * The softwareId must match a Software.id declared in the BEP (which cannot contain colons).
2510
- */
2511
- source: string;
2512
- /** ID of the asset — ref to the entity within the source. */
2503
+ source: 'internal';
2504
+ type: 'deliverable';
2513
2505
  id: string;
2506
+ } | {
2507
+ source: 'external';
2508
+ url: string;
2514
2509
  label: string;
2515
2510
  };
2516
2511
  /** Key of the current FlowNode. Not a decision node — engine auto-traverses those. */