@xyo-network/xl1-protocol-sdk 2.0.0 → 2.0.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.
@@ -1,7 +1,7 @@
1
1
  import type { Hash } from '@xylabs/sdk-js';
2
2
  import type { BoundWitness, Payload } from '@xyo-network/sdk-js';
3
3
  import { LRUCache } from 'lru-cache';
4
- import type { NamedDataLake } from '../../primitives/datalake/index.ts';
4
+ import type { NamedDataLake, PayloadLocation } from '../../primitives/datalake/index.ts';
5
5
  import { PayloadLocator } from '../../primitives/datalake/index.ts';
6
6
  import type { HydrateFunction } from '../../utils/index.ts';
7
7
  /** Valid recursion depths for BoundWitness hydration. */
@@ -38,16 +38,33 @@ export declare class BoundWitnessHydrator<TBw extends BoundWitness, THydrated> {
38
38
  */
39
39
  constructor(params: BoundWitnessHydratorParams<TBw, THydrated>);
40
40
  hydrate(input: Hash | TBw, maxDepth?: HydrationDepth, minDepth?: HydrationDepth): Promise<THydrated>;
41
+ /**
42
+ * Like hydrateWithProvenance, but queries every datalake for every hash and returns the full
43
+ * list of sources per hash. Bypasses the single-source LRU caches so that a prior first-found
44
+ * cache hit cannot suppress discovery of additional sources.
45
+ */
46
+ hydrateWithAllProvenance(input: Hash | TBw, maxDepth?: HydrationDepth, minDepth?: HydrationDepth): Promise<[THydrated, Map<Hash, PayloadLocation[]>]>;
41
47
  hydrateWithProvenance(input: Hash | TBw, maxDepth?: HydrationDepth, minDepth?: HydrationDepth): Promise<[THydrated, Map<Hash, string>]>;
42
48
  /** Returns an adapter compatible with HydratedCache. The context arg is ignored. */
43
49
  toHydrateFunction(): HydrateFunction<THydrated>;
44
50
  tryHydrate(input: Hash | TBw, maxDepth?: HydrationDepth): Promise<THydrated | undefined>;
51
+ tryHydrateWithAllProvenance(input: Hash | TBw, maxDepth?: HydrationDepth): Promise<[THydrated, Map<Hash, PayloadLocation[]>] | undefined>;
45
52
  tryHydrateWithProvenance(input: Hash | TBw, maxDepth?: HydrationDepth): Promise<[THydrated, Map<Hash, string>] | undefined>;
46
53
  protected appendDirectPayloads(bw: TBw, sources: Map<Hash, string>, minDepth: HydrationDepth, orderedHashes: Set<Hash>, orderedPayloads: Payload[]): Promise<void>;
54
+ protected appendDirectPayloadsAll(bw: TBw, sources: Map<Hash, PayloadLocation[]>, minDepth: HydrationDepth, orderedHashes: Set<Hash>, orderedPayloads: Payload[]): Promise<void>;
47
55
  protected appendNestedPayloads(sources: Map<Hash, string>, minDepth: HydrationDepth, orderedHashes: Set<Hash>, orderedPayloads: Payload[]): Promise<void>;
56
+ protected appendNestedPayloadsAll(sources: Map<Hash, PayloadLocation[]>, minDepth: HydrationDepth, orderedHashes: Set<Hash>, orderedPayloads: Payload[]): Promise<void>;
48
57
  protected fetchByHash(hash: Hash, sources: Map<Hash, string>): Promise<Payload | undefined>;
49
58
  protected fetchByHashes(hashes: Hash[], sources: Map<Hash, string>): Promise<Map<Hash, Payload>>;
59
+ /**
60
+ * Exhaustive variant: bypasses both LRU caches and queries every datalake. The picked payload
61
+ * (locations[0].payload) is the first in registration order; the DataLakeViewer's content-addressed
62
+ * fetch guarantees all entries for a given hash are equivalent.
63
+ */
64
+ protected fetchByHashesAll(hashes: Hash[], sources: Map<Hash, PayloadLocation[]>): Promise<Map<Hash, Payload>>;
50
65
  protected hydrateInternal(input: Hash | TBw, maxDepth: HydrationDepth, minDepth: HydrationDepth): Promise<[THydrated, Map<Hash, string>]>;
66
+ protected hydrateInternalAll(input: Hash | TBw, maxDepth: HydrationDepth, minDepth: HydrationDepth): Promise<[THydrated, Map<Hash, PayloadLocation[]>]>;
51
67
  protected resolveBoundWitness(input: Hash | TBw, sources: Map<Hash, string>): Promise<TBw>;
68
+ protected resolveBoundWitnessAll(input: Hash | TBw, sources: Map<Hash, PayloadLocation[]>): Promise<TBw>;
52
69
  }
53
70
  //# sourceMappingURL=BoundWitnessHydrator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BoundWitnessHydrator.d.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AAC,IAAI,EAAE,OAAO,CAAC,CAAC;cAYd,eAAe,CAC7B,KAAK,EAAE,IAAI,GAAG,GAAG,EACjB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;cAqB1B,kBAAkB,CAChC,KAAK,EAAE,IAAI,GAAG,GAAG,EACjB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC;cAqBrC,mBAAmB,CAAC,KAAK,EAAE,IAAI,GAAG,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;cAYhF,sBAAsB,CAAC,KAAK,EAAE,IAAI,GAAG,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;CAY/G"}
@@ -339,6 +339,14 @@ var BoundWitnessHydrator = class {
339
339
  const [hydrated] = await this.hydrateInternal(input, maxDepth, minDepth);
340
340
  return hydrated;
341
341
  }
342
+ /**
343
+ * Like hydrateWithProvenance, but queries every datalake for every hash and returns the full
344
+ * list of sources per hash. Bypasses the single-source LRU caches so that a prior first-found
345
+ * cache hit cannot suppress discovery of additional sources.
346
+ */
347
+ async hydrateWithAllProvenance(input, maxDepth = 1, minDepth = maxDepth) {
348
+ return await this.hydrateInternalAll(input, maxDepth, minDepth);
349
+ }
342
350
  async hydrateWithProvenance(input, maxDepth = 1, minDepth = maxDepth) {
343
351
  return await this.hydrateInternal(input, maxDepth, minDepth);
344
352
  }
@@ -353,6 +361,13 @@ var BoundWitnessHydrator = class {
353
361
  return void 0;
354
362
  }
355
363
  }
364
+ async tryHydrateWithAllProvenance(input, maxDepth = 1) {
365
+ try {
366
+ return await this.hydrateWithAllProvenance(input, maxDepth);
367
+ } catch {
368
+ return void 0;
369
+ }
370
+ }
356
371
  async tryHydrateWithProvenance(input, maxDepth = 1) {
357
372
  try {
358
373
  return await this.hydrateWithProvenance(input, maxDepth);
@@ -373,6 +388,19 @@ var BoundWitnessHydrator = class {
373
388
  orderedPayloads.push(p);
374
389
  }
375
390
  }
391
+ async appendDirectPayloadsAll(bw, sources, minDepth, orderedHashes, orderedPayloads) {
392
+ const fetched = await this.fetchByHashesAll(bw.payload_hashes, sources);
393
+ if (minDepth >= 1) {
394
+ const missing = bw.payload_hashes.filter((h) => !fetched.has(h));
395
+ assertEx4(missing.length === 0, () => `Unable to find all payloads for BoundWitness: missing ${missing.join(", ")}`);
396
+ }
397
+ for (const h of bw.payload_hashes) {
398
+ const p = fetched.get(h);
399
+ if (isUndefined3(p) || orderedHashes.has(h)) continue;
400
+ orderedHashes.add(h);
401
+ orderedPayloads.push(p);
402
+ }
403
+ }
376
404
  async appendNestedPayloads(sources, minDepth, orderedHashes, orderedPayloads) {
377
405
  const nestedHashes = [];
378
406
  for (const p of orderedPayloads) {
@@ -393,6 +421,26 @@ var BoundWitnessHydrator = class {
393
421
  orderedPayloads.push(p);
394
422
  }
395
423
  }
424
+ async appendNestedPayloadsAll(sources, minDepth, orderedHashes, orderedPayloads) {
425
+ const nestedHashes = [];
426
+ for (const p of orderedPayloads) {
427
+ if (!this.isNestedBoundWitness(p)) continue;
428
+ for (const h of p.payload_hashes) {
429
+ if (!orderedHashes.has(h)) nestedHashes.push(h);
430
+ }
431
+ }
432
+ const fetched = await this.fetchByHashesAll(nestedHashes, sources);
433
+ if (minDepth >= 2) {
434
+ const missing = nestedHashes.filter((h) => !fetched.has(h));
435
+ assertEx4(missing.length === 0, () => `Unable to find all nested payloads for BoundWitness: missing ${missing.join(", ")}`);
436
+ }
437
+ for (const h of nestedHashes) {
438
+ const p = fetched.get(h);
439
+ if (isUndefined3(p) || orderedHashes.has(h)) continue;
440
+ orderedHashes.add(h);
441
+ orderedPayloads.push(p);
442
+ }
443
+ }
396
444
  async fetchByHash(hash, sources) {
397
445
  const cached = this.payloadCache.get(hash);
398
446
  if (isDefined(cached)) {
@@ -430,6 +478,22 @@ var BoundWitnessHydrator = class {
430
478
  }
431
479
  return result;
432
480
  }
481
+ /**
482
+ * Exhaustive variant: bypasses both LRU caches and queries every datalake. The picked payload
483
+ * (locations[0].payload) is the first in registration order; the DataLakeViewer's content-addressed
484
+ * fetch guarantees all entries for a given hash are equivalent.
485
+ */
486
+ async fetchByHashesAll(hashes, sources) {
487
+ const result = /* @__PURE__ */ new Map();
488
+ if (hashes.length === 0) return result;
489
+ const located = await this.locator.findAll(hashes);
490
+ for (const [h, locations] of located) {
491
+ if (locations.length === 0) continue;
492
+ result.set(h, locations[0].payload);
493
+ sources.set(h, locations);
494
+ }
495
+ return result;
496
+ }
433
497
  async hydrateInternal(input, maxDepth, minDepth) {
434
498
  assertEx4(maxDepth >= 0 && maxDepth <= 2, () => `maxDepth must be 0, 1, or 2 (got ${maxDepth})`);
435
499
  assertEx4(minDepth >= 0 && minDepth <= 2, () => `minDepth must be 0, 1, or 2 (got ${minDepth})`);
@@ -447,6 +511,23 @@ var BoundWitnessHydrator = class {
447
511
  }
448
512
  return [this.asHydrated([bw, orderedPayloads], true), sources];
449
513
  }
514
+ async hydrateInternalAll(input, maxDepth, minDepth) {
515
+ assertEx4(maxDepth >= 0 && maxDepth <= 2, () => `maxDepth must be 0, 1, or 2 (got ${maxDepth})`);
516
+ assertEx4(minDepth >= 0 && minDepth <= 2, () => `minDepth must be 0, 1, or 2 (got ${minDepth})`);
517
+ assertEx4(maxDepth >= minDepth, () => `maxDepth (${maxDepth}) must be >= minDepth (${minDepth})`);
518
+ const sources = /* @__PURE__ */ new Map();
519
+ const bw = await this.resolveBoundWitnessAll(input, sources);
520
+ if (maxDepth === 0) {
521
+ return [this.asHydrated([bw, []], true), sources];
522
+ }
523
+ const orderedHashes = /* @__PURE__ */ new Set();
524
+ const orderedPayloads = [];
525
+ await this.appendDirectPayloadsAll(bw, sources, minDepth, orderedHashes, orderedPayloads);
526
+ if (maxDepth === 2) {
527
+ await this.appendNestedPayloadsAll(sources, minDepth, orderedHashes, orderedPayloads);
528
+ }
529
+ return [this.asHydrated([bw, orderedPayloads], true), sources];
530
+ }
450
531
  async resolveBoundWitness(input, sources) {
451
532
  if (typeof input === "string") {
452
533
  const fetched = assertEx4(
@@ -458,6 +539,18 @@ var BoundWitnessHydrator = class {
458
539
  const withMeta = "_hash" in input ? input : await PayloadBuilder2.addStorageMeta(input);
459
540
  return this.asBoundWitness(withMeta, true);
460
541
  }
542
+ async resolveBoundWitnessAll(input, sources) {
543
+ if (typeof input === "string") {
544
+ const fetched = await this.fetchByHashesAll([input], sources);
545
+ const payload = assertEx4(
546
+ fetched.get(input),
547
+ () => `BoundWitness ${input} not found in any datalake`
548
+ );
549
+ return this.asBoundWitness(payload, true);
550
+ }
551
+ const withMeta = "_hash" in input ? input : await PayloadBuilder2.addStorageMeta(input);
552
+ return this.asBoundWitness(withMeta, true);
553
+ }
461
554
  };
462
555
 
463
556
  // src/block/hydrate/createBlockHydrator.ts