@xyo-network/xns-record-payload-plugins 3.2.0-rc.7 → 3.2.0-rc.9

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.
Files changed (39) hide show
  1. package/dist/browser/Domain/Domain.d.ts +13 -21
  2. package/dist/browser/Domain/Domain.d.ts.map +1 -1
  3. package/dist/browser/Domain/DomainLease.d.ts +61 -3
  4. package/dist/browser/Domain/DomainLease.d.ts.map +1 -1
  5. package/dist/browser/DomainRegistration/DomainRegistration.d.ts +13 -13
  6. package/dist/browser/DomainRegistration/DomainRegistration.d.ts.map +1 -1
  7. package/dist/browser/DomainRegistration/DomainRegistrationLease.d.ts +79 -5
  8. package/dist/browser/DomainRegistration/DomainRegistrationLease.d.ts.map +1 -1
  9. package/dist/browser/diviner/lib/parseEstimatesFromArray.d.ts.map +1 -1
  10. package/dist/browser/index.mjs +29 -10
  11. package/dist/browser/index.mjs.map +1 -1
  12. package/dist/neutral/Domain/Domain.d.ts +13 -21
  13. package/dist/neutral/Domain/Domain.d.ts.map +1 -1
  14. package/dist/neutral/Domain/DomainLease.d.ts +61 -3
  15. package/dist/neutral/Domain/DomainLease.d.ts.map +1 -1
  16. package/dist/neutral/DomainRegistration/DomainRegistration.d.ts +13 -13
  17. package/dist/neutral/DomainRegistration/DomainRegistration.d.ts.map +1 -1
  18. package/dist/neutral/DomainRegistration/DomainRegistrationLease.d.ts +79 -5
  19. package/dist/neutral/DomainRegistration/DomainRegistrationLease.d.ts.map +1 -1
  20. package/dist/neutral/diviner/lib/parseEstimatesFromArray.d.ts.map +1 -1
  21. package/dist/neutral/index.mjs +29 -10
  22. package/dist/neutral/index.mjs.map +1 -1
  23. package/dist/node/Domain/Domain.d.ts +13 -21
  24. package/dist/node/Domain/Domain.d.ts.map +1 -1
  25. package/dist/node/Domain/DomainLease.d.ts +61 -3
  26. package/dist/node/Domain/DomainLease.d.ts.map +1 -1
  27. package/dist/node/DomainRegistration/DomainRegistration.d.ts +13 -13
  28. package/dist/node/DomainRegistration/DomainRegistration.d.ts.map +1 -1
  29. package/dist/node/DomainRegistration/DomainRegistrationLease.d.ts +79 -5
  30. package/dist/node/DomainRegistration/DomainRegistrationLease.d.ts.map +1 -1
  31. package/dist/node/diviner/lib/parseEstimatesFromArray.d.ts.map +1 -1
  32. package/dist/node/index.mjs +29 -10
  33. package/dist/node/index.mjs.map +1 -1
  34. package/package.json +16 -15
  35. package/src/Domain/Domain.ts +4 -4
  36. package/src/Domain/DomainLease.ts +7 -2
  37. package/src/DomainRegistration/DomainRegistration.ts +4 -4
  38. package/src/DomainRegistration/DomainRegistrationLease.ts +9 -2
  39. package/src/diviner/lib/parseEstimatesFromArray.ts +8 -6
@@ -1,14 +1,16 @@
1
+ import { findAs } from '@xylabs/array'
1
2
  import { exists } from '@xylabs/exists'
2
3
  import { type BoundWitness, isBoundWitness } from '@xyo-network/boundwitness-model'
3
4
  import {
4
- type HashLeaseEstimate, HashLeaseEstimateSchema, isHashLeaseEstimate,
5
+ asHashLeaseEstimate,
6
+ type HashLeaseEstimate, HashLeaseEstimateSchema,
5
7
  } from '@xyo-network/diviner-hash-lease'
6
8
  import { PayloadBuilder } from '@xyo-network/payload-builder'
7
9
  import type { Payload, WithSources } from '@xyo-network/payload-model'
8
10
 
9
11
  import {
12
+ asDomainRegistrationLeaseWithSources,
10
13
  type DomainRegistrationLease, DomainRegistrationLeaseSchema,
11
- isDomainRegistrationLeaseWithSources,
12
14
  } from '../../DomainRegistration/index.ts'
13
15
 
14
16
  export type Estimate = [
@@ -36,14 +38,14 @@ export const parseEstimatesFromArray = async (payloads?: Payload[]): Promise<Est
36
38
  bw,
37
39
  HashLeaseEstimateSchema,
38
40
  hashMap,
39
- isHashLeaseEstimate,
41
+ asHashLeaseEstimate,
40
42
  )
41
43
  if (!hashLeaseEstimate) return
42
44
  const domainLease = getPayloadBySchemaFromBoundWitness<WithSources<DomainRegistrationLease>>(
43
45
  bw,
44
46
  DomainRegistrationLeaseSchema,
45
47
  hashMap,
46
- isDomainRegistrationLeaseWithSources,
48
+ asDomainRegistrationLeaseWithSources,
47
49
  )
48
50
  if (!domainLease) return
49
51
  return [bw, hashLeaseEstimate, domainLease]
@@ -72,10 +74,10 @@ const getPayloadBySchemaFromBoundWitness = <T extends Payload = Payload>(
72
74
  bw: BoundWitness,
73
75
  schema: string,
74
76
  hashMap: Awaited<ReturnType<typeof PayloadBuilder.toHashMap>>,
75
- identity: (payload: Payload) => payload is T,
77
+ identity: (payload: Payload) => T,
76
78
  ): T | undefined => {
77
79
  const schemaIndex = bw.payload_schemas.indexOf(schema)
78
80
  if (schemaIndex === -1) return
79
81
  const hash = bw.payload_hashes[schemaIndex]
80
- return [hashMap[hash]].filter(exists).find(identity)
82
+ return findAs([hashMap[hash]], identity)
81
83
  }