Skip to content

Commit 3b3fb1b

Browse files
committed
Rename more things
1 parent db8e51f commit 3b3fb1b

File tree

4 files changed

+50
-50
lines changed

4 files changed

+50
-50
lines changed

src/api/app/types.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export type RoleNameCallZomeRequestSigned = Omit<
4343
/**
4444
* @public
4545
*/
46-
export type AppAgentCallZomeRequest =
46+
export type AppCallZomeRequest =
4747
| NonProvenanceCallZomeRequest
4848
| RoleNameCallZomeRequest
4949
| CallZomeRequestSigned
@@ -70,15 +70,15 @@ export type AppDisableCloneCellRequest = Omit<
7070
/**
7171
* @public
7272
*/
73-
export type AppAgentNetworkInfoRequest = Omit<
73+
export type AppNetworkInfoRequest = Omit<
7474
NetworkInfoRequest,
7575
"agent_pub_key"
7676
>;
7777

7878
/**
7979
* @public
8080
*/
81-
export interface AppAgentEvents {
81+
export interface AppEvents {
8282
signal: AppSignal;
8383
}
8484

@@ -262,10 +262,10 @@ export type NetworkInfoResponse = NetworkInfo[];
262262
/**
263263
* @public
264264
*/
265-
export interface AppAgentClient {
266-
callZome(args: AppAgentCallZomeRequest, timeout?: number): Promise<any>;
265+
export interface AppClient {
266+
callZome(args: AppCallZomeRequest, timeout?: number): Promise<any>;
267267

268-
on<Name extends keyof AppAgentEvents>(
268+
on<Name extends keyof AppEvents>(
269269
eventName: Name | readonly Name[],
270270
listener: AppSignalCb
271271
): UnsubscribeFunction;
@@ -283,5 +283,5 @@ export interface AppAgentClient {
283283
disableCloneCell(
284284
args: AppDisableCloneCellRequest
285285
): Promise<DisableCloneCellResponse>;
286-
networkInfo(args: AppAgentNetworkInfoRequest): Promise<NetworkInfoResponse>;
286+
networkInfo(args: AppNetworkInfoRequest): Promise<NetworkInfoResponse>;
287287
}

src/api/app/websocket.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import {
1616
WebsocketConnectionOptions,
1717
} from "../common.js";
1818
import {
19-
AppAgentCallZomeRequest,
20-
AppAgentClient,
21-
AppAgentEvents,
22-
AppAgentNetworkInfoRequest,
19+
AppCallZomeRequest,
20+
AppClient,
21+
AppEvents,
22+
AppNetworkInfoRequest,
2323
AppCreateCloneCellRequest,
2424
AppDisableCloneCellRequest,
2525
AppEnableCloneCellRequest,
@@ -63,11 +63,11 @@ import { WsClient } from "../client";
6363
*
6464
* @public
6565
*/
66-
export class AppWebsocket implements AppAgentClient {
66+
export class AppWebsocket implements AppClient {
6767
readonly client: WsClient;
6868
readonly myPubKey: AgentPubKey;
6969
private readonly defaultTimeout: number;
70-
private readonly emitter: Emittery<AppAgentEvents>;
70+
private readonly emitter: Emittery<AppEvents>;
7171
cachedAppInfo?: AppInfo | null;
7272

7373
private readonly appInfoRequester: Requester<null, AppInfoResponse>;
@@ -100,7 +100,7 @@ export class AppWebsocket implements AppAgentClient {
100100
this.client = client;
101101
this.myPubKey = appInfo.agent_pub_key;
102102
this.defaultTimeout = defaultTimeout ?? DEFAULT_TIMEOUT;
103-
this.emitter = new Emittery<AppAgentEvents>();
103+
this.emitter = new Emittery<AppEvents>();
104104
this.cachedAppInfo = appInfo;
105105

106106
this.appInfoRequester = AppWebsocket.requester(
@@ -271,7 +271,7 @@ export class AppWebsocket implements AppAgentClient {
271271
* @returns The zome call's response.
272272
*/
273273
async callZome(
274-
request: AppAgentCallZomeRequest,
274+
request: AppCallZomeRequest,
275275
timeout?: number
276276
): Promise<CallZomeResponse> {
277277
if (!("provenance" in request)) {
@@ -349,7 +349,7 @@ export class AppWebsocket implements AppAgentClient {
349349
* @returns Network info for the specified DNAs
350350
*/
351351
async networkInfo(
352-
args: AppAgentNetworkInfoRequest
352+
args: AppNetworkInfoRequest
353353
): Promise<NetworkInfoResponse> {
354354
return this.networkInfoRequester({
355355
...args,
@@ -364,7 +364,7 @@ export class AppWebsocket implements AppAgentClient {
364364
* @param listener - The function to call when event is triggered.
365365
* @returns A function to unsubscribe the event listener.
366366
*/
367-
on<Name extends keyof AppAgentEvents>(
367+
on<Name extends keyof AppEvents>(
368368
eventName: Name | readonly Name[],
369369
listener: AppSignalCb
370370
): UnsubscribeFunction {

test/e2e/app-websocket.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from "node:assert";
22
import test from "tape";
33
import {
44
AdminWebsocket,
5-
AppAgentCallZomeRequest,
5+
AppCallZomeRequest,
66
AppWebsocket,
77
AppCreateCloneCellRequest,
88
AppEntryDef,
@@ -14,7 +14,7 @@ import {
1414
RoleName,
1515
} from "../../src";
1616
import {
17-
createAppAgentWsAndInstallApp,
17+
createAppWsAndInstallApp,
1818
FIXTURE_PATH,
1919
withConductor,
2020
} from "./common.js";
@@ -30,11 +30,11 @@ test(
3030
const {
3131
installed_app_id,
3232
cell_id,
33-
client: appAgentWs,
33+
client: appWs,
3434
admin,
35-
} = await createAppAgentWsAndInstallApp(ADMIN_PORT);
35+
} = await createAppWsAndInstallApp(ADMIN_PORT);
3636

37-
let info = await appAgentWs.appInfo();
37+
let info = await appWs.appInfo();
3838
assert(CellType.Provisioned in info.cell_info[ROLE_NAME][0]);
3939
t.deepEqual(
4040
info.cell_info[ROLE_NAME][0][CellType.Provisioned].cell_id,
@@ -51,7 +51,7 @@ test(
5151
visibility: { Private: null },
5252
};
5353

54-
const response = await appAgentWs.callZome({
54+
const response = await appWs.callZome({
5555
cell_id,
5656
zome_name: TEST_ZOME_NAME,
5757
fn_name: "echo_app_entry_def",
@@ -60,13 +60,13 @@ test(
6060

6161
t.equal(response, null, "app entry type deserializes correctly");
6262

63-
const cellIdFromRoleName = appAgentWs.getCellIdFromRoleName(
63+
const cellIdFromRoleName = appWs.getCellIdFromRoleName(
6464
ROLE_NAME,
6565
info
6666
);
6767
t.deepEqual(cellIdFromRoleName, cell_id);
6868

69-
const response_from_role_name = await appAgentWs.callZome({
69+
const response_from_role_name = await appWs.callZome({
7070
role_name: ROLE_NAME,
7171
zome_name: TEST_ZOME_NAME,
7272
fn_name: "echo_app_entry_def",
@@ -80,7 +80,7 @@ test(
8080
);
8181

8282
await admin.disableApp({ installed_app_id });
83-
info = await appAgentWs.appInfo();
83+
info = await appWs.appInfo();
8484
t.deepEqual(info.status, { disabled: { reason: { user: null } } });
8585
})
8686
);
@@ -104,15 +104,15 @@ test(
104104
const {
105105
admin,
106106
cell_id,
107-
client: appAgentWs,
108-
} = await createAppAgentWsAndInstallApp(ADMIN_PORT);
107+
client: appWs,
108+
} = await createAppWsAndInstallApp(ADMIN_PORT);
109109

110110
await admin.authorizeSigningCredentials(cell_id);
111111

112-
appAgentWs.on("signal", signalCb);
112+
appWs.on("signal", signalCb);
113113

114114
// trigger an emit_signal
115-
await appAgentWs.callZome({
115+
await appWs.callZome({
116116
cell_id,
117117
zome_name: TEST_ZOME_NAME,
118118
fn_name: "emitter",
@@ -174,23 +174,23 @@ test(
174174
installed_app_id: app_id1,
175175
});
176176
const clientUrl = new URL(`ws://localhost:${appPort}`);
177-
const appAgentWs1 = await AppWebsocket.connect(issued1.token, {
177+
const appWs1 = await AppWebsocket.connect(issued1.token, {
178178
url: clientUrl,
179179
wsClientOptions: { origin: "client-test-app" },
180180
});
181181
const issued2 = await admin.issueAppAuthenticationToken({
182182
installed_app_id: app_id2,
183183
});
184-
const appAgentWs2 = await AppWebsocket.connect(issued2.token, {
184+
const appWs2 = await AppWebsocket.connect(issued2.token, {
185185
url: clientUrl,
186186
wsClientOptions: { origin: "client-test-app" },
187187
});
188188

189-
appAgentWs1.on("signal", signalCb1);
190-
appAgentWs2.on("signal", signalCb2);
189+
appWs1.on("signal", signalCb1);
190+
appWs2.on("signal", signalCb2);
191191

192192
// trigger an emit_signal
193-
await appAgentWs1.callZome({
193+
await appWs1.callZome({
194194
cell_id: cell_id1,
195195
zome_name: TEST_ZOME_NAME,
196196
fn_name: "emitter",
@@ -208,18 +208,18 @@ test(
208208
test(
209209
"can create a callable clone cell and call it by clone id",
210210
withConductor(ADMIN_PORT, async (t) => {
211-
const { admin, client: appAgentWs } = await createAppAgentWsAndInstallApp(
211+
const { admin, client: appWs } = await createAppWsAndInstallApp(
212212
ADMIN_PORT
213213
);
214-
const info = await appAgentWs.appInfo();
214+
const info = await appWs.appInfo();
215215

216216
const createCloneCellParams: AppCreateCloneCellRequest = {
217217
role_name: ROLE_NAME,
218218
modifiers: {
219219
network_seed: "clone-0",
220220
},
221221
};
222-
const cloneCell = await appAgentWs.createCloneCell(createCloneCellParams);
222+
const cloneCell = await appWs.createCloneCell(createCloneCellParams);
223223
await admin.authorizeSigningCredentials(cloneCell.cell_id);
224224

225225
const expectedCloneId = new CloneId(ROLE_NAME, 0).toString();
@@ -231,13 +231,13 @@ test(
231231
"clone cell agent key matches base cell agent key"
232232
);
233233

234-
const params: AppAgentCallZomeRequest = {
234+
const params: AppCallZomeRequest = {
235235
role_name: cloneCell.clone_id,
236236
zome_name: TEST_ZOME_NAME,
237237
fn_name: "foo",
238238
payload: null,
239239
};
240-
const response = await appAgentWs.callZome(params);
240+
const response = await appWs.callZome(params);
241241
t.equal(
242242
response,
243243
"foo",
@@ -249,7 +249,7 @@ test(
249249
test(
250250
"can disable and re-enable a clone cell",
251251
withConductor(ADMIN_PORT, async (t) => {
252-
const { admin, client: appAgentWs } = await createAppAgentWsAndInstallApp(
252+
const { admin, client: appWs } = await createAppWsAndInstallApp(
253253
ADMIN_PORT
254254
);
255255

@@ -259,14 +259,14 @@ test(
259259
network_seed: "clone-0",
260260
},
261261
};
262-
const cloneCell = await appAgentWs.createCloneCell(createCloneCellParams);
262+
const cloneCell = await appWs.createCloneCell(createCloneCellParams);
263263
await admin.authorizeSigningCredentials(cloneCell.cell_id);
264264

265-
await appAgentWs.disableCloneCell({
265+
await appWs.disableCloneCell({
266266
clone_cell_id: cloneCell.cell_id,
267267
});
268268

269-
const appInfo = await appAgentWs.appInfo();
269+
const appInfo = await appWs.appInfo();
270270
t.equal(
271271
appInfo.cell_info[ROLE_NAME].length,
272272
2,
@@ -279,28 +279,28 @@ test(
279279
payload: null,
280280
};
281281
try {
282-
await appAgentWs.callZome(params);
282+
await appWs.callZome(params);
283283
t.fail();
284284
} catch (error) {
285285
t.pass("disabled clone call cannot be called");
286286
}
287287

288-
await appAgentWs.enableCloneCell({
288+
await appWs.enableCloneCell({
289289
clone_cell_id: cloneCell.cell_id,
290290
});
291-
await appAgentWs.callZome(params);
291+
await appWs.callZome(params);
292292
t.pass("re-enabled clone can be called");
293293
})
294294
);
295295

296296
test(
297297
"can fetch network info",
298298
withConductor(ADMIN_PORT, async (t) => {
299-
const { client: appAgentWs, cell_id } = await createAppAgentWsAndInstallApp(
299+
const { client: appWs, cell_id } = await createAppWsAndInstallApp(
300300
ADMIN_PORT
301301
);
302302

303-
const response = await appAgentWs.networkInfo({
303+
const response = await appWs.networkInfo({
304304
dnas: [cell_id[0]],
305305
});
306306

test/e2e/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const installAppAndDna = async (
129129
return { installed_app_id, cell_id, client, admin };
130130
};
131131

132-
export const createAppAgentWsAndInstallApp = async (
132+
export const createAppWsAndInstallApp = async (
133133
adminPort: number
134134
): Promise<{
135135
installed_app_id: InstalledAppId;

0 commit comments

Comments
 (0)