diff --git a/indexer/UPGRADE.md b/indexer/UPGRADE.md index 0aca1ef56..1ed1432fa 100644 --- a/indexer/UPGRADE.md +++ b/indexer/UPGRADE.md @@ -1,9 +1,18 @@ # Upgrade instructions -Some indexer updates changes the database schemas and an upgrade script must be run on the database to migrate the data before or after updating the indexer. Here is a list of those migrations. If a version is not listed here it means the indexer can be updated without any manual migration. +Some indexer updates changes the database schemas and an upgrade script must be run on the database to migrate the data before or after updating the indexer. Here is a list of those migrations. If a version is not listed here it means the indexer can be updated without any manual migration. **It is recommended to stop the indexer before running any migration script.** +## v1.7.1 + +Storing cpu vcores as numbers instead of strings + +``` +ALTER TABLE IF EXISTS public."providerSnapshotNodeCPU" + ALTER COLUMN vcores smallint; +``` + ## v1.7.0 Version 1.7.0 adds some tables and fields to improve provider queries as well as keep track of node/cpu/gpu data provided by the new status endpoint (grpc). @@ -23,13 +32,13 @@ ALTER TABLE IF EXISTS public."providerSnapshot" ADD COLUMN "isLastOfDay" boolean NOT NULL DEFAULT false, ALTER COLUMN "isOnline" SET NOT NULL, ALTER COLUMN "checkDate" SET NOT NULL; - + -- Set isLastOfDay to true for snapshots that are the last of each day for every providers WITH last_snapshots AS ( SELECT DISTINCT ON(ps."owner",DATE("checkDate")) DATE("checkDate") AS date, ps."id" AS "psId" FROM "providerSnapshot" ps ORDER BY ps."owner",DATE("checkDate"),"checkDate" DESC -) +) UPDATE "providerSnapshot" AS ps SET "isLastOfDay" = TRUE FROM last_snapshots AS ls diff --git a/indexer/package-lock.json b/indexer/package-lock.json index f35a06200..86624782b 100644 --- a/indexer/package-lock.json +++ b/indexer/package-lock.json @@ -1,22 +1,22 @@ { "name": "cloudmos-indexer", - "version": "1.7.0", + "version": "1.7.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "cloudmos-indexer", - "version": "1.7.0", + "version": "1.7.1", "license": "Apache-2.0", "dependencies": { "@akashnetwork/akashjs": "0.5.0", + "@connectrpc/connect": "^1.3.0", + "@connectrpc/connect-node": "^1.3.0", "@cosmjs/crypto": "^0.31.1", "@cosmjs/encoding": "^0.31.1", "@cosmjs/math": "^0.31.1", "@cosmjs/proto-signing": "^0.31.1", "@cosmjs/stargate": "^0.31.1", - "@grpc/grpc-js": "^1.9.14", - "@grpc/proto-loader": "^0.7.10", "@sentry/node": "^7.52.0", "async": "^3.2.4", "axios": "^0.27.2", @@ -2323,6 +2323,12 @@ "dev": true, "peer": true }, + "node_modules/@bufbuild/protobuf": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.7.2.tgz", + "integrity": "sha512-i5GE2Dk5ekdlK1TR7SugY4LWRrKSfb5T1Qn4unpIMbfxoeGKERKQ59HG3iYewacGD10SR7UzevfPnh6my4tNmQ==", + "peer": true + }, "node_modules/@confio/ics23": { "version": "0.6.8", "resolved": "https://registry.npmjs.org/@confio/ics23/-/ics23-0.6.8.tgz", @@ -2332,6 +2338,29 @@ "protobufjs": "^6.8.8" } }, + "node_modules/@connectrpc/connect": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-1.3.0.tgz", + "integrity": "sha512-kTeWxJnLLtxKc2ZSDN0rIBgwfP8RwcLknthX4AKlIAmN9ZC4gGnCbwp+3BKcP/WH5c8zGBAWqSY3zeqCM+ah7w==", + "peerDependencies": { + "@bufbuild/protobuf": "^1.4.2" + } + }, + "node_modules/@connectrpc/connect-node": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@connectrpc/connect-node/-/connect-node-1.3.0.tgz", + "integrity": "sha512-2fV/z/8MUFOkTn2Gbm7T/qvRfkpt/D/w7ykYqACZRH6VNG/faY4lH2wUZiNkwv9tzTrECKOJFyPsaGs3nRYK3w==", + "dependencies": { + "undici": "^5.28.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@bufbuild/protobuf": "^1.4.2", + "@connectrpc/connect": "1.3.0" + } + }, "node_modules/@cosmjs/amino": { "version": "0.28.13", "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.28.13.tgz", @@ -3182,139 +3211,12 @@ "node": ">=10.0.0" } }, - "node_modules/@grpc/grpc-js": { - "version": "1.9.14", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.14.tgz", - "integrity": "sha512-nOpuzZ2G3IuMFN+UPPpKrC6NsLmWsTqSsm66IRfnBt1D4pwTqE27lmbpcPM+l2Ua4gE7PfjRHI6uedAy7hoXUw==", - "dependencies": { - "@grpc/proto-loader": "^0.7.8", - "@types/node": ">=12.12.47" - }, - "engines": { - "node": "^8.13.0 || >=10.10.0" - } - }, - "node_modules/@grpc/proto-loader": { - "version": "0.7.10", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.10.tgz", - "integrity": "sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==", - "dependencies": { - "lodash.camelcase": "^4.3.0", - "long": "^5.0.0", - "protobufjs": "^7.2.4", - "yargs": "^17.7.2" - }, - "bin": { - "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@grpc/proto-loader/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@grpc/proto-loader/node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@grpc/proto-loader/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "engines": { - "node": ">=8" - } - }, - "node_modules/@grpc/proto-loader/node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" - }, - "node_modules/@grpc/proto-loader/node_modules/protobufjs": { - "version": "7.2.6", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.6.tgz", - "integrity": "sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw==", - "hasInstallScript": true, - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/node": ">=13.7.0", - "long": "^5.0.0" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/@grpc/proto-loader/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@grpc/proto-loader/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@grpc/proto-loader/node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@grpc/proto-loader/node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "node_modules/@fastify/busboy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", + "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==", "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/@istanbuljs/load-nyc-config": { @@ -7095,6 +6997,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, "engines": { "node": ">=6" } @@ -12072,11 +11975,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "node_modules/lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" - }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -15249,6 +15147,17 @@ "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.4.tgz", "integrity": "sha512-BQFnUDuAQ4Yf/cYY5LNrK9NCJFKriaRbD9uR1fTeXnBeoa97W0i41qkZfGO9pSo8I5KzjAcSY2XYtdf0oKd7KQ==" }, + "node_modules/undici": { + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -15790,6 +15699,8 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "peer": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -15806,6 +15717,8 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "peer": true, "engines": { "node": ">=8" } @@ -15814,6 +15727,8 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "peer": true, "engines": { "node": ">=8" } @@ -15822,6 +15737,8 @@ "version": "4.2.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "peer": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -15835,6 +15752,8 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "peer": true, "dependencies": { "ansi-regex": "^5.0.0" }, @@ -15915,6 +15834,8 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "peer": true, "engines": { "node": ">=10" } @@ -17711,6 +17632,12 @@ "dev": true, "peer": true }, + "@bufbuild/protobuf": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-1.7.2.tgz", + "integrity": "sha512-i5GE2Dk5ekdlK1TR7SugY4LWRrKSfb5T1Qn4unpIMbfxoeGKERKQ59HG3iYewacGD10SR7UzevfPnh6my4tNmQ==", + "peer": true + }, "@confio/ics23": { "version": "0.6.8", "resolved": "https://registry.npmjs.org/@confio/ics23/-/ics23-0.6.8.tgz", @@ -17720,6 +17647,20 @@ "protobufjs": "^6.8.8" } }, + "@connectrpc/connect": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-1.3.0.tgz", + "integrity": "sha512-kTeWxJnLLtxKc2ZSDN0rIBgwfP8RwcLknthX4AKlIAmN9ZC4gGnCbwp+3BKcP/WH5c8zGBAWqSY3zeqCM+ah7w==", + "requires": {} + }, + "@connectrpc/connect-node": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@connectrpc/connect-node/-/connect-node-1.3.0.tgz", + "integrity": "sha512-2fV/z/8MUFOkTn2Gbm7T/qvRfkpt/D/w7ykYqACZRH6VNG/faY4lH2wUZiNkwv9tzTrECKOJFyPsaGs3nRYK3w==", + "requires": { + "undici": "^5.28.2" + } + }, "@cosmjs/amino": { "version": "0.28.13", "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.28.13.tgz", @@ -18532,108 +18473,10 @@ "integrity": "sha512-Fxt+AfXgjMoin2maPIYzFZnQjAXjAL0PHscM5pRTtatFqB+vZxAM9tLp2Optnuw3QOQC40jTNeGYFOMvyf7v9g==", "dev": true }, - "@grpc/grpc-js": { - "version": "1.9.14", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.14.tgz", - "integrity": "sha512-nOpuzZ2G3IuMFN+UPPpKrC6NsLmWsTqSsm66IRfnBt1D4pwTqE27lmbpcPM+l2Ua4gE7PfjRHI6uedAy7hoXUw==", - "requires": { - "@grpc/proto-loader": "^0.7.8", - "@types/node": ">=12.12.47" - } - }, - "@grpc/proto-loader": { - "version": "0.7.10", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.10.tgz", - "integrity": "sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==", - "requires": { - "lodash.camelcase": "^4.3.0", - "long": "^5.0.0", - "protobufjs": "^7.2.4", - "yargs": "^17.7.2" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" - }, - "cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" - }, - "long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" - }, - "protobufjs": { - "version": "7.2.6", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.6.tgz", - "integrity": "sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/node": ">=13.7.0", - "long": "^5.0.0" - } - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "requires": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - } - }, - "yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" - } - } + "@fastify/busboy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.0.tgz", + "integrity": "sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==" }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", @@ -21748,7 +21591,8 @@ "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true }, "escape-html": { "version": "1.0.3", @@ -25609,11 +25453,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" - }, "lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -27993,6 +27832,14 @@ "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.4.tgz", "integrity": "sha512-BQFnUDuAQ4Yf/cYY5LNrK9NCJFKriaRbD9uR1fTeXnBeoa97W0i41qkZfGO9pSo8I5KzjAcSY2XYtdf0oKd7KQ==" }, + "undici": { + "version": "5.28.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", + "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "requires": { + "@fastify/busboy": "^2.0.0" + } + }, "unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -28406,6 +28253,8 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "peer": true, "requires": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -28415,17 +28264,23 @@ "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "peer": true }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "peer": true }, "string-width": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "peer": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -28436,6 +28291,8 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "peer": true, "requires": { "ansi-regex": "^5.0.0" } @@ -28497,7 +28354,9 @@ "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "peer": true }, "yallist": { "version": "4.0.0", diff --git a/indexer/package.json b/indexer/package.json index 53bf84d23..bbf5bbca2 100644 --- a/indexer/package.json +++ b/indexer/package.json @@ -1,6 +1,6 @@ { "name": "cloudmos-indexer", - "version": "1.7.0", + "version": "1.7.1", "description": "Indexer for any Cosmos based blockchain", "author": "Cloudmos", "license": "Apache-2.0", @@ -20,13 +20,13 @@ "homepage": "https://github.com/akash-network/cloudmos", "dependencies": { "@akashnetwork/akashjs": "0.5.0", + "@connectrpc/connect": "^1.3.0", + "@connectrpc/connect-node": "^1.3.0", "@cosmjs/crypto": "^0.31.1", "@cosmjs/encoding": "^0.31.1", "@cosmjs/math": "^0.31.1", "@cosmjs/proto-signing": "^0.31.1", "@cosmjs/stargate": "^0.31.1", - "@grpc/grpc-js": "^1.9.14", - "@grpc/proto-loader": "^0.7.10", "@sentry/node": "^7.52.0", "async": "^3.2.4", "axios": "^0.27.2", diff --git a/indexer/src/proto/akash/providerServiceDescriptor.bin b/indexer/src/proto/akash/providerServiceDescriptor.bin deleted file mode 100644 index 211d1122d..000000000 Binary files a/indexer/src/proto/akash/providerServiceDescriptor.bin and /dev/null differ diff --git a/indexer/src/proto/gen/akash/base/v1beta3/attribute_pb.ts b/indexer/src/proto/gen/akash/base/v1beta3/attribute_pb.ts new file mode 100644 index 000000000..13c09ff43 --- /dev/null +++ b/indexer/src/proto/gen/akash/base/v1beta3/attribute_pb.ts @@ -0,0 +1,154 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/base/v1beta3/attribute.proto (package akash.base.v1beta3, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * Attribute represents key value pair + * + * @generated from message akash.base.v1beta3.Attribute + */ +export class Attribute extends Message { + /** + * @generated from field: string key = 1; + */ + key = ""; + + /** + * @generated from field: string value = 2; + */ + value = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.base.v1beta3.Attribute"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "key", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "value", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Attribute { + return new Attribute().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Attribute { + return new Attribute().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Attribute { + return new Attribute().fromJsonString(jsonString, options); + } + + static equals(a: Attribute | PlainMessage | undefined, b: Attribute | PlainMessage | undefined): boolean { + return proto3.util.equals(Attribute, a, b); + } +} + +/** + * SignedBy represents validation accounts that tenant expects signatures for provider attributes + * AllOf has precedence i.e. if there is at least one entry AnyOf is ignored regardless to how many + * entries there + * this behaviour to be discussed + * + * @generated from message akash.base.v1beta3.SignedBy + */ +export class SignedBy extends Message { + /** + * all_of all keys in this list must have signed attributes + * + * @generated from field: repeated string all_of = 1; + */ + allOf: string[] = []; + + /** + * any_of at least of of the keys from the list must have signed attributes + * + * @generated from field: repeated string any_of = 2; + */ + anyOf: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.base.v1beta3.SignedBy"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "all_of", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 2, name: "any_of", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): SignedBy { + return new SignedBy().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): SignedBy { + return new SignedBy().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): SignedBy { + return new SignedBy().fromJsonString(jsonString, options); + } + + static equals(a: SignedBy | PlainMessage | undefined, b: SignedBy | PlainMessage | undefined): boolean { + return proto3.util.equals(SignedBy, a, b); + } +} + +/** + * PlacementRequirements + * + * @generated from message akash.base.v1beta3.PlacementRequirements + */ +export class PlacementRequirements extends Message { + /** + * SignedBy list of keys that tenants expect to have signatures from + * + * @generated from field: akash.base.v1beta3.SignedBy signed_by = 1; + */ + signedBy?: SignedBy; + + /** + * Attribute list of attributes tenant expects from the provider + * + * @generated from field: repeated akash.base.v1beta3.Attribute attributes = 2; + */ + attributes: Attribute[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.base.v1beta3.PlacementRequirements"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "signed_by", kind: "message", T: SignedBy }, + { no: 2, name: "attributes", kind: "message", T: Attribute, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): PlacementRequirements { + return new PlacementRequirements().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): PlacementRequirements { + return new PlacementRequirements().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): PlacementRequirements { + return new PlacementRequirements().fromJsonString(jsonString, options); + } + + static equals(a: PlacementRequirements | PlainMessage | undefined, b: PlacementRequirements | PlainMessage | undefined): boolean { + return proto3.util.equals(PlacementRequirements, a, b); + } +} + diff --git a/indexer/src/proto/gen/akash/inventory/v1/cluster_pb.ts b/indexer/src/proto/gen/akash/inventory/v1/cluster_pb.ts new file mode 100644 index 000000000..f48838d32 --- /dev/null +++ b/indexer/src/proto/gen/akash/inventory/v1/cluster_pb.ts @@ -0,0 +1,55 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/inventory/v1/cluster.proto (package akash.inventory.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { Node } from "./node_pb"; +import { Storage } from "./storage_pb"; + +/** + * Cluster reports inventory across entire cluster + * + * @generated from message akash.inventory.v1.Cluster + */ +export class Cluster extends Message { + /** + * @generated from field: repeated akash.inventory.v1.Node nodes = 1; + */ + nodes: Node[] = []; + + /** + * @generated from field: repeated akash.inventory.v1.Storage storage = 2; + */ + storage: Storage[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.Cluster"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "nodes", kind: "message", T: Node, repeated: true }, + { no: 2, name: "storage", kind: "message", T: Storage, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Cluster { + return new Cluster().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Cluster { + return new Cluster().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Cluster { + return new Cluster().fromJsonString(jsonString, options); + } + + static equals(a: Cluster | PlainMessage | undefined, b: Cluster | PlainMessage | undefined): boolean { + return proto3.util.equals(Cluster, a, b); + } +} + diff --git a/indexer/src/proto/gen/akash/inventory/v1/cpu_pb.ts b/indexer/src/proto/gen/akash/inventory/v1/cpu_pb.ts new file mode 100644 index 000000000..b81749b80 --- /dev/null +++ b/indexer/src/proto/gen/akash/inventory/v1/cpu_pb.ts @@ -0,0 +1,111 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/inventory/v1/cpu.proto (package akash.inventory.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { ResourcePair } from "./resourcepair_pb"; + +/** + * CPUInfo reports CPU details + * + * @generated from message akash.inventory.v1.CPUInfo + */ +export class CPUInfo extends Message { + /** + * @generated from field: string id = 1; + */ + id = ""; + + /** + * @generated from field: string vendor = 2; + */ + vendor = ""; + + /** + * @generated from field: string model = 3; + */ + model = ""; + + /** + * @generated from field: uint32 vcores = 4; + */ + vcores = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.CPUInfo"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "vendor", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "model", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "vcores", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CPUInfo { + return new CPUInfo().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CPUInfo { + return new CPUInfo().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CPUInfo { + return new CPUInfo().fromJsonString(jsonString, options); + } + + static equals(a: CPUInfo | PlainMessage | undefined, b: CPUInfo | PlainMessage | undefined): boolean { + return proto3.util.equals(CPUInfo, a, b); + } +} + +/** + * CPU reports CPU inventory details + * + * @generated from message akash.inventory.v1.CPU + */ +export class CPU extends Message { + /** + * @generated from field: akash.inventory.v1.ResourcePair quantity = 1; + */ + quantity?: ResourcePair; + + /** + * @generated from field: repeated akash.inventory.v1.CPUInfo info = 2; + */ + info: CPUInfo[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.CPU"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "quantity", kind: "message", T: ResourcePair }, + { no: 2, name: "info", kind: "message", T: CPUInfo, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CPU { + return new CPU().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CPU { + return new CPU().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CPU { + return new CPU().fromJsonString(jsonString, options); + } + + static equals(a: CPU | PlainMessage | undefined, b: CPU | PlainMessage | undefined): boolean { + return proto3.util.equals(CPU, a, b); + } +} + diff --git a/indexer/src/proto/gen/akash/inventory/v1/gpu_pb.ts b/indexer/src/proto/gen/akash/inventory/v1/gpu_pb.ts new file mode 100644 index 000000000..20d271f8a --- /dev/null +++ b/indexer/src/proto/gen/akash/inventory/v1/gpu_pb.ts @@ -0,0 +1,123 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/inventory/v1/gpu.proto (package akash.inventory.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { ResourcePair } from "./resourcepair_pb"; + +/** + * GPUInfo reports GPU details + * + * @generated from message akash.inventory.v1.GPUInfo + */ +export class GPUInfo extends Message { + /** + * @generated from field: string vendor = 1; + */ + vendor = ""; + + /** + * @generated from field: string vendor_id = 2; + */ + vendorId = ""; + + /** + * @generated from field: string name = 3; + */ + name = ""; + + /** + * @generated from field: string modelid = 4; + */ + modelid = ""; + + /** + * @generated from field: string interface = 5; + */ + interface = ""; + + /** + * @generated from field: string memory_size = 6; + */ + memorySize = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.GPUInfo"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "vendor", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "vendor_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "modelid", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 5, name: "interface", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 6, name: "memory_size", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GPUInfo { + return new GPUInfo().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GPUInfo { + return new GPUInfo().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GPUInfo { + return new GPUInfo().fromJsonString(jsonString, options); + } + + static equals(a: GPUInfo | PlainMessage | undefined, b: GPUInfo | PlainMessage | undefined): boolean { + return proto3.util.equals(GPUInfo, a, b); + } +} + +/** + * GPUInfo reports GPU inventory details + * + * @generated from message akash.inventory.v1.GPU + */ +export class GPU extends Message { + /** + * @generated from field: akash.inventory.v1.ResourcePair quantity = 1; + */ + quantity?: ResourcePair; + + /** + * @generated from field: repeated akash.inventory.v1.GPUInfo info = 2; + */ + info: GPUInfo[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.GPU"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "quantity", kind: "message", T: ResourcePair }, + { no: 2, name: "info", kind: "message", T: GPUInfo, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): GPU { + return new GPU().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): GPU { + return new GPU().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): GPU { + return new GPU().fromJsonString(jsonString, options); + } + + static equals(a: GPU | PlainMessage | undefined, b: GPU | PlainMessage | undefined): boolean { + return proto3.util.equals(GPU, a, b); + } +} + diff --git a/indexer/src/proto/gen/akash/inventory/v1/memory_pb.ts b/indexer/src/proto/gen/akash/inventory/v1/memory_pb.ts new file mode 100644 index 000000000..a48be7f9f --- /dev/null +++ b/indexer/src/proto/gen/akash/inventory/v1/memory_pb.ts @@ -0,0 +1,111 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/inventory/v1/memory.proto (package akash.inventory.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { ResourcePair } from "./resourcepair_pb"; + +/** + * MemoryInfo reports Memory details + * + * @generated from message akash.inventory.v1.MemoryInfo + */ +export class MemoryInfo extends Message { + /** + * @generated from field: string vendor = 1; + */ + vendor = ""; + + /** + * @generated from field: string type = 2; + */ + type = ""; + + /** + * @generated from field: string total_size = 3; + */ + totalSize = ""; + + /** + * @generated from field: string speed = 4; + */ + speed = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.MemoryInfo"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "vendor", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "type", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 3, name: "total_size", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 4, name: "speed", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): MemoryInfo { + return new MemoryInfo().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): MemoryInfo { + return new MemoryInfo().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): MemoryInfo { + return new MemoryInfo().fromJsonString(jsonString, options); + } + + static equals(a: MemoryInfo | PlainMessage | undefined, b: MemoryInfo | PlainMessage | undefined): boolean { + return proto3.util.equals(MemoryInfo, a, b); + } +} + +/** + * Memory reports Memory inventory details + * + * @generated from message akash.inventory.v1.Memory + */ +export class Memory extends Message { + /** + * @generated from field: akash.inventory.v1.ResourcePair quantity = 1; + */ + quantity?: ResourcePair; + + /** + * @generated from field: repeated akash.inventory.v1.MemoryInfo info = 2; + */ + info: MemoryInfo[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.Memory"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "quantity", kind: "message", T: ResourcePair }, + { no: 2, name: "info", kind: "message", T: MemoryInfo, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Memory { + return new Memory().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Memory { + return new Memory().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Memory { + return new Memory().fromJsonString(jsonString, options); + } + + static equals(a: Memory | PlainMessage | undefined, b: Memory | PlainMessage | undefined): boolean { + return proto3.util.equals(Memory, a, b); + } +} + diff --git a/indexer/src/proto/gen/akash/inventory/v1/node_pb.ts b/indexer/src/proto/gen/akash/inventory/v1/node_pb.ts new file mode 100644 index 000000000..8dd515698 --- /dev/null +++ b/indexer/src/proto/gen/akash/inventory/v1/node_pb.ts @@ -0,0 +1,99 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/inventory/v1/node.proto (package akash.inventory.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { NodeResources } from "./resources_pb"; + +/** + * NodeCapabilities extended list of node capabilities + * + * @generated from message akash.inventory.v1.NodeCapabilities + */ +export class NodeCapabilities extends Message { + /** + * @generated from field: repeated string storage_classes = 1; + */ + storageClasses: string[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.NodeCapabilities"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "storage_classes", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): NodeCapabilities { + return new NodeCapabilities().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): NodeCapabilities { + return new NodeCapabilities().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): NodeCapabilities { + return new NodeCapabilities().fromJsonString(jsonString, options); + } + + static equals(a: NodeCapabilities | PlainMessage | undefined, b: NodeCapabilities | PlainMessage | undefined): boolean { + return proto3.util.equals(NodeCapabilities, a, b); + } +} + +/** + * Node reports node inventory details + * + * @generated from message akash.inventory.v1.Node + */ +export class Node extends Message { + /** + * @generated from field: string name = 1; + */ + name = ""; + + /** + * @generated from field: akash.inventory.v1.NodeResources resources = 2; + */ + resources?: NodeResources; + + /** + * @generated from field: akash.inventory.v1.NodeCapabilities capabilities = 3; + */ + capabilities?: NodeCapabilities; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.Node"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "resources", kind: "message", T: NodeResources }, + { no: 3, name: "capabilities", kind: "message", T: NodeCapabilities }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Node { + return new Node().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Node { + return new Node().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Node { + return new Node().fromJsonString(jsonString, options); + } + + static equals(a: Node | PlainMessage | undefined, b: Node | PlainMessage | undefined): boolean { + return proto3.util.equals(Node, a, b); + } +} + diff --git a/indexer/src/proto/gen/akash/inventory/v1/resourcepair_pb.ts b/indexer/src/proto/gen/akash/inventory/v1/resourcepair_pb.ts new file mode 100644 index 000000000..c0994cd85 --- /dev/null +++ b/indexer/src/proto/gen/akash/inventory/v1/resourcepair_pb.ts @@ -0,0 +1,61 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/inventory/v1/resourcepair.proto (package akash.inventory.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { Quantity } from "../../../k8s.io/apimachinery/pkg/api/resource/generated_pb"; +import { Attribute } from "../../base/v1beta3/attribute_pb"; + +/** + * ResourcePair to extents resource.Quantity to provide total and available units of the resource + * + * @generated from message akash.inventory.v1.ResourcePair + */ +export class ResourcePair extends Message { + /** + * @generated from field: k8s.io.apimachinery.pkg.api.resource.Quantity allocatable = 1; + */ + allocatable?: Quantity; + + /** + * @generated from field: k8s.io.apimachinery.pkg.api.resource.Quantity allocated = 2; + */ + allocated?: Quantity; + + /** + * @generated from field: repeated akash.base.v1beta3.Attribute attributes = 3; + */ + attributes: Attribute[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.ResourcePair"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "allocatable", kind: "message", T: Quantity }, + { no: 2, name: "allocated", kind: "message", T: Quantity }, + { no: 3, name: "attributes", kind: "message", T: Attribute, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ResourcePair { + return new ResourcePair().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ResourcePair { + return new ResourcePair().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ResourcePair { + return new ResourcePair().fromJsonString(jsonString, options); + } + + static equals(a: ResourcePair | PlainMessage | undefined, b: ResourcePair | PlainMessage | undefined): boolean { + return proto3.util.equals(ResourcePair, a, b); + } +} + diff --git a/indexer/src/proto/gen/akash/inventory/v1/resources_pb.ts b/indexer/src/proto/gen/akash/inventory/v1/resources_pb.ts new file mode 100644 index 000000000..a26bfccd5 --- /dev/null +++ b/indexer/src/proto/gen/akash/inventory/v1/resources_pb.ts @@ -0,0 +1,81 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/inventory/v1/resources.proto (package akash.inventory.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { CPU } from "./cpu_pb"; +import { Memory } from "./memory_pb"; +import { GPU } from "./gpu_pb"; +import { ResourcePair } from "./resourcepair_pb"; + +/** + * NodeResources reports node inventory details + * + * @generated from message akash.inventory.v1.NodeResources + */ +export class NodeResources extends Message { + /** + * @generated from field: akash.inventory.v1.CPU cpu = 1; + */ + cpu?: CPU; + + /** + * @generated from field: akash.inventory.v1.Memory memory = 2; + */ + memory?: Memory; + + /** + * @generated from field: akash.inventory.v1.GPU gpu = 3; + */ + gpu?: GPU; + + /** + * @generated from field: akash.inventory.v1.ResourcePair ephemeral_storage = 4; + */ + ephemeralStorage?: ResourcePair; + + /** + * @generated from field: akash.inventory.v1.ResourcePair volumes_attached = 5; + */ + volumesAttached?: ResourcePair; + + /** + * @generated from field: akash.inventory.v1.ResourcePair volumes_mounted = 6; + */ + volumesMounted?: ResourcePair; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.NodeResources"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "cpu", kind: "message", T: CPU }, + { no: 2, name: "memory", kind: "message", T: Memory }, + { no: 3, name: "gpu", kind: "message", T: GPU }, + { no: 4, name: "ephemeral_storage", kind: "message", T: ResourcePair }, + { no: 5, name: "volumes_attached", kind: "message", T: ResourcePair }, + { no: 6, name: "volumes_mounted", kind: "message", T: ResourcePair }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): NodeResources { + return new NodeResources().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): NodeResources { + return new NodeResources().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): NodeResources { + return new NodeResources().fromJsonString(jsonString, options); + } + + static equals(a: NodeResources | PlainMessage | undefined, b: NodeResources | PlainMessage | undefined): boolean { + return proto3.util.equals(NodeResources, a, b); + } +} + diff --git a/indexer/src/proto/gen/akash/inventory/v1/storage_pb.ts b/indexer/src/proto/gen/akash/inventory/v1/storage_pb.ts new file mode 100644 index 000000000..08bea2f52 --- /dev/null +++ b/indexer/src/proto/gen/akash/inventory/v1/storage_pb.ts @@ -0,0 +1,99 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/inventory/v1/storage.proto (package akash.inventory.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import { ResourcePair } from "./resourcepair_pb"; + +/** + * StorageInfo reports Storage details + * + * @generated from message akash.inventory.v1.StorageInfo + */ +export class StorageInfo extends Message { + /** + * @generated from field: string class = 1; + */ + class = ""; + + /** + * @generated from field: string iops = 2; + */ + iops = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.StorageInfo"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "class", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "iops", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): StorageInfo { + return new StorageInfo().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): StorageInfo { + return new StorageInfo().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): StorageInfo { + return new StorageInfo().fromJsonString(jsonString, options); + } + + static equals(a: StorageInfo | PlainMessage | undefined, b: StorageInfo | PlainMessage | undefined): boolean { + return proto3.util.equals(StorageInfo, a, b); + } +} + +/** + * Storage reports Storage inventory details + * + * @generated from message akash.inventory.v1.Storage + */ +export class Storage extends Message { + /** + * @generated from field: akash.inventory.v1.ResourcePair quantity = 1; + */ + quantity?: ResourcePair; + + /** + * @generated from field: akash.inventory.v1.StorageInfo info = 2; + */ + info?: StorageInfo; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.inventory.v1.Storage"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "quantity", kind: "message", T: ResourcePair }, + { no: 2, name: "info", kind: "message", T: StorageInfo }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Storage { + return new Storage().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Storage { + return new Storage().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Storage { + return new Storage().fromJsonString(jsonString, options); + } + + static equals(a: Storage | PlainMessage | undefined, b: Storage | PlainMessage | undefined): boolean { + return proto3.util.equals(Storage, a, b); + } +} + diff --git a/indexer/src/proto/gen/akash/provider/v1/service_connect.ts b/indexer/src/proto/gen/akash/provider/v1/service_connect.ts new file mode 100644 index 000000000..39eb4b665 --- /dev/null +++ b/indexer/src/proto/gen/akash/provider/v1/service_connect.ts @@ -0,0 +1,45 @@ +// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=ts" +// @generated from file akash/provider/v1/service.proto (package akash.provider.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { Empty, MethodKind } from "@bufbuild/protobuf"; +import { Status } from "./status_pb"; + +/** + * ProviderRPC defines the RPC server for provider + * + * @generated from service akash.provider.v1.ProviderRPC + */ +export const ProviderRPC = { + typeName: "akash.provider.v1.ProviderRPC", + methods: { + /** + * GetStatus defines a method to query provider state + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * + * @generated from rpc akash.provider.v1.ProviderRPC.GetStatus + */ + getStatus: { + name: "GetStatus", + I: Empty, + O: Status, + kind: MethodKind.Unary, + }, + /** + * Status defines a method to stream provider state + * buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + * buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + * + * @generated from rpc akash.provider.v1.ProviderRPC.StreamStatus + */ + streamStatus: { + name: "StreamStatus", + I: Empty, + O: Status, + kind: MethodKind.ServerStreaming, + }, + } +} as const; + diff --git a/indexer/src/proto/gen/akash/provider/v1/status_pb.ts b/indexer/src/proto/gen/akash/provider/v1/status_pb.ts new file mode 100644 index 000000000..67a6433b4 --- /dev/null +++ b/indexer/src/proto/gen/akash/provider/v1/status_pb.ts @@ -0,0 +1,439 @@ +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file akash/provider/v1/status.proto (package akash.provider.v1, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3, Timestamp } from "@bufbuild/protobuf"; +import { Quantity } from "../../../k8s.io/apimachinery/pkg/api/resource/generated_pb"; +import { Cluster } from "../../inventory/v1/cluster_pb"; + +/** + * ResourceMetrics + * + * @generated from message akash.provider.v1.ResourcesMetric + */ +export class ResourcesMetric extends Message { + /** + * @generated from field: k8s.io.apimachinery.pkg.api.resource.Quantity cpu = 1; + */ + cpu?: Quantity; + + /** + * @generated from field: k8s.io.apimachinery.pkg.api.resource.Quantity memory = 2; + */ + memory?: Quantity; + + /** + * @generated from field: k8s.io.apimachinery.pkg.api.resource.Quantity gpu = 3; + */ + gpu?: Quantity; + + /** + * @generated from field: k8s.io.apimachinery.pkg.api.resource.Quantity ephemeral_storage = 4; + */ + ephemeralStorage?: Quantity; + + /** + * @generated from field: map storage = 5; + */ + storage: { [key: string]: Quantity } = {}; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.provider.v1.ResourcesMetric"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "cpu", kind: "message", T: Quantity }, + { no: 2, name: "memory", kind: "message", T: Quantity }, + { no: 3, name: "gpu", kind: "message", T: Quantity }, + { no: 4, name: "ephemeral_storage", kind: "message", T: Quantity }, + { no: 5, name: "storage", kind: "map", K: 9 /* ScalarType.STRING */, V: {kind: "message", T: Quantity} }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ResourcesMetric { + return new ResourcesMetric().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ResourcesMetric { + return new ResourcesMetric().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ResourcesMetric { + return new ResourcesMetric().fromJsonString(jsonString, options); + } + + static equals(a: ResourcesMetric | PlainMessage | undefined, b: ResourcesMetric | PlainMessage | undefined): boolean { + return proto3.util.equals(ResourcesMetric, a, b); + } +} + +/** + * Leases + * + * @generated from message akash.provider.v1.Leases + */ +export class Leases extends Message { + /** + * @generated from field: uint32 active = 1; + */ + active = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.provider.v1.Leases"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "active", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Leases { + return new Leases().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Leases { + return new Leases().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Leases { + return new Leases().fromJsonString(jsonString, options); + } + + static equals(a: Leases | PlainMessage | undefined, b: Leases | PlainMessage | undefined): boolean { + return proto3.util.equals(Leases, a, b); + } +} + +/** + * ReservationsMetric + * + * @generated from message akash.provider.v1.ReservationsMetric + */ +export class ReservationsMetric extends Message { + /** + * @generated from field: uint32 count = 1; + */ + count = 0; + + /** + * @generated from field: akash.provider.v1.ResourcesMetric resources = 2; + */ + resources?: ResourcesMetric; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.provider.v1.ReservationsMetric"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "count", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + { no: 2, name: "resources", kind: "message", T: ResourcesMetric }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ReservationsMetric { + return new ReservationsMetric().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ReservationsMetric { + return new ReservationsMetric().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ReservationsMetric { + return new ReservationsMetric().fromJsonString(jsonString, options); + } + + static equals(a: ReservationsMetric | PlainMessage | undefined, b: ReservationsMetric | PlainMessage | undefined): boolean { + return proto3.util.equals(ReservationsMetric, a, b); + } +} + +/** + * Reservations + * + * @generated from message akash.provider.v1.Reservations + */ +export class Reservations extends Message { + /** + * @generated from field: akash.provider.v1.ReservationsMetric pending = 1; + */ + pending?: ReservationsMetric; + + /** + * @generated from field: akash.provider.v1.ReservationsMetric active = 2; + */ + active?: ReservationsMetric; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.provider.v1.Reservations"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "pending", kind: "message", T: ReservationsMetric }, + { no: 2, name: "active", kind: "message", T: ReservationsMetric }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Reservations { + return new Reservations().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Reservations { + return new Reservations().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Reservations { + return new Reservations().fromJsonString(jsonString, options); + } + + static equals(a: Reservations | PlainMessage | undefined, b: Reservations | PlainMessage | undefined): boolean { + return proto3.util.equals(Reservations, a, b); + } +} + +/** + * Inventory + * + * @generated from message akash.provider.v1.Inventory + */ +export class Inventory extends Message { + /** + * @generated from field: akash.inventory.v1.Cluster cluster = 1; + */ + cluster?: Cluster; + + /** + * @generated from field: akash.provider.v1.Reservations reservations = 2; + */ + reservations?: Reservations; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.provider.v1.Inventory"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "cluster", kind: "message", T: Cluster }, + { no: 2, name: "reservations", kind: "message", T: Reservations }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Inventory { + return new Inventory().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Inventory { + return new Inventory().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Inventory { + return new Inventory().fromJsonString(jsonString, options); + } + + static equals(a: Inventory | PlainMessage | undefined, b: Inventory | PlainMessage | undefined): boolean { + return proto3.util.equals(Inventory, a, b); + } +} + +/** + * ClusterStatus + * + * @generated from message akash.provider.v1.ClusterStatus + */ +export class ClusterStatus extends Message { + /** + * @generated from field: akash.provider.v1.Leases leases = 1; + */ + leases?: Leases; + + /** + * @generated from field: akash.provider.v1.Inventory inventory = 2; + */ + inventory?: Inventory; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.provider.v1.ClusterStatus"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "leases", kind: "message", T: Leases }, + { no: 2, name: "inventory", kind: "message", T: Inventory }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ClusterStatus { + return new ClusterStatus().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ClusterStatus { + return new ClusterStatus().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ClusterStatus { + return new ClusterStatus().fromJsonString(jsonString, options); + } + + static equals(a: ClusterStatus | PlainMessage | undefined, b: ClusterStatus | PlainMessage | undefined): boolean { + return proto3.util.equals(ClusterStatus, a, b); + } +} + +/** + * BidEngineStatus + * + * @generated from message akash.provider.v1.BidEngineStatus + */ +export class BidEngineStatus extends Message { + /** + * @generated from field: uint32 orders = 1; + */ + orders = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.provider.v1.BidEngineStatus"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "orders", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): BidEngineStatus { + return new BidEngineStatus().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): BidEngineStatus { + return new BidEngineStatus().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): BidEngineStatus { + return new BidEngineStatus().fromJsonString(jsonString, options); + } + + static equals(a: BidEngineStatus | PlainMessage | undefined, b: BidEngineStatus | PlainMessage | undefined): boolean { + return proto3.util.equals(BidEngineStatus, a, b); + } +} + +/** + * ManifestStatus + * + * @generated from message akash.provider.v1.ManifestStatus + */ +export class ManifestStatus extends Message { + /** + * @generated from field: uint32 deployments = 1; + */ + deployments = 0; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.provider.v1.ManifestStatus"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "deployments", kind: "scalar", T: 13 /* ScalarType.UINT32 */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): ManifestStatus { + return new ManifestStatus().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): ManifestStatus { + return new ManifestStatus().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): ManifestStatus { + return new ManifestStatus().fromJsonString(jsonString, options); + } + + static equals(a: ManifestStatus | PlainMessage | undefined, b: ManifestStatus | PlainMessage | undefined): boolean { + return proto3.util.equals(ManifestStatus, a, b); + } +} + +/** + * Status + * + * @generated from message akash.provider.v1.Status + */ +export class Status extends Message { + /** + * @generated from field: repeated string errors = 1; + */ + errors: string[] = []; + + /** + * @generated from field: akash.provider.v1.ClusterStatus cluster = 2; + */ + cluster?: ClusterStatus; + + /** + * @generated from field: akash.provider.v1.BidEngineStatus bid_engine = 3; + */ + bidEngine?: BidEngineStatus; + + /** + * @generated from field: akash.provider.v1.ManifestStatus manifest = 4; + */ + manifest?: ManifestStatus; + + /** + * @generated from field: repeated string public_hostnames = 5; + */ + publicHostnames: string[] = []; + + /** + * @generated from field: google.protobuf.Timestamp timestamp = 6; + */ + timestamp?: Timestamp; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "akash.provider.v1.Status"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "errors", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 2, name: "cluster", kind: "message", T: ClusterStatus }, + { no: 3, name: "bid_engine", kind: "message", T: BidEngineStatus }, + { no: 4, name: "manifest", kind: "message", T: ManifestStatus }, + { no: 5, name: "public_hostnames", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, + { no: 6, name: "timestamp", kind: "message", T: Timestamp }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Status { + return new Status().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Status { + return new Status().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Status { + return new Status().fromJsonString(jsonString, options); + } + + static equals(a: Status | PlainMessage | undefined, b: Status | PlainMessage | undefined): boolean { + return proto3.util.equals(Status, a, b); + } +} + diff --git a/indexer/src/proto/gen/gogoproto/gogo_pb.ts b/indexer/src/proto/gen/gogoproto/gogo_pb.ts new file mode 100644 index 000000000..970d4f5c3 --- /dev/null +++ b/indexer/src/proto/gen/gogoproto/gogo_pb.ts @@ -0,0 +1,728 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file gogoproto/gogo.proto (package gogoproto, syntax proto2) +/* eslint-disable */ +// @ts-nocheck + +import { EnumOptions, EnumValueOptions, FieldOptions, FileOptions, MessageOptions, proto2 } from "@bufbuild/protobuf"; + +/** + * @generated from extension: optional bool goproto_enum_prefix = 62001; + */ +export const goproto_enum_prefix = proto2.makeExtension( + "gogoproto.goproto_enum_prefix", + EnumOptions, + { no: 62001, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_enum_stringer = 62021; + */ +export const goproto_enum_stringer = proto2.makeExtension( + "gogoproto.goproto_enum_stringer", + EnumOptions, + { no: 62021, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool enum_stringer = 62022; + */ +export const enum_stringer = proto2.makeExtension( + "gogoproto.enum_stringer", + EnumOptions, + { no: 62022, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional string enum_customname = 62023; + */ +export const enum_customname = proto2.makeExtension( + "gogoproto.enum_customname", + EnumOptions, + { no: 62023, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + +/** + * @generated from extension: optional bool enumdecl = 62024; + */ +export const enumdecl = proto2.makeExtension( + "gogoproto.enumdecl", + EnumOptions, + { no: 62024, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional string enumvalue_customname = 66001; + */ +export const enumvalue_customname = proto2.makeExtension( + "gogoproto.enumvalue_customname", + EnumValueOptions, + { no: 66001, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_getters_all = 63001; + */ +export const goproto_getters_all = proto2.makeExtension( + "gogoproto.goproto_getters_all", + FileOptions, + { no: 63001, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_enum_prefix_all = 63002; + */ +export const goproto_enum_prefix_all = proto2.makeExtension( + "gogoproto.goproto_enum_prefix_all", + FileOptions, + { no: 63002, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_stringer_all = 63003; + */ +export const goproto_stringer_all = proto2.makeExtension( + "gogoproto.goproto_stringer_all", + FileOptions, + { no: 63003, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool verbose_equal_all = 63004; + */ +export const verbose_equal_all = proto2.makeExtension( + "gogoproto.verbose_equal_all", + FileOptions, + { no: 63004, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool face_all = 63005; + */ +export const face_all = proto2.makeExtension( + "gogoproto.face_all", + FileOptions, + { no: 63005, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool gostring_all = 63006; + */ +export const gostring_all = proto2.makeExtension( + "gogoproto.gostring_all", + FileOptions, + { no: 63006, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool populate_all = 63007; + */ +export const populate_all = proto2.makeExtension( + "gogoproto.populate_all", + FileOptions, + { no: 63007, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool stringer_all = 63008; + */ +export const stringer_all = proto2.makeExtension( + "gogoproto.stringer_all", + FileOptions, + { no: 63008, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool onlyone_all = 63009; + */ +export const onlyone_all = proto2.makeExtension( + "gogoproto.onlyone_all", + FileOptions, + { no: 63009, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool equal_all = 63013; + */ +export const equal_all = proto2.makeExtension( + "gogoproto.equal_all", + FileOptions, + { no: 63013, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool description_all = 63014; + */ +export const description_all = proto2.makeExtension( + "gogoproto.description_all", + FileOptions, + { no: 63014, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool testgen_all = 63015; + */ +export const testgen_all = proto2.makeExtension( + "gogoproto.testgen_all", + FileOptions, + { no: 63015, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool benchgen_all = 63016; + */ +export const benchgen_all = proto2.makeExtension( + "gogoproto.benchgen_all", + FileOptions, + { no: 63016, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool marshaler_all = 63017; + */ +export const marshaler_all = proto2.makeExtension( + "gogoproto.marshaler_all", + FileOptions, + { no: 63017, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool unmarshaler_all = 63018; + */ +export const unmarshaler_all = proto2.makeExtension( + "gogoproto.unmarshaler_all", + FileOptions, + { no: 63018, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool stable_marshaler_all = 63019; + */ +export const stable_marshaler_all = proto2.makeExtension( + "gogoproto.stable_marshaler_all", + FileOptions, + { no: 63019, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool sizer_all = 63020; + */ +export const sizer_all = proto2.makeExtension( + "gogoproto.sizer_all", + FileOptions, + { no: 63020, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_enum_stringer_all = 63021; + */ +export const goproto_enum_stringer_all = proto2.makeExtension( + "gogoproto.goproto_enum_stringer_all", + FileOptions, + { no: 63021, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool enum_stringer_all = 63022; + */ +export const enum_stringer_all = proto2.makeExtension( + "gogoproto.enum_stringer_all", + FileOptions, + { no: 63022, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool unsafe_marshaler_all = 63023; + */ +export const unsafe_marshaler_all = proto2.makeExtension( + "gogoproto.unsafe_marshaler_all", + FileOptions, + { no: 63023, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool unsafe_unmarshaler_all = 63024; + */ +export const unsafe_unmarshaler_all = proto2.makeExtension( + "gogoproto.unsafe_unmarshaler_all", + FileOptions, + { no: 63024, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_extensions_map_all = 63025; + */ +export const goproto_extensions_map_all = proto2.makeExtension( + "gogoproto.goproto_extensions_map_all", + FileOptions, + { no: 63025, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_unrecognized_all = 63026; + */ +export const goproto_unrecognized_all = proto2.makeExtension( + "gogoproto.goproto_unrecognized_all", + FileOptions, + { no: 63026, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool gogoproto_import = 63027; + */ +export const gogoproto_import = proto2.makeExtension( + "gogoproto.gogoproto_import", + FileOptions, + { no: 63027, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool protosizer_all = 63028; + */ +export const protosizer_all = proto2.makeExtension( + "gogoproto.protosizer_all", + FileOptions, + { no: 63028, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool compare_all = 63029; + */ +export const compare_all = proto2.makeExtension( + "gogoproto.compare_all", + FileOptions, + { no: 63029, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool typedecl_all = 63030; + */ +export const typedecl_all = proto2.makeExtension( + "gogoproto.typedecl_all", + FileOptions, + { no: 63030, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool enumdecl_all = 63031; + */ +export const enumdecl_all = proto2.makeExtension( + "gogoproto.enumdecl_all", + FileOptions, + { no: 63031, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_registration = 63032; + */ +export const goproto_registration = proto2.makeExtension( + "gogoproto.goproto_registration", + FileOptions, + { no: 63032, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool messagename_all = 63033; + */ +export const messagename_all = proto2.makeExtension( + "gogoproto.messagename_all", + FileOptions, + { no: 63033, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_sizecache_all = 63034; + */ +export const goproto_sizecache_all = proto2.makeExtension( + "gogoproto.goproto_sizecache_all", + FileOptions, + { no: 63034, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_unkeyed_all = 63035; + */ +export const goproto_unkeyed_all = proto2.makeExtension( + "gogoproto.goproto_unkeyed_all", + FileOptions, + { no: 63035, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_getters = 64001; + */ +export const goproto_getters = proto2.makeExtension( + "gogoproto.goproto_getters", + MessageOptions, + { no: 64001, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_stringer = 64003; + */ +export const goproto_stringer = proto2.makeExtension( + "gogoproto.goproto_stringer", + MessageOptions, + { no: 64003, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool verbose_equal = 64004; + */ +export const verbose_equal = proto2.makeExtension( + "gogoproto.verbose_equal", + MessageOptions, + { no: 64004, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool face = 64005; + */ +export const face = proto2.makeExtension( + "gogoproto.face", + MessageOptions, + { no: 64005, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool gostring = 64006; + */ +export const gostring = proto2.makeExtension( + "gogoproto.gostring", + MessageOptions, + { no: 64006, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool populate = 64007; + */ +export const populate = proto2.makeExtension( + "gogoproto.populate", + MessageOptions, + { no: 64007, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool stringer = 67008; + */ +export const stringer = proto2.makeExtension( + "gogoproto.stringer", + MessageOptions, + { no: 67008, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool onlyone = 64009; + */ +export const onlyone = proto2.makeExtension( + "gogoproto.onlyone", + MessageOptions, + { no: 64009, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool equal = 64013; + */ +export const equal = proto2.makeExtension( + "gogoproto.equal", + MessageOptions, + { no: 64013, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool description = 64014; + */ +export const description = proto2.makeExtension( + "gogoproto.description", + MessageOptions, + { no: 64014, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool testgen = 64015; + */ +export const testgen = proto2.makeExtension( + "gogoproto.testgen", + MessageOptions, + { no: 64015, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool benchgen = 64016; + */ +export const benchgen = proto2.makeExtension( + "gogoproto.benchgen", + MessageOptions, + { no: 64016, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool marshaler = 64017; + */ +export const marshaler = proto2.makeExtension( + "gogoproto.marshaler", + MessageOptions, + { no: 64017, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool unmarshaler = 64018; + */ +export const unmarshaler = proto2.makeExtension( + "gogoproto.unmarshaler", + MessageOptions, + { no: 64018, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool stable_marshaler = 64019; + */ +export const stable_marshaler = proto2.makeExtension( + "gogoproto.stable_marshaler", + MessageOptions, + { no: 64019, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool sizer = 64020; + */ +export const sizer = proto2.makeExtension( + "gogoproto.sizer", + MessageOptions, + { no: 64020, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool unsafe_marshaler = 64023; + */ +export const unsafe_marshaler = proto2.makeExtension( + "gogoproto.unsafe_marshaler", + MessageOptions, + { no: 64023, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool unsafe_unmarshaler = 64024; + */ +export const unsafe_unmarshaler = proto2.makeExtension( + "gogoproto.unsafe_unmarshaler", + MessageOptions, + { no: 64024, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_extensions_map = 64025; + */ +export const goproto_extensions_map = proto2.makeExtension( + "gogoproto.goproto_extensions_map", + MessageOptions, + { no: 64025, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_unrecognized = 64026; + */ +export const goproto_unrecognized = proto2.makeExtension( + "gogoproto.goproto_unrecognized", + MessageOptions, + { no: 64026, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool protosizer = 64028; + */ +export const protosizer = proto2.makeExtension( + "gogoproto.protosizer", + MessageOptions, + { no: 64028, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool compare = 64029; + */ +export const compare = proto2.makeExtension( + "gogoproto.compare", + MessageOptions, + { no: 64029, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool typedecl = 64030; + */ +export const typedecl = proto2.makeExtension( + "gogoproto.typedecl", + MessageOptions, + { no: 64030, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool messagename = 64033; + */ +export const messagename = proto2.makeExtension( + "gogoproto.messagename", + MessageOptions, + { no: 64033, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_sizecache = 64034; + */ +export const goproto_sizecache = proto2.makeExtension( + "gogoproto.goproto_sizecache", + MessageOptions, + { no: 64034, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool goproto_unkeyed = 64035; + */ +export const goproto_unkeyed = proto2.makeExtension( + "gogoproto.goproto_unkeyed", + MessageOptions, + { no: 64035, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool nullable = 65001; + */ +export const nullable = proto2.makeExtension( + "gogoproto.nullable", + FieldOptions, + { no: 65001, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool embed = 65002; + */ +export const embed = proto2.makeExtension( + "gogoproto.embed", + FieldOptions, + { no: 65002, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional string customtype = 65003; + */ +export const customtype = proto2.makeExtension( + "gogoproto.customtype", + FieldOptions, + { no: 65003, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + +/** + * @generated from extension: optional string customname = 65004; + */ +export const customname = proto2.makeExtension( + "gogoproto.customname", + FieldOptions, + { no: 65004, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + +/** + * @generated from extension: optional string jsontag = 65005; + */ +export const jsontag = proto2.makeExtension( + "gogoproto.jsontag", + FieldOptions, + { no: 65005, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + +/** + * @generated from extension: optional string moretags = 65006; + */ +export const moretags = proto2.makeExtension( + "gogoproto.moretags", + FieldOptions, + { no: 65006, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + +/** + * @generated from extension: optional string casttype = 65007; + */ +export const casttype = proto2.makeExtension( + "gogoproto.casttype", + FieldOptions, + { no: 65007, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + +/** + * @generated from extension: optional string castkey = 65008; + */ +export const castkey = proto2.makeExtension( + "gogoproto.castkey", + FieldOptions, + { no: 65008, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + +/** + * @generated from extension: optional string castvalue = 65009; + */ +export const castvalue = proto2.makeExtension( + "gogoproto.castvalue", + FieldOptions, + { no: 65009, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + +/** + * @generated from extension: optional bool stdtime = 65010; + */ +export const stdtime = proto2.makeExtension( + "gogoproto.stdtime", + FieldOptions, + { no: 65010, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool stdduration = 65011; + */ +export const stdduration = proto2.makeExtension( + "gogoproto.stdduration", + FieldOptions, + { no: 65011, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional bool wktpointer = 65012; + */ +export const wktpointer = proto2.makeExtension( + "gogoproto.wktpointer", + FieldOptions, + { no: 65012, kind: "scalar", T: 8 /* ScalarType.BOOL */, opt: true }, +); + +/** + * @generated from extension: optional string castrepeated = 65013; + */ +export const castrepeated = proto2.makeExtension( + "gogoproto.castrepeated", + FieldOptions, + { no: 65013, kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, +); + diff --git a/indexer/src/proto/gen/google/api/annotations_pb.ts b/indexer/src/proto/gen/google/api/annotations_pb.ts new file mode 100644 index 000000000..089ee28e7 --- /dev/null +++ b/indexer/src/proto/gen/google/api/annotations_pb.ts @@ -0,0 +1,33 @@ +// Copyright (c) 2015, Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file google/api/annotations.proto (package google.api, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import { MethodOptions, proto3 } from "@bufbuild/protobuf"; +import { HttpRule } from "./http_pb"; + +/** + * See `HttpRule`. + * + * @generated from extension: google.api.HttpRule http = 72295728; + */ +export const http = proto3.makeExtension( + "google.api.http", + MethodOptions, + () => ({ no: 72295728, kind: "message", T: HttpRule }), +); + diff --git a/indexer/src/proto/gen/google/api/http_pb.ts b/indexer/src/proto/gen/google/api/http_pb.ts new file mode 100644 index 000000000..205ddfcc4 --- /dev/null +++ b/indexer/src/proto/gen/google/api/http_pb.ts @@ -0,0 +1,485 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file google/api/http.proto (package google.api, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + * + * @generated from message google.api.Http + */ +export class Http extends Message { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + * + * @generated from field: repeated google.api.HttpRule rules = 1; + */ + rules: HttpRule[] = []; + + /** + * When set to true, URL path parmeters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + * + * @generated from field: bool fully_decode_reserved_expansion = 2; + */ + fullyDecodeReservedExpansion = false; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "google.api.Http"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "rules", kind: "message", T: HttpRule, repeated: true }, + { no: 2, name: "fully_decode_reserved_expansion", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Http { + return new Http().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Http { + return new Http().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Http { + return new Http().fromJsonString(jsonString, options); + } + + static equals(a: Http | PlainMessage | undefined, b: Http | PlainMessage | undefined): boolean { + return proto3.util.equals(Http, a, b); + } +} + +/** + * `HttpRule` defines the mapping of an RPC method to one or more HTTP + * REST API methods. The mapping specifies how different portions of the RPC + * request message are mapped to URL path, URL query parameters, and + * HTTP request body. The mapping is typically specified as an + * `google.api.http` annotation on the RPC method, + * see "google/api/annotations.proto" for details. + * + * The mapping consists of a field specifying the path template and + * method kind. The path template can refer to fields in the request + * message, as in the example below which describes a REST GET + * operation on a resource collection of messages: + * + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // mapped to the URL + * SubMessage sub = 2; // `sub.subfield` is url-mapped + * } + * message Message { + * string text = 1; // content of the resource + * } + * + * The same http annotation can alternatively be expressed inside the + * `GRPC API Configuration` YAML file. + * + * http: + * rules: + * - selector: .Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * This definition enables an automatic, bidrectional mapping of HTTP + * JSON to RPC. Example: + * + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` + * + * In general, not only fields but also field paths can be referenced + * from a path pattern. Fields mapped to the path pattern cannot be + * repeated and must have a primitive (non-message) type. + * + * Any fields in the request message which are not bound by the path + * pattern automatically become (optional) HTTP query + * parameters. Assume the following definition of the request message: + * + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http).get = "/v1/messages/{message_id}"; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // mapped to the URL + * int64 revision = 2; // becomes a parameter + * SubMessage sub = 3; // `sub.subfield` becomes a parameter + * } + * + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` + * + * Note that fields which are mapped to HTTP parameters must have a + * primitive type or a repeated primitive type. Message types are not + * allowed. In the case of a repeated type, the parameter can be + * repeated in the URL, as in `...?param=A¶m=B`. + * + * For HTTP method kinds which allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * put: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | RPC + * -----|----- + * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * put: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | RPC + * -----|----- + * `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice of + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * + * This enables the following two alternative HTTP JSON to RPC + * mappings: + * + * HTTP | RPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` + * + * # Rules for HTTP mapping + * + * The rules for mapping HTTP path, query parameters, and body fields + * to the request message are as follows: + * + * 1. The `body` field specifies either `*` or a field path, or is + * omitted. If omitted, it indicates there is no HTTP request body. + * 2. Leaf fields (recursive expansion of nested messages in the + * request) can be classified into three types: + * (a) Matched in the URL template. + * (b) Covered by body (if body is `*`, everything except (a) fields; + * else everything under the body field) + * (c) All other fields. + * 3. URL query parameters found in the HTTP request are mapped to (c) fields. + * 4. Any body sent with an HTTP request can contain only (b) fields. + * + * The syntax of the path template is as follows: + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single path segment. The syntax `**` matches zero + * or more path segments, which must be the last part of the path except the + * `Verb`. The syntax `LITERAL` matches literal text in the path. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path, all characters + * except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the + * Discovery Document as `{var}`. + * + * If a variable contains one or more path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path, all + * characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables + * show up in the Discovery Document as `{+var}`. + * + * NOTE: While the single segment variable matches the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 + * Simple String Expansion, the multi segment variable **does not** match + * RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. + * + * NOTE: the field paths in variables and in the `body` must not refer to + * repeated fields or map fields. + * + * @generated from message google.api.HttpRule + */ +export class HttpRule extends Message { + /** + * Selects methods to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + * + * @generated from field: string selector = 1; + */ + selector = ""; + + /** + * Determines the URL pattern is matched by this rules. This pattern can be + * used with any of the {get|put|post|delete|patch} methods. A custom method + * can be defined using the 'custom' field. + * + * @generated from oneof google.api.HttpRule.pattern + */ + pattern: { + /** + * Used for listing and getting information about resources. + * + * @generated from field: string get = 2; + */ + value: string; + case: "get"; + } | { + /** + * Used for updating a resource. + * + * @generated from field: string put = 3; + */ + value: string; + case: "put"; + } | { + /** + * Used for creating a resource. + * + * @generated from field: string post = 4; + */ + value: string; + case: "post"; + } | { + /** + * Used for deleting a resource. + * + * @generated from field: string delete = 5; + */ + value: string; + case: "delete"; + } | { + /** + * Used for updating a resource. + * + * @generated from field: string patch = 6; + */ + value: string; + case: "patch"; + } | { + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + * + * @generated from field: google.api.CustomHttpPattern custom = 8; + */ + value: CustomHttpPattern; + case: "custom"; + } | { case: undefined; value?: undefined } = { case: undefined }; + + /** + * The name of the request field whose value is mapped to the HTTP body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + * + * @generated from field: string body = 7; + */ + body = ""; + + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + * + * @generated from field: string response_body = 12; + */ + responseBody = ""; + + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + * + * @generated from field: repeated google.api.HttpRule additional_bindings = 11; + */ + additionalBindings: HttpRule[] = []; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "google.api.HttpRule"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "selector", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "get", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 3, name: "put", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 4, name: "post", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 5, name: "delete", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 6, name: "patch", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "pattern" }, + { no: 8, name: "custom", kind: "message", T: CustomHttpPattern, oneof: "pattern" }, + { no: 7, name: "body", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 12, name: "response_body", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 11, name: "additional_bindings", kind: "message", T: HttpRule, repeated: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): HttpRule { + return new HttpRule().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): HttpRule { + return new HttpRule().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): HttpRule { + return new HttpRule().fromJsonString(jsonString, options); + } + + static equals(a: HttpRule | PlainMessage | undefined, b: HttpRule | PlainMessage | undefined): boolean { + return proto3.util.equals(HttpRule, a, b); + } +} + +/** + * A custom pattern is used for defining custom HTTP verb. + * + * @generated from message google.api.CustomHttpPattern + */ +export class CustomHttpPattern extends Message { + /** + * The name of this custom HTTP verb. + * + * @generated from field: string kind = 1; + */ + kind = ""; + + /** + * The path matched by this custom verb. + * + * @generated from field: string path = 2; + */ + path = ""; + + constructor(data?: PartialMessage) { + super(); + proto3.util.initPartial(data, this); + } + + static readonly runtime: typeof proto3 = proto3; + static readonly typeName = "google.api.CustomHttpPattern"; + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: "kind", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + { no: 2, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): CustomHttpPattern { + return new CustomHttpPattern().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): CustomHttpPattern { + return new CustomHttpPattern().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): CustomHttpPattern { + return new CustomHttpPattern().fromJsonString(jsonString, options); + } + + static equals(a: CustomHttpPattern | PlainMessage | undefined, b: CustomHttpPattern | PlainMessage | undefined): boolean { + return proto3.util.equals(CustomHttpPattern, a, b); + } +} + diff --git a/indexer/src/proto/gen/k8s.io/apimachinery/pkg/api/resource/generated_pb.ts b/indexer/src/proto/gen/k8s.io/apimachinery/pkg/api/resource/generated_pb.ts new file mode 100644 index 000000000..ee2f13ea9 --- /dev/null +++ b/indexer/src/proto/gen/k8s.io/apimachinery/pkg/api/resource/generated_pb.ts @@ -0,0 +1,178 @@ +// +//Copyright The Kubernetes Authors. +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +// @generated by protoc-gen-es v1.7.2 with parameter "target=ts" +// @generated from file k8s.io/apimachinery/pkg/api/resource/generated.proto (package k8s.io.apimachinery.pkg.api.resource, syntax proto2) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto2 } from "@bufbuild/protobuf"; + +/** + * Quantity is a fixed-point representation of a number. + * It provides convenient marshaling/unmarshaling in JSON and YAML, + * in addition to String() and AsInt64() accessors. + * + * The serialization format is: + * + * ``` + * ::= + * + * (Note that may be empty, from the "" case in .) + * + * ::= 0 | 1 | ... | 9 + * ::= | + * ::= | . | . | . + * ::= "+" | "-" + * ::= | + * ::= | | + * ::= Ki | Mi | Gi | Ti | Pi | Ei + * + * (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) + * + * ::= m | "" | k | M | G | T | P | E + * + * (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) + * + * ::= "e" | "E" + * ``` + * + * No matter which of the three exponent forms is used, no quantity may represent + * a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal + * places. Numbers larger or more precise will be capped or rounded up. + * (E.g.: 0.1m will rounded up to 1m.) + * This may be extended in the future if we require larger or smaller quantities. + * + * When a Quantity is parsed from a string, it will remember the type of suffix + * it had, and will use the same type again when it is serialized. + * + * Before serializing, Quantity will be put in "canonical form". + * This means that Exponent/suffix will be adjusted up or down (with a + * corresponding increase or decrease in Mantissa) such that: + * + * - No precision is lost + * - No fractional digits will be emitted + * - The exponent (or suffix) is as large as possible. + * + * The sign will be omitted unless the number is negative. + * + * Examples: + * + * - 1.5 will be serialized as "1500m" + * - 1.5Gi will be serialized as "1536Mi" + * + * Note that the quantity will NEVER be internally represented by a + * floating point number. That is the whole point of this exercise. + * + * Non-canonical values will still parse as long as they are well formed, + * but will be re-emitted in their canonical form. (So always use canonical + * form, or don't diff.) + * + * This format is intended to make it difficult to use these numbers without + * writing some sort of special handling code in the hopes that that will + * cause implementors to also use a fixed point implementation. + * + * +protobuf=true + * +protobuf.embed=string + * +protobuf.options.marshal=false + * +protobuf.options.(gogoproto.goproto_stringer)=false + * +k8s:deepcopy-gen=true + * +k8s:openapi-gen=true + * + * @generated from message k8s.io.apimachinery.pkg.api.resource.Quantity + */ +export class Quantity extends Message { + /** + * @generated from field: optional string string = 1; + */ + string?: string; + + constructor(data?: PartialMessage) { + super(); + proto2.util.initPartial(data, this); + } + + static readonly runtime: typeof proto2 = proto2; + static readonly typeName = "k8s.io.apimachinery.pkg.api.resource.Quantity"; + static readonly fields: FieldList = proto2.util.newFieldList(() => [ + { no: 1, name: "string", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): Quantity { + return new Quantity().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): Quantity { + return new Quantity().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): Quantity { + return new Quantity().fromJsonString(jsonString, options); + } + + static equals(a: Quantity | PlainMessage | undefined, b: Quantity | PlainMessage | undefined): boolean { + return proto2.util.equals(Quantity, a, b); + } +} + +/** + * QuantityValue makes it possible to use a Quantity as value for a command + * line parameter. + * + * +protobuf=true + * +protobuf.embed=string + * +protobuf.options.marshal=false + * +protobuf.options.(gogoproto.goproto_stringer)=false + * +k8s:deepcopy-gen=true + * + * @generated from message k8s.io.apimachinery.pkg.api.resource.QuantityValue + */ +export class QuantityValue extends Message { + /** + * @generated from field: optional string string = 1; + */ + string?: string; + + constructor(data?: PartialMessage) { + super(); + proto2.util.initPartial(data, this); + } + + static readonly runtime: typeof proto2 = proto2; + static readonly typeName = "k8s.io.apimachinery.pkg.api.resource.QuantityValue"; + static readonly fields: FieldList = proto2.util.newFieldList(() => [ + { no: 1, name: "string", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true }, + ]); + + static fromBinary(bytes: Uint8Array, options?: Partial): QuantityValue { + return new QuantityValue().fromBinary(bytes, options); + } + + static fromJson(jsonValue: JsonValue, options?: Partial): QuantityValue { + return new QuantityValue().fromJson(jsonValue, options); + } + + static fromJsonString(jsonString: string, options?: Partial): QuantityValue { + return new QuantityValue().fromJsonString(jsonString, options); + } + + static equals(a: QuantityValue | PlainMessage | undefined, b: QuantityValue | PlainMessage | undefined): boolean { + return proto2.util.equals(QuantityValue, a, b); + } +} + diff --git a/indexer/src/providers/providerStatusProvider.ts b/indexer/src/providers/providerStatusProvider.ts index 3c4a9219f..eeeee1186 100644 --- a/indexer/src/providers/providerStatusProvider.ts +++ b/indexer/src/providers/providerStatusProvider.ts @@ -7,7 +7,6 @@ import { ProviderSnapshot } from "@src/../../shared/dbSchemas/akash/providerSnap import { fetchAndSaveProviderStats as grpcFetchAndSaveProviderStats } from "./statusEndpointHandlers/grpc"; import { fetchAndSaveProviderStats as restFetchAndSaveProviderStats } from "./statusEndpointHandlers/rest"; -const IsGrpcEnpointEnabled = false; const ConcurrentStatusCall = 10; const StatusCallTimeout = 10_000; // 10 seconds @@ -34,13 +33,13 @@ export async function syncProvidersInfo() { httpsAgent: httpsAgent, timeout: StatusCallTimeout }); - - const versionStr = versionResponse.data.akash.version; - if (IsGrpcEnpointEnabled && versionStr && semver.gte(versionStr, "0.5.0")) { - await grpcFetchAndSaveProviderStats(provider, versionResponse.data.akash.cosmosSdkVersion, versionResponse.data.akash.version, StatusCallTimeout); + const versionStr = semver.valid(versionResponse.data.akash.version); + + if (versionStr && semver.gte(versionStr, "0.5.0-0")) { + await grpcFetchAndSaveProviderStats(provider, versionResponse.data.akash.cosmosSdkVersion, versionStr, StatusCallTimeout); } else { - await restFetchAndSaveProviderStats(provider, versionResponse.data.akash.cosmosSdkVersion, versionResponse.data.akash.version, StatusCallTimeout); + await restFetchAndSaveProviderStats(provider, versionResponse.data.akash.cosmosSdkVersion, versionStr, StatusCallTimeout); } } catch (err) { const checkDate = new Date(); diff --git a/indexer/src/providers/statusEndpointHandlers/grpc.ts b/indexer/src/providers/statusEndpointHandlers/grpc.ts index 896189c88..d11f42c85 100644 --- a/indexer/src/providers/statusEndpointHandlers/grpc.ts +++ b/indexer/src/providers/statusEndpointHandlers/grpc.ts @@ -3,28 +3,19 @@ import { sequelize } from "@src/db/dbConnection"; import { toUTC } from "@src/shared/utils/date"; import { parseDecimalKubernetesString, parseSizeStr } from "@src/shared/utils/files"; import { isSameDay } from "date-fns"; -import { loadFileDescriptorSetFromBuffer } from "@grpc/proto-loader"; -import { ProviderStatusResponseType } from "@src/types/grpc/providerStatusResponseType"; -import * as fs from "fs"; -import * as grpc from "@grpc/grpc-js"; - -const protosetBuffer = fs.readFileSync("./src/proto/akash/providerServiceDescriptor.bin"); -const descriptorSet = loadFileDescriptorSetFromBuffer(protosetBuffer); -const packageDef = grpc.loadPackageDefinition(descriptorSet); -const clientInsecureCreds = grpc.credentials.createInsecure(); +import { createPromiseClient } from "@connectrpc/connect"; +import { createGrpcTransport } from "@connectrpc/connect-node"; +import { ProviderRPC } from "@src/proto/gen/akash/provider/v1/service_connect"; +import { ResourcesMetric, Status } from "@src/proto/gen/akash/provider/v1/status_pb"; +import { NodeResources } from "@src/proto/gen/akash/inventory/v1/resources_pb"; export async function fetchAndSaveProviderStats(provider: Provider, cosmosSdkVersion: string, version: string, timeout: number) { const data = await queryStatus(provider.hostUri, timeout); - const activeResources = sumResources(data.cluster.inventory.reservations.active); - const pendingResources = sumResources(data.cluster.inventory.reservations.pending); + const activeResources = parseResources(data.cluster.inventory.reservations.active.resources); + const pendingResources = parseResources(data.cluster.inventory.reservations.pending.resources); const availableResources = data.cluster.inventory.cluster.nodes - .map((x) => ({ - cpu: parseDecimalKubernetesString(x.resources.cpu.quantity.allocatable.string), - memory: parseSizeStr(x.resources.memory.quantity.allocatable.string), - storage: parseSizeStr(x.resources.ephemeralStorage.allocatable.string), - gpu: parseDecimalKubernetesString(x.resources.gpu.quantity.allocatable.string) - })) + .map((x) => getAvailableResources(x.resources)) .reduce( (prev, next) => ({ cpu: prev.cpu + next.cpu, @@ -40,7 +31,7 @@ export async function fetchAndSaveProviderStats(provider: Provider, cosmosSdkVer } ); const checkDate = toUTC(new Date()); - + await sequelize.transaction(async (t) => { const createdSnapshot = await ProviderSnapshot.create( { @@ -108,21 +99,22 @@ export async function fetchAndSaveProviderStats(provider: Provider, cosmosSdkVer ); for (const node of data.cluster.inventory.cluster.nodes) { + const parsedResources = parseNodeResources(node.resources); const providerSnapshotNode = await ProviderSnapshotNode.create( { snapshotId: createdSnapshot.id, name: node.name, - cpuAllocatable: parseDecimalKubernetesString(node.resources.cpu.quantity.allocatable.string) * 1000, - cpuAllocated: parseDecimalKubernetesString(node.resources.cpu.quantity.allocated.string) * 1000, - memoryAllocatable: parseInt(node.resources.memory.quantity.allocatable.string), - memoryAllocated: parseSizeStr(node.resources.memory.quantity.allocated.string), - ephemeralStorageAllocatable: parseInt(node.resources.ephemeralStorage.allocatable.string), - ephemeralStorageAllocated: parseSizeStr(node.resources.ephemeralStorage.allocated.string), + cpuAllocatable: parsedResources.allocatableCPU, + cpuAllocated: parsedResources.allocatedCPU, + memoryAllocatable: parsedResources.allocatableMemory, + memoryAllocated: parsedResources.allocatedMemory, + ephemeralStorageAllocatable: parsedResources.allocatableStorage, + ephemeralStorageAllocated: parsedResources.allocatedStorage, capabilitiesStorageHDD: node.capabilities.storageClasses.includes("beta1"), capabilitiesStorageSSD: node.capabilities.storageClasses.includes("beta2"), capabilitiesStorageNVME: node.capabilities.storageClasses.includes("beta3"), - gpuAllocatable: parseDecimalKubernetesString(node.resources.gpu.quantity.allocatable.string), - gpuAllocated: parseDecimalKubernetesString(node.resources.gpu.quantity.allocated.string) + gpuAllocatable: parsedResources.allocatableGPU, + gpuAllocated: parsedResources.allocatedGPU }, { transaction: t } ); @@ -133,7 +125,7 @@ export async function fetchAndSaveProviderStats(provider: Provider, cosmosSdkVer snapshotNodeId: providerSnapshotNode.id, vendor: cpuInfo.vendor, model: cpuInfo.model, - vcores: cpuInfo.vcores // TODO: Change type to integer? + vcores: cpuInfo.vcores }, { transaction: t } ); @@ -156,49 +148,49 @@ export async function fetchAndSaveProviderStats(provider: Provider, cosmosSdkVer }); } -async function queryStatus(hostUri: string, timeout: number): Promise { - return new Promise((resolve, reject) => { - try { - const url = hostUri.replace("https://", "").replace(":8443", ":8444"); // Use 8444 as default GRPC port for now, enventually get from on-chain data - - const grpcClient = new (packageDef as any).akash.provider.v1.ProviderRPC(url, clientInsecureCreds); // TODO: Add deadline { deadline: Date.now() + timeout }, +async function queryStatus(hostUri: string, timeout: number): Promise { + const url = hostUri.replace(":8443", ":8444"); // Use 8444 as default GRPC port for now, enventually get from on-chain data - grpcClient.getStatus({}, (err, response) => { - console.log("err", err, "response", response); - if (err) { - reject(err); - } else { - resolve(response); - } - }); - } catch (err) { - reject(err); - } + const transport = createGrpcTransport({ + baseUrl: url, + httpVersion: "2", + nodeOptions: { rejectUnauthorized: false }, + interceptors: [] }); + const client = createPromiseClient(ProviderRPC, transport); + const res = await client.getStatus({}); + + return res; } -function sumResources(resources) { - const resourcesArr = resources?.nodes || resources || []; +function parseResources(resources: ResourcesMetric) { + return { + cpu: Math.round(parseDecimalKubernetesString(resources.cpu.string) * 1_000), + memory: parseSizeStr(resources.memory.string), + storage: parseSizeStr(resources.ephemeralStorage.string), + gpu: parseDecimalKubernetesString(resources.gpu.string) + }; +} - return resourcesArr - .map((x) => ({ - cpu: parseDecimalKubernetesString(x.cpu) * 1000, - gpu: x.gpu ? parseDecimalKubernetesString(x.gpu) : 0, - memory: parseSizeStr(x.memory), - storage: parseSizeStr(x.ephemeralStorage) - })) - .reduce( - (prev, next) => ({ - cpu: prev.cpu + next.cpu, - gpu: prev.gpu + next.gpu, - memory: prev.memory + next.memory, - storage: prev.storage + next.storage - }), - { - cpu: 0, - gpu: 0, - memory: 0, - storage: 0 - } - ); +function parseNodeResources(resources: NodeResources) { + return { + allocatableCPU: Math.round(parseDecimalKubernetesString(resources.cpu.quantity.allocatable.string) * 1_000), + allocatedCPU: Math.round(parseDecimalKubernetesString(resources.cpu.quantity.allocated.string) * 1_000), + allocatableMemory: parseSizeStr(resources.memory.quantity.allocatable.string), + allocatedMemory: parseSizeStr(resources.memory.quantity.allocated.string), + allocatableStorage: parseSizeStr(resources.ephemeralStorage.allocatable.string), + allocatedStorage: parseSizeStr(resources.ephemeralStorage.allocated.string), + allocatableGPU: parseDecimalKubernetesString(resources.gpu.quantity.allocatable.string), + allocatedGPU: parseDecimalKubernetesString(resources.gpu.quantity.allocatable.string) + }; +} + +function getAvailableResources(resources: NodeResources) { + const parsedResources = parseNodeResources(resources); + return { + cpu: parsedResources.allocatableCPU - parsedResources.allocatedCPU, + memory: parsedResources.allocatableMemory - parsedResources.allocatedMemory, + storage: parsedResources.allocatableStorage - parsedResources.allocatedStorage, + gpu: parsedResources.allocatableGPU - parsedResources.allocatedGPU + }; } diff --git a/indexer/src/shared/utils/files.ts b/indexer/src/shared/utils/files.ts index 5c0e9b54e..b29a2d38d 100644 --- a/indexer/src/shared/utils/files.ts +++ b/indexer/src/shared/utils/files.ts @@ -69,7 +69,7 @@ export function parseDecimalKubernetesString(str: string) { if (suffix) { const suffixPos = str.length - suffix.length; const numberStr = str.substring(0, suffixPos); - return parseFloat(numberStr) * specSuffixes[suffix]; + return parseFloat(numberStr) * kubernetesDecimalSuffixes[suffix]; } else { return parseFloat(str); } diff --git a/indexer/src/types/grpc/providerStatusResponseType.ts b/indexer/src/types/grpc/providerStatusResponseType.ts deleted file mode 100644 index 64d57f6c1..000000000 --- a/indexer/src/types/grpc/providerStatusResponseType.ts +++ /dev/null @@ -1,125 +0,0 @@ -// TODO: Remove once we have the generated grpc client and types -export type ProviderStatusResponseType = { - cluster: { - leases: { active?: number }; - inventory: { - cluster: { - nodes: { - name: string; - resources: { - cpu: { - quantity: { - allocatable: { - string: string; - }; - allocated: { - string: string; - }; - }; - info: { - id: string; - vendor: string; - model: string; - vcores: number; - }[]; - }; - memory: { - quantity: { - allocatable: { - string: string; - }; - allocated: { - string: string; - }; - }; - }; - gpu: { - quantity: { - allocatable: { - string: string; - }; - allocated: { - string: string; - }; - }; - info: { - vendor: string; - name: string; - modelid: string; - interface: string; - memorySize: string; - }[]; - }; - ephemeralStorage: { - allocatable: { - string: string; - }; - allocated: { - string: string; - }; - }; - volumesAttached: { - allocatable: { - string: string; - }; - allocated: { - string: string; - }; - }; - volumesMounted: { - allocatable: { - string: string; - }; - allocated: { - string: string; - }; - }; - }; - capabilities: { - storageClasses: ("beta1" | "beta2" | "beta3")[]; - }; - }[]; - }; - reservations: { - pending: { - resources: { - cpu: { - string: string; - }; - memory: { - string: string; - }; - gpu: { - string: string; - }; - ephemeralStorage: { - string: string; - }; - }; - }; - active: { - resources: { - cpu: { - string: string; - }; - memory: { - string: string; - }; - gpu: { - string: string; - }; - ephemeralStorage: { - string: string; - }; - }; - }; - }; - }; - }; - bidEngine: {}; - manifest: { - deployments: number; - }; - publicHostnames: string[]; - timestamp: string; -}; diff --git a/shared/dbSchemas/akash/providerSnapshotNodeCPU.ts b/shared/dbSchemas/akash/providerSnapshotNodeCPU.ts index df4084939..ca54f6029 100644 --- a/shared/dbSchemas/akash/providerSnapshotNodeCPU.ts +++ b/shared/dbSchemas/akash/providerSnapshotNodeCPU.ts @@ -11,5 +11,5 @@ export class ProviderSnapshotNodeCPU extends Model { @Column vendor: string; @Column model: string; - @Column vcores: string; + @Column(DataTypes.SMALLINT) vcores: number; }