@output.ai/core 0.1.10 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@output.ai/core",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "exports": {
package/src/index.d.ts CHANGED
@@ -31,6 +31,10 @@ export type Options = { retry?: ActivityOptions['retry'] };
31
31
  * @property {import('@temporalio/workflow').ActivityOptions['retry']} [retry]
32
32
  */
33
33
 
34
+ export type WorkflowCallConfig = {
35
+ options?: ActivityOptions
36
+ };
37
+
34
38
  /*
35
39
  ╭─────────╮
36
40
  │ S T E P │╮
@@ -165,7 +169,7 @@ export function workflow<
165
169
  outputSchema: OutputSchema,
166
170
  fn: ( input: z.infer<InputSchema> ) => Promise<z.infer<OutputSchema>>,
167
171
  options?: Options
168
- } ): ( input: z.infer<InputSchema> ) => Promise<z.infer<OutputSchema>>;
172
+ } ): ( input: z.infer<InputSchema>, extra?: WorkflowCallConfig ) => Promise<z.infer<OutputSchema>>;
169
173
 
170
174
  /**
171
175
  * Creates a workflow orchestrator with defined schema for input only.
@@ -186,7 +190,7 @@ export function workflow<
186
190
  inputSchema: InputSchema,
187
191
  fn: ( input: z.infer<InputSchema> ) => Promise<void>,
188
192
  options?: Options
189
- } ): ( input: z.infer<InputSchema> ) => Promise<void>;
193
+ } ): ( input: z.infer<InputSchema>, extra?: WorkflowCallConfig ) => Promise<void>;
190
194
 
191
195
  /**
192
196
  * Creates a workflow orchestrator with defined schema for output only.
@@ -207,7 +211,7 @@ export function workflow<
207
211
  outputSchema: OutputSchema,
208
212
  fn: () => Promise<z.infer<OutputSchema>>,
209
213
  options?: Options
210
- } ): () => Promise<z.infer<OutputSchema>>;
214
+ } ): ( input?: undefined | null, extra?: WorkflowCallConfig ) => Promise<z.infer<OutputSchema>>;
211
215
 
212
216
  /**
213
217
  * Creates a workflow orchestrator without defined schemas.
@@ -224,7 +228,7 @@ export function workflow( options : {
224
228
  description?: string,
225
229
  fn: () => Promise<void>,
226
230
  options?: Options
227
- } ): () => Promise<void>;
231
+ } ): ( input?: undefined | null, extra?: WorkflowCallConfig ) => Promise<void>;
228
232
 
229
233
  /*
230
234
  ╭───────────────────╮
@@ -59,11 +59,16 @@ export function workflow( { name, description, inputSchema, outputSchema, fn, op
59
59
  invokeSharedStep: async ( stepName, input, options ) => steps[`${SHARED_STEP_PREFIX}#${stepName}`]( input, options ),
60
60
  invokeEvaluator: async ( evaluatorName, input, options ) => steps[`${workflowPath}#${evaluatorName}`]( input, options ),
61
61
 
62
- startWorkflow: async ( childName, input ) => {
62
+ startWorkflow: async ( childName, input, extra = {} ) => {
63
63
  return executeChild( childName, {
64
64
  args: input ? [ input ] : [],
65
65
  workflowId: `${workflowId}-${childName}-${Date.now()}`,
66
- memo: { executionContext, parentId: workflowId }
66
+ memo: {
67
+ executionContext,
68
+ parentId: workflowId,
69
+ // new configuration for activities of the child workflow, this will be omitted so it will use what that workflow have defined
70
+ ...( extra?.options && { activityOptions: mergeActivityOptions( activityOptions, extra.options ) } )
71
+ }
67
72
  } );
68
73
  }
69
74
  }, input );