@ddd-qc/cell-proxy 0.25.1 → 0.26.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,9 +1,10 @@
1
1
  import { AppSignal, AppSignalCb, CallZomeRequest, CapSecret, ZomeName } from "@holochain/client";
2
2
  import { Empty } from "./mixins";
3
3
  import { Cell } from "./cell";
4
- import { DnaInfo, ZomeInfo } from "./types";
4
+ import { DnaInfo, EntryDef, ZomeInfo } from "./types";
5
5
  import MutexInterface from "async-mutex/lib/MutexInterface";
6
6
  import { AppProxy, SignalUnsubscriber } from "./AppProxy";
7
+ import { Dictionary } from "./utils";
7
8
  export interface RequestLog {
8
9
  request: CallZomeRequest;
9
10
  timeout: number;
@@ -71,7 +72,7 @@ export declare class CellProxy extends CellProxy_base {
71
72
  * Calls the `entry_defs()` zome function and
72
73
  * Returns an array of all the zome's AppEntryNames and Visibility, i.e. (AppEntryName, isPublic)[]
73
74
  */
74
- callEntryDefs(zomeName: ZomeName): Promise<[string, boolean][]>;
75
+ callEntryDefs(zomeName: ZomeName): Promise<Dictionary<EntryDef>>;
75
76
  /**
76
77
  * Calls the `zome_info()` zome function
77
78
  */
package/dist/CellProxy.js CHANGED
@@ -220,12 +220,15 @@ export class CellProxy extends CellMixin(Empty) {
220
220
  //console.log("callEntryDefs()", zomeName)
221
221
  try {
222
222
  const entryDefs = await this.callZome(zomeName, "entry_defs", null, null); // Need big timeout since holochain is slow when receiving simultaneous calls from multiple happs
223
- //console.debug("getEntryDefs() for " + this.zomeName + " result:")
224
- //console.log({entryDefs})
225
- let result = [];
223
+ console.debug("getEntryDefs() for " + zomeName + " result:");
224
+ console.log({ entryDefs });
225
+ let result = {};
226
226
  for (const def of entryDefs.Defs) {
227
- const name = def.id.App;
228
- result.push([name, def.visibility.hasOwnProperty('Public')]);
227
+ let name = Object.keys(def.id)[0];
228
+ if ("App" in def.id) {
229
+ name = def.id.App;
230
+ }
231
+ result[name] = def;
229
232
  }
230
233
  //console.log({result})
231
234
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"CellProxy.js","sourceRoot":"","sources":["../src/CellProxy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAC,MAAM,UAAU,CAAC;AAE1C,OAAO,EACL,SAAS,EAGT,UAAU,EAIX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,KAAK,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAM/C,OAAO,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AACpD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,QAAQ,CAAC;AAyBvC;;;;;GAKG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS,CAAC,KAAK,CAAC;IAE7C,WAAW;IACX,YACU,SAAmB,EAC3B,IAAU;IACV,mCAAmC;IACnC,cAAuB;QACvB,KAAK,EAAE,CAAC;QAJA,cAAS,GAAT,SAAS,CAAU;QA2F7B,uBAAuB;QACf,gBAAW,GAAiB,EAAE,CAAA;QAC9B,iBAAY,GAAkB,EAAE,CAAA;QAxFtC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;QAClE,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,IAAI,KAAK,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAEhE,6EAA6E;QAC7E,kBAAkB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;IACpF,CAAC;IAMS,KAAK,CAAC,oBAAoB,CAAC,MAAiB;QACpD,MAAM,UAAU,GAAG,IAAI,C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,CAAC,CAAC,CAAC;iBACtF;aACF;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,IAAI,UAAU,EAAE;YACxD,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,OAAO,IAAI,OAAO,IAAI,MAAM,IAAI,WAAW,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAA;YACvI,IAAI,KAAK,IAAI,CAAC,CAAC,EAAE;gBACf,SAAS;aACV;YACD,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC;YACvC,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC;YAC3D,MAAM,GAAG,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAA;YACtI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtB;QAED,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAC3B,CAAC;CAGF","sourcesContent":["import {\n AppSignal,\n AppSignalCb,\n CallZomeRequest,\n CapSecret,\n Timestamp,\n ZomeName\n} from \"@holochain/client\";\nimport {CellMixin, Empty} from \"./mixins\";\nimport {Cell} from \"./cell\";\nimport {\n CellIdStr,\n DnaInfo,\n EntryDefsCallbackResult,\n SignalType,\n SystemPulse,\n\n ZomeInfo\n} from \"./types\";\nimport {Mutex, withTimeout} from \"async-mutex\";\nimport MutexInterface from \"async-mutex/lib/MutexInterface\";\nimport {\n AppProxy,\n SignalUnsubscriber,\n} from \"./AppProxy\";\nimport {prettyDate, prettyDuration} from \"./pretty\";\nimport {anyToB64, enc64} from \"./hash\";\nimport {\n SystemSignalProtocolVariantPostCommitNewEnd,\n SystemSignalProtocolVariantSelfCallEnd,\n SystemSignalProtocolVariantSelfCallStart\n} from \"./zomeSignals.types\";\n\n\nexport interface RequestLog {\n request: CallZomeRequest,\n timeout: number,\n requestTimestamp: number,\n executionTimestamp: number,\n}\n\nexport interface ResponseLog {\n success?: unknown,\n failure?: unknown,\n timestamp: number,\n requestIndex: number;\n}\n\n\nexport type Cb = () => Promise<unknown>\n\n/**\n * Proxy for a running DNA.\n * It logs and queues ZomeCalls.\n * It holds a reference to its AppProxy and its Cell.\n * This class is expected to be used by ZomeProxies.\n */\nexport class CellProxy extends CellMixin(Empty) {\n\n /** Ctor */\n constructor(\n private _appProxy: AppProxy,\n cell: Cell,\n //public readonly dnaDef: MyDnaDef,\n defaultTimeout?: number) {\n super();\n this._cell = cell;\n console.log(`CellProxy.ctor`, cell);\n this.defaultTimeout = defaultTimeout ? defaultTimeout : 10 * 1000;\n this._callMutex = withTimeout(new Mutex(), this.defaultTimeout);\n\n ///*const _unsub =*/ this.addSignalHandler((sig) => this.blockSelfCall(sig));\n /*const _unsub =*/ this.addSignalHandler((sig) => this.blockUntilPostCommit(sig));\n }\n\n\n /** Have a PostCommitEnd release the Mutex */\n private _postCommitRelease?;\n private _postCommitReleaseEntryType?: string;\n protected async blockUntilPostCommit(signal: AppSignal) {\n const zomeSignal = this._appProxy.intoZomeSignal(signal);\n if (!zomeSignal || zomeSignal.pulses.length == 0) {\n return;\n }\n console.debug(\"blockUntilPostCommit()\", zomeSignal, this._postCommitReleaseEntryType, !!this._postCommitRelease);\n const signalType = Object.keys(zomeSignal.pulses[0])[0];\n if (signalType != \"System\" || !this._postCommitRelease || !this._postCommitReleaseEntryType) {\n return;\n }\n for (const pulse of zomeSignal.pulses) {\n const sys = (pulse as SystemPulse).System;\n if (sys.type !== \"PostCommitNewEnd\") {\n continue;\n }\n const end = sys as SystemSignalProtocolVariantPostCommitNewEnd;\n if (!end.succeeded) {\n console.error(\"System call failed\");\n this.dumpCallLogs(signal.zome_name);\n this.dumpSignalLogs(signal.zome_name);\n }\n if (end.app_entry_type !== this._postCommitReleaseEntryType) {\n continue;\n }\n /** Release */\n console.debug(\"blockUntilPostCommit() RELEASE\");\n this._postCommitRelease();\n delete this._postCommitRelease;\n delete this._postCommitReleaseEntryType;\n break;\n }\n }\n\n\n /** Have a self call acquire & the call Mutex */\n private _selfCallRelease?;\n protected async blockSelfCall(signal: AppSignal) {\n const zomeSignal = this._appProxy.intoZomeSignal(signal);\n if (!zomeSignal || zomeSignal.pulses.length == 0 || Object.keys(zomeSignal.pulses[0])[0] != 'System') {\n return;\n }\n for (const pulse of zomeSignal.pulses) {\n const sys = (pulse as SystemPulse).System;\n if (sys.type == \"SelfCallStart\") {\n console.log(\"\")\n /** Acquire lock */\n try {\n this._callMutex.acquire().then((r) => this._selfCallRelease = r)\n } catch (e) {\n console.error(\"A Zome self call is initialted during a writing zome call\", e);\n }\n }\n if (sys.type == \"SelfCallEnd\" && this._selfCallRelease) {\n /** Release */\n this._selfCallRelease();\n delete this._selfCallRelease;\n const end = sys as SystemSignalProtocolVariantSelfCallEnd;\n if (!end.succeeded) {\n console.error(\"Call to self failed.\")\n this.dumpCallLogs(end.zome_name);\n this.dumpSignalLogs(end.zome_name);\n }\n }\n }\n }\n\n /** -- Fields -- */\n\n defaultTimeout: number;\n protected _callMutex: MutexInterface;\n\n\n\n /** append only logs */\n private _requestLog: RequestLog[] = []\n private _responseLog: ResponseLog[] = []\n\n\n /** -- Methods -- */\n\n /** */\n addSignalHandler(handler: AppSignalCb): SignalUnsubscriber {\n return this._appProxy.addSignalHandler(handler, this.cell.hcl().toString());\n }\n\n\n /** */\n dumpSignalLogs(zomeName?: ZomeName, canAppSignals?: boolean) {\n this._appProxy.dumpSignalLogs(canAppSignals? canAppSignals : true, this.cell.id, zomeName);\n }\n\n\n /** */\n get signalLogs() {\n const cellStr = CellIdStr(this.cell.id);\n return this._appProxy.signalLogs.filter((log) => log.cellId == cellStr);\n }\n\n\n /** Pass call request to conductor proxy and log it */\n async executeZomeCall(reqLog: RequestLog): Promise<ResponseLog> {\n reqLog.executionTimestamp = Date.now();\n const requestIndex = this._requestLog.length;\n this._requestLog.push(reqLog);\n try {\n const response = await this._appProxy.callZome(reqLog.request, reqLog.timeout);\n const respLog = { requestIndex, success: response, timestamp: Date.now() };\n this._responseLog.push(respLog);\n return respLog;\n } catch (e) {\n const respLog = { requestIndex, failure: e, timestamp: Date.now() }\n this._responseLog.push(respLog);\n return respLog;\n }\n }\n\n\n /** Pass call request to conductor proxy and log it */\n logCallTimedout(reqLog: RequestLog): ResponseLog {\n reqLog.executionTimestamp = Date.now();\n const requestIndex = this._requestLog.length;\n this._requestLog.push(reqLog);\n const respLog = { requestIndex, failure: \"Waiting for Mutex timed-out\", timestamp: Date.now() }\n this._responseLog.push(respLog);\n return respLog;\n }\n\n\n /**\n * callZome() with Mutex (for calls that writes to source-chain)\n * TODO: Implement call queue instead of mutex?\n */\n async callZomeBlockPostCommit(entryType: string, zome_name: ZomeName, fn_name: string, payload: any, cap_secret: CapSecret | null, timeout?: number): Promise<unknown> {\n timeout = timeout? timeout : this.defaultTimeout;\n const req = {\n cap_secret, zome_name, fn_name, payload,\n cell_id: this.cell.id,\n provenance: this.cell.id[1],\n } as CallZomeRequest;\n const log = { request: req, timeout, requestTimestamp: Date.now() } as RequestLog;\n\n /** Acquire lock */\n try {\n this._postCommitRelease = await this._callMutex.acquire();\n this._postCommitReleaseEntryType = entryType;\n } catch(e) {\n console.warn(\"Waiting for callZomeBlockPostCommit mutex timed-out\", e);\n this.logCallTimedout(log)\n return Promise.reject(\"Waiting for callZomeBlockPostCommit mutex timed-out\");\n }\n /** Execute */\n const respLog = await this.executeZomeCall(log);\n return respLog.success;\n }\n\n\n /**\n * callZome() with Mutex (for calls that writes to source-chain)\n * TODO: Implement call queue instead of mutex?\n */\n async callZomeBlocking(zome_name: ZomeName, fn_name: string, payload: any, cap_secret: CapSecret | null, timeout?: number): Promise<unknown> {\n timeout = timeout? timeout : this.defaultTimeout;\n const req = {\n cap_secret, zome_name, fn_name, payload,\n cell_id: this.cell.id,\n provenance: this.cell.id[1],\n } as CallZomeRequest;\n const log = { request: req, timeout, requestTimestamp: Date.now() } as RequestLog;\n\n /** Acquire lock */\n let release;\n try {\n release = await this._callMutex.acquire();\n } catch(e) {\n console.warn(\"Waiting for callZomeBlocking mutex timed-out\", e);\n this.logCallTimedout(log)\n return Promise.reject(\"Waiting for callZomeBlocking mutex timed-out\");\n }\n /** Execute */\n const respLog = await this.executeZomeCall(log);\n /** Release */\n release();\n if (respLog.failure) {\n this.dumpCallLogs(zome_name);\n this.dumpSignalLogs(zome_name);\n return Promise.reject(respLog.failure)\n }\n return respLog.success;\n }\n\n\n /** */\n async callZome(zome_name: ZomeName, fn_name: string, payload: any, cap_secret: CapSecret | null, timeout?: number): Promise<unknown> {\n timeout = timeout? timeout : this.defaultTimeout;\n const req = {\n cap_secret, zome_name, fn_name, payload,\n cell_id: this.cell.id,\n provenance: this.cell.id[1],\n } as CallZomeRequest;\n const log = { request: req, timeout, requestTimestamp: Date.now() } as RequestLog;\n try {\n await this._callMutex.waitForUnlock();\n } catch(e) {\n console.warn(\"Waiting for callZome mutex timed-out\", e);\n this.logCallTimedout(log);\n return Promise.reject(\"Waiting for callZome mutex timed-out\");\n }\n const respLog = await this.executeZomeCall(log);\n if (respLog.failure) {\n this.dumpCallLogs(zome_name);\n this.dumpSignalLogs(zome_name);\n return Promise.reject(respLog.failure)\n }\n return respLog.success;\n }\n\n\n /**\n * Calls the `entry_defs()` zome function and\n * Returns an array of all the zome's AppEntryNames and Visibility, i.e. (AppEntryName, isPublic)[]\n */\n async callEntryDefs(zomeName: ZomeName): Promise<[string, boolean][]> {\n //console.log(\"callEntryDefs()\", zomeName)\n try {\n const entryDefs = await this.callZome(zomeName, \"entry_defs\", null, null) as EntryDefsCallbackResult; // Need big timeout since holochain is slow when receiving simultaneous calls from multiple happs\n //console.debug(\"getEntryDefs() for \" + this.zomeName + \" result:\")\n //console.log({entryDefs})\n let result: [string, boolean][] = []\n for (const def of entryDefs.Defs) {\n const name = def.id.App;\n result.push([name, def.visibility.hasOwnProperty('Public')])\n }\n //console.log({result})\n return result;\n } catch (e) {\n console.error(\"Calling getEntryDefs() on \" + zomeName + \" failed: \")\n console.error({ e })\n return Promise.reject(e)\n }\n }\n\n\n\n /**\n * Calls the `zome_info()` zome function\n */\n async callZomeInfo(zomeName: ZomeName): Promise<ZomeInfo> {\n console.log(\"callZomeInfo()\", zomeName)\n try {\n const zome_info = await this.callZome(zomeName, \"get_zome_info\", null, null, 10 * 100) as ZomeInfo;\n //console.debug(\"callZomeInfo() for \" + zomeName + \" result:\")\n //console.log({zome_info})\n return zome_info;\n } catch (e) {\n console.error(\"Calling callZomeInfo() on \" + zomeName + \" failed. Make sure `get_zome_info()` is implemented in your zome code. Error: \")\n console.error({ e })\n return Promise.reject(e)\n }\n }\n\n\n /**\n * Calls the `dna_info()` zome function\n */\n async callDnaInfo(zomeName: ZomeName): Promise<DnaInfo> {\n console.log(\"callDnaInfo()\", zomeName)\n try {\n const dna_info = await this.callZome(zomeName, \"get_dna_info\", null, null, 10 * 100) as DnaInfo;\n //console.debug(\"callDnaInfo() for \" + zomeName + \" result:\")\n //console.log({dna_info})\n return dna_info;\n } catch (e) {\n console.error(\"Calling callDnaInfo() on \" + zomeName + \" failed. Make sure `get_dna_info()` is implemented in your zome code. Error: \")\n console.error({ e })\n return Promise.reject(e)\n }\n }\n\n\n // /** TODO once we have getDnaDefinition() api */\n // dumpAllZomes() {\n // // FIXME get DNA DEF\n // for (const zomeName of dnaDef) {\n // this.dumpCallLogs(zomeName)\n // }\n // }\n\n /** */\n dumpCallLogs(zomeName?: ZomeName) {\n let result = [];\n for (const response of this._responseLog) {\n const requestLog = this._requestLog[response.requestIndex];\n if (zomeName && requestLog.request.zome_name != zomeName) {\n continue;\n }\n const startTime= prettyDate(new Date(requestLog.requestTimestamp));\n const waitTime = prettyDuration(new Date(requestLog.executionTimestamp - requestLog.requestTimestamp));\n const duration = prettyDuration(new Date(response.timestamp - requestLog.requestTimestamp));\n const input = requestLog.request.payload instanceof Uint8Array ? enc64(requestLog.request.payload) : requestLog.request.payload;\n const output = anyToB64(response.failure ? response.failure : response.success);\n const log = zomeName\n ? { startTime, fnName: requestLog.request.fn_name, input, output, duration, waitTime }\n : { startTime, zomeName: requestLog.request.zome_name, fnName: requestLog.request.fn_name, input, output, duration, waitTime }\n result.push(log);\n }\n console.warn(`Dumping logs for cell \"${this._appProxy.getLocations(this.cell.id)}\"`)\n if (zomeName) {\n console.warn(` - For zome \"${zomeName}\"`);\n }\n console.table(result)\n\n /** Parse signal self-call logs */\n //console.log(this._appProxy.signalLogs)\n\n const zomeSignals = this._appProxy.signalLogs.filter((log) => log.type == SignalType.Zome);\n const sysSignals = zomeSignals.filter((log) => {\n const type = Object.keys(log.zomeSignal.pulses[0])[0];\n type == \"System\"\n });\n\n const startCalls: [Timestamp, CellIdStr, SystemSignalProtocolVariantSelfCallStart][] = [];\n const endCalls: [Timestamp, CellIdStr, SystemSignalProtocolVariantSelfCallEnd][] = [];\n sysSignals.map((log) => {\n for (const pulse of log.zomeSignal.pulses) {\n const sys = (pulse as SystemPulse).System;\n if(sys.type == \"SelfCallStart\") {\n startCalls.push([log.ts, log.cellId, (sys as SystemSignalProtocolVariantSelfCallStart)]);\n }\n if(sys.type == \"SelfCallEnd\") {\n endCalls.push([log.ts, log.cellId, (sys as SystemSignalProtocolVariantSelfCallEnd)]);\n }\n }\n })\n\n let sigResults = [];\n for (const [startTs, startId, startSignal] of startCalls) {\n const index = endCalls.findIndex(([ts, cellId, signal]) => ts >= startTs && startId == cellId && startSignal.fn_name == signal.fn_name)\n if (index == -1) {\n continue;\n }\n const first = endCalls.splice(index, 1)[0];\n const [endTs, _cId, endSignal] = first;\n const duration = prettyDuration(new Date(endTs - startTs));\n const log = { startTime: startTs, zomeName: endSignal.zome_name, fnName: endSignal.fn_name, succeeded: endSignal.succeeded, duration }\n sigResults.push(log);\n }\n\n console.table(sigResults)\n }\n\n\n}\n\n"]}
1
+ {"version":3,"file":"CellProxy.js","sourceRoot":"","sources":["../src/CellProxy.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAC,MAAM,UAAU,CAAC;AAE1C,OAAO,EACL,SAAS,EAGT,UAAU,EAIX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,KAAK,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAM/C,OAAO,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AACpD,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,QAAQ,CAAC;AA6CvC;;;;;GAKG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS,CAAC,KAAK,CAAC;IAE7C,WAAW;IACX,YACU,SAAmB,EAC3B,IAAU;IACV,mCAAmC;IACnC,cAAuB;QACvB,KAAK,EAAE,CAAC;QAJA,cAAS,GAAT,SAAS,CAAU;QA2F7B,uBAAuB;QACf,gBAAW,GAAiB,EAAE,CAAA;QAC9B,iBAAY,GAAkB,EAAE,CAAA;QAxFtC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC;QAClE,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,IAAI,KAAK,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAEhE,6EAA6E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,SAAS,EAAE,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAA;YACtI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtB;QAED,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAC3B,CAAC;CAGF","sourcesContent":["import {\n AppSignal,\n AppSignalCb,\n CallZomeRequest,\n CapSecret, Entry,\n Timestamp,\n ZomeName\n} from \"@holochain/client\";\nimport {CellMixin, Empty} from \"./mixins\";\nimport {Cell} from \"./cell\";\nimport {\n CellIdStr,\n DnaInfo, EntryDef,\n EntryDefsCallbackResult,\n SignalType,\n SystemPulse,\n\n ZomeInfo\n} from \"./types\";\nimport {Mutex, withTimeout} from \"async-mutex\";\nimport MutexInterface from \"async-mutex/lib/MutexInterface\";\nimport {\n AppProxy,\n SignalUnsubscriber,\n} from \"./AppProxy\";\nimport {prettyDate, prettyDuration} from \"./pretty\";\nimport {anyToB64, enc64} from \"./hash\";\nimport {\n SystemSignalProtocolVariantPostCommitNewEnd,\n SystemSignalProtocolVariantSelfCallEnd,\n SystemSignalProtocolVariantSelfCallStart\n} from \"./zomeSignals.types\";\nimport {Dictionary} from \"./utils\";\n\n\n// /** */\n// export interface EntryDefMat {\n// // index: number\n// id: string,\n// visibility: \"Public\" | \"Private\",\n// requiredValidations: number,\n// cacheAtAgentActivity: boolean,\n// }\n//\n// function materializeEntryDef(def: EntryDef): EntryDefMat {\n// return {\n// id: def.id.App,\n// visibility: def.visibility,\n// requiredValidations: 0, // FIXME\n// cacheAtAgentActivity: false, // FIXME\n// }\n// }\n\n\nexport interface RequestLog {\n request: CallZomeRequest,\n timeout: number,\n requestTimestamp: number,\n executionTimestamp: number,\n}\n\nexport interface ResponseLog {\n success?: unknown,\n failure?: unknown,\n timestamp: number,\n requestIndex: number;\n}\n\n\nexport type Cb = () => Promise<unknown>\n\n/**\n * Proxy for a running DNA.\n * It logs and queues ZomeCalls.\n * It holds a reference to its AppProxy and its Cell.\n * This class is expected to be used by ZomeProxies.\n */\nexport class CellProxy extends CellMixin(Empty) {\n\n /** Ctor */\n constructor(\n private _appProxy: AppProxy,\n cell: Cell,\n //public readonly dnaDef: MyDnaDef,\n defaultTimeout?: number) {\n super();\n this._cell = cell;\n console.log(`CellProxy.ctor`, cell);\n this.defaultTimeout = defaultTimeout ? defaultTimeout : 10 * 1000;\n this._callMutex = withTimeout(new Mutex(), this.defaultTimeout);\n\n ///*const _unsub =*/ this.addSignalHandler((sig) => this.blockSelfCall(sig));\n /*const _unsub =*/ this.addSignalHandler((sig) => this.blockUntilPostCommit(sig));\n }\n\n\n /** Have a PostCommitEnd release the Mutex */\n private _postCommitRelease?;\n private _postCommitReleaseEntryType?: string;\n protected async blockUntilPostCommit(signal: AppSignal) {\n const zomeSignal = this._appProxy.intoZomeSignal(signal);\n if (!zomeSignal || zomeSignal.pulses.length == 0) {\n return;\n }\n console.debug(\"blockUntilPostCommit()\", zomeSignal, this._postCommitReleaseEntryType, !!this._postCommitRelease);\n const signalType = Object.keys(zomeSignal.pulses[0])[0];\n if (signalType != \"System\" || !this._postCommitRelease || !this._postCommitReleaseEntryType) {\n return;\n }\n for (const pulse of zomeSignal.pulses) {\n const sys = (pulse as SystemPulse).System;\n if (sys.type !== \"PostCommitNewEnd\") {\n continue;\n }\n const end = sys as SystemSignalProtocolVariantPostCommitNewEnd;\n if (!end.succeeded) {\n console.error(\"System call failed\");\n this.dumpCallLogs(signal.zome_name);\n this.dumpSignalLogs(signal.zome_name);\n }\n if (end.app_entry_type !== this._postCommitReleaseEntryType) {\n continue;\n }\n /** Release */\n console.debug(\"blockUntilPostCommit() RELEASE\");\n this._postCommitRelease();\n delete this._postCommitRelease;\n delete this._postCommitReleaseEntryType;\n break;\n }\n }\n\n\n /** Have a self call acquire & the call Mutex */\n private _selfCallRelease?;\n protected async blockSelfCall(signal: AppSignal) {\n const zomeSignal = this._appProxy.intoZomeSignal(signal);\n if (!zomeSignal || zomeSignal.pulses.length == 0 || Object.keys(zomeSignal.pulses[0])[0] != 'System') {\n return;\n }\n for (const pulse of zomeSignal.pulses) {\n const sys = (pulse as SystemPulse).System;\n if (sys.type == \"SelfCallStart\") {\n console.log(\"\")\n /** Acquire lock */\n try {\n this._callMutex.acquire().then((r) => this._selfCallRelease = r)\n } catch (e) {\n console.error(\"A Zome self call is initialted during a writing zome call\", e);\n }\n }\n if (sys.type == \"SelfCallEnd\" && this._selfCallRelease) {\n /** Release */\n this._selfCallRelease();\n delete this._selfCallRelease;\n const end = sys as SystemSignalProtocolVariantSelfCallEnd;\n if (!end.succeeded) {\n console.error(\"Call to self failed.\")\n this.dumpCallLogs(end.zome_name);\n this.dumpSignalLogs(end.zome_name);\n }\n }\n }\n }\n\n /** -- Fields -- */\n\n defaultTimeout: number;\n protected _callMutex: MutexInterface;\n\n\n\n /** append only logs */\n private _requestLog: RequestLog[] = []\n private _responseLog: ResponseLog[] = []\n\n\n /** -- Methods -- */\n\n /** */\n addSignalHandler(handler: AppSignalCb): SignalUnsubscriber {\n return this._appProxy.addSignalHandler(handler, this.cell.hcl().toString());\n }\n\n\n /** */\n dumpSignalLogs(zomeName?: ZomeName, canAppSignals?: boolean) {\n this._appProxy.dumpSignalLogs(canAppSignals? canAppSignals : true, this.cell.id, zomeName);\n }\n\n\n /** */\n get signalLogs() {\n const cellStr = CellIdStr(this.cell.id);\n return this._appProxy.signalLogs.filter((log) => log.cellId == cellStr);\n }\n\n\n /** Pass call request to conductor proxy and log it */\n async executeZomeCall(reqLog: RequestLog): Promise<ResponseLog> {\n reqLog.executionTimestamp = Date.now();\n const requestIndex = this._requestLog.length;\n this._requestLog.push(reqLog);\n try {\n const response = await this._appProxy.callZome(reqLog.request, reqLog.timeout);\n const respLog = { requestIndex, success: response, timestamp: Date.now() };\n this._responseLog.push(respLog);\n return respLog;\n } catch (e) {\n const respLog = { requestIndex, failure: e, timestamp: Date.now() }\n this._responseLog.push(respLog);\n return respLog;\n }\n }\n\n\n /** Pass call request to conductor proxy and log it */\n logCallTimedout(reqLog: RequestLog): ResponseLog {\n reqLog.executionTimestamp = Date.now();\n const requestIndex = this._requestLog.length;\n this._requestLog.push(reqLog);\n const respLog = { requestIndex, failure: \"Waiting for Mutex timed-out\", timestamp: Date.now() }\n this._responseLog.push(respLog);\n return respLog;\n }\n\n\n /**\n * callZome() with Mutex (for calls that writes to source-chain)\n * TODO: Implement call queue instead of mutex?\n */\n async callZomeBlockPostCommit(entryType: string, zome_name: ZomeName, fn_name: string, payload: any, cap_secret: CapSecret | null, timeout?: number): Promise<unknown> {\n timeout = timeout? timeout : this.defaultTimeout;\n const req = {\n cap_secret, zome_name, fn_name, payload,\n cell_id: this.cell.id,\n provenance: this.cell.id[1],\n } as CallZomeRequest;\n const log = { request: req, timeout, requestTimestamp: Date.now() } as RequestLog;\n\n /** Acquire lock */\n try {\n this._postCommitRelease = await this._callMutex.acquire();\n this._postCommitReleaseEntryType = entryType;\n } catch(e) {\n console.warn(\"Waiting for callZomeBlockPostCommit mutex timed-out\", e);\n this.logCallTimedout(log)\n return Promise.reject(\"Waiting for callZomeBlockPostCommit mutex timed-out\");\n }\n /** Execute */\n const respLog = await this.executeZomeCall(log);\n return respLog.success;\n }\n\n\n /**\n * callZome() with Mutex (for calls that writes to source-chain)\n * TODO: Implement call queue instead of mutex?\n */\n async callZomeBlocking(zome_name: ZomeName, fn_name: string, payload: any, cap_secret: CapSecret | null, timeout?: number): Promise<unknown> {\n timeout = timeout? timeout : this.defaultTimeout;\n const req = {\n cap_secret, zome_name, fn_name, payload,\n cell_id: this.cell.id,\n provenance: this.cell.id[1],\n } as CallZomeRequest;\n const log = { request: req, timeout, requestTimestamp: Date.now() } as RequestLog;\n\n /** Acquire lock */\n let release;\n try {\n release = await this._callMutex.acquire();\n } catch(e) {\n console.warn(\"Waiting for callZomeBlocking mutex timed-out\", e);\n this.logCallTimedout(log)\n return Promise.reject(\"Waiting for callZomeBlocking mutex timed-out\");\n }\n /** Execute */\n const respLog = await this.executeZomeCall(log);\n /** Release */\n release();\n if (respLog.failure) {\n this.dumpCallLogs(zome_name);\n this.dumpSignalLogs(zome_name);\n return Promise.reject(respLog.failure)\n }\n return respLog.success;\n }\n\n\n /** */\n async callZome(zome_name: ZomeName, fn_name: string, payload: any, cap_secret: CapSecret | null, timeout?: number): Promise<unknown> {\n timeout = timeout? timeout : this.defaultTimeout;\n const req = {\n cap_secret, zome_name, fn_name, payload,\n cell_id: this.cell.id,\n provenance: this.cell.id[1],\n } as CallZomeRequest;\n const log = { request: req, timeout, requestTimestamp: Date.now() } as RequestLog;\n try {\n await this._callMutex.waitForUnlock();\n } catch(e) {\n console.warn(\"Waiting for callZome mutex timed-out\", e);\n this.logCallTimedout(log);\n return Promise.reject(\"Waiting for callZome mutex timed-out\");\n }\n const respLog = await this.executeZomeCall(log);\n if (respLog.failure) {\n this.dumpCallLogs(zome_name);\n this.dumpSignalLogs(zome_name);\n return Promise.reject(respLog.failure)\n }\n return respLog.success;\n }\n\n\n /**\n * Calls the `entry_defs()` zome function and\n * Returns an array of all the zome's AppEntryNames and Visibility, i.e. (AppEntryName, isPublic)[]\n */\n async callEntryDefs(zomeName: ZomeName): Promise<Dictionary<EntryDef>> {\n //console.log(\"callEntryDefs()\", zomeName)\n try {\n const entryDefs = await this.callZome(zomeName, \"entry_defs\", null, null) as EntryDefsCallbackResult; // Need big timeout since holochain is slow when receiving simultaneous calls from multiple happs\n console.debug(\"getEntryDefs() for \" + zomeName + \" result:\")\n console.log({entryDefs})\n let result: Dictionary<EntryDef> = {}\n for (const def of entryDefs.Defs) {\n let name = Object.keys(def.id)[0];\n if (\"App\" in def.id) {\n name = def.id.App;\n }\n result[name] = def;\n }\n //console.log({result})\n return result;\n } catch (e) {\n console.error(\"Calling getEntryDefs() on \" + zomeName + \" failed: \")\n console.error({ e })\n return Promise.reject(e)\n }\n }\n\n\n\n /**\n * Calls the `zome_info()` zome function\n */\n async callZomeInfo(zomeName: ZomeName): Promise<ZomeInfo> {\n console.log(\"callZomeInfo()\", zomeName)\n try {\n const zome_info = await this.callZome(zomeName, \"get_zome_info\", null, null, 10 * 100) as ZomeInfo;\n //console.debug(\"callZomeInfo() for \" + zomeName + \" result:\")\n //console.log({zome_info})\n return zome_info;\n } catch (e) {\n console.error(\"Calling callZomeInfo() on \" + zomeName + \" failed. Make sure `get_zome_info()` is implemented in your zome code. Error: \")\n console.error({ e })\n return Promise.reject(e)\n }\n }\n\n\n /**\n * Calls the `dna_info()` zome function\n */\n async callDnaInfo(zomeName: ZomeName): Promise<DnaInfo> {\n console.log(\"callDnaInfo()\", zomeName)\n try {\n const dna_info = await this.callZome(zomeName, \"get_dna_info\", null, null, 10 * 100) as DnaInfo;\n //console.debug(\"callDnaInfo() for \" + zomeName + \" result:\")\n //console.log({dna_info})\n return dna_info;\n } catch (e) {\n console.error(\"Calling callDnaInfo() on \" + zomeName + \" failed. Make sure `get_dna_info()` is implemented in your zome code. Error: \")\n console.error({ e })\n return Promise.reject(e)\n }\n }\n\n\n // /** TODO once we have getDnaDefinition() api */\n // dumpAllZomes() {\n // // FIXME get DNA DEF\n // for (const zomeName of dnaDef) {\n // this.dumpCallLogs(zomeName)\n // }\n // }\n\n /** */\n dumpCallLogs(zomeName?: ZomeName) {\n let result = [];\n for (const response of this._responseLog) {\n const requestLog = this._requestLog[response.requestIndex];\n if (zomeName && requestLog.request.zome_name != zomeName) {\n continue;\n }\n const startTime= prettyDate(new Date(requestLog.requestTimestamp));\n const waitTime = prettyDuration(new Date(requestLog.executionTimestamp - requestLog.requestTimestamp));\n const duration = prettyDuration(new Date(response.timestamp - requestLog.requestTimestamp));\n const input = requestLog.request.payload instanceof Uint8Array ? enc64(requestLog.request.payload) : requestLog.request.payload;\n const output = anyToB64(response.failure ? response.failure : response.success);\n const log = zomeName\n ? { startTime, fnName: requestLog.request.fn_name, input, output, duration, waitTime }\n : { startTime, zomeName: requestLog.request.zome_name, fnName: requestLog.request.fn_name, input, output, duration, waitTime }\n result.push(log);\n }\n console.warn(`Dumping logs for cell \"${this._appProxy.getLocations(this.cell.id)}\"`)\n if (zomeName) {\n console.warn(` - For zome \"${zomeName}\"`);\n }\n console.table(result)\n\n /** Parse signal self-call logs */\n //console.log(this._appProxy.signalLogs)\n\n const zomeSignals = this._appProxy.signalLogs.filter((log) => log.type == SignalType.Zome);\n const sysSignals = zomeSignals.filter((log) => {\n const type = Object.keys(log.zomeSignal.pulses[0])[0];\n type == \"System\"\n });\n\n const startCalls: [Timestamp, CellIdStr, SystemSignalProtocolVariantSelfCallStart][] = [];\n const endCalls: [Timestamp, CellIdStr, SystemSignalProtocolVariantSelfCallEnd][] = [];\n sysSignals.map((log) => {\n for (const pulse of log.zomeSignal.pulses) {\n const sys = (pulse as SystemPulse).System;\n if(sys.type == \"SelfCallStart\") {\n startCalls.push([log.ts, log.cellId, (sys as SystemSignalProtocolVariantSelfCallStart)]);\n }\n if(sys.type == \"SelfCallEnd\") {\n endCalls.push([log.ts, log.cellId, (sys as SystemSignalProtocolVariantSelfCallEnd)]);\n }\n }\n })\n\n let sigResults = [];\n for (const [startTs, startId, startSignal] of startCalls) {\n const index = endCalls.findIndex(([ts, cellId, signal]) => ts >= startTs && startId == cellId && startSignal.fn_name == signal.fn_name)\n if (index == -1) {\n continue;\n }\n const first = endCalls.splice(index, 1)[0];\n const [endTs, _cId, endSignal] = first;\n const duration = prettyDuration(new Date(endTs - startTs));\n const log = { startTime: startTs, zomeName: endSignal.zome_name, fnName: endSignal.fn_name, succeeded: endSignal.succeeded, duration }\n sigResults.push(log);\n }\n\n console.table(sigResults)\n }\n\n\n}\n\n"]}
@@ -1,7 +1,8 @@
1
1
  import { CapSecret, FunctionName, ZomeName } from "@holochain/client";
2
2
  import { ZomeSpecific } from "./mixins";
3
3
  import { CellProxy } from "./CellProxy";
4
- import { DnaInfo, ZomeInfo } from "./types";
4
+ import { DnaInfo, EntryDef, ZomeInfo } from "./types";
5
+ import { Dictionary } from "./utils";
5
6
  export type ZomeProxyConstructor = {
6
7
  new (cellProxy: CellProxy, zomeName?: ZomeName): ZomeProxy;
7
8
  } & typeof ZomeSpecific;
@@ -11,9 +12,13 @@ declare const ZomeProxy_base: (abstract new (...args: any[]) => {
11
12
  }) & ((abstract new (...args: any[]) => {
12
13
  zomeName: string;
13
14
  readonly defaultZomeName: string;
15
+ readonly entryTypes: string[];
16
+ readonly linkTypes: string[];
14
17
  readonly fnNames: [string, string][];
15
18
  }) & {
16
19
  readonly DEFAULT_ZOME_NAME: string;
20
+ readonly ENTRY_TYPES: string[];
21
+ readonly LINK_TYPES: string[];
17
22
  readonly FN_NAMES: string[];
18
23
  }) & typeof import("./mixins").Empty;
19
24
  /**
@@ -35,6 +40,6 @@ export declare abstract class ZomeProxy extends ZomeProxy_base {
35
40
  /** */
36
41
  dnaInfo(): Promise<DnaInfo>;
37
42
  /** */
38
- callEntryDefs(zomeName: ZomeName): Promise<[string, boolean][]>;
43
+ callEntryDefs(zomeName: ZomeName): Promise<Dictionary<EntryDef>>;
39
44
  }
40
45
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ZomeProxy.js","sourceRoot":"","sources":["../src/ZomeProxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAOjD;;;GAGG;AACH,MAAM,OAAgB,SAAU,SAAQ,SAAS,CAAC,YAAY,CAAC;IAE7D,WAAW;IACX,YAAsB,UAAqB,EAAE,QAAmB;QAC9D,KAAK,EAAE,CAAC;QADY,eAAU,GAAV,UAAU,CAAW;QAEzC,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;gBACzB,MAAM,KAAK,CAAC,6CAA6C,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aACpF;SACF;QACD,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;IAC/B,CAAC;IAGD,4BAA4B;IAC5B,0BAA0B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,EAAE,WAAuB,EAAE,OAAgB;QACtI,8CAA8C;QAC9C,IAAI,CAAE,IAAI,CAAC,WAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACxD,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,MAAM,yBAAyB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;SACrF;QACD,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC;QACpD,OAAO,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACjH,CAAC;IAGD,MAAM;IACN,KAAK,CAAC,QAAQ;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED,MAAM;IACN,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED,MAAM;IACN,KAAK,CAAC,aAAa,CAAC,QAAkB;QACpC,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["import {CapSecret, FunctionName, ZomeName} from \"@holochain/client\";\nimport {CellMixin, ZomeSpecific} from \"./mixins\";\nimport {CellProxy} from \"./CellProxy\";\nimport {DnaInfo, ZomeInfo} from \"./types\";\n\nexport type ZomeProxyConstructor = {new(cellProxy: CellProxy, zomeName?: ZomeName): ZomeProxy} & typeof ZomeSpecific;\n\n\n/**\n * ABC for representing the zome function bindings of a Zome.\n * It holds the zomeName and reference to a CellProxy.\n */\nexport abstract class ZomeProxy extends CellMixin(ZomeSpecific) {\n\n /** Ctor */\n constructor(protected _cellProxy: CellProxy, zomeName?: ZomeName) {\n super();\n if (zomeName) {\n this.zomeName = zomeName;\n } else {\n if (!this.defaultZomeName) {\n throw Error(\"zomeName not defined in ZomeProxy subclass \" + this.constructor.name);\n }\n }\n this._cell = _cellProxy.cell;\n }\n\n\n // private _signingProps?: {\n // capSecret: CapSecret;\n // keyPair: nacl.SignKeyPair;\n // signingKey: AgentPubKey;\n // };\n // setSigningProps(signingProps: { capSecret: CapSecret; keyPair: nacl.SignKeyPair; signingKey: AgentPubKey}): void {\n // this._signingProps = signingProps;\n // }\n\n\n /** Helper for calling a zome function on its zome */\n async call(fnName: FunctionName, payload: any, maybeSecret?: CapSecret, timeout?: number): Promise<any> {\n //console.log(\"ZomeProxy.call\", this.zomeName)\n if (!(this.constructor as any).FN_NAMES.includes(fnName)) {\n return Promise.reject(`Function \"${fnName}()\" not part of zome \"${this.zomeName}\"`);\n }\n const cap_secret = maybeSecret\n ? maybeSecret\n // : this._signingProps\n // ? this._signingProps.capSecret\n : null;\n return this._cellProxy.callZome(this.zomeName, fnName, payload, cap_secret, timeout);\n }\n\n\n /** Helper for calling a zome function on its zome */\n protected async callBlocking(fnName: FunctionName, payload: any, maybeSecret?: CapSecret, timeout?: number): Promise<any> {\n //console.log(\"ZomeProxy.call\", this.zomeName)\n if (!(this.constructor as any).FN_NAMES.includes(fnName)) {\n return Promise.reject(`Function \"${fnName}()\" not part of zome \"${this.zomeName}\"`);\n }\n const cap_secret = maybeSecret ? maybeSecret : null;\n return this._cellProxy.callZomeBlocking(this.zomeName, fnName, payload, cap_secret, timeout);\n }\n\n\n /** Helper for calling a zome function on its zome */\n protected async callZomeBlockPostCommit(entryType: string, fnName: FunctionName, payload: any, maybeSecret?: CapSecret, timeout?: number): Promise<any> {\n //console.log(\"ZomeProxy.call\", this.zomeName)\n if (!(this.constructor as any).FN_NAMES.includes(fnName)) {\n return Promise.reject(`Function \"${fnName}()\" not part of zome \"${this.zomeName}\"`);\n }\n const cap_secret = maybeSecret ? maybeSecret : null;\n return this._cellProxy.callZomeBlockPostCommit(entryType, this.zomeName, fnName, payload, cap_secret, timeout);\n }\n\n\n /** */\n async zomeInfo(): Promise<ZomeInfo> {\n return this._cellProxy.callZomeInfo(this.zomeName);\n }\n\n /** */\n async dnaInfo(): Promise<DnaInfo> {\n return this._cellProxy.callDnaInfo(this.zomeName);\n }\n\n /** */\n async callEntryDefs(zomeName: ZomeName): Promise<[string, boolean][]> {\n return this._cellProxy.callEntryDefs(zomeName);\n }\n}\n"]}
1
+ {"version":3,"file":"ZomeProxy.js","sourceRoot":"","sources":["../src/ZomeProxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAQjD;;;GAGG;AACH,MAAM,OAAgB,SAAU,SAAQ,SAAS,CAAC,YAAY,CAAC;IAE7D,WAAW;IACX,YAAsB,UAAqB,EAAE,QAAmB;QAC9D,KAAK,EAAE,CAAC;QADY,eAAU,GAAV,UAAU,CAAW;QAEzC,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;gBACzB,MAAM,KAAK,CAAC,6CAA6C,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aACpF;SACF;QACD,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;IAC/B,CAAC;IAGD,4BAA4B;IAC5B,0BAA0B;IAC1B,+BAA+B;IAC/B,6BAA6B;IAC7B,KAAK;IACL,qHAAqH;IACrH,uCAAuC;IACvC,IAAI;IAGJ,qDAAqD;IACrD,KAAK,CAAC,IAAI,CAAC,MAAoB,EAAE,OAAY,EAAE,WAAuB,EAAE,OAAgB;QACtF,8CAA8C;QAC9C,IAAI,CAAE,IAAI,CAAC,WAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACxD,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,MAAM,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AI,CAAC,UAAU,CAAC,uBAAuB,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACjH,CAAC;IAGD,MAAM;IACN,KAAK,CAAC,QAAQ;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED,MAAM;IACN,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED,MAAM;IACN,KAAK,CAAC,aAAa,CAAC,QAAkB;QACpC,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["import {CapSecret, FunctionName, ZomeName} from \"@holochain/client\";\nimport {CellMixin, ZomeSpecific} from \"./mixins\";\nimport {CellProxy} from \"./CellProxy\";\nimport {DnaInfo, EntryDef, ZomeInfo} from \"./types\";\nimport {Dictionary} from \"./utils\";\n\nexport type ZomeProxyConstructor = {new(cellProxy: CellProxy, zomeName?: ZomeName): ZomeProxy} & typeof ZomeSpecific;\n\n\n/**\n * ABC for representing the zome function bindings of a Zome.\n * It holds the zomeName and reference to a CellProxy.\n */\nexport abstract class ZomeProxy extends CellMixin(ZomeSpecific) {\n\n /** Ctor */\n constructor(protected _cellProxy: CellProxy, zomeName?: ZomeName) {\n super();\n if (zomeName) {\n this.zomeName = zomeName;\n } else {\n if (!this.defaultZomeName) {\n throw Error(\"zomeName not defined in ZomeProxy subclass \" + this.constructor.name);\n }\n }\n this._cell = _cellProxy.cell;\n }\n\n\n // private _signingProps?: {\n // capSecret: CapSecret;\n // keyPair: nacl.SignKeyPair;\n // signingKey: AgentPubKey;\n // };\n // setSigningProps(signingProps: { capSecret: CapSecret; keyPair: nacl.SignKeyPair; signingKey: AgentPubKey}): void {\n // this._signingProps = signingProps;\n // }\n\n\n /** Helper for calling a zome function on its zome */\n async call(fnName: FunctionName, payload: any, maybeSecret?: CapSecret, timeout?: number): Promise<any> {\n //console.log(\"ZomeProxy.call\", this.zomeName)\n if (!(this.constructor as any).FN_NAMES.includes(fnName)) {\n return Promise.reject(`Function \"${fnName}()\" not part of zome \"${this.zomeName}\"`);\n }\n const cap_secret = maybeSecret\n ? maybeSecret\n // : this._signingProps\n // ? this._signingProps.capSecret\n : null;\n return this._cellProxy.callZome(this.zomeName, fnName, payload, cap_secret, timeout);\n }\n\n\n /** Helper for calling a zome function on its zome */\n protected async callBlocking(fnName: FunctionName, payload: any, maybeSecret?: CapSecret, timeout?: number): Promise<any> {\n //console.log(\"ZomeProxy.call\", this.zomeName)\n if (!(this.constructor as any).FN_NAMES.includes(fnName)) {\n return Promise.reject(`Function \"${fnName}()\" not part of zome \"${this.zomeName}\"`);\n }\n const cap_secret = maybeSecret ? maybeSecret : null;\n return this._cellProxy.callZomeBlocking(this.zomeName, fnName, payload, cap_secret, timeout);\n }\n\n\n /** Helper for calling a zome function on its zome */\n protected async callZomeBlockPostCommit(entryType: string, fnName: FunctionName, payload: any, maybeSecret?: CapSecret, timeout?: number): Promise<any> {\n //console.log(\"ZomeProxy.call\", this.zomeName)\n if (!(this.constructor as any).FN_NAMES.includes(fnName)) {\n return Promise.reject(`Function \"${fnName}()\" not part of zome \"${this.zomeName}\"`);\n }\n const cap_secret = maybeSecret ? maybeSecret : null;\n return this._cellProxy.callZomeBlockPostCommit(entryType, this.zomeName, fnName, payload, cap_secret, timeout);\n }\n\n\n /** */\n async zomeInfo(): Promise<ZomeInfo> {\n return this._cellProxy.callZomeInfo(this.zomeName);\n }\n\n /** */\n async dnaInfo(): Promise<DnaInfo> {\n return this._cellProxy.callDnaInfo(this.zomeName);\n }\n\n /** */\n async callEntryDefs(zomeName: ZomeName): Promise<Dictionary<EntryDef>> {\n return this._cellProxy.callEntryDefs(zomeName);\n }\n}\n"]}
package/dist/mixins.d.ts CHANGED
@@ -25,18 +25,26 @@ export declare function CellMixin<TBase extends AbstractConstructor>(Base: TBase
25
25
  export declare function ZomeMixin<TBase extends AbstractConstructor>(Base: TBase): ((abstract new (...args: any[]) => {
26
26
  zomeName: ZomeName;
27
27
  readonly defaultZomeName: string;
28
+ readonly entryTypes: string[];
29
+ readonly linkTypes: string[];
28
30
  /** Tuple array with zome name */
29
31
  readonly fnNames: [string, string][];
30
32
  }) & {
31
33
  readonly DEFAULT_ZOME_NAME: ZomeName;
34
+ readonly ENTRY_TYPES: string[];
35
+ readonly LINK_TYPES: string[];
32
36
  readonly FN_NAMES: FunctionName[];
33
37
  }) & TBase;
34
38
  export declare const ZomeSpecific: ((abstract new (...args: any[]) => {
35
39
  zomeName: ZomeName;
36
40
  readonly defaultZomeName: string;
41
+ readonly entryTypes: string[];
42
+ readonly linkTypes: string[];
37
43
  /** Tuple array with zome name */
38
44
  readonly fnNames: [string, string][];
39
45
  }) & {
40
46
  readonly DEFAULT_ZOME_NAME: ZomeName;
47
+ readonly ENTRY_TYPES: string[];
48
+ readonly LINK_TYPES: string[];
41
49
  readonly FN_NAMES: FunctionName[];
42
50
  }) & typeof Empty;
package/dist/mixins.js CHANGED
@@ -28,6 +28,12 @@ export function ZomeMixin(Base) {
28
28
  get defaultZomeName() {
29
29
  return this.constructor.DEFAULT_ZOME_NAME;
30
30
  }
31
+ get entryTypes() {
32
+ return this.constructor.ENTRY_TYPES;
33
+ }
34
+ get linkTypes() {
35
+ return this.constructor.LINK_TYPES;
36
+ }
31
37
  /** Tuple array with zome name */
32
38
  get fnNames() {
33
39
  const fnNames = this.constructor.FN_NAMES;
@@ -1 +1 @@
1
- {"version":3,"file":"mixins.js","sourceRoot":"","sources":["../src/mixins.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,KAAK;IAChB,YAAY,GAAG,IAAW,IAAG,CAAC;CAC/B;AAGD,mGAAmG;AAEnG;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAoC,IAAW;IACtE,MAAe,KAAM,SAAQ,IAAI;QAM/B,IAAI,IAAI,KAAW,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,MAAM,KAAK,CAAC,+BAA+B,CAAC,CAAE,CAAC,OAAO,IAAI,CAAC,KAAM,CAAA,CAAC,CAAC;KAExG;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,+CAA+C;AAI/C,mGAAmG;AAEnG;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAoC,IAAW;IACtE,MAAe,aAAc,SAAQ,IAAI;QAOvC,YAAY,GAAG,IAAW;YACxB,KAAK,CAAC,IAAI,CAAC,CAAC;YACZ,IAAI,CAAC,QAAQ,GAAI,IAAI,CAAC,WAAoC,CAAC,iBAAiB,CAAA;QAC9E,CAAC;QAED,IAAI,eAAe;YACjB,OAAQ,IAAI,CAAC,WAAoC,CAAC,iBAAiB,CAAC;QACtE,CAAC;QAED,iCAAiC;QACjC,IAAI,OAAO;YACT,MAAM,OAAO,GAAI,IAAI,CAAC,WAAoC,CAAC,QAAQ,CAAC;YACpE,IAAI,CAAC,OAAO,EAAE;gBACZ,MAAM,KAAK,CAAC,6CAA6C,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aACpF;YACD,OAAQ,OAA0B,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;gBAChD,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;YAChC,CAAC,CAAC,CAAA;QACJ,CAAC;KACF;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC","sourcesContent":["import {\n FunctionName,\n ZomeName\n} from \"@holochain/client\";\nimport {Cell} from \"./cell\";\n\nexport type Constructor<T> = {new (): T};\nexport type GConstructor<T = {}> = new (...args: any[]) => T;\nexport type AbstractConstructor<T = {}> = abstract new (...args: any[]) => T\n\n\nexport class Empty {\n constructor(...args: any[]) {}\n}\n\n\n/** ------------------------------------------------------------------------------------------- **/\n\n/**\n * Mixin for Cell bound classes.\n * A Cell bound class must have a \"Provisioned\" or \"Cloned\" cell from @holochain/client\n */\nexport function CellMixin<TBase extends AbstractConstructor>(Base: TBase) {\n abstract class ACell extends Base {\n // constructor(...args: any[]){\n // super(args);\n // }\n _cell?: Cell;\n\n get cell(): Cell { if (!this._cell) throw Error(\"Cell field not set for object\") ; return this._cell! }\n\n }\n\n return ACell;\n}\n\n//export const CellSpecific = CellMixin(Empty);\n\n\n\n/** ------------------------------------------------------------------------------------------- **/\n\n/**\n * Mixin for Zome bound classes.\n * A Zome bound class must have a zome name and a list of zome functions\n */\nexport function ZomeMixin<TBase extends AbstractConstructor>(Base: TBase) {\n abstract class AZomeSpecific extends Base {\n\n static readonly DEFAULT_ZOME_NAME: ZomeName;\n zomeName: ZomeName;\n\n static readonly FN_NAMES: FunctionName[];\n\n constructor(...args: any[]){\n super(args);\n this.zomeName = (this.constructor as typeof AZomeSpecific).DEFAULT_ZOME_NAME\n }\n\n get defaultZomeName(): ZomeName {\n return (this.constructor as typeof AZomeSpecific).DEFAULT_ZOME_NAME;\n }\n\n /** Tuple array with zome name */\n get fnNames(): [ZomeName, FunctionName][] {\n const fnNames = (this.constructor as typeof AZomeSpecific).FN_NAMES;\n if (!fnNames) {\n throw Error(\"FN_NAMES not defined in ZomeProxy subclass \" + this.constructor.name);\n }\n return (fnNames as FunctionName[]).map((fnName) => {\n return [this.zomeName, fnName]\n })\n }\n }\n\n return AZomeSpecific;\n}\n\nexport const ZomeSpecific = ZomeMixin(Empty);\n"]}
1
+ {"version":3,"file":"mixins.js","sourceRoot":"","sources":["../src/mixins.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,KAAK;IAChB,YAAY,GAAG,IAAW,IAAG,CAAC;CAC/B;AAGD,mGAAmG;AAEnG;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAoC,IAAW;IACtE,MAAe,KAAM,SAAQ,IAAI;QAM/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type Constructor<T> = {new (): T};\nexport type GConstructor<T = {}> = new (...args: any[]) => T;\nexport type AbstractConstructor<T = {}> = abstract new (...args: any[]) => T\n\n\nexport class Empty {\n constructor(...args: any[]) {}\n}\n\n\n/** ------------------------------------------------------------------------------------------- **/\n\n/**\n * Mixin for Cell bound classes.\n * A Cell bound class must have a \"Provisioned\" or \"Cloned\" cell from @holochain/client\n */\nexport function CellMixin<TBase extends AbstractConstructor>(Base: TBase) {\n abstract class ACell extends Base {\n // constructor(...args: any[]){\n // super(args);\n // }\n _cell?: Cell;\n\n get cell(): Cell { if (!this._cell) throw Error(\"Cell field not set for object\") ; return this._cell! }\n\n }\n\n return ACell;\n}\n\n//export const CellSpecific = CellMixin(Empty);\n\n\n\n/** ------------------------------------------------------------------------------------------- **/\n\n/**\n * Mixin for Zome bound classes.\n * A Zome bound class must have a zome name and a list of zome functions\n */\nexport function ZomeMixin<TBase extends AbstractConstructor>(Base: TBase) {\n abstract class AZomeSpecific extends Base {\n\n zomeName: ZomeName;\n static readonly DEFAULT_ZOME_NAME: ZomeName;\n static readonly ENTRY_TYPES: string[];\n static readonly LINK_TYPES: string[];\n static readonly FN_NAMES: FunctionName[];\n\n constructor(...args: any[]){\n super(args);\n this.zomeName = (this.constructor as typeof AZomeSpecific).DEFAULT_ZOME_NAME\n }\n\n get defaultZomeName(): ZomeName {\n return (this.constructor as typeof AZomeSpecific).DEFAULT_ZOME_NAME;\n }\n\n get entryTypes(): string[] {\n return (this.constructor as typeof AZomeSpecific).ENTRY_TYPES;\n }\n get linkTypes(): string[] {\n return (this.constructor as typeof AZomeSpecific).LINK_TYPES;\n }\n\n\n /** Tuple array with zome name */\n get fnNames(): [ZomeName, FunctionName][] {\n const fnNames = (this.constructor as typeof AZomeSpecific).FN_NAMES;\n if (!fnNames) {\n throw Error(\"FN_NAMES not defined in ZomeProxy subclass \" + this.constructor.name);\n }\n return (fnNames as FunctionName[]).map((fnName) => {\n return [this.zomeName, fnName]\n })\n }\n }\n\n return AZomeSpecific;\n}\n\nexport const ZomeSpecific = ZomeMixin(Empty);\n"]}
package/dist/types.d.ts CHANGED
@@ -15,7 +15,18 @@ export type SystemPulse = {
15
15
  export type BaseRoleName = string;
16
16
  export type CloneIndex = number;
17
17
  export type ZomeIndex = number;
18
- export type EntryDef = any;
18
+ export type EntryDef = {
19
+ id: {
20
+ App: string;
21
+ } | {
22
+ CapClaim: null;
23
+ } | {
24
+ CapGrant: null;
25
+ };
26
+ visibility: "Public" | "Private";
27
+ requiredValidations: number;
28
+ cacheAtAgentActivity: boolean;
29
+ };
19
30
  export type EntryDefsCallbackResult = {
20
31
  Defs: EntryDef[];
21
32
  };
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,QAAQ,CAAC;AAEpD,0DAA0D;AAG1D,mBAAmB;AAEnB,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,6BAAe,CAAA;IACf,2BAAa,CAAA;AACf,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAgGD,MAAM;AACN,MAAM,UAAU,YAAY,CAAC,KAAmB;IAC9C,IAAI,GAAG,GAAa,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1F,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC;AAKD,oDAAoD;AACpD,MAAM,UAAU,eAAe,CAAC,YAA0B,EAAE,UAAsB;IAChF,oDAAoD;IACpD,OAAO,EAAE,GAAG,YAAY,GAAG,GAAG,GAAG,UAA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AAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACzC,CAAC","sourcesContent":["import {\n CellId,\n RoleName, ClonedCell, ProvisionedCell, ZomeName, FunctionName,\n} from \"@holochain/client\";\nimport {Dictionary} from \"./utils\";\nimport {AgentId, dec64, DnaId, enc64} from \"./hash\";\nimport {SystemSignalProtocol} from \"./zomeSignals.types\";\n//import {AgentPubKey} from \"@holochain/client/lib/types\";\n\n\n/** Signal types */\n\nexport enum SignalType {\n Unknown = \"Unknown\",\n Empty = \"Empty\",\n Zome = \"Zome\",\n}\n\nexport type SystemPulse = {System: SystemSignalProtocol}\n\n//\n// //export type SignalPayload = unknown | LitHappSignal;\n\n// export interface LitHappSignal {\n// from: AgentPubKey,\n// pulses: unknown[],\n// }\n//\n// /** Protocol for notifying the ViewModel (UI) of system level events */\n// export type SystemSignalProtocolVariantPostCommitNewStart = {\n// type: \"PostCommitNewStart\"\n// app_entry_type: string\n// }\n// export type SystemSignalProtocolVariantPostCommitNewEnd = {\n// type: \"PostCommitNewEnd\"\n// app_entry_type: string\n// succeeded: boolean\n// }\n// export type SystemSignalProtocolVariantPostCommitDeleteStart = {\n// type: \"PostCommitDeleteStart\"\n// app_entry_type: string\n// }\n// export type SystemSignalProtocolVariantPostCommitDeleteEnd = {\n// type: \"PostCommitDeleteEnd\"\n// app_entry_type: string\n// succeeded: boolean\n// }\n// export type SystemSignalProtocolVariantSelfCallStart = {\n// type: \"SelfCallStart\"\n// zome_name: string\n// fn_name: string\n// }\n// export type SystemSignalProtocolVariantSelfCallEnd = {\n// type: \"SelfCallEnd\"\n// zome_name: string\n// fn_name: string\n// succeeded: boolean\n// }\n// export type SystemSignalProtocol =\n// | SystemSignalProtocolVariantPostCommitNewStart\n// | SystemSignalProtocolVariantPostCommitNewEnd\n// | SystemSignalProtocolVariantPostCommitDeleteStart\n// | SystemSignalProtocolVariantPostCommitDeleteEnd\n// | SystemSignalProtocolVariantSelfCallStart\n// | SystemSignalProtocolVariantSelfCallEnd;\n//\n\n/** ---- */\n\nexport type BaseRoleName = string;\nexport type CloneIndex = number;\n\nexport type ZomeIndex = number;\n\nexport type EntryDef = any; // FIXME\nexport type EntryDefsCallbackResult = {Defs: EntryDef[]}\n\nexport type ScopedZomeTypes = [ZomeIndex, number[]][];\n\nexport type ScopedZomeTypesSet = {\n entries: ScopedZomeTypes, // EntryDefIndex\n links: ScopedZomeTypes, // LinkType\n};\n\nexport type ZomeInfo = {\n name: ZomeName,\n id: ZomeIndex,\n properties: Uint8Array,\n entry_defs: EntryDef[],\n extern_fns: FunctionName[],\n zome_types: ScopedZomeTypesSet,\n}\n\n\nexport type DnaInfo = {\n name: string,\n id: DnaId,\n properties: Uint8Array,\n zome_names: ZomeName[],\n}\n\n/** */\nexport type CellsForRole = {\n //baseRoleName: BaseRoleName,\n provisioned: ProvisionedCell,\n /** CloneId -> Cell */\n clones: Dictionary<ClonedCell>,\n}\n\n/** BaseRoleName -> RoleCells */\nexport type RoleCellsMap = Dictionary<CellsForRole>;\n\n/** */\nexport function flattenCells(cells: CellsForRole): CellId[] {\n let res: CellId[] = Object.entries(cells.clones).map(([cloneId, clone]) => clone.cell_id);\n res.push(cells.provisioned.cell_id);\n return res;\n}\n\n\n/** -- CloneId -- */\nexport type CloneId = RoleName;\n/** type for string \"<baseRoleName>.<cloneIndex>\" */\nexport function createCloneName(baseRoleName: BaseRoleName, cloneIndex: CloneIndex): string {\n //if (!cloneIndex) return baseRoleName as CloneName;\n return \"\" + baseRoleName + \".\" + cloneIndex;\n}\n\n/** */\nexport function destructureCloneId(cloneId: CloneId): [BaseRoleName, CloneIndex] | undefined {\n const subs = cloneId.split(\".\");\n if (subs.length != 2) {\n //throw Error(`Bad RoleInstance id format: \"${id}\"`);\n return undefined;\n }\n return [subs[0] as BaseRoleName, Number(subs[1]) as CloneIndex];\n}\n\n\n/** */\nexport function decomposeCellId(cellId: CellId): [DnaId, AgentId] {\n return [new DnaId(cellId[0]), new AgentId(cellId[1])]\n}\n\n\n/** -- CellIdStr -- */\n\nexport type CellIdStr = string;\n\nconst CELL_ID_SEPARATOR = \"||\"\n\nexport function CellIdStr(dna_or_cell_id: DnaId | CellId, key?: AgentId): CellIdStr {\n if (Array.isArray(dna_or_cell_id)) {\n return \"\" + enc64(dna_or_cell_id[0]) + CELL_ID_SEPARATOR + enc64(dna_or_cell_id[1]);\n }\n if (!key) {\n throw Error(\"CellIdStr() failed. AgentPubKey not provided\");\n }\n return \"\" + dna_or_cell_id.b64 + CELL_ID_SEPARATOR + key.b64;\n}\n\n/** */\nexport function str2CellId(str: CellIdStr): CellId {\n const subs = str.split(CELL_ID_SEPARATOR);\n if (subs.length != 2) {\n throw Error(\"str2CellId() failed. Bad input string format\");\n }\n return [dec64(subs[0]), dec64(subs[1])]\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,QAAQ,CAAC;AAEpD,0DAA0D;AAG1D,mBAAmB;AAEnB,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,iCAAmB,CAAA;IACnB,6BAAe,CAAA;IACf,2BAAa,CAAA;AACf,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAsGD,MAAM;AACN,MAAM,UAAU,YAAY,CAAC,KAAmB;IAC9C,IAAI,GAAG,GAAa,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1F,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC;AAKD,oDAAoD;AACpD,MAAM,UAA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,CAAC,MAAM,IAAI,CAAC,EAAE;QACpB,MAAM,KAAK,CAAC,8CAA8C,CAAC,CAAC;KAC7D;IACD,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACzC,CAAC","sourcesContent":["import {\n CellId,\n RoleName, ClonedCell, ProvisionedCell, ZomeName, FunctionName,\n} from \"@holochain/client\";\nimport {Dictionary} from \"./utils\";\nimport {AgentId, dec64, DnaId, enc64} from \"./hash\";\nimport {SystemSignalProtocol} from \"./zomeSignals.types\";\n//import {AgentPubKey} from \"@holochain/client/lib/types\";\n\n\n/** Signal types */\n\nexport enum SignalType {\n Unknown = \"Unknown\",\n Empty = \"Empty\",\n Zome = \"Zome\",\n}\n\nexport type SystemPulse = {System: SystemSignalProtocol}\n\n//\n// //export type SignalPayload = unknown | LitHappSignal;\n\n// export interface LitHappSignal {\n// from: AgentPubKey,\n// pulses: unknown[],\n// }\n//\n// /** Protocol for notifying the ViewModel (UI) of system level events */\n// export type SystemSignalProtocolVariantPostCommitNewStart = {\n// type: \"PostCommitNewStart\"\n// app_entry_type: string\n// }\n// export type SystemSignalProtocolVariantPostCommitNewEnd = {\n// type: \"PostCommitNewEnd\"\n// app_entry_type: string\n// succeeded: boolean\n// }\n// export type SystemSignalProtocolVariantPostCommitDeleteStart = {\n// type: \"PostCommitDeleteStart\"\n// app_entry_type: string\n// }\n// export type SystemSignalProtocolVariantPostCommitDeleteEnd = {\n// type: \"PostCommitDeleteEnd\"\n// app_entry_type: string\n// succeeded: boolean\n// }\n// export type SystemSignalProtocolVariantSelfCallStart = {\n// type: \"SelfCallStart\"\n// zome_name: string\n// fn_name: string\n// }\n// export type SystemSignalProtocolVariantSelfCallEnd = {\n// type: \"SelfCallEnd\"\n// zome_name: string\n// fn_name: string\n// succeeded: boolean\n// }\n// export type SystemSignalProtocol =\n// | SystemSignalProtocolVariantPostCommitNewStart\n// | SystemSignalProtocolVariantPostCommitNewEnd\n// | SystemSignalProtocolVariantPostCommitDeleteStart\n// | SystemSignalProtocolVariantPostCommitDeleteEnd\n// | SystemSignalProtocolVariantSelfCallStart\n// | SystemSignalProtocolVariantSelfCallEnd;\n//\n\n/** ---- */\n\nexport type BaseRoleName = string;\nexport type CloneIndex = number;\n\nexport type ZomeIndex = number;\n\nexport type EntryDef = {\n id: { App: string } | { CapClaim: null } | { CapGrant: null },\n visibility: \"Public\" | \"Private\",\n requiredValidations: number,\n cacheAtAgentActivity: boolean,\n}\n\nexport type EntryDefsCallbackResult = {Defs: EntryDef[]}\n\nexport type ScopedZomeTypes = [ZomeIndex, number[]][];\n\nexport type ScopedZomeTypesSet = {\n entries: ScopedZomeTypes, // EntryDefIndex\n links: ScopedZomeTypes, // LinkType\n};\n\nexport type ZomeInfo = {\n name: ZomeName,\n id: ZomeIndex,\n properties: Uint8Array,\n entry_defs: EntryDef[],\n extern_fns: FunctionName[],\n zome_types: ScopedZomeTypesSet,\n}\n\n\nexport type DnaInfo = {\n name: string,\n id: DnaId,\n properties: Uint8Array,\n zome_names: ZomeName[],\n}\n\n/** */\nexport type CellsForRole = {\n //baseRoleName: BaseRoleName,\n provisioned: ProvisionedCell,\n /** CloneId -> Cell */\n clones: Dictionary<ClonedCell>,\n}\n\n/** BaseRoleName -> RoleCells */\nexport type RoleCellsMap = Dictionary<CellsForRole>;\n\n/** */\nexport function flattenCells(cells: CellsForRole): CellId[] {\n let res: CellId[] = Object.entries(cells.clones).map(([cloneId, clone]) => clone.cell_id);\n res.push(cells.provisioned.cell_id);\n return res;\n}\n\n\n/** -- CloneId -- */\nexport type CloneId = RoleName;\n/** type for string \"<baseRoleName>.<cloneIndex>\" */\nexport function createCloneName(baseRoleName: BaseRoleName, cloneIndex: CloneIndex): string {\n //if (!cloneIndex) return baseRoleName as CloneName;\n return \"\" + baseRoleName + \".\" + cloneIndex;\n}\n\n/** */\nexport function destructureCloneId(cloneId: CloneId): [BaseRoleName, CloneIndex] | undefined {\n const subs = cloneId.split(\".\");\n if (subs.length != 2) {\n //throw Error(`Bad RoleInstance id format: \"${id}\"`);\n return undefined;\n }\n return [subs[0] as BaseRoleName, Number(subs[1]) as CloneIndex];\n}\n\n\n/** */\nexport function decomposeCellId(cellId: CellId): [DnaId, AgentId] {\n return [new DnaId(cellId[0]), new AgentId(cellId[1])]\n}\n\n\n/** -- CellIdStr -- */\n\nexport type CellIdStr = string;\n\nconst CELL_ID_SEPARATOR = \"||\"\n\nexport function CellIdStr(dna_or_cell_id: DnaId | CellId, key?: AgentId): CellIdStr {\n if (Array.isArray(dna_or_cell_id)) {\n return \"\" + enc64(dna_or_cell_id[0]) + CELL_ID_SEPARATOR + enc64(dna_or_cell_id[1]);\n }\n if (!key) {\n throw Error(\"CellIdStr() failed. AgentPubKey not provided\");\n }\n return \"\" + dna_or_cell_id.b64 + CELL_ID_SEPARATOR + key.b64;\n}\n\n/** */\nexport function str2CellId(str: CellIdStr): CellId {\n const subs = str.split(CELL_ID_SEPARATOR);\n if (subs.length != 2) {\n throw Error(\"str2CellId() failed. Bad input string format\");\n }\n return [dec64(subs[0]), dec64(subs[1])]\n}\n"]}
package/dist/utils.d.ts CHANGED
@@ -13,4 +13,4 @@ export declare const snake: (str: any) => any;
13
13
  /** convert snake case to pascal case */
14
14
  export declare const pascal: (str: any) => any;
15
15
  /** */
16
- export declare function getVariantByIndex(enumType: any, index: number): string;
16
+ export declare function getVariantByIndex(enumType: Object, index: number): string;
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAOA,MAAM;AACN,MAAM,UAAU,cAAc,CAAC,KAAiB,EAAE,MAAkB;IAClE,OAAO,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,CA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EAAE;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;KACtB;IACD,MAAM,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import {CellId} from \"@holochain/client\";\n\n\nexport declare type Dictionary<T> = {\n [key: string]: T;\n};\n\n/** */\nexport function areArraysEqual(first: Uint8Array, second: Uint8Array) {\n return first.length === second.length && first.every((value, index) => value === second[index])\n}\n\n/** */\nexport function areCellsEqual(cellA: CellId, cellB: CellId) {\n return areArraysEqual(cellA[0], cellB[0]) && areArraysEqual(cellA[1], cellB[1])\n}\n\n/** */\nexport const delay = (ms: number) => new Promise(r => setTimeout(r, ms))\n\n/** convert Pascal case to snake case */\nexport const snake = str => str[0].toLowerCase() + str.slice(1, str.length).replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);\n\n/** convert snake case to pascal case */\nexport const pascal = str => str[0].toUpperCase() + str.slice(1, str.length).replace(/_([a-z])/g, letter => `${letter[1].toUpperCase()}`);\n\n\n/** */\nexport function getVariantByIndex(enumType: any, index: number): string {\n const keys = Object.keys(enumType);\n if (index >= 0 && index < keys.length) {\n const key = keys[index];\n return enumType[key];\n }\n throw Error(\"Out of bounds index\");\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAOA,MAAM;AACN,MAAM,UAAU,cAAc,CAAC,KAAiB,EAAE,MAAkB;IAClE,OAAO,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;AACjG,CAAC;AAED,MAAM;AACN,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,KAAa;IACxD,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,EA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CAAC;AACrC,CAAC","sourcesContent":["import {CellId} from \"@holochain/client\";\n\n\nexport declare type Dictionary<T> = {\n [key: string]: T;\n};\n\n/** */\nexport function areArraysEqual(first: Uint8Array, second: Uint8Array) {\n return first.length === second.length && first.every((value, index) => value === second[index])\n}\n\n/** */\nexport function areCellsEqual(cellA: CellId, cellB: CellId) {\n return areArraysEqual(cellA[0], cellB[0]) && areArraysEqual(cellA[1], cellB[1])\n}\n\n/** */\nexport const delay = (ms: number) => new Promise(r => setTimeout(r, ms))\n\n/** convert Pascal case to snake case */\nexport const snake = str => str[0].toLowerCase() + str.slice(1, str.length).replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);\n\n/** convert snake case to pascal case */\nexport const pascal = str => str[0].toUpperCase() + str.slice(1, str.length).replace(/_([a-z])/g, letter => `${letter[1].toUpperCase()}`);\n\n\n/** */\nexport function getVariantByIndex(enumType: Object, index: number): string {\n const keys = Object.keys(enumType);\n if (index >= 0 && index < keys.length) {\n const key = keys[index];\n return enumType[key];\n }\n throw Error(\"Out of bounds index\");\n}\n"]}
File without changes
@@ -0,0 +1,2 @@
1
+ /* This file is generated by zits. Do not edit manually */
2
+ //# sourceMappingURL=zomeSignals.integrity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zomeSignals.integrity.js","sourceRoot":"","sources":["../src/zomeSignals.integrity.ts"],"names":[],"mappings":"AAAA,0DAA0D","sourcesContent":["/* This file is generated by zits. Do not edit manually */\n\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddd-qc/cell-proxy",
3
- "version": "0.25.1",
3
+ "version": "0.26.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",