@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,43 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const QueryPayloadZod: z.ZodMiniObject<{
|
|
3
|
+
schema: z.ZodMiniLiteral<"network.xyo.query" & {
|
|
4
|
+
readonly __schema: true;
|
|
5
|
+
}>;
|
|
6
|
+
query: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<import("../../payload-model/neutral/index.ts").BrandedSchema<string>, string>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type QueryPayload = z.infer<typeof QueryPayloadZod>;
|
|
9
|
+
export declare const isQueryPayload: <T>(value: T) => value is T & {
|
|
10
|
+
schema: "network.xyo.query" & {
|
|
11
|
+
readonly __schema: true;
|
|
12
|
+
};
|
|
13
|
+
query: import("../../payload-model/neutral/index.ts").BrandedSchema<string>;
|
|
14
|
+
};
|
|
15
|
+
export declare const asQueryPayload: {
|
|
16
|
+
<T>(value: T): (T & {
|
|
17
|
+
schema: "network.xyo.query" & {
|
|
18
|
+
readonly __schema: true;
|
|
19
|
+
};
|
|
20
|
+
query: import("../../payload-model/neutral/index.ts").BrandedSchema<string>;
|
|
21
|
+
}) | undefined;
|
|
22
|
+
<T>(value: T, assert: import("@xylabs/sdk").ZodFactoryConfig): T & {
|
|
23
|
+
schema: "network.xyo.query" & {
|
|
24
|
+
readonly __schema: true;
|
|
25
|
+
};
|
|
26
|
+
query: import("../../payload-model/neutral/index.ts").BrandedSchema<string>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare const toQueryPayload: {
|
|
30
|
+
<T>(value: T): (T & {
|
|
31
|
+
schema: "network.xyo.query" & {
|
|
32
|
+
readonly __schema: true;
|
|
33
|
+
};
|
|
34
|
+
query: import("../../payload-model/neutral/index.ts").BrandedSchema<string>;
|
|
35
|
+
}) | undefined;
|
|
36
|
+
<T>(value: T, assert: import("@xylabs/sdk").ZodFactoryConfig): T & {
|
|
37
|
+
schema: "network.xyo.query" & {
|
|
38
|
+
readonly __schema: true;
|
|
39
|
+
};
|
|
40
|
+
query: import("../../payload-model/neutral/index.ts").BrandedSchema<string>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=Payload.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const QueryPayloadPlugin: () => import("../../payload-plugin/neutral/index.ts").PayloadPlugin<{
|
|
2
|
+
schema: "network.xyo.query" & {
|
|
3
|
+
readonly __schema: true;
|
|
4
|
+
};
|
|
5
|
+
query: import("../../payload-model/neutral/index.ts").BrandedSchema<string>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// src/Payload.ts
|
|
2
|
+
import {
|
|
3
|
+
zodAsFactory,
|
|
4
|
+
zodIsFactory,
|
|
5
|
+
zodToFactory
|
|
6
|
+
} from "@xylabs/sdk";
|
|
7
|
+
import { PayloadZodOfSchema, SchemaZod } 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 QuerySchema = asSchema("network.xyo.query", true);
|
|
13
|
+
|
|
14
|
+
// src/Payload.ts
|
|
15
|
+
var QueryPayloadZod = z.extend(PayloadZodOfSchema(QuerySchema), { query: SchemaZod });
|
|
16
|
+
var isQueryPayload = zodIsFactory(QueryPayloadZod);
|
|
17
|
+
var asQueryPayload = zodAsFactory(QueryPayloadZod, "asQueryPayload");
|
|
18
|
+
var toQueryPayload = zodToFactory(QueryPayloadZod, "toQueryPayload");
|
|
19
|
+
|
|
20
|
+
// src/Plugin.ts
|
|
21
|
+
import { createPayloadPlugin } from "../../payload-plugin/neutral/index.mjs";
|
|
22
|
+
|
|
23
|
+
// src/Template.ts
|
|
24
|
+
var queryPayloadTemplate = () => ({
|
|
25
|
+
query: "",
|
|
26
|
+
schema: QuerySchema
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// src/Plugin.ts
|
|
30
|
+
var QueryPayloadPlugin = () => createPayloadPlugin({
|
|
31
|
+
schema: QuerySchema,
|
|
32
|
+
template: queryPayloadTemplate
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
QueryPayloadPlugin,
|
|
36
|
+
QueryPayloadZod,
|
|
37
|
+
QuerySchema,
|
|
38
|
+
asQueryPayload,
|
|
39
|
+
QueryPayloadPlugin as default,
|
|
40
|
+
isQueryPayload,
|
|
41
|
+
queryPayloadTemplate,
|
|
42
|
+
toQueryPayload
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SchemaResolution, SchemaResolutionSource } from '../../domain-payload-plugin/neutral/index.ts';
|
|
2
|
+
import type { FetchedPayload } from '../../huri/neutral/index.ts';
|
|
3
|
+
import type { SchemaPayload } from '../../schema-payload-plugin/neutral/index.ts';
|
|
4
|
+
import type { SchemaNameToValidatorMap } from './SchemaNameToValidatorMap.ts';
|
|
5
|
+
export interface SchemaCacheEntry extends FetchedPayload<SchemaPayload> {
|
|
6
|
+
/** Provenance of the schema definition when resolved via the domain schema authority */
|
|
7
|
+
source?: SchemaResolutionSource;
|
|
8
|
+
}
|
|
9
|
+
export declare class SchemaCache<T extends SchemaNameToValidatorMap = SchemaNameToValidatorMap> {
|
|
10
|
+
/**
|
|
11
|
+
* Object representing `null` since LRU Cache types
|
|
12
|
+
* only allow for types that derive from object
|
|
13
|
+
*/
|
|
14
|
+
protected static readonly NULL: SchemaCacheEntry;
|
|
15
|
+
private static _instance?;
|
|
16
|
+
private _cache;
|
|
17
|
+
private _resolutions;
|
|
18
|
+
private _validators;
|
|
19
|
+
private getDebounce;
|
|
20
|
+
onSchemaCached?: (name: string, entry: SchemaCacheEntry) => void;
|
|
21
|
+
proxy?: string;
|
|
22
|
+
private constructor();
|
|
23
|
+
static get instance(): SchemaCache<SchemaNameToValidatorMap>;
|
|
24
|
+
private cacheSchemaIfValid;
|
|
25
|
+
private cacheSchemas;
|
|
26
|
+
private fetchSchema;
|
|
27
|
+
/**
|
|
28
|
+
* A map of cached schema (by name) to payload validators for the schema. A schema
|
|
29
|
+
* must be cached via `get('schema.name')` before it's validator can be used as
|
|
30
|
+
* they are compiled dynamically at runtime upon retrieval.
|
|
31
|
+
*/
|
|
32
|
+
get validators(): T;
|
|
33
|
+
get(schema?: string): Promise<SchemaCacheEntry | undefined | null>;
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a schema name to its domain-published authoritative definition (SPEC.md in
|
|
36
|
+
* @xyo-network/domain-payload-plugin), with provenance and a richer status than get():
|
|
37
|
+
* 'resolved' | 'not-published' | 'unreachable'. Resolved definitions are cached and
|
|
38
|
+
* their validators compiled, exactly as with get(). 'unreachable' results are
|
|
39
|
+
* retryable: they are not cached as permanent negatives.
|
|
40
|
+
*/
|
|
41
|
+
resolve(schema?: string): Promise<SchemaResolution | undefined>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=SchemaCache.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Payload } from '../../payload-model/neutral/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Used in conjunction with schema validation to support compile time type assertion
|
|
4
|
+
* for known schema types.
|
|
5
|
+
*/
|
|
6
|
+
export type NarrowPayload<T extends Payload = Payload> = ((x: Payload) => x is T) | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Used to map known schemas (byt their string name) to the validators which assert their types
|
|
9
|
+
*/
|
|
10
|
+
export interface SchemaNameToValidatorMap {
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=SchemaNameToValidatorMap.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface TtlLruCacheOpts {
|
|
2
|
+
max: number;
|
|
3
|
+
ttl: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class TtlLruCache<K, V> {
|
|
6
|
+
private readonly map;
|
|
7
|
+
private readonly max;
|
|
8
|
+
private readonly ttl;
|
|
9
|
+
constructor(opts: TtlLruCacheOpts);
|
|
10
|
+
get(key: K): V | undefined;
|
|
11
|
+
set(key: K, value: V): void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=TtlLruCache.d.ts.map
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// src/Debounce.ts
|
|
2
|
+
import { delay, isDefined } from "@xylabs/sdk";
|
|
3
|
+
var Debounce = class {
|
|
4
|
+
map = /* @__PURE__ */ new Map();
|
|
5
|
+
async one(key, closure, timeout = 1e4) {
|
|
6
|
+
const startTime = Date.now();
|
|
7
|
+
while (isDefined(this.map.get(key))) {
|
|
8
|
+
await delay(100);
|
|
9
|
+
if (Date.now() - startTime > timeout) {
|
|
10
|
+
throw new Error(`Debounce timed out [${String(key)}]`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
this.map.set(key, 1);
|
|
15
|
+
return await closure();
|
|
16
|
+
} finally {
|
|
17
|
+
this.map.delete(key);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// src/SchemaCache.ts
|
|
23
|
+
import {
|
|
24
|
+
FetchClientError,
|
|
25
|
+
handleError,
|
|
26
|
+
isDefined as isDefined2,
|
|
27
|
+
isString
|
|
28
|
+
} from "@xylabs/sdk";
|
|
29
|
+
import { DomainPayloadWrapper, DomainSchemaResolver } from "../../domain-payload-plugin/neutral/index.mjs";
|
|
30
|
+
import { SchemaSchema } from "../../schema-payload-plugin/neutral/index.mjs";
|
|
31
|
+
import { Ajv } from "ajv";
|
|
32
|
+
|
|
33
|
+
// src/TtlLruCache.ts
|
|
34
|
+
var TtlLruCache = class {
|
|
35
|
+
map = /* @__PURE__ */ new Map();
|
|
36
|
+
max;
|
|
37
|
+
ttl;
|
|
38
|
+
constructor(opts) {
|
|
39
|
+
this.max = opts.max;
|
|
40
|
+
this.ttl = opts.ttl;
|
|
41
|
+
}
|
|
42
|
+
get(key) {
|
|
43
|
+
const entry = this.map.get(key);
|
|
44
|
+
if (entry === void 0) return void 0;
|
|
45
|
+
if (entry.expires <= Date.now()) {
|
|
46
|
+
this.map.delete(key);
|
|
47
|
+
return void 0;
|
|
48
|
+
}
|
|
49
|
+
this.map.delete(key);
|
|
50
|
+
this.map.set(key, entry);
|
|
51
|
+
return entry.value;
|
|
52
|
+
}
|
|
53
|
+
set(key, value) {
|
|
54
|
+
if (this.map.has(key)) this.map.delete(key);
|
|
55
|
+
this.map.set(key, { value, expires: Date.now() + this.ttl });
|
|
56
|
+
if (this.map.size > this.max) {
|
|
57
|
+
const oldest = this.map.keys().next().value;
|
|
58
|
+
if (oldest !== void 0) this.map.delete(oldest);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/SchemaCache.ts
|
|
64
|
+
var getSchemaNameFromSchema = (schema) => {
|
|
65
|
+
if (isString(schema.$id)) {
|
|
66
|
+
return schema.$id;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
var SchemaCache = class _SchemaCache {
|
|
70
|
+
/**
|
|
71
|
+
* Object representing `null` since LRU Cache types
|
|
72
|
+
* only allow for types that derive from object
|
|
73
|
+
*/
|
|
74
|
+
static NULL = { payload: { definition: {}, schema: SchemaSchema } };
|
|
75
|
+
static _instance;
|
|
76
|
+
_cache = new TtlLruCache({ max: 500, ttl: 1e3 * 60 * 5 });
|
|
77
|
+
_resolutions = new TtlLruCache({ max: 500, ttl: 1e3 * 60 * 5 });
|
|
78
|
+
_validators = {};
|
|
79
|
+
// prevents double discovery
|
|
80
|
+
getDebounce = new Debounce();
|
|
81
|
+
onSchemaCached;
|
|
82
|
+
proxy;
|
|
83
|
+
constructor(proxy) {
|
|
84
|
+
this.proxy = proxy;
|
|
85
|
+
}
|
|
86
|
+
static get instance() {
|
|
87
|
+
this._instance ??= new _SchemaCache();
|
|
88
|
+
return this._instance;
|
|
89
|
+
}
|
|
90
|
+
cacheSchemaIfValid(entry) {
|
|
91
|
+
if (!isDefined2(entry?.payload?.definition)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const ajv = new Ajv({ strict: false });
|
|
95
|
+
const validator = ajv.compile(entry.payload.definition);
|
|
96
|
+
const schemaName = getSchemaNameFromSchema(entry.payload.definition);
|
|
97
|
+
if (isString(schemaName)) {
|
|
98
|
+
this._cache.set(schemaName, entry);
|
|
99
|
+
const key = schemaName;
|
|
100
|
+
this._validators[key] = validator;
|
|
101
|
+
this.onSchemaCached?.(schemaName, entry);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
cacheSchemas(aliasEntries) {
|
|
105
|
+
for (const entry of aliasEntries?.filter((entry2) => entry2.payload.schema === SchemaSchema) ?? []) {
|
|
106
|
+
this.cacheSchemaIfValid(entry);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async fetchSchema(schema) {
|
|
110
|
+
try {
|
|
111
|
+
const resolution = await this.resolve(schema);
|
|
112
|
+
if (resolution?.status === "resolved") {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const domain = await DomainPayloadWrapper.discover(schema, this.proxy);
|
|
116
|
+
await domain?.fetch();
|
|
117
|
+
this.cacheSchemas(domain?.aliases);
|
|
118
|
+
if (this._cache.get(schema) === void 0 && resolution?.status !== "unreachable") {
|
|
119
|
+
this._cache.set(schema, _SchemaCache.NULL);
|
|
120
|
+
}
|
|
121
|
+
} catch (error) {
|
|
122
|
+
if (error instanceof FetchClientError) {
|
|
123
|
+
console.log(`Fetch Url: ${error.config.url}`);
|
|
124
|
+
}
|
|
125
|
+
handleError(error, (error2) => {
|
|
126
|
+
console.error(`fetchSchema threw: ${error2.message}`);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A map of cached schema (by name) to payload validators for the schema. A schema
|
|
132
|
+
* must be cached via `get('schema.name')` before it's validator can be used as
|
|
133
|
+
* they are compiled dynamically at runtime upon retrieval.
|
|
134
|
+
*/
|
|
135
|
+
get validators() {
|
|
136
|
+
return this._validators;
|
|
137
|
+
}
|
|
138
|
+
async get(schema) {
|
|
139
|
+
if (isString(schema)) {
|
|
140
|
+
await this.getDebounce.one(schema, async () => {
|
|
141
|
+
if (this._cache.get(schema) === void 0) {
|
|
142
|
+
await this.fetchSchema(schema);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const value = this._cache.get(schema);
|
|
146
|
+
return value === _SchemaCache.NULL ? null : value;
|
|
147
|
+
}
|
|
148
|
+
return void 0;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Resolve a schema name to its domain-published authoritative definition (SPEC.md in
|
|
152
|
+
* @xyo-network/domain-payload-plugin), with provenance and a richer status than get():
|
|
153
|
+
* 'resolved' | 'not-published' | 'unreachable'. Resolved definitions are cached and
|
|
154
|
+
* their validators compiled, exactly as with get(). 'unreachable' results are
|
|
155
|
+
* retryable: they are not cached as permanent negatives.
|
|
156
|
+
*/
|
|
157
|
+
async resolve(schema) {
|
|
158
|
+
if (!isString(schema)) return void 0;
|
|
159
|
+
await this.getDebounce.one(`resolve:${schema}`, async () => {
|
|
160
|
+
const existing = this._resolutions.get(schema);
|
|
161
|
+
if (existing === void 0 || existing.status === "unreachable") {
|
|
162
|
+
const resolver = new DomainSchemaResolver();
|
|
163
|
+
const resolution = await resolver.resolve(schema, { proxy: this.proxy });
|
|
164
|
+
this._resolutions.set(schema, resolution);
|
|
165
|
+
if (resolution.status === "resolved" && isDefined2(resolution.payload)) {
|
|
166
|
+
this.cacheSchemaIfValid({ payload: resolution.payload, source: resolution.source });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
return this._resolutions.get(schema);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
export {
|
|
174
|
+
Debounce,
|
|
175
|
+
SchemaCache,
|
|
176
|
+
TtlLruCache
|
|
177
|
+
};
|
|
178
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates a XYO schema name's structure
|
|
3
|
+
*/
|
|
4
|
+
export declare class SchemaNameValidator {
|
|
5
|
+
private _parts?;
|
|
6
|
+
private _rootDomain?;
|
|
7
|
+
private _schema?;
|
|
8
|
+
constructor(schema?: string);
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether the schema is all lowercase
|
|
11
|
+
*
|
|
12
|
+
* @returns boolean
|
|
13
|
+
*/
|
|
14
|
+
get isLowercase(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Levels in the schema
|
|
17
|
+
*
|
|
18
|
+
* @returns number
|
|
19
|
+
*/
|
|
20
|
+
get levels(): number | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The schema converted into a string array split on '.'
|
|
23
|
+
*
|
|
24
|
+
* @returns string[]
|
|
25
|
+
*/
|
|
26
|
+
get parts(): string[] | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The rootDomain is the first two levels of the schema, in reverse order
|
|
29
|
+
* This can be used to determine who 'owns' that schema, based on domain
|
|
30
|
+
* registration
|
|
31
|
+
*
|
|
32
|
+
* @returns string
|
|
33
|
+
*/
|
|
34
|
+
get rootDomain(): string | undefined;
|
|
35
|
+
get schema(): string | undefined;
|
|
36
|
+
set schema(schema: string | undefined);
|
|
37
|
+
/**
|
|
38
|
+
* Run all static validations
|
|
39
|
+
* @returns Error[]
|
|
40
|
+
*/
|
|
41
|
+
all(): Error[];
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=SchemaNameValidator.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// src/SchemaNameValidator.ts
|
|
2
|
+
var SchemaNameValidator = class {
|
|
3
|
+
_parts;
|
|
4
|
+
_rootDomain;
|
|
5
|
+
_schema;
|
|
6
|
+
constructor(schema) {
|
|
7
|
+
this._schema = schema;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether the schema is all lowercase
|
|
11
|
+
*
|
|
12
|
+
* @returns boolean
|
|
13
|
+
*/
|
|
14
|
+
get isLowercase() {
|
|
15
|
+
return this.schema === this.schema?.toLowerCase();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Levels in the schema
|
|
19
|
+
*
|
|
20
|
+
* @returns number
|
|
21
|
+
*/
|
|
22
|
+
get levels() {
|
|
23
|
+
return this.parts?.length;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The schema converted into a string array split on '.'
|
|
27
|
+
*
|
|
28
|
+
* @returns string[]
|
|
29
|
+
*/
|
|
30
|
+
get parts() {
|
|
31
|
+
this._parts = this._parts ?? this.schema?.split(".");
|
|
32
|
+
return this._parts;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The rootDomain is the first two levels of the schema, in reverse order
|
|
36
|
+
* This can be used to determine who 'owns' that schema, based on domain
|
|
37
|
+
* registration
|
|
38
|
+
*
|
|
39
|
+
* @returns string
|
|
40
|
+
*/
|
|
41
|
+
get rootDomain() {
|
|
42
|
+
this._rootDomain = this._rootDomain ?? domainLevel(this, 1);
|
|
43
|
+
return this._rootDomain;
|
|
44
|
+
}
|
|
45
|
+
get schema() {
|
|
46
|
+
return this._schema;
|
|
47
|
+
}
|
|
48
|
+
set schema(schema) {
|
|
49
|
+
this._schema = schema;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Run all static validations
|
|
53
|
+
* @returns Error[]
|
|
54
|
+
*/
|
|
55
|
+
all() {
|
|
56
|
+
const errors = [];
|
|
57
|
+
if ((this.schema?.length ?? 0) === 0) errors.push(new Error("schema missing"));
|
|
58
|
+
else if ((this.levels ?? 0) < 3) errors.push(new Error(`schema levels < 3 [${this.levels}, ${this.schema}]`));
|
|
59
|
+
else if (!this.isLowercase) errors.push(new Error(`schema not lowercase [${this.schema}]`));
|
|
60
|
+
return errors;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
function domainLevel(validator, level) {
|
|
64
|
+
return validator.parts?.slice(0, level + 1).toReversed().join(".");
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
SchemaNameValidator
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
export declare const SchemaPayloadZod: z.ZodMiniObject<{
|
|
3
|
+
schema: z.ZodMiniLiteral<"network.xyo.schema" & {
|
|
4
|
+
readonly __schema: true;
|
|
5
|
+
}>;
|
|
6
|
+
definition: z.ZodMiniObject<{
|
|
7
|
+
$id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
8
|
+
}, z.core.$loose>;
|
|
9
|
+
extends: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
10
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
11
|
+
version: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type SchemaPayload = z.infer<typeof SchemaPayloadZod>;
|
|
14
|
+
/**
|
|
15
|
+
* Identity function for determining if an object is a Schema
|
|
16
|
+
*/
|
|
17
|
+
export declare const isSchemaPayload: <T>(value: T) => value is T & {
|
|
18
|
+
schema: "network.xyo.schema" & {
|
|
19
|
+
readonly __schema: true;
|
|
20
|
+
};
|
|
21
|
+
definition: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
$id?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
extends?: string | undefined;
|
|
26
|
+
name?: string | undefined;
|
|
27
|
+
version?: number | undefined;
|
|
28
|
+
};
|
|
29
|
+
export declare const asSchemaPayload: {
|
|
30
|
+
<T>(value: T): (T & {
|
|
31
|
+
schema: "network.xyo.schema" & {
|
|
32
|
+
readonly __schema: true;
|
|
33
|
+
};
|
|
34
|
+
definition: {
|
|
35
|
+
[x: string]: unknown;
|
|
36
|
+
$id?: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
extends?: string | undefined;
|
|
39
|
+
name?: string | undefined;
|
|
40
|
+
version?: number | undefined;
|
|
41
|
+
}) | undefined;
|
|
42
|
+
<T>(value: T, assert: import("@xylabs/sdk").ZodFactoryConfig): T & {
|
|
43
|
+
schema: "network.xyo.schema" & {
|
|
44
|
+
readonly __schema: true;
|
|
45
|
+
};
|
|
46
|
+
definition: {
|
|
47
|
+
[x: string]: unknown;
|
|
48
|
+
$id?: string | undefined;
|
|
49
|
+
};
|
|
50
|
+
extends?: string | undefined;
|
|
51
|
+
name?: string | undefined;
|
|
52
|
+
version?: number | undefined;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export declare const toSchemaPayload: {
|
|
56
|
+
<T>(value: T): (T & {
|
|
57
|
+
schema: "network.xyo.schema" & {
|
|
58
|
+
readonly __schema: true;
|
|
59
|
+
};
|
|
60
|
+
definition: {
|
|
61
|
+
[x: string]: unknown;
|
|
62
|
+
$id?: string | undefined;
|
|
63
|
+
};
|
|
64
|
+
extends?: string | undefined;
|
|
65
|
+
name?: string | undefined;
|
|
66
|
+
version?: number | undefined;
|
|
67
|
+
}) | undefined;
|
|
68
|
+
<T>(value: T, assert: import("@xylabs/sdk").ZodFactoryConfig): T & {
|
|
69
|
+
schema: "network.xyo.schema" & {
|
|
70
|
+
readonly __schema: true;
|
|
71
|
+
};
|
|
72
|
+
definition: {
|
|
73
|
+
[x: string]: unknown;
|
|
74
|
+
$id?: string | undefined;
|
|
75
|
+
};
|
|
76
|
+
extends?: string | undefined;
|
|
77
|
+
name?: string | undefined;
|
|
78
|
+
version?: number | undefined;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Identity function for determining if an object is a Schema with sources
|
|
83
|
+
*/
|
|
84
|
+
export declare const isSchemaPayloadWithSources: (x?: unknown) => x is import("../../payload-model/neutral/index.ts").WithSources<{
|
|
85
|
+
schema: "network.xyo.schema" & {
|
|
86
|
+
readonly __schema: true;
|
|
87
|
+
};
|
|
88
|
+
definition: {
|
|
89
|
+
[x: string]: unknown;
|
|
90
|
+
$id?: string | undefined;
|
|
91
|
+
};
|
|
92
|
+
extends?: string | undefined;
|
|
93
|
+
name?: string | undefined;
|
|
94
|
+
version?: number | undefined;
|
|
95
|
+
}>;
|
|
96
|
+
//# sourceMappingURL=Payload.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const SchemaPayloadPlugin: () => import("../../payload-plugin/neutral/index.ts").PayloadPlugin<{
|
|
2
|
+
schema: "network.xyo.schema" & {
|
|
3
|
+
readonly __schema: true;
|
|
4
|
+
};
|
|
5
|
+
definition: {
|
|
6
|
+
[x: string]: unknown;
|
|
7
|
+
$id?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
extends?: string | undefined;
|
|
10
|
+
name?: string | undefined;
|
|
11
|
+
version?: number | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=Plugin.d.ts.map
|