@ddd-qc/cell-proxy 0.9.8 → 0.10.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.
@@ -1,71 +1,74 @@
1
- import { AppApi, AppInfoRequest, AppInfoResponse, AppSignal, AppSignalCb, AppWebsocket, CallZomeRequest, CellId, InstalledAppId, InstalledCell } from "@holochain/client";
2
- import { CellProxy } from "./CellProxy";
3
- import { CellsMap, BaseRoleName, RoleInstanceId, RoleCells } from "./types";
4
- import { ArchiveCloneCellRequest, CreateCloneCellRequest } from "@holochain/client/lib/api/app/types";
5
- import { HCL, HCLString } from "./hcl";
6
- /** */
7
- export interface SignalUnsubscriber {
8
- unsubscribe: () => void;
9
- }
10
- /**
11
- * Creates, connects and holds a appWebsocket.
12
- * Creates and holds Cell proxies for this appWebsocket.
13
- * Maintains a mapping between CellIds and HCLs
14
- * Handles SignalHandlers per HCL
15
- * Stores appSignal logs
16
- * TODO Implement Singleton per App port?
17
- */
18
- export declare class ConductorAppProxy implements AppApi {
19
- defaultTimeout: number;
20
- /** -- Fields -- */
21
- private _appWs;
22
- /** [Timestamp, CellIdStr, Signal] */
23
- private _signalLogs;
24
- /** InstalledAppId -> (BaseRoleName -> RoleInstalledCells) */
25
- private _installedCellsByApp;
26
- /** CellIdStr -> HCL[] */
27
- private _hclMap;
28
- /** HCLString -> AppSignalCb */
29
- private _signalHandlers;
30
- /** CellIdStr -> CellProxy */
31
- private _cellProxies;
32
- /** -- Getters -- */
33
- /** */
34
- getAppCells(appId: InstalledAppId): CellsMap | undefined;
35
- /** */
36
- getLocations(cellId: CellId): HCL[] | undefined;
37
- /** */
38
- getCell(hcl: HCL): InstalledCell;
39
- /** Get stored CellProxy or attempt to create it */
40
- getCellProxy(cellIdOrLoc: HCL | CellId): CellProxy;
41
- /** */
42
- getAppRoleInstanceIds(installedAppId: InstalledAppId): RoleInstanceId[] | undefined;
43
- /** */
44
- getClones(appId: InstalledAppId, baseRoleName: BaseRoleName): InstalledCell[];
45
- /** -- AppApi (Passthrough to appWebsocket) -- */
46
- createCloneCell(request: CreateCloneCellRequest): Promise<InstalledCell>;
47
- archiveCloneCell(request: ArchiveCloneCellRequest): Promise<void>;
48
- appInfo(args: AppInfoRequest): Promise<AppInfoResponse>;
49
- callZome(req: CallZomeRequest, timeout?: number): Promise<any>;
50
- /** -- Creation -- */
51
- /** async Factory */
52
- static new(port_or_socket: number | AppWebsocket, defaultTimeout?: number): Promise<ConductorAppProxy>;
53
- /** */
54
- private static fromSocket;
55
- /** Ctor */
56
- private constructor();
57
- /** -- Methods -- */
58
- fetchCells(appId: InstalledAppId, baseRoleName: BaseRoleName): Promise<RoleCells>;
59
- /** */
60
- addClone(hcl: HCL, cloneCell: InstalledCell): void;
61
- /** */
62
- createCellProxy(hcl: HCL): CellProxy;
63
- /** */
64
- onSignal(signal: AppSignal): void;
65
- /** Store signalHandler to internal handler array */
66
- addSignalHandler(handler: AppSignalCb, hcl?: HCLString): SignalUnsubscriber;
67
- /** Log all signals received */
68
- private logSignal;
69
- /** */
70
- dumpSignals(cellId?: CellId): void;
71
- }
1
+ import { AppApi, AppInfoRequest, AppInfoResponse, AppSignal, AppSignalCb, AppWebsocket, CallZomeRequest, CellId, InstalledAppId, InstalledCell, CreateCloneCellRequest, DisableCloneCellRequest, EnableCloneCellRequest, Cell } from "@holochain/client";
2
+ import { CellProxy } from "./CellProxy";
3
+ import { RoleCellsMap, BaseRoleName, CellsForRole } from "./types";
4
+ import { HCL, HCLString } from "./hcl";
5
+ /** */
6
+ export interface SignalUnsubscriber {
7
+ unsubscribe: () => void;
8
+ }
9
+ /**
10
+ * Creates, connects and holds a appWebsocket.
11
+ * Creates and holds Cell proxies for this appWebsocket.
12
+ * Maintains a mapping between CellIds and HCLs
13
+ * Handles SignalHandlers per HCL
14
+ * Stores appSignal logs
15
+ * TODO Implement Singleton per App port?
16
+ */
17
+ export declare class ConductorAppProxy implements AppApi {
18
+ defaultTimeout: number;
19
+ /** -- Fields -- */
20
+ private _appWs;
21
+ /** Signal log: [Timestamp, CellIdStr, Signal] */
22
+ private _signalLogs;
23
+ /** Map cells per App: InstalledAppId -> (BaseRoleName -> RoleInstalledCells) */
24
+ private _cellsByApp;
25
+ /** Map cell locations: CellIdStr -> HCL[] */
26
+ private _hclMap;
27
+ /** Store handlers per cell locaiton: HCLString -> AppSignalCb */
28
+ private _signalHandlers;
29
+ /** Store cell proxies per cell: CellIdStr -> CellProxy */
30
+ private _cellProxies;
31
+ /** -- Getters -- */
32
+ /** */
33
+ getAppCells(appId: InstalledAppId): RoleCellsMap | undefined;
34
+ /** */
35
+ getLocations(cellId: CellId): HCL[] | undefined;
36
+ /** */
37
+ getCell(hcl: HCL): Cell;
38
+ /** Get stored CellProxy or attempt to create it */
39
+ getCellProxy(cellIdOrLoc: HCL | CellId): CellProxy;
40
+ /** */
41
+ getAppRoles(installedAppId: InstalledAppId): BaseRoleName[] | undefined;
42
+ /** */
43
+ getClones(appId: InstalledAppId, baseRoleName: BaseRoleName): Cell[];
44
+ createCloneCell(request: CreateCloneCellRequest): Promise<InstalledCell>;
45
+ /** -- AppApi (Passthrough to appWebsocket) -- */
46
+ enableCloneCell(request: EnableCloneCellRequest): Promise<InstalledCell>;
47
+ disableCloneCell(request: DisableCloneCellRequest): Promise<void>;
48
+ appInfo(args: AppInfoRequest): Promise<AppInfoResponse>;
49
+ callZome(req: CallZomeRequest, timeout?: number): Promise<any>;
50
+ /** -- Creation -- */
51
+ /** async Factory */
52
+ static new(port_or_socket: number | AppWebsocket, defaultTimeout?: number): Promise<ConductorAppProxy>;
53
+ /** */
54
+ private static fromSocket;
55
+ /** Ctor */
56
+ private constructor();
57
+ /** -- Methods -- */
58
+ /** */
59
+ fetchCell(appId: InstalledAppId, cellId: CellId): Promise<Cell>;
60
+ /** */
61
+ fetchCells(appId: InstalledAppId, baseRoleName: BaseRoleName): Promise<CellsForRole>;
62
+ /** */
63
+ addClone(hcl: HCL, cloneCell: Cell): void;
64
+ /** */
65
+ createCellProxy(hcl: HCL): CellProxy;
66
+ /** */
67
+ onSignal(signal: AppSignal): void;
68
+ /** Store signalHandler to internal handler array */
69
+ addSignalHandler(handler: AppSignalCb, hcl?: HCLString): SignalUnsubscriber;
70
+ /** Log all signals received */
71
+ private logSignal;
72
+ /** */
73
+ dumpSignals(cellId?: CellId): void;
74
+ }