@aikirun/workflow 0.10.1 → 0.11.0

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
@@ -255,7 +255,8 @@ interface WorkflowVersion<Input, Output, AppContext, TEventsDefinition extends E
255
255
  with(): WorkflowBuilder<Input, Output, AppContext, TEventsDefinition>;
256
256
  start: (client: Client<AppContext>, ...args: Input extends void ? [] : [Input]) => Promise<WorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
257
257
  startAsChild: <ParentInput, ParentEventsDefinition extends EventsDefinition>(parentRun: WorkflowRunContext<ParentInput, AppContext, ParentEventsDefinition>, ...args: Input extends void ? [] : [Input]) => Promise<ChildWorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
258
- getHandle: (client: Client<AppContext>, runId: string) => Promise<WorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
258
+ getHandleById: (client: Client<AppContext>, runId: string) => Promise<WorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
259
+ getHandleByReferenceId: (client: Client<AppContext>, referenceId: string) => Promise<WorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
259
260
  [INTERNAL]: {
260
261
  eventsDefinition: TEventsDefinition;
261
262
  handler: (run: WorkflowRunContext<Input, AppContext, TEventsDefinition>, input: Input, context: AppContext) => Promise<void>;
@@ -277,7 +278,8 @@ declare class WorkflowVersionImpl<Input, Output, AppContext, TEventsDefinition e
277
278
  start(client: Client<AppContext>, ...args: Input extends void ? [] : [Input]): Promise<WorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
278
279
  startAsChild(parentRun: WorkflowRunContext<unknown, AppContext, EventsDefinition>, ...args: Input extends void ? [] : [Input]): Promise<ChildWorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
279
280
  private assertUniqueChildRunReferenceId;
280
- getHandle(client: Client<AppContext>, runId: string): Promise<WorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
281
+ getHandleById(client: Client<AppContext>, runId: string): Promise<WorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
282
+ getHandleByReferenceId(client: Client<AppContext>, referenceId: string): Promise<WorkflowRunHandle<Input, Output, AppContext, TEventsDefinition>>;
281
283
  private handler;
282
284
  private tryExecuteWorkflow;
283
285
  private assertRetryAllowed;
package/dist/index.js CHANGED
@@ -985,9 +985,17 @@ var WorkflowVersionImpl = class _WorkflowVersionImpl {
985
985
  throw error;
986
986
  }
987
987
  }
988
- async getHandle(client, runId) {
988
+ async getHandleById(client, runId) {
989
989
  return workflowRunHandle(client, runId, this[INTERNAL5].eventsDefinition);
990
990
  }
991
+ async getHandleByReferenceId(client, referenceId) {
992
+ const { run } = await client.api.workflowRun.getByReferenceIdV1({
993
+ name: this.name,
994
+ versionId: this.versionId,
995
+ referenceId
996
+ });
997
+ return workflowRunHandle(client, run, this[INTERNAL5].eventsDefinition);
998
+ }
991
999
  async handler(run, input, context) {
992
1000
  const { logger } = run;
993
1001
  const { handle } = run[INTERNAL5];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikirun/workflow",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "Workflow SDK for Aiki - define durable workflows with tasks, sleeps, waits, and event handling",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "build": "tsup"
19
19
  },
20
20
  "dependencies": {
21
- "@aikirun/types": "0.10.1",
21
+ "@aikirun/types": "0.11.0",
22
22
  "@standard-schema/spec": "^1.1.0"
23
23
  },
24
24
  "publishConfig": {