@xyo-network/sdk-protocol 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.
- package/LICENSE +165 -0
- package/README.md +85 -0
- package/dist/_pkg/account/neutral/Account.d.ts +38 -0
- package/dist/_pkg/account/neutral/Jwt/base64url.d.ts +5 -0
- package/dist/_pkg/account/neutral/Jwt/createJwt.d.ts +3 -0
- package/dist/_pkg/account/neutral/Jwt/decodeJwt.d.ts +3 -0
- package/dist/_pkg/account/neutral/Jwt/digest.d.ts +4 -0
- package/dist/_pkg/account/neutral/Jwt/index.d.ts +6 -0
- package/dist/_pkg/account/neutral/Jwt/verifyJwt.d.ts +3 -0
- package/dist/_pkg/account/neutral/Key/AddressValue.d.ts +11 -0
- package/dist/_pkg/account/neutral/Key/EllipticKey.d.ts +4 -0
- package/dist/_pkg/account/neutral/Key/PrivateKey.d.ts +14 -0
- package/dist/_pkg/account/neutral/Key/PublicKey.d.ts +14 -0
- package/dist/_pkg/account/neutral/Key/index.d.ts +5 -0
- package/dist/_pkg/account/neutral/index.d.ts +6 -0
- package/dist/_pkg/account/neutral/index.mjs +547 -0
- package/dist/_pkg/account/neutral/lib/index.d.ts +2 -0
- package/dist/_pkg/account/neutral/lib/walletPath/combineWalletPaths.d.ts +2 -0
- package/dist/_pkg/account/neutral/lib/walletPath/formatWalletPath.d.ts +2 -0
- package/dist/_pkg/account/neutral/lib/walletPath/index.d.ts +4 -0
- package/dist/_pkg/account/neutral/lib/walletPath/isValidWalletPath.d.ts +3 -0
- package/dist/_pkg/account/neutral/register.d.ts +2 -0
- package/dist/_pkg/account-model/neutral/Account.d.ts +46 -0
- package/dist/_pkg/account-model/neutral/Algorithm.d.ts +5 -0
- package/dist/_pkg/account-model/neutral/Jwt/constants.d.ts +14 -0
- package/dist/_pkg/account-model/neutral/Jwt/index.d.ts +3 -0
- package/dist/_pkg/account-model/neutral/Jwt/types.d.ts +56 -0
- package/dist/_pkg/account-model/neutral/VerifierRegistry.d.ts +6 -0
- package/dist/_pkg/account-model/neutral/addressTo20Bytes.d.ts +2 -0
- package/dist/_pkg/account-model/neutral/index.d.ts +6 -0
- package/dist/_pkg/account-model/neutral/index.mjs +100 -0
- package/dist/_pkg/address/neutral/XyoAddress.d.ts +38 -0
- package/dist/_pkg/address/neutral/XyoLegacyAddress.d.ts +37 -0
- package/dist/_pkg/address/neutral/XyoQuantAddress.d.ts +33 -0
- package/dist/_pkg/address/neutral/index.d.ts +4 -0
- package/dist/_pkg/address/neutral/index.mjs +75 -0
- package/dist/_pkg/api/neutral/Api/Api.d.ts +8 -0
- package/dist/_pkg/api/neutral/Api/index.d.ts +2 -0
- package/dist/_pkg/api/neutral/Base.d.ts +32 -0
- package/dist/_pkg/api/neutral/Simple.d.ts +22 -0
- package/dist/_pkg/api/neutral/WithArchive.d.ts +4 -0
- package/dist/_pkg/api/neutral/index.d.ts +6 -0
- package/dist/_pkg/api/neutral/index.mjs +187 -0
- package/dist/_pkg/api/neutral/models/ArchivePath.d.ts +4 -0
- package/dist/_pkg/api/neutral/models/index.d.ts +2 -0
- package/dist/_pkg/api/neutral/objToQuery.d.ts +2 -0
- package/dist/_pkg/api-models/neutral/Config.d.ts +25 -0
- package/dist/_pkg/api-models/neutral/Envelope.d.ts +15 -0
- package/dist/_pkg/api-models/neutral/Error.d.ts +5 -0
- package/dist/_pkg/api-models/neutral/Reportable.d.ts +8 -0
- package/dist/_pkg/api-models/neutral/Response.d.ts +8 -0
- package/dist/_pkg/api-models/neutral/Warning.d.ts +2 -0
- package/dist/_pkg/api-models/neutral/index.d.ts +7 -0
- package/dist/_pkg/api-models/neutral/index.mjs +1 -0
- package/dist/_pkg/boundwitness/neutral/builder.d.ts +2 -0
- package/dist/_pkg/boundwitness/neutral/builder.mjs +3 -0
- package/dist/_pkg/boundwitness/neutral/index.d.ts +5 -0
- package/dist/_pkg/boundwitness/neutral/index.mjs +6 -0
- package/dist/_pkg/boundwitness/neutral/model.d.ts +2 -0
- package/dist/_pkg/boundwitness/neutral/model.mjs +3 -0
- package/dist/_pkg/boundwitness/neutral/validator.d.ts +2 -0
- package/dist/_pkg/boundwitness/neutral/validator.mjs +3 -0
- package/dist/_pkg/boundwitness/neutral/wrapper.d.ts +2 -0
- package/dist/_pkg/boundwitness/neutral/wrapper.mjs +3 -0
- package/dist/_pkg/boundwitness-builder/neutral/BoundWitnessBuilder.d.ts +48 -0
- package/dist/_pkg/boundwitness-builder/neutral/GeneratedBoundWitnessFields.d.ts +3 -0
- package/dist/_pkg/boundwitness-builder/neutral/Query/QueryBoundWitnessBuilder.d.ts +9 -0
- package/dist/_pkg/boundwitness-builder/neutral/Query/index.d.ts +2 -0
- package/dist/_pkg/boundwitness-builder/neutral/combinationsByBoundwitness.d.ts +10 -0
- package/dist/_pkg/boundwitness-builder/neutral/index.d.ts +5 -0
- package/dist/_pkg/boundwitness-builder/neutral/index.mjs +311 -0
- package/dist/_pkg/boundwitness-builder/neutral/intraBoundwitnessSchemaCombinations.d.ts +11 -0
- package/dist/_pkg/boundwitness-builder/neutral/uniqueAccounts.d.ts +3 -0
- package/dist/_pkg/boundwitness-builder/neutral/uniqueAddresses.d.ts +3 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/BoundWitness.d.ts +173 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/BoundWitnessJsonSchema.d.ts +37 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/BoundWitnessSchema.d.ts +5 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/HydratedBoundWitness.d.ts +72 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/Signatures.d.ts +14 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/SignedBoundWitness.d.ts +44 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/UnsignedBoundWitness.d.ts +44 -0
- package/dist/_pkg/boundwitness-model/neutral/BoundWitness/index.d.ts +8 -0
- package/dist/_pkg/boundwitness-model/neutral/QueryBoundWitness.d.ts +150 -0
- package/dist/_pkg/boundwitness-model/neutral/index.d.ts +3 -0
- package/dist/_pkg/boundwitness-model/neutral/index.mjs +131 -0
- package/dist/_pkg/boundwitness-validator/neutral/Validator.d.ts +17 -0
- package/dist/_pkg/boundwitness-validator/neutral/index.d.ts +3 -0
- package/dist/_pkg/boundwitness-validator/neutral/index.mjs +177 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/addresses/addressesContains.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/addresses/addressesContainsAll.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/addresses/addressesContainsAny.d.ts +12 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/addresses/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadHashes/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadHashes/payloadHashesContains.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadHashes/payloadHashesContainsAll.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadHashes/payloadHashesContainsAny.d.ts +12 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadSchemas/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadSchemas/payloadSchemasContains.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadSchemas/payloadSchemasContainsAll.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/payloadSchemas/payloadSchemasContainsAny.d.ts +12 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/BoundWitnessArrayProperty.d.ts +10 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/boundWitnessArrayPropertyContains.d.ts +11 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/boundWitnessArrayPropertyContainsAll.d.ts +11 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/boundWitnessArrayPropertyContainsAny.d.ts +13 -0
- package/dist/_pkg/boundwitness-validator/neutral/lib/util/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/BoundWitnessWrapper.d.ts +60 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/QueryBoundWitnessWrapper.d.ts +14 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/SchemaType.d.ts +6 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/index.d.ts +4 -0
- package/dist/_pkg/boundwitness-wrapper/neutral/index.mjs +281 -0
- package/dist/_pkg/config-payload-plugin/neutral/Payload.d.ts +44 -0
- package/dist/_pkg/config-payload-plugin/neutral/Plugin.d.ts +7 -0
- package/dist/_pkg/config-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/config-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/config-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/config-payload-plugin/neutral/index.mjs +44 -0
- package/dist/_pkg/core/neutral/index.d.ts +6 -0
- package/dist/_pkg/core/neutral/index.mjs +7 -0
- package/dist/_pkg/core-payload-plugins/neutral/index.d.ts +11 -0
- package/dist/_pkg/core-payload-plugins/neutral/index.mjs +26 -0
- package/dist/_pkg/crypto/neutral/account-model.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/account-model.mjs +3 -0
- package/dist/_pkg/crypto/neutral/account.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/account.mjs +3 -0
- package/dist/_pkg/crypto/neutral/index.d.ts +10 -0
- package/dist/_pkg/crypto/neutral/index.mjs +11 -0
- package/dist/_pkg/crypto/neutral/key-model.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/key-model.mjs +3 -0
- package/dist/_pkg/crypto/neutral/wallet-model.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/wallet-model.mjs +3 -0
- package/dist/_pkg/crypto/neutral/wallet.d.ts +2 -0
- package/dist/_pkg/crypto/neutral/wallet.mjs +3 -0
- package/dist/_pkg/data/neutral/AbstractData.d.ts +16 -0
- package/dist/_pkg/data/neutral/Data.d.ts +13 -0
- package/dist/_pkg/data/neutral/index.d.ts +3 -0
- package/dist/_pkg/data/neutral/index.mjs +53 -0
- package/dist/_pkg/dns/neutral/DnsRecordType.d.ts +16 -0
- package/dist/_pkg/dns/neutral/DnsReturnCode.d.ts +14 -0
- package/dist/_pkg/dns/neutral/GoogleDnsResult.d.ts +17 -0
- package/dist/_pkg/dns/neutral/GoogleDnsResultAnswer.d.ts +8 -0
- package/dist/_pkg/dns/neutral/GoogleDnsResultQuestion.d.ts +11 -0
- package/dist/_pkg/dns/neutral/domainExists.d.ts +8 -0
- package/dist/_pkg/dns/neutral/domainResolve.d.ts +9 -0
- package/dist/_pkg/dns/neutral/googleDnsOverHttps.d.ts +5 -0
- package/dist/_pkg/dns/neutral/index.d.ts +9 -0
- package/dist/_pkg/dns/neutral/index.mjs +61 -0
- package/dist/_pkg/domain-payload-plugin/neutral/DomainConfigPayload.d.ts +219 -0
- package/dist/_pkg/domain-payload-plugin/neutral/DomainConfigPlugin.d.ts +33 -0
- package/dist/_pkg/domain-payload-plugin/neutral/DomainConfigSchema.d.ts +5 -0
- package/dist/_pkg/domain-payload-plugin/neutral/DomainConfigTemplate.d.ts +3 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Payload.d.ts +282 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Plugin.d.ts +33 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Resolution/DomainSchemaResolver.d.ts +45 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Resolution/SchemaResolution.d.ts +27 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Resolution/XyoDnsRecords.d.ts +27 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Resolution/index.d.ts +4 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/domain-payload-plugin/neutral/Wrapper.d.ts +278 -0
- package/dist/_pkg/domain-payload-plugin/neutral/index.d.ts +11 -0
- package/dist/_pkg/domain-payload-plugin/neutral/index.mjs +485 -0
- package/dist/_pkg/elliptic/neutral/Elliptic.d.ts +15 -0
- package/dist/_pkg/elliptic/neutral/index.d.ts +2 -0
- package/dist/_pkg/elliptic/neutral/index.mjs +89 -0
- package/dist/_pkg/hash/browser/BrowserObjectHasher.d.ts +9 -0
- package/dist/_pkg/hash/browser/NodeObjectHasher.d.ts +6 -0
- package/dist/_pkg/hash/browser/ObjectHasher.d.ts +69 -0
- package/dist/_pkg/hash/browser/createBrowserWorker.d.ts +3 -0
- package/dist/_pkg/hash/browser/createNodeWorker.d.ts +3 -0
- package/dist/_pkg/hash/browser/hasEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/browser/index-browser.d.ts +4 -0
- package/dist/_pkg/hash/browser/index-browser.mjs +289 -0
- package/dist/_pkg/hash/browser/index.d.ts +5 -0
- package/dist/_pkg/hash/browser/removeEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/browser/sortFields.d.ts +3 -0
- package/dist/_pkg/hash/browser/worker/index.d.ts +3 -0
- package/dist/_pkg/hash/browser/worker/subtleHash-bundle.mjs +257 -0
- package/dist/_pkg/hash/browser/worker/subtleHash.d.ts +2 -0
- package/dist/_pkg/hash/browser/worker/subtleHashNode.d.ts +2 -0
- package/dist/_pkg/hash/browser/worker/wasmHash-bundle.mjs +1678 -0
- package/dist/_pkg/hash/browser/worker/wasmHash.d.ts +2 -0
- package/dist/_pkg/hash/browser/worker/wasmHashNode.d.ts +2 -0
- package/dist/_pkg/hash/neutral/BrowserObjectHasher.d.ts +9 -0
- package/dist/_pkg/hash/neutral/NodeObjectHasher.d.ts +6 -0
- package/dist/_pkg/hash/neutral/ObjectHasher.d.ts +69 -0
- package/dist/_pkg/hash/neutral/createBrowserWorker.d.ts +3 -0
- package/dist/_pkg/hash/neutral/createNodeWorker.d.ts +3 -0
- package/dist/_pkg/hash/neutral/hasEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/neutral/index-browser.d.ts +4 -0
- package/dist/_pkg/hash/neutral/index-browser.mjs +289 -0
- package/dist/_pkg/hash/neutral/index.d.ts +5 -0
- package/dist/_pkg/hash/neutral/removeEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/neutral/sortFields.d.ts +3 -0
- package/dist/_pkg/hash/neutral/worker/index.d.ts +3 -0
- package/dist/_pkg/hash/neutral/worker/subtleHash.d.ts +2 -0
- package/dist/_pkg/hash/neutral/worker/subtleHashNode.d.ts +2 -0
- package/dist/_pkg/hash/neutral/worker/wasmHash.d.ts +2 -0
- package/dist/_pkg/hash/neutral/worker/wasmHashNode.d.ts +2 -0
- package/dist/_pkg/hash/node/BrowserObjectHasher.d.ts +9 -0
- package/dist/_pkg/hash/node/NodeObjectHasher.d.ts +6 -0
- package/dist/_pkg/hash/node/ObjectHasher.d.ts +69 -0
- package/dist/_pkg/hash/node/createBrowserWorker.d.ts +3 -0
- package/dist/_pkg/hash/node/createNodeWorker.d.ts +3 -0
- package/dist/_pkg/hash/node/hasEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/node/index-browser.d.ts +4 -0
- package/dist/_pkg/hash/node/index.d.ts +5 -0
- package/dist/_pkg/hash/node/index.mjs +279 -0
- package/dist/_pkg/hash/node/removeEmptyFields.d.ts +3 -0
- package/dist/_pkg/hash/node/sortFields.d.ts +3 -0
- package/dist/_pkg/hash/node/worker/index.d.ts +3 -0
- package/dist/_pkg/hash/node/worker/subtleHash.d.ts +2 -0
- package/dist/_pkg/hash/node/worker/subtleHashNode.d.ts +2 -0
- package/dist/_pkg/hash/node/worker/wasmHash.d.ts +2 -0
- package/dist/_pkg/hash/node/worker/wasmHashNode.d.ts +2 -0
- package/dist/_pkg/huri/neutral/Huri.d.ts +33 -0
- package/dist/_pkg/huri/neutral/index.d.ts +2 -0
- package/dist/_pkg/huri/neutral/index.mjs +118 -0
- package/dist/_pkg/id-payload-plugin/neutral/Payload.d.ts +86 -0
- package/dist/_pkg/id-payload-plugin/neutral/Plugin.d.ts +7 -0
- package/dist/_pkg/id-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/id-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/id-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/id-payload-plugin/neutral/index.mjs +48 -0
- package/dist/_pkg/key-model/neutral/Key/AddressValue.d.ts +10 -0
- package/dist/_pkg/key-model/neutral/Key/EllipticKey.d.ts +4 -0
- package/dist/_pkg/key-model/neutral/Key/PrivateKey.d.ts +15 -0
- package/dist/_pkg/key-model/neutral/Key/PublicKey.d.ts +11 -0
- package/dist/_pkg/key-model/neutral/Key/index.d.ts +4 -0
- package/dist/_pkg/key-model/neutral/index.d.ts +2 -0
- package/dist/_pkg/key-model/neutral/index.mjs +1 -0
- package/dist/_pkg/manifest/neutral/index.d.ts +2 -0
- package/dist/_pkg/manifest/neutral/index.mjs +3 -0
- package/dist/_pkg/manifest-model/neutral/Manifest.d.ts +4 -0
- package/dist/_pkg/manifest-model/neutral/Manifest.zod.d.ts +2619 -0
- package/dist/_pkg/manifest-model/neutral/Payload.d.ts +2 -0
- package/dist/_pkg/manifest-model/neutral/Payload.zod.d.ts +1591 -0
- package/dist/_pkg/manifest-model/neutral/index.d.ts +3 -0
- package/dist/_pkg/manifest-model/neutral/index.mjs +193 -0
- package/dist/_pkg/metamask-connector/browser/MetaMaskConnector.d.ts +38 -0
- package/dist/_pkg/metamask-connector/browser/index.d.ts +2 -0
- package/dist/_pkg/metamask-connector/browser/index.mjs +114 -0
- package/dist/_pkg/network/neutral/NetworkNodePayload.d.ts +79 -0
- package/dist/_pkg/network/neutral/NetworkNodePayloadWrapper.d.ts +17 -0
- package/dist/_pkg/network/neutral/NetworkPayload.d.ts +119 -0
- package/dist/_pkg/network/neutral/NetworkPayloadWrapper.d.ts +63 -0
- package/dist/_pkg/network/neutral/index.d.ts +8 -0
- package/dist/_pkg/network/neutral/index.mjs +211 -0
- package/dist/_pkg/network/neutral/knownArchivists.d.ts +3 -0
- package/dist/_pkg/network/neutral/knownDiviners.d.ts +3 -0
- package/dist/_pkg/network/neutral/knownNetworks.d.ts +3 -0
- package/dist/_pkg/payload/neutral/builder.d.ts +2 -0
- package/dist/_pkg/payload/neutral/builder.mjs +3 -0
- package/dist/_pkg/payload/neutral/index.d.ts +6 -0
- package/dist/_pkg/payload/neutral/index.mjs +7 -0
- package/dist/_pkg/payload/neutral/model.d.ts +2 -0
- package/dist/_pkg/payload/neutral/model.mjs +3 -0
- package/dist/_pkg/payload/neutral/validator.d.ts +2 -0
- package/dist/_pkg/payload/neutral/validator.mjs +3 -0
- package/dist/_pkg/payload/neutral/wrapper.d.ts +2 -0
- package/dist/_pkg/payload/neutral/wrapper.mjs +3 -0
- package/dist/_pkg/payload-builder/neutral/Builder.d.ts +70 -0
- package/dist/_pkg/payload-builder/neutral/Options.d.ts +7 -0
- package/dist/_pkg/payload-builder/neutral/index.d.ts +3 -0
- package/dist/_pkg/payload-builder/neutral/index.mjs +218 -0
- package/dist/_pkg/payload-model/neutral/Error.d.ts +65 -0
- package/dist/_pkg/payload-model/neutral/Payload.d.ts +35 -0
- package/dist/_pkg/payload-model/neutral/PayloadBundle.d.ts +72 -0
- package/dist/_pkg/payload-model/neutral/PayloadFindFilter.d.ts +6 -0
- package/dist/_pkg/payload-model/neutral/PayloadHashMap.d.ts +7 -0
- package/dist/_pkg/payload-model/neutral/PayloadSet/PayloadSetPayload.d.ts +54 -0
- package/dist/_pkg/payload-model/neutral/PayloadSet/PayloadSetSchema.d.ts +5 -0
- package/dist/_pkg/payload-model/neutral/PayloadSet/index.d.ts +3 -0
- package/dist/_pkg/payload-model/neutral/PayloadValidationFunction.d.ts +14 -0
- package/dist/_pkg/payload-model/neutral/PayloadValueExpression.d.ts +38 -0
- package/dist/_pkg/payload-model/neutral/PayloadZod.d.ts +173 -0
- package/dist/_pkg/payload-model/neutral/Query.d.ts +21 -0
- package/dist/_pkg/payload-model/neutral/Schema.d.ts +38 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/DataHash.d.ts +24 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/Hash.d.ts +25 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/Sequence.d.ts +11 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/index.d.ts +3 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/Comparer.d.ts +7 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/Parser.d.ts +31 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/Sequence.d.ts +80 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/SequenceZod.d.ts +9 -0
- package/dist/_pkg/payload-model/neutral/StorageMeta/sequence/index.d.ts +5 -0
- package/dist/_pkg/payload-model/neutral/Timestamp.d.ts +8 -0
- package/dist/_pkg/payload-model/neutral/index.d.ts +16 -0
- package/dist/_pkg/payload-model/neutral/index.mjs +452 -0
- package/dist/_pkg/payload-model/neutral/isPayloadOfSchemaType.d.ts +5 -0
- package/dist/_pkg/payload-model/neutral/isPayloadOfZodType.d.ts +12 -0
- package/dist/_pkg/payload-plugin/neutral/Plugin.d.ts +19 -0
- package/dist/_pkg/payload-plugin/neutral/Resolver.d.ts +26 -0
- package/dist/_pkg/payload-plugin/neutral/createPlugin.d.ts +5 -0
- package/dist/_pkg/payload-plugin/neutral/index.d.ts +4 -0
- package/dist/_pkg/payload-plugin/neutral/index.mjs +67 -0
- package/dist/_pkg/payload-validator/neutral/Validator.d.ts +18 -0
- package/dist/_pkg/payload-validator/neutral/index.d.ts +2 -0
- package/dist/_pkg/payload-validator/neutral/index.mjs +40 -0
- package/dist/_pkg/payload-wrapper/neutral/PayloadDataWrapper.d.ts +18 -0
- package/dist/_pkg/payload-wrapper/neutral/PayloadWrapper.d.ts +6 -0
- package/dist/_pkg/payload-wrapper/neutral/PayloadWrapperBase.d.ts +23 -0
- package/dist/_pkg/payload-wrapper/neutral/SchemaType.d.ts +6 -0
- package/dist/_pkg/payload-wrapper/neutral/index.d.ts +4 -0
- package/dist/_pkg/payload-wrapper/neutral/index.mjs +157 -0
- package/dist/_pkg/pqc/neutral/MlDsa.d.ts +20 -0
- package/dist/_pkg/pqc/neutral/index.d.ts +2 -0
- package/dist/_pkg/pqc/neutral/index.mjs +47 -0
- package/dist/_pkg/previous-hash-store/neutral/index.d.ts +4 -0
- package/dist/_pkg/previous-hash-store/neutral/index.mjs +5 -0
- package/dist/_pkg/previous-hash-store-indexeddb/neutral/IndexedDbPreviousHashStore.d.ts +27 -0
- package/dist/_pkg/previous-hash-store-indexeddb/neutral/index.d.ts +2 -0
- package/dist/_pkg/previous-hash-store-indexeddb/neutral/index.mjs +42 -0
- package/dist/_pkg/previous-hash-store-model/neutral/PreviousHashStore.d.ts +8 -0
- package/dist/_pkg/previous-hash-store-model/neutral/index.d.ts +2 -0
- package/dist/_pkg/previous-hash-store-model/neutral/index.mjs +1 -0
- package/dist/_pkg/previous-hash-store-storage/neutral/NamespacedStorage.d.ts +10 -0
- package/dist/_pkg/previous-hash-store-storage/neutral/StoragePreviousHashStore.d.ts +24 -0
- package/dist/_pkg/previous-hash-store-storage/neutral/index.d.ts +3 -0
- package/dist/_pkg/previous-hash-store-storage/neutral/index.mjs +104 -0
- package/dist/_pkg/protocol/neutral/index.d.ts +5 -0
- package/dist/_pkg/protocol/neutral/index.mjs +6 -0
- package/dist/_pkg/quadkey/neutral/Quadkey.d.ts +65 -0
- package/dist/_pkg/quadkey/neutral/RelativeDirectionConstantLookup.d.ts +2 -0
- package/dist/_pkg/quadkey/neutral/index.d.ts +2 -0
- package/dist/_pkg/quadkey/neutral/index.mjs +281 -0
- package/dist/_pkg/quant-account/neutral/QuantAccount.d.ts +34 -0
- package/dist/_pkg/quant-account/neutral/index.d.ts +3 -0
- package/dist/_pkg/quant-account/neutral/index.mjs +173 -0
- package/dist/_pkg/quant-account/neutral/register.d.ts +2 -0
- package/dist/_pkg/query-payload-plugin/neutral/Payload.d.ts +43 -0
- package/dist/_pkg/query-payload-plugin/neutral/Plugin.d.ts +7 -0
- package/dist/_pkg/query-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/query-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/query-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/query-payload-plugin/neutral/index.mjs +44 -0
- package/dist/_pkg/schema-cache/neutral/Debounce.d.ts +5 -0
- package/dist/_pkg/schema-cache/neutral/SchemaCache.d.ts +43 -0
- package/dist/_pkg/schema-cache/neutral/SchemaNameToValidatorMap.d.ts +12 -0
- package/dist/_pkg/schema-cache/neutral/TtlLruCache.d.ts +13 -0
- package/dist/_pkg/schema-cache/neutral/index.d.ts +5 -0
- package/dist/_pkg/schema-cache/neutral/index.mjs +178 -0
- package/dist/_pkg/schema-name-validator/neutral/SchemaNameValidator.d.ts +43 -0
- package/dist/_pkg/schema-name-validator/neutral/index.d.ts +2 -0
- package/dist/_pkg/schema-name-validator/neutral/index.mjs +69 -0
- package/dist/_pkg/schema-payload-plugin/neutral/Payload.d.ts +96 -0
- package/dist/_pkg/schema-payload-plugin/neutral/Plugin.d.ts +13 -0
- package/dist/_pkg/schema-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/schema-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/schema-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/schema-payload-plugin/neutral/index.mjs +60 -0
- package/dist/_pkg/sdk-utils/neutral/api.d.ts +5 -0
- package/dist/_pkg/sdk-utils/neutral/api.mjs +6 -0
- package/dist/_pkg/sdk-utils/neutral/index.d.ts +9 -0
- package/dist/_pkg/sdk-utils/neutral/index.mjs +10 -0
- package/dist/_pkg/sdk-utils/neutral/integrations.d.ts +3 -0
- package/dist/_pkg/sdk-utils/neutral/integrations.mjs +4 -0
- package/dist/_pkg/sdk-utils/neutral/plugins.d.ts +2 -0
- package/dist/_pkg/sdk-utils/neutral/plugins.mjs +3 -0
- package/dist/_pkg/sdk-utils/neutral/validation.d.ts +2 -0
- package/dist/_pkg/sdk-utils/neutral/validation.mjs +3 -0
- package/dist/_pkg/value-payload-plugin/neutral/Payload.d.ts +46 -0
- package/dist/_pkg/value-payload-plugin/neutral/Plugin.d.ts +3 -0
- package/dist/_pkg/value-payload-plugin/neutral/Schema.d.ts +5 -0
- package/dist/_pkg/value-payload-plugin/neutral/Template.d.ts +3 -0
- package/dist/_pkg/value-payload-plugin/neutral/index.d.ts +5 -0
- package/dist/_pkg/value-payload-plugin/neutral/index.mjs +44 -0
- package/dist/_pkg/wallet/neutral/HDWallet.d.ts +38 -0
- package/dist/_pkg/wallet/neutral/index.d.ts +2 -0
- package/dist/_pkg/wallet/neutral/index.mjs +157 -0
- package/dist/_pkg/wallet-model/neutral/Mnemonic.d.ts +27 -0
- package/dist/_pkg/wallet-model/neutral/Wallet.d.ts +26 -0
- package/dist/_pkg/wallet-model/neutral/Wordlist.d.ts +24 -0
- package/dist/_pkg/wallet-model/neutral/index.d.ts +2 -0
- package/dist/_pkg/wallet-model/neutral/index.mjs +1 -0
- package/dist/_pkg/wasm/neutral/WasmSupport.d.ts +110 -0
- package/dist/_pkg/wasm/neutral/index.d.ts +2 -0
- package/dist/_pkg/wasm/neutral/index.mjs +178 -0
- package/dist/_pkg/wasm/neutral/wasmFeatureDetect.d.ts +16 -0
- package/dist/neutral/core-payload-plugins.d.ts +1 -0
- package/dist/neutral/core-payload-plugins.mjs +1 -0
- package/dist/neutral/index.d.ts +4 -0
- package/dist/neutral/index.mjs +4 -0
- package/dist/neutral/manifest.d.ts +1 -0
- package/dist/neutral/manifest.mjs +1 -0
- package/dist/neutral/protocol.d.ts +1 -0
- package/dist/neutral/protocol.mjs +1 -0
- package/dist/neutral/sdk-utils.d.ts +1 -0
- package/dist/neutral/sdk-utils.mjs +1 -0
- package/package.json +113 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/hasEmptyFields.ts
|
|
9
|
+
import { typeOf } from "@xylabs/sdk";
|
|
10
|
+
var hasEmptyFields = (obj) => {
|
|
11
|
+
if (obj == null || Array.isArray(obj)) return false;
|
|
12
|
+
if (obj == void 0 || Object.keys(obj).length === 0) return true;
|
|
13
|
+
for (const [value] of Object.values(obj)) {
|
|
14
|
+
if (typeOf(value) === "object") {
|
|
15
|
+
if (hasEmptyFields(value)) return true;
|
|
16
|
+
} else if (value === void 0) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// src/createNodeWorker.ts
|
|
24
|
+
import { Worker } from "@xylabs/threads/master";
|
|
25
|
+
var createNodeWorker = (func) => {
|
|
26
|
+
try {
|
|
27
|
+
const code = func?.toString().slice(6) ?? "";
|
|
28
|
+
return new Worker(
|
|
29
|
+
code,
|
|
30
|
+
{ fromSource: true }
|
|
31
|
+
);
|
|
32
|
+
} catch {
|
|
33
|
+
throw new Error("Unable to create worker");
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/ObjectHasher.ts
|
|
38
|
+
import {
|
|
39
|
+
asHash,
|
|
40
|
+
assertEx,
|
|
41
|
+
hexFromArrayBuffer,
|
|
42
|
+
ObjectWrapper,
|
|
43
|
+
omitBy
|
|
44
|
+
} from "@xylabs/sdk";
|
|
45
|
+
import { Pool, spawn } from "@xylabs/threads/master";
|
|
46
|
+
import { WasmSupport } from "../../wasm/neutral/index.mjs";
|
|
47
|
+
import { sha256 } from "hash-wasm";
|
|
48
|
+
|
|
49
|
+
// src/removeEmptyFields.ts
|
|
50
|
+
import { typeOf as typeOf2 } from "@xylabs/sdk";
|
|
51
|
+
var removeEmptyFields = (obj) => {
|
|
52
|
+
if (obj == null) return obj;
|
|
53
|
+
if (Array.isArray(obj)) {
|
|
54
|
+
const arr = obj;
|
|
55
|
+
return arr.map((value) => typeof value === "object" ? removeEmptyFields(value) : value);
|
|
56
|
+
}
|
|
57
|
+
const newObject = {};
|
|
58
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
59
|
+
if (typeOf2(value) === "object") {
|
|
60
|
+
newObject[key] = removeEmptyFields(value);
|
|
61
|
+
} else if (value !== void 0) {
|
|
62
|
+
newObject[key] = value;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return newObject;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/sortFields.ts
|
|
69
|
+
import { isObject } from "@xylabs/sdk";
|
|
70
|
+
var subSort = (value) => {
|
|
71
|
+
return isObject(value) ? sortFields(value) : value;
|
|
72
|
+
};
|
|
73
|
+
var sortFields = (obj) => {
|
|
74
|
+
const result = {};
|
|
75
|
+
const keys = Object.keys(obj);
|
|
76
|
+
for (const key of keys.toSorted()) {
|
|
77
|
+
result[key] = subSort(obj[key]);
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// src/worker/subtleHashNode.ts
|
|
83
|
+
var subtleHashFunc = () => {
|
|
84
|
+
const { subtle } = __require("@xylabs/platform");
|
|
85
|
+
const { expose } = __require("@xylabs/threads/worker");
|
|
86
|
+
expose({ hash: async (data) => await subtle.digest("SHA-256", data) });
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/worker/wasmHashNode.ts
|
|
90
|
+
var wasmHashFunc = () => {
|
|
91
|
+
const { sha256: sha2562 } = __require("hash-wasm");
|
|
92
|
+
const { asHash: asHash2 } = __require("@xylabs/hex");
|
|
93
|
+
const { expose } = __require("@xylabs/threads/worker");
|
|
94
|
+
expose({ hash: async (data) => asHash2(await sha2562(data), true) });
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// src/ObjectHasher.ts
|
|
98
|
+
var wasmSupportStatic = new WasmSupport(["bigInt"]);
|
|
99
|
+
var omitByPredicate = (prefix) => (_, key) => {
|
|
100
|
+
assertEx(typeof key === "string", () => `Invalid key type [${String(key)}, ${typeof key}]`);
|
|
101
|
+
return String(key).startsWith(prefix);
|
|
102
|
+
};
|
|
103
|
+
var ObjectHasher = class _ObjectHasher extends ObjectWrapper {
|
|
104
|
+
static allowHashPooling = true;
|
|
105
|
+
static allowSubtle = true;
|
|
106
|
+
static createBrowserWorker;
|
|
107
|
+
static createNodeWorker;
|
|
108
|
+
static subtleHashWorkerUrl;
|
|
109
|
+
static warnIfUsingJsHash = true;
|
|
110
|
+
static wasmHashWorkerUrl;
|
|
111
|
+
static wasmInitialized = wasmSupportStatic.initialize();
|
|
112
|
+
static wasmSupport = wasmSupportStatic;
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
114
|
+
static _subtleHashPool;
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
|
+
static _wasmHashPool;
|
|
117
|
+
static get subtleHashPool() {
|
|
118
|
+
if (!this.allowHashPooling || this._subtleHashPool === null) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
return this._subtleHashPool = this._subtleHashPool ?? (this.subtleHashWorkerUrl ? this.createWorkerPool(this.subtleHashWorkerUrl, subtleHashFunc) : null);
|
|
123
|
+
} catch {
|
|
124
|
+
console.warn("Creating subtle hash worker failed");
|
|
125
|
+
this._subtleHashPool = null;
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
static get wasmHashPool() {
|
|
130
|
+
if (!this.allowHashPooling || this._wasmHashPool === null) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
return this._wasmHashPool = this._wasmHashPool ?? (this.wasmHashWorkerUrl ? this.createWorkerPool(this.wasmHashWorkerUrl, wasmHashFunc) : null);
|
|
135
|
+
} catch {
|
|
136
|
+
console.warn("Creating wasm hash worker failed");
|
|
137
|
+
this._wasmHashPool = null;
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
static createWorker(url, func) {
|
|
142
|
+
if (url) console.debug(`createWorker: ${url.href}`);
|
|
143
|
+
return assertEx(this.createBrowserWorker?.(url) ?? this.createNodeWorker?.(func), () => "Unable to create worker");
|
|
144
|
+
}
|
|
145
|
+
static async filterExcludeByHash(objs = [], hash) {
|
|
146
|
+
const hashes = Array.isArray(hash) ? hash : [hash];
|
|
147
|
+
const pairs = await this.hashPairs(objs);
|
|
148
|
+
return pairs.filter(([_, objHash]) => !hashes.includes(objHash))?.map((pair) => pair[0]);
|
|
149
|
+
}
|
|
150
|
+
static async filterIncludeByHash(objs = [], hash) {
|
|
151
|
+
const hashes = Array.isArray(hash) ? hash : [hash];
|
|
152
|
+
const pairs = await this.hashPairs(objs);
|
|
153
|
+
return pairs.filter(([_, objHash]) => hashes.includes(objHash))?.map((pair) => pair[0]);
|
|
154
|
+
}
|
|
155
|
+
static async findByHash(objs = [], hash) {
|
|
156
|
+
const pairs = await this.hashPairs(objs);
|
|
157
|
+
return pairs.find(([_, objHash]) => objHash === hash)?.[0];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Asynchronously hashes a payload
|
|
161
|
+
* @param obj A payload
|
|
162
|
+
* @returns The payload hash
|
|
163
|
+
*/
|
|
164
|
+
static async hash(obj) {
|
|
165
|
+
const stringToHash = this.stringifyHashFields(obj);
|
|
166
|
+
const enc = new TextEncoder();
|
|
167
|
+
const data = enc.encode(stringToHash);
|
|
168
|
+
if (_ObjectHasher.allowSubtle) {
|
|
169
|
+
try {
|
|
170
|
+
const hashArray = await this.subtleHash(data);
|
|
171
|
+
return hexFromArrayBuffer(hashArray, { bitLength: 256 });
|
|
172
|
+
} catch {
|
|
173
|
+
_ObjectHasher.allowSubtle = false;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
await this.wasmInitialized;
|
|
177
|
+
if (_ObjectHasher.wasmSupport.canUseWasm) {
|
|
178
|
+
try {
|
|
179
|
+
return await this.wasmHash(data);
|
|
180
|
+
} catch {
|
|
181
|
+
_ObjectHasher.wasmSupport.allowWasm = false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
throw new Error("No subtle or wasm hashing available");
|
|
185
|
+
}
|
|
186
|
+
static async hashBytes(bytes) {
|
|
187
|
+
const bytesArray = new Uint8Array(bytes);
|
|
188
|
+
if (_ObjectHasher.allowSubtle) {
|
|
189
|
+
const hashArray = await this.subtleHash(bytesArray);
|
|
190
|
+
return hexFromArrayBuffer(hashArray, { bitLength: 256 });
|
|
191
|
+
}
|
|
192
|
+
await this.wasmInitialized;
|
|
193
|
+
if (_ObjectHasher.wasmSupport.canUseWasm) {
|
|
194
|
+
return await this.wasmHash(bytesArray);
|
|
195
|
+
}
|
|
196
|
+
throw new Error("No subtle or wasm hashing available");
|
|
197
|
+
}
|
|
198
|
+
static hashFields(obj) {
|
|
199
|
+
const filtered = omitBy(obj, omitByPredicate("_"));
|
|
200
|
+
const cleaned = removeEmptyFields(filtered);
|
|
201
|
+
return sortFields(cleaned);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Creates an array of payload/hash tuples based on the payloads passed in
|
|
205
|
+
* @param objs Any array of payloads
|
|
206
|
+
* @returns An array of payload/hash tuples
|
|
207
|
+
*/
|
|
208
|
+
static async hashPairs(objs) {
|
|
209
|
+
return await Promise.all(objs.map(async (obj) => [obj, await this.hash(obj)]));
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Creates an array of payload hashes based on the payloads passed in
|
|
213
|
+
* @param objs Any array of payloads
|
|
214
|
+
* @returns An array of payload hashes
|
|
215
|
+
*/
|
|
216
|
+
static async hashes(objs) {
|
|
217
|
+
return objs ? await Promise.all(objs.map((obj) => this.hash(obj))) : void 0;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Returns a clone of the payload that is JSON safe
|
|
221
|
+
* @param obj A payload
|
|
222
|
+
* @param meta Keeps underscore (meta) fields if set to true
|
|
223
|
+
* @returns Returns a clone of the payload that is JSON safe
|
|
224
|
+
*/
|
|
225
|
+
static json(payload, meta = false) {
|
|
226
|
+
const source = meta ? payload : omitBy(payload, omitByPredicate("_"));
|
|
227
|
+
const cleaned = removeEmptyFields(source);
|
|
228
|
+
return sortFields(cleaned);
|
|
229
|
+
}
|
|
230
|
+
/** @deprecated us JSON instead */
|
|
231
|
+
static jsonPayload(payload, meta = false) {
|
|
232
|
+
return this.json(payload, meta);
|
|
233
|
+
}
|
|
234
|
+
static stringifyHashFields(obj) {
|
|
235
|
+
return JSON.stringify(this.hashFields(obj));
|
|
236
|
+
}
|
|
237
|
+
static async subtleHash(data) {
|
|
238
|
+
const pool = this.subtleHashPool;
|
|
239
|
+
if (pool === null) return await globalThis.crypto.subtle.digest("SHA-256", data);
|
|
240
|
+
const result = await pool.queue(async (thread) => await thread.hash(data));
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
243
|
+
static async wasmHash(data) {
|
|
244
|
+
const pool = this.wasmHashPool;
|
|
245
|
+
if (pool === null) return asHash(await sha256(data), true);
|
|
246
|
+
const result = await pool.queue(async (thread) => await thread.hash(data));
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
249
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
250
|
+
static createWorkerPool(url, func, size = 8) {
|
|
251
|
+
if (url) console.debug(`createWorkerPool: ${url.href}`);
|
|
252
|
+
const createFunc = () => spawn(this.createWorker(url, func));
|
|
253
|
+
return Pool(createFunc, size);
|
|
254
|
+
}
|
|
255
|
+
async hash() {
|
|
256
|
+
return await _ObjectHasher.hash(this.obj);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Returns a clone of the payload that is JSON safe
|
|
260
|
+
* @param meta Keeps underscore (meta) fields if set to true
|
|
261
|
+
* @returns Returns a clone of the payload that is JSON safe
|
|
262
|
+
*/
|
|
263
|
+
json(meta = false) {
|
|
264
|
+
return _ObjectHasher.json(this.obj, meta);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// src/NodeObjectHasher.ts
|
|
269
|
+
ObjectHasher.createNodeWorker = createNodeWorker;
|
|
270
|
+
var NodeObjectHasher = class extends ObjectHasher {
|
|
271
|
+
static createNodeWorker = createNodeWorker;
|
|
272
|
+
};
|
|
273
|
+
export {
|
|
274
|
+
NodeObjectHasher as ObjectHasher,
|
|
275
|
+
hasEmptyFields,
|
|
276
|
+
removeEmptyFields,
|
|
277
|
+
sortFields
|
|
278
|
+
};
|
|
279
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Hash } from '@xylabs/sdk';
|
|
2
|
+
import type { XyoAddress } from '../../address/neutral/index.ts';
|
|
3
|
+
import type { Payload } from '../../payload-model/neutral/index.ts';
|
|
4
|
+
export type ObjectCategory = 'block' | 'payload';
|
|
5
|
+
export type HuriFetchFunction = (huri: Huri) => Promise<Payload | undefined>;
|
|
6
|
+
export interface HuriOptions {
|
|
7
|
+
archivistUri?: string;
|
|
8
|
+
token?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FetchedPayload<T extends Payload = Payload> {
|
|
11
|
+
huri?: Huri;
|
|
12
|
+
payload: T;
|
|
13
|
+
}
|
|
14
|
+
export declare class Huri<T extends Payload = Payload> {
|
|
15
|
+
private isHuri;
|
|
16
|
+
archive?: string;
|
|
17
|
+
archivist?: XyoAddress | string;
|
|
18
|
+
hash: Hash;
|
|
19
|
+
originalHref: string;
|
|
20
|
+
protocol?: string;
|
|
21
|
+
token?: string;
|
|
22
|
+
constructor(huri: Hash | Huri | string, { archivistUri, token }?: HuriOptions);
|
|
23
|
+
static fetch<T extends Payload = Payload>(huri: Huri): Promise<T | undefined>;
|
|
24
|
+
static isHuri(value: unknown): Huri<Payload> | undefined;
|
|
25
|
+
private static parsePath;
|
|
26
|
+
private static parseProtocol;
|
|
27
|
+
private parsePath;
|
|
28
|
+
private validateParse;
|
|
29
|
+
get href(): string;
|
|
30
|
+
fetch(): Promise<T | undefined>;
|
|
31
|
+
toString(): string;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=Huri.d.ts.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// src/Huri.ts
|
|
2
|
+
import {
|
|
3
|
+
assertEx,
|
|
4
|
+
fetchJson,
|
|
5
|
+
isDefined,
|
|
6
|
+
isHash,
|
|
7
|
+
isString
|
|
8
|
+
} from "@xylabs/sdk";
|
|
9
|
+
import { AddressValue } from "../../account/neutral/index.mjs";
|
|
10
|
+
var Huri = class _Huri {
|
|
11
|
+
isHuri = true;
|
|
12
|
+
archive;
|
|
13
|
+
archivist;
|
|
14
|
+
hash;
|
|
15
|
+
originalHref;
|
|
16
|
+
protocol;
|
|
17
|
+
token;
|
|
18
|
+
constructor(huri, { archivistUri, token } = {}) {
|
|
19
|
+
let huriString;
|
|
20
|
+
const existingHuri = _Huri.isHuri(huri);
|
|
21
|
+
if (existingHuri) {
|
|
22
|
+
huriString = existingHuri.href;
|
|
23
|
+
} else if (typeof huri === "string") {
|
|
24
|
+
huriString = huri;
|
|
25
|
+
} else if (huri instanceof ArrayBuffer) {
|
|
26
|
+
const addressValue = new AddressValue(huri);
|
|
27
|
+
huriString = addressValue.hex;
|
|
28
|
+
} else {
|
|
29
|
+
huriString = huri.href;
|
|
30
|
+
}
|
|
31
|
+
this.originalHref = huriString;
|
|
32
|
+
const protocol = _Huri.parseProtocol(huriString);
|
|
33
|
+
this.protocol = protocol ?? "https";
|
|
34
|
+
const path = assertEx(_Huri.parsePath(huriString), () => "Missing path");
|
|
35
|
+
this.hash = assertEx(this.parsePath(path, protocol !== void 0), () => "Missing hash");
|
|
36
|
+
assertEx(isHash(this.hash), () => `Invalid hash [${this.hash}]`);
|
|
37
|
+
if (isString(archivistUri)) {
|
|
38
|
+
const archivistUriParts = archivistUri.split("://");
|
|
39
|
+
this.protocol = archivistUriParts[0];
|
|
40
|
+
this.archivist = archivistUriParts[1];
|
|
41
|
+
}
|
|
42
|
+
this.token = token;
|
|
43
|
+
this.validateParse();
|
|
44
|
+
}
|
|
45
|
+
static async fetch(huri) {
|
|
46
|
+
const headers = isDefined(huri.token) ? { Authorization: `Bearer ${huri.token}` } : void 0;
|
|
47
|
+
const response = await fetchJson(huri.href, { headers });
|
|
48
|
+
return response.data ?? void 0;
|
|
49
|
+
}
|
|
50
|
+
static isHuri(value) {
|
|
51
|
+
if (typeof value === "object") {
|
|
52
|
+
return value.isHuri ? value : void 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
static parsePath(huri) {
|
|
56
|
+
const protocolSplit = huri.split("//");
|
|
57
|
+
assertEx(protocolSplit.length <= 2, () => `Invalid format [${huri}]`);
|
|
58
|
+
if (protocolSplit.length === 1) {
|
|
59
|
+
return huri;
|
|
60
|
+
}
|
|
61
|
+
if (protocolSplit.length === 2) {
|
|
62
|
+
return protocolSplit[1];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
static parseProtocol(huri) {
|
|
66
|
+
const protocolSplit = huri.split("//");
|
|
67
|
+
assertEx(protocolSplit.length <= 2, () => `Invalid second protocol [${protocolSplit[2]}]`);
|
|
68
|
+
const rawProtocol = protocolSplit.length === 2 ? protocolSplit.shift() : void 0;
|
|
69
|
+
if (isString(rawProtocol)) {
|
|
70
|
+
const protocolParts = rawProtocol?.split(":");
|
|
71
|
+
assertEx(protocolParts.length === 2, () => `Invalid protocol format [${rawProtocol}]`);
|
|
72
|
+
assertEx(protocolParts[1].length === 0, () => `Invalid protocol format (post :) [${rawProtocol}]`);
|
|
73
|
+
return protocolParts.shift();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
parsePath(path, hasProtocol) {
|
|
77
|
+
const pathParts = path.split("/");
|
|
78
|
+
assertEx(!(hasProtocol && pathParts[0].length === 0), () => "Invalid protocol separator");
|
|
79
|
+
pathParts[0].length === 0 ? pathParts.shift() : null;
|
|
80
|
+
const hash = assertEx(pathParts.pop(), () => "No hash specified");
|
|
81
|
+
this.archivist = pathParts.shift() ?? "api.archivist.xyo.network";
|
|
82
|
+
this.archive = pathParts.pop();
|
|
83
|
+
assertEx(pathParts.length === 0, () => "Too many path parts");
|
|
84
|
+
return hash;
|
|
85
|
+
}
|
|
86
|
+
validateParse() {
|
|
87
|
+
assertEx(this.archivist?.length !== 0, () => "Invalid archivist length");
|
|
88
|
+
assertEx(this.archive?.length !== 0, () => "Invalid archive length");
|
|
89
|
+
assertEx(!(isString(this.archive) && !isString(this.archivist)), () => "If specifying archive, archivist is also required");
|
|
90
|
+
}
|
|
91
|
+
/*
|
|
92
|
+
The full href or the hash
|
|
93
|
+
*/
|
|
94
|
+
get href() {
|
|
95
|
+
const parts = [];
|
|
96
|
+
if (isDefined(this.protocol)) {
|
|
97
|
+
parts.push(`${this.protocol}:/`);
|
|
98
|
+
}
|
|
99
|
+
if (isDefined(this.archive)) {
|
|
100
|
+
parts.push(this.archive);
|
|
101
|
+
}
|
|
102
|
+
if (isDefined(this.archivist)) {
|
|
103
|
+
parts.push(this.archivist);
|
|
104
|
+
}
|
|
105
|
+
parts.push(this.hash);
|
|
106
|
+
return parts.join("/");
|
|
107
|
+
}
|
|
108
|
+
async fetch() {
|
|
109
|
+
return await _Huri.fetch(this);
|
|
110
|
+
}
|
|
111
|
+
toString() {
|
|
112
|
+
return this.href;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
export {
|
|
116
|
+
Huri
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { WithSources } from '../../payload-model/neutral/index.ts';
|
|
2
|
+
import * as z from 'zod/mini';
|
|
3
|
+
/**
|
|
4
|
+
* The fields of an ID Payload
|
|
5
|
+
*/
|
|
6
|
+
export interface IdFields {
|
|
7
|
+
salt: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const IdPayloadZod: z.ZodMiniObject<{
|
|
10
|
+
schema: z.ZodMiniLiteral<"network.xyo.id" & {
|
|
11
|
+
readonly __schema: true;
|
|
12
|
+
}>;
|
|
13
|
+
salt: z.ZodMiniString<string>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
/**
|
|
16
|
+
* The ID Payload
|
|
17
|
+
*/
|
|
18
|
+
export type Id = z.infer<typeof IdPayloadZod>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `Id` instead
|
|
21
|
+
*/
|
|
22
|
+
export type IdPayload = Id;
|
|
23
|
+
/**
|
|
24
|
+
* Identity helpers for ID Payload
|
|
25
|
+
*/
|
|
26
|
+
export declare const isId: <T>(value: T) => value is T & {
|
|
27
|
+
schema: "network.xyo.id" & {
|
|
28
|
+
readonly __schema: true;
|
|
29
|
+
};
|
|
30
|
+
salt: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const asId: {
|
|
33
|
+
<T>(value: T): (T & {
|
|
34
|
+
schema: "network.xyo.id" & {
|
|
35
|
+
readonly __schema: true;
|
|
36
|
+
};
|
|
37
|
+
salt: string;
|
|
38
|
+
}) | undefined;
|
|
39
|
+
<T>(value: T, assert: import("@xylabs/sdk").ZodFactoryConfig): T & {
|
|
40
|
+
schema: "network.xyo.id" & {
|
|
41
|
+
readonly __schema: true;
|
|
42
|
+
};
|
|
43
|
+
salt: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export declare const toId: {
|
|
47
|
+
<T>(value: T): (T & {
|
|
48
|
+
schema: "network.xyo.id" & {
|
|
49
|
+
readonly __schema: true;
|
|
50
|
+
};
|
|
51
|
+
salt: string;
|
|
52
|
+
}) | undefined;
|
|
53
|
+
<T>(value: T, assert: import("@xylabs/sdk").ZodFactoryConfig): T & {
|
|
54
|
+
schema: "network.xyo.id" & {
|
|
55
|
+
readonly __schema: true;
|
|
56
|
+
};
|
|
57
|
+
salt: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use `asId` instead (returns undefined on failure when called without an assert config)
|
|
62
|
+
*/
|
|
63
|
+
export declare const asOptionalId: {
|
|
64
|
+
<T>(value: T): (T & {
|
|
65
|
+
schema: "network.xyo.id" & {
|
|
66
|
+
readonly __schema: true;
|
|
67
|
+
};
|
|
68
|
+
salt: string;
|
|
69
|
+
}) | undefined;
|
|
70
|
+
<T>(value: T, assert: import("@xylabs/sdk").ZodFactoryConfig): T & {
|
|
71
|
+
schema: "network.xyo.id" & {
|
|
72
|
+
readonly __schema: true;
|
|
73
|
+
};
|
|
74
|
+
salt: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Identity helper for ID Payload with sources
|
|
79
|
+
*/
|
|
80
|
+
export declare const isIdWithSources: (x?: unknown) => x is WithSources<WithSources<{
|
|
81
|
+
schema: "network.xyo.id" & {
|
|
82
|
+
readonly __schema: true;
|
|
83
|
+
};
|
|
84
|
+
salt: string;
|
|
85
|
+
}>>;
|
|
86
|
+
//# sourceMappingURL=Payload.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/Payload.ts
|
|
2
|
+
import {
|
|
3
|
+
zodAsFactory,
|
|
4
|
+
zodIsFactory,
|
|
5
|
+
zodToFactory
|
|
6
|
+
} from "@xylabs/sdk";
|
|
7
|
+
import { isPayloadOfSchemaTypeWithSources, PayloadZodOfSchema } from "../../payload-model/neutral/index.mjs";
|
|
8
|
+
import * as z from "zod/mini";
|
|
9
|
+
|
|
10
|
+
// src/Schema.ts
|
|
11
|
+
import { asSchema } from "../../payload-model/neutral/index.mjs";
|
|
12
|
+
var IdSchema = asSchema("network.xyo.id", true);
|
|
13
|
+
|
|
14
|
+
// src/Payload.ts
|
|
15
|
+
var IdPayloadZod = z.extend(PayloadZodOfSchema(IdSchema), { salt: z.string() });
|
|
16
|
+
var isId = zodIsFactory(IdPayloadZod);
|
|
17
|
+
var asId = zodAsFactory(IdPayloadZod, "asId");
|
|
18
|
+
var toId = zodToFactory(IdPayloadZod, "toId");
|
|
19
|
+
var asOptionalId = asId;
|
|
20
|
+
var isIdWithSources = isPayloadOfSchemaTypeWithSources(IdSchema);
|
|
21
|
+
|
|
22
|
+
// src/Plugin.ts
|
|
23
|
+
import { createPayloadPlugin } from "../../payload-plugin/neutral/index.mjs";
|
|
24
|
+
|
|
25
|
+
// src/Template.ts
|
|
26
|
+
var idPayloadTemplate = () => ({
|
|
27
|
+
salt: "",
|
|
28
|
+
schema: IdSchema
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// src/Plugin.ts
|
|
32
|
+
var IdPayloadPlugin = () => createPayloadPlugin({
|
|
33
|
+
schema: IdSchema,
|
|
34
|
+
template: idPayloadTemplate
|
|
35
|
+
});
|
|
36
|
+
export {
|
|
37
|
+
IdPayloadPlugin,
|
|
38
|
+
IdPayloadZod,
|
|
39
|
+
IdSchema,
|
|
40
|
+
asId,
|
|
41
|
+
asOptionalId,
|
|
42
|
+
IdPayloadPlugin as default,
|
|
43
|
+
idPayloadTemplate,
|
|
44
|
+
isId,
|
|
45
|
+
isIdWithSources,
|
|
46
|
+
toId
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EllipticKeyInstance } from './EllipticKey.ts';
|
|
2
|
+
export interface AddressValueInstance extends EllipticKeyInstance {
|
|
3
|
+
}
|
|
4
|
+
export interface AddressValueStatic {
|
|
5
|
+
new (address: ArrayBuffer): AddressValueInstance;
|
|
6
|
+
addressFromAddressOrPublicKey(bytes: ArrayBufferLike): ArrayBufferLike;
|
|
7
|
+
addressFromPublicKey(key: ArrayBufferLike): ArrayBufferLike;
|
|
8
|
+
isAddress(value: unknown): boolean;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AddressValue.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EllipticKeyInstance } from './EllipticKey.ts';
|
|
2
|
+
import type { PublicKeyInstance } from './PublicKey.ts';
|
|
3
|
+
export interface PrivateKeyConfig {
|
|
4
|
+
privateKeyData?: ArrayBufferLike;
|
|
5
|
+
}
|
|
6
|
+
export interface PrivateKeyInstance extends EllipticKeyInstance {
|
|
7
|
+
public: PublicKeyInstance;
|
|
8
|
+
sign: (hash: ArrayBufferLike) => ArrayBufferLike | Promise<ArrayBufferLike>;
|
|
9
|
+
verify: (msg: ArrayBufferLike, signature: ArrayBufferLike) => boolean | Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
export interface PrivateKeyStatic {
|
|
12
|
+
create(value: ArrayBufferLike | bigint): Promise<PrivateKeyInstance>;
|
|
13
|
+
isPrivateKey(value: unknown): boolean;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=PrivateKey.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AddressValueInstance } from './AddressValue.ts';
|
|
2
|
+
import type { EllipticKeyInstance } from './EllipticKey.ts';
|
|
3
|
+
export interface PublicKeyInstance extends EllipticKeyInstance {
|
|
4
|
+
get address(): AddressValueInstance;
|
|
5
|
+
verify(msg: ArrayBufferLike, signature: ArrayBufferLike): boolean | Promise<boolean>;
|
|
6
|
+
}
|
|
7
|
+
export interface PublicKeyStatic {
|
|
8
|
+
create(bytes: ArrayBufferLike): Promise<PublicKeyInstance>;
|
|
9
|
+
isPublicKey(value: unknown): boolean;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=PublicKey.d.ts.map
|