@holochain/client
Advanced tools
Comparing version 0.18.0-dev.0 to 0.18.0-dev.1
import { UnsubscribeFunction } from "emittery"; | ||
import { AgentPubKey, AppAuthenticationToken, AppInfo, CapSecret, CellId, ClonedCell, DnaHash, DnaProperties, FunctionName, MembraneProof, NetworkInfo, NetworkSeed, Nonce256Bit, RoleName, Timestamp, WebsocketConnectionOptions, ZomeName } from "../../index.js"; | ||
import { AgentPubKey, AppAuthenticationToken, AppInfo, CapSecret, CellId, ClonedCell, DnaHash, DnaProperties, FunctionName, InstalledAppId, MembraneProof, NetworkInfo, NetworkSeed, Nonce256Bit, RoleName, Timestamp, Transformer, WebsocketConnectionOptions, ZomeName } from "../../index.js"; | ||
/** | ||
@@ -217,2 +217,3 @@ * @public | ||
myPubKey: AgentPubKey; | ||
installedAppId: InstalledAppId; | ||
createCloneCell(args: AppCreateCloneCellRequest): Promise<CreateCloneCellResponse>; | ||
@@ -228,2 +229,4 @@ enableCloneCell(args: AppEnableCloneCellRequest): Promise<EnableCloneCellResponse>; | ||
token?: AppAuthenticationToken; | ||
callZomeTransform?: CallZomeTransform; | ||
} | ||
export type CallZomeTransform = Transformer<CallZomeRequest | CallZomeRequestSigned, Promise<CallZomeRequestSigned>, CallZomeResponseGeneric<Uint8Array>, CallZomeResponse>; |
import { UnsubscribeFunction } from "emittery"; | ||
import { AgentPubKey, CellId, RoleName } from "../../types.js"; | ||
import { AgentPubKey, CellId, InstalledAppId, RoleName } from "../../types.js"; | ||
import { AppInfo } from "../admin/index.js"; | ||
@@ -15,4 +15,6 @@ import { AppCallZomeRequest, AppClient, AppEvents, AppNetworkInfoRequest, AppCreateCloneCellRequest, AppDisableCloneCellRequest, AppEnableCloneCellRequest, AppSignalCb, CallZomeRequest, CallZomeRequestSigned, CallZomeResponse, CreateCloneCellResponse, DisableCloneCellResponse, EnableCloneCellResponse, NetworkInfoResponse, AppWebsocketConnectionOptions } from "./types.js"; | ||
readonly myPubKey: AgentPubKey; | ||
readonly installedAppId: InstalledAppId; | ||
private readonly defaultTimeout; | ||
private readonly emitter; | ||
private readonly callZomeTransform; | ||
cachedAppInfo?: AppInfo | null; | ||
@@ -19,0 +21,0 @@ private readonly appInfoRequester; |
@@ -21,4 +21,6 @@ import Emittery from "emittery"; | ||
myPubKey; | ||
installedAppId; | ||
defaultTimeout; | ||
emitter; | ||
callZomeTransform; | ||
cachedAppInfo; | ||
@@ -31,10 +33,12 @@ appInfoRequester; | ||
networkInfoRequester; | ||
constructor(client, appInfo, defaultTimeout) { | ||
constructor(client, appInfo, callZomeTransform, defaultTimeout) { | ||
this.client = client; | ||
this.myPubKey = appInfo.agent_pub_key; | ||
this.installedAppId = appInfo.installed_app_id; | ||
this.defaultTimeout = defaultTimeout ?? DEFAULT_TIMEOUT; | ||
this.callZomeTransform = callZomeTransform ?? defaultCallZomeTransform; | ||
this.emitter = new Emittery(); | ||
this.cachedAppInfo = appInfo; | ||
this.appInfoRequester = AppWebsocket.requester(this.client, "app_info", this.defaultTimeout); | ||
this.callZomeRequester = AppWebsocket.requester(this.client, "call_zome", this.defaultTimeout, callZomeTransform); | ||
this.callZomeRequester = AppWebsocket.requester(this.client, "call_zome", this.defaultTimeout, this.callZomeTransform); | ||
this.createCloneCellRequester = AppWebsocket.requester(this.client, "create_clone_cell", this.defaultTimeout); | ||
@@ -90,3 +94,3 @@ this.enableCloneCellRequester = AppWebsocket.requester(this.client, "enable_clone_cell", this.defaultTimeout); | ||
} | ||
return new AppWebsocket(client, appInfo, options.defaultTimeout); | ||
return new AppWebsocket(client, appInfo, options.callZomeTransform, options.defaultTimeout); | ||
} | ||
@@ -242,3 +246,3 @@ /** | ||
} | ||
const callZomeTransform = { | ||
const defaultCallZomeTransform = { | ||
input: async (request) => { | ||
@@ -245,0 +249,0 @@ if ("signature" in request) { |
{ | ||
"name": "@holochain/client", | ||
"version": "0.18.0-dev.0", | ||
"version": "0.18.0-dev.1", | ||
"description": "A JavaScript client for the Holochain Conductor API", | ||
@@ -5,0 +5,0 @@ "author": "Holochain Foundation <info@holochain.org> (https://holochain.org)", |
126139
3489