@@ -2,7 +2,7 @@ import assert from "node:assert";
2
2
import test from "tape" ;
3
3
import {
4
4
AdminWebsocket ,
5
- AppAgentCallZomeRequest ,
5
+ AppCallZomeRequest ,
6
6
AppWebsocket ,
7
7
AppCreateCloneCellRequest ,
8
8
AppEntryDef ,
@@ -14,7 +14,7 @@ import {
14
14
RoleName ,
15
15
} from "../../src" ;
16
16
import {
17
- createAppAgentWsAndInstallApp ,
17
+ createAppWsAndInstallApp ,
18
18
FIXTURE_PATH ,
19
19
withConductor ,
20
20
} from "./common.js" ;
@@ -30,11 +30,11 @@ test(
30
30
const {
31
31
installed_app_id,
32
32
cell_id,
33
- client : appAgentWs ,
33
+ client : appWs ,
34
34
admin,
35
- } = await createAppAgentWsAndInstallApp ( ADMIN_PORT ) ;
35
+ } = await createAppWsAndInstallApp ( ADMIN_PORT ) ;
36
36
37
- let info = await appAgentWs . appInfo ( ) ;
37
+ let info = await appWs . appInfo ( ) ;
38
38
assert ( CellType . Provisioned in info . cell_info [ ROLE_NAME ] [ 0 ] ) ;
39
39
t . deepEqual (
40
40
info . cell_info [ ROLE_NAME ] [ 0 ] [ CellType . Provisioned ] . cell_id ,
51
51
visibility : { Private : null } ,
52
52
} ;
53
53
54
- const response = await appAgentWs . callZome ( {
54
+ const response = await appWs . callZome ( {
55
55
cell_id,
56
56
zome_name : TEST_ZOME_NAME ,
57
57
fn_name : "echo_app_entry_def" ,
@@ -60,13 +60,13 @@ test(
60
60
61
61
t . equal ( response , null , "app entry type deserializes correctly" ) ;
62
62
63
- const cellIdFromRoleName = appAgentWs . getCellIdFromRoleName (
63
+ const cellIdFromRoleName = appWs . getCellIdFromRoleName (
64
64
ROLE_NAME ,
65
65
info
66
66
) ;
67
67
t . deepEqual ( cellIdFromRoleName , cell_id ) ;
68
68
69
- const response_from_role_name = await appAgentWs . callZome ( {
69
+ const response_from_role_name = await appWs . callZome ( {
70
70
role_name : ROLE_NAME ,
71
71
zome_name : TEST_ZOME_NAME ,
72
72
fn_name : "echo_app_entry_def" ,
80
80
) ;
81
81
82
82
await admin . disableApp ( { installed_app_id } ) ;
83
- info = await appAgentWs . appInfo ( ) ;
83
+ info = await appWs . appInfo ( ) ;
84
84
t . deepEqual ( info . status , { disabled : { reason : { user : null } } } ) ;
85
85
} )
86
86
) ;
@@ -104,15 +104,15 @@ test(
104
104
const {
105
105
admin,
106
106
cell_id,
107
- client : appAgentWs ,
108
- } = await createAppAgentWsAndInstallApp ( ADMIN_PORT ) ;
107
+ client : appWs ,
108
+ } = await createAppWsAndInstallApp ( ADMIN_PORT ) ;
109
109
110
110
await admin . authorizeSigningCredentials ( cell_id ) ;
111
111
112
- appAgentWs . on ( "signal" , signalCb ) ;
112
+ appWs . on ( "signal" , signalCb ) ;
113
113
114
114
// trigger an emit_signal
115
- await appAgentWs . callZome ( {
115
+ await appWs . callZome ( {
116
116
cell_id,
117
117
zome_name : TEST_ZOME_NAME ,
118
118
fn_name : "emitter" ,
@@ -174,23 +174,23 @@ test(
174
174
installed_app_id : app_id1 ,
175
175
} ) ;
176
176
const clientUrl = new URL ( `ws://localhost:${ appPort } ` ) ;
177
- const appAgentWs1 = await AppWebsocket . connect ( issued1 . token , {
177
+ const appWs1 = await AppWebsocket . connect ( issued1 . token , {
178
178
url : clientUrl ,
179
179
wsClientOptions : { origin : "client-test-app" } ,
180
180
} ) ;
181
181
const issued2 = await admin . issueAppAuthenticationToken ( {
182
182
installed_app_id : app_id2 ,
183
183
} ) ;
184
- const appAgentWs2 = await AppWebsocket . connect ( issued2 . token , {
184
+ const appWs2 = await AppWebsocket . connect ( issued2 . token , {
185
185
url : clientUrl ,
186
186
wsClientOptions : { origin : "client-test-app" } ,
187
187
} ) ;
188
188
189
- appAgentWs1 . on ( "signal" , signalCb1 ) ;
190
- appAgentWs2 . on ( "signal" , signalCb2 ) ;
189
+ appWs1 . on ( "signal" , signalCb1 ) ;
190
+ appWs2 . on ( "signal" , signalCb2 ) ;
191
191
192
192
// trigger an emit_signal
193
- await appAgentWs1 . callZome ( {
193
+ await appWs1 . callZome ( {
194
194
cell_id : cell_id1 ,
195
195
zome_name : TEST_ZOME_NAME ,
196
196
fn_name : "emitter" ,
@@ -208,18 +208,18 @@ test(
208
208
test (
209
209
"can create a callable clone cell and call it by clone id" ,
210
210
withConductor ( ADMIN_PORT , async ( t ) => {
211
- const { admin, client : appAgentWs } = await createAppAgentWsAndInstallApp (
211
+ const { admin, client : appWs } = await createAppWsAndInstallApp (
212
212
ADMIN_PORT
213
213
) ;
214
- const info = await appAgentWs . appInfo ( ) ;
214
+ const info = await appWs . appInfo ( ) ;
215
215
216
216
const createCloneCellParams : AppCreateCloneCellRequest = {
217
217
role_name : ROLE_NAME ,
218
218
modifiers : {
219
219
network_seed : "clone-0" ,
220
220
} ,
221
221
} ;
222
- const cloneCell = await appAgentWs . createCloneCell ( createCloneCellParams ) ;
222
+ const cloneCell = await appWs . createCloneCell ( createCloneCellParams ) ;
223
223
await admin . authorizeSigningCredentials ( cloneCell . cell_id ) ;
224
224
225
225
const expectedCloneId = new CloneId ( ROLE_NAME , 0 ) . toString ( ) ;
@@ -231,13 +231,13 @@ test(
231
231
"clone cell agent key matches base cell agent key"
232
232
) ;
233
233
234
- const params : AppAgentCallZomeRequest = {
234
+ const params : AppCallZomeRequest = {
235
235
role_name : cloneCell . clone_id ,
236
236
zome_name : TEST_ZOME_NAME ,
237
237
fn_name : "foo" ,
238
238
payload : null ,
239
239
} ;
240
- const response = await appAgentWs . callZome ( params ) ;
240
+ const response = await appWs . callZome ( params ) ;
241
241
t . equal (
242
242
response ,
243
243
"foo" ,
@@ -249,7 +249,7 @@ test(
249
249
test (
250
250
"can disable and re-enable a clone cell" ,
251
251
withConductor ( ADMIN_PORT , async ( t ) => {
252
- const { admin, client : appAgentWs } = await createAppAgentWsAndInstallApp (
252
+ const { admin, client : appWs } = await createAppWsAndInstallApp (
253
253
ADMIN_PORT
254
254
) ;
255
255
@@ -259,14 +259,14 @@ test(
259
259
network_seed : "clone-0" ,
260
260
} ,
261
261
} ;
262
- const cloneCell = await appAgentWs . createCloneCell ( createCloneCellParams ) ;
262
+ const cloneCell = await appWs . createCloneCell ( createCloneCellParams ) ;
263
263
await admin . authorizeSigningCredentials ( cloneCell . cell_id ) ;
264
264
265
- await appAgentWs . disableCloneCell ( {
265
+ await appWs . disableCloneCell ( {
266
266
clone_cell_id : cloneCell . cell_id ,
267
267
} ) ;
268
268
269
- const appInfo = await appAgentWs . appInfo ( ) ;
269
+ const appInfo = await appWs . appInfo ( ) ;
270
270
t . equal (
271
271
appInfo . cell_info [ ROLE_NAME ] . length ,
272
272
2 ,
@@ -279,28 +279,28 @@ test(
279
279
payload : null ,
280
280
} ;
281
281
try {
282
- await appAgentWs . callZome ( params ) ;
282
+ await appWs . callZome ( params ) ;
283
283
t . fail ( ) ;
284
284
} catch ( error ) {
285
285
t . pass ( "disabled clone call cannot be called" ) ;
286
286
}
287
287
288
- await appAgentWs . enableCloneCell ( {
288
+ await appWs . enableCloneCell ( {
289
289
clone_cell_id : cloneCell . cell_id ,
290
290
} ) ;
291
- await appAgentWs . callZome ( params ) ;
291
+ await appWs . callZome ( params ) ;
292
292
t . pass ( "re-enabled clone can be called" ) ;
293
293
} )
294
294
) ;
295
295
296
296
test (
297
297
"can fetch network info" ,
298
298
withConductor ( ADMIN_PORT , async ( t ) => {
299
- const { client : appAgentWs , cell_id } = await createAppAgentWsAndInstallApp (
299
+ const { client : appWs , cell_id } = await createAppWsAndInstallApp (
300
300
ADMIN_PORT
301
301
) ;
302
302
303
- const response = await appAgentWs . networkInfo ( {
303
+ const response = await appWs . networkInfo ( {
304
304
dnas : [ cell_id [ 0 ] ] ,
305
305
} ) ;
306
306
0 commit comments