@lunnoa/client 2.2.0 → 2.3.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
@@ -825,6 +825,41 @@ interface components {
825
825
  /** @description Step description. */
826
826
  description?: string;
827
827
  };
828
+ UpsertWorkflowTriggerInputFieldDto: {
829
+ /** @description Field id. Callers pass this key to workflows.execute. */
830
+ id: string;
831
+ /** @description Label shown on the Manually Run form. */
832
+ label?: string;
833
+ description?: string;
834
+ /** @description text, number, date, or select. Defaults to text. */
835
+ inputType?: string;
836
+ /** @description true, or { missingMessage, missingStatus }. */
837
+ required?: boolean | {
838
+ [key: string]: unknown;
839
+ };
840
+ /** @description Used when the caller omits the field. */
841
+ defaultValue?: unknown;
842
+ selectOptions?: {
843
+ [key: string]: unknown;
844
+ }[];
845
+ };
846
+ UpsertWorkflowTriggerDto: {
847
+ /** @description Catalogue trigger id, for example flow-control_trigger_manual. */
848
+ triggerId: string;
849
+ /** @description Workflow app id. Inferred from triggerId when it contains _trigger_. */
850
+ appId?: string;
851
+ /** @description Connection instance UUID for this trigger. */
852
+ connectionId?: string;
853
+ /** @description Trigger config fields from the catalogue inputConfig. */
854
+ input?: {
855
+ [key: string]: unknown;
856
+ };
857
+ /** @description Manual-trigger fields. Stored on the trigger as customInputConfig. */
858
+ inputs?: components["schemas"]["UpsertWorkflowTriggerInputFieldDto"][];
859
+ /** @description Display name for the trigger node. */
860
+ name?: string;
861
+ description?: string;
862
+ };
828
863
  UpsertWorkflowBySlugDto: {
829
864
  /**
830
865
  * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
@@ -836,6 +871,8 @@ interface components {
836
871
  description?: string;
837
872
  /** @description Whether the workflow is active. */
838
873
  isActive?: boolean;
874
+ /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
875
+ trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
839
876
  /** @description Linear catalogue-action steps (v1; no branches). */
840
877
  steps: components["schemas"]["UpsertWorkflowStepDto"][];
841
878
  /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
@@ -2651,6 +2688,7 @@ declare const DEFINE_KINDS: {
2651
2688
  readonly connection: "connection";
2652
2689
  readonly aiConnection: "aiConnection";
2653
2690
  readonly action: "action";
2691
+ readonly trigger: "trigger";
2654
2692
  readonly workflow: "workflow";
2655
2693
  readonly agent: "agent";
2656
2694
  readonly entityType: "entityType";
@@ -2685,6 +2723,43 @@ interface ActionDefinition {
2685
2723
  name?: string;
2686
2724
  description?: string;
2687
2725
  }
2726
+ /** One field on a Manually Run trigger. Stored as `customInputConfig`. */
2727
+ interface TriggerInputFieldDefinition {
2728
+ /** Field id. Callers pass this key to `workflows.execute`. */
2729
+ id: string;
2730
+ label?: string;
2731
+ description?: string;
2732
+ /** `text`, `number`, `date`, or `select`. Defaults to `text` on deploy. */
2733
+ inputType?: string;
2734
+ required?: boolean | {
2735
+ missingMessage?: string;
2736
+ missingStatus?: string;
2737
+ };
2738
+ defaultValue?: unknown;
2739
+ selectOptions?: Array<{
2740
+ label?: string;
2741
+ value?: string;
2742
+ }>;
2743
+ }
2744
+ /** Ref to a catalogue trigger. Credentials stay on the connection, when one is set. */
2745
+ interface TriggerDefinition {
2746
+ kind: typeof DEFINE_KINDS.trigger;
2747
+ /**
2748
+ * Catalogue trigger id, e.g. `flow-control_trigger_manual`.
2749
+ * Discover with `apps get <appId> --json` (`triggers[].triggerId`).
2750
+ */
2751
+ id: string;
2752
+ /** Workflow app id. Inferred from `id` when it matches `{app}_trigger_…`. */
2753
+ appId?: string;
2754
+ /** Optional Connection ref. Omit to let the platform resolve. */
2755
+ connection?: ConnectionDefinition;
2756
+ /** Catalogue trigger config (webhook method, schedule, app trigger fields). */
2757
+ input?: Record<string, unknown>;
2758
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
2759
+ inputs?: TriggerInputFieldDefinition[];
2760
+ name?: string;
2761
+ description?: string;
2762
+ }
2688
2763
  interface WorkflowStepDefinition {
2689
2764
  /** Action definition (or inline action-shaped object). */
2690
2765
  use: ActionDefinition;
@@ -2699,6 +2774,11 @@ interface WorkflowDefinition {
2699
2774
  name?: string;
2700
2775
  description?: string;
2701
2776
  isActive?: boolean;
2777
+ /**
2778
+ * Catalogue trigger. Omit for Manually Run with no input fields.
2779
+ * `runs.start` ignores this and runs the steps only.
2780
+ */
2781
+ trigger?: TriggerDefinition;
2702
2782
  /** Linear steps (v1; no branches). */
2703
2783
  steps: WorkflowStepDefinition[];
2704
2784
  }
@@ -3469,11 +3549,24 @@ interface UpsertWorkflowStepInput {
3469
3549
  name?: string;
3470
3550
  description?: string;
3471
3551
  }
3552
+ interface UpsertWorkflowTriggerInput {
3553
+ triggerId: string;
3554
+ appId?: string;
3555
+ connectionId?: string;
3556
+ /** Catalogue trigger config. */
3557
+ input?: Record<string, unknown>;
3558
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
3559
+ inputs?: TriggerDefinition['inputs'];
3560
+ name?: string;
3561
+ description?: string;
3562
+ }
3472
3563
  interface UpsertWorkflowBySlugInput {
3473
3564
  slug: string;
3474
3565
  name?: string;
3475
3566
  description?: string;
3476
3567
  isActive?: boolean;
3568
+ /** Omit for Manually Run with no input fields. */
3569
+ trigger?: UpsertWorkflowTriggerInput;
3477
3570
  steps: UpsertWorkflowStepInput[];
3478
3571
  managedByCode?: boolean;
3479
3572
  }
package/dist/react.d.ts CHANGED
@@ -825,6 +825,41 @@ interface components {
825
825
  /** @description Step description. */
826
826
  description?: string;
827
827
  };
828
+ UpsertWorkflowTriggerInputFieldDto: {
829
+ /** @description Field id. Callers pass this key to workflows.execute. */
830
+ id: string;
831
+ /** @description Label shown on the Manually Run form. */
832
+ label?: string;
833
+ description?: string;
834
+ /** @description text, number, date, or select. Defaults to text. */
835
+ inputType?: string;
836
+ /** @description true, or { missingMessage, missingStatus }. */
837
+ required?: boolean | {
838
+ [key: string]: unknown;
839
+ };
840
+ /** @description Used when the caller omits the field. */
841
+ defaultValue?: unknown;
842
+ selectOptions?: {
843
+ [key: string]: unknown;
844
+ }[];
845
+ };
846
+ UpsertWorkflowTriggerDto: {
847
+ /** @description Catalogue trigger id, for example flow-control_trigger_manual. */
848
+ triggerId: string;
849
+ /** @description Workflow app id. Inferred from triggerId when it contains _trigger_. */
850
+ appId?: string;
851
+ /** @description Connection instance UUID for this trigger. */
852
+ connectionId?: string;
853
+ /** @description Trigger config fields from the catalogue inputConfig. */
854
+ input?: {
855
+ [key: string]: unknown;
856
+ };
857
+ /** @description Manual-trigger fields. Stored on the trigger as customInputConfig. */
858
+ inputs?: components["schemas"]["UpsertWorkflowTriggerInputFieldDto"][];
859
+ /** @description Display name for the trigger node. */
860
+ name?: string;
861
+ description?: string;
862
+ };
828
863
  UpsertWorkflowBySlugDto: {
829
864
  /**
830
865
  * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
@@ -836,6 +871,8 @@ interface components {
836
871
  description?: string;
837
872
  /** @description Whether the workflow is active. */
838
873
  isActive?: boolean;
874
+ /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
875
+ trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
839
876
  /** @description Linear catalogue-action steps (v1; no branches). */
840
877
  steps: components["schemas"]["UpsertWorkflowStepDto"][];
841
878
  /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
@@ -2651,6 +2688,7 @@ declare const DEFINE_KINDS: {
2651
2688
  readonly connection: "connection";
2652
2689
  readonly aiConnection: "aiConnection";
2653
2690
  readonly action: "action";
2691
+ readonly trigger: "trigger";
2654
2692
  readonly workflow: "workflow";
2655
2693
  readonly agent: "agent";
2656
2694
  readonly entityType: "entityType";
@@ -2685,6 +2723,43 @@ interface ActionDefinition {
2685
2723
  name?: string;
2686
2724
  description?: string;
2687
2725
  }
2726
+ /** One field on a Manually Run trigger. Stored as `customInputConfig`. */
2727
+ interface TriggerInputFieldDefinition {
2728
+ /** Field id. Callers pass this key to `workflows.execute`. */
2729
+ id: string;
2730
+ label?: string;
2731
+ description?: string;
2732
+ /** `text`, `number`, `date`, or `select`. Defaults to `text` on deploy. */
2733
+ inputType?: string;
2734
+ required?: boolean | {
2735
+ missingMessage?: string;
2736
+ missingStatus?: string;
2737
+ };
2738
+ defaultValue?: unknown;
2739
+ selectOptions?: Array<{
2740
+ label?: string;
2741
+ value?: string;
2742
+ }>;
2743
+ }
2744
+ /** Ref to a catalogue trigger. Credentials stay on the connection, when one is set. */
2745
+ interface TriggerDefinition {
2746
+ kind: typeof DEFINE_KINDS.trigger;
2747
+ /**
2748
+ * Catalogue trigger id, e.g. `flow-control_trigger_manual`.
2749
+ * Discover with `apps get <appId> --json` (`triggers[].triggerId`).
2750
+ */
2751
+ id: string;
2752
+ /** Workflow app id. Inferred from `id` when it matches `{app}_trigger_…`. */
2753
+ appId?: string;
2754
+ /** Optional Connection ref. Omit to let the platform resolve. */
2755
+ connection?: ConnectionDefinition;
2756
+ /** Catalogue trigger config (webhook method, schedule, app trigger fields). */
2757
+ input?: Record<string, unknown>;
2758
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
2759
+ inputs?: TriggerInputFieldDefinition[];
2760
+ name?: string;
2761
+ description?: string;
2762
+ }
2688
2763
  interface WorkflowStepDefinition {
2689
2764
  /** Action definition (or inline action-shaped object). */
2690
2765
  use: ActionDefinition;
@@ -2699,6 +2774,11 @@ interface WorkflowDefinition {
2699
2774
  name?: string;
2700
2775
  description?: string;
2701
2776
  isActive?: boolean;
2777
+ /**
2778
+ * Catalogue trigger. Omit for Manually Run with no input fields.
2779
+ * `runs.start` ignores this and runs the steps only.
2780
+ */
2781
+ trigger?: TriggerDefinition;
2702
2782
  /** Linear steps (v1; no branches). */
2703
2783
  steps: WorkflowStepDefinition[];
2704
2784
  }
@@ -3469,11 +3549,24 @@ interface UpsertWorkflowStepInput {
3469
3549
  name?: string;
3470
3550
  description?: string;
3471
3551
  }
3552
+ interface UpsertWorkflowTriggerInput {
3553
+ triggerId: string;
3554
+ appId?: string;
3555
+ connectionId?: string;
3556
+ /** Catalogue trigger config. */
3557
+ input?: Record<string, unknown>;
3558
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
3559
+ inputs?: TriggerDefinition['inputs'];
3560
+ name?: string;
3561
+ description?: string;
3562
+ }
3472
3563
  interface UpsertWorkflowBySlugInput {
3473
3564
  slug: string;
3474
3565
  name?: string;
3475
3566
  description?: string;
3476
3567
  isActive?: boolean;
3568
+ /** Omit for Manually Run with no input fields. */
3569
+ trigger?: UpsertWorkflowTriggerInput;
3477
3570
  steps: UpsertWorkflowStepInput[];
3478
3571
  managedByCode?: boolean;
3479
3572
  }
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();
@@ -2016,6 +2050,17 @@ var WorkflowAppsResource = class {
2016
2050
  };
2017
2051
 
2018
2052
  // src/resources/workflows.ts
2053
+ function triggerToUpsertInput(trigger) {
2054
+ return {
2055
+ triggerId: resolveTriggerId(trigger),
2056
+ appId: resolveTriggerAppId(trigger),
2057
+ ...trigger.connection?.id ? { connectionId: trigger.connection.id } : {},
2058
+ ...trigger.input ? { input: trigger.input } : {},
2059
+ ...trigger.inputs?.length ? { inputs: trigger.inputs } : {},
2060
+ ...trigger.name ? { name: trigger.name } : {},
2061
+ ...trigger.description ? { description: trigger.description } : {}
2062
+ };
2063
+ }
2019
2064
  function stepToUpsertInput(step) {
2020
2065
  const use = step.use;
2021
2066
  return {
@@ -2036,6 +2081,7 @@ function workflowDefinitionToUpsert(def) {
2036
2081
  name: def.name,
2037
2082
  description: def.description,
2038
2083
  isActive: def.isActive,
2084
+ ...def.trigger ? { trigger: triggerToUpsertInput(def.trigger) } : {},
2039
2085
  managedByCode: true,
2040
2086
  steps: def.steps.map(stepToUpsertInput)
2041
2087
  };