@lunnoa/client 2.2.0 → 2.4.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/react.d.cts CHANGED
@@ -810,13 +810,18 @@ interface components {
810
810
  requestedCount: number;
811
811
  };
812
812
  UpsertWorkflowStepDto: {
813
+ /**
814
+ * @description Name later steps use in ={{step:<key>,path}}. Keyed steps keep their node id across deploys. "trigger" is reserved.
815
+ * @example loadCase
816
+ */
817
+ key?: string;
813
818
  /** @description Workflow app id (catalogue slug). */
814
819
  appId: string;
815
820
  /** @description Catalogue action id. */
816
821
  actionId: string;
817
822
  /** @description Connection instance UUID for this step. */
818
823
  connectionId?: string;
819
- /** @description Action input / config fields. */
824
+ /** @description Action input / config fields. String values may use ={{step:trigger,field}} or ={{step:<key>,path,to,value}}. */
820
825
  input?: {
821
826
  [key: string]: unknown;
822
827
  };
@@ -825,6 +830,41 @@ interface components {
825
830
  /** @description Step description. */
826
831
  description?: string;
827
832
  };
833
+ UpsertWorkflowTriggerInputFieldDto: {
834
+ /** @description Field id. Callers pass this key to workflows.execute. */
835
+ id: string;
836
+ /** @description Label shown on the Manually Run form. */
837
+ label?: string;
838
+ description?: string;
839
+ /** @description text, number, date, or select. Defaults to text. */
840
+ inputType?: string;
841
+ /** @description true, or { missingMessage, missingStatus }. */
842
+ required?: boolean | {
843
+ [key: string]: unknown;
844
+ };
845
+ /** @description Used when the caller omits the field. */
846
+ defaultValue?: unknown;
847
+ selectOptions?: {
848
+ [key: string]: unknown;
849
+ }[];
850
+ };
851
+ UpsertWorkflowTriggerDto: {
852
+ /** @description Catalogue trigger id, for example flow-control_trigger_manual. */
853
+ triggerId: string;
854
+ /** @description Workflow app id. Inferred from triggerId when it contains _trigger_. */
855
+ appId?: string;
856
+ /** @description Connection instance UUID for this trigger. */
857
+ connectionId?: string;
858
+ /** @description Trigger config fields from the catalogue inputConfig. */
859
+ input?: {
860
+ [key: string]: unknown;
861
+ };
862
+ /** @description Manual-trigger fields. Stored on the trigger as customInputConfig. */
863
+ inputs?: components["schemas"]["UpsertWorkflowTriggerInputFieldDto"][];
864
+ /** @description Display name for the trigger node. */
865
+ name?: string;
866
+ description?: string;
867
+ };
828
868
  UpsertWorkflowBySlugDto: {
829
869
  /**
830
870
  * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
@@ -836,6 +876,8 @@ interface components {
836
876
  description?: string;
837
877
  /** @description Whether the workflow is active. */
838
878
  isActive?: boolean;
879
+ /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
880
+ trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
839
881
  /** @description Linear catalogue-action steps (v1; no branches). */
840
882
  steps: components["schemas"]["UpsertWorkflowStepDto"][];
841
883
  /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
@@ -1938,6 +1980,8 @@ interface components {
1938
1980
  executionPath?: components["schemas"]["ExecutionPathStepDto"][];
1939
1981
  };
1940
1982
  RunStepDto: {
1983
+ /** @description Name later steps use in ={{step:<key>,path}}. Ad-hoc runs have no trigger. */
1984
+ key?: string;
1941
1985
  /** @description Workflow app id (catalogue slug), e.g. `http`, `gmail`. */
1942
1986
  appId: string;
1943
1987
  /** @description Action id within the app, e.g. `http_action_send-request`. Discover via GET /workflow-apps. */
@@ -2651,6 +2695,7 @@ declare const DEFINE_KINDS: {
2651
2695
  readonly connection: "connection";
2652
2696
  readonly aiConnection: "aiConnection";
2653
2697
  readonly action: "action";
2698
+ readonly trigger: "trigger";
2654
2699
  readonly workflow: "workflow";
2655
2700
  readonly agent: "agent";
2656
2701
  readonly entityType: "entityType";
@@ -2685,10 +2730,52 @@ interface ActionDefinition {
2685
2730
  name?: string;
2686
2731
  description?: string;
2687
2732
  }
2733
+ /** One field on a Manually Run trigger. Stored as `customInputConfig`. */
2734
+ interface TriggerInputFieldDefinition {
2735
+ /** Field id. Callers pass this key to `workflows.execute`. */
2736
+ id: string;
2737
+ label?: string;
2738
+ description?: string;
2739
+ /** `text`, `number`, `date`, or `select`. Defaults to `text` on deploy. */
2740
+ inputType?: string;
2741
+ required?: boolean | {
2742
+ missingMessage?: string;
2743
+ missingStatus?: string;
2744
+ };
2745
+ defaultValue?: unknown;
2746
+ selectOptions?: Array<{
2747
+ label?: string;
2748
+ value?: string;
2749
+ }>;
2750
+ }
2751
+ /** Ref to a catalogue trigger. Credentials stay on the connection, when one is set. */
2752
+ interface TriggerDefinition {
2753
+ kind: typeof DEFINE_KINDS.trigger;
2754
+ /**
2755
+ * Catalogue trigger id, e.g. `flow-control_trigger_manual`.
2756
+ * Discover with `apps get <appId> --json` (`triggers[].triggerId`).
2757
+ */
2758
+ id: string;
2759
+ /** Workflow app id. Inferred from `id` when it matches `{app}_trigger_…`. */
2760
+ appId?: string;
2761
+ /** Optional Connection ref. Omit to let the platform resolve. */
2762
+ connection?: ConnectionDefinition;
2763
+ /** Catalogue trigger config (webhook method, schedule, app trigger fields). */
2764
+ input?: Record<string, unknown>;
2765
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
2766
+ inputs?: TriggerInputFieldDefinition[];
2767
+ name?: string;
2768
+ description?: string;
2769
+ }
2688
2770
  interface WorkflowStepDefinition {
2771
+ /**
2772
+ * Name later steps use with `ref.step(key, ...)`. Keyed steps keep their
2773
+ * node id across deploys. `trigger` is reserved.
2774
+ */
2775
+ key?: string;
2689
2776
  /** Action definition (or inline action-shaped object). */
2690
2777
  use: ActionDefinition;
2691
- /** Per-step input overrides. */
2778
+ /** Per-step input overrides. Values may contain `ref.trigger` / `ref.step`. */
2692
2779
  input?: Record<string, unknown>;
2693
2780
  name?: string;
2694
2781
  }
@@ -2699,6 +2786,11 @@ interface WorkflowDefinition {
2699
2786
  name?: string;
2700
2787
  description?: string;
2701
2788
  isActive?: boolean;
2789
+ /**
2790
+ * Catalogue trigger. Omit for Manually Run with no input fields.
2791
+ * `runs.start` ignores this and runs the steps only.
2792
+ */
2793
+ trigger?: TriggerDefinition;
2702
2794
  /** Linear steps (v1; no branches). */
2703
2795
  steps: WorkflowStepDefinition[];
2704
2796
  }
@@ -3310,6 +3402,8 @@ declare class QueuesResource {
3310
3402
  }
3311
3403
 
3312
3404
  interface StartRunStep {
3405
+ /** Name later steps use with `ref.step(key, ...)`. */
3406
+ key?: string;
3313
3407
  appId: string;
3314
3408
  actionId: string;
3315
3409
  connectionId?: string;
@@ -3462,6 +3556,8 @@ declare class VariablesResource {
3462
3556
  }
3463
3557
 
3464
3558
  interface UpsertWorkflowStepInput {
3559
+ /** Name later steps use in `={{step:<key>,path}}`. Keeps the node id stable. */
3560
+ key?: string;
3465
3561
  appId: string;
3466
3562
  actionId: string;
3467
3563
  connectionId?: string;
@@ -3469,11 +3565,24 @@ interface UpsertWorkflowStepInput {
3469
3565
  name?: string;
3470
3566
  description?: string;
3471
3567
  }
3568
+ interface UpsertWorkflowTriggerInput {
3569
+ triggerId: string;
3570
+ appId?: string;
3571
+ connectionId?: string;
3572
+ /** Catalogue trigger config. */
3573
+ input?: Record<string, unknown>;
3574
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
3575
+ inputs?: TriggerDefinition['inputs'];
3576
+ name?: string;
3577
+ description?: string;
3578
+ }
3472
3579
  interface UpsertWorkflowBySlugInput {
3473
3580
  slug: string;
3474
3581
  name?: string;
3475
3582
  description?: string;
3476
3583
  isActive?: boolean;
3584
+ /** Omit for Manually Run with no input fields. */
3585
+ trigger?: UpsertWorkflowTriggerInput;
3477
3586
  steps: UpsertWorkflowStepInput[];
3478
3587
  managedByCode?: boolean;
3479
3588
  }
package/dist/react.d.ts CHANGED
@@ -810,13 +810,18 @@ interface components {
810
810
  requestedCount: number;
811
811
  };
812
812
  UpsertWorkflowStepDto: {
813
+ /**
814
+ * @description Name later steps use in ={{step:<key>,path}}. Keyed steps keep their node id across deploys. "trigger" is reserved.
815
+ * @example loadCase
816
+ */
817
+ key?: string;
813
818
  /** @description Workflow app id (catalogue slug). */
814
819
  appId: string;
815
820
  /** @description Catalogue action id. */
816
821
  actionId: string;
817
822
  /** @description Connection instance UUID for this step. */
818
823
  connectionId?: string;
819
- /** @description Action input / config fields. */
824
+ /** @description Action input / config fields. String values may use ={{step:trigger,field}} or ={{step:<key>,path,to,value}}. */
820
825
  input?: {
821
826
  [key: string]: unknown;
822
827
  };
@@ -825,6 +830,41 @@ interface components {
825
830
  /** @description Step description. */
826
831
  description?: string;
827
832
  };
833
+ UpsertWorkflowTriggerInputFieldDto: {
834
+ /** @description Field id. Callers pass this key to workflows.execute. */
835
+ id: string;
836
+ /** @description Label shown on the Manually Run form. */
837
+ label?: string;
838
+ description?: string;
839
+ /** @description text, number, date, or select. Defaults to text. */
840
+ inputType?: string;
841
+ /** @description true, or { missingMessage, missingStatus }. */
842
+ required?: boolean | {
843
+ [key: string]: unknown;
844
+ };
845
+ /** @description Used when the caller omits the field. */
846
+ defaultValue?: unknown;
847
+ selectOptions?: {
848
+ [key: string]: unknown;
849
+ }[];
850
+ };
851
+ UpsertWorkflowTriggerDto: {
852
+ /** @description Catalogue trigger id, for example flow-control_trigger_manual. */
853
+ triggerId: string;
854
+ /** @description Workflow app id. Inferred from triggerId when it contains _trigger_. */
855
+ appId?: string;
856
+ /** @description Connection instance UUID for this trigger. */
857
+ connectionId?: string;
858
+ /** @description Trigger config fields from the catalogue inputConfig. */
859
+ input?: {
860
+ [key: string]: unknown;
861
+ };
862
+ /** @description Manual-trigger fields. Stored on the trigger as customInputConfig. */
863
+ inputs?: components["schemas"]["UpsertWorkflowTriggerInputFieldDto"][];
864
+ /** @description Display name for the trigger node. */
865
+ name?: string;
866
+ description?: string;
867
+ };
828
868
  UpsertWorkflowBySlugDto: {
829
869
  /**
830
870
  * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
@@ -836,6 +876,8 @@ interface components {
836
876
  description?: string;
837
877
  /** @description Whether the workflow is active. */
838
878
  isActive?: boolean;
879
+ /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
880
+ trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
839
881
  /** @description Linear catalogue-action steps (v1; no branches). */
840
882
  steps: components["schemas"]["UpsertWorkflowStepDto"][];
841
883
  /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
@@ -1938,6 +1980,8 @@ interface components {
1938
1980
  executionPath?: components["schemas"]["ExecutionPathStepDto"][];
1939
1981
  };
1940
1982
  RunStepDto: {
1983
+ /** @description Name later steps use in ={{step:<key>,path}}. Ad-hoc runs have no trigger. */
1984
+ key?: string;
1941
1985
  /** @description Workflow app id (catalogue slug), e.g. `http`, `gmail`. */
1942
1986
  appId: string;
1943
1987
  /** @description Action id within the app, e.g. `http_action_send-request`. Discover via GET /workflow-apps. */
@@ -2651,6 +2695,7 @@ declare const DEFINE_KINDS: {
2651
2695
  readonly connection: "connection";
2652
2696
  readonly aiConnection: "aiConnection";
2653
2697
  readonly action: "action";
2698
+ readonly trigger: "trigger";
2654
2699
  readonly workflow: "workflow";
2655
2700
  readonly agent: "agent";
2656
2701
  readonly entityType: "entityType";
@@ -2685,10 +2730,52 @@ interface ActionDefinition {
2685
2730
  name?: string;
2686
2731
  description?: string;
2687
2732
  }
2733
+ /** One field on a Manually Run trigger. Stored as `customInputConfig`. */
2734
+ interface TriggerInputFieldDefinition {
2735
+ /** Field id. Callers pass this key to `workflows.execute`. */
2736
+ id: string;
2737
+ label?: string;
2738
+ description?: string;
2739
+ /** `text`, `number`, `date`, or `select`. Defaults to `text` on deploy. */
2740
+ inputType?: string;
2741
+ required?: boolean | {
2742
+ missingMessage?: string;
2743
+ missingStatus?: string;
2744
+ };
2745
+ defaultValue?: unknown;
2746
+ selectOptions?: Array<{
2747
+ label?: string;
2748
+ value?: string;
2749
+ }>;
2750
+ }
2751
+ /** Ref to a catalogue trigger. Credentials stay on the connection, when one is set. */
2752
+ interface TriggerDefinition {
2753
+ kind: typeof DEFINE_KINDS.trigger;
2754
+ /**
2755
+ * Catalogue trigger id, e.g. `flow-control_trigger_manual`.
2756
+ * Discover with `apps get <appId> --json` (`triggers[].triggerId`).
2757
+ */
2758
+ id: string;
2759
+ /** Workflow app id. Inferred from `id` when it matches `{app}_trigger_…`. */
2760
+ appId?: string;
2761
+ /** Optional Connection ref. Omit to let the platform resolve. */
2762
+ connection?: ConnectionDefinition;
2763
+ /** Catalogue trigger config (webhook method, schedule, app trigger fields). */
2764
+ input?: Record<string, unknown>;
2765
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
2766
+ inputs?: TriggerInputFieldDefinition[];
2767
+ name?: string;
2768
+ description?: string;
2769
+ }
2688
2770
  interface WorkflowStepDefinition {
2771
+ /**
2772
+ * Name later steps use with `ref.step(key, ...)`. Keyed steps keep their
2773
+ * node id across deploys. `trigger` is reserved.
2774
+ */
2775
+ key?: string;
2689
2776
  /** Action definition (or inline action-shaped object). */
2690
2777
  use: ActionDefinition;
2691
- /** Per-step input overrides. */
2778
+ /** Per-step input overrides. Values may contain `ref.trigger` / `ref.step`. */
2692
2779
  input?: Record<string, unknown>;
2693
2780
  name?: string;
2694
2781
  }
@@ -2699,6 +2786,11 @@ interface WorkflowDefinition {
2699
2786
  name?: string;
2700
2787
  description?: string;
2701
2788
  isActive?: boolean;
2789
+ /**
2790
+ * Catalogue trigger. Omit for Manually Run with no input fields.
2791
+ * `runs.start` ignores this and runs the steps only.
2792
+ */
2793
+ trigger?: TriggerDefinition;
2702
2794
  /** Linear steps (v1; no branches). */
2703
2795
  steps: WorkflowStepDefinition[];
2704
2796
  }
@@ -3310,6 +3402,8 @@ declare class QueuesResource {
3310
3402
  }
3311
3403
 
3312
3404
  interface StartRunStep {
3405
+ /** Name later steps use with `ref.step(key, ...)`. */
3406
+ key?: string;
3313
3407
  appId: string;
3314
3408
  actionId: string;
3315
3409
  connectionId?: string;
@@ -3462,6 +3556,8 @@ declare class VariablesResource {
3462
3556
  }
3463
3557
 
3464
3558
  interface UpsertWorkflowStepInput {
3559
+ /** Name later steps use in `={{step:<key>,path}}`. Keeps the node id stable. */
3560
+ key?: string;
3465
3561
  appId: string;
3466
3562
  actionId: string;
3467
3563
  connectionId?: string;
@@ -3469,11 +3565,24 @@ interface UpsertWorkflowStepInput {
3469
3565
  name?: string;
3470
3566
  description?: string;
3471
3567
  }
3568
+ interface UpsertWorkflowTriggerInput {
3569
+ triggerId: string;
3570
+ appId?: string;
3571
+ connectionId?: string;
3572
+ /** Catalogue trigger config. */
3573
+ input?: Record<string, unknown>;
3574
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
3575
+ inputs?: TriggerDefinition['inputs'];
3576
+ name?: string;
3577
+ description?: string;
3578
+ }
3472
3579
  interface UpsertWorkflowBySlugInput {
3473
3580
  slug: string;
3474
3581
  name?: string;
3475
3582
  description?: string;
3476
3583
  isActive?: boolean;
3584
+ /** Omit for Manually Run with no input fields. */
3585
+ trigger?: UpsertWorkflowTriggerInput;
3477
3586
  steps: UpsertWorkflowStepInput[];
3478
3587
  managedByCode?: boolean;
3479
3588
  }
package/dist/react.js CHANGED
@@ -602,6 +602,40 @@ function resolveActionAppId(action) {
602
602
  `Cannot infer appId for action "${id}". Pass appId explicitly.`
603
603
  );
604
604
  }
605
+ function resolveTriggerAppId(trigger) {
606
+ if (trigger.appId?.trim()) {
607
+ return trigger.appId.trim();
608
+ }
609
+ const id = trigger.id.trim();
610
+ const marker = "_trigger_";
611
+ const markerIndex = id.indexOf(marker);
612
+ if (markerIndex > 0) {
613
+ return id.slice(0, markerIndex);
614
+ }
615
+ const dot = id.indexOf(".");
616
+ if (dot > 0) {
617
+ return id.slice(0, dot);
618
+ }
619
+ throw new Error(
620
+ `Cannot infer appId for trigger "${id}". Pass appId explicitly.`
621
+ );
622
+ }
623
+ function resolveTriggerId(trigger) {
624
+ const id = trigger.id.trim();
625
+ const appId = trigger.appId?.trim();
626
+ if (appId && id.startsWith(`${appId}.`)) {
627
+ return id.slice(appId.length + 1);
628
+ }
629
+ const marker = "_trigger_";
630
+ if (id.includes(marker)) {
631
+ return id;
632
+ }
633
+ const dot = id.indexOf(".");
634
+ if (dot > 0) {
635
+ return id.slice(dot + 1);
636
+ }
637
+ return id;
638
+ }
605
639
  function resolveActionId(action) {
606
640
  const id = action.id.trim();
607
641
  const appId = action.appId?.trim();
@@ -1814,7 +1848,9 @@ function stepFromDefinition(step) {
1814
1848
  ...use.input ?? {},
1815
1849
  ...step.input ?? {}
1816
1850
  };
1851
+ const key = step.key;
1817
1852
  return {
1853
+ ...key ? { key } : {},
1818
1854
  appId: resolveActionAppId(use),
1819
1855
  actionId: resolveActionId(use),
1820
1856
  ...use.connection?.id ? { connectionId: use.connection.id } : {},
@@ -2016,9 +2052,21 @@ var WorkflowAppsResource = class {
2016
2052
  };
2017
2053
 
2018
2054
  // src/resources/workflows.ts
2055
+ function triggerToUpsertInput(trigger) {
2056
+ return {
2057
+ triggerId: resolveTriggerId(trigger),
2058
+ appId: resolveTriggerAppId(trigger),
2059
+ ...trigger.connection?.id ? { connectionId: trigger.connection.id } : {},
2060
+ ...trigger.input ? { input: trigger.input } : {},
2061
+ ...trigger.inputs?.length ? { inputs: trigger.inputs } : {},
2062
+ ...trigger.name ? { name: trigger.name } : {},
2063
+ ...trigger.description ? { description: trigger.description } : {}
2064
+ };
2065
+ }
2019
2066
  function stepToUpsertInput(step) {
2020
2067
  const use = step.use;
2021
2068
  return {
2069
+ ...step.key ? { key: step.key } : {},
2022
2070
  appId: resolveActionAppId(use),
2023
2071
  actionId: resolveActionId(use),
2024
2072
  connectionId: use.connection?.id,
@@ -2036,6 +2084,7 @@ function workflowDefinitionToUpsert(def) {
2036
2084
  name: def.name,
2037
2085
  description: def.description,
2038
2086
  isActive: def.isActive,
2087
+ ...def.trigger ? { trigger: triggerToUpsertInput(def.trigger) } : {},
2039
2088
  managedByCode: true,
2040
2089
  steps: def.steps.map(stepToUpsertInput)
2041
2090
  };