@tailor-platform/function-types 0.6.1 → 0.7.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tailor.d.ts +60 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/function-types",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "TypeScript types for Tailor Platform Function service",
5
5
  "repository": {
6
6
  "type": "git",
package/tailor.d.ts CHANGED
@@ -85,8 +85,8 @@ declare namespace tailor.iconv {
85
85
  */
86
86
  function decode<T extends string>(
87
87
  buffer: Uint8Array | ArrayBuffer,
88
- encoding: T
89
- ): T extends 'UTF8' | 'UTF-8' ? string : Uint8Array;
88
+ encoding: string
89
+ ): string;
90
90
 
91
91
  /**
92
92
  * Encode string to buffer
@@ -251,3 +251,61 @@ interface TailorDBFileAPI {
251
251
  recordId: string
252
252
  ): Promise<FileStreamIterator>;
253
253
  }
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
+ }