@lunnoa/client 2.3.0 → 2.5.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.cts CHANGED
@@ -715,7 +715,7 @@ interface paths {
715
715
  put?: never;
716
716
  /**
717
717
  * Upsert a workflow by slug from a linear step list
718
- * @description Creates or updates a workflow identified by workspace-scoped `slug`. Builds a minimal valid graph (one catalogue trigger, Manually Run when omitted, then linear catalogue-action steps). Marks `managedByCode` by default. Prefer the CLI (`npx @lunnoa/client workflows deploy`) over calling this from application code.
718
+ * @description Creates or updates a workflow identified by workspace-scoped `slug`. Builds a minimal valid graph (one catalogue trigger, Manually Run when omitted, then catalogue-action steps; the last step may branch with `paths`). Marks `managedByCode` by default. Prefer the CLI (`npx @lunnoa/client workflows deploy`) over calling this from application code.
719
719
  */
720
720
  post: operations["WorkflowsController_upsertBySlug"];
721
721
  delete?: never;
@@ -2299,13 +2299,18 @@ interface components {
2299
2299
  requestedCount: number;
2300
2300
  };
2301
2301
  UpsertWorkflowStepDto: {
2302
+ /**
2303
+ * @description Name later steps use in ={{step:<key>,path}}. Keyed steps keep their node id across deploys. "trigger" is reserved.
2304
+ * @example loadCase
2305
+ */
2306
+ key?: string;
2302
2307
  /** @description Workflow app id (catalogue slug). */
2303
2308
  appId: string;
2304
2309
  /** @description Catalogue action id. */
2305
2310
  actionId: string;
2306
2311
  /** @description Connection instance UUID for this step. */
2307
2312
  connectionId?: string;
2308
- /** @description Action input / config fields. */
2313
+ /** @description Action input / config fields. String values may use ={{step:trigger,field}} or ={{step:<key>,path,to,value}}. */
2309
2314
  input?: {
2310
2315
  [key: string]: unknown;
2311
2316
  };
@@ -2313,6 +2318,24 @@ interface components {
2313
2318
  name?: string;
2314
2319
  /** @description Step description. */
2315
2320
  description?: string;
2321
+ /** @description Branches after this step. Only on flow-control_action_conditional-paths, flow-control_action_manually-decide-paths, or flow-control_action_request-approval (approved path first, then rejected), and only on the last step of a list. */
2322
+ paths?: components["schemas"]["UpsertWorkflowPathDto"][];
2323
+ };
2324
+ UpsertWorkflowPathConditionDto: {
2325
+ /** @description One step reference, e.g. ={{step:load,amount}}. */
2326
+ field: string;
2327
+ /** @description contains, does_not_contain, equals, does_not_equal, exists, does_not_exist, starts_with, ends_with, is_empty, is_not_empty, comes_before, comes_after, is_in_the_past, is_in_the_future, is_true, is_false, is_truthy, is_falsey, is_greater_than, is_less_than, is_greater_than_or_equal_to, is_less_than_or_equal_to, matches_regex, does_not_match_regex. */
2328
+ condition: string;
2329
+ /** @description Value to compare with. */
2330
+ value?: string;
2331
+ };
2332
+ UpsertWorkflowPathDto: {
2333
+ /** @description Path label, unique on its step. */
2334
+ label: string;
2335
+ /** @description Conditional Paths only. Groups are OR-ed, conditions inside a group AND-ed. Omit to always take this path. */
2336
+ when?: components["schemas"]["UpsertWorkflowPathConditionDto"][][];
2337
+ /** @description Steps on this path. */
2338
+ steps: components["schemas"]["UpsertWorkflowStepDto"][];
2316
2339
  };
2317
2340
  UpsertWorkflowTriggerInputFieldDto: {
2318
2341
  /** @description Field id. Callers pass this key to workflows.execute. */
@@ -2362,7 +2385,7 @@ interface components {
2362
2385
  isActive?: boolean;
2363
2386
  /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
2364
2387
  trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
2365
- /** @description Linear catalogue-action steps (v1; no branches). */
2388
+ /** @description Catalogue-action steps in order. The last step may branch with `paths`. */
2366
2389
  steps: components["schemas"]["UpsertWorkflowStepDto"][];
2367
2390
  /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
2368
2391
  managedByCode?: boolean;
@@ -3464,6 +3487,8 @@ interface components {
3464
3487
  executionPath?: components["schemas"]["ExecutionPathStepDto"][];
3465
3488
  };
3466
3489
  RunStepDto: {
3490
+ /** @description Name later steps use in ={{step:<key>,path}}. Ad-hoc runs have no trigger. */
3491
+ key?: string;
3467
3492
  /** @description Workflow app id (catalogue slug), e.g. `http`, `gmail`. */
3468
3493
  appId: string;
3469
3494
  /** @description Action id within the app, e.g. `http_action_send-request`. Discover via GET /workflow-apps. */
@@ -6716,11 +6741,42 @@ interface TriggerDefinition {
6716
6741
  description?: string;
6717
6742
  }
6718
6743
  interface WorkflowStepDefinition {
6744
+ /**
6745
+ * Name later steps use with `ref.step(key, ...)`. Keyed steps keep their
6746
+ * node id across deploys. `trigger` is reserved.
6747
+ */
6748
+ key?: string;
6719
6749
  /** Action definition (or inline action-shaped object). */
6720
6750
  use: ActionDefinition;
6721
- /** Per-step input overrides. */
6751
+ /** Per-step input overrides. Values may contain `ref.trigger` / `ref.step`. */
6722
6752
  input?: Record<string, unknown>;
6723
6753
  name?: string;
6754
+ /**
6755
+ * Branches after this step. Only on Conditional Paths, Manually Decide Path,
6756
+ * or Request Approval (approved path first, then rejected), and only on the
6757
+ * last step of a list. Put later steps inside each path.
6758
+ */
6759
+ paths?: WorkflowPathDefinition[];
6760
+ }
6761
+ /** Conditions Conditional Paths evaluates (same list as the builder). */
6762
+ declare const PATH_CONDITIONS: readonly ["contains", "does_not_contain", "equals", "does_not_equal", "exists", "does_not_exist", "starts_with", "ends_with", "is_empty", "is_not_empty", "comes_before", "comes_after", "is_in_the_past", "is_in_the_future", "is_true", "is_false", "is_truthy", "is_falsey", "is_greater_than", "is_less_than", "is_greater_than_or_equal_to", "is_less_than_or_equal_to", "matches_regex", "does_not_match_regex"];
6763
+ type PathConditionType = (typeof PATH_CONDITIONS)[number];
6764
+ interface PathCondition {
6765
+ /** One reference: `ref.trigger(...)` or `ref.step(...)`. */
6766
+ field: string;
6767
+ condition: PathConditionType;
6768
+ /** Compared as text. Omit for exists / is_empty / is_true and similar. */
6769
+ value?: string;
6770
+ }
6771
+ interface WorkflowPathDefinition {
6772
+ /** Unique on its step. On Request Approval use `Approved` / `Rejected`. */
6773
+ label: string;
6774
+ /**
6775
+ * Conditional Paths only. Groups are OR-ed, conditions in a group AND-ed.
6776
+ * Omit to always take this path.
6777
+ */
6778
+ when?: PathCondition[][];
6779
+ steps: WorkflowStepDefinition[];
6724
6780
  }
6725
6781
  interface WorkflowDefinition {
6726
6782
  kind: typeof DEFINE_KINDS.workflow;
@@ -6734,7 +6790,7 @@ interface WorkflowDefinition {
6734
6790
  * `runs.start` ignores this and runs the steps only.
6735
6791
  */
6736
6792
  trigger?: TriggerDefinition;
6737
- /** Linear steps (v1; no branches). */
6793
+ /** Steps in order. The last step may branch with `paths`. */
6738
6794
  steps: WorkflowStepDefinition[];
6739
6795
  }
6740
6796
  type AgentToolDefinition = ActionDefinition | WorkflowDefinition | {
@@ -6762,6 +6818,17 @@ declare function defineConnection(config?: Omit<ConnectionDefinition, 'kind'>):
6762
6818
  declare function defineAiConnection(config?: Omit<AiConnectionDefinition, 'kind'>): AiConnectionDefinition;
6763
6819
  declare function defineAction(config: Omit<ActionDefinition, 'kind'>): ActionDefinition;
6764
6820
  declare function defineTrigger(config: Omit<TriggerDefinition, 'kind'>): TriggerDefinition;
6821
+ /**
6822
+ * References for step inputs. The server swaps them for the real node ids on
6823
+ * deploy, and the builder shows them as mapped fields from earlier nodes.
6824
+ * They are plain strings, so they also work inside text and nested objects.
6825
+ */
6826
+ declare const ref: {
6827
+ /** A trigger output field, e.g. a Manually Run input id. */
6828
+ trigger: (field: string, ...path: Array<string | number>) => string;
6829
+ /** An earlier step's output, by its `key`. Array indexes are numbers. */
6830
+ step: (key: string, ...path: Array<string | number>) => string;
6831
+ };
6765
6832
  declare function defineWorkflow(config: Omit<WorkflowDefinition, 'kind'>): WorkflowDefinition;
6766
6833
  declare function defineAgent(config: Omit<AgentDefinition, 'kind'>): AgentDefinition;
6767
6834
  interface EntityTypeDefinition {
@@ -7360,6 +7427,8 @@ declare class QueuesResource {
7360
7427
  }
7361
7428
 
7362
7429
  interface StartRunStep {
7430
+ /** Name later steps use with `ref.step(key, ...)`. */
7431
+ key?: string;
7363
7432
  appId: string;
7364
7433
  actionId: string;
7365
7434
  connectionId?: string;
@@ -7512,12 +7581,21 @@ declare class VariablesResource {
7512
7581
  }
7513
7582
 
7514
7583
  interface UpsertWorkflowStepInput {
7584
+ /** Name later steps use in `={{step:<key>,path}}`. Keeps the node id stable. */
7585
+ key?: string;
7515
7586
  appId: string;
7516
7587
  actionId: string;
7517
7588
  connectionId?: string;
7518
7589
  input?: Record<string, unknown>;
7519
7590
  name?: string;
7520
7591
  description?: string;
7592
+ /** Branches after this step (last step of a list only). */
7593
+ paths?: UpsertWorkflowPathInput[];
7594
+ }
7595
+ interface UpsertWorkflowPathInput {
7596
+ label: string;
7597
+ when?: WorkflowPathDefinition['when'];
7598
+ steps: UpsertWorkflowStepInput[];
7521
7599
  }
7522
7600
  interface UpsertWorkflowTriggerInput {
7523
7601
  triggerId: string;
@@ -7765,4 +7843,4 @@ interface CreateServerClientOptions {
7765
7843
  */
7766
7844
  declare function createServerClient(options: CreateServerClientOptions): LunnoaClient;
7767
7845
 
7768
- export { API_KEY_PREFIX, type ActionDefinition, ActionsResource, type AddQueueItemErrorInput, type Agent, AgentChatClient, AgentChatStream, type AgentDefinition, type AgentToolDefinition, AgentsResource, type AiConnection, type AiConnectionDefinition, type AiConnectionModel, AiConnectionsResource, type ApprovalInboxItem, ApprovalsResource, AuthResource, type AuthTokens, type BulkCreateQueueItemsInput, type BulkCreateQueueItemsResult, type ChangeEntityStateInput, type ChangeEntityStateResult, type ChatMode, type Connection, type ConnectionDefinition, ConnectionsResource, type CreateBrowserClientOptions, type CreateEntityInput, type CreateKnowledgeInput, type CreateQueueInput, type CreateQueueItemInput, type CreateServerClientOptions, type CreateTaskInput, type CreateVariableInput, type CurrentUser, DEFINE_KINDS, type DefineKind, type DeletedTask, DiscoveryResource, type EligibleApprover, type EnabledFeatures, EntitiesResource, type Entity, type EntityStateHistoryEntry, type EntityStateTransitions, type EntityType, type EntityTypeDefinition, type EntityTypeReadOptions, EntityTypesResource, type ExecuteWorkflowResult, type Execution, type ExecutionPathStep, type ExecutionProgress, type ExecutionProgressPayload, type ExecutionProgressStep, ExecutionProgressStream, type ExecutionStatus, type ExecutionStreamEvent, type ExecutionStreamEventType, ExecutionTimeoutError, ExecutionsResource, type ExportEntitiesInput, type FetchLike, HttpClient, type ImportEntitiesInput, type ImportEntitiesResult, type ImportTemplate, type Knowledge, type KnowledgeDocument, type KnowledgeDocumentGroup, KnowledgeResource, type ListEntitiesOptions, type ListQueryOptions, type ListQueueItemsByObjectOptions, type ListQueueItemsOptions, type LocalStorageTokenStoreOptions, type LoginRequires2FA, type LoginResult, type LoginSuccess, LunnoaApiError, LunnoaClient, type LunnoaClientOptions, type MessageTaskInput, type OffsetPagination, type PagePagination, type PaginatedEntities, type PendingInput, type PendingInputField, type QueryValue, type Queue, type QueueAllowedObjectType, type QueueItem, type QueueItemCreated, type QueueItemErrorEntry, type QueueItemFull, type QueueItemList, type QueueItemObjectSummary, type QueueItemStats, type QueueItemStatus, QueueItemsResource, type QueueStats, QueuesResource, type RecordMeasureValueInput, type RequestOptions, type RunActionInput, type RunActionOptions, type RunActionResult, RunsResource, type SaveUploadedTextInput, type Scorecard, type ScorecardMeasure, type ScorecardMeasureStatus, type ScorecardMeasureValue, type ScorecardObjective, type ScorecardSummary, ScorecardsResource, type SseEvent, SsoAuthResource, type SsoProviderSummary, type SsoProvidersResponse, type StartRunInput, type StartRunInputDto, type StartRunOptions, type StartRunStep, type StopStreamOptions, type StreamMessageOptions, type Table, TablesResource, type Task, type TaskListItem, TasksResource, type TokenStore, type TriggerDefinition, type TriggerInputFieldDefinition, type UpdateEntityInput, type UpdateKnowledgeInput, type UpdateQueueInput, type UpdateQueueItemInput, type UpdateTaskInput, type UpdateVariableInput, type UpsertAgentBySlugInput, type UpsertAgentBySlugInputDto, type UpsertAgentToolInput, type UpsertEntityTypeBySlugInput, type UpsertTableBySlugInput, type UpsertWorkflowBySlugInput, type UpsertWorkflowBySlugInputDto, type UpsertWorkflowStepInput, type UpsertWorkflowTriggerInput, type Variable, VariablesResource, type WaitUntilFinishedOptions, type WatchProgressOptions, type Workflow, type WorkflowApp, WorkflowAppsResource, type WorkflowDefinition, type WorkflowStepDefinition, WorkflowsResource, assertApiKeyAllowedInEnvironment, type components, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineTrigger, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, type operations, parseSseEvents, parseSseStream, type paths, resolveActionAppId, resolveActionId, resolveTriggerAppId, resolveTriggerId };
7846
+ export { API_KEY_PREFIX, type ActionDefinition, ActionsResource, type AddQueueItemErrorInput, type Agent, AgentChatClient, AgentChatStream, type AgentDefinition, type AgentToolDefinition, AgentsResource, type AiConnection, type AiConnectionDefinition, type AiConnectionModel, AiConnectionsResource, type ApprovalInboxItem, ApprovalsResource, AuthResource, type AuthTokens, type BulkCreateQueueItemsInput, type BulkCreateQueueItemsResult, type ChangeEntityStateInput, type ChangeEntityStateResult, type ChatMode, type Connection, type ConnectionDefinition, ConnectionsResource, type CreateBrowserClientOptions, type CreateEntityInput, type CreateKnowledgeInput, type CreateQueueInput, type CreateQueueItemInput, type CreateServerClientOptions, type CreateTaskInput, type CreateVariableInput, type CurrentUser, DEFINE_KINDS, type DefineKind, type DeletedTask, DiscoveryResource, type EligibleApprover, type EnabledFeatures, EntitiesResource, type Entity, type EntityStateHistoryEntry, type EntityStateTransitions, type EntityType, type EntityTypeDefinition, type EntityTypeReadOptions, EntityTypesResource, type ExecuteWorkflowResult, type Execution, type ExecutionPathStep, type ExecutionProgress, type ExecutionProgressPayload, type ExecutionProgressStep, ExecutionProgressStream, type ExecutionStatus, type ExecutionStreamEvent, type ExecutionStreamEventType, ExecutionTimeoutError, ExecutionsResource, type ExportEntitiesInput, type FetchLike, HttpClient, type ImportEntitiesInput, type ImportEntitiesResult, type ImportTemplate, type Knowledge, type KnowledgeDocument, type KnowledgeDocumentGroup, KnowledgeResource, type ListEntitiesOptions, type ListQueryOptions, type ListQueueItemsByObjectOptions, type ListQueueItemsOptions, type LocalStorageTokenStoreOptions, type LoginRequires2FA, type LoginResult, type LoginSuccess, LunnoaApiError, LunnoaClient, type LunnoaClientOptions, type MessageTaskInput, type OffsetPagination, PATH_CONDITIONS, type PagePagination, type PaginatedEntities, type PathCondition, type PathConditionType, type PendingInput, type PendingInputField, type QueryValue, type Queue, type QueueAllowedObjectType, type QueueItem, type QueueItemCreated, type QueueItemErrorEntry, type QueueItemFull, type QueueItemList, type QueueItemObjectSummary, type QueueItemStats, type QueueItemStatus, QueueItemsResource, type QueueStats, QueuesResource, type RecordMeasureValueInput, type RequestOptions, type RunActionInput, type RunActionOptions, type RunActionResult, RunsResource, type SaveUploadedTextInput, type Scorecard, type ScorecardMeasure, type ScorecardMeasureStatus, type ScorecardMeasureValue, type ScorecardObjective, type ScorecardSummary, ScorecardsResource, type SseEvent, SsoAuthResource, type SsoProviderSummary, type SsoProvidersResponse, type StartRunInput, type StartRunInputDto, type StartRunOptions, type StartRunStep, type StopStreamOptions, type StreamMessageOptions, type Table, TablesResource, type Task, type TaskListItem, TasksResource, type TokenStore, type TriggerDefinition, type TriggerInputFieldDefinition, type UpdateEntityInput, type UpdateKnowledgeInput, type UpdateQueueInput, type UpdateQueueItemInput, type UpdateTaskInput, type UpdateVariableInput, type UpsertAgentBySlugInput, type UpsertAgentBySlugInputDto, type UpsertAgentToolInput, type UpsertEntityTypeBySlugInput, type UpsertTableBySlugInput, type UpsertWorkflowBySlugInput, type UpsertWorkflowBySlugInputDto, type UpsertWorkflowPathInput, type UpsertWorkflowStepInput, type UpsertWorkflowTriggerInput, type Variable, VariablesResource, type WaitUntilFinishedOptions, type WatchProgressOptions, type Workflow, type WorkflowApp, WorkflowAppsResource, type WorkflowDefinition, type WorkflowPathDefinition, type WorkflowStepDefinition, WorkflowsResource, assertApiKeyAllowedInEnvironment, type components, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineTrigger, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, type operations, parseSseEvents, parseSseStream, type paths, ref, resolveActionAppId, resolveActionId, resolveTriggerAppId, resolveTriggerId };
package/dist/index.d.ts CHANGED
@@ -715,7 +715,7 @@ interface paths {
715
715
  put?: never;
716
716
  /**
717
717
  * Upsert a workflow by slug from a linear step list
718
- * @description Creates or updates a workflow identified by workspace-scoped `slug`. Builds a minimal valid graph (one catalogue trigger, Manually Run when omitted, then linear catalogue-action steps). Marks `managedByCode` by default. Prefer the CLI (`npx @lunnoa/client workflows deploy`) over calling this from application code.
718
+ * @description Creates or updates a workflow identified by workspace-scoped `slug`. Builds a minimal valid graph (one catalogue trigger, Manually Run when omitted, then catalogue-action steps; the last step may branch with `paths`). Marks `managedByCode` by default. Prefer the CLI (`npx @lunnoa/client workflows deploy`) over calling this from application code.
719
719
  */
720
720
  post: operations["WorkflowsController_upsertBySlug"];
721
721
  delete?: never;
@@ -2299,13 +2299,18 @@ interface components {
2299
2299
  requestedCount: number;
2300
2300
  };
2301
2301
  UpsertWorkflowStepDto: {
2302
+ /**
2303
+ * @description Name later steps use in ={{step:<key>,path}}. Keyed steps keep their node id across deploys. "trigger" is reserved.
2304
+ * @example loadCase
2305
+ */
2306
+ key?: string;
2302
2307
  /** @description Workflow app id (catalogue slug). */
2303
2308
  appId: string;
2304
2309
  /** @description Catalogue action id. */
2305
2310
  actionId: string;
2306
2311
  /** @description Connection instance UUID for this step. */
2307
2312
  connectionId?: string;
2308
- /** @description Action input / config fields. */
2313
+ /** @description Action input / config fields. String values may use ={{step:trigger,field}} or ={{step:<key>,path,to,value}}. */
2309
2314
  input?: {
2310
2315
  [key: string]: unknown;
2311
2316
  };
@@ -2313,6 +2318,24 @@ interface components {
2313
2318
  name?: string;
2314
2319
  /** @description Step description. */
2315
2320
  description?: string;
2321
+ /** @description Branches after this step. Only on flow-control_action_conditional-paths, flow-control_action_manually-decide-paths, or flow-control_action_request-approval (approved path first, then rejected), and only on the last step of a list. */
2322
+ paths?: components["schemas"]["UpsertWorkflowPathDto"][];
2323
+ };
2324
+ UpsertWorkflowPathConditionDto: {
2325
+ /** @description One step reference, e.g. ={{step:load,amount}}. */
2326
+ field: string;
2327
+ /** @description contains, does_not_contain, equals, does_not_equal, exists, does_not_exist, starts_with, ends_with, is_empty, is_not_empty, comes_before, comes_after, is_in_the_past, is_in_the_future, is_true, is_false, is_truthy, is_falsey, is_greater_than, is_less_than, is_greater_than_or_equal_to, is_less_than_or_equal_to, matches_regex, does_not_match_regex. */
2328
+ condition: string;
2329
+ /** @description Value to compare with. */
2330
+ value?: string;
2331
+ };
2332
+ UpsertWorkflowPathDto: {
2333
+ /** @description Path label, unique on its step. */
2334
+ label: string;
2335
+ /** @description Conditional Paths only. Groups are OR-ed, conditions inside a group AND-ed. Omit to always take this path. */
2336
+ when?: components["schemas"]["UpsertWorkflowPathConditionDto"][][];
2337
+ /** @description Steps on this path. */
2338
+ steps: components["schemas"]["UpsertWorkflowStepDto"][];
2316
2339
  };
2317
2340
  UpsertWorkflowTriggerInputFieldDto: {
2318
2341
  /** @description Field id. Callers pass this key to workflows.execute. */
@@ -2362,7 +2385,7 @@ interface components {
2362
2385
  isActive?: boolean;
2363
2386
  /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
2364
2387
  trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
2365
- /** @description Linear catalogue-action steps (v1; no branches). */
2388
+ /** @description Catalogue-action steps in order. The last step may branch with `paths`. */
2366
2389
  steps: components["schemas"]["UpsertWorkflowStepDto"][];
2367
2390
  /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
2368
2391
  managedByCode?: boolean;
@@ -3464,6 +3487,8 @@ interface components {
3464
3487
  executionPath?: components["schemas"]["ExecutionPathStepDto"][];
3465
3488
  };
3466
3489
  RunStepDto: {
3490
+ /** @description Name later steps use in ={{step:<key>,path}}. Ad-hoc runs have no trigger. */
3491
+ key?: string;
3467
3492
  /** @description Workflow app id (catalogue slug), e.g. `http`, `gmail`. */
3468
3493
  appId: string;
3469
3494
  /** @description Action id within the app, e.g. `http_action_send-request`. Discover via GET /workflow-apps. */
@@ -6716,11 +6741,42 @@ interface TriggerDefinition {
6716
6741
  description?: string;
6717
6742
  }
6718
6743
  interface WorkflowStepDefinition {
6744
+ /**
6745
+ * Name later steps use with `ref.step(key, ...)`. Keyed steps keep their
6746
+ * node id across deploys. `trigger` is reserved.
6747
+ */
6748
+ key?: string;
6719
6749
  /** Action definition (or inline action-shaped object). */
6720
6750
  use: ActionDefinition;
6721
- /** Per-step input overrides. */
6751
+ /** Per-step input overrides. Values may contain `ref.trigger` / `ref.step`. */
6722
6752
  input?: Record<string, unknown>;
6723
6753
  name?: string;
6754
+ /**
6755
+ * Branches after this step. Only on Conditional Paths, Manually Decide Path,
6756
+ * or Request Approval (approved path first, then rejected), and only on the
6757
+ * last step of a list. Put later steps inside each path.
6758
+ */
6759
+ paths?: WorkflowPathDefinition[];
6760
+ }
6761
+ /** Conditions Conditional Paths evaluates (same list as the builder). */
6762
+ declare const PATH_CONDITIONS: readonly ["contains", "does_not_contain", "equals", "does_not_equal", "exists", "does_not_exist", "starts_with", "ends_with", "is_empty", "is_not_empty", "comes_before", "comes_after", "is_in_the_past", "is_in_the_future", "is_true", "is_false", "is_truthy", "is_falsey", "is_greater_than", "is_less_than", "is_greater_than_or_equal_to", "is_less_than_or_equal_to", "matches_regex", "does_not_match_regex"];
6763
+ type PathConditionType = (typeof PATH_CONDITIONS)[number];
6764
+ interface PathCondition {
6765
+ /** One reference: `ref.trigger(...)` or `ref.step(...)`. */
6766
+ field: string;
6767
+ condition: PathConditionType;
6768
+ /** Compared as text. Omit for exists / is_empty / is_true and similar. */
6769
+ value?: string;
6770
+ }
6771
+ interface WorkflowPathDefinition {
6772
+ /** Unique on its step. On Request Approval use `Approved` / `Rejected`. */
6773
+ label: string;
6774
+ /**
6775
+ * Conditional Paths only. Groups are OR-ed, conditions in a group AND-ed.
6776
+ * Omit to always take this path.
6777
+ */
6778
+ when?: PathCondition[][];
6779
+ steps: WorkflowStepDefinition[];
6724
6780
  }
6725
6781
  interface WorkflowDefinition {
6726
6782
  kind: typeof DEFINE_KINDS.workflow;
@@ -6734,7 +6790,7 @@ interface WorkflowDefinition {
6734
6790
  * `runs.start` ignores this and runs the steps only.
6735
6791
  */
6736
6792
  trigger?: TriggerDefinition;
6737
- /** Linear steps (v1; no branches). */
6793
+ /** Steps in order. The last step may branch with `paths`. */
6738
6794
  steps: WorkflowStepDefinition[];
6739
6795
  }
6740
6796
  type AgentToolDefinition = ActionDefinition | WorkflowDefinition | {
@@ -6762,6 +6818,17 @@ declare function defineConnection(config?: Omit<ConnectionDefinition, 'kind'>):
6762
6818
  declare function defineAiConnection(config?: Omit<AiConnectionDefinition, 'kind'>): AiConnectionDefinition;
6763
6819
  declare function defineAction(config: Omit<ActionDefinition, 'kind'>): ActionDefinition;
6764
6820
  declare function defineTrigger(config: Omit<TriggerDefinition, 'kind'>): TriggerDefinition;
6821
+ /**
6822
+ * References for step inputs. The server swaps them for the real node ids on
6823
+ * deploy, and the builder shows them as mapped fields from earlier nodes.
6824
+ * They are plain strings, so they also work inside text and nested objects.
6825
+ */
6826
+ declare const ref: {
6827
+ /** A trigger output field, e.g. a Manually Run input id. */
6828
+ trigger: (field: string, ...path: Array<string | number>) => string;
6829
+ /** An earlier step's output, by its `key`. Array indexes are numbers. */
6830
+ step: (key: string, ...path: Array<string | number>) => string;
6831
+ };
6765
6832
  declare function defineWorkflow(config: Omit<WorkflowDefinition, 'kind'>): WorkflowDefinition;
6766
6833
  declare function defineAgent(config: Omit<AgentDefinition, 'kind'>): AgentDefinition;
6767
6834
  interface EntityTypeDefinition {
@@ -7360,6 +7427,8 @@ declare class QueuesResource {
7360
7427
  }
7361
7428
 
7362
7429
  interface StartRunStep {
7430
+ /** Name later steps use with `ref.step(key, ...)`. */
7431
+ key?: string;
7363
7432
  appId: string;
7364
7433
  actionId: string;
7365
7434
  connectionId?: string;
@@ -7512,12 +7581,21 @@ declare class VariablesResource {
7512
7581
  }
7513
7582
 
7514
7583
  interface UpsertWorkflowStepInput {
7584
+ /** Name later steps use in `={{step:<key>,path}}`. Keeps the node id stable. */
7585
+ key?: string;
7515
7586
  appId: string;
7516
7587
  actionId: string;
7517
7588
  connectionId?: string;
7518
7589
  input?: Record<string, unknown>;
7519
7590
  name?: string;
7520
7591
  description?: string;
7592
+ /** Branches after this step (last step of a list only). */
7593
+ paths?: UpsertWorkflowPathInput[];
7594
+ }
7595
+ interface UpsertWorkflowPathInput {
7596
+ label: string;
7597
+ when?: WorkflowPathDefinition['when'];
7598
+ steps: UpsertWorkflowStepInput[];
7521
7599
  }
7522
7600
  interface UpsertWorkflowTriggerInput {
7523
7601
  triggerId: string;
@@ -7765,4 +7843,4 @@ interface CreateServerClientOptions {
7765
7843
  */
7766
7844
  declare function createServerClient(options: CreateServerClientOptions): LunnoaClient;
7767
7845
 
7768
- export { API_KEY_PREFIX, type ActionDefinition, ActionsResource, type AddQueueItemErrorInput, type Agent, AgentChatClient, AgentChatStream, type AgentDefinition, type AgentToolDefinition, AgentsResource, type AiConnection, type AiConnectionDefinition, type AiConnectionModel, AiConnectionsResource, type ApprovalInboxItem, ApprovalsResource, AuthResource, type AuthTokens, type BulkCreateQueueItemsInput, type BulkCreateQueueItemsResult, type ChangeEntityStateInput, type ChangeEntityStateResult, type ChatMode, type Connection, type ConnectionDefinition, ConnectionsResource, type CreateBrowserClientOptions, type CreateEntityInput, type CreateKnowledgeInput, type CreateQueueInput, type CreateQueueItemInput, type CreateServerClientOptions, type CreateTaskInput, type CreateVariableInput, type CurrentUser, DEFINE_KINDS, type DefineKind, type DeletedTask, DiscoveryResource, type EligibleApprover, type EnabledFeatures, EntitiesResource, type Entity, type EntityStateHistoryEntry, type EntityStateTransitions, type EntityType, type EntityTypeDefinition, type EntityTypeReadOptions, EntityTypesResource, type ExecuteWorkflowResult, type Execution, type ExecutionPathStep, type ExecutionProgress, type ExecutionProgressPayload, type ExecutionProgressStep, ExecutionProgressStream, type ExecutionStatus, type ExecutionStreamEvent, type ExecutionStreamEventType, ExecutionTimeoutError, ExecutionsResource, type ExportEntitiesInput, type FetchLike, HttpClient, type ImportEntitiesInput, type ImportEntitiesResult, type ImportTemplate, type Knowledge, type KnowledgeDocument, type KnowledgeDocumentGroup, KnowledgeResource, type ListEntitiesOptions, type ListQueryOptions, type ListQueueItemsByObjectOptions, type ListQueueItemsOptions, type LocalStorageTokenStoreOptions, type LoginRequires2FA, type LoginResult, type LoginSuccess, LunnoaApiError, LunnoaClient, type LunnoaClientOptions, type MessageTaskInput, type OffsetPagination, type PagePagination, type PaginatedEntities, type PendingInput, type PendingInputField, type QueryValue, type Queue, type QueueAllowedObjectType, type QueueItem, type QueueItemCreated, type QueueItemErrorEntry, type QueueItemFull, type QueueItemList, type QueueItemObjectSummary, type QueueItemStats, type QueueItemStatus, QueueItemsResource, type QueueStats, QueuesResource, type RecordMeasureValueInput, type RequestOptions, type RunActionInput, type RunActionOptions, type RunActionResult, RunsResource, type SaveUploadedTextInput, type Scorecard, type ScorecardMeasure, type ScorecardMeasureStatus, type ScorecardMeasureValue, type ScorecardObjective, type ScorecardSummary, ScorecardsResource, type SseEvent, SsoAuthResource, type SsoProviderSummary, type SsoProvidersResponse, type StartRunInput, type StartRunInputDto, type StartRunOptions, type StartRunStep, type StopStreamOptions, type StreamMessageOptions, type Table, TablesResource, type Task, type TaskListItem, TasksResource, type TokenStore, type TriggerDefinition, type TriggerInputFieldDefinition, type UpdateEntityInput, type UpdateKnowledgeInput, type UpdateQueueInput, type UpdateQueueItemInput, type UpdateTaskInput, type UpdateVariableInput, type UpsertAgentBySlugInput, type UpsertAgentBySlugInputDto, type UpsertAgentToolInput, type UpsertEntityTypeBySlugInput, type UpsertTableBySlugInput, type UpsertWorkflowBySlugInput, type UpsertWorkflowBySlugInputDto, type UpsertWorkflowStepInput, type UpsertWorkflowTriggerInput, type Variable, VariablesResource, type WaitUntilFinishedOptions, type WatchProgressOptions, type Workflow, type WorkflowApp, WorkflowAppsResource, type WorkflowDefinition, type WorkflowStepDefinition, WorkflowsResource, assertApiKeyAllowedInEnvironment, type components, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineTrigger, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, type operations, parseSseEvents, parseSseStream, type paths, resolveActionAppId, resolveActionId, resolveTriggerAppId, resolveTriggerId };
7846
+ export { API_KEY_PREFIX, type ActionDefinition, ActionsResource, type AddQueueItemErrorInput, type Agent, AgentChatClient, AgentChatStream, type AgentDefinition, type AgentToolDefinition, AgentsResource, type AiConnection, type AiConnectionDefinition, type AiConnectionModel, AiConnectionsResource, type ApprovalInboxItem, ApprovalsResource, AuthResource, type AuthTokens, type BulkCreateQueueItemsInput, type BulkCreateQueueItemsResult, type ChangeEntityStateInput, type ChangeEntityStateResult, type ChatMode, type Connection, type ConnectionDefinition, ConnectionsResource, type CreateBrowserClientOptions, type CreateEntityInput, type CreateKnowledgeInput, type CreateQueueInput, type CreateQueueItemInput, type CreateServerClientOptions, type CreateTaskInput, type CreateVariableInput, type CurrentUser, DEFINE_KINDS, type DefineKind, type DeletedTask, DiscoveryResource, type EligibleApprover, type EnabledFeatures, EntitiesResource, type Entity, type EntityStateHistoryEntry, type EntityStateTransitions, type EntityType, type EntityTypeDefinition, type EntityTypeReadOptions, EntityTypesResource, type ExecuteWorkflowResult, type Execution, type ExecutionPathStep, type ExecutionProgress, type ExecutionProgressPayload, type ExecutionProgressStep, ExecutionProgressStream, type ExecutionStatus, type ExecutionStreamEvent, type ExecutionStreamEventType, ExecutionTimeoutError, ExecutionsResource, type ExportEntitiesInput, type FetchLike, HttpClient, type ImportEntitiesInput, type ImportEntitiesResult, type ImportTemplate, type Knowledge, type KnowledgeDocument, type KnowledgeDocumentGroup, KnowledgeResource, type ListEntitiesOptions, type ListQueryOptions, type ListQueueItemsByObjectOptions, type ListQueueItemsOptions, type LocalStorageTokenStoreOptions, type LoginRequires2FA, type LoginResult, type LoginSuccess, LunnoaApiError, LunnoaClient, type LunnoaClientOptions, type MessageTaskInput, type OffsetPagination, PATH_CONDITIONS, type PagePagination, type PaginatedEntities, type PathCondition, type PathConditionType, type PendingInput, type PendingInputField, type QueryValue, type Queue, type QueueAllowedObjectType, type QueueItem, type QueueItemCreated, type QueueItemErrorEntry, type QueueItemFull, type QueueItemList, type QueueItemObjectSummary, type QueueItemStats, type QueueItemStatus, QueueItemsResource, type QueueStats, QueuesResource, type RecordMeasureValueInput, type RequestOptions, type RunActionInput, type RunActionOptions, type RunActionResult, RunsResource, type SaveUploadedTextInput, type Scorecard, type ScorecardMeasure, type ScorecardMeasureStatus, type ScorecardMeasureValue, type ScorecardObjective, type ScorecardSummary, ScorecardsResource, type SseEvent, SsoAuthResource, type SsoProviderSummary, type SsoProvidersResponse, type StartRunInput, type StartRunInputDto, type StartRunOptions, type StartRunStep, type StopStreamOptions, type StreamMessageOptions, type Table, TablesResource, type Task, type TaskListItem, TasksResource, type TokenStore, type TriggerDefinition, type TriggerInputFieldDefinition, type UpdateEntityInput, type UpdateKnowledgeInput, type UpdateQueueInput, type UpdateQueueItemInput, type UpdateTaskInput, type UpdateVariableInput, type UpsertAgentBySlugInput, type UpsertAgentBySlugInputDto, type UpsertAgentToolInput, type UpsertEntityTypeBySlugInput, type UpsertTableBySlugInput, type UpsertWorkflowBySlugInput, type UpsertWorkflowBySlugInputDto, type UpsertWorkflowPathInput, type UpsertWorkflowStepInput, type UpsertWorkflowTriggerInput, type Variable, VariablesResource, type WaitUntilFinishedOptions, type WatchProgressOptions, type Workflow, type WorkflowApp, WorkflowAppsResource, type WorkflowDefinition, type WorkflowPathDefinition, type WorkflowStepDefinition, WorkflowsResource, assertApiKeyAllowedInEnvironment, type components, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineTrigger, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, type operations, parseSseEvents, parseSseStream, type paths, ref, resolveActionAppId, resolveActionId, resolveTriggerAppId, resolveTriggerId };
package/dist/index.js CHANGED
@@ -540,6 +540,32 @@ var DEFINE_KINDS = {
540
540
  agent: "agent",
541
541
  entityType: "entityType"
542
542
  };
543
+ var PATH_CONDITIONS = [
544
+ "contains",
545
+ "does_not_contain",
546
+ "equals",
547
+ "does_not_equal",
548
+ "exists",
549
+ "does_not_exist",
550
+ "starts_with",
551
+ "ends_with",
552
+ "is_empty",
553
+ "is_not_empty",
554
+ "comes_before",
555
+ "comes_after",
556
+ "is_in_the_past",
557
+ "is_in_the_future",
558
+ "is_true",
559
+ "is_false",
560
+ "is_truthy",
561
+ "is_falsey",
562
+ "is_greater_than",
563
+ "is_less_than",
564
+ "is_greater_than_or_equal_to",
565
+ "is_less_than_or_equal_to",
566
+ "matches_regex",
567
+ "does_not_match_regex"
568
+ ];
543
569
  function defineConnection(config = {}) {
544
570
  return { kind: DEFINE_KINDS.connection, ...config };
545
571
  }
@@ -561,7 +587,7 @@ function assertTriggerConfig(config) {
561
587
  throw new Error("defineTrigger inputs require id");
562
588
  }
563
589
  }
564
- if (config.inputs?.length && config.id.trim() !== "flow-control_trigger_manual") {
590
+ if (config.inputs?.length && config.id.trim() !== MANUAL_TRIGGER_ID) {
565
591
  throw new Error(
566
592
  "defineTrigger inputs are only valid on flow-control_trigger_manual"
567
593
  );
@@ -571,6 +597,131 @@ function defineTrigger(config) {
571
597
  assertTriggerConfig(config);
572
598
  return { kind: DEFINE_KINDS.trigger, ...config };
573
599
  }
600
+ var MANUAL_TRIGGER_ID = "flow-control_trigger_manual";
601
+ var TRIGGER_KEY = "trigger";
602
+ var STEP_KEY_PATTERN = /^[A-Za-z][A-Za-z0-9_-]*$/;
603
+ var STEP_REF_PATTERN = /={{step:([^}]*)}}/g;
604
+ function refString(key, path) {
605
+ const parts = [key, ...path.map(String)];
606
+ for (const part of parts) {
607
+ if (!part || /[,{}]/.test(part)) {
608
+ throw new Error(`ref path parts must be non-empty and contain no , { or }: "${part}"`);
609
+ }
610
+ }
611
+ return `={{step:${parts.join(",")}}}`;
612
+ }
613
+ var ref = {
614
+ /** A trigger output field, e.g. a Manually Run input id. */
615
+ trigger: (field, ...path) => refString(TRIGGER_KEY, [field, ...path]),
616
+ /** An earlier step's output, by its `key`. Array indexes are numbers. */
617
+ step: (key, ...path) => refString(key, path)
618
+ };
619
+ function collectRefs(value, out) {
620
+ if (typeof value === "string") {
621
+ for (const match of value.matchAll(STEP_REF_PATTERN)) {
622
+ out.push(match[1].split(",").map((part) => part.trim()));
623
+ }
624
+ } else if (Array.isArray(value)) {
625
+ value.forEach((item) => collectRefs(item, out));
626
+ } else if (value && typeof value === "object") {
627
+ Object.values(value).forEach((item) => collectRefs(item, out));
628
+ }
629
+ }
630
+ var CONDITIONAL_PATHS_ID = "flow-control_action_conditional-paths";
631
+ var APPROVAL_ID = "flow-control_action_request-approval";
632
+ var BRANCHING_ACTION_IDS = /* @__PURE__ */ new Set([
633
+ CONDITIONAL_PATHS_ID,
634
+ "flow-control_action_manually-decide-paths",
635
+ APPROVAL_ID
636
+ ]);
637
+ var PATH_CONDITION_SET = new Set(PATH_CONDITIONS);
638
+ var SINGLE_REF_PATTERN = /^={{step:[^}]*}}$/;
639
+ function collectKeys(steps, seen) {
640
+ for (const step of steps) {
641
+ if (step.key !== void 0) {
642
+ if (!STEP_KEY_PATTERN.test(step.key) || step.key === TRIGGER_KEY) {
643
+ throw new Error(
644
+ `Step key "${step.key}" must start with a letter, use letters, digits, - or _, and not be "${TRIGGER_KEY}".`
645
+ );
646
+ }
647
+ if (seen.has(step.key)) {
648
+ throw new Error(`Step key "${step.key}" is used twice.`);
649
+ }
650
+ seen.add(step.key);
651
+ }
652
+ for (const path of step.paths ?? []) collectKeys(path.steps ?? [], seen);
653
+ }
654
+ }
655
+ function assertStepRefs(config) {
656
+ const triggerId = config.trigger?.id.trim() ?? MANUAL_TRIGGER_ID;
657
+ const triggerFields = triggerId === MANUAL_TRIGGER_ID ? new Set((config.trigger?.inputs ?? []).map((f) => f.id.trim())) : void 0;
658
+ const allKeys = /* @__PURE__ */ new Set();
659
+ collectKeys(config.steps, allKeys);
660
+ const checkRefs = (value, earlier, where) => {
661
+ const refs = [];
662
+ collectRefs(value, refs);
663
+ for (const [key = "", ...path] of refs) {
664
+ const shown = `={{step:${[key, ...path].join(",")}}}`;
665
+ if (!earlier.has(key)) {
666
+ throw new Error(
667
+ allKeys.has(key) ? `${where}: ${shown} refers to itself, a later step, or a step on another path. Use the trigger or an earlier step on the same path.` : `${where}: ${shown} names unknown key "${key}". Use "trigger" or an earlier step's key.`
668
+ );
669
+ }
670
+ if (key === TRIGGER_KEY && triggerFields && !triggerFields.has(path[0] ?? "")) {
671
+ throw new Error(
672
+ `${where}: ${shown} uses trigger field "${path[0] ?? ""}", which is not declared in trigger inputs.`
673
+ );
674
+ }
675
+ }
676
+ };
677
+ const checkChain = (steps, visible) => {
678
+ const earlier = new Set(visible);
679
+ steps.forEach((step, index) => {
680
+ const where = `Step "${step.key ?? step.name ?? index + 1}"`;
681
+ checkRefs([step.use?.input, step.input], earlier, where);
682
+ if (step.key) earlier.add(step.key);
683
+ if (!step.paths?.length) return;
684
+ const actionId = step.use ? resolveActionId(step.use) : "";
685
+ if (!BRANCHING_ACTION_IDS.has(actionId)) {
686
+ throw new Error(`${where}: paths only work on ${[...BRANCHING_ACTION_IDS].join(", ")}.`);
687
+ }
688
+ if (index !== steps.length - 1) {
689
+ throw new Error(
690
+ `${where}: a step with paths must be the last step in its list. Put later steps inside each path.`
691
+ );
692
+ }
693
+ if (actionId === APPROVAL_ID && step.paths.length > 2) {
694
+ throw new Error(`${where}: Request Approval takes at most two paths (approved, then rejected).`);
695
+ }
696
+ const labels = /* @__PURE__ */ new Set();
697
+ for (const path of step.paths) {
698
+ const label = path?.label?.trim();
699
+ if (!label) throw new Error(`${where}: every path needs a label.`);
700
+ if (labels.has(label)) throw new Error(`${where}: path label "${label}" is used twice.`);
701
+ labels.add(label);
702
+ if (path.when !== void 0 && actionId !== CONDITIONAL_PATHS_ID) {
703
+ throw new Error(`${where}: "when" only works on Conditional Paths.`);
704
+ }
705
+ for (const condition of (path.when ?? []).flat()) {
706
+ if (!SINGLE_REF_PATTERN.test(condition?.field?.trim() ?? "")) {
707
+ throw new Error(
708
+ `${where}, path "${label}": a condition's field must be one ref.trigger(...) or ref.step(...).`
709
+ );
710
+ }
711
+ if (!PATH_CONDITION_SET.has(condition.condition)) {
712
+ throw new Error(
713
+ `${where}, path "${label}": condition "${condition.condition}" is not supported. Use one of: ${PATH_CONDITIONS.join(", ")}.`
714
+ );
715
+ }
716
+ }
717
+ checkRefs(path.when, earlier, `${where}, path "${label}"`);
718
+ if (!path.steps?.length) throw new Error(`${where}: path "${label}" needs at least one step.`);
719
+ checkChain(path.steps, earlier);
720
+ }
721
+ });
722
+ };
723
+ checkChain(config.steps, /* @__PURE__ */ new Set([TRIGGER_KEY]));
724
+ }
574
725
  function defineWorkflow(config) {
575
726
  if (!config.slug?.trim()) {
576
727
  throw new Error("defineWorkflow requires slug");
@@ -581,6 +732,7 @@ function defineWorkflow(config) {
581
732
  if (config.trigger) {
582
733
  assertTriggerConfig(config.trigger);
583
734
  }
735
+ assertStepRefs(config);
584
736
  return { kind: DEFINE_KINDS.workflow, ...config };
585
737
  }
586
738
  function defineAgent(config) {
@@ -1867,12 +2019,19 @@ function stepFromDefinition(step) {
1867
2019
  ...step.name ? { name: step.name } : {}
1868
2020
  };
1869
2021
  }
2022
+ if (step.paths?.length) {
2023
+ throw new Error(
2024
+ "runs.start runs straight lines only. Deploy workflows with paths, then execute them."
2025
+ );
2026
+ }
1870
2027
  const use = step.use;
1871
2028
  const input = {
1872
2029
  ...use.input ?? {},
1873
2030
  ...step.input ?? {}
1874
2031
  };
2032
+ const key = step.key;
1875
2033
  return {
2034
+ ...key ? { key } : {},
1876
2035
  appId: resolveActionAppId(use),
1877
2036
  actionId: resolveActionId(use),
1878
2037
  ...use.connection?.id ? { connectionId: use.connection.id } : {},
@@ -2088,6 +2247,7 @@ function triggerToUpsertInput(trigger) {
2088
2247
  function stepToUpsertInput(step) {
2089
2248
  const use = step.use;
2090
2249
  return {
2250
+ ...step.key ? { key: step.key } : {},
2091
2251
  appId: resolveActionAppId(use),
2092
2252
  actionId: resolveActionId(use),
2093
2253
  connectionId: use.connection?.id,
@@ -2096,7 +2256,14 @@ function stepToUpsertInput(step) {
2096
2256
  ...step.input ?? {}
2097
2257
  },
2098
2258
  name: step.name ?? use.name,
2099
- description: use.description
2259
+ description: use.description,
2260
+ ...step.paths?.length ? {
2261
+ paths: step.paths.map((path) => ({
2262
+ label: path.label,
2263
+ ...path.when ? { when: path.when } : {},
2264
+ steps: path.steps.map(stepToUpsertInput)
2265
+ }))
2266
+ } : {}
2100
2267
  };
2101
2268
  }
2102
2269
  function workflowDefinitionToUpsert(def) {
@@ -2304,6 +2471,6 @@ function createServerClient(options) {
2304
2471
  });
2305
2472
  }
2306
2473
 
2307
- export { API_KEY_PREFIX, ActionsResource, AgentChatClient, AgentChatStream, AgentsResource, AiConnectionsResource, ApprovalsResource, AuthResource, ConnectionsResource, DEFINE_KINDS, DiscoveryResource, EntitiesResource, EntityTypesResource, ExecutionProgressStream, ExecutionTimeoutError, ExecutionsResource, HttpClient, KnowledgeResource, LunnoaApiError, LunnoaClient, QueueItemsResource, QueuesResource, RunsResource, ScorecardsResource, SsoAuthResource, TablesResource, TasksResource, VariablesResource, WorkflowAppsResource, WorkflowsResource, assertApiKeyAllowedInEnvironment, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineTrigger, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, parseSseEvents, parseSseStream, resolveActionAppId, resolveActionId, resolveTriggerAppId, resolveTriggerId };
2474
+ export { API_KEY_PREFIX, ActionsResource, AgentChatClient, AgentChatStream, AgentsResource, AiConnectionsResource, ApprovalsResource, AuthResource, ConnectionsResource, DEFINE_KINDS, DiscoveryResource, EntitiesResource, EntityTypesResource, ExecutionProgressStream, ExecutionTimeoutError, ExecutionsResource, HttpClient, KnowledgeResource, LunnoaApiError, LunnoaClient, PATH_CONDITIONS, QueueItemsResource, QueuesResource, RunsResource, ScorecardsResource, SsoAuthResource, TablesResource, TasksResource, VariablesResource, WorkflowAppsResource, WorkflowsResource, assertApiKeyAllowedInEnvironment, createBrowserClient, createLocalStorageTokenStore, createMemoryTokenStore, createServerClient, defineAction, defineAgent, defineAiConnection, defineConnection, defineEntityType, defineTrigger, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, parseSseEvents, parseSseStream, ref, resolveActionAppId, resolveActionId, resolveTriggerAppId, resolveTriggerId };
2308
2475
  //# sourceMappingURL=index.js.map
2309
2476
  //# sourceMappingURL=index.js.map