@ddd-qc/agent-directory 4.165.3 → 4.165.4

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 CHANGED
@@ -5,11 +5,20 @@ A holochain zome module that registers agents to a known directory path on agent
5
5
 
6
6
  # API
7
7
 
8
- ## ViewModel
9
- - `subscribe(fn)`: Host can provide a function to be called when data store has been updated.
10
- - `pullAllFromDht()`: Check the DHT for any kind of new data.
11
- - `pullAllRegisteredAgents()`: Check the DHT for new registered agents.
12
- - `agents()`: Getter for the list of registered agents.
8
+ Uses [dna-client](https://www.npmjs.com/package/@ddd-qc/dna-client) framework.
9
+ Provides a ZomeProxy and ZomeViewModel.
10
+
11
+ ### Perspective
12
+
13
+ ```typescript
14
+ interface AgentDirectoryPerspective {
15
+ agents: AgentPubKeyB64[], // List of registered agents
16
+ }
17
+ ```
18
+
19
+ ### ZomeViewModel
20
+ - `probeAll()`: Check the DHT for any kind of new data.
21
+ - `probeRegisteredAgents()`: Check the DHT for new registered agents.
13
22
 
14
23
 
15
24
  # Custom Elements
@@ -1,5 +1,5 @@
1
1
  import { AgentPubKey } from "@holochain/client";
2
- import { ZomeProxy } from "@ddd-qc/dna-client";
2
+ import { ZomeProxy } from "@ddd-qc/lit-happ";
3
3
  /**
4
4
  *
5
5
  */
@@ -1,4 +1,4 @@
1
- import { ZomeProxy } from "@ddd-qc/dna-client";
1
+ import { ZomeProxy } from "@ddd-qc/lit-happ";
2
2
  /**
3
3
  *
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"agent_directory.proxy.js","sourceRoot":"","sources":["../src/agent_directory.proxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAG7C;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAGhD,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;;AAJe,qCAAiB,GAAG,iBAAiB,CAAC","sourcesContent":["import {AgentPubKey} from \"@holochain/client\";\nimport {ZomeProxy} from \"@ddd-qc/dna-client\";\n\n\n/**\n *\n */\nexport class AgentDirectoryProxy extends ZomeProxy {\n static readonly DEFAULT_ZOME_NAME = 'agent_directory';\n\n async getAllAgents(): Promise<AgentPubKey[]> {\n return this.call('get_registered_agents', null);\n }\n}\n"]}
1
+ {"version":3,"file":"agent_directory.proxy.js","sourceRoot":"","sources":["../src/agent_directory.proxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAG3C;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAGhD,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;;AAJe,qCAAiB,GAAG,iBAAiB,CAAC","sourcesContent":["import {AgentPubKey} from \"@holochain/client\";\nimport {ZomeProxy} from \"@ddd-qc/lit-happ\";\n\n\n/**\n *\n */\nexport class AgentDirectoryProxy extends ZomeProxy {\n static readonly DEFAULT_ZOME_NAME = 'agent_directory';\n\n async getAllAgents(): Promise<AgentPubKey[]> {\n return this.call('get_registered_agents', null);\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { AgentPubKey } from "@holochain/client";
2
- import { DnaClient } from "@ddd-qc/dna-client";
2
+ import { DnaClient } from "@ddd-qc/lit-happ";
3
3
  /**
4
4
  *
5
5
  */
@@ -1,5 +1,5 @@
1
1
  import { AgentPubKeyB64 } from '@holochain-open-dev/core-types';
2
- import { ZomeViewModel } from "@ddd-qc/dna-client";
2
+ import { ZomeViewModel } from "@ddd-qc/lit-happ";
3
3
  import { AgentDirectoryProxy } from "./agent_directory.proxy";
4
4
  /** */
5
5
  export interface AgentDirectoryPerspective {
@@ -1,5 +1,5 @@
1
1
  import { serializeHash } from "@holochain-open-dev/utils";
2
- import { ZomeViewModel } from "@ddd-qc/dna-client";
2
+ import { ZomeViewModel } from "@ddd-qc/lit-happ";
3
3
  import { AgentDirectoryProxy } from "./agent_directory.proxy";
4
4
  /**
5
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"agent_directory.zvm.js","sourceRoot":"","sources":["../src/agent_directory.zvm.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAS5D;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAApD;;QASE,mBAAmB;QAEX,YAAO,GAAqB,EAAE,CAAC;IAkCzC,CAAC;IAzCC,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAiC,CAAC;IAChD,CAAC;IAQD,oBAAoB;IAEpB,KAAK;IACL,IAAI,WAAW;QACb,OAAO,EAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAC,CAAA;IAC/B,CAAC;IAGD,MAAM;IACI,UAAU;QAClB,IAAI,CAAC,IAAI,CAAC,oBAAoB;YAAE,OAAO,IAAI,CAAC;QAC5C,IAAI,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;QAC7G,OAAO,UAAU,CAAA;IACnB,CAAC;IAGD,MAAM;IACN,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAA;IACpC,CAAC;IAGD,MAAM;IACN,KAAK,CAAC,qBAAqB;QACzB,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjE,+CAA+C;QAC/C,6FAA6F;QAC7F,IAAI,CAAC,iBAAiB,EAAE,CAAA;IAC1B,CAAC;;AAzCe,4BAAU,GAAG,mBAAmB,CAAC","sourcesContent":["import {AgentPubKeyB64} from '@holochain-open-dev/core-types';\nimport {serializeHash} from \"@holochain-open-dev/utils\";\nimport {ZomeViewModel} from \"@ddd-qc/dna-client\";\nimport {AgentDirectoryProxy} from \"./agent_directory.proxy\";\n\n\n/** */\nexport interface AgentDirectoryPerspective {\n agents: AgentPubKeyB64[],\n}\n\n\n/**\n *\n */\nexport class AgentDirectoryZvm extends ZomeViewModel {\n\n static readonly ZOME_PROXY = AgentDirectoryProxy;\n\n get zomeProxy(): AgentDirectoryProxy {\n return this._zomeProxy as AgentDirectoryProxy;\n }\n\n\n /** -- Fields -- */\n\n private _agents: AgentPubKeyB64[] = [];\n\n\n /** -- Methods -- */\n\n /* */\n get perspective(): AgentDirectoryPerspective {\n return {agents: this._agents}\n }\n\n\n /** */\n protected hasChanged(): boolean {\n if (!this._previousPerspective) return true;\n let hasChanged = JSON.stringify(this.perspective.agents) !== JSON.stringify(this._previousPerspective.agents)\n return hasChanged\n }\n\n\n /** */\n async probeAll(): Promise<void> {\n await this.probeRegisteredAgents()\n }\n\n\n /** */\n async probeRegisteredAgents() {\n let agents = await this.zomeProxy.getAllAgents();\n this._agents = agents.map((agentKey) => serializeHash(agentKey));\n // Debug add a random string to the perspective\n // this._agents.push(String.fromCharCode(\"A\".charCodeAt(0) + Math.floor(Math.random() * 26)))\n this.notifySubscribers()\n }\n\n}"]}
1
+ {"version":3,"file":"agent_directory.zvm.js","sourceRoot":"","sources":["../src/agent_directory.zvm.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,mBAAmB,EAAC,MAAM,yBAAyB,CAAC;AAS5D;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAApD;;QASE,mBAAmB;QAEX,YAAO,GAAqB,EAAE,CAAC;IAkCzC,CAAC;IAzCC,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAiC,CAAC;IAChD,CAAC;IAQD,oBAAoB;IAEpB,KAAK;IACL,IAAI,WAAW;QACb,OAAO,EAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAC,CAAA;IAC/B,CAAC;IAGD,MAAM;IACI,UAAU;QAClB,IAAI,CAAC,IAAI,CAAC,oBAAoB;YAAE,OAAO,IAAI,CAAC;QAC5C,IAAI,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;QAC7G,OAAO,UAAU,CAAA;IACnB,CAAC;IAGD,MAAM;IACN,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,qBAAqB,EAAE,CAAA;IACpC,CAAC;IAGD,MAAM;IACN,KAAK,CAAC,qBAAqB;QACzB,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjE,+CAA+C;QAC/C,6FAA6F;QAC7F,IAAI,CAAC,iBAAiB,EAAE,CAAA;IAC1B,CAAC;;AAzCe,4BAAU,GAAG,mBAAmB,CAAC","sourcesContent":["import {AgentPubKeyB64} from '@holochain-open-dev/core-types';\nimport {serializeHash} from \"@holochain-open-dev/utils\";\nimport {ZomeViewModel} from \"@ddd-qc/lit-happ\";\nimport {AgentDirectoryProxy} from \"./agent_directory.proxy\";\n\n\n/** */\nexport interface AgentDirectoryPerspective {\n agents: AgentPubKeyB64[],\n}\n\n\n/**\n *\n */\nexport class AgentDirectoryZvm extends ZomeViewModel {\n\n static readonly ZOME_PROXY = AgentDirectoryProxy;\n\n get zomeProxy(): AgentDirectoryProxy {\n return this._zomeProxy as AgentDirectoryProxy;\n }\n\n\n /** -- Fields -- */\n\n private _agents: AgentPubKeyB64[] = [];\n\n\n /** -- Methods -- */\n\n /* */\n get perspective(): AgentDirectoryPerspective {\n return {agents: this._agents}\n }\n\n\n /** */\n protected hasChanged(): boolean {\n if (!this._previousPerspective) return true;\n let hasChanged = JSON.stringify(this.perspective.agents) !== JSON.stringify(this._previousPerspective.agents)\n return hasChanged\n }\n\n\n /** */\n async probeAll(): Promise<void> {\n await this.probeRegisteredAgents()\n }\n\n\n /** */\n async probeRegisteredAgents() {\n let agents = await this.zomeProxy.getAllAgents();\n this._agents = agents.map((agentKey) => serializeHash(agentKey));\n // Debug add a random string to the perspective\n // this._agents.push(String.fromCharCode(\"A\".charCodeAt(0) + Math.floor(Math.random() * 26)))\n this.notifySubscribers()\n }\n\n}"]}
@@ -1,4 +1,4 @@
1
- import { ZomeElement } from "@ddd-qc/dna-client";
1
+ import { ZomeElement } from "@ddd-qc/lit-happ";
2
2
  import { AgentDirectoryPerspective, AgentDirectoryZvm } from "../agent_directory.zvm";
3
3
  /**
4
4
  * @element agent-directory-list
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { html } from "lit";
3
3
  import { state } from "lit/decorators.js";
4
- import { ZomeElement } from "@ddd-qc/dna-client";
4
+ import { ZomeElement } from "@ddd-qc/lit-happ";
5
5
  import { AgentDirectoryZvm } from "../agent_directory.zvm";
6
6
  /**
7
7
  * @element agent-directory-list
@@ -1 +1 @@
1
- {"version":3,"file":"agent-directory-list.js","sourceRoot":"","sources":["../../src/elements/agent-directory-list.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,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A8B","sourcesContent":["import {html} from \"lit\";\nimport {property, state} from \"lit/decorators.js\";\nimport {ZomeElement} from \"@ddd-qc/dna-client\";\nimport {AgentDirectoryPerspective, AgentDirectoryZvm} from \"../agent_directory.zvm\";\n\n/**\n * @element agent-directory-list\n */\nexport class AgentDirectoryList extends ZomeElement<AgentDirectoryPerspective, AgentDirectoryZvm> {\n /** Ctor */\n constructor() {\n super(AgentDirectoryZvm.DEFAULT_ZOME_NAME);\n }\n\n\n /** -- Fields -- */\n\n @state() private _initialized = false;\n\n\n\n /** -- Methods -- */\n\n /** After first call to render() */\n async firstUpdated() {\n //this._viewModel.subscribe(this, 'perspective');\n await this.refresh();\n this._initialized = true;\n }\n\n\n /** After each call to render() */\n async updated(changedProperties: any) {\n // n/a\n }\n\n\n /** */\n async refresh(_e?: any) {\n //console.log(\"refresh(): Pulling data from DHT\")\n await this._zvm.probeAll();\n }\n\n\n /** */\n render() {\n console.log(\"agent-directory-list render() START\");\n\n if (!this._initialized) {\n return html`<span>Loading...</span>`;\n }\n\n /* Agents */\n const agentLi = Object.entries(this.perspective.agents).map(\n ([_index, agentIdB64]) => {\n //console.log(\"\" + index + \". \" + agentIdB64)\n return html `<li value=\"${agentIdB64}\">${agentIdB64}</li>`\n }\n )\n\n /** render all */\n return html` \n <ul>\n ${agentLi}\n </ul>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"agent-directory-list.js","sourceRoot":"","sources":["../../src/elements/agent-directory-list.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAW,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAA4B,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAEpF;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,WAAyD;IAC/F,WAAW;IACX;QACE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;QAI7C,mBAAmB;QAEF,iBAAY,GAAG,KAAK,CAAC;IALtC,CAAC;IASD,oBAAoB;IAEpB,mCAAmC;IACnC,KAAK,CAAC,YAAY;QAChB,iDAAiD;QACjD,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IAGD,kCAAkC;IAClC,KAAK,CAAC,OAAO,CAAC,iBAAsB;QAClC,MAAM;IACR,CAAC;IAGD,MAAM;IACN,KAAK,CAAC,OAAO,CAAC,EAAQ;QACpB,iDAAiD;QACjD,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;IAGD,MAAM;IACN,MAAM;QACJ,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QAEnD,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACtB,OAAO,IAAI,CAAA,yBAAyB,CAAC;SACtC;QAED,YAAY;QACZ,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CACvD,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE;YACvB,6CAA6C;YAC7C,OAAO,IAAI,CAAC,cAAc,UAAU,KAAK,UAAU,OAAO,CAAA;QAC5D,CAAC,CACJ,CAAA;QAED,iBAAiB;QACjB,OAAO,IAAI,CAAA;;YAEH,OAAO;;KAEd,CAAC;IACJ,CAAC;CACF;AAlDU;IAAR,KAAK,EAAE;wDAA8B","sourcesContent":["import {html} from \"lit\";\nimport {property, state} from \"lit/decorators.js\";\nimport {ZomeElement} from \"@ddd-qc/lit-happ\";\nimport {AgentDirectoryPerspective, AgentDirectoryZvm} from \"../agent_directory.zvm\";\n\n/**\n * @element agent-directory-list\n */\nexport class AgentDirectoryList extends ZomeElement<AgentDirectoryPerspective, AgentDirectoryZvm> {\n /** Ctor */\n constructor() {\n super(AgentDirectoryZvm.DEFAULT_ZOME_NAME);\n }\n\n\n /** -- Fields -- */\n\n @state() private _initialized = false;\n\n\n\n /** -- Methods -- */\n\n /** After first call to render() */\n async firstUpdated() {\n //this._viewModel.subscribe(this, 'perspective');\n await this.refresh();\n this._initialized = true;\n }\n\n\n /** After each call to render() */\n async updated(changedProperties: any) {\n // n/a\n }\n\n\n /** */\n async refresh(_e?: any) {\n //console.log(\"refresh(): Pulling data from DHT\")\n await this._zvm.probeAll();\n }\n\n\n /** */\n render() {\n console.log(\"agent-directory-list render() START\");\n\n if (!this._initialized) {\n return html`<span>Loading...</span>`;\n }\n\n /* Agents */\n const agentLi = Object.entries(this.perspective.agents).map(\n ([_index, agentIdB64]) => {\n //console.log(\"\" + index + \". \" + agentIdB64)\n return html `<li value=\"${agentIdB64}\">${agentIdB64}</li>`\n }\n )\n\n /** render all */\n return html` \n <ul>\n ${agentLi}\n </ul>\n `;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddd-qc/agent-directory",
3
- "version": "4.165.3",
3
+ "version": "4.165.4",
4
4
  "license" : "CAL-1.0",
5
5
  "keywords": ["holochain", "zome"],
6
6
  "main": "./dist/index.js",
@@ -25,10 +25,11 @@
25
25
  "typescript": "4.3.5"
26
26
  },
27
27
  "dependencies": {
28
- "@holochain/client": "^0.9.2",
28
+ "@holochain/client": "^0.9.3",
29
29
  "@holochain-open-dev/core-types": "^0.5.0",
30
30
  "@holochain-open-dev/utils": "0.4.0",
31
- "@ddd-qc/dna-client": "0.8.8",
31
+ "@ddd-qc/lit-happ": "0.9.6",
32
+ "@ddd-qc/cell-proxy": "0.9.6",
32
33
  "lit": "^2.2.0"
33
34
  },
34
35
  "type": "module",