@holochain/client 0.12.5 → 0.12.7
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/admin/types.d.ts +177 -77
- package/lib/api/admin/websocket.d.ts +8 -2
- package/lib/api/admin/websocket.js +8 -2
- package/lib/api/app/types.d.ts +25 -17
- package/lib/api/app/websocket.d.ts +2 -2
- package/lib/api/app/websocket.js +35 -12
- package/lib/api/app-agent/types.d.ts +13 -8
- package/lib/api/app-agent/websocket.d.ts +11 -3
- package/lib/api/app-agent/websocket.js +23 -7
- package/lib/api/client.d.ts +15 -15
- package/lib/api/client.js +53 -26
- package/lib/api/common.d.ts +13 -5
- package/lib/api/common.js +22 -6
- package/lib/api/index.d.ts +2 -2
- package/lib/api/index.js +2 -2
- package/lib/api/zome-call-signing.d.ts +8 -9
- package/lib/api/zome-call-signing.js +15 -13
- package/lib/environments/launcher.d.ts +31 -3
- package/lib/environments/launcher.js +36 -4
- package/lib/hdk/action.d.ts +16 -6
- package/lib/hdk/capabilities.d.ts +17 -7
- package/lib/hdk/capabilities.js +9 -0
- package/lib/hdk/countersigning.d.ts +4 -4
- package/lib/hdk/dht-ops.d.ts +1 -1
- package/lib/hdk/entry.d.ts +4 -4
- package/lib/hdk/index.d.ts +1 -0
- package/lib/hdk/index.js +1 -0
- package/lib/hdk/link.d.ts +48 -0
- package/lib/hdk/link.js +1 -0
- package/lib/hdk/record.d.ts +2 -2
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types.d.ts +32 -23
- package/lib/utils/fake-hash.d.ts +8 -4
- package/lib/utils/fake-hash.js +25 -12
- package/lib/utils/hash-parts.d.ts +71 -0
- package/lib/utils/hash-parts.js +94 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/package.json +1 -1
package/lib/api/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const ERROR_TYPE = "error";
|
|
2
|
-
export const DEFAULT_TIMEOUT =
|
|
2
|
+
export const DEFAULT_TIMEOUT = 60000;
|
|
3
3
|
/**
|
|
4
4
|
* Take a Requester function which deals with tagged requests and responses,
|
|
5
5
|
* and return a Requester which deals only with the inner data types, also
|
|
@@ -19,16 +19,32 @@ const identityTransformer = {
|
|
|
19
19
|
input: identity,
|
|
20
20
|
output: identity,
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when response from Holochain is an error.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export class HolochainError extends Error {
|
|
28
|
+
constructor(name, message) {
|
|
29
|
+
super();
|
|
30
|
+
this.name = name;
|
|
31
|
+
this.message = message;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// this determines the error format of all error responses
|
|
22
35
|
export const catchError = (res) => {
|
|
23
|
-
|
|
36
|
+
if (res.type === ERROR_TYPE) {
|
|
37
|
+
const error = new HolochainError(res.data.type, res.data.data);
|
|
38
|
+
return Promise.reject(error);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return Promise.resolve(res);
|
|
42
|
+
}
|
|
24
43
|
};
|
|
25
44
|
export const promiseTimeout = (promise, tag, ms) => {
|
|
26
45
|
let id;
|
|
27
46
|
const timeout = new Promise((_, reject) => {
|
|
28
|
-
id = setTimeout(() => {
|
|
29
|
-
clearTimeout(id);
|
|
30
|
-
reject(new Error(`Timed out in ${ms}ms: ${tag}`));
|
|
31
|
-
}, ms);
|
|
47
|
+
id = setTimeout(() => reject(new Error(`Timed out in ${ms}ms: ${tag}`)), ms);
|
|
32
48
|
});
|
|
33
49
|
return new Promise((res, rej) => {
|
|
34
50
|
Promise.race([promise, timeout])
|
package/lib/api/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { hashZomeCall } from "@holochain/serialization";
|
|
|
2
2
|
export * from "./admin/index.js";
|
|
3
3
|
export * from "./app-agent/index.js";
|
|
4
4
|
export * from "./app/index.js";
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { IsoWebSocket, WsClient } from "./client.js";
|
|
6
|
+
export { CloneId, HolochainError, Requester, Transformer, getBaseRoleNameFromCloneId, isCloneId, } from "./common.js";
|
|
7
7
|
export * from "./zome-call-signing.js";
|
package/lib/api/index.js
CHANGED
|
@@ -2,6 +2,6 @@ export { hashZomeCall } from "@holochain/serialization";
|
|
|
2
2
|
export * from "./admin/index.js";
|
|
3
3
|
export * from "./app-agent/index.js";
|
|
4
4
|
export * from "./app/index.js";
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
5
|
+
export { IsoWebSocket, WsClient } from "./client.js";
|
|
6
|
+
export { CloneId, HolochainError, getBaseRoleNameFromCloneId, isCloneId, } from "./common.js";
|
|
7
7
|
export * from "./zome-call-signing.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CapSecret } from "../hdk/capabilities.js";
|
|
3
|
-
import { AgentPubKey, CellId } from "../types.js";
|
|
1
|
+
import { type KeyPair } from "libsodium-wrappers";
|
|
2
|
+
import type { CapSecret } from "../hdk/capabilities.js";
|
|
3
|
+
import type { AgentPubKey, CellId } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type Nonce256Bit = Uint8Array;
|
|
8
8
|
/**
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
11
|
export interface SigningCredentials {
|
|
12
12
|
capSecret: CapSecret;
|
|
13
|
-
keyPair:
|
|
13
|
+
keyPair: KeyPair;
|
|
14
14
|
signingKey: AgentPubKey;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -33,14 +33,13 @@ export declare const setSigningCredentials: (cellId: CellId, credentials: Signin
|
|
|
33
33
|
/**
|
|
34
34
|
* Generates a key pair for signing zome calls.
|
|
35
35
|
*
|
|
36
|
+
* @param agentPubKey - The agent pub key to take 4 last bytes (= DHT location)
|
|
37
|
+
* from (optional).
|
|
36
38
|
* @returns The signing key pair and an agent pub key based on the public key.
|
|
37
39
|
*
|
|
38
40
|
* @public
|
|
39
41
|
*/
|
|
40
|
-
export declare const generateSigningKeyPair: () => [
|
|
41
|
-
nacl.SignKeyPair,
|
|
42
|
-
AgentPubKey
|
|
43
|
-
];
|
|
42
|
+
export declare const generateSigningKeyPair: (agentPubKey?: AgentPubKey) => Promise<[KeyPair, AgentPubKey]>;
|
|
44
43
|
/**
|
|
45
44
|
* @public
|
|
46
45
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _sodium from "libsodium-wrappers";
|
|
2
2
|
import { encodeHashToBase64 } from "../utils/base64.js";
|
|
3
3
|
const signingCredentials = new Map();
|
|
4
4
|
/**
|
|
@@ -27,19 +27,24 @@ export const setSigningCredentials = (cellId, credentials) => {
|
|
|
27
27
|
/**
|
|
28
28
|
* Generates a key pair for signing zome calls.
|
|
29
29
|
*
|
|
30
|
+
* @param agentPubKey - The agent pub key to take 4 last bytes (= DHT location)
|
|
31
|
+
* from (optional).
|
|
30
32
|
* @returns The signing key pair and an agent pub key based on the public key.
|
|
31
33
|
*
|
|
32
34
|
* @public
|
|
33
35
|
*/
|
|
34
|
-
export const generateSigningKeyPair = () => {
|
|
35
|
-
|
|
36
|
-
const
|
|
36
|
+
export const generateSigningKeyPair = async (agentPubKey) => {
|
|
37
|
+
await _sodium.ready;
|
|
38
|
+
const sodium = _sodium;
|
|
39
|
+
const keyPair = sodium.crypto_sign_keypair();
|
|
40
|
+
const locationBytes = agentPubKey ? agentPubKey.subarray(35) : [0, 0, 0, 0];
|
|
41
|
+
const signingKey = new Uint8Array([132, 32, 36].concat(...keyPair.publicKey).concat(...locationBytes));
|
|
37
42
|
return [keyPair, signingKey];
|
|
38
43
|
};
|
|
39
44
|
/**
|
|
40
45
|
* @public
|
|
41
46
|
*/
|
|
42
|
-
export const randomCapSecret = () => randomByteArray(64);
|
|
47
|
+
export const randomCapSecret = async () => randomByteArray(64);
|
|
43
48
|
/**
|
|
44
49
|
* @public
|
|
45
50
|
*/
|
|
@@ -48,15 +53,12 @@ export const randomNonce = async () => randomByteArray(32);
|
|
|
48
53
|
* @public
|
|
49
54
|
*/
|
|
50
55
|
export const randomByteArray = async (length) => {
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
"getRandomValues" in window.crypto) {
|
|
54
|
-
return window.crypto.getRandomValues(new Uint8Array(length));
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
const crypto = await import("crypto");
|
|
58
|
-
return new Uint8Array(crypto.randomBytes(length));
|
|
56
|
+
if (globalThis.crypto && "getRandomValues" in globalThis.crypto) {
|
|
57
|
+
return globalThis.crypto.getRandomValues(new Uint8Array(length));
|
|
59
58
|
}
|
|
59
|
+
await _sodium.ready;
|
|
60
|
+
const sodium = _sodium;
|
|
61
|
+
return sodium.randombytes_buf(length);
|
|
60
62
|
};
|
|
61
63
|
/**
|
|
62
64
|
* @public
|
|
@@ -1,17 +1,45 @@
|
|
|
1
|
+
import { CallZomeRequest } from "../api/app/types.js";
|
|
2
|
+
import { CallZomeRequestSigned, CallZomeRequestUnsigned } from "../api/app/websocket.js";
|
|
1
3
|
import { InstalledAppId } from "../types.js";
|
|
2
|
-
import { CallZomeRequest, CallZomeRequestSigned } from "../api/index.js";
|
|
3
4
|
export interface LauncherEnvironment {
|
|
4
5
|
APP_INTERFACE_PORT?: number;
|
|
5
6
|
ADMIN_INTERFACE_PORT?: number;
|
|
6
7
|
INSTALLED_APP_ID?: InstalledAppId;
|
|
8
|
+
FRAMEWORK?: "tauri" | "electron";
|
|
9
|
+
}
|
|
10
|
+
export interface HostZomeCallSigner {
|
|
11
|
+
signZomeCall: (request: CallZomeRequest) => Promise<CallZomeRequestSigned>;
|
|
7
12
|
}
|
|
8
13
|
declare const __HC_LAUNCHER_ENV__ = "__HC_LAUNCHER_ENV__";
|
|
9
|
-
|
|
14
|
+
declare const __HC_ZOME_CALL_SIGNER__ = "__HC_ZOME_CALL_SIGNER__";
|
|
15
|
+
export declare const isLauncher: () => boolean;
|
|
10
16
|
export declare const getLauncherEnvironment: () => LauncherEnvironment | undefined;
|
|
17
|
+
export declare const getHostZomeCallSigner: () => HostZomeCallSigner | undefined;
|
|
11
18
|
declare global {
|
|
12
19
|
interface Window {
|
|
13
|
-
[__HC_LAUNCHER_ENV__]
|
|
20
|
+
[__HC_LAUNCHER_ENV__]?: LauncherEnvironment;
|
|
21
|
+
[__HC_ZOME_CALL_SIGNER__]?: HostZomeCallSigner;
|
|
22
|
+
electronAPI?: {
|
|
23
|
+
signZomeCall: (data: CallZomeRequestUnsignedElectron) => CallZomeRequestSignedElectron;
|
|
24
|
+
};
|
|
14
25
|
}
|
|
15
26
|
}
|
|
27
|
+
interface CallZomeRequestSignedElectron extends Omit<CallZomeRequestSigned, "cap_secret" | "cell_id" | "provenance" | "nonce" | "zome_name" | "fn_name" | "expires_at"> {
|
|
28
|
+
cellId: [Array<number>, Array<number>];
|
|
29
|
+
provenance: Array<number>;
|
|
30
|
+
zomeName: string;
|
|
31
|
+
fnName: string;
|
|
32
|
+
nonce: Array<number>;
|
|
33
|
+
expiresAt: number;
|
|
34
|
+
}
|
|
35
|
+
interface CallZomeRequestUnsignedElectron extends Omit<CallZomeRequestUnsigned, "cap_secret" | "cell_id" | "provenance" | "nonce" | "zome_name" | "fn_name" | "expires_at"> {
|
|
36
|
+
cellId: [Array<number>, Array<number>];
|
|
37
|
+
provenance: Array<number>;
|
|
38
|
+
zomeName: string;
|
|
39
|
+
fnName: string;
|
|
40
|
+
nonce: Array<number>;
|
|
41
|
+
expiresAt: number;
|
|
42
|
+
}
|
|
16
43
|
export declare const signZomeCallTauri: (request: CallZomeRequest) => Promise<CallZomeRequestSigned>;
|
|
44
|
+
export declare const signZomeCallElectron: (request: CallZomeRequest) => Promise<CallZomeRequestSigned>;
|
|
17
45
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { invoke } from "@tauri-apps/api/tauri";
|
|
2
|
-
import { getNonceExpiration, randomNonce, } from "../api/index.js";
|
|
3
1
|
import { encode } from "@msgpack/msgpack";
|
|
2
|
+
import { invoke } from "@tauri-apps/api/tauri";
|
|
3
|
+
import { getNonceExpiration, randomNonce } from "../api/zome-call-signing.js";
|
|
4
4
|
const __HC_LAUNCHER_ENV__ = "__HC_LAUNCHER_ENV__";
|
|
5
|
-
|
|
6
|
-
export const
|
|
5
|
+
const __HC_ZOME_CALL_SIGNER__ = "__HC_ZOME_CALL_SIGNER__";
|
|
6
|
+
export const isLauncher = () => globalThis.window && __HC_LAUNCHER_ENV__ in globalThis.window;
|
|
7
|
+
export const getLauncherEnvironment = () => isLauncher() ? globalThis.window[__HC_LAUNCHER_ENV__] : undefined;
|
|
8
|
+
export const getHostZomeCallSigner = () => globalThis.window && globalThis.window[__HC_ZOME_CALL_SIGNER__];
|
|
7
9
|
export const signZomeCallTauri = async (request) => {
|
|
8
10
|
const zomeCallUnsigned = {
|
|
9
11
|
provenance: Array.from(request.provenance),
|
|
@@ -31,3 +33,33 @@ export const signZomeCallTauri = async (request) => {
|
|
|
31
33
|
};
|
|
32
34
|
return signedZomeCall;
|
|
33
35
|
};
|
|
36
|
+
export const signZomeCallElectron = async (request) => {
|
|
37
|
+
if (!window.electronAPI) {
|
|
38
|
+
throw Error("Unable to signZomeCallElectron. window.electronAPI not defined");
|
|
39
|
+
}
|
|
40
|
+
const zomeCallUnsignedElectron = {
|
|
41
|
+
provenance: Array.from(request.provenance),
|
|
42
|
+
cellId: [Array.from(request.cell_id[0]), Array.from(request.cell_id[1])],
|
|
43
|
+
zomeName: request.zome_name,
|
|
44
|
+
fnName: request.fn_name,
|
|
45
|
+
payload: Array.from(encode(request.payload)),
|
|
46
|
+
nonce: Array.from(await randomNonce()),
|
|
47
|
+
expiresAt: getNonceExpiration(),
|
|
48
|
+
};
|
|
49
|
+
const zomeCallSignedElectron = await window.electronAPI.signZomeCall(zomeCallUnsignedElectron);
|
|
50
|
+
const zomeCallSigned = {
|
|
51
|
+
provenance: Uint8Array.from(zomeCallSignedElectron.provenance),
|
|
52
|
+
cap_secret: null,
|
|
53
|
+
cell_id: [
|
|
54
|
+
Uint8Array.from(zomeCallSignedElectron.cellId[0]),
|
|
55
|
+
Uint8Array.from(zomeCallSignedElectron.cellId[1]),
|
|
56
|
+
],
|
|
57
|
+
zome_name: zomeCallSignedElectron.zomeName,
|
|
58
|
+
fn_name: zomeCallSignedElectron.fnName,
|
|
59
|
+
payload: Uint8Array.from(zomeCallSignedElectron.payload),
|
|
60
|
+
signature: Uint8Array.from(zomeCallSignedElectron.signature),
|
|
61
|
+
expires_at: zomeCallSignedElectron.expiresAt,
|
|
62
|
+
nonce: Uint8Array.from(zomeCallSignedElectron.nonce),
|
|
63
|
+
};
|
|
64
|
+
return zomeCallSigned;
|
|
65
|
+
};
|
package/lib/hdk/action.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AgentPubKey, DnaHash, EntryHash, ActionHash, HoloHashed, Signature, Timestamp } from "../types.js";
|
|
2
|
-
import { EntryType } from "./entry.js";
|
|
2
|
+
import { Entry, EntryType } from "./entry.js";
|
|
3
|
+
import { LinkTag, LinkType, RateWeight } from "./link.js";
|
|
3
4
|
/**
|
|
4
5
|
* @public
|
|
5
6
|
*/
|
|
@@ -10,7 +11,14 @@ export interface SignedActionHashed<H extends Action = Action> {
|
|
|
10
11
|
/**
|
|
11
12
|
* @public
|
|
12
13
|
*/
|
|
13
|
-
export
|
|
14
|
+
export interface RegisterAgentActivity {
|
|
15
|
+
action: SignedActionHashed;
|
|
16
|
+
cached_entry?: Entry;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export type ActionHashed = HoloHashed<Action>;
|
|
14
22
|
/**
|
|
15
23
|
* @public
|
|
16
24
|
*/
|
|
@@ -29,11 +37,11 @@ export declare enum ActionType {
|
|
|
29
37
|
/**
|
|
30
38
|
* @public
|
|
31
39
|
*/
|
|
32
|
-
export
|
|
40
|
+
export type Action = Dna | AgentValidationPkg | InitZomesComplete | CreateLink | DeleteLink | OpenChain | CloseChain | Delete | NewEntryAction;
|
|
33
41
|
/**
|
|
34
42
|
* @public
|
|
35
43
|
*/
|
|
36
|
-
export
|
|
44
|
+
export type NewEntryAction = Create | Update;
|
|
37
45
|
/**
|
|
38
46
|
* @public
|
|
39
47
|
*/
|
|
@@ -75,8 +83,10 @@ export interface CreateLink {
|
|
|
75
83
|
prev_action: ActionHash;
|
|
76
84
|
base_address: EntryHash;
|
|
77
85
|
target_address: EntryHash;
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
zome_index: number;
|
|
87
|
+
link_type: LinkType;
|
|
88
|
+
tag: LinkTag;
|
|
89
|
+
weight: RateWeight;
|
|
80
90
|
}
|
|
81
91
|
/**
|
|
82
92
|
* @public
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FunctionName, ZomeName } from "../api/
|
|
1
|
+
import { FunctionName, ZomeName } from "../api/admin/types.js";
|
|
2
2
|
import { AgentPubKey } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type CapSecret = Uint8Array;
|
|
7
7
|
/**
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
@@ -22,7 +22,7 @@ export declare enum GrantedFunctionsType {
|
|
|
22
22
|
/**
|
|
23
23
|
* @public
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export type GrantedFunctions = {
|
|
26
26
|
[GrantedFunctionsType.All]: null;
|
|
27
27
|
} | {
|
|
28
28
|
[GrantedFunctionsType.Listed]: [ZomeName, FunctionName][];
|
|
@@ -38,12 +38,22 @@ export interface ZomeCallCapGrant {
|
|
|
38
38
|
/**
|
|
39
39
|
* @public
|
|
40
40
|
*/
|
|
41
|
-
export declare
|
|
42
|
-
|
|
41
|
+
export declare enum CapAccessType {
|
|
42
|
+
Unrestricted = "Unrestricted",
|
|
43
|
+
Transferable = "Transferable",
|
|
44
|
+
Assigned = "Assigned"
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export type CapAccess = {
|
|
50
|
+
[CapAccessType.Unrestricted]: null;
|
|
51
|
+
} | {
|
|
52
|
+
[CapAccessType.Transferable]: {
|
|
43
53
|
secret: CapSecret;
|
|
44
54
|
};
|
|
45
55
|
} | {
|
|
46
|
-
Assigned: {
|
|
56
|
+
[CapAccessType.Assigned]: {
|
|
47
57
|
secret: CapSecret;
|
|
48
58
|
assignees: AgentPubKey[];
|
|
49
59
|
};
|
|
@@ -51,7 +61,7 @@ export declare type CapAccess = "Unrestricted" | {
|
|
|
51
61
|
/**
|
|
52
62
|
* @public
|
|
53
63
|
*/
|
|
54
|
-
export
|
|
64
|
+
export type CapGrant = {
|
|
55
65
|
ChainAuthor: AgentPubKey;
|
|
56
66
|
} | {
|
|
57
67
|
RemoteAgent: ZomeCallCapGrant;
|
package/lib/hdk/capabilities.js
CHANGED
|
@@ -6,3 +6,12 @@ export var GrantedFunctionsType;
|
|
|
6
6
|
GrantedFunctionsType["All"] = "All";
|
|
7
7
|
GrantedFunctionsType["Listed"] = "Listed";
|
|
8
8
|
})(GrantedFunctionsType || (GrantedFunctionsType = {}));
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export var CapAccessType;
|
|
13
|
+
(function (CapAccessType) {
|
|
14
|
+
CapAccessType["Unrestricted"] = "Unrestricted";
|
|
15
|
+
CapAccessType["Transferable"] = "Transferable";
|
|
16
|
+
CapAccessType["Assigned"] = "Assigned";
|
|
17
|
+
})(CapAccessType || (CapAccessType = {}));
|
|
@@ -28,7 +28,7 @@ export interface CounterSigningSessionTimes {
|
|
|
28
28
|
/**
|
|
29
29
|
* @public
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export type ActionBase = {
|
|
32
32
|
Create: CreateBase;
|
|
33
33
|
} | {
|
|
34
34
|
Update: UpdateBase;
|
|
@@ -50,15 +50,15 @@ export interface UpdateBase {
|
|
|
50
50
|
/**
|
|
51
51
|
* @public
|
|
52
52
|
*/
|
|
53
|
-
export
|
|
53
|
+
export type CounterSigningAgents = Array<[AgentPubKey, Array<Role>]>;
|
|
54
54
|
/**
|
|
55
55
|
* @public
|
|
56
56
|
*/
|
|
57
|
-
export
|
|
57
|
+
export type PreflightBytes = Uint8Array;
|
|
58
58
|
/**
|
|
59
59
|
* @public
|
|
60
60
|
*/
|
|
61
|
-
export
|
|
61
|
+
export type Role = number;
|
|
62
62
|
/**
|
|
63
63
|
* @public
|
|
64
64
|
*/
|
package/lib/hdk/dht-ops.d.ts
CHANGED
package/lib/hdk/entry.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { CounterSigningSessionData } from "./countersigning.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type EntryVisibility = {
|
|
8
8
|
Public: null;
|
|
9
9
|
} | {
|
|
10
10
|
Private: null;
|
|
@@ -12,7 +12,7 @@ export declare type EntryVisibility = {
|
|
|
12
12
|
/**
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export
|
|
15
|
+
export type AppEntryDef = {
|
|
16
16
|
entry_index: number;
|
|
17
17
|
zome_index: number;
|
|
18
18
|
visibility: EntryVisibility;
|
|
@@ -20,7 +20,7 @@ export declare type AppEntryDef = {
|
|
|
20
20
|
/**
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export type EntryType = "Agent" | {
|
|
24
24
|
App: AppEntryDef;
|
|
25
25
|
} | "CapClaim" | "CapGrant";
|
|
26
26
|
/**
|
|
@@ -33,4 +33,4 @@ export interface EntryContent<E extends string, C> {
|
|
|
33
33
|
/**
|
|
34
34
|
* @public
|
|
35
35
|
*/
|
|
36
|
-
export
|
|
36
|
+
export type Entry = EntryContent<"Agent", AgentPubKey> | EntryContent<"App", Uint8Array> | EntryContent<"CounterSign", [CounterSigningSessionData, Uint8Array]> | EntryContent<"CapGrant", ZomeCallCapGrant> | EntryContent<"CapClaim", CapClaim>;
|
package/lib/hdk/index.d.ts
CHANGED
package/lib/hdk/index.js
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ActionHash, AgentPubKey, EntryHash, ExternalHash, Timestamp } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export type AnyLinkableHash = EntryHash | ActionHash | ExternalHash;
|
|
6
|
+
/**
|
|
7
|
+
* An internal zome index within the DNA, from 0 to 255.
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export type ZomeIndex = number;
|
|
12
|
+
/**
|
|
13
|
+
* An internal link type index within the DNA, from 0 to 255.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export type LinkType = number;
|
|
18
|
+
/**
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export type LinkTag = Uint8Array;
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export interface RateWeight {
|
|
26
|
+
bucket_id: RateBucketId;
|
|
27
|
+
units: RateUnits;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export type RateBucketId = number;
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export type RateUnits = number;
|
|
37
|
+
/**
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export interface Link {
|
|
41
|
+
author: AgentPubKey;
|
|
42
|
+
target: AnyLinkableHash;
|
|
43
|
+
timestamp: Timestamp;
|
|
44
|
+
zome_index: ZomeIndex;
|
|
45
|
+
link_type: LinkType;
|
|
46
|
+
tag: Uint8Array;
|
|
47
|
+
create_link_hash: ActionHash;
|
|
48
|
+
}
|
package/lib/hdk/link.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/hdk/record.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ import { Entry } from "./entry.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type Record = {
|
|
7
7
|
signed_action: SignedActionHashed;
|
|
8
8
|
entry: RecordEntry;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type RecordEntry = {
|
|
14
14
|
Present: Entry;
|
|
15
15
|
} | {
|
|
16
16
|
Hidden: void;
|