Skip to content

Commit ebe745f

Browse files
committed
update proxyActivities comment to show runWithOptions usage
1 parent 1efb3f0 commit ebe745f

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

packages/workflow/src/workflow.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -550,18 +550,19 @@ export type ActivityFunctionWithOptions<T extends ActivityFunction> = T & {
550550
* startToCloseTimeout: '30 minutes',
551551
* });
552552
*
553-
* // Setup Activities with summaries for better observability
554-
* const {
555-
* httpGet,
556-
* processData,
557-
* saveResults
558-
* } = proxyActivities<typeof activities>({
559-
* startToCloseTimeout: '10m',
560-
* }).withSummaries({
561-
* httpGet: 'Fetches data from external API',
562-
* processData: 'Processes the fetched data',
563-
* saveResults: 'Saves processed results to database'
564-
* });
553+
* // Use activities with default options
554+
* const result1 = await httpGet('http://example.com');
555+
*
556+
* // Override options for specific activity calls
557+
* const result2 = await httpGet.runWithOptions({
558+
* staticSummary: 'Fetches data from external API',
559+
* scheduleToCloseTimeout: '5m'
560+
* }, ['http://api.example.com']);
561+
*
562+
* const result3 = await otherActivity.runWithOptions({
563+
* staticSummary: 'Processes the fetched data',
564+
* taskQueue: 'special-task-queue'
565+
* }, [data]);
565566
*
566567
* // Setup Activities from an explicit interface (e.g. when defined by another SDK)
567568
* interface JavaActivities {
@@ -579,6 +580,11 @@ export type ActivityFunctionWithOptions<T extends ActivityFunction> = T & {
579580
*
580581
* export function execute(): Promise<void> {
581582
* const response = await httpGet("http://example.com");
583+
* // Or with custom options:
584+
* const response2 = await httpGetFromJava.runWithOptions({
585+
* staticSummary: 'Java HTTP call with timeout override',
586+
* startToCloseTimeout: '2m'
587+
* }, ["http://fast-api.example.com"]);
582588
* // ...
583589
* }
584590
* ```

0 commit comments

Comments
 (0)