@ddd-qc/cell-proxy 0.10.0 → 0.11.0
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/README.md +2 -2
- package/dist/CellProxy.d.ts +58 -58
- package/dist/CellProxy.js +165 -165
- package/dist/ConductorAppProxy.d.ts +74 -74
- package/dist/ConductorAppProxy.js +334 -338
- package/dist/ConductorAppProxy.js.map +1 -1
- package/dist/ZomeProxy.d.ts +34 -34
- package/dist/ZomeProxy.js +56 -56
- package/dist/hcl.d.ts +25 -26
- package/dist/hcl.js +55 -56
- package/dist/hcl.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -7
- package/dist/mixins.d.ts +40 -40
- package/dist/mixins.js +50 -50
- package/dist/types.d.ts +30 -30
- package/dist/types.js +32 -31
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +37 -37
- package/dist/utils.js +108 -108
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { CellId, AgentPubKeyB64, DnaHashB64, Cell } from "@holochain/client";
|
|
2
|
-
import { AgentPubKey, DnaHash } from "@holochain/client/lib/types";
|
|
3
|
-
import { Dictionary } from "./utils";
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export interface ICell {
|
|
8
|
-
get cell(): Cell;
|
|
9
|
-
get dnaHash(): DnaHashB64;
|
|
10
|
-
get agentPubKey(): AgentPubKeyB64;
|
|
11
|
-
}
|
|
12
|
-
export type BaseRoleName = string;
|
|
13
|
-
export type CloneIndex = number;
|
|
14
|
-
export type CellsForRole = {
|
|
15
|
-
provisioned: Cell;
|
|
16
|
-
/**
|
|
17
|
-
clones: Dictionary<Cell>;
|
|
18
|
-
};
|
|
19
|
-
/** BaseRoleName -> RoleCells */
|
|
20
|
-
export type RoleCellsMap = Dictionary<CellsForRole>;
|
|
21
|
-
/** --
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export declare function createCloneName(baseRoleName: BaseRoleName, cloneIndex: CloneIndex):
|
|
25
|
-
export declare function
|
|
26
|
-
/** -- CellIdStr -- */
|
|
27
|
-
export type CellIdStr = string;
|
|
28
|
-
export declare function CellIdStr(hash_or_id: DnaHash | CellId, key?: AgentPubKey): CellIdStr;
|
|
29
|
-
/** */
|
|
30
|
-
export declare function str2CellId(str: CellIdStr): CellId;
|
|
1
|
+
import { CellId, AgentPubKeyB64, DnaHashB64, Cell, RoleName } from "@holochain/client";
|
|
2
|
+
import { AgentPubKey, DnaHash } from "@holochain/client/lib/types";
|
|
3
|
+
import { Dictionary } from "./utils";
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export interface ICell {
|
|
8
|
+
get cell(): Cell;
|
|
9
|
+
get dnaHash(): DnaHashB64;
|
|
10
|
+
get agentPubKey(): AgentPubKeyB64;
|
|
11
|
+
}
|
|
12
|
+
export type BaseRoleName = string;
|
|
13
|
+
export type CloneIndex = number;
|
|
14
|
+
export type CellsForRole = {
|
|
15
|
+
provisioned: Cell;
|
|
16
|
+
/** CloneId -> Cell */
|
|
17
|
+
clones: Dictionary<Cell>;
|
|
18
|
+
};
|
|
19
|
+
/** BaseRoleName -> RoleCells */
|
|
20
|
+
export type RoleCellsMap = Dictionary<CellsForRole>;
|
|
21
|
+
/** -- CloneId -- */
|
|
22
|
+
export type CloneId = RoleName;
|
|
23
|
+
/** type for string "<baseRoleName>.<cloneIndex>" */
|
|
24
|
+
export declare function createCloneName(baseRoleName: BaseRoleName, cloneIndex: CloneIndex): string;
|
|
25
|
+
export declare function destructureCloneId(cloneId: CloneId): [BaseRoleName, CloneIndex] | undefined;
|
|
26
|
+
/** -- CellIdStr -- */
|
|
27
|
+
export type CellIdStr = string;
|
|
28
|
+
export declare function CellIdStr(hash_or_id: DnaHash | CellId, key?: AgentPubKey): CellIdStr;
|
|
29
|
+
/** */
|
|
30
|
+
export declare function str2CellId(str: CellIdStr): CellId;
|
package/dist/types.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { decodeHashFromBase64, encodeHashToBase64 } from "@holochain/client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import { decodeHashFromBase64, encodeHashToBase64 } from "@holochain/client";
|
|
2
|
+
/** type for string "<baseRoleName>.<cloneIndex>" */
|
|
3
|
+
export function createCloneName(baseRoleName, cloneIndex) {
|
|
4
|
+
//if (!cloneIndex) return baseRoleName as CloneName;
|
|
5
|
+
return "" + baseRoleName + "." + cloneIndex;
|
|
6
|
+
}
|
|
7
|
+
export function destructureCloneId(cloneId) {
|
|
8
|
+
const subs = cloneId.split(".");
|
|
9
|
+
if (subs.length != 2) {
|
|
10
|
+
//throw Error(`Bad RoleInstance id format: "${id}"`);
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
return [subs[0], Number(subs[1])];
|
|
14
|
+
}
|
|
15
|
+
const CELL_ID_SEPARATOR = "||";
|
|
16
|
+
export function CellIdStr(hash_or_id, key) {
|
|
17
|
+
if (Array.isArray(hash_or_id)) {
|
|
18
|
+
return "" + encodeHashToBase64(hash_or_id[0]) + CELL_ID_SEPARATOR + encodeHashToBase64(hash_or_id[1]);
|
|
19
|
+
}
|
|
20
|
+
if (!key) {
|
|
21
|
+
throw Error("CellIdStr() failed. AgentPubKey not provided");
|
|
22
|
+
}
|
|
23
|
+
return "" + encodeHashToBase64(hash_or_id) + CELL_ID_SEPARATOR + encodeHashToBase64(key);
|
|
24
|
+
}
|
|
25
|
+
/** */
|
|
26
|
+
export function str2CellId(str) {
|
|
27
|
+
const subs = str.split(CELL_ID_SEPARATOR);
|
|
28
|
+
if (subs.length != 2) {
|
|
29
|
+
throw Error("str2CellId() failed. Bad input string format");
|
|
30
|
+
}
|
|
31
|
+
return [decodeHashFromBase64(subs[0]), decodeHashFromBase64(subs[1])];
|
|
32
|
+
}
|
|
32
33
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EACpB,kBAAkB,EAInB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EACpB,kBAAkB,EAInB,MAAM,mBAAmB,CAAC;AAqC3B,oDAAoD;AACpD,MAAM,UAAU,eAAe,CAAC,YAA0B,EAAE,UAAsB;IAChF,oDAAoD;IACpD,OAAO,EAAE,GAAG,YAAY,GAAG,GAAG,GAAG,UAAU,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;QACpB,qDAAqD;QACrD,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAe,CAAC,CAAC;AAClE,CAAC;AASD,MAAM,iBAAiB,GAAG,IAAI,CAAA;AAE9B,MAAM,UAAU,SAAS,CAAC,UAA4B,EAAE,GAAiB;IACvE,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC7B,OAAO,EAAE,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;KACvG;IACD,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAC;KAC7D;IACD,OAAO,EAAE,GAAG,kBAAkB,CAAC,UAAU,CAAC,GAAG,iBAAiB,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;AAC3F,CAAC;AAED,MAAM;AACN,MAAM,UAAU,UAAU,CAAC,GAAc;IACvC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;QACpB,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAC;KAC7D;IACD,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACvE,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { CellId, AppInfo, CellInfo, Cell } from "@holochain/client";
|
|
2
|
-
import { StemCell } from "@holochain/client/lib/api/admin/types";
|
|
3
|
-
export declare type Dictionary<T> = {
|
|
4
|
-
[key: string]: T;
|
|
5
|
-
};
|
|
6
|
-
/** */
|
|
7
|
-
export declare function areArraysEqual(first: Uint8Array, second: Uint8Array): boolean;
|
|
8
|
-
/** */
|
|
9
|
-
export declare function areCellsEqual(cellA: CellId, cellB: CellId): boolean;
|
|
10
|
-
/** */
|
|
11
|
-
export declare const delay: (ms: number) => Promise<unknown>;
|
|
12
|
-
/**
|
|
13
|
-
* Checks if obj is a Hash or list of hashes and tries to convert it a B64 or list of B64
|
|
14
|
-
*/
|
|
15
|
-
export declare function anyToB64(obj: any): any;
|
|
16
|
-
export declare function prettyDuration(date: Date): string;
|
|
17
|
-
/** */
|
|
18
|
-
export declare function prettyDate(date: Date): string;
|
|
19
|
-
/** ... */
|
|
20
|
-
export declare function intoStem(cellInfo: CellInfo): StemCell | undefined;
|
|
21
|
-
/** ... */
|
|
22
|
-
export declare function intoCell(cellInfo: CellInfo): Cell | undefined;
|
|
23
|
-
/** */
|
|
24
|
-
export declare function printAppInfo(appInfo: AppInfo): string;
|
|
25
|
-
/** */
|
|
26
|
-
export declare function printCell(cell: Cell): string;
|
|
27
|
-
/** -- Experimental -- */
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
export declare class Queue<T> {
|
|
32
|
-
private _store;
|
|
33
|
-
get length(): number;
|
|
34
|
-
push(val: T): void;
|
|
35
|
-
pop(): T | undefined;
|
|
36
|
-
isEmpty(): boolean;
|
|
37
|
-
}
|
|
1
|
+
import { CellId, AppInfo, CellInfo, Cell } from "@holochain/client";
|
|
2
|
+
import { StemCell } from "@holochain/client/lib/api/admin/types";
|
|
3
|
+
export declare type Dictionary<T> = {
|
|
4
|
+
[key: string]: T;
|
|
5
|
+
};
|
|
6
|
+
/** */
|
|
7
|
+
export declare function areArraysEqual(first: Uint8Array, second: Uint8Array): boolean;
|
|
8
|
+
/** */
|
|
9
|
+
export declare function areCellsEqual(cellA: CellId, cellB: CellId): boolean;
|
|
10
|
+
/** */
|
|
11
|
+
export declare const delay: (ms: number) => Promise<unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if obj is a Hash or list of hashes and tries to convert it a B64 or list of B64
|
|
14
|
+
*/
|
|
15
|
+
export declare function anyToB64(obj: any): any;
|
|
16
|
+
export declare function prettyDuration(date: Date): string;
|
|
17
|
+
/** */
|
|
18
|
+
export declare function prettyDate(date: Date): string;
|
|
19
|
+
/** ... */
|
|
20
|
+
export declare function intoStem(cellInfo: CellInfo): StemCell | undefined;
|
|
21
|
+
/** ... */
|
|
22
|
+
export declare function intoCell(cellInfo: CellInfo): Cell | undefined;
|
|
23
|
+
/** */
|
|
24
|
+
export declare function printAppInfo(appInfo: AppInfo): string;
|
|
25
|
+
/** */
|
|
26
|
+
export declare function printCell(cell: Cell): string;
|
|
27
|
+
/** -- Experimental -- */
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
export declare class Queue<T> {
|
|
32
|
+
private _store;
|
|
33
|
+
get length(): number;
|
|
34
|
+
push(val: T): void;
|
|
35
|
+
pop(): T | undefined;
|
|
36
|
+
isEmpty(): boolean;
|
|
37
|
+
}
|
package/dist/utils.js
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import { encodeHashToBase64 } from "@holochain/client";
|
|
2
|
-
import { CellType } from "@holochain/client";
|
|
3
|
-
/** */
|
|
4
|
-
export function areArraysEqual(first, second) {
|
|
5
|
-
return first.length === second.length && first.every((value, index) => value === second[index]);
|
|
6
|
-
}
|
|
7
|
-
/** */
|
|
8
|
-
export function areCellsEqual(cellA, cellB) {
|
|
9
|
-
return areArraysEqual(cellA[0], cellB[0]) && areArraysEqual(cellA[1], cellB[1]);
|
|
10
|
-
}
|
|
11
|
-
/** */
|
|
12
|
-
export const delay = (ms) => new Promise(r => setTimeout(r, ms));
|
|
13
|
-
/**
|
|
14
|
-
* Checks if obj is a Hash or list of hashes and tries to convert it a B64 or list of B64
|
|
15
|
-
*/
|
|
16
|
-
export function anyToB64(obj) {
|
|
17
|
-
/** Check if it's a hash */
|
|
18
|
-
if (obj instanceof Uint8Array) {
|
|
19
|
-
return encodeHashToBase64(obj);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
/** Check if it's an array of hashes */
|
|
23
|
-
if (Array.isArray(obj)) {
|
|
24
|
-
const isUint8Array = obj.length > 0 &&
|
|
25
|
-
obj.every((value) => {
|
|
26
|
-
return value instanceof Uint8Array;
|
|
27
|
-
});
|
|
28
|
-
if (isUint8Array) {
|
|
29
|
-
let result = [];
|
|
30
|
-
for (const cur of obj) {
|
|
31
|
-
result.push(encodeHashToBase64(cur));
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return obj;
|
|
38
|
-
}
|
|
39
|
-
/** -- Pretty print -- */
|
|
40
|
-
const zeroPad = (num, places) => String(num).padStart(places, '0');
|
|
41
|
-
export function prettyDuration(date) {
|
|
42
|
-
return date.getSeconds() + "." + zeroPad(date.getMilliseconds(), 3);
|
|
43
|
-
}
|
|
44
|
-
/** */
|
|
45
|
-
export function prettyDate(date) {
|
|
46
|
-
return ""
|
|
47
|
-
+ zeroPad(date.getHours(), 2)
|
|
48
|
-
+ ":" + zeroPad(date.getMinutes(), 2)
|
|
49
|
-
+ ":" + zeroPad(date.getSeconds(), 2)
|
|
50
|
-
+ "." + zeroPad(date.getMilliseconds(), 3);
|
|
51
|
-
}
|
|
52
|
-
/** ... */
|
|
53
|
-
export function intoStem(cellInfo) {
|
|
54
|
-
if (CellType.Stem in cellInfo) {
|
|
55
|
-
return cellInfo.Stem;
|
|
56
|
-
}
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
/** ... */
|
|
60
|
-
export function intoCell(cellInfo) {
|
|
61
|
-
if (CellType.Stem in cellInfo) {
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
if (CellType.Cloned in cellInfo) {
|
|
65
|
-
return cellInfo.Cloned;
|
|
66
|
-
}
|
|
67
|
-
if (CellType.Provisioned in cellInfo) {
|
|
68
|
-
return cellInfo.Provisioned;
|
|
69
|
-
}
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
/** */
|
|
73
|
-
export function printAppInfo(appInfo) {
|
|
74
|
-
let print = `Happ "${appInfo.installed_app_id}" info: (status: ${JSON.stringify(appInfo.status)})`;
|
|
75
|
-
for (const [roleName, cellInfos] of Object.entries(appInfo.cell_info)) {
|
|
76
|
-
for (const cellInfo of Object.values(cellInfos)) {
|
|
77
|
-
if (CellType.Stem in cellInfo) {
|
|
78
|
-
const stem = intoStem(cellInfo);
|
|
79
|
-
print += `\n - ${roleName}.${stem.name ? stem.name : "unnamed"} : ${encodeHashToBase64(stem.dna)} (stem)`;
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
const cell = intoCell(cellInfo);
|
|
83
|
-
print += `\n - ${roleName}.${cell.name}${cell.name ? "." + cell.name : ""} : ${encodeHashToBase64(cell.cell_id[0])}`;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return print;
|
|
87
|
-
}
|
|
88
|
-
/** */
|
|
89
|
-
export function printCell(cell) {
|
|
90
|
-
return `Cell "${cell.name}${cell.clone_id ? "." + cell.clone_id : ""}": ${encodeHashToBase64(cell.cell_id[0])}`;
|
|
91
|
-
}
|
|
92
|
-
/** -- Experimental -- */
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
*/
|
|
96
|
-
export class Queue {
|
|
97
|
-
constructor() {
|
|
98
|
-
this._store = [];
|
|
99
|
-
}
|
|
100
|
-
get length() { return this._store.length; }
|
|
101
|
-
push(val) {
|
|
102
|
-
this._store.push(val);
|
|
103
|
-
}
|
|
104
|
-
pop() {
|
|
105
|
-
return this._store.shift();
|
|
106
|
-
}
|
|
107
|
-
isEmpty() { return this._store.length == 0; }
|
|
108
|
-
}
|
|
1
|
+
import { encodeHashToBase64 } from "@holochain/client";
|
|
2
|
+
import { CellType } from "@holochain/client";
|
|
3
|
+
/** */
|
|
4
|
+
export function areArraysEqual(first, second) {
|
|
5
|
+
return first.length === second.length && first.every((value, index) => value === second[index]);
|
|
6
|
+
}
|
|
7
|
+
/** */
|
|
8
|
+
export function areCellsEqual(cellA, cellB) {
|
|
9
|
+
return areArraysEqual(cellA[0], cellB[0]) && areArraysEqual(cellA[1], cellB[1]);
|
|
10
|
+
}
|
|
11
|
+
/** */
|
|
12
|
+
export const delay = (ms) => new Promise(r => setTimeout(r, ms));
|
|
13
|
+
/**
|
|
14
|
+
* Checks if obj is a Hash or list of hashes and tries to convert it a B64 or list of B64
|
|
15
|
+
*/
|
|
16
|
+
export function anyToB64(obj) {
|
|
17
|
+
/** Check if it's a hash */
|
|
18
|
+
if (obj instanceof Uint8Array) {
|
|
19
|
+
return encodeHashToBase64(obj);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
/** Check if it's an array of hashes */
|
|
23
|
+
if (Array.isArray(obj)) {
|
|
24
|
+
const isUint8Array = obj.length > 0 &&
|
|
25
|
+
obj.every((value) => {
|
|
26
|
+
return value instanceof Uint8Array;
|
|
27
|
+
});
|
|
28
|
+
if (isUint8Array) {
|
|
29
|
+
let result = [];
|
|
30
|
+
for (const cur of obj) {
|
|
31
|
+
result.push(encodeHashToBase64(cur));
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return obj;
|
|
38
|
+
}
|
|
39
|
+
/** -- Pretty print -- */
|
|
40
|
+
const zeroPad = (num, places) => String(num).padStart(places, '0');
|
|
41
|
+
export function prettyDuration(date) {
|
|
42
|
+
return date.getSeconds() + "." + zeroPad(date.getMilliseconds(), 3);
|
|
43
|
+
}
|
|
44
|
+
/** */
|
|
45
|
+
export function prettyDate(date) {
|
|
46
|
+
return ""
|
|
47
|
+
+ zeroPad(date.getHours(), 2)
|
|
48
|
+
+ ":" + zeroPad(date.getMinutes(), 2)
|
|
49
|
+
+ ":" + zeroPad(date.getSeconds(), 2)
|
|
50
|
+
+ "." + zeroPad(date.getMilliseconds(), 3);
|
|
51
|
+
}
|
|
52
|
+
/** ... */
|
|
53
|
+
export function intoStem(cellInfo) {
|
|
54
|
+
if (CellType.Stem in cellInfo) {
|
|
55
|
+
return cellInfo.Stem;
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
/** ... */
|
|
60
|
+
export function intoCell(cellInfo) {
|
|
61
|
+
if (CellType.Stem in cellInfo) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
if (CellType.Cloned in cellInfo) {
|
|
65
|
+
return cellInfo.Cloned;
|
|
66
|
+
}
|
|
67
|
+
if (CellType.Provisioned in cellInfo) {
|
|
68
|
+
return cellInfo.Provisioned;
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
/** */
|
|
73
|
+
export function printAppInfo(appInfo) {
|
|
74
|
+
let print = `Happ "${appInfo.installed_app_id}" info: (status: ${JSON.stringify(appInfo.status)})`;
|
|
75
|
+
for (const [roleName, cellInfos] of Object.entries(appInfo.cell_info)) {
|
|
76
|
+
for (const cellInfo of Object.values(cellInfos)) {
|
|
77
|
+
if (CellType.Stem in cellInfo) {
|
|
78
|
+
const stem = intoStem(cellInfo);
|
|
79
|
+
print += `\n - ${roleName}.${stem.name ? stem.name : "unnamed"} : ${encodeHashToBase64(stem.dna)} (stem)`;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const cell = intoCell(cellInfo);
|
|
83
|
+
print += `\n - ${roleName}.${cell.name}${cell.name ? "." + cell.name : ""} : ${encodeHashToBase64(cell.cell_id[0])}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return print;
|
|
87
|
+
}
|
|
88
|
+
/** */
|
|
89
|
+
export function printCell(cell) {
|
|
90
|
+
return `Cell "${cell.name}${cell.clone_id ? "." + cell.clone_id : ""}": ${encodeHashToBase64(cell.cell_id[0])}`;
|
|
91
|
+
}
|
|
92
|
+
/** -- Experimental -- */
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
export class Queue {
|
|
97
|
+
constructor() {
|
|
98
|
+
this._store = [];
|
|
99
|
+
}
|
|
100
|
+
get length() { return this._store.length; }
|
|
101
|
+
push(val) {
|
|
102
|
+
this._store.push(val);
|
|
103
|
+
}
|
|
104
|
+
pop() {
|
|
105
|
+
return this._store.shift();
|
|
106
|
+
}
|
|
107
|
+
isEmpty() { return this._store.length == 0; }
|
|
108
|
+
}
|
|
109
109
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ddd-qc/cell-proxy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Proxy classes and helpers for managing a Holochain AppWebsocket",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/ddd-mtl/lit-happ#readme",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@holochain/client": "^0.11.
|
|
26
|
+
"@holochain/client": "^0.11.9"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tslib": "^2.4.0",
|