@xyo-network/diviner-address-chain-memory 2.84.19 → 2.85.1

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.
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
7
  var __export = (target, all) => {
7
8
  for (var name in all)
8
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -30,7 +31,12 @@ var import_boundwitness_wrapper = require("@xyo-network/boundwitness-wrapper");
30
31
  var import_diviner_address_chain_abstract = require("@xyo-network/diviner-address-chain-abstract");
31
32
  var import_diviner_address_chain_model = require("@xyo-network/diviner-address-chain-model");
32
33
  var MemoryAddressChainDiviner = class extends import_diviner_address_chain_abstract.AddressChainDiviner {
33
- static configSchemas = [import_diviner_address_chain_model.AddressChainDivinerConfigSchema];
34
+ static {
35
+ __name(this, "MemoryAddressChainDiviner");
36
+ }
37
+ static configSchemas = [
38
+ import_diviner_address_chain_model.AddressChainDivinerConfigSchema
39
+ ];
34
40
  get queryAddress() {
35
41
  return (0, import_assert.assertEx)(this.config.address, "Missing address");
36
42
  }
@@ -42,7 +48,9 @@ var MemoryAddressChainDiviner = class extends import_diviner_address_chain_abstr
42
48
  const archivist = (0, import_assert.assertEx)(archivistIn, "Unable to resolve archivist");
43
49
  let currentHash = (0, import_assert.assertEx)(this.config.startHash, "Missing startHash");
44
50
  while (currentHash && result.length < (this.config.maxResults ?? 1e3)) {
45
- const bwPayload = await this.archivistFindHash([archivist], currentHash);
51
+ const bwPayload = await this.archivistFindHash([
52
+ archivist
53
+ ], currentHash);
46
54
  const bwWrapper = import_boundwitness_wrapper.BoundWitnessWrapper.tryParse(bwPayload);
47
55
  if (bwWrapper) {
48
56
  result.push(bwWrapper.payload());
@@ -57,7 +65,9 @@ var MemoryAddressChainDiviner = class extends import_diviner_address_chain_abstr
57
65
  async archivistFindHash(archivists, hash) {
58
66
  let index = 0;
59
67
  if (archivists[index]) {
60
- const result = (await archivists[index].get([hash])).pop();
68
+ const result = (await archivists[index].get([
69
+ hash
70
+ ])).pop();
61
71
  if (result) {
62
72
  return result;
63
73
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/MemoryDiviner.ts"],"sourcesContent":["export * from './MemoryDiviner'\n","import { assertEx } from '@xylabs/assert'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'\nimport { AddressChainDiviner } from '@xyo-network/diviner-address-chain-abstract'\nimport { AddressChainDivinerConfig, AddressChainDivinerConfigSchema } from '@xyo-network/diviner-address-chain-model'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n// This diviner returns the most recent boundwitness signed by the address that can be found\n// if multiple broken chains are found, all the heads are returned\nexport type MemoryAddressChainDivinerParams = DivinerParams<AnyConfigSchema<AddressChainDivinerConfig>>\n\nexport class MemoryAddressChainDiviner<\n TParams extends MemoryAddressChainDivinerParams = MemoryAddressChainDivinerParams,\n> extends AddressChainDiviner<TParams> {\n static override configSchemas = [AddressChainDivinerConfigSchema]\n\n get queryAddress() {\n return assertEx(this.config.address, 'Missing address')\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const result: Payload[] = []\n assertEx(!payloads?.length, 'MemoryAddressChainDiviner.divine does not allow payloads to be sent')\n try {\n const archivistIn = await this.getArchivist()\n const archivist = assertEx(archivistIn, 'Unable to resolve archivist')\n let currentHash: string | null = assertEx(this.config.startHash, 'Missing startHash')\n while (currentHash && result.length < (this.config.maxResults ?? 1000)) {\n const bwPayload: BoundWitness | undefined = await this.archivistFindHash([archivist], currentHash)\n const bwWrapper: BoundWitnessWrapper | undefined = BoundWitnessWrapper.tryParse(bwPayload)\n if (bwWrapper) {\n result.push(bwWrapper.payload())\n currentHash = bwWrapper.prev(this.queryAddress)\n }\n }\n } catch (ex) {\n console.log(ex)\n }\n return result\n }\n\n private async archivistFindHash(archivists: ArchivistInstance[], hash: string): Promise<BoundWitness | undefined> {\n let index = 0\n if (archivists[index]) {\n const result = (await archivists[index].get([hash])).pop() as BoundWitness\n if (result) {\n return result\n }\n index++\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AAGzB,kCAAoC;AACpC,4CAAoC;AACpC,yCAA2E;AASpE,IAAM,4BAAN,cAEG,0DAA6B;AAAA,EACrC,OAAgB,gBAAgB,CAAC,kEAA+B;AAAA,EAEhE,IAAI,eAAe;AACjB,eAAO,wBAAS,KAAK,OAAO,SAAS,iBAAiB;AAAA,EACxD;AAAA,EAEA,MAAyB,cAAc,UAA0C;AAC/E,UAAM,SAAoB,CAAC;AAC3B,gCAAS,CAAC,UAAU,QAAQ,qEAAqE;AACjG,QAAI;AACF,YAAM,cAAc,MAAM,KAAK,aAAa;AAC5C,YAAM,gBAAY,wBAAS,aAAa,6BAA6B;AACrE,UAAI,kBAA6B,wBAAS,KAAK,OAAO,WAAW,mBAAmB;AACpF,aAAO,eAAe,OAAO,UAAU,KAAK,OAAO,cAAc,MAAO;AACtE,cAAM,YAAsC,MAAM,KAAK,kBAAkB,CAAC,SAAS,GAAG,WAAW;AACjG,cAAM,YAA6C,gDAAoB,SAAS,SAAS;AACzF,YAAI,WAAW;AACb,iBAAO,KAAK,UAAU,QAAQ,CAAC;AAC/B,wBAAc,UAAU,KAAK,KAAK,YAAY;AAAA,QAChD;AAAA,MACF;AAAA,IACF,SAAS,IAAI;AACX,cAAQ,IAAI,EAAE;AAAA,IAChB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,kBAAkB,YAAiC,MAAiD;AAChH,QAAI,QAAQ;AACZ,QAAI,WAAW,KAAK,GAAG;AACrB,YAAM,UAAU,MAAM,WAAW,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI;AACzD,UAAI,QAAQ;AACV,eAAO;AAAA,MACT;AACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/MemoryDiviner.ts"],"sourcesContent":["export * from './MemoryDiviner'\n","import { assertEx } from '@xylabs/assert'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'\nimport { AddressChainDiviner } from '@xyo-network/diviner-address-chain-abstract'\nimport { AddressChainDivinerConfig, AddressChainDivinerConfigSchema } from '@xyo-network/diviner-address-chain-model'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n// This diviner returns the most recent boundwitness signed by the address that can be found\n// if multiple broken chains are found, all the heads are returned\nexport type MemoryAddressChainDivinerParams = DivinerParams<AnyConfigSchema<AddressChainDivinerConfig>>\n\nexport class MemoryAddressChainDiviner<\n TParams extends MemoryAddressChainDivinerParams = MemoryAddressChainDivinerParams,\n> extends AddressChainDiviner<TParams> {\n static override configSchemas = [AddressChainDivinerConfigSchema]\n\n get queryAddress() {\n return assertEx(this.config.address, 'Missing address')\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const result: Payload[] = []\n assertEx(!payloads?.length, 'MemoryAddressChainDiviner.divine does not allow payloads to be sent')\n try {\n const archivistIn = await this.getArchivist()\n const archivist = assertEx(archivistIn, 'Unable to resolve archivist')\n let currentHash: string | null = assertEx(this.config.startHash, 'Missing startHash')\n while (currentHash && result.length < (this.config.maxResults ?? 1000)) {\n const bwPayload: BoundWitness | undefined = await this.archivistFindHash([archivist], currentHash)\n const bwWrapper: BoundWitnessWrapper | undefined = BoundWitnessWrapper.tryParse(bwPayload)\n if (bwWrapper) {\n result.push(bwWrapper.payload())\n currentHash = bwWrapper.prev(this.queryAddress)\n }\n }\n } catch (ex) {\n console.log(ex)\n }\n return result\n }\n\n private async archivistFindHash(archivists: ArchivistInstance[], hash: string): Promise<BoundWitness | undefined> {\n let index = 0\n if (archivists[index]) {\n const result = (await archivists[index].get([hash])).pop() as BoundWitness\n if (result) {\n return result\n }\n index++\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,oBAAyB;AAGzB,kCAAoC;AACpC,4CAAoC;AACpC,yCAA2E;AASpE,IAAMA,4BAAN,cAEGC,0DAAAA;EAhBV,OAgBUA;;;EACR,OAAgBC,gBAAgB;IAACC;;EAEjC,IAAIC,eAAe;AACjB,eAAOC,wBAAS,KAAKC,OAAOC,SAAS,iBAAA;EACvC;EAEA,MAAyBC,cAAcC,UAA0C;AAC/E,UAAMC,SAAoB,CAAA;AAC1BL,gCAAS,CAACI,UAAUE,QAAQ,qEAAA;AAC5B,QAAI;AACF,YAAMC,cAAc,MAAM,KAAKC,aAAY;AAC3C,YAAMC,gBAAYT,wBAASO,aAAa,6BAAA;AACxC,UAAIG,kBAA6BV,wBAAS,KAAKC,OAAOU,WAAW,mBAAA;AACjE,aAAOD,eAAeL,OAAOC,UAAU,KAAKL,OAAOW,cAAc,MAAO;AACtE,cAAMC,YAAsC,MAAM,KAAKC,kBAAkB;UAACL;WAAYC,WAAAA;AACtF,cAAMK,YAA6CC,gDAAoBC,SAASJ,SAAAA;AAChF,YAAIE,WAAW;AACbV,iBAAOa,KAAKH,UAAUI,QAAO,CAAA;AAC7BT,wBAAcK,UAAUK,KAAK,KAAKrB,YAAY;QAChD;MACF;IACF,SAASsB,IAAI;AACXC,cAAQC,IAAIF,EAAAA;IACd;AACA,WAAOhB;EACT;EAEA,MAAcS,kBAAkBU,YAAiCC,MAAiD;AAChH,QAAIC,QAAQ;AACZ,QAAIF,WAAWE,KAAAA,GAAQ;AACrB,YAAMrB,UAAU,MAAMmB,WAAWE,KAAAA,EAAOC,IAAI;QAACF;OAAK,GAAGG,IAAG;AACxD,UAAIvB,QAAQ;AACV,eAAOA;MACT;AACAqB;IACF;EACF;AACF;","names":["MemoryAddressChainDiviner","AddressChainDiviner","configSchemas","AddressChainDivinerConfigSchema","queryAddress","assertEx","config","address","divineHandler","payloads","result","length","archivistIn","getArchivist","archivist","currentHash","startHash","maxResults","bwPayload","archivistFindHash","bwWrapper","BoundWitnessWrapper","tryParse","push","payload","prev","ex","console","log","archivists","hash","index","get","pop"]}
@@ -1,10 +1,18 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/MemoryDiviner.ts
2
5
  import { assertEx } from "@xylabs/assert";
3
6
  import { BoundWitnessWrapper } from "@xyo-network/boundwitness-wrapper";
4
7
  import { AddressChainDiviner } from "@xyo-network/diviner-address-chain-abstract";
5
8
  import { AddressChainDivinerConfigSchema } from "@xyo-network/diviner-address-chain-model";
6
9
  var MemoryAddressChainDiviner = class extends AddressChainDiviner {
7
- static configSchemas = [AddressChainDivinerConfigSchema];
10
+ static {
11
+ __name(this, "MemoryAddressChainDiviner");
12
+ }
13
+ static configSchemas = [
14
+ AddressChainDivinerConfigSchema
15
+ ];
8
16
  get queryAddress() {
9
17
  return assertEx(this.config.address, "Missing address");
10
18
  }
@@ -16,7 +24,9 @@ var MemoryAddressChainDiviner = class extends AddressChainDiviner {
16
24
  const archivist = assertEx(archivistIn, "Unable to resolve archivist");
17
25
  let currentHash = assertEx(this.config.startHash, "Missing startHash");
18
26
  while (currentHash && result.length < (this.config.maxResults ?? 1e3)) {
19
- const bwPayload = await this.archivistFindHash([archivist], currentHash);
27
+ const bwPayload = await this.archivistFindHash([
28
+ archivist
29
+ ], currentHash);
20
30
  const bwWrapper = BoundWitnessWrapper.tryParse(bwPayload);
21
31
  if (bwWrapper) {
22
32
  result.push(bwWrapper.payload());
@@ -31,7 +41,9 @@ var MemoryAddressChainDiviner = class extends AddressChainDiviner {
31
41
  async archivistFindHash(archivists, hash) {
32
42
  let index = 0;
33
43
  if (archivists[index]) {
34
- const result = (await archivists[index].get([hash])).pop();
44
+ const result = (await archivists[index].get([
45
+ hash
46
+ ])).pop();
35
47
  if (result) {
36
48
  return result;
37
49
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/MemoryDiviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'\nimport { AddressChainDiviner } from '@xyo-network/diviner-address-chain-abstract'\nimport { AddressChainDivinerConfig, AddressChainDivinerConfigSchema } from '@xyo-network/diviner-address-chain-model'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n// This diviner returns the most recent boundwitness signed by the address that can be found\n// if multiple broken chains are found, all the heads are returned\nexport type MemoryAddressChainDivinerParams = DivinerParams<AnyConfigSchema<AddressChainDivinerConfig>>\n\nexport class MemoryAddressChainDiviner<\n TParams extends MemoryAddressChainDivinerParams = MemoryAddressChainDivinerParams,\n> extends AddressChainDiviner<TParams> {\n static override configSchemas = [AddressChainDivinerConfigSchema]\n\n get queryAddress() {\n return assertEx(this.config.address, 'Missing address')\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const result: Payload[] = []\n assertEx(!payloads?.length, 'MemoryAddressChainDiviner.divine does not allow payloads to be sent')\n try {\n const archivistIn = await this.getArchivist()\n const archivist = assertEx(archivistIn, 'Unable to resolve archivist')\n let currentHash: string | null = assertEx(this.config.startHash, 'Missing startHash')\n while (currentHash && result.length < (this.config.maxResults ?? 1000)) {\n const bwPayload: BoundWitness | undefined = await this.archivistFindHash([archivist], currentHash)\n const bwWrapper: BoundWitnessWrapper | undefined = BoundWitnessWrapper.tryParse(bwPayload)\n if (bwWrapper) {\n result.push(bwWrapper.payload())\n currentHash = bwWrapper.prev(this.queryAddress)\n }\n }\n } catch (ex) {\n console.log(ex)\n }\n return result\n }\n\n private async archivistFindHash(archivists: ArchivistInstance[], hash: string): Promise<BoundWitness | undefined> {\n let index = 0\n if (archivists[index]) {\n const result = (await archivists[index].get([hash])).pop() as BoundWitness\n if (result) {\n return result\n }\n index++\n }\n }\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAGzB,SAAS,2BAA2B;AACpC,SAAS,2BAA2B;AACpC,SAAoC,uCAAuC;AASpE,IAAM,4BAAN,cAEG,oBAA6B;AAAA,EACrC,OAAgB,gBAAgB,CAAC,+BAA+B;AAAA,EAEhE,IAAI,eAAe;AACjB,WAAO,SAAS,KAAK,OAAO,SAAS,iBAAiB;AAAA,EACxD;AAAA,EAEA,MAAyB,cAAc,UAA0C;AAC/E,UAAM,SAAoB,CAAC;AAC3B,aAAS,CAAC,UAAU,QAAQ,qEAAqE;AACjG,QAAI;AACF,YAAM,cAAc,MAAM,KAAK,aAAa;AAC5C,YAAM,YAAY,SAAS,aAAa,6BAA6B;AACrE,UAAI,cAA6B,SAAS,KAAK,OAAO,WAAW,mBAAmB;AACpF,aAAO,eAAe,OAAO,UAAU,KAAK,OAAO,cAAc,MAAO;AACtE,cAAM,YAAsC,MAAM,KAAK,kBAAkB,CAAC,SAAS,GAAG,WAAW;AACjG,cAAM,YAA6C,oBAAoB,SAAS,SAAS;AACzF,YAAI,WAAW;AACb,iBAAO,KAAK,UAAU,QAAQ,CAAC;AAC/B,wBAAc,UAAU,KAAK,KAAK,YAAY;AAAA,QAChD;AAAA,MACF;AAAA,IACF,SAAS,IAAI;AACX,cAAQ,IAAI,EAAE;AAAA,IAChB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,kBAAkB,YAAiC,MAAiD;AAChH,QAAI,QAAQ;AACZ,QAAI,WAAW,KAAK,GAAG;AACrB,YAAM,UAAU,MAAM,WAAW,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI;AACzD,UAAI,QAAQ;AACV,eAAO;AAAA,MACT;AACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/MemoryDiviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'\nimport { AddressChainDiviner } from '@xyo-network/diviner-address-chain-abstract'\nimport { AddressChainDivinerConfig, AddressChainDivinerConfigSchema } from '@xyo-network/diviner-address-chain-model'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n// This diviner returns the most recent boundwitness signed by the address that can be found\n// if multiple broken chains are found, all the heads are returned\nexport type MemoryAddressChainDivinerParams = DivinerParams<AnyConfigSchema<AddressChainDivinerConfig>>\n\nexport class MemoryAddressChainDiviner<\n TParams extends MemoryAddressChainDivinerParams = MemoryAddressChainDivinerParams,\n> extends AddressChainDiviner<TParams> {\n static override configSchemas = [AddressChainDivinerConfigSchema]\n\n get queryAddress() {\n return assertEx(this.config.address, 'Missing address')\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const result: Payload[] = []\n assertEx(!payloads?.length, 'MemoryAddressChainDiviner.divine does not allow payloads to be sent')\n try {\n const archivistIn = await this.getArchivist()\n const archivist = assertEx(archivistIn, 'Unable to resolve archivist')\n let currentHash: string | null = assertEx(this.config.startHash, 'Missing startHash')\n while (currentHash && result.length < (this.config.maxResults ?? 1000)) {\n const bwPayload: BoundWitness | undefined = await this.archivistFindHash([archivist], currentHash)\n const bwWrapper: BoundWitnessWrapper | undefined = BoundWitnessWrapper.tryParse(bwPayload)\n if (bwWrapper) {\n result.push(bwWrapper.payload())\n currentHash = bwWrapper.prev(this.queryAddress)\n }\n }\n } catch (ex) {\n console.log(ex)\n }\n return result\n }\n\n private async archivistFindHash(archivists: ArchivistInstance[], hash: string): Promise<BoundWitness | undefined> {\n let index = 0\n if (archivists[index]) {\n const result = (await archivists[index].get([hash])).pop() as BoundWitness\n if (result) {\n return result\n }\n index++\n }\n }\n}\n"],"mappings":";;;;AAAA,SAASA,gBAAgB;AAGzB,SAASC,2BAA2B;AACpC,SAASC,2BAA2B;AACpC,SAAoCC,uCAAuC;AASpE,IAAMC,4BAAN,cAEGC,oBAAAA;EAhBV,OAgBUA;;;EACR,OAAgBC,gBAAgB;IAACC;;EAEjC,IAAIC,eAAe;AACjB,WAAOC,SAAS,KAAKC,OAAOC,SAAS,iBAAA;EACvC;EAEA,MAAyBC,cAAcC,UAA0C;AAC/E,UAAMC,SAAoB,CAAA;AAC1BL,aAAS,CAACI,UAAUE,QAAQ,qEAAA;AAC5B,QAAI;AACF,YAAMC,cAAc,MAAM,KAAKC,aAAY;AAC3C,YAAMC,YAAYT,SAASO,aAAa,6BAAA;AACxC,UAAIG,cAA6BV,SAAS,KAAKC,OAAOU,WAAW,mBAAA;AACjE,aAAOD,eAAeL,OAAOC,UAAU,KAAKL,OAAOW,cAAc,MAAO;AACtE,cAAMC,YAAsC,MAAM,KAAKC,kBAAkB;UAACL;WAAYC,WAAAA;AACtF,cAAMK,YAA6CC,oBAAoBC,SAASJ,SAAAA;AAChF,YAAIE,WAAW;AACbV,iBAAOa,KAAKH,UAAUI,QAAO,CAAA;AAC7BT,wBAAcK,UAAUK,KAAK,KAAKrB,YAAY;QAChD;MACF;IACF,SAASsB,IAAI;AACXC,cAAQC,IAAIF,EAAAA;IACd;AACA,WAAOhB;EACT;EAEA,MAAcS,kBAAkBU,YAAiCC,MAAiD;AAChH,QAAIC,QAAQ;AACZ,QAAIF,WAAWE,KAAAA,GAAQ;AACrB,YAAMrB,UAAU,MAAMmB,WAAWE,KAAAA,EAAOC,IAAI;QAACF;OAAK,GAAGG,IAAG;AACxD,UAAIvB,QAAQ;AACV,eAAOA;MACT;AACAqB;IACF;EACF;AACF;","names":["assertEx","BoundWitnessWrapper","AddressChainDiviner","AddressChainDivinerConfigSchema","MemoryAddressChainDiviner","AddressChainDiviner","configSchemas","AddressChainDivinerConfigSchema","queryAddress","assertEx","config","address","divineHandler","payloads","result","length","archivistIn","getArchivist","archivist","currentHash","startHash","maxResults","bwPayload","archivistFindHash","bwWrapper","BoundWitnessWrapper","tryParse","push","payload","prev","ex","console","log","archivists","hash","index","get","pop"]}
@@ -3,6 +3,8 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
8
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
16
18
  return to;
17
19
  };
18
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var __publicField = (obj, key, value) => {
22
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
23
+ return value;
24
+ };
19
25
 
20
26
  // src/index.ts
21
27
  var src_exports = {};
@@ -29,8 +35,7 @@ var import_assert = require("@xylabs/assert");
29
35
  var import_boundwitness_wrapper = require("@xyo-network/boundwitness-wrapper");
30
36
  var import_diviner_address_chain_abstract = require("@xyo-network/diviner-address-chain-abstract");
31
37
  var import_diviner_address_chain_model = require("@xyo-network/diviner-address-chain-model");
32
- var MemoryAddressChainDiviner = class extends import_diviner_address_chain_abstract.AddressChainDiviner {
33
- static configSchemas = [import_diviner_address_chain_model.AddressChainDivinerConfigSchema];
38
+ var _MemoryAddressChainDiviner = class _MemoryAddressChainDiviner extends import_diviner_address_chain_abstract.AddressChainDiviner {
34
39
  get queryAddress() {
35
40
  return (0, import_assert.assertEx)(this.config.address, "Missing address");
36
41
  }
@@ -42,7 +47,9 @@ var MemoryAddressChainDiviner = class extends import_diviner_address_chain_abstr
42
47
  const archivist = (0, import_assert.assertEx)(archivistIn, "Unable to resolve archivist");
43
48
  let currentHash = (0, import_assert.assertEx)(this.config.startHash, "Missing startHash");
44
49
  while (currentHash && result.length < (this.config.maxResults ?? 1e3)) {
45
- const bwPayload = await this.archivistFindHash([archivist], currentHash);
50
+ const bwPayload = await this.archivistFindHash([
51
+ archivist
52
+ ], currentHash);
46
53
  const bwWrapper = import_boundwitness_wrapper.BoundWitnessWrapper.tryParse(bwPayload);
47
54
  if (bwWrapper) {
48
55
  result.push(bwWrapper.payload());
@@ -57,7 +64,9 @@ var MemoryAddressChainDiviner = class extends import_diviner_address_chain_abstr
57
64
  async archivistFindHash(archivists, hash) {
58
65
  let index = 0;
59
66
  if (archivists[index]) {
60
- const result = (await archivists[index].get([hash])).pop();
67
+ const result = (await archivists[index].get([
68
+ hash
69
+ ])).pop();
61
70
  if (result) {
62
71
  return result;
63
72
  }
@@ -65,6 +74,11 @@ var MemoryAddressChainDiviner = class extends import_diviner_address_chain_abstr
65
74
  }
66
75
  }
67
76
  };
77
+ __name(_MemoryAddressChainDiviner, "MemoryAddressChainDiviner");
78
+ __publicField(_MemoryAddressChainDiviner, "configSchemas", [
79
+ import_diviner_address_chain_model.AddressChainDivinerConfigSchema
80
+ ]);
81
+ var MemoryAddressChainDiviner = _MemoryAddressChainDiviner;
68
82
  // Annotate the CommonJS export names for ESM import in node:
69
83
  0 && (module.exports = {
70
84
  MemoryAddressChainDiviner
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/MemoryDiviner.ts"],"sourcesContent":["export * from './MemoryDiviner'\n","import { assertEx } from '@xylabs/assert'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'\nimport { AddressChainDiviner } from '@xyo-network/diviner-address-chain-abstract'\nimport { AddressChainDivinerConfig, AddressChainDivinerConfigSchema } from '@xyo-network/diviner-address-chain-model'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n// This diviner returns the most recent boundwitness signed by the address that can be found\n// if multiple broken chains are found, all the heads are returned\nexport type MemoryAddressChainDivinerParams = DivinerParams<AnyConfigSchema<AddressChainDivinerConfig>>\n\nexport class MemoryAddressChainDiviner<\n TParams extends MemoryAddressChainDivinerParams = MemoryAddressChainDivinerParams,\n> extends AddressChainDiviner<TParams> {\n static override configSchemas = [AddressChainDivinerConfigSchema]\n\n get queryAddress() {\n return assertEx(this.config.address, 'Missing address')\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const result: Payload[] = []\n assertEx(!payloads?.length, 'MemoryAddressChainDiviner.divine does not allow payloads to be sent')\n try {\n const archivistIn = await this.getArchivist()\n const archivist = assertEx(archivistIn, 'Unable to resolve archivist')\n let currentHash: string | null = assertEx(this.config.startHash, 'Missing startHash')\n while (currentHash && result.length < (this.config.maxResults ?? 1000)) {\n const bwPayload: BoundWitness | undefined = await this.archivistFindHash([archivist], currentHash)\n const bwWrapper: BoundWitnessWrapper | undefined = BoundWitnessWrapper.tryParse(bwPayload)\n if (bwWrapper) {\n result.push(bwWrapper.payload())\n currentHash = bwWrapper.prev(this.queryAddress)\n }\n }\n } catch (ex) {\n console.log(ex)\n }\n return result\n }\n\n private async archivistFindHash(archivists: ArchivistInstance[], hash: string): Promise<BoundWitness | undefined> {\n let index = 0\n if (archivists[index]) {\n const result = (await archivists[index].get([hash])).pop() as BoundWitness\n if (result) {\n return result\n }\n index++\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAyB;AAGzB,kCAAoC;AACpC,4CAAoC;AACpC,yCAA2E;AASpE,IAAM,4BAAN,cAEG,0DAA6B;AAAA,EACrC,OAAgB,gBAAgB,CAAC,kEAA+B;AAAA,EAEhE,IAAI,eAAe;AACjB,eAAO,wBAAS,KAAK,OAAO,SAAS,iBAAiB;AAAA,EACxD;AAAA,EAEA,MAAyB,cAAc,UAA0C;AAC/E,UAAM,SAAoB,CAAC;AAC3B,gCAAS,EAAC,qCAAU,SAAQ,qEAAqE;AACjG,QAAI;AACF,YAAM,cAAc,MAAM,KAAK,aAAa;AAC5C,YAAM,gBAAY,wBAAS,aAAa,6BAA6B;AACrE,UAAI,kBAA6B,wBAAS,KAAK,OAAO,WAAW,mBAAmB;AACpF,aAAO,eAAe,OAAO,UAAU,KAAK,OAAO,cAAc,MAAO;AACtE,cAAM,YAAsC,MAAM,KAAK,kBAAkB,CAAC,SAAS,GAAG,WAAW;AACjG,cAAM,YAA6C,gDAAoB,SAAS,SAAS;AACzF,YAAI,WAAW;AACb,iBAAO,KAAK,UAAU,QAAQ,CAAC;AAC/B,wBAAc,UAAU,KAAK,KAAK,YAAY;AAAA,QAChD;AAAA,MACF;AAAA,IACF,SAAS,IAAI;AACX,cAAQ,IAAI,EAAE;AAAA,IAChB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,kBAAkB,YAAiC,MAAiD;AAChH,QAAI,QAAQ;AACZ,QAAI,WAAW,KAAK,GAAG;AACrB,YAAM,UAAU,MAAM,WAAW,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI;AACzD,UAAI,QAAQ;AACV,eAAO;AAAA,MACT;AACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts","../../src/MemoryDiviner.ts"],"sourcesContent":["export * from './MemoryDiviner'\n","import { assertEx } from '@xylabs/assert'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'\nimport { AddressChainDiviner } from '@xyo-network/diviner-address-chain-abstract'\nimport { AddressChainDivinerConfig, AddressChainDivinerConfigSchema } from '@xyo-network/diviner-address-chain-model'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n// This diviner returns the most recent boundwitness signed by the address that can be found\n// if multiple broken chains are found, all the heads are returned\nexport type MemoryAddressChainDivinerParams = DivinerParams<AnyConfigSchema<AddressChainDivinerConfig>>\n\nexport class MemoryAddressChainDiviner<\n TParams extends MemoryAddressChainDivinerParams = MemoryAddressChainDivinerParams,\n> extends AddressChainDiviner<TParams> {\n static override configSchemas = [AddressChainDivinerConfigSchema]\n\n get queryAddress() {\n return assertEx(this.config.address, 'Missing address')\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const result: Payload[] = []\n assertEx(!payloads?.length, 'MemoryAddressChainDiviner.divine does not allow payloads to be sent')\n try {\n const archivistIn = await this.getArchivist()\n const archivist = assertEx(archivistIn, 'Unable to resolve archivist')\n let currentHash: string | null = assertEx(this.config.startHash, 'Missing startHash')\n while (currentHash && result.length < (this.config.maxResults ?? 1000)) {\n const bwPayload: BoundWitness | undefined = await this.archivistFindHash([archivist], currentHash)\n const bwWrapper: BoundWitnessWrapper | undefined = BoundWitnessWrapper.tryParse(bwPayload)\n if (bwWrapper) {\n result.push(bwWrapper.payload())\n currentHash = bwWrapper.prev(this.queryAddress)\n }\n }\n } catch (ex) {\n console.log(ex)\n }\n return result\n }\n\n private async archivistFindHash(archivists: ArchivistInstance[], hash: string): Promise<BoundWitness | undefined> {\n let index = 0\n if (archivists[index]) {\n const result = (await archivists[index].get([hash])).pop() as BoundWitness\n if (result) {\n return result\n }\n index++\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;ACAA,oBAAyB;AAGzB,kCAAoC;AACpC,4CAAoC;AACpC,yCAA2E;AASpE,IAAMA,6BAAN,MAAMA,mCAEHC,0DAAAA;EAGR,IAAIC,eAAe;AACjB,eAAOC,wBAAS,KAAKC,OAAOC,SAAS,iBAAA;EACvC;EAEA,MAAyBC,cAAcC,UAA0C;AAC/E,UAAMC,SAAoB,CAAA;AAC1BL,gCAAS,EAACI,qCAAUE,SAAQ,qEAAA;AAC5B,QAAI;AACF,YAAMC,cAAc,MAAM,KAAKC,aAAY;AAC3C,YAAMC,gBAAYT,wBAASO,aAAa,6BAAA;AACxC,UAAIG,kBAA6BV,wBAAS,KAAKC,OAAOU,WAAW,mBAAA;AACjE,aAAOD,eAAeL,OAAOC,UAAU,KAAKL,OAAOW,cAAc,MAAO;AACtE,cAAMC,YAAsC,MAAM,KAAKC,kBAAkB;UAACL;WAAYC,WAAAA;AACtF,cAAMK,YAA6CC,gDAAoBC,SAASJ,SAAAA;AAChF,YAAIE,WAAW;AACbV,iBAAOa,KAAKH,UAAUI,QAAO,CAAA;AAC7BT,wBAAcK,UAAUK,KAAK,KAAKrB,YAAY;QAChD;MACF;IACF,SAASsB,IAAI;AACXC,cAAQC,IAAIF,EAAAA;IACd;AACA,WAAOhB;EACT;EAEA,MAAcS,kBAAkBU,YAAiCC,MAAiD;AAChH,QAAIC,QAAQ;AACZ,QAAIF,WAAWE,KAAAA,GAAQ;AACrB,YAAMrB,UAAU,MAAMmB,WAAWE,KAAAA,EAAOC,IAAI;QAACF;OAAK,GAAGG,IAAG;AACxD,UAAIvB,QAAQ;AACV,eAAOA;MACT;AACAqB;IACF;EACF;AACF;AAtCU5B;AACR,cAHWD,4BAGKgC,iBAAgB;EAACC;;AAH5B,IAAMjC,4BAAN;","names":["MemoryAddressChainDiviner","AddressChainDiviner","queryAddress","assertEx","config","address","divineHandler","payloads","result","length","archivistIn","getArchivist","archivist","currentHash","startHash","maxResults","bwPayload","archivistFindHash","bwWrapper","BoundWitnessWrapper","tryParse","push","payload","prev","ex","console","log","archivists","hash","index","get","pop","configSchemas","AddressChainDivinerConfigSchema"]}
@@ -1,10 +1,17 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ var __publicField = (obj, key, value) => {
5
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ return value;
7
+ };
8
+
1
9
  // src/MemoryDiviner.ts
2
10
  import { assertEx } from "@xylabs/assert";
3
11
  import { BoundWitnessWrapper } from "@xyo-network/boundwitness-wrapper";
4
12
  import { AddressChainDiviner } from "@xyo-network/diviner-address-chain-abstract";
5
13
  import { AddressChainDivinerConfigSchema } from "@xyo-network/diviner-address-chain-model";
6
- var MemoryAddressChainDiviner = class extends AddressChainDiviner {
7
- static configSchemas = [AddressChainDivinerConfigSchema];
14
+ var _MemoryAddressChainDiviner = class _MemoryAddressChainDiviner extends AddressChainDiviner {
8
15
  get queryAddress() {
9
16
  return assertEx(this.config.address, "Missing address");
10
17
  }
@@ -16,7 +23,9 @@ var MemoryAddressChainDiviner = class extends AddressChainDiviner {
16
23
  const archivist = assertEx(archivistIn, "Unable to resolve archivist");
17
24
  let currentHash = assertEx(this.config.startHash, "Missing startHash");
18
25
  while (currentHash && result.length < (this.config.maxResults ?? 1e3)) {
19
- const bwPayload = await this.archivistFindHash([archivist], currentHash);
26
+ const bwPayload = await this.archivistFindHash([
27
+ archivist
28
+ ], currentHash);
20
29
  const bwWrapper = BoundWitnessWrapper.tryParse(bwPayload);
21
30
  if (bwWrapper) {
22
31
  result.push(bwWrapper.payload());
@@ -31,7 +40,9 @@ var MemoryAddressChainDiviner = class extends AddressChainDiviner {
31
40
  async archivistFindHash(archivists, hash) {
32
41
  let index = 0;
33
42
  if (archivists[index]) {
34
- const result = (await archivists[index].get([hash])).pop();
43
+ const result = (await archivists[index].get([
44
+ hash
45
+ ])).pop();
35
46
  if (result) {
36
47
  return result;
37
48
  }
@@ -39,6 +50,11 @@ var MemoryAddressChainDiviner = class extends AddressChainDiviner {
39
50
  }
40
51
  }
41
52
  };
53
+ __name(_MemoryAddressChainDiviner, "MemoryAddressChainDiviner");
54
+ __publicField(_MemoryAddressChainDiviner, "configSchemas", [
55
+ AddressChainDivinerConfigSchema
56
+ ]);
57
+ var MemoryAddressChainDiviner = _MemoryAddressChainDiviner;
42
58
  export {
43
59
  MemoryAddressChainDiviner
44
60
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/MemoryDiviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'\nimport { AddressChainDiviner } from '@xyo-network/diviner-address-chain-abstract'\nimport { AddressChainDivinerConfig, AddressChainDivinerConfigSchema } from '@xyo-network/diviner-address-chain-model'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n// This diviner returns the most recent boundwitness signed by the address that can be found\n// if multiple broken chains are found, all the heads are returned\nexport type MemoryAddressChainDivinerParams = DivinerParams<AnyConfigSchema<AddressChainDivinerConfig>>\n\nexport class MemoryAddressChainDiviner<\n TParams extends MemoryAddressChainDivinerParams = MemoryAddressChainDivinerParams,\n> extends AddressChainDiviner<TParams> {\n static override configSchemas = [AddressChainDivinerConfigSchema]\n\n get queryAddress() {\n return assertEx(this.config.address, 'Missing address')\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const result: Payload[] = []\n assertEx(!payloads?.length, 'MemoryAddressChainDiviner.divine does not allow payloads to be sent')\n try {\n const archivistIn = await this.getArchivist()\n const archivist = assertEx(archivistIn, 'Unable to resolve archivist')\n let currentHash: string | null = assertEx(this.config.startHash, 'Missing startHash')\n while (currentHash && result.length < (this.config.maxResults ?? 1000)) {\n const bwPayload: BoundWitness | undefined = await this.archivistFindHash([archivist], currentHash)\n const bwWrapper: BoundWitnessWrapper | undefined = BoundWitnessWrapper.tryParse(bwPayload)\n if (bwWrapper) {\n result.push(bwWrapper.payload())\n currentHash = bwWrapper.prev(this.queryAddress)\n }\n }\n } catch (ex) {\n console.log(ex)\n }\n return result\n }\n\n private async archivistFindHash(archivists: ArchivistInstance[], hash: string): Promise<BoundWitness | undefined> {\n let index = 0\n if (archivists[index]) {\n const result = (await archivists[index].get([hash])).pop() as BoundWitness\n if (result) {\n return result\n }\n index++\n }\n }\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAGzB,SAAS,2BAA2B;AACpC,SAAS,2BAA2B;AACpC,SAAoC,uCAAuC;AASpE,IAAM,4BAAN,cAEG,oBAA6B;AAAA,EACrC,OAAgB,gBAAgB,CAAC,+BAA+B;AAAA,EAEhE,IAAI,eAAe;AACjB,WAAO,SAAS,KAAK,OAAO,SAAS,iBAAiB;AAAA,EACxD;AAAA,EAEA,MAAyB,cAAc,UAA0C;AAC/E,UAAM,SAAoB,CAAC;AAC3B,aAAS,EAAC,qCAAU,SAAQ,qEAAqE;AACjG,QAAI;AACF,YAAM,cAAc,MAAM,KAAK,aAAa;AAC5C,YAAM,YAAY,SAAS,aAAa,6BAA6B;AACrE,UAAI,cAA6B,SAAS,KAAK,OAAO,WAAW,mBAAmB;AACpF,aAAO,eAAe,OAAO,UAAU,KAAK,OAAO,cAAc,MAAO;AACtE,cAAM,YAAsC,MAAM,KAAK,kBAAkB,CAAC,SAAS,GAAG,WAAW;AACjG,cAAM,YAA6C,oBAAoB,SAAS,SAAS;AACzF,YAAI,WAAW;AACb,iBAAO,KAAK,UAAU,QAAQ,CAAC;AAC/B,wBAAc,UAAU,KAAK,KAAK,YAAY;AAAA,QAChD;AAAA,MACF;AAAA,IACF,SAAS,IAAI;AACX,cAAQ,IAAI,EAAE;AAAA,IAChB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,kBAAkB,YAAiC,MAAiD;AAChH,QAAI,QAAQ;AACZ,QAAI,WAAW,KAAK,GAAG;AACrB,YAAM,UAAU,MAAM,WAAW,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI;AACzD,UAAI,QAAQ;AACV,eAAO;AAAA,MACT;AACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/MemoryDiviner.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { BoundWitness } from '@xyo-network/boundwitness-model'\nimport { BoundWitnessWrapper } from '@xyo-network/boundwitness-wrapper'\nimport { AddressChainDiviner } from '@xyo-network/diviner-address-chain-abstract'\nimport { AddressChainDivinerConfig, AddressChainDivinerConfigSchema } from '@xyo-network/diviner-address-chain-model'\nimport { DivinerParams } from '@xyo-network/diviner-model'\nimport { AnyConfigSchema } from '@xyo-network/module-model'\nimport { Payload } from '@xyo-network/payload-model'\n\n// This diviner returns the most recent boundwitness signed by the address that can be found\n// if multiple broken chains are found, all the heads are returned\nexport type MemoryAddressChainDivinerParams = DivinerParams<AnyConfigSchema<AddressChainDivinerConfig>>\n\nexport class MemoryAddressChainDiviner<\n TParams extends MemoryAddressChainDivinerParams = MemoryAddressChainDivinerParams,\n> extends AddressChainDiviner<TParams> {\n static override configSchemas = [AddressChainDivinerConfigSchema]\n\n get queryAddress() {\n return assertEx(this.config.address, 'Missing address')\n }\n\n protected override async divineHandler(payloads?: Payload[]): Promise<Payload[]> {\n const result: Payload[] = []\n assertEx(!payloads?.length, 'MemoryAddressChainDiviner.divine does not allow payloads to be sent')\n try {\n const archivistIn = await this.getArchivist()\n const archivist = assertEx(archivistIn, 'Unable to resolve archivist')\n let currentHash: string | null = assertEx(this.config.startHash, 'Missing startHash')\n while (currentHash && result.length < (this.config.maxResults ?? 1000)) {\n const bwPayload: BoundWitness | undefined = await this.archivistFindHash([archivist], currentHash)\n const bwWrapper: BoundWitnessWrapper | undefined = BoundWitnessWrapper.tryParse(bwPayload)\n if (bwWrapper) {\n result.push(bwWrapper.payload())\n currentHash = bwWrapper.prev(this.queryAddress)\n }\n }\n } catch (ex) {\n console.log(ex)\n }\n return result\n }\n\n private async archivistFindHash(archivists: ArchivistInstance[], hash: string): Promise<BoundWitness | undefined> {\n let index = 0\n if (archivists[index]) {\n const result = (await archivists[index].get([hash])).pop() as BoundWitness\n if (result) {\n return result\n }\n index++\n }\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAASA,gBAAgB;AAGzB,SAASC,2BAA2B;AACpC,SAASC,2BAA2B;AACpC,SAAoCC,uCAAuC;AASpE,IAAMC,6BAAN,MAAMA,mCAEHC,oBAAAA;EAGR,IAAIC,eAAe;AACjB,WAAOC,SAAS,KAAKC,OAAOC,SAAS,iBAAA;EACvC;EAEA,MAAyBC,cAAcC,UAA0C;AAC/E,UAAMC,SAAoB,CAAA;AAC1BL,aAAS,EAACI,qCAAUE,SAAQ,qEAAA;AAC5B,QAAI;AACF,YAAMC,cAAc,MAAM,KAAKC,aAAY;AAC3C,YAAMC,YAAYT,SAASO,aAAa,6BAAA;AACxC,UAAIG,cAA6BV,SAAS,KAAKC,OAAOU,WAAW,mBAAA;AACjE,aAAOD,eAAeL,OAAOC,UAAU,KAAKL,OAAOW,cAAc,MAAO;AACtE,cAAMC,YAAsC,MAAM,KAAKC,kBAAkB;UAACL;WAAYC,WAAAA;AACtF,cAAMK,YAA6CC,oBAAoBC,SAASJ,SAAAA;AAChF,YAAIE,WAAW;AACbV,iBAAOa,KAAKH,UAAUI,QAAO,CAAA;AAC7BT,wBAAcK,UAAUK,KAAK,KAAKrB,YAAY;QAChD;MACF;IACF,SAASsB,IAAI;AACXC,cAAQC,IAAIF,EAAAA;IACd;AACA,WAAOhB;EACT;EAEA,MAAcS,kBAAkBU,YAAiCC,MAAiD;AAChH,QAAIC,QAAQ;AACZ,QAAIF,WAAWE,KAAAA,GAAQ;AACrB,YAAMrB,UAAU,MAAMmB,WAAWE,KAAAA,EAAOC,IAAI;QAACF;OAAK,GAAGG,IAAG;AACxD,UAAIvB,QAAQ;AACV,eAAOA;MACT;AACAqB;IACF;EACF;AACF;AAtCU5B;AACR,cAHWD,4BAGKgC,iBAAgB;EAACC;;AAH5B,IAAMjC,4BAAN;","names":["assertEx","BoundWitnessWrapper","AddressChainDiviner","AddressChainDivinerConfigSchema","MemoryAddressChainDiviner","AddressChainDiviner","queryAddress","assertEx","config","address","divineHandler","payloads","result","length","archivistIn","getArchivist","archivist","currentHash","startHash","maxResults","bwPayload","archivistFindHash","bwWrapper","BoundWitnessWrapper","tryParse","push","payload","prev","ex","console","log","archivists","hash","index","get","pop","configSchemas","AddressChainDivinerConfigSchema"]}
package/package.json CHANGED
@@ -11,24 +11,24 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@xylabs/assert": "^2.13.20",
14
- "@xyo-network/archivist-model": "~2.84.19",
15
- "@xyo-network/boundwitness-model": "~2.84.19",
16
- "@xyo-network/boundwitness-wrapper": "~2.84.19",
17
- "@xyo-network/diviner-address-chain-abstract": "~2.84.19",
18
- "@xyo-network/diviner-address-chain-model": "~2.84.19",
19
- "@xyo-network/diviner-model": "~2.84.19",
20
- "@xyo-network/module-model": "~2.84.19",
21
- "@xyo-network/payload-model": "~2.84.19"
14
+ "@xyo-network/archivist-model": "~2.85.1",
15
+ "@xyo-network/boundwitness-model": "~2.85.1",
16
+ "@xyo-network/boundwitness-wrapper": "~2.85.1",
17
+ "@xyo-network/diviner-address-chain-abstract": "~2.85.1",
18
+ "@xyo-network/diviner-address-chain-model": "~2.85.1",
19
+ "@xyo-network/diviner-model": "~2.85.1",
20
+ "@xyo-network/module-model": "~2.85.1",
21
+ "@xyo-network/payload-model": "~2.85.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@xylabs/ts-scripts-yarn3": "^3.2.25",
25
25
  "@xylabs/tsconfig": "^3.2.25",
26
- "@xyo-network/account": "~2.84.19",
27
- "@xyo-network/archivist": "~2.84.19",
28
- "@xyo-network/archivist-wrapper": "~2.84.19",
29
- "@xyo-network/node-memory": "~2.84.19",
30
- "@xyo-network/node-model": "~2.84.19",
31
- "@xyo-network/payload-wrapper": "~2.84.19",
26
+ "@xyo-network/account": "~2.85.1",
27
+ "@xyo-network/archivist": "~2.85.1",
28
+ "@xyo-network/archivist-wrapper": "~2.85.1",
29
+ "@xyo-network/node-memory": "~2.85.1",
30
+ "@xyo-network/node-model": "~2.85.1",
31
+ "@xyo-network/payload-wrapper": "~2.85.1",
32
32
  "typescript": "^5.3.3"
33
33
  },
34
34
  "description": "Primary SDK for using XYO Protocol 2.0",
@@ -70,6 +70,6 @@
70
70
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
71
71
  },
72
72
  "sideEffects": false,
73
- "version": "2.84.19",
73
+ "version": "2.85.1",
74
74
  "type": "module"
75
75
  }