@opendatalabs/vana-sdk 0.1.0-alpha.7e4db82 → 0.1.0-alpha.7ee7635
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/README.md +98 -36
- package/dist/browser.cjs +29 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +2 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +5 -0
- package/dist/browser.js.map +1 -0
- package/dist/chains/definitions.cjs +92 -0
- package/dist/chains/definitions.cjs.map +1 -0
- package/dist/chains/definitions.d.cts +53 -0
- package/dist/chains/definitions.d.ts +53 -0
- package/dist/chains/definitions.js +64 -0
- package/dist/chains/definitions.js.map +1 -0
- package/dist/chains/index.cjs +37 -0
- package/dist/chains/index.cjs.map +1 -0
- package/dist/chains/index.d.cts +2 -0
- package/dist/chains/index.d.ts +2 -0
- package/dist/chains/index.js +15 -0
- package/dist/chains/index.js.map +1 -0
- package/dist/chains.browser.cjs +6 -65
- package/dist/chains.browser.cjs.map +1 -1
- package/dist/chains.browser.d.cts +2 -53
- package/dist/chains.browser.d.ts +2 -53
- package/dist/chains.browser.js +7 -57
- package/dist/chains.browser.js.map +1 -1
- package/dist/chains.cjs +6 -65
- package/dist/chains.cjs.map +1 -1
- package/dist/chains.d.cts +1 -1
- package/dist/chains.d.ts +1 -1
- package/dist/chains.js +7 -57
- package/dist/chains.js.map +1 -1
- package/dist/chains.node.cjs +6 -65
- package/dist/chains.node.cjs.map +1 -1
- package/dist/chains.node.d.cts +1 -1
- package/dist/chains.node.d.ts +1 -1
- package/dist/chains.node.js +7 -57
- package/dist/chains.node.js.map +1 -1
- package/dist/config/addresses.cjs +325 -0
- package/dist/config/addresses.cjs.map +1 -0
- package/dist/config/addresses.d.cts +401 -0
- package/dist/config/addresses.d.ts +401 -0
- package/dist/config/addresses.js +295 -0
- package/dist/config/addresses.js.map +1 -0
- package/dist/config/chains.cjs +93 -0
- package/dist/config/chains.cjs.map +1 -0
- package/dist/config/chains.d.cts +85 -0
- package/dist/config/chains.d.ts +85 -0
- package/dist/config/chains.js +67 -0
- package/dist/config/chains.js.map +1 -0
- package/dist/config/features.cjs +52 -0
- package/dist/config/features.cjs.map +1 -0
- package/dist/config/features.d.cts +64 -0
- package/dist/config/features.d.ts +64 -0
- package/dist/config/features.js +28 -0
- package/dist/config/features.js.map +1 -0
- package/dist/contracts/contractController.cjs +126 -0
- package/dist/contracts/contractController.cjs.map +1 -0
- package/dist/contracts/contractController.d.cts +117 -0
- package/dist/contracts/contractController.d.ts +117 -0
- package/dist/contracts/contractController.js +103 -0
- package/dist/contracts/contractController.js.map +1 -0
- package/dist/controllers/data.cjs +2251 -0
- package/dist/controllers/data.cjs.map +1 -0
- package/dist/controllers/data.d.cts +915 -0
- package/dist/controllers/data.d.ts +915 -0
- package/dist/controllers/data.js +2234 -0
- package/dist/controllers/data.js.map +1 -0
- package/dist/controllers/permissions.cjs +3949 -0
- package/dist/controllers/permissions.cjs.map +1 -0
- package/dist/controllers/permissions.d.cts +1383 -0
- package/dist/controllers/permissions.d.ts +1383 -0
- package/dist/controllers/permissions.js +3925 -0
- package/dist/controllers/permissions.js.map +1 -0
- package/dist/controllers/protocol.cjs +179 -0
- package/dist/controllers/protocol.cjs.map +1 -0
- package/dist/controllers/protocol.d.cts +188 -0
- package/dist/controllers/protocol.d.ts +188 -0
- package/dist/controllers/protocol.js +162 -0
- package/dist/controllers/protocol.js.map +1 -0
- package/dist/controllers/schemas.cjs +606 -0
- package/dist/controllers/schemas.cjs.map +1 -0
- package/dist/controllers/schemas.d.cts +260 -0
- package/dist/controllers/schemas.d.ts +260 -0
- package/dist/controllers/schemas.js +582 -0
- package/dist/controllers/schemas.js.map +1 -0
- package/dist/controllers/server.cjs +427 -0
- package/dist/controllers/server.cjs.map +1 -0
- package/dist/controllers/server.d.cts +230 -0
- package/dist/controllers/server.d.ts +230 -0
- package/dist/controllers/server.js +408 -0
- package/dist/controllers/server.js.map +1 -0
- package/dist/core/apiClient.cjs +325 -0
- package/dist/core/apiClient.cjs.map +1 -0
- package/dist/core/apiClient.d.cts +165 -0
- package/dist/core/apiClient.d.ts +165 -0
- package/dist/core/apiClient.js +309 -0
- package/dist/core/apiClient.js.map +1 -0
- package/dist/core/client.cjs +70 -0
- package/dist/core/client.cjs.map +1 -0
- package/dist/core/client.d.cts +92 -0
- package/dist/core/client.d.ts +92 -0
- package/dist/core/client.js +47 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/generics.cjs +388 -0
- package/dist/core/generics.cjs.map +1 -0
- package/dist/core/generics.d.cts +120 -0
- package/dist/core/generics.d.ts +120 -0
- package/dist/core/generics.js +366 -0
- package/dist/core/generics.js.map +1 -0
- package/dist/core.cjs +658 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +493 -0
- package/dist/core.d.ts +493 -0
- package/dist/core.js +636 -0
- package/dist/core.js.map +1 -0
- package/dist/crypto/ecies/__tests__/test-vectors.cjs +102 -0
- package/dist/crypto/ecies/__tests__/test-vectors.cjs.map +1 -0
- package/dist/crypto/ecies/__tests__/test-vectors.d.cts +40 -0
- package/dist/crypto/ecies/__tests__/test-vectors.d.ts +40 -0
- package/dist/crypto/ecies/__tests__/test-vectors.js +77 -0
- package/dist/crypto/ecies/__tests__/test-vectors.js.map +1 -0
- package/dist/crypto/ecies/base.cjs +231 -0
- package/dist/crypto/ecies/base.cjs.map +1 -0
- package/dist/crypto/ecies/base.d.cts +143 -0
- package/dist/crypto/ecies/base.d.ts +143 -0
- package/dist/crypto/ecies/base.js +211 -0
- package/dist/crypto/ecies/base.js.map +1 -0
- package/dist/crypto/ecies/browser.cjs +164 -0
- package/dist/crypto/ecies/browser.cjs.map +1 -0
- package/dist/crypto/ecies/browser.d.cts +48 -0
- package/dist/crypto/ecies/browser.d.ts +48 -0
- package/dist/crypto/ecies/browser.js +130 -0
- package/dist/crypto/ecies/browser.js.map +1 -0
- package/dist/crypto/ecies/constants.cjs +131 -0
- package/dist/crypto/ecies/constants.cjs.map +1 -0
- package/dist/crypto/ecies/constants.d.cts +122 -0
- package/dist/crypto/ecies/constants.d.ts +122 -0
- package/dist/crypto/ecies/constants.js +101 -0
- package/dist/crypto/ecies/constants.js.map +1 -0
- package/dist/crypto/ecies/index.cjs +35 -0
- package/dist/crypto/ecies/index.cjs.map +1 -0
- package/dist/crypto/ecies/index.d.cts +1 -0
- package/dist/crypto/ecies/index.d.ts +1 -0
- package/dist/crypto/ecies/index.js +13 -0
- package/dist/crypto/ecies/index.js.map +1 -0
- package/dist/crypto/ecies/interface.cjs +88 -0
- package/dist/crypto/ecies/interface.cjs.map +1 -0
- package/dist/crypto/ecies/interface.d.cts +176 -0
- package/dist/crypto/ecies/interface.d.ts +176 -0
- package/dist/crypto/ecies/interface.js +61 -0
- package/dist/crypto/ecies/interface.js.map +1 -0
- package/dist/crypto/ecies/node.cjs +166 -0
- package/dist/crypto/ecies/node.cjs.map +1 -0
- package/dist/crypto/ecies/node.d.cts +50 -0
- package/dist/crypto/ecies/node.d.ts +50 -0
- package/dist/crypto/ecies/node.js +144 -0
- package/dist/crypto/ecies/node.js.map +1 -0
- package/dist/crypto/ecies/test-vectors/eccrypto-vectors.d.cts +76 -0
- package/dist/crypto/ecies/test-vectors/eccrypto-vectors.d.ts +76 -0
- package/dist/crypto/ecies/test-vectors/eccrypto-vectors.json +72 -0
- package/dist/crypto/ecies/utils.cjs +91 -0
- package/dist/crypto/ecies/utils.cjs.map +1 -0
- package/dist/crypto/ecies/utils.d.cts +67 -0
- package/dist/crypto/ecies/utils.d.ts +67 -0
- package/dist/crypto/ecies/utils.js +60 -0
- package/dist/crypto/ecies/utils.js.map +1 -0
- package/dist/crypto/services/WalletKeyEncryptionService.cjs +128 -0
- package/dist/crypto/services/WalletKeyEncryptionService.cjs.map +1 -0
- package/dist/crypto/services/WalletKeyEncryptionService.d.cts +92 -0
- package/dist/crypto/services/WalletKeyEncryptionService.d.ts +92 -0
- package/dist/crypto/services/WalletKeyEncryptionService.js +112 -0
- package/dist/crypto/services/WalletKeyEncryptionService.js.map +1 -0
- package/dist/diagnostics.cjs +37 -0
- package/dist/diagnostics.cjs.map +1 -0
- package/dist/diagnostics.d.cts +26 -0
- package/dist/diagnostics.d.ts +26 -0
- package/dist/diagnostics.js +13 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/errors.cjs +141 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +350 -0
- package/dist/errors.d.ts +350 -0
- package/dist/errors.js +108 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/abi/ComputeEngineImplementation.cjs +1313 -0
- package/dist/generated/abi/ComputeEngineImplementation.cjs.map +1 -0
- package/dist/generated/abi/ComputeEngineImplementation.d.cts +996 -0
- package/dist/generated/abi/ComputeEngineImplementation.d.ts +996 -0
- package/dist/generated/abi/ComputeEngineImplementation.js +1289 -0
- package/dist/generated/abi/ComputeEngineImplementation.js.map +1 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs +734 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.d.cts +545 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.d.ts +545 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js +710 -0
- package/dist/generated/abi/ComputeInstructionRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/DATFactoryImplementation.cjs +882 -0
- package/dist/generated/abi/DATFactoryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATFactoryImplementation.d.cts +661 -0
- package/dist/generated/abi/DATFactoryImplementation.d.ts +661 -0
- package/dist/generated/abi/DATFactoryImplementation.js +858 -0
- package/dist/generated/abi/DATFactoryImplementation.js.map +1 -0
- package/dist/generated/abi/DATImplementation.cjs +934 -0
- package/dist/generated/abi/DATImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATImplementation.d.cts +693 -0
- package/dist/generated/abi/DATImplementation.d.ts +693 -0
- package/dist/generated/abi/DATImplementation.js +910 -0
- package/dist/generated/abi/DATImplementation.js.map +1 -0
- package/dist/generated/abi/DATPausableImplementation.cjs +1523 -0
- package/dist/generated/abi/DATPausableImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATPausableImplementation.d.cts +1145 -0
- package/dist/generated/abi/DATPausableImplementation.d.ts +1145 -0
- package/dist/generated/abi/DATPausableImplementation.js +1499 -0
- package/dist/generated/abi/DATPausableImplementation.js.map +1 -0
- package/dist/generated/abi/DATVotesImplementation.cjs +1460 -0
- package/dist/generated/abi/DATVotesImplementation.cjs.map +1 -0
- package/dist/generated/abi/DATVotesImplementation.d.cts +1095 -0
- package/dist/generated/abi/DATVotesImplementation.d.ts +1095 -0
- package/dist/generated/abi/DATVotesImplementation.js +1436 -0
- package/dist/generated/abi/DATVotesImplementation.js.map +1 -0
- package/dist/generated/abi/DLPPerformanceImplementation.cjs +1160 -0
- package/dist/generated/abi/DLPPerformanceImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPPerformanceImplementation.d.cts +883 -0
- package/dist/generated/abi/DLPPerformanceImplementation.d.ts +883 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js +1136 -0
- package/dist/generated/abi/DLPPerformanceImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRegistryImplementation.cjs +1469 -0
- package/dist/generated/abi/DLPRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRegistryImplementation.d.cts +1123 -0
- package/dist/generated/abi/DLPRegistryImplementation.d.ts +1123 -0
- package/dist/generated/abi/DLPRegistryImplementation.js +1445 -0
- package/dist/generated/abi/DLPRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs +612 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.d.cts +452 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.d.ts +452 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.js +588 -0
- package/dist/generated/abi/DLPRegistryTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs +948 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.cts +714 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.d.ts +714 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.js +924 -0
- package/dist/generated/abi/DLPRewardDeployerImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs +612 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.cts +452 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.d.ts +452 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js +588 -0
- package/dist/generated/abi/DLPRewardDeployerTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.cjs +939 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.d.cts +706 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.d.ts +706 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.js +915 -0
- package/dist/generated/abi/DLPRewardSwapImplementation.js.map +1 -0
- package/dist/generated/abi/DLPRootImplementation.cjs +1644 -0
- package/dist/generated/abi/DLPRootImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPRootImplementation.d.cts +1248 -0
- package/dist/generated/abi/DLPRootImplementation.d.ts +1248 -0
- package/dist/generated/abi/DLPRootImplementation.js +1620 -0
- package/dist/generated/abi/DLPRootImplementation.js.map +1 -0
- package/dist/generated/abi/DLPTreasuryImplementation.cjs +612 -0
- package/dist/generated/abi/DLPTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DLPTreasuryImplementation.d.cts +452 -0
- package/dist/generated/abi/DLPTreasuryImplementation.d.ts +452 -0
- package/dist/generated/abi/DLPTreasuryImplementation.js +588 -0
- package/dist/generated/abi/DLPTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs +985 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.cts +737 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.d.ts +737 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.js +961 -0
- package/dist/generated/abi/DataLiquidityPoolImplementation.js.map +1 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs +888 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.d.cts +661 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.d.ts +661 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js +864 -0
- package/dist/generated/abi/DataPortabilityGranteesImplementation.js.map +1 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs +1317 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.cts +989 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.d.ts +989 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js +1293 -0
- package/dist/generated/abi/DataPortabilityPermissionsImplementation.js.map +1 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs +1438 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.d.cts +1086 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.d.ts +1086 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.js +1414 -0
- package/dist/generated/abi/DataPortabilityServersImplementation.js.map +1 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.cjs +984 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.d.cts +737 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.d.ts +737 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.js +960 -0
- package/dist/generated/abi/DataRefinerRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/DataRegistryImplementation.cjs +1341 -0
- package/dist/generated/abi/DataRegistryImplementation.cjs.map +1 -0
- package/dist/generated/abi/DataRegistryImplementation.d.cts +1014 -0
- package/dist/generated/abi/DataRegistryImplementation.d.ts +1014 -0
- package/dist/generated/abi/DataRegistryImplementation.js +1317 -0
- package/dist/generated/abi/DataRegistryImplementation.js.map +1 -0
- package/dist/generated/abi/QueryEngineImplementation.cjs +1319 -0
- package/dist/generated/abi/QueryEngineImplementation.cjs.map +1 -0
- package/dist/generated/abi/QueryEngineImplementation.d.cts +1001 -0
- package/dist/generated/abi/QueryEngineImplementation.d.ts +1001 -0
- package/dist/generated/abi/QueryEngineImplementation.js +1295 -0
- package/dist/generated/abi/QueryEngineImplementation.js.map +1 -0
- package/dist/generated/abi/SwapHelperImplementation.cjs +1019 -0
- package/dist/generated/abi/SwapHelperImplementation.cjs.map +1 -0
- package/dist/generated/abi/SwapHelperImplementation.d.cts +764 -0
- package/dist/generated/abi/SwapHelperImplementation.d.ts +764 -0
- package/dist/generated/abi/SwapHelperImplementation.js +995 -0
- package/dist/generated/abi/SwapHelperImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js +912 -0
- package/dist/generated/abi/TeePoolDedicatedGpuImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js +912 -0
- package/dist/generated/abi/TeePoolDedicatedStandardImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js +912 -0
- package/dist/generated/abi/TeePoolEphemeralStandardImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolImplementation.cjs +1313 -0
- package/dist/generated/abi/TeePoolImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolImplementation.d.cts +993 -0
- package/dist/generated/abi/TeePoolImplementation.d.ts +993 -0
- package/dist/generated/abi/TeePoolImplementation.js +1289 -0
- package/dist/generated/abi/TeePoolImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.js +912 -0
- package/dist/generated/abi/TeePoolPersistentGpuImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs +936 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.d.cts +701 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.d.ts +701 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.js +912 -0
- package/dist/generated/abi/TeePoolPersistentStandardImplementation.js.map +1 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.cjs +1313 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.cjs.map +1 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.d.cts +993 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.d.ts +993 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.js +1289 -0
- package/dist/generated/abi/TeePoolPhalaImplementation.js.map +1 -0
- package/dist/generated/abi/VanaEpochImplementation.cjs +1188 -0
- package/dist/generated/abi/VanaEpochImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaEpochImplementation.d.cts +900 -0
- package/dist/generated/abi/VanaEpochImplementation.d.ts +900 -0
- package/dist/generated/abi/VanaEpochImplementation.js +1164 -0
- package/dist/generated/abi/VanaEpochImplementation.js.map +1 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs +1234 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.d.cts +934 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.d.ts +934 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.js +1210 -0
- package/dist/generated/abi/VanaPoolEntityImplementation.js.map +1 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs +921 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.d.cts +693 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.d.ts +693 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.js +897 -0
- package/dist/generated/abi/VanaPoolStakingImplementation.js.map +1 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs +538 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.cjs.map +1 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.d.cts +394 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.d.ts +394 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.js +514 -0
- package/dist/generated/abi/VanaPoolTreasuryImplementation.js.map +1 -0
- package/dist/generated/abi/index.cjs +177 -0
- package/dist/generated/abi/index.cjs.map +1 -0
- package/dist/generated/abi/index.d.cts +26547 -0
- package/dist/generated/abi/index.d.ts +26547 -0
- package/dist/generated/abi/index.js +120 -0
- package/dist/generated/abi/index.js.map +1 -0
- package/dist/generated/event-types.cjs +17 -0
- package/dist/generated/event-types.cjs.map +1 -0
- package/dist/generated/event-types.d.cts +855 -0
- package/dist/generated/event-types.d.ts +855 -0
- package/dist/generated/event-types.js +1 -0
- package/dist/generated/event-types.js.map +1 -0
- package/dist/generated/eventRegistry.cjs +3351 -0
- package/dist/generated/eventRegistry.cjs.map +1 -0
- package/dist/generated/eventRegistry.d.cts +18 -0
- package/dist/generated/eventRegistry.d.ts +18 -0
- package/dist/generated/eventRegistry.js +3326 -0
- package/dist/generated/eventRegistry.js.map +1 -0
- package/dist/generated/server/server-exports.cjs +23 -0
- package/dist/generated/server/server-exports.cjs.map +1 -0
- package/dist/generated/server/server-exports.d.cts +21 -0
- package/dist/generated/server/server-exports.d.ts +21 -0
- package/dist/generated/server/server-exports.js +2 -0
- package/dist/generated/server/server-exports.js.map +1 -0
- package/dist/generated/server/server.cjs +17 -0
- package/dist/generated/server/server.cjs.map +1 -0
- package/dist/generated/server/server.d.cts +512 -0
- package/dist/generated/server/server.d.ts +512 -0
- package/dist/generated/server/server.js +1 -0
- package/dist/generated/server/server.js.map +1 -0
- package/dist/generated/subgraph.cjs +675 -0
- package/dist/generated/subgraph.cjs.map +1 -0
- package/dist/generated/subgraph.d.cts +5981 -0
- package/dist/generated/subgraph.d.ts +5981 -0
- package/dist/generated/subgraph.js +644 -0
- package/dist/generated/subgraph.js.map +1 -0
- package/dist/index.browser.cjs +151 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.d.cts +201 -0
- package/dist/index.browser.d.ts +162 -32452
- package/dist/index.browser.js +64 -40995
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.node.cjs +87 -41441
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.cts +86 -32596
- package/dist/index.node.d.ts +86 -32596
- package/dist/index.node.js +68 -41331
- package/dist/index.node.js.map +1 -1
- package/dist/node.cjs +29 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +2 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +5 -0
- package/dist/node.js.map +1 -0
- package/dist/platform/browser-only.cjs +37 -0
- package/dist/platform/browser-only.cjs.map +1 -0
- package/dist/platform/browser-only.d.cts +25 -0
- package/dist/platform/browser-only.d.ts +25 -0
- package/dist/platform/browser-only.js +12 -0
- package/dist/platform/browser-only.js.map +1 -0
- package/dist/platform/browser-safe.cjs +57 -0
- package/dist/platform/browser-safe.cjs.map +1 -0
- package/dist/platform/browser-safe.d.cts +32 -0
- package/dist/platform/browser-safe.d.ts +32 -0
- package/dist/platform/browser-safe.js +31 -0
- package/dist/platform/browser-safe.js.map +1 -0
- package/dist/platform/browser.cjs +329 -0
- package/dist/platform/browser.cjs.map +1 -0
- package/dist/platform/browser.d.cts +74 -0
- package/dist/platform/browser.d.ts +74 -0
- package/dist/platform/browser.js +304 -0
- package/dist/platform/browser.js.map +1 -0
- package/dist/platform/index.cjs +50 -0
- package/dist/platform/index.cjs.map +1 -0
- package/dist/platform/index.d.cts +5 -0
- package/dist/platform/index.d.ts +5 -0
- package/dist/platform/index.js +27 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/interface.cjs +17 -0
- package/dist/platform/interface.cjs.map +1 -0
- package/dist/platform/interface.d.cts +218 -0
- package/dist/platform/interface.d.ts +218 -0
- package/dist/platform/interface.js +1 -0
- package/dist/platform/interface.js.map +1 -0
- package/dist/platform/node.cjs +351 -0
- package/dist/platform/node.cjs.map +1 -0
- package/dist/platform/node.d.cts +27 -0
- package/dist/platform/node.d.ts +27 -0
- package/dist/platform/node.js +327 -0
- package/dist/platform/node.js.map +1 -0
- package/dist/platform/shared/error-utils.cjs +43 -0
- package/dist/platform/shared/error-utils.cjs.map +1 -0
- package/dist/platform/shared/error-utils.d.cts +25 -0
- package/dist/platform/shared/error-utils.d.ts +25 -0
- package/dist/platform/shared/error-utils.js +18 -0
- package/dist/platform/shared/error-utils.js.map +1 -0
- package/dist/platform/shared/pgp-utils.cjs +55 -0
- package/dist/platform/shared/pgp-utils.cjs.map +1 -0
- package/dist/platform/shared/pgp-utils.d.cts +61 -0
- package/dist/platform/shared/pgp-utils.d.ts +61 -0
- package/dist/platform/shared/pgp-utils.js +29 -0
- package/dist/platform/shared/pgp-utils.js.map +1 -0
- package/dist/platform/shared/stream-utils.cjs +49 -0
- package/dist/platform/shared/stream-utils.cjs.map +1 -0
- package/dist/platform/shared/stream-utils.d.cts +16 -0
- package/dist/platform/shared/stream-utils.d.ts +16 -0
- package/dist/platform/shared/stream-utils.js +25 -0
- package/dist/platform/shared/stream-utils.js.map +1 -0
- package/dist/platform/utils.cjs +114 -0
- package/dist/platform/utils.cjs.map +1 -0
- package/dist/platform/utils.d.cts +53 -0
- package/dist/platform/utils.d.ts +53 -0
- package/dist/platform/utils.js +76 -0
- package/dist/platform/utils.js.map +1 -0
- package/dist/platform.browser.cjs +41 -0
- package/dist/platform.browser.cjs.map +1 -0
- package/dist/platform.browser.d.cts +4 -0
- package/dist/platform.browser.d.ts +4 -224
- package/dist/platform.browser.js +10 -309
- package/dist/platform.browser.js.map +1 -1
- package/dist/platform.cjs +14 -623
- package/dist/platform.cjs.map +1 -1
- package/dist/platform.d.cts +5 -1
- package/dist/platform.d.ts +5 -1
- package/dist/platform.js +14 -609
- package/dist/platform.js.map +1 -1
- package/dist/platform.node.cjs +14 -623
- package/dist/platform.node.cjs.map +1 -1
- package/dist/platform.node.d.cts +5 -264
- package/dist/platform.node.d.ts +5 -264
- package/dist/platform.node.js +14 -609
- package/dist/platform.node.js.map +1 -1
- package/dist/schemas/dataSchema.schema.d.cts +88 -0
- package/dist/schemas/dataSchema.schema.d.ts +88 -0
- package/dist/schemas/dataSchema.schema.json +53 -0
- package/dist/schemas/grantFile.schema.d.cts +57 -0
- package/dist/schemas/grantFile.schema.d.ts +57 -0
- package/dist/schemas/grantFile.schema.json +43 -0
- package/dist/server/handler.cjs +101 -0
- package/dist/server/handler.cjs.map +1 -0
- package/dist/server/handler.d.cts +306 -0
- package/dist/server/handler.d.ts +306 -0
- package/dist/server/handler.js +77 -0
- package/dist/server/handler.js.map +1 -0
- package/dist/storage/index.cjs +44 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.cts +10 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.js +15 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/manager.cjs +189 -0
- package/dist/storage/manager.cjs.map +1 -0
- package/dist/storage/manager.d.cts +150 -0
- package/dist/storage/manager.d.ts +150 -0
- package/dist/storage/manager.js +172 -0
- package/dist/storage/manager.js.map +1 -0
- package/dist/storage/providers/callback-storage.cjs +177 -0
- package/dist/storage/providers/callback-storage.cjs.map +1 -0
- package/dist/storage/providers/callback-storage.d.cts +100 -0
- package/dist/storage/providers/callback-storage.d.ts +100 -0
- package/dist/storage/providers/callback-storage.js +155 -0
- package/dist/storage/providers/callback-storage.js.map +1 -0
- package/dist/storage/providers/google-drive.cjs +516 -0
- package/dist/storage/providers/google-drive.cjs.map +1 -0
- package/dist/storage/providers/google-drive.d.cts +156 -0
- package/dist/storage/providers/google-drive.d.ts +156 -0
- package/dist/storage/providers/google-drive.js +497 -0
- package/dist/storage/providers/google-drive.js.map +1 -0
- package/dist/storage/providers/ipfs.cjs +283 -0
- package/dist/storage/providers/ipfs.cjs.map +1 -0
- package/dist/storage/providers/ipfs.d.cts +163 -0
- package/dist/storage/providers/ipfs.d.ts +163 -0
- package/dist/storage/providers/ipfs.js +264 -0
- package/dist/storage/providers/ipfs.js.map +1 -0
- package/dist/storage/providers/pinata.cjs +339 -0
- package/dist/storage/providers/pinata.cjs.map +1 -0
- package/dist/storage/providers/pinata.d.cts +173 -0
- package/dist/storage/providers/pinata.d.ts +173 -0
- package/dist/storage/providers/pinata.js +320 -0
- package/dist/storage/providers/pinata.js.map +1 -0
- package/dist/types/blockchain.cjs +17 -0
- package/dist/types/blockchain.cjs.map +1 -0
- package/dist/types/blockchain.d.cts +52 -0
- package/dist/types/blockchain.d.ts +52 -0
- package/dist/types/blockchain.js +1 -0
- package/dist/types/blockchain.js.map +1 -0
- package/dist/types/chains.cjs +36 -0
- package/dist/types/chains.cjs.map +1 -0
- package/dist/types/chains.d.cts +34 -0
- package/dist/types/chains.d.ts +34 -0
- package/dist/types/chains.js +11 -0
- package/dist/types/chains.js.map +1 -0
- package/dist/types/config.cjs +41 -0
- package/dist/types/config.cjs.map +1 -0
- package/dist/types/config.d.cts +726 -0
- package/dist/types/config.d.ts +726 -0
- package/dist/types/config.js +15 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/contracts.cjs +17 -0
- package/dist/types/contracts.cjs.map +1 -0
- package/dist/types/contracts.d.cts +68 -0
- package/dist/types/contracts.d.ts +68 -0
- package/dist/types/contracts.js +1 -0
- package/dist/types/contracts.js.map +1 -0
- package/dist/types/controller-context.cjs +17 -0
- package/dist/types/controller-context.cjs.map +1 -0
- package/dist/types/controller-context.d.cts +71 -0
- package/dist/types/controller-context.d.ts +71 -0
- package/dist/types/controller-context.js +1 -0
- package/dist/types/controller-context.js.map +1 -0
- package/dist/types/data.cjs +17 -0
- package/dist/types/data.cjs.map +1 -0
- package/dist/types/data.d.cts +694 -0
- package/dist/types/data.d.ts +694 -0
- package/dist/types/data.js +1 -0
- package/dist/types/data.js.map +1 -0
- package/dist/types/eccrypto-js.d.cjs +2 -0
- package/dist/types/eccrypto-js.d.cjs.map +1 -0
- package/dist/types/eccrypto-js.d.d.cts +13 -0
- package/dist/types/eccrypto-js.d.d.ts +13 -0
- package/dist/types/eccrypto-js.d.js +1 -0
- package/dist/types/eccrypto-js.d.js.map +1 -0
- package/dist/types/external-apis.cjs +61 -0
- package/dist/types/external-apis.cjs.map +1 -0
- package/dist/types/external-apis.d.cts +186 -0
- package/dist/types/external-apis.d.ts +186 -0
- package/dist/types/external-apis.js +34 -0
- package/dist/types/external-apis.js.map +1 -0
- package/dist/types/generics.cjs +17 -0
- package/dist/types/generics.cjs.map +1 -0
- package/dist/types/generics.d.cts +450 -0
- package/dist/types/generics.d.ts +450 -0
- package/dist/types/generics.js +1 -0
- package/dist/types/generics.js.map +1 -0
- package/dist/types/index.cjs +64 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +22 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.js +35 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/operations.cjs +65 -0
- package/dist/types/operations.cjs.map +1 -0
- package/dist/types/operations.d.cts +116 -0
- package/dist/types/operations.d.ts +116 -0
- package/dist/types/operations.js +37 -0
- package/dist/types/operations.js.map +1 -0
- package/dist/types/permissions.cjs +17 -0
- package/dist/types/permissions.cjs.map +1 -0
- package/dist/types/permissions.d.cts +957 -0
- package/dist/types/permissions.d.ts +957 -0
- package/dist/types/permissions.js +1 -0
- package/dist/types/permissions.js.map +1 -0
- package/dist/types/personal.cjs +17 -0
- package/dist/types/personal.cjs.map +1 -0
- package/dist/types/personal.d.cts +40 -0
- package/dist/types/personal.d.ts +40 -0
- package/dist/types/personal.js +1 -0
- package/dist/types/personal.js.map +1 -0
- package/dist/types/relayer.cjs +17 -0
- package/dist/types/relayer.cjs.map +1 -0
- package/dist/types/relayer.d.cts +284 -0
- package/dist/types/relayer.d.ts +284 -0
- package/dist/types/relayer.js +1 -0
- package/dist/types/relayer.js.map +1 -0
- package/dist/types/storage.cjs +39 -0
- package/dist/types/storage.cjs.map +1 -0
- package/dist/types/storage.d.cts +131 -0
- package/dist/types/storage.d.ts +131 -0
- package/dist/types/storage.js +18 -0
- package/dist/types/storage.js.map +1 -0
- package/dist/types/transactionResults.cjs +17 -0
- package/dist/types/transactionResults.cjs.map +1 -0
- package/dist/types/transactionResults.d.cts +195 -0
- package/dist/types/transactionResults.d.ts +195 -0
- package/dist/types/transactionResults.js +1 -0
- package/dist/types/transactionResults.js.map +1 -0
- package/dist/types/utils.cjs +17 -0
- package/dist/types/utils.cjs.map +1 -0
- package/dist/types/utils.d.cts +819 -0
- package/dist/types/utils.d.ts +819 -0
- package/dist/types/utils.js +1 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/types.cjs +23 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +54 -0
- package/dist/types.d.ts +54 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/blockchain/registry.cjs +81 -0
- package/dist/utils/blockchain/registry.cjs.map +1 -0
- package/dist/utils/blockchain/registry.d.cts +34 -0
- package/dist/utils/blockchain/registry.d.ts +34 -0
- package/dist/utils/blockchain/registry.js +56 -0
- package/dist/utils/blockchain/registry.js.map +1 -0
- package/dist/utils/crypto-utils.cjs +120 -0
- package/dist/utils/crypto-utils.cjs.map +1 -0
- package/dist/utils/crypto-utils.d.cts +118 -0
- package/dist/utils/crypto-utils.d.ts +118 -0
- package/dist/utils/crypto-utils.js +87 -0
- package/dist/utils/crypto-utils.js.map +1 -0
- package/dist/utils/download.cjs +69 -0
- package/dist/utils/download.cjs.map +1 -0
- package/dist/utils/download.d.cts +41 -0
- package/dist/utils/download.d.ts +41 -0
- package/dist/utils/download.js +45 -0
- package/dist/utils/download.js.map +1 -0
- package/dist/utils/encoding.cjs +66 -0
- package/dist/utils/encoding.cjs.map +1 -0
- package/dist/utils/encoding.d.cts +54 -0
- package/dist/utils/encoding.d.ts +54 -0
- package/dist/utils/encoding.js +39 -0
- package/dist/utils/encoding.js.map +1 -0
- package/dist/utils/encryption.cjs +170 -0
- package/dist/utils/encryption.cjs.map +1 -0
- package/dist/utils/encryption.d.cts +275 -0
- package/dist/utils/encryption.d.ts +275 -0
- package/dist/utils/encryption.js +136 -0
- package/dist/utils/encryption.js.map +1 -0
- package/dist/utils/formatters.cjs +53 -0
- package/dist/utils/formatters.cjs.map +1 -0
- package/dist/utils/formatters.d.cts +120 -0
- package/dist/utils/formatters.d.ts +120 -0
- package/dist/utils/formatters.js +26 -0
- package/dist/utils/formatters.js.map +1 -0
- package/dist/utils/grantFiles.cjs +175 -0
- package/dist/utils/grantFiles.cjs.map +1 -0
- package/dist/utils/grantFiles.d.cts +186 -0
- package/dist/utils/grantFiles.d.ts +186 -0
- package/dist/utils/grantFiles.js +137 -0
- package/dist/utils/grantFiles.js.map +1 -0
- package/dist/utils/grantValidation.cjs +243 -0
- package/dist/utils/grantValidation.cjs.map +1 -0
- package/dist/utils/grantValidation.d.cts +150 -0
- package/dist/utils/grantValidation.d.ts +150 -0
- package/dist/utils/grantValidation.js +201 -0
- package/dist/utils/grantValidation.js.map +1 -0
- package/dist/utils/grants.cjs +108 -0
- package/dist/utils/grants.cjs.map +1 -0
- package/dist/utils/grants.d.cts +70 -0
- package/dist/utils/grants.d.ts +70 -0
- package/dist/utils/grants.js +82 -0
- package/dist/utils/grants.js.map +1 -0
- package/dist/utils/ipfs.cjs +130 -0
- package/dist/utils/ipfs.cjs.map +1 -0
- package/dist/utils/ipfs.d.cts +90 -0
- package/dist/utils/ipfs.d.ts +90 -0
- package/dist/utils/ipfs.js +99 -0
- package/dist/utils/ipfs.js.map +1 -0
- package/dist/utils/lazy-import.cjs +40 -0
- package/dist/utils/lazy-import.cjs.map +1 -0
- package/dist/utils/lazy-import.d.cts +20 -0
- package/dist/utils/lazy-import.d.ts +20 -0
- package/dist/utils/lazy-import.js +16 -0
- package/dist/utils/lazy-import.js.map +1 -0
- package/dist/utils/multicall.cjs +231 -0
- package/dist/utils/multicall.cjs.map +1 -0
- package/dist/utils/multicall.d.cts +129 -0
- package/dist/utils/multicall.d.ts +129 -0
- package/dist/utils/multicall.js +206 -0
- package/dist/utils/multicall.js.map +1 -0
- package/dist/utils/parseTransactionPojo.cjs +87 -0
- package/dist/utils/parseTransactionPojo.cjs.map +1 -0
- package/dist/utils/parseTransactionPojo.d.cts +37 -0
- package/dist/utils/parseTransactionPojo.d.ts +37 -0
- package/dist/utils/parseTransactionPojo.js +63 -0
- package/dist/utils/parseTransactionPojo.js.map +1 -0
- package/dist/utils/schemaValidation.cjs +258 -0
- package/dist/utils/schemaValidation.cjs.map +1 -0
- package/dist/utils/schemaValidation.d.cts +172 -0
- package/dist/utils/schemaValidation.d.ts +172 -0
- package/dist/utils/schemaValidation.js +222 -0
- package/dist/utils/schemaValidation.js.map +1 -0
- package/dist/utils/signatureCache.cjs +187 -0
- package/dist/utils/signatureCache.cjs.map +1 -0
- package/dist/utils/signatureCache.d.cts +134 -0
- package/dist/utils/signatureCache.d.ts +134 -0
- package/dist/utils/signatureCache.js +165 -0
- package/dist/utils/signatureCache.js.map +1 -0
- package/dist/utils/signatureFormatter.cjs +45 -0
- package/dist/utils/signatureFormatter.cjs.map +1 -0
- package/dist/utils/signatureFormatter.d.cts +39 -0
- package/dist/utils/signatureFormatter.d.ts +39 -0
- package/dist/utils/signatureFormatter.js +21 -0
- package/dist/utils/signatureFormatter.js.map +1 -0
- package/dist/utils/transactionHelpers.cjs +54 -0
- package/dist/utils/transactionHelpers.cjs.map +1 -0
- package/dist/utils/transactionHelpers.d.cts +86 -0
- package/dist/utils/transactionHelpers.d.ts +86 -0
- package/dist/utils/transactionHelpers.js +29 -0
- package/dist/utils/transactionHelpers.js.map +1 -0
- package/dist/utils/typedDataConverter.cjs +43 -0
- package/dist/utils/typedDataConverter.cjs.map +1 -0
- package/dist/utils/typedDataConverter.d.cts +13 -0
- package/dist/utils/typedDataConverter.d.ts +13 -0
- package/dist/utils/typedDataConverter.js +19 -0
- package/dist/utils/typedDataConverter.js.map +1 -0
- package/dist/utils/urlResolver.cjs +55 -0
- package/dist/utils/urlResolver.cjs.map +1 -0
- package/dist/utils/urlResolver.d.cts +40 -0
- package/dist/utils/urlResolver.d.ts +40 -0
- package/dist/utils/urlResolver.js +30 -0
- package/dist/utils/urlResolver.js.map +1 -0
- package/dist/utils/withEvents.cjs +44 -0
- package/dist/utils/withEvents.cjs.map +1 -0
- package/dist/utils/withEvents.d.cts +63 -0
- package/dist/utils/withEvents.d.ts +63 -0
- package/dist/utils/withEvents.js +18 -0
- package/dist/utils/withEvents.js.map +1 -0
- package/package.json +58 -27
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var schemaValidation_exports = {};
|
|
30
|
+
__export(schemaValidation_exports, {
|
|
31
|
+
SchemaValidationError: () => SchemaValidationError,
|
|
32
|
+
SchemaValidator: () => SchemaValidator,
|
|
33
|
+
fetchAndValidateSchema: () => fetchAndValidateSchema,
|
|
34
|
+
schemaValidator: () => schemaValidator,
|
|
35
|
+
validateDataAgainstSchema: () => validateDataAgainstSchema,
|
|
36
|
+
validateDataSchemaAgainstMetaSchema: () => validateDataSchemaAgainstMetaSchema
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(schemaValidation_exports);
|
|
39
|
+
var import_ajv = __toESM(require("ajv"), 1);
|
|
40
|
+
var import_ajv_formats = __toESM(require("ajv-formats"), 1);
|
|
41
|
+
var import_dataSchema_schema = __toESM(require("../schemas/dataSchema.schema.json"), 1);
|
|
42
|
+
class SchemaValidationError extends Error {
|
|
43
|
+
constructor(message, errors) {
|
|
44
|
+
super(message);
|
|
45
|
+
this.errors = errors;
|
|
46
|
+
this.name = "SchemaValidationError";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class SchemaValidator {
|
|
50
|
+
ajv;
|
|
51
|
+
dataSchemaValidator;
|
|
52
|
+
constructor() {
|
|
53
|
+
this.ajv = new import_ajv.default({
|
|
54
|
+
allErrors: true,
|
|
55
|
+
verbose: true,
|
|
56
|
+
strict: false
|
|
57
|
+
});
|
|
58
|
+
(0, import_ajv_formats.default)(this.ajv);
|
|
59
|
+
this.dataSchemaValidator = this.ajv.compile(import_dataSchema_schema.default);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Validates a data schema definition against the Vana meta-schema
|
|
63
|
+
*
|
|
64
|
+
* @param schema - The data schema definition to validate
|
|
65
|
+
* @throws SchemaValidationError if invalid
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const validator = new SchemaValidator();
|
|
69
|
+
*
|
|
70
|
+
* const schema = {
|
|
71
|
+
* name: "User Profile",
|
|
72
|
+
* version: "1.0.0",
|
|
73
|
+
* dialect: "json",
|
|
74
|
+
* schema: {
|
|
75
|
+
* type: "object",
|
|
76
|
+
* properties: {
|
|
77
|
+
* name: { type: "string" },
|
|
78
|
+
* age: { type: "number" }
|
|
79
|
+
* }
|
|
80
|
+
* }
|
|
81
|
+
* };
|
|
82
|
+
*
|
|
83
|
+
* validator.validateDataSchemaAgainstMetaSchema(schema); // throws if invalid
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
validateDataSchemaAgainstMetaSchema(schema) {
|
|
87
|
+
const isValid = this.dataSchemaValidator(schema);
|
|
88
|
+
if (!isValid) {
|
|
89
|
+
const errors = this.dataSchemaValidator.errors || [];
|
|
90
|
+
const errorMessage = `Data schema validation failed: ${errors.map((e) => `${e.instancePath} ${e.message}`).join(", ")}`;
|
|
91
|
+
throw new SchemaValidationError(errorMessage, errors);
|
|
92
|
+
}
|
|
93
|
+
const typedSchema = schema;
|
|
94
|
+
if (typedSchema.dialect === "json" && typeof typedSchema.schema === "object") {
|
|
95
|
+
try {
|
|
96
|
+
this.ajv.compile(typedSchema.schema);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
const errorMessage = `Invalid JSON Schema in data schema: ${error instanceof Error ? error.message : "Unknown schema compilation error"}`;
|
|
99
|
+
throw new SchemaValidationError(errorMessage, []);
|
|
100
|
+
}
|
|
101
|
+
} else if (typedSchema.dialect === "sqlite" && typeof typedSchema.schema === "string") {
|
|
102
|
+
this.validateSQLiteDDL(typedSchema.schema, typedSchema.dialectVersion);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Validates data against a JSON Schema
|
|
107
|
+
*
|
|
108
|
+
* @param data - The data to validate
|
|
109
|
+
* @param schema - The schema containing the validation rules (must have been validated or fetched from chain)
|
|
110
|
+
* @throws SchemaValidationError if invalid
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const validator = new SchemaValidator();
|
|
114
|
+
*
|
|
115
|
+
* // Works with Schema from schemas.get()
|
|
116
|
+
* const schema = await vana.schemas.get(1);
|
|
117
|
+
* validator.validateDataAgainstSchema(userData, schema);
|
|
118
|
+
*
|
|
119
|
+
* // Also works with pre-validated DataSchema object
|
|
120
|
+
* const dataSchema = validator.validateDataSchemaAgainstMetaSchema({
|
|
121
|
+
* name: "User Profile",
|
|
122
|
+
* version: "1.0.0",
|
|
123
|
+
* dialect: "json",
|
|
124
|
+
* schema: { type: "object", properties: { name: { type: "string" } } }
|
|
125
|
+
* });
|
|
126
|
+
* validator.validateDataAgainstSchema(userData, dataSchema);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
validateDataAgainstSchema(data, schema) {
|
|
130
|
+
if (schema.dialect !== "json") {
|
|
131
|
+
console.warn(
|
|
132
|
+
`[SchemaValidator] Data validation skipped: dialect '${schema.dialect}' does not support data validation. Only JSON schemas can validate data structure.`
|
|
133
|
+
);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (typeof schema.schema !== "object") {
|
|
137
|
+
throw new SchemaValidationError(
|
|
138
|
+
"JSON dialect schemas must have an object schema",
|
|
139
|
+
[]
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
const dataValidator = this.ajv.compile(schema.schema);
|
|
143
|
+
const isValid = dataValidator(data);
|
|
144
|
+
if (!isValid) {
|
|
145
|
+
const errors = dataValidator.errors || [];
|
|
146
|
+
const errorMessage = `Data validation failed: ${errors.map((e) => `${e.instancePath} ${e.message}`).join(", ")}`;
|
|
147
|
+
throw new SchemaValidationError(errorMessage, errors);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Validates a SQLite DDL string for basic syntax
|
|
152
|
+
* Note: This is a basic validation, full SQL parsing would require a proper SQL parser
|
|
153
|
+
*
|
|
154
|
+
* @param ddl - The DDL string to validate
|
|
155
|
+
* @param dialectVersion - Optional SQLite version (e.g., "3" for SQLite v3)
|
|
156
|
+
* @throws SchemaValidationError if invalid
|
|
157
|
+
*/
|
|
158
|
+
validateSQLiteDDL(ddl, dialectVersion) {
|
|
159
|
+
if (typeof ddl !== "string" || ddl.trim().length === 0) {
|
|
160
|
+
throw new SchemaValidationError(
|
|
161
|
+
"SQLite DDL must be a non-empty string",
|
|
162
|
+
[]
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
if (dialectVersion !== void 0) {
|
|
166
|
+
const supportedVersions = ["3"];
|
|
167
|
+
if (!supportedVersions.includes(dialectVersion)) {
|
|
168
|
+
throw new SchemaValidationError(
|
|
169
|
+
`Unsupported SQLite dialect version: ${dialectVersion}. Supported versions: ${supportedVersions.join(", ")}`,
|
|
170
|
+
[]
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const normalizedDDL = ddl.trim().toUpperCase();
|
|
175
|
+
if (!normalizedDDL.includes("CREATE TABLE")) {
|
|
176
|
+
throw new SchemaValidationError(
|
|
177
|
+
"SQLite DDL must contain at least one CREATE TABLE statement",
|
|
178
|
+
[]
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
let parenCount = 0;
|
|
182
|
+
for (const char of ddl) {
|
|
183
|
+
if (char === "(") parenCount++;
|
|
184
|
+
if (char === ")") parenCount--;
|
|
185
|
+
if (parenCount < 0) {
|
|
186
|
+
throw new SchemaValidationError(
|
|
187
|
+
"SQLite DDL has unbalanced parentheses",
|
|
188
|
+
[]
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (parenCount !== 0) {
|
|
193
|
+
throw new SchemaValidationError(
|
|
194
|
+
"SQLite DDL has unbalanced parentheses",
|
|
195
|
+
[]
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Fetches and validates a data schema from a URL
|
|
201
|
+
*
|
|
202
|
+
* @param url - The URL to fetch the data schema from
|
|
203
|
+
* @param downloadRelayer - Optional download relayer for CORS bypass
|
|
204
|
+
* @param downloadRelayer.proxyDownload - Function to proxy downloads through application server
|
|
205
|
+
* @returns The validated data schema
|
|
206
|
+
* @throws SchemaValidationError if invalid or fetch fails
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const validator = new SchemaValidator();
|
|
210
|
+
* const schema = await validator.fetchAndValidateSchema("https://example.com/schema.json");
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
async fetchAndValidateSchema(url, downloadRelayer) {
|
|
214
|
+
try {
|
|
215
|
+
const { fetchWithRelayer } = await import("./download");
|
|
216
|
+
const response = await fetchWithRelayer(url, downloadRelayer);
|
|
217
|
+
if (!response.ok) {
|
|
218
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
219
|
+
}
|
|
220
|
+
const schema = await response.json();
|
|
221
|
+
this.validateDataSchemaAgainstMetaSchema(schema);
|
|
222
|
+
if (schema.dialect === "sqlite" && typeof schema.schema === "string") {
|
|
223
|
+
this.validateSQLiteDDL(schema.schema, schema.dialectVersion);
|
|
224
|
+
}
|
|
225
|
+
return schema;
|
|
226
|
+
} catch (error) {
|
|
227
|
+
if (error instanceof SchemaValidationError) {
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
throw new SchemaValidationError(
|
|
231
|
+
`Failed to fetch and validate schema from ${url}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
232
|
+
[]
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const schemaValidator = new SchemaValidator();
|
|
238
|
+
function validateDataSchemaAgainstMetaSchema(schema) {
|
|
239
|
+
const validator = schemaValidator;
|
|
240
|
+
validator.validateDataSchemaAgainstMetaSchema(schema);
|
|
241
|
+
return schema;
|
|
242
|
+
}
|
|
243
|
+
function validateDataAgainstSchema(data, schema) {
|
|
244
|
+
return schemaValidator.validateDataAgainstSchema(data, schema);
|
|
245
|
+
}
|
|
246
|
+
function fetchAndValidateSchema(url, downloadRelayer) {
|
|
247
|
+
return schemaValidator.fetchAndValidateSchema(url, downloadRelayer);
|
|
248
|
+
}
|
|
249
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
250
|
+
0 && (module.exports = {
|
|
251
|
+
SchemaValidationError,
|
|
252
|
+
SchemaValidator,
|
|
253
|
+
fetchAndValidateSchema,
|
|
254
|
+
schemaValidator,
|
|
255
|
+
validateDataAgainstSchema,
|
|
256
|
+
validateDataSchemaAgainstMetaSchema
|
|
257
|
+
});
|
|
258
|
+
//# sourceMappingURL=schemaValidation.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/schemaValidation.ts"],"sourcesContent":["import Ajv, { type ValidateFunction } from \"ajv\";\nimport addFormats from \"ajv-formats\";\nimport dataSchemaSchema from \"../schemas/dataSchema.schema.json\";\nimport type { Schema } from \"../types/data\";\n\n/**\n * Data schema interface following the Vana schema specification\n *\n * @category Configuration\n */\nexport interface DataSchema {\n /** The name of the data schema */\n name: string;\n /** The version of the data schema */\n version: string;\n /** Optional description of the data schema */\n description?: string;\n /** The dialect type - either SQLite or JSON */\n dialect: \"sqlite\" | \"json\";\n /** Optional version of the dialect */\n dialectVersion?: string;\n /** The actual schema definition as string or object */\n schema: string | object;\n}\n\n/**\n * Error thrown when schema validation fails\n */\nexport class SchemaValidationError extends Error {\n constructor(\n message: string,\n public errors: Array<{\n instancePath: string;\n schemaPath: string;\n keyword: string;\n params: Record<string, unknown>;\n message?: string;\n }>,\n ) {\n super(message);\n this.name = \"SchemaValidationError\";\n }\n}\n\n/**\n * Data schema validation utility class\n */\nexport class SchemaValidator {\n private ajv: Ajv;\n private dataSchemaValidator: ValidateFunction;\n\n constructor() {\n this.ajv = new Ajv({\n allErrors: true,\n verbose: true,\n strict: false,\n });\n\n // Add format validation (e.g., date, email, uri)\n addFormats(this.ajv);\n\n // Compile the data schema meta-schema validator\n this.dataSchemaValidator = this.ajv.compile(dataSchemaSchema);\n }\n\n /**\n * Validates a data schema definition against the Vana meta-schema\n *\n * @param schema - The data schema definition to validate\n * @throws SchemaValidationError if invalid\n * @example\n * ```typescript\n * const validator = new SchemaValidator();\n *\n * const schema = {\n * name: \"User Profile\",\n * version: \"1.0.0\",\n * dialect: \"json\",\n * schema: {\n * type: \"object\",\n * properties: {\n * name: { type: \"string\" },\n * age: { type: \"number\" }\n * }\n * }\n * };\n *\n * validator.validateDataSchemaAgainstMetaSchema(schema); // throws if invalid\n * ```\n */\n validateDataSchemaAgainstMetaSchema(\n schema: unknown,\n ): asserts schema is DataSchema {\n const isValid = this.dataSchemaValidator(schema);\n\n if (!isValid) {\n const errors = this.dataSchemaValidator.errors || [];\n const errorMessage = `Data schema validation failed: ${errors.map((e) => `${e.instancePath} ${e.message}`).join(\", \")}`;\n throw new SchemaValidationError(errorMessage, errors);\n }\n\n // Additional validation based on dialect\n const typedSchema = schema as DataSchema;\n if (\n typedSchema.dialect === \"json\" &&\n typeof typedSchema.schema === \"object\"\n ) {\n // Validate that the embedded JSON Schema is actually valid\n try {\n this.ajv.compile(typedSchema.schema);\n } catch (error) {\n const errorMessage = `Invalid JSON Schema in data schema: ${error instanceof Error ? error.message : \"Unknown schema compilation error\"}`;\n throw new SchemaValidationError(errorMessage, []);\n }\n } else if (\n typedSchema.dialect === \"sqlite\" &&\n typeof typedSchema.schema === \"string\"\n ) {\n // Validate SQLite DDL syntax\n this.validateSQLiteDDL(typedSchema.schema, typedSchema.dialectVersion);\n }\n }\n\n /**\n * Validates data against a JSON Schema\n *\n * @param data - The data to validate\n * @param schema - The schema containing the validation rules (must have been validated or fetched from chain)\n * @throws SchemaValidationError if invalid\n * @example\n * ```typescript\n * const validator = new SchemaValidator();\n *\n * // Works with Schema from schemas.get()\n * const schema = await vana.schemas.get(1);\n * validator.validateDataAgainstSchema(userData, schema);\n *\n * // Also works with pre-validated DataSchema object\n * const dataSchema = validator.validateDataSchemaAgainstMetaSchema({\n * name: \"User Profile\",\n * version: \"1.0.0\",\n * dialect: \"json\",\n * schema: { type: \"object\", properties: { name: { type: \"string\" } } }\n * });\n * validator.validateDataAgainstSchema(userData, dataSchema);\n * ```\n */\n validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void {\n if (schema.dialect !== \"json\") {\n console.warn(\n `[SchemaValidator] Data validation skipped: dialect '${schema.dialect}' does not support data validation. ` +\n `Only JSON schemas can validate data structure.`,\n );\n return;\n }\n\n if (typeof schema.schema !== \"object\") {\n throw new SchemaValidationError(\n \"JSON dialect schemas must have an object schema\",\n [],\n );\n }\n\n // Compile and validate against the data schema\n const dataValidator = this.ajv.compile(schema.schema);\n const isValid = dataValidator(data);\n\n if (!isValid) {\n const errors = dataValidator.errors || [];\n const errorMessage = `Data validation failed: ${errors.map((e) => `${e.instancePath} ${e.message}`).join(\", \")}`;\n throw new SchemaValidationError(errorMessage, errors);\n }\n }\n\n /**\n * Validates a SQLite DDL string for basic syntax\n * Note: This is a basic validation, full SQL parsing would require a proper SQL parser\n *\n * @param ddl - The DDL string to validate\n * @param dialectVersion - Optional SQLite version (e.g., \"3\" for SQLite v3)\n * @throws SchemaValidationError if invalid\n */\n validateSQLiteDDL(ddl: string, dialectVersion?: string): void {\n if (typeof ddl !== \"string\" || ddl.trim().length === 0) {\n throw new SchemaValidationError(\n \"SQLite DDL must be a non-empty string\",\n [],\n );\n }\n\n // Validate dialectVersion if provided\n if (dialectVersion !== undefined) {\n const supportedVersions = [\"3\"];\n if (!supportedVersions.includes(dialectVersion)) {\n throw new SchemaValidationError(\n `Unsupported SQLite dialect version: ${dialectVersion}. Supported versions: ${supportedVersions.join(\", \")}`,\n [],\n );\n }\n }\n\n // Basic validation - check for CREATE TABLE statements\n const normalizedDDL = ddl.trim().toUpperCase();\n if (!normalizedDDL.includes(\"CREATE TABLE\")) {\n throw new SchemaValidationError(\n \"SQLite DDL must contain at least one CREATE TABLE statement\",\n [],\n );\n }\n\n // Check for balanced parentheses\n let parenCount = 0;\n for (const char of ddl) {\n if (char === \"(\") parenCount++;\n if (char === \")\") parenCount--;\n if (parenCount < 0) {\n throw new SchemaValidationError(\n \"SQLite DDL has unbalanced parentheses\",\n [],\n );\n }\n }\n\n if (parenCount !== 0) {\n throw new SchemaValidationError(\n \"SQLite DDL has unbalanced parentheses\",\n [],\n );\n }\n }\n\n /**\n * Fetches and validates a data schema from a URL\n *\n * @param url - The URL to fetch the data schema from\n * @param downloadRelayer - Optional download relayer for CORS bypass\n * @param downloadRelayer.proxyDownload - Function to proxy downloads through application server\n * @returns The validated data schema\n * @throws SchemaValidationError if invalid or fetch fails\n * @example\n * ```typescript\n * const validator = new SchemaValidator();\n * const schema = await validator.fetchAndValidateSchema(\"https://example.com/schema.json\");\n * ```\n */\n async fetchAndValidateSchema(\n url: string,\n downloadRelayer?: { proxyDownload: (url: string) => Promise<Blob> },\n ): Promise<DataSchema> {\n try {\n const { fetchWithRelayer } = await import(\"./download\");\n const response = await fetchWithRelayer(url, downloadRelayer);\n if (!response.ok) {\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\n }\n\n const schema = await response.json();\n this.validateDataSchemaAgainstMetaSchema(schema);\n\n // Additional validation based on dialect\n if (schema.dialect === \"sqlite\" && typeof schema.schema === \"string\") {\n this.validateSQLiteDDL(schema.schema, schema.dialectVersion);\n }\n\n return schema;\n } catch (error) {\n if (error instanceof SchemaValidationError) {\n throw error;\n }\n\n throw new SchemaValidationError(\n `Failed to fetch and validate schema from ${url}: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n [],\n );\n }\n }\n}\n\n/**\n * Global schema validator instance\n */\nexport const schemaValidator = new SchemaValidator();\n\n/**\n * Convenience function to validate a data schema definition against the Vana meta-schema\n *\n * @param schema - The data schema definition to validate\n * @returns The validated DataSchema\n * @throws SchemaValidationError if invalid\n * @example\n * ```typescript\n * const schemaDefinition = {\n * name: \"User Profile\",\n * version: \"1.0.0\",\n * dialect: \"json\",\n * schema: { type: \"object\", properties: { name: { type: \"string\" } } }\n * };\n *\n * const validatedSchema = validateDataSchemaAgainstMetaSchema(schemaDefinition);\n * ```\n */\nexport function validateDataSchemaAgainstMetaSchema(\n schema: unknown,\n): DataSchema {\n const validator: SchemaValidator = schemaValidator;\n validator.validateDataSchemaAgainstMetaSchema(schema);\n // If we get here, schema is valid and typed as DataSchema\n return schema as DataSchema;\n}\n\n/**\n * Convenience function to validate data against a schema\n *\n * @param data - The data to validate\n * @param schema - The data schema containing the schema\n * @returns void - Function doesn't return a value\n * @throws SchemaValidationError if invalid\n */\nexport function validateDataAgainstSchema(\n data: unknown,\n schema: DataSchema | Schema,\n): void {\n return schemaValidator.validateDataAgainstSchema(data, schema);\n}\n\n/**\n * Convenience function to fetch and validate a data schema from a URL\n *\n * @param url - The URL to fetch the data schema from\n * @param downloadRelayer - Optional download relayer for CORS bypass\n * @param downloadRelayer.proxyDownload - Function to proxy downloads through application server\n * @returns The validated data schema\n * @throws SchemaValidationError if invalid or fetch fails\n */\nexport function fetchAndValidateSchema(\n url: string,\n downloadRelayer?: { proxyDownload: (url: string) => Promise<Blob> },\n): Promise<DataSchema> {\n return schemaValidator.fetchAndValidateSchema(url, downloadRelayer);\n}\n"],"mappings":"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","names":["Ajv","addFormats","dataSchemaSchema"]}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Schema } from '../types/data.cjs';
|
|
2
|
+
import 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Data schema interface following the Vana schema specification
|
|
6
|
+
*
|
|
7
|
+
* @category Configuration
|
|
8
|
+
*/
|
|
9
|
+
interface DataSchema {
|
|
10
|
+
/** The name of the data schema */
|
|
11
|
+
name: string;
|
|
12
|
+
/** The version of the data schema */
|
|
13
|
+
version: string;
|
|
14
|
+
/** Optional description of the data schema */
|
|
15
|
+
description?: string;
|
|
16
|
+
/** The dialect type - either SQLite or JSON */
|
|
17
|
+
dialect: "sqlite" | "json";
|
|
18
|
+
/** Optional version of the dialect */
|
|
19
|
+
dialectVersion?: string;
|
|
20
|
+
/** The actual schema definition as string or object */
|
|
21
|
+
schema: string | object;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown when schema validation fails
|
|
25
|
+
*/
|
|
26
|
+
declare class SchemaValidationError extends Error {
|
|
27
|
+
errors: Array<{
|
|
28
|
+
instancePath: string;
|
|
29
|
+
schemaPath: string;
|
|
30
|
+
keyword: string;
|
|
31
|
+
params: Record<string, unknown>;
|
|
32
|
+
message?: string;
|
|
33
|
+
}>;
|
|
34
|
+
constructor(message: string, errors: Array<{
|
|
35
|
+
instancePath: string;
|
|
36
|
+
schemaPath: string;
|
|
37
|
+
keyword: string;
|
|
38
|
+
params: Record<string, unknown>;
|
|
39
|
+
message?: string;
|
|
40
|
+
}>);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Data schema validation utility class
|
|
44
|
+
*/
|
|
45
|
+
declare class SchemaValidator {
|
|
46
|
+
private ajv;
|
|
47
|
+
private dataSchemaValidator;
|
|
48
|
+
constructor();
|
|
49
|
+
/**
|
|
50
|
+
* Validates a data schema definition against the Vana meta-schema
|
|
51
|
+
*
|
|
52
|
+
* @param schema - The data schema definition to validate
|
|
53
|
+
* @throws SchemaValidationError if invalid
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const validator = new SchemaValidator();
|
|
57
|
+
*
|
|
58
|
+
* const schema = {
|
|
59
|
+
* name: "User Profile",
|
|
60
|
+
* version: "1.0.0",
|
|
61
|
+
* dialect: "json",
|
|
62
|
+
* schema: {
|
|
63
|
+
* type: "object",
|
|
64
|
+
* properties: {
|
|
65
|
+
* name: { type: "string" },
|
|
66
|
+
* age: { type: "number" }
|
|
67
|
+
* }
|
|
68
|
+
* }
|
|
69
|
+
* };
|
|
70
|
+
*
|
|
71
|
+
* validator.validateDataSchemaAgainstMetaSchema(schema); // throws if invalid
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
validateDataSchemaAgainstMetaSchema(schema: unknown): asserts schema is DataSchema;
|
|
75
|
+
/**
|
|
76
|
+
* Validates data against a JSON Schema
|
|
77
|
+
*
|
|
78
|
+
* @param data - The data to validate
|
|
79
|
+
* @param schema - The schema containing the validation rules (must have been validated or fetched from chain)
|
|
80
|
+
* @throws SchemaValidationError if invalid
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const validator = new SchemaValidator();
|
|
84
|
+
*
|
|
85
|
+
* // Works with Schema from schemas.get()
|
|
86
|
+
* const schema = await vana.schemas.get(1);
|
|
87
|
+
* validator.validateDataAgainstSchema(userData, schema);
|
|
88
|
+
*
|
|
89
|
+
* // Also works with pre-validated DataSchema object
|
|
90
|
+
* const dataSchema = validator.validateDataSchemaAgainstMetaSchema({
|
|
91
|
+
* name: "User Profile",
|
|
92
|
+
* version: "1.0.0",
|
|
93
|
+
* dialect: "json",
|
|
94
|
+
* schema: { type: "object", properties: { name: { type: "string" } } }
|
|
95
|
+
* });
|
|
96
|
+
* validator.validateDataAgainstSchema(userData, dataSchema);
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
|
|
100
|
+
/**
|
|
101
|
+
* Validates a SQLite DDL string for basic syntax
|
|
102
|
+
* Note: This is a basic validation, full SQL parsing would require a proper SQL parser
|
|
103
|
+
*
|
|
104
|
+
* @param ddl - The DDL string to validate
|
|
105
|
+
* @param dialectVersion - Optional SQLite version (e.g., "3" for SQLite v3)
|
|
106
|
+
* @throws SchemaValidationError if invalid
|
|
107
|
+
*/
|
|
108
|
+
validateSQLiteDDL(ddl: string, dialectVersion?: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Fetches and validates a data schema from a URL
|
|
111
|
+
*
|
|
112
|
+
* @param url - The URL to fetch the data schema from
|
|
113
|
+
* @param downloadRelayer - Optional download relayer for CORS bypass
|
|
114
|
+
* @param downloadRelayer.proxyDownload - Function to proxy downloads through application server
|
|
115
|
+
* @returns The validated data schema
|
|
116
|
+
* @throws SchemaValidationError if invalid or fetch fails
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const validator = new SchemaValidator();
|
|
120
|
+
* const schema = await validator.fetchAndValidateSchema("https://example.com/schema.json");
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
fetchAndValidateSchema(url: string, downloadRelayer?: {
|
|
124
|
+
proxyDownload: (url: string) => Promise<Blob>;
|
|
125
|
+
}): Promise<DataSchema>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Global schema validator instance
|
|
129
|
+
*/
|
|
130
|
+
declare const schemaValidator: SchemaValidator;
|
|
131
|
+
/**
|
|
132
|
+
* Convenience function to validate a data schema definition against the Vana meta-schema
|
|
133
|
+
*
|
|
134
|
+
* @param schema - The data schema definition to validate
|
|
135
|
+
* @returns The validated DataSchema
|
|
136
|
+
* @throws SchemaValidationError if invalid
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const schemaDefinition = {
|
|
140
|
+
* name: "User Profile",
|
|
141
|
+
* version: "1.0.0",
|
|
142
|
+
* dialect: "json",
|
|
143
|
+
* schema: { type: "object", properties: { name: { type: "string" } } }
|
|
144
|
+
* };
|
|
145
|
+
*
|
|
146
|
+
* const validatedSchema = validateDataSchemaAgainstMetaSchema(schemaDefinition);
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
declare function validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
|
|
150
|
+
/**
|
|
151
|
+
* Convenience function to validate data against a schema
|
|
152
|
+
*
|
|
153
|
+
* @param data - The data to validate
|
|
154
|
+
* @param schema - The data schema containing the schema
|
|
155
|
+
* @returns void - Function doesn't return a value
|
|
156
|
+
* @throws SchemaValidationError if invalid
|
|
157
|
+
*/
|
|
158
|
+
declare function validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
|
|
159
|
+
/**
|
|
160
|
+
* Convenience function to fetch and validate a data schema from a URL
|
|
161
|
+
*
|
|
162
|
+
* @param url - The URL to fetch the data schema from
|
|
163
|
+
* @param downloadRelayer - Optional download relayer for CORS bypass
|
|
164
|
+
* @param downloadRelayer.proxyDownload - Function to proxy downloads through application server
|
|
165
|
+
* @returns The validated data schema
|
|
166
|
+
* @throws SchemaValidationError if invalid or fetch fails
|
|
167
|
+
*/
|
|
168
|
+
declare function fetchAndValidateSchema(url: string, downloadRelayer?: {
|
|
169
|
+
proxyDownload: (url: string) => Promise<Blob>;
|
|
170
|
+
}): Promise<DataSchema>;
|
|
171
|
+
|
|
172
|
+
export { type DataSchema, SchemaValidationError, SchemaValidator, fetchAndValidateSchema, schemaValidator, validateDataAgainstSchema, validateDataSchemaAgainstMetaSchema };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Schema } from '../types/data.js';
|
|
2
|
+
import 'viem';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Data schema interface following the Vana schema specification
|
|
6
|
+
*
|
|
7
|
+
* @category Configuration
|
|
8
|
+
*/
|
|
9
|
+
interface DataSchema {
|
|
10
|
+
/** The name of the data schema */
|
|
11
|
+
name: string;
|
|
12
|
+
/** The version of the data schema */
|
|
13
|
+
version: string;
|
|
14
|
+
/** Optional description of the data schema */
|
|
15
|
+
description?: string;
|
|
16
|
+
/** The dialect type - either SQLite or JSON */
|
|
17
|
+
dialect: "sqlite" | "json";
|
|
18
|
+
/** Optional version of the dialect */
|
|
19
|
+
dialectVersion?: string;
|
|
20
|
+
/** The actual schema definition as string or object */
|
|
21
|
+
schema: string | object;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Error thrown when schema validation fails
|
|
25
|
+
*/
|
|
26
|
+
declare class SchemaValidationError extends Error {
|
|
27
|
+
errors: Array<{
|
|
28
|
+
instancePath: string;
|
|
29
|
+
schemaPath: string;
|
|
30
|
+
keyword: string;
|
|
31
|
+
params: Record<string, unknown>;
|
|
32
|
+
message?: string;
|
|
33
|
+
}>;
|
|
34
|
+
constructor(message: string, errors: Array<{
|
|
35
|
+
instancePath: string;
|
|
36
|
+
schemaPath: string;
|
|
37
|
+
keyword: string;
|
|
38
|
+
params: Record<string, unknown>;
|
|
39
|
+
message?: string;
|
|
40
|
+
}>);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Data schema validation utility class
|
|
44
|
+
*/
|
|
45
|
+
declare class SchemaValidator {
|
|
46
|
+
private ajv;
|
|
47
|
+
private dataSchemaValidator;
|
|
48
|
+
constructor();
|
|
49
|
+
/**
|
|
50
|
+
* Validates a data schema definition against the Vana meta-schema
|
|
51
|
+
*
|
|
52
|
+
* @param schema - The data schema definition to validate
|
|
53
|
+
* @throws SchemaValidationError if invalid
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const validator = new SchemaValidator();
|
|
57
|
+
*
|
|
58
|
+
* const schema = {
|
|
59
|
+
* name: "User Profile",
|
|
60
|
+
* version: "1.0.0",
|
|
61
|
+
* dialect: "json",
|
|
62
|
+
* schema: {
|
|
63
|
+
* type: "object",
|
|
64
|
+
* properties: {
|
|
65
|
+
* name: { type: "string" },
|
|
66
|
+
* age: { type: "number" }
|
|
67
|
+
* }
|
|
68
|
+
* }
|
|
69
|
+
* };
|
|
70
|
+
*
|
|
71
|
+
* validator.validateDataSchemaAgainstMetaSchema(schema); // throws if invalid
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
validateDataSchemaAgainstMetaSchema(schema: unknown): asserts schema is DataSchema;
|
|
75
|
+
/**
|
|
76
|
+
* Validates data against a JSON Schema
|
|
77
|
+
*
|
|
78
|
+
* @param data - The data to validate
|
|
79
|
+
* @param schema - The schema containing the validation rules (must have been validated or fetched from chain)
|
|
80
|
+
* @throws SchemaValidationError if invalid
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const validator = new SchemaValidator();
|
|
84
|
+
*
|
|
85
|
+
* // Works with Schema from schemas.get()
|
|
86
|
+
* const schema = await vana.schemas.get(1);
|
|
87
|
+
* validator.validateDataAgainstSchema(userData, schema);
|
|
88
|
+
*
|
|
89
|
+
* // Also works with pre-validated DataSchema object
|
|
90
|
+
* const dataSchema = validator.validateDataSchemaAgainstMetaSchema({
|
|
91
|
+
* name: "User Profile",
|
|
92
|
+
* version: "1.0.0",
|
|
93
|
+
* dialect: "json",
|
|
94
|
+
* schema: { type: "object", properties: { name: { type: "string" } } }
|
|
95
|
+
* });
|
|
96
|
+
* validator.validateDataAgainstSchema(userData, dataSchema);
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
|
|
100
|
+
/**
|
|
101
|
+
* Validates a SQLite DDL string for basic syntax
|
|
102
|
+
* Note: This is a basic validation, full SQL parsing would require a proper SQL parser
|
|
103
|
+
*
|
|
104
|
+
* @param ddl - The DDL string to validate
|
|
105
|
+
* @param dialectVersion - Optional SQLite version (e.g., "3" for SQLite v3)
|
|
106
|
+
* @throws SchemaValidationError if invalid
|
|
107
|
+
*/
|
|
108
|
+
validateSQLiteDDL(ddl: string, dialectVersion?: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Fetches and validates a data schema from a URL
|
|
111
|
+
*
|
|
112
|
+
* @param url - The URL to fetch the data schema from
|
|
113
|
+
* @param downloadRelayer - Optional download relayer for CORS bypass
|
|
114
|
+
* @param downloadRelayer.proxyDownload - Function to proxy downloads through application server
|
|
115
|
+
* @returns The validated data schema
|
|
116
|
+
* @throws SchemaValidationError if invalid or fetch fails
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const validator = new SchemaValidator();
|
|
120
|
+
* const schema = await validator.fetchAndValidateSchema("https://example.com/schema.json");
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
fetchAndValidateSchema(url: string, downloadRelayer?: {
|
|
124
|
+
proxyDownload: (url: string) => Promise<Blob>;
|
|
125
|
+
}): Promise<DataSchema>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Global schema validator instance
|
|
129
|
+
*/
|
|
130
|
+
declare const schemaValidator: SchemaValidator;
|
|
131
|
+
/**
|
|
132
|
+
* Convenience function to validate a data schema definition against the Vana meta-schema
|
|
133
|
+
*
|
|
134
|
+
* @param schema - The data schema definition to validate
|
|
135
|
+
* @returns The validated DataSchema
|
|
136
|
+
* @throws SchemaValidationError if invalid
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const schemaDefinition = {
|
|
140
|
+
* name: "User Profile",
|
|
141
|
+
* version: "1.0.0",
|
|
142
|
+
* dialect: "json",
|
|
143
|
+
* schema: { type: "object", properties: { name: { type: "string" } } }
|
|
144
|
+
* };
|
|
145
|
+
*
|
|
146
|
+
* const validatedSchema = validateDataSchemaAgainstMetaSchema(schemaDefinition);
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
declare function validateDataSchemaAgainstMetaSchema(schema: unknown): DataSchema;
|
|
150
|
+
/**
|
|
151
|
+
* Convenience function to validate data against a schema
|
|
152
|
+
*
|
|
153
|
+
* @param data - The data to validate
|
|
154
|
+
* @param schema - The data schema containing the schema
|
|
155
|
+
* @returns void - Function doesn't return a value
|
|
156
|
+
* @throws SchemaValidationError if invalid
|
|
157
|
+
*/
|
|
158
|
+
declare function validateDataAgainstSchema(data: unknown, schema: DataSchema | Schema): void;
|
|
159
|
+
/**
|
|
160
|
+
* Convenience function to fetch and validate a data schema from a URL
|
|
161
|
+
*
|
|
162
|
+
* @param url - The URL to fetch the data schema from
|
|
163
|
+
* @param downloadRelayer - Optional download relayer for CORS bypass
|
|
164
|
+
* @param downloadRelayer.proxyDownload - Function to proxy downloads through application server
|
|
165
|
+
* @returns The validated data schema
|
|
166
|
+
* @throws SchemaValidationError if invalid or fetch fails
|
|
167
|
+
*/
|
|
168
|
+
declare function fetchAndValidateSchema(url: string, downloadRelayer?: {
|
|
169
|
+
proxyDownload: (url: string) => Promise<Blob>;
|
|
170
|
+
}): Promise<DataSchema>;
|
|
171
|
+
|
|
172
|
+
export { type DataSchema, SchemaValidationError, SchemaValidator, fetchAndValidateSchema, schemaValidator, validateDataAgainstSchema, validateDataSchemaAgainstMetaSchema };
|