@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/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 (manual trigger → 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 linear catalogue-action steps). 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;
@@ -2314,6 +2314,41 @@ interface components {
2314
2314
  /** @description Step description. */
2315
2315
  description?: string;
2316
2316
  };
2317
+ UpsertWorkflowTriggerInputFieldDto: {
2318
+ /** @description Field id. Callers pass this key to workflows.execute. */
2319
+ id: string;
2320
+ /** @description Label shown on the Manually Run form. */
2321
+ label?: string;
2322
+ description?: string;
2323
+ /** @description text, number, date, or select. Defaults to text. */
2324
+ inputType?: string;
2325
+ /** @description true, or { missingMessage, missingStatus }. */
2326
+ required?: boolean | {
2327
+ [key: string]: unknown;
2328
+ };
2329
+ /** @description Used when the caller omits the field. */
2330
+ defaultValue?: unknown;
2331
+ selectOptions?: {
2332
+ [key: string]: unknown;
2333
+ }[];
2334
+ };
2335
+ UpsertWorkflowTriggerDto: {
2336
+ /** @description Catalogue trigger id, for example flow-control_trigger_manual. */
2337
+ triggerId: string;
2338
+ /** @description Workflow app id. Inferred from triggerId when it contains _trigger_. */
2339
+ appId?: string;
2340
+ /** @description Connection instance UUID for this trigger. */
2341
+ connectionId?: string;
2342
+ /** @description Trigger config fields from the catalogue inputConfig. */
2343
+ input?: {
2344
+ [key: string]: unknown;
2345
+ };
2346
+ /** @description Manual-trigger fields. Stored on the trigger as customInputConfig. */
2347
+ inputs?: components["schemas"]["UpsertWorkflowTriggerInputFieldDto"][];
2348
+ /** @description Display name for the trigger node. */
2349
+ name?: string;
2350
+ description?: string;
2351
+ };
2317
2352
  UpsertWorkflowBySlugDto: {
2318
2353
  /**
2319
2354
  * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
@@ -2325,6 +2360,8 @@ interface components {
2325
2360
  description?: string;
2326
2361
  /** @description Whether the workflow is active. */
2327
2362
  isActive?: boolean;
2363
+ /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
2364
+ trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
2328
2365
  /** @description Linear catalogue-action steps (v1; no branches). */
2329
2366
  steps: components["schemas"]["UpsertWorkflowStepDto"][];
2330
2367
  /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
@@ -6605,6 +6642,7 @@ declare const DEFINE_KINDS: {
6605
6642
  readonly connection: "connection";
6606
6643
  readonly aiConnection: "aiConnection";
6607
6644
  readonly action: "action";
6645
+ readonly trigger: "trigger";
6608
6646
  readonly workflow: "workflow";
6609
6647
  readonly agent: "agent";
6610
6648
  readonly entityType: "entityType";
@@ -6640,6 +6678,43 @@ interface ActionDefinition {
6640
6678
  name?: string;
6641
6679
  description?: string;
6642
6680
  }
6681
+ /** One field on a Manually Run trigger. Stored as `customInputConfig`. */
6682
+ interface TriggerInputFieldDefinition {
6683
+ /** Field id. Callers pass this key to `workflows.execute`. */
6684
+ id: string;
6685
+ label?: string;
6686
+ description?: string;
6687
+ /** `text`, `number`, `date`, or `select`. Defaults to `text` on deploy. */
6688
+ inputType?: string;
6689
+ required?: boolean | {
6690
+ missingMessage?: string;
6691
+ missingStatus?: string;
6692
+ };
6693
+ defaultValue?: unknown;
6694
+ selectOptions?: Array<{
6695
+ label?: string;
6696
+ value?: string;
6697
+ }>;
6698
+ }
6699
+ /** Ref to a catalogue trigger. Credentials stay on the connection, when one is set. */
6700
+ interface TriggerDefinition {
6701
+ kind: typeof DEFINE_KINDS.trigger;
6702
+ /**
6703
+ * Catalogue trigger id, e.g. `flow-control_trigger_manual`.
6704
+ * Discover with `apps get <appId> --json` (`triggers[].triggerId`).
6705
+ */
6706
+ id: string;
6707
+ /** Workflow app id. Inferred from `id` when it matches `{app}_trigger_…`. */
6708
+ appId?: string;
6709
+ /** Optional Connection ref. Omit to let the platform resolve. */
6710
+ connection?: ConnectionDefinition;
6711
+ /** Catalogue trigger config (webhook method, schedule, app trigger fields). */
6712
+ input?: Record<string, unknown>;
6713
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
6714
+ inputs?: TriggerInputFieldDefinition[];
6715
+ name?: string;
6716
+ description?: string;
6717
+ }
6643
6718
  interface WorkflowStepDefinition {
6644
6719
  /** Action definition (or inline action-shaped object). */
6645
6720
  use: ActionDefinition;
@@ -6654,6 +6729,11 @@ interface WorkflowDefinition {
6654
6729
  name?: string;
6655
6730
  description?: string;
6656
6731
  isActive?: boolean;
6732
+ /**
6733
+ * Catalogue trigger. Omit for Manually Run with no input fields.
6734
+ * `runs.start` ignores this and runs the steps only.
6735
+ */
6736
+ trigger?: TriggerDefinition;
6657
6737
  /** Linear steps (v1; no branches). */
6658
6738
  steps: WorkflowStepDefinition[];
6659
6739
  }
@@ -6681,6 +6761,7 @@ interface AgentDefinition {
6681
6761
  declare function defineConnection(config?: Omit<ConnectionDefinition, 'kind'>): ConnectionDefinition;
6682
6762
  declare function defineAiConnection(config?: Omit<AiConnectionDefinition, 'kind'>): AiConnectionDefinition;
6683
6763
  declare function defineAction(config: Omit<ActionDefinition, 'kind'>): ActionDefinition;
6764
+ declare function defineTrigger(config: Omit<TriggerDefinition, 'kind'>): TriggerDefinition;
6684
6765
  declare function defineWorkflow(config: Omit<WorkflowDefinition, 'kind'>): WorkflowDefinition;
6685
6766
  declare function defineAgent(config: Omit<AgentDefinition, 'kind'>): AgentDefinition;
6686
6767
  interface EntityTypeDefinition {
@@ -6705,6 +6786,9 @@ interface EntityTypeDefinition {
6705
6786
  declare function defineEntityType(config: Omit<EntityTypeDefinition, 'kind'>): EntityTypeDefinition;
6706
6787
  /** Infer appId from catalogue action ids like `http_action_send-request`. */
6707
6788
  declare function resolveActionAppId(action: ActionDefinition): string;
6789
+ /** Infer appId from catalogue trigger ids like `flow-control_trigger_manual`. */
6790
+ declare function resolveTriggerAppId(trigger: TriggerDefinition): string;
6791
+ declare function resolveTriggerId(trigger: TriggerDefinition): string;
6708
6792
  declare function resolveActionId(action: ActionDefinition): string;
6709
6793
 
6710
6794
  interface UpsertAgentToolInput {
@@ -7435,11 +7519,24 @@ interface UpsertWorkflowStepInput {
7435
7519
  name?: string;
7436
7520
  description?: string;
7437
7521
  }
7522
+ interface UpsertWorkflowTriggerInput {
7523
+ triggerId: string;
7524
+ appId?: string;
7525
+ connectionId?: string;
7526
+ /** Catalogue trigger config. */
7527
+ input?: Record<string, unknown>;
7528
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
7529
+ inputs?: TriggerDefinition['inputs'];
7530
+ name?: string;
7531
+ description?: string;
7532
+ }
7438
7533
  interface UpsertWorkflowBySlugInput {
7439
7534
  slug: string;
7440
7535
  name?: string;
7441
7536
  description?: string;
7442
7537
  isActive?: boolean;
7538
+ /** Omit for Manually Run with no input fields. */
7539
+ trigger?: UpsertWorkflowTriggerInput;
7443
7540
  steps: UpsertWorkflowStepInput[];
7444
7541
  managedByCode?: boolean;
7445
7542
  }
@@ -7668,4 +7765,4 @@ interface CreateServerClientOptions {
7668
7765
  */
7669
7766
  declare function createServerClient(options: CreateServerClientOptions): LunnoaClient;
7670
7767
 
7671
- 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 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 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, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, type operations, parseSseEvents, parseSseStream, type paths, resolveActionAppId, resolveActionId };
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 };
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 (manual trigger → 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 linear catalogue-action steps). 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;
@@ -2314,6 +2314,41 @@ interface components {
2314
2314
  /** @description Step description. */
2315
2315
  description?: string;
2316
2316
  };
2317
+ UpsertWorkflowTriggerInputFieldDto: {
2318
+ /** @description Field id. Callers pass this key to workflows.execute. */
2319
+ id: string;
2320
+ /** @description Label shown on the Manually Run form. */
2321
+ label?: string;
2322
+ description?: string;
2323
+ /** @description text, number, date, or select. Defaults to text. */
2324
+ inputType?: string;
2325
+ /** @description true, or { missingMessage, missingStatus }. */
2326
+ required?: boolean | {
2327
+ [key: string]: unknown;
2328
+ };
2329
+ /** @description Used when the caller omits the field. */
2330
+ defaultValue?: unknown;
2331
+ selectOptions?: {
2332
+ [key: string]: unknown;
2333
+ }[];
2334
+ };
2335
+ UpsertWorkflowTriggerDto: {
2336
+ /** @description Catalogue trigger id, for example flow-control_trigger_manual. */
2337
+ triggerId: string;
2338
+ /** @description Workflow app id. Inferred from triggerId when it contains _trigger_. */
2339
+ appId?: string;
2340
+ /** @description Connection instance UUID for this trigger. */
2341
+ connectionId?: string;
2342
+ /** @description Trigger config fields from the catalogue inputConfig. */
2343
+ input?: {
2344
+ [key: string]: unknown;
2345
+ };
2346
+ /** @description Manual-trigger fields. Stored on the trigger as customInputConfig. */
2347
+ inputs?: components["schemas"]["UpsertWorkflowTriggerInputFieldDto"][];
2348
+ /** @description Display name for the trigger node. */
2349
+ name?: string;
2350
+ description?: string;
2351
+ };
2317
2352
  UpsertWorkflowBySlugDto: {
2318
2353
  /**
2319
2354
  * @description Stable workspace-scoped slug (lowercase, digits, hyphens). Used as the upsert key.
@@ -2325,6 +2360,8 @@ interface components {
2325
2360
  description?: string;
2326
2361
  /** @description Whether the workflow is active. */
2327
2362
  isActive?: boolean;
2363
+ /** @description Catalogue trigger. Omit for a Manually Run trigger with no input fields. */
2364
+ trigger?: components["schemas"]["UpsertWorkflowTriggerDto"];
2328
2365
  /** @description Linear catalogue-action steps (v1; no branches). */
2329
2366
  steps: components["schemas"]["UpsertWorkflowStepDto"][];
2330
2367
  /** @description Marks the row as managed by code (CLI / SDK). Defaults to true on this endpoint. */
@@ -6605,6 +6642,7 @@ declare const DEFINE_KINDS: {
6605
6642
  readonly connection: "connection";
6606
6643
  readonly aiConnection: "aiConnection";
6607
6644
  readonly action: "action";
6645
+ readonly trigger: "trigger";
6608
6646
  readonly workflow: "workflow";
6609
6647
  readonly agent: "agent";
6610
6648
  readonly entityType: "entityType";
@@ -6640,6 +6678,43 @@ interface ActionDefinition {
6640
6678
  name?: string;
6641
6679
  description?: string;
6642
6680
  }
6681
+ /** One field on a Manually Run trigger. Stored as `customInputConfig`. */
6682
+ interface TriggerInputFieldDefinition {
6683
+ /** Field id. Callers pass this key to `workflows.execute`. */
6684
+ id: string;
6685
+ label?: string;
6686
+ description?: string;
6687
+ /** `text`, `number`, `date`, or `select`. Defaults to `text` on deploy. */
6688
+ inputType?: string;
6689
+ required?: boolean | {
6690
+ missingMessage?: string;
6691
+ missingStatus?: string;
6692
+ };
6693
+ defaultValue?: unknown;
6694
+ selectOptions?: Array<{
6695
+ label?: string;
6696
+ value?: string;
6697
+ }>;
6698
+ }
6699
+ /** Ref to a catalogue trigger. Credentials stay on the connection, when one is set. */
6700
+ interface TriggerDefinition {
6701
+ kind: typeof DEFINE_KINDS.trigger;
6702
+ /**
6703
+ * Catalogue trigger id, e.g. `flow-control_trigger_manual`.
6704
+ * Discover with `apps get <appId> --json` (`triggers[].triggerId`).
6705
+ */
6706
+ id: string;
6707
+ /** Workflow app id. Inferred from `id` when it matches `{app}_trigger_…`. */
6708
+ appId?: string;
6709
+ /** Optional Connection ref. Omit to let the platform resolve. */
6710
+ connection?: ConnectionDefinition;
6711
+ /** Catalogue trigger config (webhook method, schedule, app trigger fields). */
6712
+ input?: Record<string, unknown>;
6713
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
6714
+ inputs?: TriggerInputFieldDefinition[];
6715
+ name?: string;
6716
+ description?: string;
6717
+ }
6643
6718
  interface WorkflowStepDefinition {
6644
6719
  /** Action definition (or inline action-shaped object). */
6645
6720
  use: ActionDefinition;
@@ -6654,6 +6729,11 @@ interface WorkflowDefinition {
6654
6729
  name?: string;
6655
6730
  description?: string;
6656
6731
  isActive?: boolean;
6732
+ /**
6733
+ * Catalogue trigger. Omit for Manually Run with no input fields.
6734
+ * `runs.start` ignores this and runs the steps only.
6735
+ */
6736
+ trigger?: TriggerDefinition;
6657
6737
  /** Linear steps (v1; no branches). */
6658
6738
  steps: WorkflowStepDefinition[];
6659
6739
  }
@@ -6681,6 +6761,7 @@ interface AgentDefinition {
6681
6761
  declare function defineConnection(config?: Omit<ConnectionDefinition, 'kind'>): ConnectionDefinition;
6682
6762
  declare function defineAiConnection(config?: Omit<AiConnectionDefinition, 'kind'>): AiConnectionDefinition;
6683
6763
  declare function defineAction(config: Omit<ActionDefinition, 'kind'>): ActionDefinition;
6764
+ declare function defineTrigger(config: Omit<TriggerDefinition, 'kind'>): TriggerDefinition;
6684
6765
  declare function defineWorkflow(config: Omit<WorkflowDefinition, 'kind'>): WorkflowDefinition;
6685
6766
  declare function defineAgent(config: Omit<AgentDefinition, 'kind'>): AgentDefinition;
6686
6767
  interface EntityTypeDefinition {
@@ -6705,6 +6786,9 @@ interface EntityTypeDefinition {
6705
6786
  declare function defineEntityType(config: Omit<EntityTypeDefinition, 'kind'>): EntityTypeDefinition;
6706
6787
  /** Infer appId from catalogue action ids like `http_action_send-request`. */
6707
6788
  declare function resolveActionAppId(action: ActionDefinition): string;
6789
+ /** Infer appId from catalogue trigger ids like `flow-control_trigger_manual`. */
6790
+ declare function resolveTriggerAppId(trigger: TriggerDefinition): string;
6791
+ declare function resolveTriggerId(trigger: TriggerDefinition): string;
6708
6792
  declare function resolveActionId(action: ActionDefinition): string;
6709
6793
 
6710
6794
  interface UpsertAgentToolInput {
@@ -7435,11 +7519,24 @@ interface UpsertWorkflowStepInput {
7435
7519
  name?: string;
7436
7520
  description?: string;
7437
7521
  }
7522
+ interface UpsertWorkflowTriggerInput {
7523
+ triggerId: string;
7524
+ appId?: string;
7525
+ connectionId?: string;
7526
+ /** Catalogue trigger config. */
7527
+ input?: Record<string, unknown>;
7528
+ /** Manual-trigger fields. Stored as `customInputConfig`. */
7529
+ inputs?: TriggerDefinition['inputs'];
7530
+ name?: string;
7531
+ description?: string;
7532
+ }
7438
7533
  interface UpsertWorkflowBySlugInput {
7439
7534
  slug: string;
7440
7535
  name?: string;
7441
7536
  description?: string;
7442
7537
  isActive?: boolean;
7538
+ /** Omit for Manually Run with no input fields. */
7539
+ trigger?: UpsertWorkflowTriggerInput;
7443
7540
  steps: UpsertWorkflowStepInput[];
7444
7541
  managedByCode?: boolean;
7445
7542
  }
@@ -7668,4 +7765,4 @@ interface CreateServerClientOptions {
7668
7765
  */
7669
7766
  declare function createServerClient(options: CreateServerClientOptions): LunnoaClient;
7670
7767
 
7671
- 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 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 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, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, type operations, parseSseEvents, parseSseStream, type paths, resolveActionAppId, resolveActionId };
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 };
package/dist/index.js CHANGED
@@ -535,6 +535,7 @@ var DEFINE_KINDS = {
535
535
  connection: "connection",
536
536
  aiConnection: "aiConnection",
537
537
  action: "action",
538
+ trigger: "trigger",
538
539
  workflow: "workflow",
539
540
  agent: "agent",
540
541
  entityType: "entityType"
@@ -551,6 +552,25 @@ function defineAction(config) {
551
552
  }
552
553
  return { kind: DEFINE_KINDS.action, ...config };
553
554
  }
555
+ function assertTriggerConfig(config) {
556
+ if (!config.id?.trim()) {
557
+ throw new Error("defineTrigger requires id (catalogue trigger id)");
558
+ }
559
+ for (const field of config.inputs ?? []) {
560
+ if (!field?.id?.trim()) {
561
+ throw new Error("defineTrigger inputs require id");
562
+ }
563
+ }
564
+ if (config.inputs?.length && config.id.trim() !== "flow-control_trigger_manual") {
565
+ throw new Error(
566
+ "defineTrigger inputs are only valid on flow-control_trigger_manual"
567
+ );
568
+ }
569
+ }
570
+ function defineTrigger(config) {
571
+ assertTriggerConfig(config);
572
+ return { kind: DEFINE_KINDS.trigger, ...config };
573
+ }
554
574
  function defineWorkflow(config) {
555
575
  if (!config.slug?.trim()) {
556
576
  throw new Error("defineWorkflow requires slug");
@@ -558,6 +578,9 @@ function defineWorkflow(config) {
558
578
  if (!config.steps?.length) {
559
579
  throw new Error("defineWorkflow requires at least one step");
560
580
  }
581
+ if (config.trigger) {
582
+ assertTriggerConfig(config.trigger);
583
+ }
561
584
  return { kind: DEFINE_KINDS.workflow, ...config };
562
585
  }
563
586
  function defineAgent(config) {
@@ -603,6 +626,40 @@ function resolveActionAppId(action) {
603
626
  `Cannot infer appId for action "${id}". Pass appId explicitly.`
604
627
  );
605
628
  }
629
+ function resolveTriggerAppId(trigger) {
630
+ if (trigger.appId?.trim()) {
631
+ return trigger.appId.trim();
632
+ }
633
+ const id = trigger.id.trim();
634
+ const marker = "_trigger_";
635
+ const markerIndex = id.indexOf(marker);
636
+ if (markerIndex > 0) {
637
+ return id.slice(0, markerIndex);
638
+ }
639
+ const dot = id.indexOf(".");
640
+ if (dot > 0) {
641
+ return id.slice(0, dot);
642
+ }
643
+ throw new Error(
644
+ `Cannot infer appId for trigger "${id}". Pass appId explicitly.`
645
+ );
646
+ }
647
+ function resolveTriggerId(trigger) {
648
+ const id = trigger.id.trim();
649
+ const appId = trigger.appId?.trim();
650
+ if (appId && id.startsWith(`${appId}.`)) {
651
+ return id.slice(appId.length + 1);
652
+ }
653
+ const marker = "_trigger_";
654
+ if (id.includes(marker)) {
655
+ return id;
656
+ }
657
+ const dot = id.indexOf(".");
658
+ if (dot > 0) {
659
+ return id.slice(dot + 1);
660
+ }
661
+ return id;
662
+ }
606
663
  function resolveActionId(action) {
607
664
  const id = action.id.trim();
608
665
  const appId = action.appId?.trim();
@@ -2017,6 +2074,17 @@ var WorkflowAppsResource = class {
2017
2074
  };
2018
2075
 
2019
2076
  // src/resources/workflows.ts
2077
+ function triggerToUpsertInput(trigger) {
2078
+ return {
2079
+ triggerId: resolveTriggerId(trigger),
2080
+ appId: resolveTriggerAppId(trigger),
2081
+ ...trigger.connection?.id ? { connectionId: trigger.connection.id } : {},
2082
+ ...trigger.input ? { input: trigger.input } : {},
2083
+ ...trigger.inputs?.length ? { inputs: trigger.inputs } : {},
2084
+ ...trigger.name ? { name: trigger.name } : {},
2085
+ ...trigger.description ? { description: trigger.description } : {}
2086
+ };
2087
+ }
2020
2088
  function stepToUpsertInput(step) {
2021
2089
  const use = step.use;
2022
2090
  return {
@@ -2037,6 +2105,7 @@ function workflowDefinitionToUpsert(def) {
2037
2105
  name: def.name,
2038
2106
  description: def.description,
2039
2107
  isActive: def.isActive,
2108
+ ...def.trigger ? { trigger: triggerToUpsertInput(def.trigger) } : {},
2040
2109
  managedByCode: true,
2041
2110
  steps: def.steps.map(stepToUpsertInput)
2042
2111
  };
@@ -2235,6 +2304,6 @@ function createServerClient(options) {
2235
2304
  });
2236
2305
  }
2237
2306
 
2238
- 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, defineWorkflow, entityTypeDefinitionToUpsert, isBrowserEnvironment, isLoginRequires2FA, iterateOffset, iteratePages, parseSseEvents, parseSseStream, resolveActionAppId, resolveActionId };
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 };
2239
2308
  //# sourceMappingURL=index.js.map
2240
2309
  //# sourceMappingURL=index.js.map