@holochain/client 0.19.0-dev.4 → 0.19.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/api/app/types.d.ts
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
1
|
import { UnsubscribeFunction } from "emittery";
|
|
2
2
|
import { AgentPubKey, AppAuthenticationToken, AppInfo, CapSecret, CellId, ClonedCell, DnaHash, DnaProperties, EntryHash, FunctionName, InstalledAppId, MembraneProof, MemproofMap, NetworkInfo, NetworkSeed, Nonce256Bit, RoleName, Timestamp, Transformer, WebsocketConnectionOptions, ZomeName, PreflightRequest, SignedAction, SignedActionHashed } from "../../index.js";
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export type NonProvenanceCallZomeRequest = Omit<CallZomeRequest, "provenance">;
|
|
7
|
-
/**
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export type RoleNameCallZomeRequest = Omit<NonProvenanceCallZomeRequest, "cell_id"> & {
|
|
11
|
-
role_name: RoleName;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export type RoleNameCallZomeRequestSigned = Omit<CallZomeRequestSigned, "cell_id"> & {
|
|
17
|
-
role_name: RoleName;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
export type AppCallZomeRequest = NonProvenanceCallZomeRequest | RoleNameCallZomeRequest | CallZomeRequest | CallZomeRequestAllParams;
|
|
23
3
|
/**
|
|
24
4
|
* @public
|
|
25
5
|
*/
|
|
@@ -45,32 +25,33 @@ export interface AppEvents {
|
|
|
45
25
|
/**
|
|
46
26
|
* @public
|
|
47
27
|
*/
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
28
|
+
export type CallZomeRequestGeneric<Payload> = {
|
|
29
|
+
cell_id: CellId;
|
|
30
|
+
zome_name: ZomeName;
|
|
31
|
+
fn_name: FunctionName;
|
|
32
|
+
provenance?: AgentPubKey;
|
|
33
|
+
payload?: Payload;
|
|
34
|
+
cap_secret?: CapSecret;
|
|
35
|
+
nonce?: Nonce256Bit;
|
|
36
|
+
expires_at?: number;
|
|
37
|
+
};
|
|
53
38
|
/**
|
|
54
39
|
* @public
|
|
55
40
|
*/
|
|
56
|
-
export
|
|
57
|
-
bytes: Uint8Array;
|
|
58
|
-
signature: Uint8Array;
|
|
59
|
-
}
|
|
41
|
+
export type CallZomeRequest = CallZomeRequestGeneric<any>;
|
|
60
42
|
/**
|
|
61
43
|
* @public
|
|
62
44
|
*/
|
|
63
|
-
export type
|
|
64
|
-
|
|
65
|
-
zome_name: ZomeName;
|
|
66
|
-
fn_name: FunctionName;
|
|
67
|
-
payload: Payload;
|
|
68
|
-
provenance: AgentPubKey;
|
|
45
|
+
export type RoleNameCallZomeRequest = Omit<CallZomeRequest, "cell_id"> & {
|
|
46
|
+
role_name: RoleName;
|
|
69
47
|
};
|
|
70
48
|
/**
|
|
71
49
|
* @public
|
|
72
50
|
*/
|
|
73
|
-
export
|
|
51
|
+
export interface CallZomeRequestSigned {
|
|
52
|
+
bytes: Uint8Array;
|
|
53
|
+
signature: Uint8Array;
|
|
54
|
+
}
|
|
74
55
|
/**
|
|
75
56
|
* @public
|
|
76
57
|
*/
|
|
@@ -446,7 +427,7 @@ export type NetworkInfoResponse = NetworkInfo[];
|
|
|
446
427
|
* @public
|
|
447
428
|
*/
|
|
448
429
|
export interface AppClient {
|
|
449
|
-
callZome(args:
|
|
430
|
+
callZome(args: CallZomeRequest | RoleNameCallZomeRequest, timeout?: number): Promise<any>;
|
|
450
431
|
on<Name extends keyof AppEvents>(eventName: Name | readonly Name[], listener: SignalCb): UnsubscribeFunction;
|
|
451
432
|
appInfo(): Promise<AppInfoResponse>;
|
|
452
433
|
myPubKey: AgentPubKey;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UnsubscribeFunction } from "emittery";
|
|
2
2
|
import { AgentPubKey, CellId, InstalledAppId, RoleName } from "../../types.js";
|
|
3
3
|
import { AppInfo, MemproofMap } from "../admin/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { AppClient, AppEvents, AppNetworkInfoRequest, AppCreateCloneCellRequest, AppDisableCloneCellRequest, AppEnableCloneCellRequest, SignalCb, CallZomeRequest, CallZomeRequestSigned, NetworkInfoResponse, AppWebsocketConnectionOptions, GetCountersigningSessionStateRequest, GetCountersigningSessionStateResponse, AbandonCountersigningSessionStateRequest, PublishCountersigningSessionStateRequest, RoleNameCallZomeRequest } from "./types.js";
|
|
5
5
|
import { WsClient } from "../client.js";
|
|
6
6
|
/**
|
|
7
7
|
* A class to establish a websocket connection to an App interface, for a
|
|
@@ -70,7 +70,7 @@ export declare class AppWebsocket implements AppClient {
|
|
|
70
70
|
* @param timeout - A timeout to override the default.
|
|
71
71
|
* @returns The zome call's response.
|
|
72
72
|
*/
|
|
73
|
-
callZome<ReturnType>(request:
|
|
73
|
+
callZome<ReturnType>(request: CallZomeRequest | RoleNameCallZomeRequest, timeout?: number): Promise<ReturnType>;
|
|
74
74
|
/**
|
|
75
75
|
* Clone an existing provisioned cell.
|
|
76
76
|
*
|
package/lib/api/app/websocket.js
CHANGED
|
@@ -167,17 +167,16 @@ export class AppWebsocket {
|
|
|
167
167
|
if ("role_name" in request && request.role_name) {
|
|
168
168
|
const appInfo = this.cachedAppInfo || (await this.appInfo());
|
|
169
169
|
const cell_id = this.getCellIdFromRoleName(request.role_name, appInfo);
|
|
170
|
-
|
|
170
|
+
request = {
|
|
171
171
|
...omit(request, "role_name"),
|
|
172
|
-
|
|
172
|
+
// Some problem here with the launcher with just the `cell_id`.
|
|
173
173
|
cell_id: [cell_id[0], cell_id[1]],
|
|
174
174
|
};
|
|
175
|
-
return this.callZomeRequester(zomeCallPayload, timeout);
|
|
176
175
|
}
|
|
177
|
-
else if ("cell_id" in request
|
|
178
|
-
|
|
176
|
+
else if (!("cell_id" in request)) {
|
|
177
|
+
throw new HolochainError("MissingRoleNameOrCellId", "callZome requires a role_name or cell_id argument");
|
|
179
178
|
}
|
|
180
|
-
|
|
179
|
+
return this.callZomeRequester(request, timeout);
|
|
181
180
|
}
|
|
182
181
|
/**
|
|
183
182
|
* Clone an existing provisioned cell.
|
|
@@ -345,7 +344,7 @@ export const signZomeCall = async (request) => {
|
|
|
345
344
|
if (!signingCredentialsForCell) {
|
|
346
345
|
throw new HolochainError("NoSigningCredentialsForCell", `no signing credentials have been authorized for cell [${encodeHashToBase64(request.cell_id[0])}, ${encodeHashToBase64(request.cell_id[1])}]`);
|
|
347
346
|
}
|
|
348
|
-
const
|
|
347
|
+
const zome_call_params = {
|
|
349
348
|
cap_secret: signingCredentialsForCell.capSecret,
|
|
350
349
|
cell_id: request.cell_id,
|
|
351
350
|
zome_name: request.zome_name,
|
|
@@ -355,7 +354,7 @@ export const signZomeCall = async (request) => {
|
|
|
355
354
|
nonce: await randomNonce(),
|
|
356
355
|
expires_at: getNonceExpiration(),
|
|
357
356
|
};
|
|
358
|
-
const bytes = encode(
|
|
357
|
+
const bytes = encode(zome_call_params);
|
|
359
358
|
const bytesHash = new Uint8Array(sha512.array(bytes));
|
|
360
359
|
await _sodium.ready;
|
|
361
360
|
const sodium = _sodium;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppAuthenticationToken, CallZomeRequest } from "../api/index.js";
|
|
2
|
-
import { CallZomeRequestSigned
|
|
2
|
+
import { CallZomeRequestSigned } from "../api/index.js";
|
|
3
3
|
import { InstalledAppId } from "../types.js";
|
|
4
4
|
export interface LauncherEnvironment {
|
|
5
5
|
APP_INTERFACE_PORT?: number;
|
|
@@ -32,7 +32,7 @@ interface CallZomeRequestSignedElectron extends Omit<CallZomeRequestSigned, "cap
|
|
|
32
32
|
nonce: Array<number>;
|
|
33
33
|
expiresAt: number;
|
|
34
34
|
}
|
|
35
|
-
interface CallZomeRequestUnsignedElectron extends Omit<
|
|
35
|
+
interface CallZomeRequestUnsignedElectron extends Omit<CallZomeRequest, "cap_secret" | "cell_id" | "provenance" | "nonce" | "zome_name" | "fn_name" | "expires_at"> {
|
|
36
36
|
cellId: [Array<number>, Array<number>];
|
|
37
37
|
provenance: Array<number>;
|
|
38
38
|
zomeName: string;
|
package/package.json
CHANGED