@@ -7,6 +7,7 @@ import { ActorReminderType } from '../../../types/ActorReminder.type';
7
7
import { ActorTimerType } from '../../../types/ActorTimer.type' ;
8
8
import IClientActor from '../../../interfaces/Client/IClientActor' ;
9
9
import { KeyValueType } from '../../../types/KeyValue.type' ;
10
+ import ActorId from "../../ActorId" ;
10
11
11
12
// https://docs.dapr.io/reference/api/actors_api/
12
13
export default class ActorClientGRPC implements IClientActor {
@@ -16,9 +17,9 @@ export default class ActorClientGRPC implements IClientActor {
16
17
this . client = client ;
17
18
}
18
19
19
- async invoke ( actorType : string , actorId : string , methodName : string , body ?: any ) : Promise < object > {
20
+ async invoke ( actorType : string , actorId : ActorId , methodName : string , body ?: any ) : Promise < object > {
20
21
const msgService = new InvokeActorRequest ( ) ;
21
- msgService . setActorId ( actorId )
22
+ msgService . setActorId ( actorId . getId ( ) )
22
23
msgService . setActorType ( actorType ) ;
23
24
msgService . setMethod ( methodName ) ;
24
25
@@ -46,7 +47,7 @@ export default class ActorClientGRPC implements IClientActor {
46
47
} ) ;
47
48
}
48
49
49
- async stateTransaction ( actorType : string , actorId : string , operations : OperationType [ ] ) : Promise < void > {
50
+ async stateTransaction ( actorType : string , actorId : ActorId , operations : OperationType [ ] ) : Promise < void > {
50
51
const transactionItems : TransactionalActorStateOperation [ ] = [ ] ;
51
52
52
53
for ( const o of operations ) {
@@ -63,7 +64,7 @@ export default class ActorClientGRPC implements IClientActor {
63
64
64
65
const msgService = new ExecuteActorStateTransactionRequest ( ) ;
65
66
msgService . setActorType ( actorType ) ;
66
- msgService . setActorId ( actorId ) ;
67
+ msgService . setActorId ( actorId . getId ( ) ) ;
67
68
msgService . setOperationsList ( transactionItems ) ;
68
69
69
70
return new Promise ( ( resolve , reject ) => {
@@ -79,10 +80,10 @@ export default class ActorClientGRPC implements IClientActor {
79
80
} ) ;
80
81
}
81
82
82
- async stateGet ( actorType : string , actorId : string , key : string ) : Promise < KeyValueType | string > {
83
+ async stateGet ( actorType : string , actorId : ActorId , key : string ) : Promise < KeyValueType | string > {
83
84
const msgService = new GetActorStateRequest ( ) ;
84
85
msgService . setActorType ( actorType ) ;
85
- msgService . setActorId ( actorId )
86
+ msgService . setActorId ( actorId . getId ( ) )
86
87
msgService . setKey ( key ) ;
87
88
88
89
return new Promise ( ( resolve , reject ) => {
@@ -105,10 +106,10 @@ export default class ActorClientGRPC implements IClientActor {
105
106
} ) ;
106
107
}
107
108
108
- async registerActorReminder ( actorType : string , actorId : string , name : string , reminder : ActorReminderType ) : Promise < void > {
109
+ async registerActorReminder ( actorType : string , actorId : ActorId , name : string , reminder : ActorReminderType ) : Promise < void > {
109
110
const msgService = new RegisterActorReminderRequest ( ) ;
110
111
msgService . setActorType ( actorType ) ;
111
- msgService . setActorId ( actorId ) ;
112
+ msgService . setActorId ( actorId . getId ( ) ) ;
112
113
msgService . setName ( name ) ;
113
114
114
115
if ( reminder . data ) {
@@ -136,10 +137,10 @@ export default class ActorClientGRPC implements IClientActor {
136
137
} ) ;
137
138
}
138
139
139
- async unregisterActorReminder ( actorType : string , actorId : string , name : string ) : Promise < void > {
140
+ async unregisterActorReminder ( actorType : string , actorId : ActorId , name : string ) : Promise < void > {
140
141
const msgService = new UnregisterActorReminderRequest ( ) ;
141
142
msgService . setActorType ( actorType ) ;
142
- msgService . setActorId ( actorId ) ;
143
+ msgService . setActorId ( actorId . getId ( ) ) ;
143
144
msgService . setName ( name ) ;
144
145
145
146
return new Promise ( ( resolve , reject ) => {
@@ -155,10 +156,10 @@ export default class ActorClientGRPC implements IClientActor {
155
156
} ) ;
156
157
}
157
158
158
- async registerActorTimer ( actorType : string , actorId : string , name : string , timer : ActorTimerType ) : Promise < void > {
159
+ async registerActorTimer ( actorType : string , actorId : ActorId , name : string , timer : ActorTimerType ) : Promise < void > {
159
160
const msgService = new RegisterActorTimerRequest ( ) ;
160
161
msgService . setActorType ( actorType ) ;
161
- msgService . setActorId ( actorId ) ;
162
+ msgService . setActorId ( actorId . getId ( ) ) ;
162
163
msgService . setName ( name ) ;
163
164
164
165
if ( timer . callback ) {
@@ -190,10 +191,10 @@ export default class ActorClientGRPC implements IClientActor {
190
191
} ) ;
191
192
}
192
193
193
- async unregisterActorTimer ( actorType : string , actorId : string , name : string ) : Promise < void > {
194
+ async unregisterActorTimer ( actorType : string , actorId : ActorId , name : string ) : Promise < void > {
194
195
const msgService = new UnregisterActorTimerRequest ( ) ;
195
196
msgService . setActorType ( actorType ) ;
196
- msgService . setActorId ( actorId ) ;
197
+ msgService . setActorId ( actorId . getId ( ) ) ;
197
198
msgService . setName ( name ) ;
198
199
199
200
return new Promise ( ( resolve , reject ) => {
0 commit comments