@xyo-network/xns-record-payload-plugins 7.0.2 → 7.0.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.
Files changed (95) hide show
  1. package/dist/neutral/index.d.ts +1 -8
  2. package/dist/neutral/index.d.ts.map +1 -1
  3. package/dist/neutral/index.mjs +2 -986
  4. package/dist/neutral/index.mjs.map +4 -4
  5. package/package.json +53 -46
  6. package/dist/neutral/Address/Payload.d.ts +0 -96
  7. package/dist/neutral/Address/Payload.d.ts.map +0 -1
  8. package/dist/neutral/Address/index.d.ts +0 -2
  9. package/dist/neutral/Address/index.d.ts.map +0 -1
  10. package/dist/neutral/Dns/Witness/Config.d.ts +0 -25
  11. package/dist/neutral/Dns/Witness/Config.d.ts.map +0 -1
  12. package/dist/neutral/Dns/Witness/Params.d.ts +0 -4
  13. package/dist/neutral/Dns/Witness/Params.d.ts.map +0 -1
  14. package/dist/neutral/Dns/Witness/Payload/Payload.d.ts +0 -4
  15. package/dist/neutral/Dns/Witness/Payload/Payload.d.ts.map +0 -1
  16. package/dist/neutral/Dns/Witness/Payload/Request.d.ts +0 -147
  17. package/dist/neutral/Dns/Witness/Payload/Request.d.ts.map +0 -1
  18. package/dist/neutral/Dns/Witness/Payload/Response.d.ts +0 -259
  19. package/dist/neutral/Dns/Witness/Payload/Response.d.ts.map +0 -1
  20. package/dist/neutral/Dns/Witness/Payload/index.d.ts +0 -4
  21. package/dist/neutral/Dns/Witness/Payload/index.d.ts.map +0 -1
  22. package/dist/neutral/Dns/Witness/Schema.d.ts +0 -5
  23. package/dist/neutral/Dns/Witness/Schema.d.ts.map +0 -1
  24. package/dist/neutral/Dns/Witness/index.d.ts +0 -5
  25. package/dist/neutral/Dns/Witness/index.d.ts.map +0 -1
  26. package/dist/neutral/Dns/index.d.ts +0 -3
  27. package/dist/neutral/Dns/index.d.ts.map +0 -1
  28. package/dist/neutral/Dns/types/Answer.d.ts +0 -10
  29. package/dist/neutral/Dns/types/Answer.d.ts.map +0 -1
  30. package/dist/neutral/Dns/types/Header.d.ts +0 -52
  31. package/dist/neutral/Dns/types/Header.d.ts.map +0 -1
  32. package/dist/neutral/Dns/types/OperationCodes.d.ts +0 -14
  33. package/dist/neutral/Dns/types/OperationCodes.d.ts.map +0 -1
  34. package/dist/neutral/Dns/types/Record.d.ts +0 -9
  35. package/dist/neutral/Dns/types/Record.d.ts.map +0 -1
  36. package/dist/neutral/Dns/types/Request.d.ts +0 -40
  37. package/dist/neutral/Dns/types/Request.d.ts.map +0 -1
  38. package/dist/neutral/Dns/types/ResourceRecord.d.ts +0 -105
  39. package/dist/neutral/Dns/types/ResourceRecord.d.ts.map +0 -1
  40. package/dist/neutral/Dns/types/Response.d.ts +0 -41
  41. package/dist/neutral/Dns/types/Response.d.ts.map +0 -1
  42. package/dist/neutral/Dns/types/ResponseCodes.d.ts +0 -22
  43. package/dist/neutral/Dns/types/ResponseCodes.d.ts.map +0 -1
  44. package/dist/neutral/Dns/types/index.d.ts +0 -9
  45. package/dist/neutral/Dns/types/index.d.ts.map +0 -1
  46. package/dist/neutral/Domain/Domain.d.ts +0 -72
  47. package/dist/neutral/Domain/Domain.d.ts.map +0 -1
  48. package/dist/neutral/Domain/DomainLease.d.ts +0 -81
  49. package/dist/neutral/Domain/DomainLease.d.ts.map +0 -1
  50. package/dist/neutral/Domain/index.d.ts +0 -3
  51. package/dist/neutral/Domain/index.d.ts.map +0 -1
  52. package/dist/neutral/DomainEstimate/DomainEstimate.d.ts +0 -9
  53. package/dist/neutral/DomainEstimate/DomainEstimate.d.ts.map +0 -1
  54. package/dist/neutral/DomainEstimate/index.d.ts +0 -2
  55. package/dist/neutral/DomainEstimate/index.d.ts.map +0 -1
  56. package/dist/neutral/DomainRegistration/DomainRegistration.d.ts +0 -134
  57. package/dist/neutral/DomainRegistration/DomainRegistration.d.ts.map +0 -1
  58. package/dist/neutral/DomainRegistration/DomainRegistrationLease.d.ts +0 -148
  59. package/dist/neutral/DomainRegistration/DomainRegistrationLease.d.ts.map +0 -1
  60. package/dist/neutral/DomainRegistration/index.d.ts +0 -3
  61. package/dist/neutral/DomainRegistration/index.d.ts.map +0 -1
  62. package/dist/neutral/Duration/Duration.d.ts +0 -7
  63. package/dist/neutral/Duration/Duration.d.ts.map +0 -1
  64. package/dist/neutral/Duration/index.d.ts +0 -3
  65. package/dist/neutral/Duration/index.d.ts.map +0 -1
  66. package/dist/neutral/Duration/validation/index.d.ts +0 -3
  67. package/dist/neutral/Duration/validation/index.d.ts.map +0 -1
  68. package/dist/neutral/Duration/validation/validateBoundWitness.d.ts +0 -3
  69. package/dist/neutral/Duration/validation/validateBoundWitness.d.ts.map +0 -1
  70. package/dist/neutral/Duration/validation/validateBoundWitnessAndDuration.d.ts +0 -4
  71. package/dist/neutral/Duration/validation/validateBoundWitnessAndDuration.d.ts.map +0 -1
  72. package/dist/neutral/Duration/validation/validateBoundWitnessWithDuration.d.ts +0 -4
  73. package/dist/neutral/Duration/validation/validateBoundWitnessWithDuration.d.ts.map +0 -1
  74. package/dist/neutral/Duration/validation/validateDuration.d.ts +0 -5
  75. package/dist/neutral/Duration/validation/validateDuration.d.ts.map +0 -1
  76. package/dist/neutral/Hash/Payload.d.ts +0 -68
  77. package/dist/neutral/Hash/Payload.d.ts.map +0 -1
  78. package/dist/neutral/Hash/index.d.ts +0 -2
  79. package/dist/neutral/Hash/index.d.ts.map +0 -1
  80. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/ErrorDetails/ErrorCodes.d.ts +0 -4
  81. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/ErrorDetails/ErrorCodes.d.ts.map +0 -1
  82. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/ErrorDetails/Payload.d.ts +0 -74
  83. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/ErrorDetails/Payload.d.ts.map +0 -1
  84. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/ErrorDetails/index.d.ts +0 -3
  85. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/ErrorDetails/index.d.ts.map +0 -1
  86. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/Schema.d.ts +0 -5
  87. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/Schema.d.ts.map +0 -1
  88. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/index.d.ts +0 -3
  89. package/dist/neutral/diviner/DomainLeaseEstimateDiviner/index.d.ts.map +0 -1
  90. package/dist/neutral/diviner/index.d.ts +0 -3
  91. package/dist/neutral/diviner/index.d.ts.map +0 -1
  92. package/dist/neutral/diviner/lib/index.d.ts +0 -2
  93. package/dist/neutral/diviner/lib/index.d.ts.map +0 -1
  94. package/dist/neutral/diviner/lib/parseEstimatesFromArray.d.ts +0 -15
  95. package/dist/neutral/diviner/lib/parseEstimatesFromArray.d.ts.map +0 -1
@@ -1,987 +1,3 @@
1
- // src/Address/Payload.ts
2
- import {
3
- AddressZod,
4
- zodAsFactory as zodAsFactory3,
5
- zodIsFactory as zodIsFactory3,
6
- zodToFactory as zodToFactory3
7
- } from "@ariestools/sdk";
8
- import { asSchema as asSchema3, PayloadZodOfSchema as PayloadZodOfSchema3 } from "@xyo-network/sdk";
9
- import * as z4 from "zod/mini";
10
-
11
- // src/Domain/Domain.ts
12
- import {
13
- zodAsFactory,
14
- zodIsFactory,
15
- zodToFactory
16
- } from "@ariestools/sdk";
17
- import { asSchema, PayloadZodOfSchema } from "@xyo-network/sdk";
18
- import * as z from "zod/mini";
19
- var DomainSchema = asSchema("network.xyo.ns.domain", true);
20
- var TopLevelDomainZod = z.literal("xyo");
21
- var DomainFieldsZod = z.object({
22
- /**
23
- * The XNS domain of the record
24
- */
25
- domain: z.string(),
26
- /**
27
- * The Top-Level Domain of the domain
28
- */
29
- tld: TopLevelDomainZod
30
- });
31
- var DomainZod = z.extend(PayloadZodOfSchema(DomainSchema), { ...DomainFieldsZod.shape });
32
- var isDomain = zodIsFactory(DomainZod);
33
- var asDomain = zodAsFactory(DomainZod, "asDomain");
34
- var toDomain = zodToFactory(DomainZod, "toDomain");
35
-
36
- // src/Domain/DomainLease.ts
37
- import {
38
- zodAsFactory as zodAsFactory2,
39
- zodIsFactory as zodIsFactory2,
40
- zodToFactory as zodToFactory2
41
- } from "@ariestools/sdk";
42
- import { asSchema as asSchema2, PayloadZodOfSchema as PayloadZodOfSchema2 } from "@xyo-network/sdk";
43
- import * as z3 from "zod/mini";
44
-
45
- // src/Duration/Duration.ts
46
- import * as z2 from "zod/mini";
47
- var DurationFieldsZod = z2.object({
48
- /**
49
- * A timestamp that indicates the expiration time of the record
50
- */
51
- exp: z2.number(),
52
- /**
53
- * A timestamp that indicates the time before which the record is not valid
54
- */
55
- nbf: z2.number()
56
- });
57
-
58
- // src/Duration/validation/validateBoundWitness.ts
59
- import { BoundWitnessValidator } from "@xyo-network/sdk";
60
- var validateBoundWitness = async (recordBw, requiredSchemas = []) => {
61
- if (requiredSchemas.some((requiredSchema) => !recordBw.payload_schemas.includes(requiredSchema))) return false;
62
- const validator = new BoundWitnessValidator(recordBw);
63
- const errors = await validator.validate();
64
- return errors.length === 0;
65
- };
66
-
67
- // src/Duration/validation/validateBoundWitnessAndDuration.ts
68
- import { PayloadBuilder } from "@xyo-network/sdk";
69
- var validateBoundWitnessAndDuration = async (recordBw, recordPayload) => {
70
- if (!await recordIsInBoundWitness(recordBw, recordPayload)) return false;
71
- return recordIsTemporallyValidToBoundWitness(recordBw, recordPayload);
72
- };
73
- var recordIsInBoundWitness = async (recordBw, recordPayload) => {
74
- const hash = await PayloadBuilder.dataHash(recordPayload);
75
- return recordBw.payload_hashes.includes(hash);
76
- };
77
- var recordIsTemporallyValidToBoundWitness = (_recordBw, _recordPayload) => {
78
- return true;
79
- };
80
-
81
- // src/Duration/validation/validateDuration.ts
82
- var validateDuration = (recordPayload) => {
83
- return isWithinDelegatedTimeframe(recordPayload);
84
- };
85
- var isWithinDelegatedTimeframe = (recordPayload, now = Date.now()) => {
86
- return recordPayload.nbf < now && now < recordPayload.exp;
87
- };
88
-
89
- // src/Duration/validation/validateBoundWitnessWithDuration.ts
90
- var validateBoundWitnessWithDuration = async (recordBw, recordPayload) => {
91
- if (!await validateBoundWitness(recordBw, [recordPayload.schema])) return false;
92
- if (!validateDuration(recordPayload)) return false;
93
- return await validateBoundWitnessAndDuration(recordBw, recordPayload);
94
- };
95
-
96
- // src/Domain/DomainLease.ts
97
- var DomainLeaseSchema = asSchema2("network.xyo.ns.domain.lease", true);
98
- var DomainLeaseFieldsZod = z3.object({
99
- ...DomainFieldsZod.shape,
100
- ...DurationFieldsZod.shape
101
- });
102
- var DomainLeaseZod = z3.extend(PayloadZodOfSchema2(DomainLeaseSchema), { ...DomainLeaseFieldsZod.shape });
103
- var isDomainLease = zodIsFactory2(DomainLeaseZod);
104
- var asDomainLease = zodAsFactory2(DomainLeaseZod, "asDomainLease");
105
- var toDomainLease = zodToFactory2(DomainLeaseZod, "toDomainLease");
106
-
107
- // src/Address/Payload.ts
108
- var AddressRecordSchema = asSchema3("network.xyo.ns.record.address", true);
109
- var AddressRecordFieldsZod = z4.object({
110
- ...DomainFieldsZod.shape,
111
- /**
112
- * The address the record points to
113
- */
114
- address: z4.array(AddressZod)
115
- });
116
- var AddressRecordZod = z4.extend(PayloadZodOfSchema3(AddressRecordSchema), { ...AddressRecordFieldsZod.shape });
117
- var isAddressRecord = zodIsFactory3(AddressRecordZod);
118
- var asAddressRecord = zodAsFactory3(AddressRecordZod, "asAddressRecord");
119
- var toAddressRecord = zodToFactory3(AddressRecordZod, "toAddressRecord");
120
-
121
- // src/diviner/DomainLeaseEstimateDiviner/Schema.ts
122
- import { asSchema as asSchema4 } from "@xyo-network/sdk";
123
- var DomainLeaseEstimateDivinerValidationErrorDetailsSchema = asSchema4("network.xyo.diviner.ns.domain.registration.lease.estimate.validation.error.details", true);
124
-
125
- // src/diviner/DomainLeaseEstimateDiviner/ErrorDetails/ErrorCodes.ts
126
- var DomainLeaseEstimateDivinerErrorDetailsDictionary = {
127
- 0: {
128
- code: "0",
129
- schema: DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
130
- title: "Success"
131
- },
132
- 1: {
133
- code: "1",
134
- schema: DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
135
- title: "Invalid casing"
136
- },
137
- 2: {
138
- code: "2",
139
- schema: DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
140
- title: "Invalid coin signature"
141
- },
142
- 3: {
143
- code: "3",
144
- schema: DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
145
- title: "Invalid length"
146
- },
147
- 4: {
148
- code: "4",
149
- schema: DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
150
- title: "Invalid name"
151
- },
152
- 5: {
153
- code: "5",
154
- schema: DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
155
- title: "Reserved fragment"
156
- },
157
- 6: {
158
- code: "6",
159
- schema: DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
160
- title: "Reserved name"
161
- },
162
- 7: {
163
- code: "7",
164
- schema: DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
165
- title: "Reserved string"
166
- },
167
- 8: {
168
- code: "8",
169
- schema: DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
170
- title: "Invalid TLD"
171
- }
172
- };
173
-
174
- // src/diviner/DomainLeaseEstimateDiviner/ErrorDetails/Payload.ts
175
- import {
176
- zodAsFactory as zodAsFactory4,
177
- zodIsFactory as zodIsFactory4,
178
- zodToFactory as zodToFactory4
179
- } from "@ariestools/sdk";
180
- import { PayloadZodOfSchema as PayloadZodOfSchema4 } from "@xyo-network/sdk";
181
- import * as z5 from "zod/mini";
182
- var ErrorDetailsZod = z5.object({
183
- /**
184
- * A string code indicating the error type.
185
- */
186
- code: z5.optional(z5.string()),
187
- /**
188
- * A human-readable explanation specific to this occurrence of the problem
189
- */
190
- detail: z5.optional(z5.string()),
191
- /**
192
- * A short, human-readable summary of the problem type.
193
- */
194
- title: z5.optional(z5.string())
195
- });
196
- var DomainLeaseEstimateDivinerValidationErrorDetailsZod = z5.extend(
197
- PayloadZodOfSchema4(DomainLeaseEstimateDivinerValidationErrorDetailsSchema),
198
- { ...ErrorDetailsZod.shape }
199
- );
200
- var baseIsDomainLeaseEstimateDivinerValidationErrorDetails = zodIsFactory4(DomainLeaseEstimateDivinerValidationErrorDetailsZod);
201
- var isDomainLeaseEstimateDivinerValidationErrorDetails = (x) => baseIsDomainLeaseEstimateDivinerValidationErrorDetails(x);
202
- var asDomainLeaseEstimateDivinerValidationErrorDetails = zodAsFactory4(
203
- DomainLeaseEstimateDivinerValidationErrorDetailsZod,
204
- "asDomainLeaseEstimateDivinerValidationErrorDetails"
205
- );
206
- var toDomainLeaseEstimateDivinerValidationErrorDetails = zodToFactory4(
207
- DomainLeaseEstimateDivinerValidationErrorDetailsZod,
208
- "toDomainLeaseEstimateDivinerValidationErrorDetails"
209
- );
210
-
211
- // src/diviner/lib/parseEstimatesFromArray.ts
212
- import { exists, findAs } from "@ariestools/sdk";
213
- import { asHashLeaseEstimate, HashLeaseEstimateSchema } from "@xyo-network/diviner-hash-lease";
214
- import { isBoundWitness, PayloadBuilder as PayloadBuilder2 } from "@xyo-network/sdk";
215
-
216
- // src/DomainRegistration/DomainRegistration.ts
217
- import {
218
- AddressZod as AddressZod2,
219
- zodAsFactory as zodAsFactory5,
220
- zodIsFactory as zodIsFactory5,
221
- zodToFactory as zodToFactory5
222
- } from "@ariestools/sdk";
223
- import { asSchema as asSchema5, PayloadZodOfSchema as PayloadZodOfSchema5 } from "@xyo-network/sdk";
224
- import * as z6 from "zod/mini";
225
- var DomainRegistrationSchema = asSchema5(`${DomainSchema}.registration`, true);
226
- var DomainRegistrationFieldsZod = z6.object({
227
- ...DomainFieldsZod.shape,
228
- /**
229
- * The registrant of the domain
230
- */
231
- registrant: z6.array(AddressZod2),
232
- /**
233
- * The registrar of the domain
234
- */
235
- registrar: z6.array(AddressZod2)
236
- });
237
- var DomainRegistrationZod = z6.extend(PayloadZodOfSchema5(DomainRegistrationSchema), { ...DomainRegistrationFieldsZod.shape });
238
- var isDomainRegistration = zodIsFactory5(DomainRegistrationZod);
239
- var asDomainRegistration = zodAsFactory5(DomainRegistrationZod, "asDomainRegistration");
240
- var toDomainRegistration = zodToFactory5(DomainRegistrationZod, "toDomainRegistration");
241
-
242
- // src/DomainRegistration/DomainRegistrationLease.ts
243
- import {
244
- zodAsFactory as zodAsFactory6,
245
- zodIsFactory as zodIsFactory6,
246
- zodToFactory as zodToFactory6
247
- } from "@ariestools/sdk";
248
- import { asSchema as asSchema6, PayloadZodOfSchema as PayloadZodOfSchema6 } from "@xyo-network/sdk";
249
- import * as z7 from "zod/mini";
250
- var DomainRegistrationLeaseSchema = asSchema6(`${DomainRegistrationSchema}.lease`, true);
251
- var DomainRegistrationLeaseFieldsZod = z7.object({
252
- ...DomainRegistrationFieldsZod.shape,
253
- ...DurationFieldsZod.shape
254
- });
255
- var DomainRegistrationLeaseZod = z7.extend(PayloadZodOfSchema6(DomainRegistrationLeaseSchema), { ...DomainRegistrationLeaseFieldsZod.shape });
256
- var isDomainRegistrationLease = zodIsFactory6(DomainRegistrationLeaseZod);
257
- var asDomainRegistrationLease = zodAsFactory6(DomainRegistrationLeaseZod, "asDomainRegistrationLease");
258
- var toDomainRegistrationLease = zodToFactory6(DomainRegistrationLeaseZod, "toDomainRegistrationLease");
259
-
260
- // src/diviner/lib/parseEstimatesFromArray.ts
261
- var parseEstimatesFromArray = async (payloads) => {
262
- if (!payloads) return [];
263
- const bws = payloads.filter(isBoundWitness).filter(hasEstimatePayloads) ?? [];
264
- if (bws.length === 0) return [];
265
- const hashMap = await PayloadBuilder2.toAllHashMap(payloads);
266
- return bws.map((bw) => {
267
- const hashLeaseEstimate = getPayloadBySchemaFromBoundWitness(
268
- bw,
269
- HashLeaseEstimateSchema,
270
- hashMap,
271
- asHashLeaseEstimate
272
- );
273
- if (!hashLeaseEstimate) return;
274
- const domainLease = getPayloadBySchemaFromBoundWitness(
275
- bw,
276
- DomainRegistrationLeaseSchema,
277
- hashMap,
278
- asDomainRegistrationLease
279
- );
280
- if (!domainLease) return;
281
- return [bw, hashLeaseEstimate, domainLease];
282
- }).filter(exists);
283
- };
284
- var hasEstimatePayloads = (bw) => {
285
- return bw.payload_schemas.includes(DomainRegistrationLeaseSchema) && bw.payload_schemas.includes(HashLeaseEstimateSchema);
286
- };
287
- var getPayloadBySchemaFromBoundWitness = (bw, schema, hashMap, identity) => {
288
- const schemaIndex = bw.payload_schemas.indexOf(schema);
289
- if (schemaIndex === -1) return;
290
- const hash = bw.payload_hashes[schemaIndex];
291
- return findAs([hashMap[hash]], identity);
292
- };
293
-
294
- // src/Dns/types/Answer.ts
295
- import * as z10 from "zod/mini";
296
-
297
- // src/Dns/types/Record.ts
298
- import * as z9 from "zod/mini";
299
-
300
- // src/Dns/types/ResourceRecord.ts
301
- import * as z8 from "zod/mini";
302
- var DNSResourceRecordTypeZod = z8.enum([
303
- "A",
304
- "NS",
305
- "MD",
306
- "MF",
307
- "CNAME",
308
- "SOA",
309
- "MB",
310
- "MG",
311
- "MR",
312
- "NULL",
313
- "WKS",
314
- "PTR",
315
- "HINFO",
316
- "MINFO",
317
- "MX",
318
- "TXT",
319
- "RP",
320
- "AFSDB",
321
- "X25",
322
- "ISDN",
323
- "RT",
324
- "NSAP",
325
- "NSAP-PTR",
326
- "SIG",
327
- "KEY",
328
- "PX",
329
- "GPOS",
330
- "AAAA",
331
- "LOC",
332
- "NXT",
333
- "EID",
334
- "NIMLOC",
335
- "SRV",
336
- "ATMA",
337
- "NAPTR",
338
- "KX",
339
- "CERT",
340
- "A6",
341
- "DNAME",
342
- "SINK",
343
- "OPT",
344
- "APL",
345
- "DS",
346
- "SSHFP",
347
- "IPSECKEY",
348
- "RRSIG",
349
- "NSEC",
350
- "DNSKEY",
351
- "DHCID",
352
- "NSEC3",
353
- "NSEC3PARAM",
354
- "TLSA",
355
- "SMIMEA",
356
- "HIP",
357
- "NINFO",
358
- "RKEY",
359
- "TALINK",
360
- "CDS",
361
- "CDNSKEY",
362
- "OPENPGPKEY",
363
- "CSYNC",
364
- "ZONEMD",
365
- "SVCB",
366
- "HTTPS",
367
- "SPF",
368
- "UINFO",
369
- "UID",
370
- "GID",
371
- "UNSPEC",
372
- "NID",
373
- "L32",
374
- "L64",
375
- "LP",
376
- "EUI48",
377
- "EUI64",
378
- "NXNAME",
379
- "TKEY",
380
- "TSIG",
381
- "IXFR",
382
- "AXFR",
383
- "MAILB",
384
- "MAILA",
385
- "*",
386
- "URI",
387
- "CAA",
388
- "AVC",
389
- "DOA",
390
- "AMTRELAY",
391
- "RESINFO",
392
- "WALLET",
393
- "CLA",
394
- "IPN",
395
- "TA",
396
- "DLV",
397
- // Custom types here
398
- "XYOA",
399
- "XYOH"
400
- ]);
401
- var DNSResourceRecordTypes = {
402
- "A": 1,
403
- // a host address
404
- "NS": 2,
405
- // an authoritative name server
406
- "MD": 3,
407
- // a mail destination (OBSOLETE - use MX)
408
- "MF": 4,
409
- // a mail forwarder (OBSOLETE - use MX)
410
- "CNAME": 5,
411
- // the canonical name for an alias
412
- "SOA": 6,
413
- // marks the start of a zone of authority
414
- "MB": 7,
415
- // a mailbox domain name (EXPERIMENTAL)
416
- "MG": 8,
417
- // a mail group member (EXPERIMENTAL)
418
- "MR": 9,
419
- // a mail rename domain name (EXPERIMENTAL)
420
- "NULL": 10,
421
- // a null RR (EXPERIMENTAL)
422
- "WKS": 11,
423
- // a well known service description
424
- "PTR": 12,
425
- // a domain name pointer
426
- "HINFO": 13,
427
- // host information
428
- "MINFO": 14,
429
- // mailbox or mail list information
430
- "MX": 15,
431
- // mail exchange
432
- "TXT": 16,
433
- // text strings
434
- "RP": 17,
435
- // for Responsible Person
436
- "AFSDB": 18,
437
- // for AFS Data Base location
438
- "X25": 19,
439
- // for X.25 PSDN address
440
- "ISDN": 20,
441
- // for ISDN address
442
- "RT": 21,
443
- // for Route Through
444
- "NSAP": 22,
445
- // for NSAP address, NSAP style A record (DEPRECATED)
446
- "NSAP-PTR": 23,
447
- // for domain name pointer, NSAP style (DEPRECATED)
448
- "SIG": 24,
449
- // for security signature
450
- "KEY": 25,
451
- // for security key
452
- "PX": 26,
453
- // X.400 mail mapping information
454
- "GPOS": 27,
455
- // Geographical Position
456
- "AAAA": 28,
457
- // IP6 Address
458
- "LOC": 29,
459
- // Location Information
460
- "NXT": 30,
461
- // Next Domain (OBSOLETE)
462
- "EID": 31,
463
- // Endpoint Identifier
464
- "NIMLOC": 32,
465
- // Nimrod Locator
466
- "SRV": 33,
467
- // Server Selection
468
- "ATMA": 34,
469
- // ATM Address
470
- "NAPTR": 35,
471
- // Naming Authority Pointer
472
- "KX": 36,
473
- // Key Exchanger
474
- "CERT": 37,
475
- // CERT
476
- "A6": 38,
477
- // A6 (OBSOLETE - use AAAA)
478
- "DNAME": 39,
479
- // DNAME
480
- "SINK": 40,
481
- // SINK
482
- "OPT": 41,
483
- // OPT
484
- "APL": 42,
485
- // APL
486
- "DS": 43,
487
- // Delegation Signer
488
- "SSHFP": 44,
489
- // SSH Key Fingerprint
490
- "IPSECKEY": 45,
491
- // IPSECKEY
492
- "RRSIG": 46,
493
- // RRSIG
494
- "NSEC": 47,
495
- // NSEC
496
- "DNSKEY": 48,
497
- // DNSKEY
498
- "DHCID": 49,
499
- // DHCID
500
- "NSEC3": 50,
501
- // NSEC3
502
- "NSEC3PARAM": 51,
503
- // NSEC3PARAM
504
- "TLSA": 52,
505
- // TLSA
506
- "SMIMEA": 53,
507
- // S/MIME cert association
508
- "HIP": 55,
509
- // Host Identity Protocol
510
- "NINFO": 56,
511
- // NINFO
512
- "RKEY": 57,
513
- // RKEY
514
- "TALINK": 58,
515
- // Trust Anchor LINK
516
- "CDS": 59,
517
- // Child DS
518
- "CDNSKEY": 60,
519
- // DNSKEY(s) the Child wants reflected in DS
520
- "OPENPGPKEY": 61,
521
- // OpenPGP Key
522
- "CSYNC": 62,
523
- // Child-To-Parent Synchronization
524
- "ZONEMD": 63,
525
- // Message Digest Over Zone Data
526
- "SVCB": 64,
527
- // General-purpose service binding
528
- "HTTPS": 65,
529
- // SVCB-compatible type for use with HTTP
530
- "SPF": 99,
531
- "UINFO": 100,
532
- "UID": 101,
533
- "GID": 102,
534
- "UNSPEC": 103,
535
- "NID": 104,
536
- "L32": 105,
537
- "L64": 106,
538
- "LP": 107,
539
- "EUI48": 108,
540
- // an EUI-48 address
541
- "EUI64": 109,
542
- // an EUI-64 address
543
- "NXNAME": 128,
544
- // NXDOMAIN indicator for Compact Denial of Existence
545
- "TKEY": 249,
546
- // Transaction Key
547
- "TSIG": 250,
548
- // Transaction Signature
549
- "IXFR": 251,
550
- // incremental transfer
551
- "AXFR": 252,
552
- // transfer of an entire zone
553
- "MAILB": 253,
554
- // mailbox-related RRs (MB, MG or MR)
555
- "MAILA": 254,
556
- // mail agent RRs (OBSOLETE - see MX)
557
- "*": 255,
558
- // A request for some or all records the server has available
559
- "URI": 256,
560
- // URI
561
- "CAA": 257,
562
- // Certification Authority Restriction
563
- "AVC": 258,
564
- // Application Visibility and Control
565
- "DOA": 259,
566
- // Digital Object Architecture
567
- "AMTRELAY": 260,
568
- // Automatic Multicast Tunneling Relay
569
- "RESINFO": 261,
570
- // Resolver Information as Key/Value Pairs
571
- "WALLET": 262,
572
- // Public wallet address
573
- "CLA": 263,
574
- // BP Convergence Layer Adapter
575
- "IPN": 264,
576
- // BP Node Number
577
- "TA": 32768,
578
- // DNSSEC Trust Authorities
579
- "DLV": 32769,
580
- // DNSSEC Lookaside Validation (OBSOLETE)
581
- // Custom types here chosen within the Private Use Range
582
- // https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
583
- // https://www.rfc-editor.org/rfc/rfc5226
584
- // as, per the RFC, the Private Use Range is reserved
585
- // "For private or local use only, with the type and
586
- // purpose defined by the local site. No attempt is made to
587
- // prevent multiple sites from using the same value in
588
- // different (and incompatible) ways. There is no need for
589
- // IANA to review such assignments (since IANA does not record
590
- // them) and assignments are not generally useful for broad
591
- // interoperability. It is the responsibility of the sites
592
- // making use of the Private Use range to ensure that no
593
- // conflicts occur (within the intended scope of use)."
594
- // If we want to apply for a custom reserved code later
595
- // on, once the usage is proven enough we can absolutely
596
- // do that.
597
- "XYOA": 65432,
598
- // XYO Address
599
- "XYOH": 65433
600
- // XYO Hash
601
- };
602
- var DNSResourceRecordTypeValueZod = z8.number();
603
- var findDNSResourceRecordTypesByValue = (value) => {
604
- for (const key in DNSResourceRecordTypes) {
605
- const resourceRecordType = key;
606
- if (DNSResourceRecordTypes[resourceRecordType] === value) {
607
- return resourceRecordType;
608
- }
609
- }
610
- return void 0;
611
- };
612
-
613
- // src/Dns/types/Record.ts
614
- var DNSRecordZod = z9.object({
615
- name: z9.string(),
616
- // The domain name that was queried
617
- type: DNSResourceRecordTypeValueZod,
618
- // The record type (e.g., 1 for A record)
619
- TTL: z9.number(),
620
- // Time to Live (how long the record can be cached)
621
- data: z9.string()
622
- // The actual data, such as an IP address or TXT record
623
- });
624
-
625
- // src/Dns/types/Answer.ts
626
- var DNSAnswerZod = z10.extend(DNSRecordZod, { class: z10.optional(z10.number()) });
627
-
628
- // src/Dns/types/Header.ts
629
- import * as z13 from "zod/mini";
630
-
631
- // src/Dns/types/OperationCodes.ts
632
- import * as z11 from "zod/mini";
633
- var DNSQueryOpcodeZod = z11.union([
634
- z11.literal(0),
635
- z11.literal(1),
636
- z11.literal(2),
637
- z11.literal(4),
638
- z11.literal(5),
639
- z11.literal(6)
640
- ]);
641
- var DNSQueryOpcodeNameZod = z11.enum(["QUERY", "IQUERY", "STATUS", "NOTIFY", "UPDATE", "DSO"]);
642
- var DNSQueryOpcodes = {
643
- QUERY: 0,
644
- IQUERY: 1,
645
- STATUS: 2,
646
- NOTIFY: 4,
647
- UPDATE: 5,
648
- DSO: 6
649
- };
650
-
651
- // src/Dns/types/ResponseCodes.ts
652
- import * as z12 from "zod/mini";
653
- var DNSRcodeZod = z12.union([
654
- z12.literal(0),
655
- z12.literal(1),
656
- z12.literal(2),
657
- z12.literal(3),
658
- z12.literal(4),
659
- z12.literal(5),
660
- z12.literal(6),
661
- z12.literal(7),
662
- z12.literal(8),
663
- z12.literal(9),
664
- z12.literal(10),
665
- z12.literal(16),
666
- z12.literal(17),
667
- z12.literal(18)
668
- ]);
669
- var DNSRcodeNameZod = z12.enum([
670
- "NOERROR",
671
- "FORMERR",
672
- "SERVFAIL",
673
- "NXDOMAIN",
674
- "NOTIMP",
675
- "REFUSED",
676
- "YXDOMAIN",
677
- "YXRRSET",
678
- "NXRRSET",
679
- "NOTAUTH",
680
- "NOTZONE",
681
- "BADSIG",
682
- "BADKEY",
683
- "BADTIME"
684
- ]);
685
- var DNSRcodes = {
686
- NOERROR: 0,
687
- FORMERR: 1,
688
- SERVFAIL: 2,
689
- NXDOMAIN: 3,
690
- NOTIMP: 4,
691
- REFUSED: 5,
692
- YXDOMAIN: 6,
693
- YXRRSET: 7,
694
- NXRRSET: 8,
695
- NOTAUTH: 9,
696
- NOTZONE: 10,
697
- BADSIG: 16,
698
- BADKEY: 17,
699
- BADTIME: 18
700
- };
701
-
702
- // src/Dns/types/Header.ts
703
- var NumericBooleanZod = z13.union([z13.literal(0), z13.literal(1), z13.literal(true), z13.literal(false)]);
704
- var NumericBooleanFalsyZod = z13.union([z13.literal(0), z13.literal(false)]);
705
- var NumericBooleanTruthyZod = z13.union([z13.literal(1), z13.literal(true)]);
706
- var DNSHeaderZod = z13.object({
707
- /**
708
- * Transaction ID, typically a random number. Integer whose value is 0 to 65535
709
- */
710
- ID: z13.optional(z13.number()),
711
- /**
712
- * Query/Response Flag (0 = Query, 1 = Response)
713
- */
714
- QR: z13.optional(NumericBooleanZod),
715
- /**
716
- * Operation Code (0 for standard query)
717
- */
718
- Opcode: z13.optional(DNSQueryOpcodeZod),
719
- /**
720
- * Authoritative Answer (set in response)
721
- */
722
- AA: z13.optional(NumericBooleanZod),
723
- /**
724
- * Truncated Flag
725
- */
726
- TC: z13.optional(NumericBooleanZod),
727
- // Truncation
728
- /**
729
- * Recursion Desired
730
- */
731
- RD: z13.optional(NumericBooleanZod),
732
- // Recursion Desired (set in query)
733
- /**
734
- * Response Code (0 for no error, non-0 for errors)
735
- */
736
- RCODE: z13.optional(DNSRcodeZod),
737
- /**
738
- * Number of questions in the query (usually 1)
739
- */
740
- QDCOUNT: z13.optional(z13.number()),
741
- /**
742
- * Number of answer records in the response
743
- */
744
- ANCOUNT: z13.optional(z13.number()),
745
- /**
746
- * Number of authority records in the response
747
- */
748
- NSCOUNT: z13.optional(z13.number()),
749
- /**
750
- * Number of additional records in the response
751
- */
752
- ARCOUNT: z13.optional(z13.number())
753
- });
754
- var DNSRequestHeaderZod = z13.extend(DNSHeaderZod, {
755
- QR: NumericBooleanFalsyZod,
756
- // Query/Response Flag (0 = Query)
757
- Opcode: DNSQueryOpcodeZod,
758
- // Operation Code (0 for standard query)
759
- AA: NumericBooleanFalsyZod,
760
- // Authoritative Answer (0 in query)
761
- TC: NumericBooleanFalsyZod,
762
- // Truncation (0 for non-truncated)
763
- RCODE: z13.literal(DNSRcodes.NOERROR),
764
- // Response Code (always 0 in query)
765
- ANCOUNT: z13.literal(0),
766
- // Number of answer records (always 0 in query)
767
- NSCOUNT: z13.literal(0),
768
- // Number of authority records (always 0 in query)
769
- ARCOUNT: z13.literal(0)
770
- // Number of additional records (always 0 in query)
771
- });
772
- var StandardRequestHeader = {
773
- ID: 0,
774
- QR: 0,
775
- // Query/Response Flag (0 = Query)
776
- Opcode: DNSQueryOpcodes.QUERY,
777
- // Operation Code (0 for standard query)
778
- AA: 0,
779
- // Authoritative Answer (0 in query)
780
- TC: 0,
781
- // Truncation (0 for non-truncated)
782
- RD: 1,
783
- // Recursion Desired (1 if recursion is requested)
784
- RCODE: DNSRcodes.NOERROR,
785
- // Response Code (always 0 in query)
786
- QDCOUNT: 1,
787
- ANCOUNT: 0,
788
- NSCOUNT: 0,
789
- ARCOUNT: 0
790
- };
791
- var DNSResponseHeaderZod = z13.extend(DNSHeaderZod, {
792
- QR: NumericBooleanTruthyZod,
793
- // Query/Response Flag (1 = Response)
794
- Opcode: DNSQueryOpcodeZod,
795
- // Operation Code (0 for standard query)
796
- AA: NumericBooleanZod,
797
- // Authoritative Answer (1 if the response is authoritative)
798
- TC: NumericBooleanZod,
799
- // Truncation (1 if the message is truncated)
800
- RA: NumericBooleanZod
801
- // Recursion Available (1 if the server supports recursion)
802
- });
803
-
804
- // src/Dns/types/Request.ts
805
- import * as z14 from "zod/mini";
806
- var DNSQuestionZod = z14.object({
807
- name: z14.string(),
808
- // The domain name that was queried
809
- type: DNSResourceRecordTypeValueZod,
810
- // The record type (e.g., 1 for A record)
811
- class: z14.optional(z14.number())
812
- // Query Class (typically 1 for IN - Internet)
813
- });
814
- var DNSRequestFieldsZod = z14.extend(DNSRequestHeaderZod, { Question: z14.array(DNSQuestionZod) });
815
- var getRequestFor = (domain, type = DNSResourceRecordTypes.A) => {
816
- return {
817
- ...StandardRequestHeader,
818
- ID: getRandomId(),
819
- Question: [{
820
- name: domain,
821
- type,
822
- class: 1
823
- }]
824
- };
825
- };
826
- var getRandomId = () => {
827
- return Math.floor(Math.random() * 65536);
828
- };
829
-
830
- // src/Dns/types/Response.ts
831
- import * as z15 from "zod/mini";
832
- var DNSResponseFieldsZod = z15.extend(DNSResponseHeaderZod, {
833
- Question: z15.array(DNSQuestionZod),
834
- // The questions that were asked
835
- Answer: z15.array(DNSAnswerZod),
836
- // Reusing DNSAnswer for the Answer Section
837
- Authority: z15.optional(z15.array(DNSRecordZod)),
838
- Additional: z15.optional(z15.array(DNSRecordZod))
839
- });
840
-
841
- // src/Dns/Witness/Config.ts
842
- import { asSchema as asSchema8 } from "@xyo-network/sdk";
843
-
844
- // src/Dns/Witness/Schema.ts
845
- import { asSchema as asSchema7 } from "@xyo-network/sdk";
846
- var DNSSchema = asSchema7("network.xyo.dns", true);
847
-
848
- // src/Dns/Witness/Config.ts
849
- var DNSWitnessConfigSchema = asSchema8(`${DNSSchema}.witness.config`, true);
850
-
851
- // src/Dns/Witness/Payload/Request.ts
852
- import {
853
- zodAsFactory as zodAsFactory7,
854
- zodIsFactory as zodIsFactory7,
855
- zodToFactory as zodToFactory7
856
- } from "@ariestools/sdk";
857
- import { PayloadZodOfSchema as PayloadZodOfSchema7 } from "@xyo-network/sdk";
858
- import * as z16 from "zod/mini";
859
- var DNSRequestZod = z16.extend(PayloadZodOfSchema7(DNSSchema), { ...DNSRequestFieldsZod.shape });
860
- var isDNSRequest = zodIsFactory7(DNSRequestZod);
861
- var asDNSRequest = zodAsFactory7(DNSRequestZod, "asDNSRequest");
862
- var toDNSRequest = zodToFactory7(DNSRequestZod, "toDNSRequest");
863
- var getDnsRequestFor = (domain, type = DNSResourceRecordTypes.A) => {
864
- return { ...getRequestFor(domain, type), schema: DNSSchema };
865
- };
866
-
867
- // src/Dns/Witness/Payload/Response.ts
868
- import {
869
- zodAsFactory as zodAsFactory8,
870
- zodIsFactory as zodIsFactory8,
871
- zodToFactory as zodToFactory8
872
- } from "@ariestools/sdk";
873
- import { PayloadZodOfSchema as PayloadZodOfSchema8 } from "@xyo-network/sdk";
874
- import * as z17 from "zod/mini";
875
- var DNSResponseZod = z17.extend(PayloadZodOfSchema8(DNSSchema), { ...DNSResponseFieldsZod.shape });
876
- var isDNSResponse = zodIsFactory8(DNSResponseZod);
877
- var asDNSResponse = zodAsFactory8(DNSResponseZod, "asDNSResponse");
878
- var toDNSResponse = zodToFactory8(DNSResponseZod, "toDNSResponse");
879
-
880
- // src/Hash/Payload.ts
881
- import {
882
- HashZod,
883
- zodAsFactory as zodAsFactory9,
884
- zodIsFactory as zodIsFactory9,
885
- zodToFactory as zodToFactory9
886
- } from "@ariestools/sdk";
887
- import { asSchema as asSchema9, PayloadZodOfSchema as PayloadZodOfSchema9 } from "@xyo-network/sdk";
888
- import * as z18 from "zod/mini";
889
- var HashRecordSchema = asSchema9("network.xyo.ns.record.hash", true);
890
- var HashRecordFieldsZod = z18.object({
891
- ...DomainFieldsZod.shape,
892
- /**
893
- * The hash the record points to
894
- */
895
- hash: z18.array(HashZod)
896
- });
897
- var HashRecordZod = z18.extend(PayloadZodOfSchema9(HashRecordSchema), { ...HashRecordFieldsZod.shape });
898
- var isHashRecord = zodIsFactory9(HashRecordZod);
899
- var asHashRecord = zodAsFactory9(HashRecordZod, "asHashRecord");
900
- var toHashRecord = zodToFactory9(HashRecordZod, "toHashRecord");
901
- export {
902
- AddressRecordFieldsZod,
903
- AddressRecordSchema,
904
- AddressRecordZod,
905
- DNSAnswerZod,
906
- DNSHeaderZod,
907
- DNSQueryOpcodeNameZod,
908
- DNSQueryOpcodeZod,
909
- DNSQueryOpcodes,
910
- DNSQuestionZod,
911
- DNSRcodeNameZod,
912
- DNSRcodeZod,
913
- DNSRcodes,
914
- DNSRecordZod,
915
- DNSRequestFieldsZod,
916
- DNSRequestHeaderZod,
917
- DNSRequestZod,
918
- DNSResourceRecordTypeValueZod,
919
- DNSResourceRecordTypeZod,
920
- DNSResourceRecordTypes,
921
- DNSResponseFieldsZod,
922
- DNSResponseHeaderZod,
923
- DNSResponseZod,
924
- DNSSchema,
925
- DNSWitnessConfigSchema,
926
- DomainFieldsZod,
927
- DomainLeaseEstimateDivinerErrorDetailsDictionary,
928
- DomainLeaseEstimateDivinerValidationErrorDetailsSchema,
929
- DomainLeaseEstimateDivinerValidationErrorDetailsZod,
930
- DomainLeaseFieldsZod,
931
- DomainLeaseSchema,
932
- DomainLeaseZod,
933
- DomainRegistrationFieldsZod,
934
- DomainRegistrationLeaseFieldsZod,
935
- DomainRegistrationLeaseSchema,
936
- DomainRegistrationLeaseZod,
937
- DomainRegistrationSchema,
938
- DomainRegistrationZod,
939
- DomainSchema,
940
- DomainZod,
941
- DurationFieldsZod,
942
- ErrorDetailsZod,
943
- HashRecordFieldsZod,
944
- HashRecordSchema,
945
- HashRecordZod,
946
- NumericBooleanFalsyZod,
947
- NumericBooleanTruthyZod,
948
- NumericBooleanZod,
949
- StandardRequestHeader,
950
- TopLevelDomainZod,
951
- asAddressRecord,
952
- asDNSRequest,
953
- asDNSResponse,
954
- asDomain,
955
- asDomainLease,
956
- asDomainLeaseEstimateDivinerValidationErrorDetails,
957
- asDomainRegistration,
958
- asDomainRegistrationLease,
959
- asHashRecord,
960
- findDNSResourceRecordTypesByValue,
961
- getDnsRequestFor,
962
- getRandomId,
963
- getRequestFor,
964
- isAddressRecord,
965
- isDNSRequest,
966
- isDNSResponse,
967
- isDomain,
968
- isDomainLease,
969
- isDomainLeaseEstimateDivinerValidationErrorDetails,
970
- isDomainRegistration,
971
- isDomainRegistrationLease,
972
- isHashRecord,
973
- isWithinDelegatedTimeframe,
974
- parseEstimatesFromArray,
975
- toAddressRecord,
976
- toDNSRequest,
977
- toDNSResponse,
978
- toDomain,
979
- toDomainLease,
980
- toDomainLeaseEstimateDivinerValidationErrorDetails,
981
- toDomainRegistration,
982
- toDomainRegistrationLease,
983
- toHashRecord,
984
- validateBoundWitnessWithDuration,
985
- validateDuration
986
- };
1
+ // src/index.ts
2
+ export * from "@xyo-network/payload-plugins/xns-record";
987
3
  //# sourceMappingURL=index.mjs.map