Skip to content

Commit 3f6ab14

Browse files
committed
add table with client API changes
1 parent 3bf1799 commit 3f6ab14

File tree

1 file changed

+282
-3
lines changed

1 file changed

+282
-3
lines changed

articles/azure-functions/durable/durable-functions-node-model-upgrade.md

Lines changed: 282 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The v4 programming model is supported by the v3.x of the `durable-functions` npm
4545
4646
In the v4 programming model, `function.json` files are a thing of the past! In v3, you would have to register your orchestration, entity, and activity triggers in a `function.json` file, and export your function implementation using `orchestrator()` or `entity()` APIs from the `durable-functions` package. With v3.x of `durable-functions`, APIs were added to the `app` namespace on the root of the package to allow you to register your durable orchestrations, entities, and activities directly in code! Find the below code snippets for examples.
4747
48-
#### Migrating an orchestration
48+
**Migrating an orchestration**
4949
5050
:::zone pivot="programming-language-javascript"
5151
# [v4 model](#tab/v4)
@@ -153,7 +153,7 @@ export default orchestrator;
153153
:::zone-end
154154
155155
156-
#### Migrating an entity
156+
**Migrating an entity**
157157
158158
:::zone pivot="programming-language-javascript"
159159
@@ -282,7 +282,7 @@ export default entity;
282282
----
283283
:::zone-end
284284
285-
#### Migrating an activity
285+
**Migrating an activity**
286286
287287
:::zone pivot="programming-language-javascript"
288288
@@ -496,3 +496,282 @@ export default durableHttpStart;
496496
497497
---
498498
:::zone-end
499+
500+
>[!TIP]
501+
> Use the `input.durableClient()` method to register a durable client extra input to your client function. Use `getClient()` as normal to retrieve a `DurableClient` instance.
502+
503+
## Update your Durable Client API calls
504+
505+
In `v3.x` of `durable-functions`, multiple APIs on the `DurableClient` class (renamed from `DurableOrchestrationClient`) have been simplified to make calling them easier and more streamlined. For many optional arguments to APIs, you now pass one options object, instead of multiple discrete optional arguments. Below is an example of these changes:
506+
507+
:::zone pivot="programming-language-javascript"
508+
509+
# [v4 model](#tab/v4)
510+
511+
```javascript
512+
const client = df.getClient(context)
513+
const status = await client.getStatus('instanceId', {
514+
showHistory: false,
515+
showHistoryOutput: false,
516+
showInput: true
517+
});
518+
```
519+
520+
# [v3 model](#tab/v3)
521+
522+
```javascript
523+
const client = df.getClient(context);
524+
const status = await client.getStatus('instanceId', false, false, true);
525+
```
526+
527+
---
528+
:::zone-end
529+
530+
:::zone pivot="programming-language-typescript"
531+
532+
# [v4 model](#tab/v4)
533+
534+
```typescript
535+
const client: DurableClient = df.getClient(context);
536+
const status: DurableOrchestrationStatus = await client.getStatus('instanceId', {
537+
showHistory: false,
538+
showHistoryOutput: false,
539+
showInput: true
540+
});
541+
```
542+
543+
# [v3 model](#tab/v3)
544+
545+
```typescript
546+
const client: DurableOrchestrationClient = df.getClient(context);
547+
const status: DurableOrchestrationStatus = await client.getStatus('instanceId', false, false, true);
548+
```
549+
550+
---
551+
:::zone-end
552+
553+
Below, find the full list of changes:
554+
555+
<table>
556+
<tr>
557+
<th> V3 model (`v2.x` `durable-functions`) </th>
558+
<th> V4 model (`v3.x` `durable-functions`) </th>
559+
</tr>
560+
<tr>
561+
<td>
562+
563+
```TS
564+
getStatus(
565+
instanceId: string,
566+
showHistory?: boolean,
567+
showHistoryOutput?: boolean,
568+
showInput?: boolean
569+
): Promise<DurableOrchestrationStatus>
570+
```
571+
</td>
572+
<td>
573+
574+
```TS
575+
getStatus(
576+
instanceId: string,
577+
options?: GetStatusOptions
578+
): Promise<DurableOrchestrationStatus>
579+
```
580+
</td>
581+
</tr>
582+
<tr>
583+
<td>
584+
585+
```TS
586+
getStatusBy(
587+
createdTimeFrom: Date | undefined,
588+
createdTimeTo: Date | undefined,
589+
runtimeStatus: OrchestrationRuntimeStatus[]
590+
): Promise<DurableOrchestrationStatus[]>
591+
```
592+
593+
</td>
594+
<td>
595+
596+
```TS
597+
getStatusBy(
598+
options: OrchestrationFilter
599+
): Promise<DurableOrchestrationStatus[]>
600+
```
601+
602+
</td>
603+
</tr>
604+
<tr>
605+
<td>
606+
607+
```TS
608+
purgeInstanceHistoryBy(
609+
createdTimeFrom: Date,
610+
createdTimeTo?: Date,
611+
runtimeStatus?: OrchestrationRuntimeStatus[]
612+
): Promise<PurgeHistoryResult>
613+
```
614+
615+
</td>
616+
<td>
617+
618+
```TS
619+
purgeInstanceHistoryBy(
620+
options: OrchestrationFilter
621+
): Promise<PurgeHistoryResult>
622+
```
623+
624+
</td>
625+
</tr>
626+
<tr>
627+
<td>
628+
629+
```TS
630+
raiseEvent(
631+
instanceId: string,
632+
eventName: string,
633+
eventData: unknown,
634+
taskHubName?: string,
635+
connectionName?: string
636+
): Promise<void>
637+
```
638+
639+
</td>
640+
<td>
641+
642+
```TS
643+
raiseEvent(
644+
instanceId: string,
645+
eventName: string,
646+
eventData: unknown,
647+
options?: TaskHubOptions
648+
): Promise<void>
649+
```
650+
651+
</td>
652+
</tr>
653+
<tr>
654+
<td>
655+
656+
```TS
657+
readEntityState<T>(
658+
entityId: EntityId,
659+
taskHubName?: string,
660+
connectionName?: string
661+
): Promise<EntityStateResponse<T>>
662+
```
663+
664+
</td>
665+
<td>
666+
667+
```TS
668+
readEntityState<T>(
669+
entityId: EntityId,
670+
options?: TaskHubOptions
671+
): Promise<EntityStateResponse<T>>
672+
```
673+
674+
</td>
675+
</tr>
676+
<tr>
677+
<td>
678+
679+
```typescript
680+
startNew(
681+
orchestratorFunctionName: string,
682+
instanceId?: string,
683+
input?: unknown
684+
): Promise<string>
685+
```
686+
687+
</td>
688+
<td>
689+
690+
```typescript
691+
startNew(
692+
orchestratorFunctionName: string,
693+
options?: StartNewOptions
694+
): Promise<string>;
695+
```
696+
697+
</td>
698+
</tr>
699+
<tr>
700+
<td>
701+
702+
```TS
703+
rewind(
704+
instanceId: string,
705+
reason: string,
706+
taskHubName?: string,
707+
connectionName?: string
708+
): Promise<void>`
709+
```
710+
711+
</td>
712+
<td>
713+
714+
```TS
715+
rewind(
716+
instanceId: string,
717+
reason: string,
718+
options?: TaskHubOptions
719+
): Promise<void>
720+
```
721+
722+
</td>
723+
</tr>
724+
<tr>
725+
<td>
726+
727+
```TS
728+
signalEntity(
729+
entityId: EntityId,
730+
operationName?: string,
731+
operationContent?: unknown,
732+
taskHubName?: string,
733+
connectionName?: string
734+
): Promise<void>
735+
```
736+
</td>
737+
<td>
738+
739+
```TS
740+
signalEntity(
741+
entityId: EntityId,
742+
operationName?: string,
743+
operationContent?: unknown,
744+
options?: TaskHubOptions
745+
): Promise<void>
746+
```
747+
</td>
748+
</tr>
749+
<tr>
750+
<td>
751+
752+
```TS
753+
waitForCompletionOrCreateCheckStatusResponse(
754+
request: HttpRequest,
755+
instanceId: string,
756+
timeoutInMilliseconds?: number,
757+
retryIntervalInMilliseconds?: number
758+
): Promise<HttpResponse>;
759+
```
760+
761+
</td>
762+
<td>
763+
764+
```TS
765+
waitForCompletionOrCreateCheckStatusResponse(
766+
request: HttpRequest,
767+
instanceId: string,
768+
waitOptions?: WaitForCompletionOptions
769+
): Promise<HttpResponse>;
770+
```
771+
772+
</td>
773+
</tr>
774+
</table>
775+
776+
>[!TIP]
777+
> Make sure to update your `DurableClient` API calls from discrete optional arguments to options objects, where applicable. See the list above for all APIs affected.

0 commit comments

Comments
 (0)