@xyo-network/payload-model 3.9.17 → 3.9.19

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 (146) hide show
  1. package/dist/browser/Error.d.ts +14 -0
  2. package/dist/browser/Error.d.ts.map +1 -0
  3. package/dist/browser/Payload.d.ts +44 -0
  4. package/dist/browser/Payload.d.ts.map +1 -0
  5. package/dist/browser/PayloadFindFilter.d.ts +6 -0
  6. package/dist/browser/PayloadFindFilter.d.ts.map +1 -0
  7. package/dist/browser/PayloadSet/PayloadSetPayload.d.ts +8 -0
  8. package/dist/browser/PayloadSet/PayloadSetPayload.d.ts.map +1 -0
  9. package/dist/browser/PayloadSet/PayloadSetSchema.d.ts +3 -0
  10. package/dist/browser/PayloadSet/PayloadSetSchema.d.ts.map +1 -0
  11. package/dist/browser/PayloadSet/index.d.ts +3 -0
  12. package/dist/browser/PayloadSet/index.d.ts.map +1 -0
  13. package/dist/browser/PayloadValidationFunction.d.ts +14 -0
  14. package/dist/browser/PayloadValidationFunction.d.ts.map +1 -0
  15. package/dist/browser/PayloadValueExpression.d.ts +38 -0
  16. package/dist/browser/PayloadValueExpression.d.ts.map +1 -0
  17. package/dist/browser/Query.d.ts +16 -0
  18. package/dist/browser/Query.d.ts.map +1 -0
  19. package/dist/browser/Schema.d.ts +19 -0
  20. package/dist/browser/Schema.d.ts.map +1 -0
  21. package/dist/browser/StorageMeta/DataHash.d.ts +14 -0
  22. package/dist/browser/StorageMeta/DataHash.d.ts.map +1 -0
  23. package/dist/browser/StorageMeta/Hash.d.ts +15 -0
  24. package/dist/browser/StorageMeta/Hash.d.ts.map +1 -0
  25. package/dist/browser/StorageMeta/Sequence.d.ts +14 -0
  26. package/dist/browser/StorageMeta/Sequence.d.ts.map +1 -0
  27. package/dist/browser/StorageMeta/StorageMeta.d.ts +14 -0
  28. package/dist/browser/StorageMeta/StorageMeta.d.ts.map +1 -0
  29. package/dist/browser/StorageMeta/index.d.ts +6 -0
  30. package/dist/browser/StorageMeta/index.d.ts.map +1 -0
  31. package/dist/browser/StorageMeta/sequence/Comparer.d.ts +6 -0
  32. package/dist/browser/StorageMeta/sequence/Comparer.d.ts.map +1 -0
  33. package/dist/browser/StorageMeta/sequence/Parser.d.ts +29 -0
  34. package/dist/browser/StorageMeta/sequence/Parser.d.ts.map +1 -0
  35. package/dist/browser/StorageMeta/sequence/Sequence.d.ts +71 -0
  36. package/dist/browser/StorageMeta/sequence/Sequence.d.ts.map +1 -0
  37. package/dist/browser/StorageMeta/sequence/index.d.ts +4 -0
  38. package/dist/browser/StorageMeta/sequence/index.d.ts.map +1 -0
  39. package/dist/browser/Timestamp.d.ts +8 -0
  40. package/dist/browser/Timestamp.d.ts.map +1 -0
  41. package/dist/browser/index.d.ts +13 -268
  42. package/dist/browser/index.d.ts.map +1 -0
  43. package/dist/browser/index.mjs.map +1 -1
  44. package/dist/browser/isPayload.d.ts +12 -0
  45. package/dist/browser/isPayload.d.ts.map +1 -0
  46. package/dist/browser/isPayloadOfSchemaType.d.ts +5 -0
  47. package/dist/browser/isPayloadOfSchemaType.d.ts.map +1 -0
  48. package/dist/neutral/Error.d.ts +14 -0
  49. package/dist/neutral/Error.d.ts.map +1 -0
  50. package/dist/neutral/Payload.d.ts +44 -0
  51. package/dist/neutral/Payload.d.ts.map +1 -0
  52. package/dist/neutral/PayloadFindFilter.d.ts +6 -0
  53. package/dist/neutral/PayloadFindFilter.d.ts.map +1 -0
  54. package/dist/neutral/PayloadSet/PayloadSetPayload.d.ts +8 -0
  55. package/dist/neutral/PayloadSet/PayloadSetPayload.d.ts.map +1 -0
  56. package/dist/neutral/PayloadSet/PayloadSetSchema.d.ts +3 -0
  57. package/dist/neutral/PayloadSet/PayloadSetSchema.d.ts.map +1 -0
  58. package/dist/neutral/PayloadSet/index.d.ts +3 -0
  59. package/dist/neutral/PayloadSet/index.d.ts.map +1 -0
  60. package/dist/neutral/PayloadValidationFunction.d.ts +14 -0
  61. package/dist/neutral/PayloadValidationFunction.d.ts.map +1 -0
  62. package/dist/neutral/PayloadValueExpression.d.ts +38 -0
  63. package/dist/neutral/PayloadValueExpression.d.ts.map +1 -0
  64. package/dist/neutral/Query.d.ts +16 -0
  65. package/dist/neutral/Query.d.ts.map +1 -0
  66. package/dist/neutral/Schema.d.ts +19 -0
  67. package/dist/neutral/Schema.d.ts.map +1 -0
  68. package/dist/neutral/StorageMeta/DataHash.d.ts +14 -0
  69. package/dist/neutral/StorageMeta/DataHash.d.ts.map +1 -0
  70. package/dist/neutral/StorageMeta/Hash.d.ts +15 -0
  71. package/dist/neutral/StorageMeta/Hash.d.ts.map +1 -0
  72. package/dist/neutral/StorageMeta/Sequence.d.ts +14 -0
  73. package/dist/neutral/StorageMeta/Sequence.d.ts.map +1 -0
  74. package/dist/neutral/StorageMeta/StorageMeta.d.ts +14 -0
  75. package/dist/neutral/StorageMeta/StorageMeta.d.ts.map +1 -0
  76. package/dist/neutral/StorageMeta/index.d.ts +6 -0
  77. package/dist/neutral/StorageMeta/index.d.ts.map +1 -0
  78. package/dist/neutral/StorageMeta/sequence/Comparer.d.ts +6 -0
  79. package/dist/neutral/StorageMeta/sequence/Comparer.d.ts.map +1 -0
  80. package/dist/neutral/StorageMeta/sequence/Parser.d.ts +29 -0
  81. package/dist/neutral/StorageMeta/sequence/Parser.d.ts.map +1 -0
  82. package/dist/neutral/StorageMeta/sequence/Sequence.d.ts +71 -0
  83. package/dist/neutral/StorageMeta/sequence/Sequence.d.ts.map +1 -0
  84. package/dist/neutral/StorageMeta/sequence/index.d.ts +4 -0
  85. package/dist/neutral/StorageMeta/sequence/index.d.ts.map +1 -0
  86. package/dist/neutral/Timestamp.d.ts +8 -0
  87. package/dist/neutral/Timestamp.d.ts.map +1 -0
  88. package/dist/neutral/index.d.ts +13 -268
  89. package/dist/neutral/index.d.ts.map +1 -0
  90. package/dist/neutral/index.mjs.map +1 -1
  91. package/dist/neutral/isPayload.d.ts +12 -0
  92. package/dist/neutral/isPayload.d.ts.map +1 -0
  93. package/dist/neutral/isPayloadOfSchemaType.d.ts +5 -0
  94. package/dist/neutral/isPayloadOfSchemaType.d.ts.map +1 -0
  95. package/dist/node/Error.d.ts +14 -0
  96. package/dist/node/Error.d.ts.map +1 -0
  97. package/dist/node/Payload.d.ts +44 -0
  98. package/dist/node/Payload.d.ts.map +1 -0
  99. package/dist/node/PayloadFindFilter.d.ts +6 -0
  100. package/dist/node/PayloadFindFilter.d.ts.map +1 -0
  101. package/dist/node/PayloadSet/PayloadSetPayload.d.ts +8 -0
  102. package/dist/node/PayloadSet/PayloadSetPayload.d.ts.map +1 -0
  103. package/dist/node/PayloadSet/PayloadSetSchema.d.ts +3 -0
  104. package/dist/node/PayloadSet/PayloadSetSchema.d.ts.map +1 -0
  105. package/dist/node/PayloadSet/index.d.ts +3 -0
  106. package/dist/node/PayloadSet/index.d.ts.map +1 -0
  107. package/dist/node/PayloadValidationFunction.d.ts +14 -0
  108. package/dist/node/PayloadValidationFunction.d.ts.map +1 -0
  109. package/dist/node/PayloadValueExpression.d.ts +38 -0
  110. package/dist/node/PayloadValueExpression.d.ts.map +1 -0
  111. package/dist/node/Query.d.ts +16 -0
  112. package/dist/node/Query.d.ts.map +1 -0
  113. package/dist/node/Schema.d.ts +19 -0
  114. package/dist/node/Schema.d.ts.map +1 -0
  115. package/dist/node/StorageMeta/DataHash.d.ts +14 -0
  116. package/dist/node/StorageMeta/DataHash.d.ts.map +1 -0
  117. package/dist/node/StorageMeta/Hash.d.ts +15 -0
  118. package/dist/node/StorageMeta/Hash.d.ts.map +1 -0
  119. package/dist/node/StorageMeta/Sequence.d.ts +14 -0
  120. package/dist/node/StorageMeta/Sequence.d.ts.map +1 -0
  121. package/dist/node/StorageMeta/StorageMeta.d.ts +14 -0
  122. package/dist/node/StorageMeta/StorageMeta.d.ts.map +1 -0
  123. package/dist/node/StorageMeta/index.d.ts +6 -0
  124. package/dist/node/StorageMeta/index.d.ts.map +1 -0
  125. package/dist/node/StorageMeta/sequence/Comparer.d.ts +6 -0
  126. package/dist/node/StorageMeta/sequence/Comparer.d.ts.map +1 -0
  127. package/dist/node/StorageMeta/sequence/Parser.d.ts +29 -0
  128. package/dist/node/StorageMeta/sequence/Parser.d.ts.map +1 -0
  129. package/dist/node/StorageMeta/sequence/Sequence.d.ts +71 -0
  130. package/dist/node/StorageMeta/sequence/Sequence.d.ts.map +1 -0
  131. package/dist/node/StorageMeta/sequence/index.d.ts +4 -0
  132. package/dist/node/StorageMeta/sequence/index.d.ts.map +1 -0
  133. package/dist/node/Timestamp.d.ts +8 -0
  134. package/dist/node/Timestamp.d.ts.map +1 -0
  135. package/dist/node/index.d.ts +13 -268
  136. package/dist/node/index.d.ts.map +1 -0
  137. package/dist/node/index.mjs.map +1 -1
  138. package/dist/node/isPayload.d.ts +12 -0
  139. package/dist/node/isPayload.d.ts.map +1 -0
  140. package/dist/node/isPayloadOfSchemaType.d.ts +5 -0
  141. package/dist/node/isPayloadOfSchemaType.d.ts.map +1 -0
  142. package/package.json +5 -5
  143. package/src/StorageMeta/DataHash.ts +2 -1
  144. package/src/StorageMeta/Hash.ts +4 -2
  145. package/src/StorageMeta/StorageMeta.ts +4 -2
  146. package/src/StorageMeta/sequence/Parser.ts +6 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/isPayload.ts","../../src/isPayloadOfSchemaType.ts","../../src/Error.ts","../../src/PayloadSet/PayloadSetSchema.ts","../../src/Schema.ts","../../src/StorageMeta/DataHash.ts","../../src/StorageMeta/Hash.ts","../../src/StorageMeta/Sequence.ts","../../src/StorageMeta/sequence/Parser.ts","../../src/StorageMeta/sequence/Sequence.ts","../../src/StorageMeta/sequence/Comparer.ts","../../src/StorageMeta/StorageMeta.ts"],"sourcesContent":["import { AsObjectFactory, isObject } from '@xylabs/object'\n\nimport type { Payload } from './Payload.ts'\n\nexport const isAnyPayload = (value: unknown): value is Payload => {\n if (isObject(value)) {\n return typeof value.schema === 'string'\n }\n return false\n}\n\nexport const asAnyPayload = AsObjectFactory.create(isAnyPayload)\n\nexport const isPayload\n = <T extends Payload>(schema: string[]) =>\n (value: unknown): value is T => {\n if (isAnyPayload(value)) {\n return schema.includes(value.schema)\n }\n return false\n }\n\nexport const asPayload = <T extends Payload>(schema: string[]) => AsObjectFactory.create((value: unknown): value is T => isPayload(schema)(value))\n","import { isAnyPayload } from './isPayload.ts'\nimport type { Payload, WithSources } from './Payload.ts'\n\nexport function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']) {\n return (x?: unknown | null): x is T => isAnyPayload(x) && x?.schema === schema\n}\n\nexport const isPayloadOfSchemaTypeWithSources = <T extends Payload | never = never>(schema: T['schema']) => {\n return (x?: unknown | null): x is WithSources<T> =>\n isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.$sources != undefined && Array.isArray(x.$sources)\n}\n\nexport const notPayloadOfSchemaType = <T extends Payload | never = never>(schema: T['schema']) => {\n return (x?: unknown | null): x is T => !isAnyPayload(x) || x?.schema !== schema\n}\n\n// test types -- keep for future validation, but comment out\n\n/*\ntype TestSchema = 'network.xyo.test'\nconst TestSchema: TestSchema = 'network.xyo.test'\n\ntype Test = Payload<{ field: string }, TestSchema>\n\nconst testPayload: Test = { field: 'test', schema: TestSchema }\n\nconst testPayloads: Payload[] = [testPayload]\n\nconst isTest: Test[] = testPayloads.filter(isPayloadOfSchemaType<Payload>(TestSchema))\n\nconst isTestFromMetaTyped = testMetaPayloads.filter(isPayloadOfSchemaType<Test>(TestSchema))\n*/\n","import type { Hash } from '@xylabs/hex'\nimport type { JsonValue } from '@xylabs/object'\n\nimport { isPayloadOfSchemaType } from './isPayloadOfSchemaType.ts'\nimport type { Payload } from './Payload.ts'\n\nexport const ModuleErrorSchema = 'network.xyo.error.module' as const\nexport type ModuleErrorSchema = typeof ModuleErrorSchema\n\nexport type ModuleError = Payload<{\n details?: JsonValue\n message?: string\n name?: string\n query?: Hash\n schema: ModuleErrorSchema\n}>\n\nexport const isModuleError = isPayloadOfSchemaType<ModuleError>(ModuleErrorSchema)\n","export const PayloadSetSchema = 'network.xyo.payload.set' as const\nexport type PayloadSetSchema = typeof PayloadSetSchema\n","import type { EmptyObject } from '@xylabs/object'\nimport { AsTypeFactory } from '@xylabs/object'\n\nexport const SchemaRegEx = String.raw`^((?!-)[a-z0-9-]{1, 63}(?<!-)\\.)+$`\n\n/** Schema type in Javascript is a string */\n// eslint-disable-next-line sonarjs/redundant-type-aliases\nexport type Schema = string\n\nexport const PayloadSchema = 'network.xyo.payload' as const\nexport type PayloadSchema = typeof PayloadSchema\n\nexport const isSchema = (value: unknown): value is Schema => {\n return typeof value === 'string'\n}\n\nexport const asSchema = AsTypeFactory.create<Schema>(isSchema)\n\n/** Schema fields for a Payload */\nexport interface SchemaFields extends EmptyObject {\n /** Schema of the object */\n schema: Schema\n}\n\n/** Add the Schema Fields to an object */\nexport type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields\n","import { type Hash, isHash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\n\nexport interface DataHashStorageMeta {\n _dataHash: Hash\n}\n\nexport type WithDataHashStorageMeta<T extends Payload = Payload> = T & DataHashStorageMeta\nexport type WithPartialDataHashStorageMeta<T extends Payload = Payload> = Partial<WithDataHashStorageMeta<T>>\n\nexport const isDataHashStorageMeta = (value: unknown): value is DataHashStorageMeta => {\n return isHash((value as WithDataHashStorageMeta)?._dataHash)\n}\n\nexport const asDataHashStorageMeta = AsObjectFactory.create<DataHashStorageMeta>(isDataHashStorageMeta)\nexport const asOptionalDataHashStorageMeta = AsObjectFactory.createOptional<DataHashStorageMeta>(isDataHashStorageMeta)\n","import { type Hash, isHash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport { type DataHashStorageMeta, isDataHashStorageMeta } from './DataHash.ts'\n\nexport interface HashStorageMeta extends DataHashStorageMeta {\n _hash: Hash\n}\n\nexport type WithHashStorageMeta<T extends Payload = Payload> = T & HashStorageMeta\nexport type WithPartialHashStorageMeta<T extends Payload = Payload> = Partial<WithHashStorageMeta<T>>\n\nexport const isHashStorageMeta = (value: unknown): value is HashStorageMeta => {\n return isDataHashStorageMeta(value) && isHash((value as WithHashStorageMeta)?._hash)\n}\n\nexport const asHashStorageMeta = AsObjectFactory.create<HashStorageMeta>(isHashStorageMeta)\nexport const asOptionalHashStorageMeta = AsObjectFactory.createOptional<HashStorageMeta>(isHashStorageMeta)\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport type { Sequence } from './sequence/index.ts'\n\nexport interface SequenceStorageMeta {\n _sequence: Sequence\n}\n\nexport type WithSequenceStorageMeta<T extends Payload = Payload> = T & SequenceStorageMeta\nexport type WithPartialSequenceStorageMeta<T extends Payload = Payload> = Partial<WithSequenceStorageMeta<T>>\n\nexport const isSequenceStorageMeta = (value: unknown): value is SequenceStorageMeta => {\n return (value as WithSequenceStorageMeta)?._sequence != undefined\n}\n\nexport const asSequenceStorageMeta = AsObjectFactory.create(isSequenceStorageMeta)\nexport const asOptionalSequenceStorageMeta = AsObjectFactory.createOptional(isSequenceStorageMeta)\n","import { toUint8Array } from '@xylabs/arraybuffer'\nimport { assertEx } from '@xylabs/assert'\nimport {\n type Address,\n type Hash, type Hex,\n isAddress,\n toHex,\n} from '@xylabs/hex'\n\nimport type {\n Epoch, LocalSequence, Nonce, QualifiedSequence,\n Sequence,\n} from './Sequence.ts'\nimport {\n isQualifiedSequence, isSequence, SequenceConstants,\n} from './Sequence.ts'\n\nexport class SequenceParser {\n protected static privateConstructorKey = Date.now().toString()\n\n private readonly data: Readonly<Uint8Array>\n\n protected constructor(privateConstructorKey: string, hex: Hex) {\n assertEx(SequenceParser.privateConstructorKey === privateConstructorKey, () => 'Use create function instead of constructor')\n const paddedHex = toHex(hex, {\n prefix: false,\n bitLength: (hex.length <= SequenceConstants.localSequenceBytes * 2)\n ? SequenceConstants.localSequenceBytes * 8\n : SequenceConstants.qualifiedSequenceBytes * 8,\n })\n this.data = toUint8Array(paddedHex)\n }\n\n get address(): Address {\n const start = SequenceConstants.localSequenceBytes\n const end = SequenceConstants.qualifiedSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get epoch(): Epoch {\n const start = 0\n const end = SequenceConstants.epochBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get localSequence(): LocalSequence {\n const start = 0\n const end = SequenceConstants.localSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get nonce(): Nonce {\n const start = SequenceConstants.epochBytes\n const end = SequenceConstants.localSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get qualifiedSequence(): QualifiedSequence {\n const start = 0\n const end = SequenceConstants.qualifiedSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n static from(sequence: Sequence, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hash, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hex, address?: Address): SequenceParser\n static from(timestamp: Hex, nonce: Nonce, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hash, index?: number, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hex, index?: number, address?: Address): SequenceParser\n static from(timestamp: Hex, nonce: Nonce, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hash, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hex, address?: Address): SequenceParser\n static from(timestamp: number, nonce: Nonce, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hash, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hex, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, nonce: Nonce, index?: number, address?: Address): SequenceParser\n static from(\n timestampOrSequence: Sequence | Hex | number,\n nonceOrAddress: Hash | Nonce,\n addressOrIndex?: Address | number,\n addressOnly?: Address,\n ): SequenceParser {\n const address = typeof addressOrIndex === 'number' ? addressOnly : addressOrIndex\n const index = typeof addressOrIndex === 'number' ? addressOrIndex : undefined\n if (isSequence(timestampOrSequence)) {\n if (nonceOrAddress) {\n assertEx(!isQualifiedSequence(timestampOrSequence), () => 'Providing both a qualified sequence and a address is not allowed')\n assertEx(isAddress(nonceOrAddress), () => 'Invalid address provided')\n return new this(SequenceParser.privateConstructorKey, (timestampOrSequence + address) as Hex)\n }\n return new this(SequenceParser.privateConstructorKey, timestampOrSequence)\n }\n const epoch = SequenceParser.toEpoch(timestampOrSequence)\n const nonce = SequenceParser.toNonce(nonceOrAddress, index)\n const addressHex: Hex = address ? toHex(address, { bitLength: SequenceConstants.addressBytes * 8 }) : SequenceConstants.minAddress\n const hexString = (epoch + nonce + addressHex) as Hex\n assertEx(isSequence(hexString), () => `Invalid sequence [${hexString}] [${epoch}, ${nonce}, ${addressHex}]`)\n return new this(SequenceParser.privateConstructorKey, hexString)\n }\n\n static parse(value: Hex | string | ArrayBufferLike): SequenceParser {\n const hex = toHex(value)\n if (isSequence(hex)) {\n return new this(SequenceParser.privateConstructorKey, hex)\n }\n throw new Error(`Invalid sequence [${value}]`)\n }\n\n // can convert a short number/hex to an epoch (treats it as the whole value) or extract an epoch from a sequence\n static toEpoch(value: number | Hex | Epoch): Epoch {\n assertEx(\n typeof value !== 'number' || Number.isInteger(value),\n () => 'Value must be in integer',\n )\n const hex = toHex(value, { prefix: false })\n if (hex.length <= SequenceConstants.epochBytes * 2) {\n return toHex(value, { prefix: false, bitLength: SequenceConstants.epochBytes * 8 }) as Epoch\n }\n if (isSequence(hex)) {\n return hex.slice(0, SequenceConstants.epochBytes * 2) as Epoch\n }\n throw new Error(`Value could not be converted to epoch [${hex}]`)\n }\n\n // can convert a short number/hex to a nonce (treats it as the whole value) or extract an nonce from a sequence\n static toNonce(value: Hash | Hex, index = 0): Nonce {\n assertEx(\n typeof value !== 'number' || Number.isInteger(value),\n () => 'Value must be in integer',\n )\n const hex = toHex(value, { prefix: false })\n if (isSequence(hex)) {\n return hex.slice(SequenceConstants.epochBytes * 2, SequenceConstants.localSequenceBytes * 2) as Nonce\n }\n const hashHex = toHex((hex as string), { prefix: false, bitLength: SequenceConstants.nonceHashBytes * 8 }).slice(-SequenceConstants.nonceHashBytes * 2)\n const indexHex = toHex(index, { prefix: false, bitLength: SequenceConstants.nonceIndexBytes * 8 }).slice(-SequenceConstants.nonceIndexBytes * 2)\n return (indexHex + hashHex).slice(-SequenceConstants.nonceBytes * 2) as Nonce\n }\n}\n","import type { Address, Hex } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\n\n// we use Exclude to intentionally make the type not equal to string\nexport type LocalSequence = Hex & Exclude<string, 'reserved-local-sequence-value'>\nexport type QualifiedSequence = Hex & Exclude<string, 'reserved-qualified-sequence-value'>\nexport type Sequence = LocalSequence | QualifiedSequence\n\nexport type Epoch = Hex & Exclude<string, 'reserved-epoch-sequence-value'>\n\nexport const isEpoch = (value: unknown): value is Epoch => {\n return isHex(value) && (value as string).length === SequenceConstants.epochBytes * 2\n}\n\nexport type Nonce = Hex & Exclude<string, 'reserved-nonce-sequence-value'>\n\nexport const isNonce = (value: unknown): value is Epoch => {\n return isHex(value) && (value as string).length === SequenceConstants.nonceBytes * 2\n}\n\nexport const isLocalSequence = (value: unknown): value is Sequence => {\n return isHex(value) && (value as string).length === SequenceConstants.localSequenceBytes * 2\n}\n\nexport const isQualifiedSequence = (value: unknown): value is Sequence => {\n return isHex(value) && (value as string).length === SequenceConstants.qualifiedSequenceBytes * 2\n}\n\nexport const isSequence = (value: unknown): value is Sequence => {\n return isLocalSequence(value) || isQualifiedSequence(value)\n}\n\nexport const SequenceNonceComponentLengths = {\n nonceIndexBytes: 4,\n nonceHashBytes: 4,\n}\n\nexport const SequenceComponentLengths = {\n ...SequenceNonceComponentLengths,\n epochBytes: 8,\n nonceBytes: SequenceNonceComponentLengths.nonceIndexBytes + SequenceNonceComponentLengths.nonceHashBytes,\n addressBytes: 20,\n}\n\nexport const SequenceComponentMinMax = {\n minEpoch: '0'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch,\n maxEpoch: 'f'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch,\n minNonce: '0'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce,\n maxNonce: 'f'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce,\n minAddress: '0'.repeat(SequenceComponentLengths.addressBytes * 2) as Address,\n maxAddress: 'f'.repeat(SequenceComponentLengths.addressBytes * 2) as Address,\n}\n\nexport const LocalSequenceConstants = {\n ...SequenceComponentLengths,\n ...SequenceComponentMinMax,\n localSequenceBytes: SequenceComponentLengths.epochBytes + SequenceComponentLengths.nonceBytes,\n minLocalSequence: SequenceComponentMinMax.minEpoch + SequenceComponentMinMax.minNonce as LocalSequence,\n maxLocalSequence: SequenceComponentMinMax.maxEpoch + SequenceComponentMinMax.maxNonce as LocalSequence,\n}\n\nexport const QualifiedSequenceConstants = {\n qualifiedSequenceBytes: LocalSequenceConstants.localSequenceBytes + SequenceComponentLengths.addressBytes,\n minQualifiedSequence: LocalSequenceConstants.minLocalSequence + SequenceComponentMinMax.minAddress as QualifiedSequence,\n maxQualifiedSequence: LocalSequenceConstants.maxLocalSequence + SequenceComponentMinMax.maxAddress as QualifiedSequence,\n}\n\nexport const SequenceConstants = {\n ...LocalSequenceConstants,\n ...QualifiedSequenceConstants,\n}\n\n// \"11111111111111112222222222222222\" is and example of a local sequence string\n\n// \"111111111111111122222222222222223333333333333333333333333333333333333333\" is and example of a local sequence string\n// epoch = \"1111111111111111\"\n// nonce = \"2222222222222222\"\n// address = \"3333333333333333333333333333333333333333\"\n","import type { Compare } from '@xylabs/object'\n\nimport { SequenceParser } from './Parser.ts'\nimport type { Sequence } from './Sequence.ts'\n\nconst local: Compare<Sequence> = (a, b) => {\n const aa = SequenceParser.from(a)\n const bb = SequenceParser.from(b)\n return aa.localSequence > bb.localSequence ? 1 : aa.localSequence < bb.localSequence ? -1 : 0\n}\n\nconst qualified: Compare<Sequence> = (a, b) => {\n const aa = SequenceParser.from(a)\n const bb = SequenceParser.from(b)\n return aa.qualifiedSequence > bb.qualifiedSequence ? 1 : aa.qualifiedSequence < bb.qualifiedSequence ? -1 : 0\n}\n\nexport const SequenceComparer = { local, qualified }\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport { type HashStorageMeta, isHashStorageMeta } from './Hash.ts'\nimport { isSequenceStorageMeta, type SequenceStorageMeta } from './Sequence.ts'\n\nexport interface StorageMeta extends SequenceStorageMeta, HashStorageMeta {}\n\nexport type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta\nexport type WithPartialStorageMeta<T extends Payload = Payload> = T & Partial<StorageMeta>\n\nexport const isStorageMeta = (value: unknown): value is StorageMeta => {\n return isSequenceStorageMeta(value) && isHashStorageMeta(value)\n}\n\nexport const asStorageStorageMeta = AsObjectFactory.create(isStorageMeta)\nexport const asOptionalStorageMeta = AsObjectFactory.createOptional(isStorageMeta)\n"],"mappings":";AAAA,SAAS,iBAAiB,gBAAgB;AAInC,IAAM,eAAe,CAAC,UAAqC;AAChE,MAAI,SAAS,KAAK,GAAG;AACnB,WAAO,OAAO,MAAM,WAAW;AAAA,EACjC;AACA,SAAO;AACT;AAEO,IAAM,eAAe,gBAAgB,OAAO,YAAY;AAExD,IAAM,YACT,CAAoB,WACpB,CAAC,UAA+B;AAC9B,MAAI,aAAa,KAAK,GAAG;AACvB,WAAO,OAAO,SAAS,MAAM,MAAM;AAAA,EACrC;AACA,SAAO;AACT;AAEG,IAAM,YAAY,CAAoB,WAAqB,gBAAgB,OAAO,CAAC,UAA+B,UAAU,MAAM,EAAE,KAAK,CAAC;;;ACnB1I,SAAS,sBAAyD,QAAqB;AAC5F,SAAO,CAAC,MAA+B,aAAa,CAAC,KAAK,GAAG,WAAW;AAC1E;AAEO,IAAM,mCAAmC,CAAoC,WAAwB;AAC1G,SAAO,CAAC,MACN,sBAAsC,MAAM,EAAE,CAAC,K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,CAAC,GAAG,MAAM;AAC7C,QAAM,KAAK,eAAe,KAAK,CAAC;AAChC,QAAM,KAAK,eAAe,KAAK,CAAC;AAChC,SAAO,GAAG,oBAAoB,GAAG,oBAAoB,IAAI,GAAG,oBAAoB,GAAG,oBAAoB,KAAK;AAC9G;AAEO,IAAM,mBAAmB,EAAE,OAAO,UAAU;;;ACjBnD,SAAS,mBAAAC,wBAAuB;AAWzB,IAAM,gBAAgB,CAAC,UAAyC;AACrE,SAAO,sBAAsB,KAAK,KAAK,kBAAkB,KAAK;AAChE;AAEO,IAAM,uBAAuBC,iBAAgB,OAAO,aAAa;AACjE,IAAM,wBAAwBA,iBAAgB,eAAe,aAAa;","names":["AsObjectFactory","isHash","AsObjectFactory","isHash","AsObjectFactory","AsObjectFactory","AsObjectFactory","AsObjectFactory"]}
1
+ {"version":3,"sources":["../../src/isPayload.ts","../../src/isPayloadOfSchemaType.ts","../../src/Error.ts","../../src/PayloadSet/PayloadSetSchema.ts","../../src/Schema.ts","../../src/StorageMeta/DataHash.ts","../../src/StorageMeta/Hash.ts","../../src/StorageMeta/Sequence.ts","../../src/StorageMeta/sequence/Parser.ts","../../src/StorageMeta/sequence/Sequence.ts","../../src/StorageMeta/sequence/Comparer.ts","../../src/StorageMeta/StorageMeta.ts"],"sourcesContent":["import { AsObjectFactory, isObject } from '@xylabs/object'\n\nimport type { Payload } from './Payload.ts'\n\nexport const isAnyPayload = (value: unknown): value is Payload => {\n if (isObject(value)) {\n return typeof value.schema === 'string'\n }\n return false\n}\n\nexport const asAnyPayload = AsObjectFactory.create(isAnyPayload)\n\nexport const isPayload\n = <T extends Payload>(schema: string[]) =>\n (value: unknown): value is T => {\n if (isAnyPayload(value)) {\n return schema.includes(value.schema)\n }\n return false\n }\n\nexport const asPayload = <T extends Payload>(schema: string[]) => AsObjectFactory.create((value: unknown): value is T => isPayload(schema)(value))\n","import { isAnyPayload } from './isPayload.ts'\nimport type { Payload, WithSources } from './Payload.ts'\n\nexport function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']) {\n return (x?: unknown | null): x is T => isAnyPayload(x) && x?.schema === schema\n}\n\nexport const isPayloadOfSchemaTypeWithSources = <T extends Payload | never = never>(schema: T['schema']) => {\n return (x?: unknown | null): x is WithSources<T> =>\n isPayloadOfSchemaType<WithSources<T>>(schema)(x) && x.$sources != undefined && Array.isArray(x.$sources)\n}\n\nexport const notPayloadOfSchemaType = <T extends Payload | never = never>(schema: T['schema']) => {\n return (x?: unknown | null): x is T => !isAnyPayload(x) || x?.schema !== schema\n}\n\n// test types -- keep for future validation, but comment out\n\n/*\ntype TestSchema = 'network.xyo.test'\nconst TestSchema: TestSchema = 'network.xyo.test'\n\ntype Test = Payload<{ field: string }, TestSchema>\n\nconst testPayload: Test = { field: 'test', schema: TestSchema }\n\nconst testPayloads: Payload[] = [testPayload]\n\nconst isTest: Test[] = testPayloads.filter(isPayloadOfSchemaType<Payload>(TestSchema))\n\nconst isTestFromMetaTyped = testMetaPayloads.filter(isPayloadOfSchemaType<Test>(TestSchema))\n*/\n","import type { Hash } from '@xylabs/hex'\nimport type { JsonValue } from '@xylabs/object'\n\nimport { isPayloadOfSchemaType } from './isPayloadOfSchemaType.ts'\nimport type { Payload } from './Payload.ts'\n\nexport const ModuleErrorSchema = 'network.xyo.error.module' as const\nexport type ModuleErrorSchema = typeof ModuleErrorSchema\n\nexport type ModuleError = Payload<{\n details?: JsonValue\n message?: string\n name?: string\n query?: Hash\n schema: ModuleErrorSchema\n}>\n\nexport const isModuleError = isPayloadOfSchemaType<ModuleError>(ModuleErrorSchema)\n","export const PayloadSetSchema = 'network.xyo.payload.set' as const\nexport type PayloadSetSchema = typeof PayloadSetSchema\n","import type { EmptyObject } from '@xylabs/object'\nimport { AsTypeFactory } from '@xylabs/object'\n\nexport const SchemaRegEx = String.raw`^((?!-)[a-z0-9-]{1, 63}(?<!-)\\.)+$`\n\n/** Schema type in Javascript is a string */\n// eslint-disable-next-line sonarjs/redundant-type-aliases\nexport type Schema = string\n\nexport const PayloadSchema = 'network.xyo.payload' as const\nexport type PayloadSchema = typeof PayloadSchema\n\nexport const isSchema = (value: unknown): value is Schema => {\n return typeof value === 'string'\n}\n\nexport const asSchema = AsTypeFactory.create<Schema>(isSchema)\n\n/** Schema fields for a Payload */\nexport interface SchemaFields extends EmptyObject {\n /** Schema of the object */\n schema: Schema\n}\n\n/** Add the Schema Fields to an object */\nexport type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields\n","import type { Hash } from '@xylabs/hex'\nimport { isHash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\n\nexport interface DataHashStorageMeta {\n _dataHash: Hash\n}\n\nexport type WithDataHashStorageMeta<T extends Payload = Payload> = T & DataHashStorageMeta\nexport type WithPartialDataHashStorageMeta<T extends Payload = Payload> = Partial<WithDataHashStorageMeta<T>>\n\nexport const isDataHashStorageMeta = (value: unknown): value is DataHashStorageMeta => {\n return isHash((value as WithDataHashStorageMeta)?._dataHash)\n}\n\nexport const asDataHashStorageMeta = AsObjectFactory.create<DataHashStorageMeta>(isDataHashStorageMeta)\nexport const asOptionalDataHashStorageMeta = AsObjectFactory.createOptional<DataHashStorageMeta>(isDataHashStorageMeta)\n","import type { Hash } from '@xylabs/hex'\nimport { isHash } from '@xylabs/hex'\nimport { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport type { DataHashStorageMeta } from './DataHash.ts'\nimport { isDataHashStorageMeta } from './DataHash.ts'\n\nexport interface HashStorageMeta extends DataHashStorageMeta {\n _hash: Hash\n}\n\nexport type WithHashStorageMeta<T extends Payload = Payload> = T & HashStorageMeta\nexport type WithPartialHashStorageMeta<T extends Payload = Payload> = Partial<WithHashStorageMeta<T>>\n\nexport const isHashStorageMeta = (value: unknown): value is HashStorageMeta => {\n return isDataHashStorageMeta(value) && isHash((value as WithHashStorageMeta)?._hash)\n}\n\nexport const asHashStorageMeta = AsObjectFactory.create<HashStorageMeta>(isHashStorageMeta)\nexport const asOptionalHashStorageMeta = AsObjectFactory.createOptional<HashStorageMeta>(isHashStorageMeta)\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport type { Sequence } from './sequence/index.ts'\n\nexport interface SequenceStorageMeta {\n _sequence: Sequence\n}\n\nexport type WithSequenceStorageMeta<T extends Payload = Payload> = T & SequenceStorageMeta\nexport type WithPartialSequenceStorageMeta<T extends Payload = Payload> = Partial<WithSequenceStorageMeta<T>>\n\nexport const isSequenceStorageMeta = (value: unknown): value is SequenceStorageMeta => {\n return (value as WithSequenceStorageMeta)?._sequence != undefined\n}\n\nexport const asSequenceStorageMeta = AsObjectFactory.create(isSequenceStorageMeta)\nexport const asOptionalSequenceStorageMeta = AsObjectFactory.createOptional(isSequenceStorageMeta)\n","import { toUint8Array } from '@xylabs/arraybuffer'\nimport { assertEx } from '@xylabs/assert'\nimport type {\n Address,\n Hash, Hex,\n} from '@xylabs/hex'\nimport {\n isAddress,\n toHex,\n} from '@xylabs/hex'\n\nimport type {\n Epoch, LocalSequence, Nonce, QualifiedSequence,\n Sequence,\n} from './Sequence.ts'\nimport {\n isQualifiedSequence, isSequence,\n SequenceConstants,\n} from './Sequence.ts'\n\nexport class SequenceParser {\n protected static privateConstructorKey = Date.now().toString()\n\n private readonly data: Readonly<Uint8Array>\n\n protected constructor(privateConstructorKey: string, hex: Hex) {\n assertEx(SequenceParser.privateConstructorKey === privateConstructorKey, () => 'Use create function instead of constructor')\n const paddedHex = toHex(hex, {\n prefix: false,\n bitLength: (hex.length <= SequenceConstants.localSequenceBytes * 2)\n ? SequenceConstants.localSequenceBytes * 8\n : SequenceConstants.qualifiedSequenceBytes * 8,\n })\n this.data = toUint8Array(paddedHex)\n }\n\n get address(): Address {\n const start = SequenceConstants.localSequenceBytes\n const end = SequenceConstants.qualifiedSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get epoch(): Epoch {\n const start = 0\n const end = SequenceConstants.epochBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get localSequence(): LocalSequence {\n const start = 0\n const end = SequenceConstants.localSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get nonce(): Nonce {\n const start = SequenceConstants.epochBytes\n const end = SequenceConstants.localSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n get qualifiedSequence(): QualifiedSequence {\n const start = 0\n const end = SequenceConstants.qualifiedSequenceBytes\n return toHex(this.data.slice(start, end).buffer, { prefix: false })\n }\n\n static from(sequence: Sequence, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hash, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hex, address?: Address): SequenceParser\n static from(timestamp: Hex, nonce: Nonce, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hash, index?: number, address?: Address): SequenceParser\n static from(timestamp: Hex, hash: Hex, index?: number, address?: Address): SequenceParser\n static from(timestamp: Hex, nonce: Nonce, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hash, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hex, address?: Address): SequenceParser\n static from(timestamp: number, nonce: Nonce, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hash, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, hash: Hex, index?: number, address?: Address): SequenceParser\n static from(timestamp: number, nonce: Nonce, index?: number, address?: Address): SequenceParser\n static from(\n timestampOrSequence: Sequence | Hex | number,\n nonceOrAddress: Hash | Nonce,\n addressOrIndex?: Address | number,\n addressOnly?: Address,\n ): SequenceParser {\n const address = typeof addressOrIndex === 'number' ? addressOnly : addressOrIndex\n const index = typeof addressOrIndex === 'number' ? addressOrIndex : undefined\n if (isSequence(timestampOrSequence)) {\n if (nonceOrAddress) {\n assertEx(!isQualifiedSequence(timestampOrSequence), () => 'Providing both a qualified sequence and a address is not allowed')\n assertEx(isAddress(nonceOrAddress), () => 'Invalid address provided')\n return new this(SequenceParser.privateConstructorKey, (timestampOrSequence + address) as Hex)\n }\n return new this(SequenceParser.privateConstructorKey, timestampOrSequence)\n }\n const epoch = SequenceParser.toEpoch(timestampOrSequence)\n const nonce = SequenceParser.toNonce(nonceOrAddress, index)\n const addressHex: Hex = address ? toHex(address, { bitLength: SequenceConstants.addressBytes * 8 }) : SequenceConstants.minAddress\n const hexString = (epoch + nonce + addressHex) as Hex\n assertEx(isSequence(hexString), () => `Invalid sequence [${hexString}] [${epoch}, ${nonce}, ${addressHex}]`)\n return new this(SequenceParser.privateConstructorKey, hexString)\n }\n\n static parse(value: Hex | string | ArrayBufferLike): SequenceParser {\n const hex = toHex(value)\n if (isSequence(hex)) {\n return new this(SequenceParser.privateConstructorKey, hex)\n }\n throw new Error(`Invalid sequence [${value}]`)\n }\n\n // can convert a short number/hex to an epoch (treats it as the whole value) or extract an epoch from a sequence\n static toEpoch(value: number | Hex | Epoch): Epoch {\n assertEx(\n typeof value !== 'number' || Number.isInteger(value),\n () => 'Value must be in integer',\n )\n const hex = toHex(value, { prefix: false })\n if (hex.length <= SequenceConstants.epochBytes * 2) {\n return toHex(value, { prefix: false, bitLength: SequenceConstants.epochBytes * 8 }) as Epoch\n }\n if (isSequence(hex)) {\n return hex.slice(0, SequenceConstants.epochBytes * 2) as Epoch\n }\n throw new Error(`Value could not be converted to epoch [${hex}]`)\n }\n\n // can convert a short number/hex to a nonce (treats it as the whole value) or extract an nonce from a sequence\n static toNonce(value: Hash | Hex, index = 0): Nonce {\n assertEx(\n typeof value !== 'number' || Number.isInteger(value),\n () => 'Value must be in integer',\n )\n const hex = toHex(value, { prefix: false })\n if (isSequence(hex)) {\n return hex.slice(SequenceConstants.epochBytes * 2, SequenceConstants.localSequenceBytes * 2) as Nonce\n }\n const hashHex = toHex((hex as string), { prefix: false, bitLength: SequenceConstants.nonceHashBytes * 8 }).slice(-SequenceConstants.nonceHashBytes * 2)\n const indexHex = toHex(index, { prefix: false, bitLength: SequenceConstants.nonceIndexBytes * 8 }).slice(-SequenceConstants.nonceIndexBytes * 2)\n return (indexHex + hashHex).slice(-SequenceConstants.nonceBytes * 2) as Nonce\n }\n}\n","import type { Address, Hex } from '@xylabs/hex'\nimport { isHex } from '@xylabs/hex'\n\n// we use Exclude to intentionally make the type not equal to string\nexport type LocalSequence = Hex & Exclude<string, 'reserved-local-sequence-value'>\nexport type QualifiedSequence = Hex & Exclude<string, 'reserved-qualified-sequence-value'>\nexport type Sequence = LocalSequence | QualifiedSequence\n\nexport type Epoch = Hex & Exclude<string, 'reserved-epoch-sequence-value'>\n\nexport const isEpoch = (value: unknown): value is Epoch => {\n return isHex(value) && (value as string).length === SequenceConstants.epochBytes * 2\n}\n\nexport type Nonce = Hex & Exclude<string, 'reserved-nonce-sequence-value'>\n\nexport const isNonce = (value: unknown): value is Epoch => {\n return isHex(value) && (value as string).length === SequenceConstants.nonceBytes * 2\n}\n\nexport const isLocalSequence = (value: unknown): value is Sequence => {\n return isHex(value) && (value as string).length === SequenceConstants.localSequenceBytes * 2\n}\n\nexport const isQualifiedSequence = (value: unknown): value is Sequence => {\n return isHex(value) && (value as string).length === SequenceConstants.qualifiedSequenceBytes * 2\n}\n\nexport const isSequence = (value: unknown): value is Sequence => {\n return isLocalSequence(value) || isQualifiedSequence(value)\n}\n\nexport const SequenceNonceComponentLengths = {\n nonceIndexBytes: 4,\n nonceHashBytes: 4,\n}\n\nexport const SequenceComponentLengths = {\n ...SequenceNonceComponentLengths,\n epochBytes: 8,\n nonceBytes: SequenceNonceComponentLengths.nonceIndexBytes + SequenceNonceComponentLengths.nonceHashBytes,\n addressBytes: 20,\n}\n\nexport const SequenceComponentMinMax = {\n minEpoch: '0'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch,\n maxEpoch: 'f'.repeat(SequenceComponentLengths.epochBytes * 2) as Epoch,\n minNonce: '0'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce,\n maxNonce: 'f'.repeat(SequenceComponentLengths.nonceBytes * 2) as Nonce,\n minAddress: '0'.repeat(SequenceComponentLengths.addressBytes * 2) as Address,\n maxAddress: 'f'.repeat(SequenceComponentLengths.addressBytes * 2) as Address,\n}\n\nexport const LocalSequenceConstants = {\n ...SequenceComponentLengths,\n ...SequenceComponentMinMax,\n localSequenceBytes: SequenceComponentLengths.epochBytes + SequenceComponentLengths.nonceBytes,\n minLocalSequence: SequenceComponentMinMax.minEpoch + SequenceComponentMinMax.minNonce as LocalSequence,\n maxLocalSequence: SequenceComponentMinMax.maxEpoch + SequenceComponentMinMax.maxNonce as LocalSequence,\n}\n\nexport const QualifiedSequenceConstants = {\n qualifiedSequenceBytes: LocalSequenceConstants.localSequenceBytes + SequenceComponentLengths.addressBytes,\n minQualifiedSequence: LocalSequenceConstants.minLocalSequence + SequenceComponentMinMax.minAddress as QualifiedSequence,\n maxQualifiedSequence: LocalSequenceConstants.maxLocalSequence + SequenceComponentMinMax.maxAddress as QualifiedSequence,\n}\n\nexport const SequenceConstants = {\n ...LocalSequenceConstants,\n ...QualifiedSequenceConstants,\n}\n\n// \"11111111111111112222222222222222\" is and example of a local sequence string\n\n// \"111111111111111122222222222222223333333333333333333333333333333333333333\" is and example of a local sequence string\n// epoch = \"1111111111111111\"\n// nonce = \"2222222222222222\"\n// address = \"3333333333333333333333333333333333333333\"\n","import type { Compare } from '@xylabs/object'\n\nimport { SequenceParser } from './Parser.ts'\nimport type { Sequence } from './Sequence.ts'\n\nconst local: Compare<Sequence> = (a, b) => {\n const aa = SequenceParser.from(a)\n const bb = SequenceParser.from(b)\n return aa.localSequence > bb.localSequence ? 1 : aa.localSequence < bb.localSequence ? -1 : 0\n}\n\nconst qualified: Compare<Sequence> = (a, b) => {\n const aa = SequenceParser.from(a)\n const bb = SequenceParser.from(b)\n return aa.qualifiedSequence > bb.qualifiedSequence ? 1 : aa.qualifiedSequence < bb.qualifiedSequence ? -1 : 0\n}\n\nexport const SequenceComparer = { local, qualified }\n","import { AsObjectFactory } from '@xylabs/object'\n\nimport type { Payload } from '../Payload.ts'\nimport type { HashStorageMeta } from './Hash.ts'\nimport { isHashStorageMeta } from './Hash.ts'\nimport type { SequenceStorageMeta } from './Sequence.ts'\nimport { isSequenceStorageMeta } from './Sequence.ts'\n\nexport interface StorageMeta extends SequenceStorageMeta, HashStorageMeta {}\n\nexport type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta\nexport type WithPartialStorageMeta<T extends Payload = Payload> = T & Partial<StorageMeta>\n\nexport const isStorageMeta = (value: unknown): value is StorageMeta => {\n return isSequenceStorageMeta(value) && isHashStorageMeta(value)\n}\n\nexport const asStorageStorageMeta = AsObjectFactory.create(isStorageMeta)\nexport const asOptionalStorageMeta = AsObjectFactory.createOptional(isStorageMeta)\n"],"mappings":";AAAA,SAAS,iBAAiB,gBAAgB;AAInC,IAAM,eAAe,CAAC,UAAqC;AAChE,MAAI,SAAS,KAAK,GAAG;AACnB,WAAO,OAAO,MAAM,WAAW;AAAA,EACjC;AACA,SAAO;AACT;AAEO,IAAM,eAAe,gBAAgB,OAAO,YAAY;AAExD,IAAM,YACT,CAAoB,WACpB,CAAC,UAA+B;AAC9B,MAAI,aAAa,KAAK,GAAG;AACvB,WAAO,OAAO,SAAS,MAAM,MAAM;AAAA,EACrC;AACA,SAAO;AACT;AAEG,IAAM,YAAY,CAAoB,WAAqB,gBAAgB,OAAO,CAAC,UAA+B,UAAU,MAAM,EAAE,KAAK,CAAC;;;ACnB1I,SAAS,sBAAyD,QAAqB;AAC5F,SAAO,CAAC,MAA+B,aAAa,CAAC,KAAK,GAAG,WAAW;AAC1E;AAEO,IAAM,mCAAmC,CAAoC,WAAwB;AAC1G,SAAO,CAAC,MACN,sBAAsC,MAAM,EAAE,CAAC,KAAK,EAAE,YAAY,UAAa,MAAM,QAAQ,EAAE,QAAQ;AAC3G;AAEO,IAAM,yBAAyB,CAAoC,WAAwB;AAChG,SAAO,CAAC,MAA+B,CAAC,aAAa,CAAC,KAAK,GAAG,WAAW;AA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G,oBAAoB,KAAK;AAC9G;AAEO,IAAM,mBAAmB,EAAE,OAAO,UAAU;;;ACjBnD,SAAS,mBAAAC,wBAAuB;AAazB,IAAM,gBAAgB,CAAC,UAAyC;AACrE,SAAO,sBAAsB,KAAK,KAAK,kBAAkB,KAAK;AAChE;AAEO,IAAM,uBAAuBC,iBAAgB,OAAO,aAAa;AACjE,IAAM,wBAAwBA,iBAAgB,eAAe,aAAa;","names":["AsObjectFactory","isHash","AsObjectFactory","isHash","AsObjectFactory","AsObjectFactory","AsObjectFactory","AsObjectFactory"]}
@@ -0,0 +1,12 @@
1
+ import type { Payload } from './Payload.ts';
2
+ export declare const isAnyPayload: (value: unknown) => value is Payload;
3
+ export declare const asAnyPayload: {
4
+ <TType extends Payload>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
5
+ <TType extends Payload>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<Payload>, config?: import("@xylabs/object").TypeCheckConfig): TType;
6
+ };
7
+ export declare const isPayload: <T extends Payload>(schema: string[]) => (value: unknown) => value is T;
8
+ export declare const asPayload: <T extends Payload>(schema: string[]) => {
9
+ <TType extends T>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
10
+ <TType extends T>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<T>, config?: import("@xylabs/object").TypeCheckConfig): TType;
11
+ };
12
+ //# sourceMappingURL=isPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPayload.d.ts","sourceRoot":"","sources":["../../src/isPayload.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OAKtD,CAAA;AAED,eAAO,MAAM,YAAY;0CAHrB,qDAGD,iCAAiC,gBAAoB;0CAIpD,qDAAc,kGAEyB,gBAEjC;CARsD,CAAA;AAEhE,eAAO,MAAM,SAAS,GACjB,CAAC,SAAS,OAAO,EAAE,QAAQ,MAAM,EAAE,MACnC,OAAO,OAAO,KAAG,KAAK,IAAI,CAK1B,CAAA;AAEL,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,OAAO,EAAE,QAAQ,MAAM,EAAE;oCAdzD,qDAGD,iCAAiC,gBAAoB;oCAIpD,qDAAc,4FAEyB,gBAEjC;CAGwI,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { Payload, WithSources } from './Payload.ts';
2
+ export declare function isPayloadOfSchemaType<T extends Payload | never = never>(schema: T['schema']): (x?: unknown | null) => x is T;
3
+ export declare const isPayloadOfSchemaTypeWithSources: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is WithSources<T>;
4
+ export declare const notPayloadOfSchemaType: <T extends Payload | never = never>(schema: T["schema"]) => (x?: unknown | null) => x is T;
5
+ //# sourceMappingURL=isPayloadOfSchemaType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPayloadOfSchemaType.d.ts","sourceRoot":"","sources":["../../src/isPayloadOfSchemaType.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAExD,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,IAClF,IAAI,OAAO,GAAG,IAAI,KAAG,CAAC,IAAI,CAAC,CACpC;AAED,eAAO,MAAM,gCAAgC,GAAI,CAAC,SAAS,OAAO,GAAG,KAAK,GAAG,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAC7F,IAAI,OAAO,GAAG,IAAI,KAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAEhD,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,OAAO,GAAG,KAAK,GAAG,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MACnF,IAAI,OAAO,GAAG,IAAI,KAAG,CAAC,IAAI,CACnC,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { Hash } from '@xylabs/hex';
2
+ import type { JsonValue } from '@xylabs/object';
3
+ import type { Payload } from './Payload.ts';
4
+ export declare const ModuleErrorSchema: "network.xyo.error.module";
5
+ export type ModuleErrorSchema = typeof ModuleErrorSchema;
6
+ export type ModuleError = Payload<{
7
+ details?: JsonValue;
8
+ message?: string;
9
+ name?: string;
10
+ query?: Hash;
11
+ schema: ModuleErrorSchema;
12
+ }>;
13
+ export declare const isModuleError: (x?: unknown | null) => x is ModuleError;
14
+ //# sourceMappingURL=Error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Error.d.ts","sourceRoot":"","sources":["../../src/Error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,eAAO,MAAM,iBAAiB,EAAG,0BAAmC,CAAA;AACpE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAA;AAExD,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,MAAM,EAAE,iBAAiB,CAAA;CAC1B,CAAC,CAAA;AAEF,eAAO,MAAM,aAAa,0CAAwD,CAAA"}
@@ -0,0 +1,44 @@
1
+ import type { Hash } from '@xylabs/hex';
2
+ import type { DeepOmitStartsWith, DeepPickStartsWith, DeepRestrictToStringKeys, EmptyObject, JsonObject } from '@xylabs/object';
3
+ import type { Schema, WithSchema } from './Schema.ts';
4
+ export interface SchemaField<T extends Schema = Schema> {
5
+ schema: T;
6
+ }
7
+ /** Additional fields for a payload */
8
+ export interface PayloadFields extends SchemaField {
9
+ }
10
+ export type OpCode = 'elevate';
11
+ export interface SourcesMetaField {
12
+ $sources: Hash[];
13
+ }
14
+ export interface ChainMetaFields {
15
+ $opCodes?: OpCode[];
16
+ }
17
+ export interface PayloadMetaFields extends SourcesMetaField, ChainMetaFields {
18
+ }
19
+ export type WithPayload<T extends EmptyObject | void = void> = DeepRestrictToStringKeys<WithSchema<T extends EmptyObject ? PayloadFields & T : PayloadFields>>;
20
+ /** Base Type for Payloads */
21
+ export type Payload<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = (T extends WithSchema ? S extends Schema ? WithPayload<Omit<T, 'schema'> & {
22
+ schema: S;
23
+ }> : WithPayload<T> : T extends object ? S extends Schema ? WithPayload<T & {
24
+ schema: S;
25
+ }> : WithPayload<T & PayloadFields> : WithPayload<{
26
+ schema: S extends Schema ? S : Schema;
27
+ }>) & Partial<PayloadMetaFields>;
28
+ export type OverridablePayload<T extends Payload> = WithoutMeta<Omit<T, 'schema'> & PayloadFields>;
29
+ export type WithSources<T extends EmptyObject> = T & SourcesMetaField;
30
+ /** @deprecated optional $sources are now optional in all Payloads */
31
+ export type WithOptionalSources<T extends EmptyObject> = (T & SourcesMetaField) | T;
32
+ export type PayloadWithSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithSources<Payload<T, S>>;
33
+ /** @deprecated optional $sources are now optional in all Payloads */
34
+ export type PayloadWithOptionalSources<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = WithOptionalSources<Payload<T, S>>;
35
+ export type WithAnySchema<T extends Payload> = OverridablePayload<T>;
36
+ export type WithoutClientMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '$'>;
37
+ export type WithoutStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '_'>;
38
+ export type WithoutPrivateStorageMeta<T extends EmptyObject> = DeepOmitStartsWith<T, '__'>;
39
+ export type WithoutMeta<T extends EmptyObject> = WithoutClientMeta<WithoutStorageMeta<T>>;
40
+ export type WithoutSchema<T extends WithOptionalSchema<Payload>> = Omit<T, 'schema'>;
41
+ export type WithOptionalSchema<T extends EmptyObject = EmptyObject> = WithoutSchema<T> & Partial<T & SchemaField>;
42
+ export type WithOnlyClientMeta<T extends EmptyObject> = DeepPickStartsWith<T, '$'>;
43
+ export type AnyPayload = Payload<JsonObject, Schema>;
44
+ //# sourceMappingURL=Payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EACV,kBAAkB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,WAAW,EAC7E,UAAU,EACX,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACpD,MAAM,EAAE,CAAC,CAAA;CACV;AAED,sCAAsC;AACtC,MAAM,WAAW,aAAc,SAAQ,WAAW;CAAG;AAGrD,MAAM,MAAM,MAAM,GAAG,SAAS,CAAA;AAE9B,MAAM,WAAW,gBAAgB;IAAG,QAAQ,EAAE,IAAI,EAAE,CAAA;CAAE;AACtD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB,EAAE,eAAe;CAAG;AAE/E,MAAM,MAAM,WAAW,C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,CAAC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export interface PayloadFindFilter {
2
+ limit?: number;
3
+ order?: 'desc' | 'asc';
4
+ schema?: string | string[];
5
+ }
6
+ //# sourceMappingURL=PayloadFindFilter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadFindFilter.d.ts","sourceRoot":"","sources":["../../src/PayloadFindFilter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC3B"}
@@ -0,0 +1,8 @@
1
+ import type { Payload } from '../Payload.ts';
2
+ import type { PayloadSetSchema } from './PayloadSetSchema.ts';
3
+ export interface PayloadSet {
4
+ optional?: Record<string, number>;
5
+ required?: Record<string, number>;
6
+ }
7
+ export type PayloadSetPayload = Payload<PayloadSet, PayloadSetSchema>;
8
+ //# sourceMappingURL=PayloadSetPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadSetPayload.d.ts","sourceRoot":"","sources":["../../../src/PayloadSet/PayloadSetPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const PayloadSetSchema: "network.xyo.payload.set";
2
+ export type PayloadSetSchema = typeof PayloadSetSchema;
3
+ //# sourceMappingURL=PayloadSetSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadSetSchema.d.ts","sourceRoot":"","sources":["../../../src/PayloadSet/PayloadSetSchema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,yBAAkC,CAAA;AAClE,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './PayloadSetPayload.ts';
2
+ export * from './PayloadSetSchema.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PayloadSet/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { Payload } from './Payload.ts';
2
+ /**
3
+ * A function that validates the supplied payload synchronously
4
+ */
5
+ export type SyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => boolean;
6
+ /**
7
+ * A function that validates the supplied payload asynchronously
8
+ */
9
+ export type AsyncPayloadValidationFunction<T extends Payload = Payload> = (payload: T) => Promise<boolean>;
10
+ /**
11
+ * A function that validates the supplied payload
12
+ */
13
+ export type PayloadValidationFunction<T extends Payload = Payload> = SyncPayloadValidationFunction<T> | AsyncPayloadValidationFunction<T>;
14
+ //# sourceMappingURL=PayloadValidationFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadValidationFunction.d.ts","sourceRoot":"","sources":["../../src/PayloadValidationFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,6BAA6B,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAA;AAEhG;;GAEG;AACH,MAAM,MAAM,8BAA8B,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAE1G;;GAEG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,6BAA6B,CAAC,CAAC,CAAC,GAAG,8BAA8B,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,38 @@
1
+ import type { Payload } from './Payload.ts';
2
+ /**
3
+ * Type corresponding to the properties of a payload
4
+ */
5
+ export type PayloadProperty<
6
+ /**
7
+ * The type of payload
8
+ */
9
+ T extends Payload = Payload> = keyof T;
10
+ /**
11
+ * Type corresponding to the payload values
12
+ */
13
+ export type PayloadValue<
14
+ /**
15
+ * The type of payload
16
+ */
17
+ T extends Payload = Payload,
18
+ /**
19
+ * The property of the payload to select
20
+ */
21
+ Key extends PayloadProperty<T> = PayloadProperty<T>> = T[Key];
22
+ /**
23
+ * An expressions that selects a property value from the payload
24
+ */
25
+ export type PayloadValueExpression<
26
+ /**
27
+ * The type of payload
28
+ */
29
+ T extends Payload = Payload,
30
+ /**
31
+ * The property of the payload to select
32
+ */
33
+ Key extends PayloadProperty<T> = PayloadProperty<T>,
34
+ /**
35
+ * The type of the selected property's value
36
+ */
37
+ TValue = PayloadValue<T, Key>> = (payload: T) => TValue;
38
+ //# sourceMappingURL=PayloadValueExpression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PayloadValueExpression.d.ts","sourceRoot":"","sources":["../../src/PayloadValueExpression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,eAAe;AACzB;;GAEG;AACH,CAAC,SAAS,OAAO,GAAG,OAAO,IACzB,MAAM,CAAC,CAAA;AAEX;;GAEG;AACH,MAAM,MAAM,YAAY;AACtB;;GAEG;AACH,CAAC,SAAS,OAAO,GAAG,OAAO;AAC3B;;GAEG;AACH,GAAG,SAAS,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,IACjD,CAAC,CAAC,GAAG,CAAC,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,sBAAsB;AAChC;;GAEG;AACH,CAAC,SAAS,OAAO,GAAG,OAAO;AAC3B;;GAEG;AACH,GAAG,SAAS,eAAe,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;AACnD;;GAEG;AACH,MAAM,GAAG,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,IAC3B,CAAC,OAAO,EAAE,CAAC,KAAK,MAAM,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { Address } from '@xylabs/hex';
2
+ import type { EmptyObject } from '@xylabs/object';
3
+ import type { Payload } from './Payload.ts';
4
+ import type { Schema, WithSchema } from './Schema.ts';
5
+ export interface QueryFields {
6
+ /** @field The addresses of the intended handlers */
7
+ address?: Address | Address[];
8
+ /** @field The maximum XYO that can be spent executing the query */
9
+ budget?: number;
10
+ /** @field The frequency on which this query can be rerun */
11
+ maxFrequency?: 'once' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
12
+ /** @field The starting point for the bidding on the query */
13
+ minBid?: number;
14
+ }
15
+ export type Query<T extends void | EmptyObject | WithSchema = void, S extends Schema | void = void> = Payload<T extends void ? QueryFields : T & QueryFields, S extends void ? T extends WithSchema ? T['schema'] : T extends void ? Schema : void : S>;
16
+ //# sourceMappingURL=Query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAA;IAE7B,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,4DAA4D;IAC5D,YAAY,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;IAExF,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,EAAE,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,IAAI,IAAI,OAAO,CAC3G,CAAC,SAAS,IAAI,GAAG,WAAW,GAAG,CAAC,GAAG,WAAW,EAC9C,CAAC,SAAS,IAAI,GACZ,CAAC,SAAS,UAAU,GAAG,CAAC,CAAC,QAAQ,CAAC,GAC9B,CAAC,SAAS,IAAI,GAAG,MAAM,GACrB,IAAI,GACR,CAAC,CACN,CAAA"}
@@ -0,0 +1,19 @@
1
+ import type { EmptyObject } from '@xylabs/object';
2
+ export declare const SchemaRegEx: string;
3
+ /** Schema type in Javascript is a string */
4
+ export type Schema = string;
5
+ export declare const PayloadSchema: "network.xyo.payload";
6
+ export type PayloadSchema = typeof PayloadSchema;
7
+ export declare const isSchema: (value: unknown) => value is Schema;
8
+ export declare const asSchema: {
9
+ <TType extends string>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
10
+ <TType extends string>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<string>, config?: import("@xylabs/object").TypeCheckConfig): TType;
11
+ };
12
+ /** Schema fields for a Payload */
13
+ export interface SchemaFields extends EmptyObject {
14
+ /** Schema of the object */
15
+ schema: Schema;
16
+ }
17
+ /** Add the Schema Fields to an object */
18
+ export type WithSchema<T extends EmptyObject | void = void> = T extends EmptyObject ? SchemaFields & T : SchemaFields;
19
+ //# sourceMappingURL=Schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../src/Schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAGjD,eAAO,MAAM,WAAW,QAAiD,CAAA;AAEzE,4CAA4C;AAE5C,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAE3B,eAAO,MAAM,aAAa,EAAG,qBAA8B,CAAA;AAC3D,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA;AAEhD,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAElD,CAAA;AAED,eAAO,MAAM,QAAQ;;;CAAyC,CAAA;AAE9D,kCAAkC;AAClC,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,4BAA4B;IAC5B,MAAM,EAAE,MAAM,CAAA;CACf;AAED,yCAAyC;AACzC,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,WAAW,GAAG,YAAY,GAAG,CAAC,GAAG,YAAY,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { Hash } from '@xylabs/hex';
2
+ import type { Payload } from '../Payload.ts';
3
+ export interface DataHashStorageMeta {
4
+ _dataHash: Hash;
5
+ }
6
+ export type WithDataHashStorageMeta<T extends Payload = Payload> = T & DataHashStorageMeta;
7
+ export type WithPartialDataHashStorageMeta<T extends Payload = Payload> = Partial<WithDataHashStorageMeta<T>>;
8
+ export declare const isDataHashStorageMeta: (value: unknown) => value is DataHashStorageMeta;
9
+ export declare const asDataHashStorageMeta: {
10
+ <TType extends DataHashStorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
11
+ <TType extends DataHashStorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<DataHashStorageMeta>, config?: import("@xylabs/object").TypeCheckConfig): TType;
12
+ };
13
+ export declare const asOptionalDataHashStorageMeta: <TType extends DataHashStorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise) => TType | undefined;
14
+ //# sourceMappingURL=DataHash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataHash.d.ts","sourceRoot":"","sources":["../../../src/StorageMeta/DataHash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAIvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG,mBAAmB,CAAA;AAC1F,MAAM,MAAM,8BAA8B,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAA;AAE7G,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,mBAE/D,CAAA;AAED,eAAO,MAAM,qBAAqB;sDAPjB,qDAAiB,iCAAiC,gBAAoB;sDACZ,qDAAiB,8GAEf,gBACrE;CAG+F,CAAA;AACvG,eAAO,MAAM,6BAA6B,oDADsC,qDAAiB,qCACsB,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { Hash } from '@xylabs/hex';
2
+ import type { Payload } from '../Payload.ts';
3
+ import type { DataHashStorageMeta } from './DataHash.ts';
4
+ export interface HashStorageMeta extends DataHashStorageMeta {
5
+ _hash: Hash;
6
+ }
7
+ export type WithHashStorageMeta<T extends Payload = Payload> = T & HashStorageMeta;
8
+ export type WithPartialHashStorageMeta<T extends Payload = Payload> = Partial<WithHashStorageMeta<T>>;
9
+ export declare const isHashStorageMeta: (value: unknown) => value is HashStorageMeta;
10
+ export declare const asHashStorageMeta: {
11
+ <TType extends HashStorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
12
+ <TType extends HashStorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<HashStorageMeta>, config?: import("@xylabs/object").TypeCheckConfig): TType;
13
+ };
14
+ export declare const asOptionalHashStorageMeta: <TType extends HashStorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise) => TType | undefined;
15
+ //# sourceMappingURL=Hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hash.d.ts","sourceRoot":"","sources":["../../../src/StorageMeta/Hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAIvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGxD,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D,KAAK,EAAE,IAAI,CAAA;CACZ;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG,eAAe,CAAA;AAClF,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAA;AAErG,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,eAE3D,CAAA;AAED,eAAO,MAAM,iBAAiB;kDAbT,qDAAiB,iCAErB,gBAAmB;kDAID,qDAAiB,0GACa,gBAAoB;CAMM,CAAA;AAC3F,eAAO,MAAM,yBAAyB,gDAJC,qDAAiB,qCAImD,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { Payload } from '../Payload.ts';
2
+ import type { Sequence } from './sequence/index.ts';
3
+ export interface SequenceStorageMeta {
4
+ _sequence: Sequence;
5
+ }
6
+ export type WithSequenceStorageMeta<T extends Payload = Payload> = T & SequenceStorageMeta;
7
+ export type WithPartialSequenceStorageMeta<T extends Payload = Payload> = Partial<WithSequenceStorageMeta<T>>;
8
+ export declare const isSequenceStorageMeta: (value: unknown) => value is SequenceStorageMeta;
9
+ export declare const asSequenceStorageMeta: {
10
+ <TType extends SequenceStorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
11
+ <TType extends SequenceStorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<SequenceStorageMeta>, config?: import("@xylabs/object").TypeCheckConfig): TType;
12
+ };
13
+ export declare const asOptionalSequenceStorageMeta: <TType extends SequenceStorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise) => TType | undefined;
14
+ //# sourceMappingURL=Sequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sequence.d.ts","sourceRoot":"","sources":["../../../src/StorageMeta/Sequence.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,QAAQ,CAAA;CACpB;AAED,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG,mBAAmB,CAAA;AAC1F,MAAM,MAAM,8BAA8B,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAA;AAE7G,eAAO,MAAM,qBAAqB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,mBAE/D,CAAA;AAED,eAAO,MAAM,qBAAqB;sDAPI,qDAAiB,iCAAiC,gBACvE;sDAA+E,qDAE9F,8GACO,gBAAoB;CAGqD,CAAA;AAClF,eAAO,MAAM,6BAA6B,oDAA7B,qDAAiB,qCAAoE,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { Payload } from '../Payload.ts';
2
+ import type { HashStorageMeta } from './Hash.ts';
3
+ import type { SequenceStorageMeta } from './Sequence.ts';
4
+ export interface StorageMeta extends SequenceStorageMeta, HashStorageMeta {
5
+ }
6
+ export type WithStorageMeta<T extends Payload = Payload> = T & StorageMeta;
7
+ export type WithPartialStorageMeta<T extends Payload = Payload> = T & Partial<StorageMeta>;
8
+ export declare const isStorageMeta: (value: unknown) => value is StorageMeta;
9
+ export declare const asStorageStorageMeta: {
10
+ <TType extends StorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, config?: import("@xylabs/object").TypeCheckConfig): TType | undefined;
11
+ <TType extends StorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise, assert: import("@xylabs/object").StringOrAlertFunction<StorageMeta>, config?: import("@xylabs/object").TypeCheckConfig): TType;
12
+ };
13
+ export declare const asOptionalStorageMeta: <TType extends StorageMeta>(value: import(".store/@xylabs-promise-npm-4.5.1-97d36b712b/package").AnyNonPromise) => TType | undefined;
14
+ //# sourceMappingURL=StorageMeta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageMeta.d.ts","sourceRoot":"","sources":["../../../src/StorageMeta/StorageMeta.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAGxD,MAAM,WAAW,WAAY,SAAQ,mBAAmB,EAAE,eAAe;CAAG;AAE5E,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG,WAAW,CAAA;AAC1E,MAAM,MAAM,sBAAsB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAE1F,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAEvD,CAAA;AAED,eAAO,MAAM,oBAAoB;8CAX9B,qDAAiB,iCAEpB,gBAAkB;8CAEC,qDAAiB,sGACqB,gBAAoB;CAMJ,CAAA;AACzE,eAAO,MAAM,qBAAqB,4CAJgB,qDACjD,qCAGiF,CAAA"}
@@ -0,0 +1,6 @@
1
+ export * from './DataHash.ts';
2
+ export * from './Hash.ts';
3
+ export * from './Sequence.ts';
4
+ export * from './sequence/index.ts';
5
+ export * from './StorageMeta.ts';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/StorageMeta/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import type { Compare } from '@xylabs/object';
2
+ export declare const SequenceComparer: {
3
+ local: Compare<Lowercase<string>>;
4
+ qualified: Compare<Lowercase<string>>;
5
+ };
6
+ //# sourceMappingURL=Comparer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Comparer.d.ts","sourceRoot":"","sources":["../../../../src/StorageMeta/sequence/Comparer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAiB7C,eAAO,MAAM,gBAAgB;;;CAAuB,CAAA"}
@@ -0,0 +1,29 @@
1
+ import type { Address, Hash, Hex } from '@xylabs/hex';
2
+ import type { Epoch, LocalSequence, Nonce, QualifiedSequence, Sequence } from './Sequence.ts';
3
+ export declare class SequenceParser {
4
+ protected static privateConstructorKey: string;
5
+ private readonly data;
6
+ protected constructor(privateConstructorKey: string, hex: Hex);
7
+ get address(): Address;
8
+ get epoch(): Epoch;
9
+ get localSequence(): LocalSequence;
10
+ get nonce(): Nonce;
11
+ get qualifiedSequence(): QualifiedSequence;
12
+ static from(sequence: Sequence, address?: Address): SequenceParser;
13
+ static from(timestamp: Hex, hash: Hash, address?: Address): SequenceParser;
14
+ static from(timestamp: Hex, hash: Hex, address?: Address): SequenceParser;
15
+ static from(timestamp: Hex, nonce: Nonce, address?: Address): SequenceParser;
16
+ static from(timestamp: Hex, hash: Hash, index?: number, address?: Address): SequenceParser;
17
+ static from(timestamp: Hex, hash: Hex, index?: number, address?: Address): SequenceParser;
18
+ static from(timestamp: Hex, nonce: Nonce, index?: number, address?: Address): SequenceParser;
19
+ static from(timestamp: number, hash: Hash, address?: Address): SequenceParser;
20
+ static from(timestamp: number, hash: Hex, address?: Address): SequenceParser;
21
+ static from(timestamp: number, nonce: Nonce, address?: Address): SequenceParser;
22
+ static from(timestamp: number, hash: Hash, index?: number, address?: Address): SequenceParser;
23
+ static from(timestamp: number, hash: Hex, index?: number, address?: Address): SequenceParser;
24
+ static from(timestamp: number, nonce: Nonce, index?: number, address?: Address): SequenceParser;
25
+ static parse(value: Hex | string | ArrayBufferLike): SequenceParser;
26
+ static toEpoch(value: number | Hex | Epoch): Epoch;
27
+ static toNonce(value: Hash | Hex, index?: number): Nonce;
28
+ }
29
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,GAAG,GAAG,GAAG,KAAK,GAAG,KAAK;IAgBlD,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,GAAG,EAAE,KAAK,SAAI,GAAG,KAAK;CAapD"}
@@ -0,0 +1,71 @@
1
+ import type { Address, Hex } from '@xylabs/hex';
2
+ export type LocalSequence = Hex & Exclude<string, 'reserved-local-sequence-value'>;
3
+ export type QualifiedSequence = Hex & Exclude<string, 'reserved-qualified-sequence-value'>;
4
+ export type Sequence = LocalSequence | QualifiedSequence;
5
+ export type Epoch = Hex & Exclude<string, 'reserved-epoch-sequence-value'>;
6
+ export declare const isEpoch: (value: unknown) => value is Epoch;
7
+ export type Nonce = Hex & Exclude<string, 'reserved-nonce-sequence-value'>;
8
+ export declare const isNonce: (value: unknown) => value is Epoch;
9
+ export declare const isLocalSequence: (value: unknown) => value is Sequence;
10
+ export declare const isQualifiedSequence: (value: unknown) => value is Sequence;
11
+ export declare const isSequence: (value: unknown) => value is Sequence;
12
+ export declare const SequenceNonceComponentLengths: {
13
+ nonceIndexBytes: number;
14
+ nonceHashBytes: number;
15
+ };
16
+ export declare const SequenceComponentLengths: {
17
+ epochBytes: number;
18
+ nonceBytes: number;
19
+ addressBytes: number;
20
+ nonceIndexBytes: number;
21
+ nonceHashBytes: number;
22
+ };
23
+ export declare const SequenceComponentMinMax: {
24
+ minEpoch: Epoch;
25
+ maxEpoch: Epoch;
26
+ minNonce: Nonce;
27
+ maxNonce: Nonce;
28
+ minAddress: Address;
29
+ maxAddress: Address;
30
+ };
31
+ export declare const LocalSequenceConstants: {
32
+ localSequenceBytes: number;
33
+ minLocalSequence: LocalSequence;
34
+ maxLocalSequence: LocalSequence;
35
+ minEpoch: Epoch;
36
+ maxEpoch: Epoch;
37
+ minNonce: Nonce;
38
+ maxNonce: Nonce;
39
+ minAddress: Address;
40
+ maxAddress: Address;
41
+ epochBytes: number;
42
+ nonceBytes: number;
43
+ addressBytes: number;
44
+ nonceIndexBytes: number;
45
+ nonceHashBytes: number;
46
+ };
47
+ export declare const QualifiedSequenceConstants: {
48
+ qualifiedSequenceBytes: number;
49
+ minQualifiedSequence: QualifiedSequence;
50
+ maxQualifiedSequence: QualifiedSequence;
51
+ };
52
+ export declare const SequenceConstants: {
53
+ qualifiedSequenceBytes: number;
54
+ minQualifiedSequence: QualifiedSequence;
55
+ maxQualifiedSequence: QualifiedSequence;
56
+ localSequenceBytes: number;
57
+ minLocalSequence: LocalSequence;
58
+ maxLocalSequence: LocalSequence;
59
+ minEpoch: Epoch;
60
+ maxEpoch: Epoch;
61
+ minNonce: Nonce;
62
+ maxNonce: Nonce;
63
+ minAddress: Address;
64
+ maxAddress: Address;
65
+ epochBytes: number;
66
+ nonceBytes: number;
67
+ addressBytes: number;
68
+ nonceIndexBytes: number;
69
+ nonceHashBytes: number;
70
+ };
71
+ //# sourceMappingURL=Sequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sequence.d.ts","sourceRoot":"","sources":["../../../../src/StorageMeta/sequence/Sequence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAI/C,MAAM,MAAM,aAAa,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAA;AAClF,MAAM,MAAM,iBAAiB,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,mCAAmC,CAAC,CAAA;AAC1F,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,iBAAiB,CAAA;AAExD,MAAM,MAAM,KAAK,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAA;AAE1E,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,KAEjD,CAAA;AAED,MAAM,MAAM,KAAK,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,+BAA+B,CAAC,CAAA;AAE1E,eAAO,MAAM,OAAO,GAAI,OA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