Skip to content

Commit f2569a6

Browse files
committed
Merge remote-tracking branch 'origin/main' into remiposo/introduce-changesets
2 parents 6c3e887 + 1a71191 commit f2569a6

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

packages/types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tailor-platform/function-types",
3-
"version": "0.6.1",
3+
"version": "0.7.0",
44
"description": "TypeScript types for Tailor Platform Function service",
55
"repository": {
66
"type": "git",

packages/types/tailor.d.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,61 @@ interface TailorDBFileAPI {
251251
recordId: string
252252
): Promise<FileStreamIterator>;
253253
}
254+
255+
declare namespace tailor.workflow {
256+
/**
257+
* Specifies the machine user that should be used to execute the workflow.
258+
* This allows workflows to run with specific authentication context.
259+
*/
260+
interface AuthInvoker {
261+
/** The namespace where the machine user is defined */
262+
namespace: string;
263+
/** The name of the machine user to use for workflow execution */
264+
machineUserName: string;
265+
}
266+
267+
/**
268+
* Options for triggering a workflow
269+
*/
270+
interface TriggerWorkflowOptions {
271+
/** Optional authentication invoker to specify which machine user should execute the workflow */
272+
authInvoker?: AuthInvoker;
273+
}
274+
275+
/**
276+
* Triggers a workflow and returns its execution ID.
277+
*
278+
* @param workflow_name - The name of the workflow to trigger
279+
* @param args - Optional arguments to pass to the workflow
280+
* @param options - Optional configuration including authentication settings
281+
* @returns A Promise that resolves to the workflow execution ID (UUID format)
282+
*
283+
* @example
284+
* ```typescript
285+
* // Basic usage
286+
* const executionId = await tailor.workflow.triggerWorkflow('myWorkflow', { data: 'value' });
287+
*
288+
* // With authentication invoker
289+
* const executionId = await tailor.workflow.triggerWorkflow(
290+
* 'myWorkflow',
291+
* { data: 'value' },
292+
* { authInvoker: { namespace: 'myNamespace', machineUserName: 'myUser' } }
293+
* );
294+
* ```
295+
*/
296+
function triggerWorkflow(
297+
workflow_name: string,
298+
args?: any,
299+
options?: TriggerWorkflowOptions
300+
): Promise<string>;
301+
302+
/**
303+
* Triggers a job function and returns its result.
304+
*
305+
* @param job_name - The name of the job function to trigger
306+
* @param args - Optional arguments to pass to the job function
307+
* @returns The result returned by the job function. The return type depends on the specific job function
308+
implementation.
309+
*/
310+
function triggerJobFunction(job_name: string, args?: any): any;
311+
}

0 commit comments

Comments
 (0)