From 806b563b8f5ce193dc7cce40b082cb32b0e508de Mon Sep 17 00:00:00 2001 From: gmemez Date: Wed, 29 Jan 2025 18:55:33 +0700 Subject: [PATCH 1/3] add block-related endpoints --- package-lock.json | 1588 ++++++++++++++++++++++++++++++ package.json | 7 +- src/endpoints.ts | 10 + src/index.test.ts | 177 ---- src/index.ts | 114 ++- src/schemas/address.ts | 11 + src/schemas/block.ts | 28 + src/schemas/index.ts | 4 + src/schemas/primitives.ts | 10 + src/schemas/transaction.ts | 21 + src/test/config/test-config.ts | 2 + src/test/data/test-data.ts | 102 ++ src/test/integration/api.test.ts | 202 ++++ src/test/unit/schemas.test.ts | 221 +++++ src/types/index.ts | 14 + tsconfig.json | 8 + 16 files changed, 2294 insertions(+), 225 deletions(-) create mode 100644 package-lock.json create mode 100644 src/endpoints.ts delete mode 100644 src/index.test.ts create mode 100644 src/schemas/address.ts create mode 100644 src/schemas/block.ts create mode 100644 src/schemas/index.ts create mode 100644 src/schemas/primitives.ts create mode 100644 src/schemas/transaction.ts create mode 100644 src/test/config/test-config.ts create mode 100644 src/test/data/test-data.ts create mode 100644 src/test/integration/api.test.ts create mode 100644 src/test/unit/schemas.test.ts create mode 100644 src/types/index.ts diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9ac186d --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1588 @@ +{ + "name": "ordapi", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "ordapi", + "version": "0.0.1", + "dependencies": { + "typescript-eslint": "^8.22.0", + "zod": "^3.24.1" + }, + "devDependencies": { + "@types/bun": "^1.2.1" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.1.tgz", + "integrity": "sha512-fo6Mtm5mWyKjA/Chy1BYTdn5mGJoDNjC7C64ug20ADsRDGrA85bN3uK3MaKbeRkRuuIEAR5N33Jr1pbm411/PA==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@eslint/object-schema": "^2.1.5", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz", + "integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "license": "MIT", + "peer": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "9.19.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.19.0.tgz", + "integrity": "sha512-rbq9/g38qjfqFLOVPvwjIvFFdNziEC5S65jmjPw5r6A//QH+W91akh9irMwjDN8zKUTak6W9EsAv4m/7Wnw0UQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.5.tgz", + "integrity": "sha512-o0bhxnL89h5Bae5T318nFoFzGy+YE5i/gGkoPAgkmTVdRKTiv3p8JHevPiPaMwoloKfEiiaHlawCqaZMqRm+XQ==", + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz", + "integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@eslint/core": "^0.10.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "license": "Apache-2.0", + "peer": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/bun": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.2.1.tgz", + "integrity": "sha512-iiCeMAKMkft8EPQJxSbpVRD0DKqrh91w40zunNajce3nMNNFd/LnAquVisSZC+UpTMjDwtcdyzbWct08IvEqRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bun-types": "1.2.1" + } + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "license": "MIT", + "peer": true + }, + "node_modules/@types/node": { + "version": "22.12.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.12.0.tgz", + "integrity": "sha512-Fll2FZ1riMjNmlmJOdAyY5pUbkftXslB5DgEzlIuNaiWhXd00FhWxVC/r4yV/4wBb9JfImTu+jiSvXTkJ7F/gA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } + }, + "node_modules/@types/ws": { + "version": "8.5.14", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.14.tgz", + "integrity": "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.22.0.tgz", + "integrity": "sha512-4Uta6REnz/xEJMvwf72wdUnC3rr4jAQf5jnTkeRQ9b6soxLxhDEbS/pfMPoJLDfFPNVRdryqWUIV/2GZzDJFZw==", + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.22.0", + "@typescript-eslint/type-utils": "8.22.0", + "@typescript-eslint/utils": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.22.0.tgz", + "integrity": "sha512-MqtmbdNEdoNxTPzpWiWnqNac54h8JDAmkWtJExBVVnSrSmi9z+sZUt0LfKqk9rjqmKOIeRhO4fHHJ1nQIjduIQ==", + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.22.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/typescript-estree": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.22.0.tgz", + "integrity": "sha512-/lwVV0UYgkj7wPSw0o8URy6YI64QmcOdwHuGuxWIYznO6d45ER0wXUbksr9pYdViAofpUCNJx/tAzNukgvaaiQ==", + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.22.0.tgz", + "integrity": "sha512-NzE3aB62fDEaGjaAYZE4LH7I1MUwHooQ98Byq0G0y3kkibPJQIXVUspzlFOmOfHhiDLwKzMlWxaNv+/qcZurJA==", + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "8.22.0", + "@typescript-eslint/utils": "8.22.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.22.0.tgz", + "integrity": "sha512-0S4M4baNzp612zwpD4YOieP3VowOARgK2EkN/GBn95hpyF8E2fbMT55sRHWBq+Huaqk3b3XK+rxxlM8sPgGM6A==", + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.22.0.tgz", + "integrity": "sha512-SJX99NAS2ugGOzpyhMza/tX+zDwjvwAtQFLsBo3GQxiGcvaKlqGBkmZ+Y1IdiSi9h4Q0Lr5ey+Cp9CGWNY/F/w==", + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/visitor-keys": "8.22.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.22.0.tgz", + "integrity": "sha512-T8oc1MbF8L+Bk2msAvCUzjxVB2Z2f+vXYfcucE2wOmYs7ZUwco5Ep0fYZw8quNwOiw9K8GYVL+Kgc2pETNTLOg==", + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "8.22.0", + "@typescript-eslint/types": "8.22.0", + "@typescript-eslint/typescript-estree": "8.22.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.22.0.tgz", + "integrity": "sha512-AWpYAXnUgvLNabGTy3uBylkgZoosva/miNd1I8Bz3SjotmQPbVqhO4Cczo8AsZ44XVErEBPr/CRSgaj8sG7g0w==", + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.22.0", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "license": "MIT", + "peer": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "license": "MIT", + "peer": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "peer": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0", + "peer": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/bun-types": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.2.1.tgz", + "integrity": "sha512-p7bmXUWmrPWxhcbFVk7oUXM5jAGt94URaoa3qf4mz43MEhNAo/ot1urzBqctgvuq7y9YxkuN51u+/qm4BiIsHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/ws": "~8.5.10" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT", + "peer": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT", + "peer": true + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "peer": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "license": "MIT", + "peer": true + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.19.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.19.0.tgz", + "integrity": "sha512-ug92j0LepKlbbEv6hD911THhoRHmbdXt2gX+VDABAW/Ir7D3nqKdv5Pf5vtlyY6HQMTEP2skXY43ueqTCWssEA==", + "license": "MIT", + "peer": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.10.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.19.0", + "@eslint/plugin-kit": "^0.2.5", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", + "license": "BSD-2-Clause", + "peer": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "license": "BSD-2-Clause", + "peer": true, + "dependencies": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "license": "BSD-3-Clause", + "peer": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "license": "BSD-2-Clause", + "peer": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "license": "BSD-2-Clause", + "peer": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "license": "BSD-2-Clause", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT", + "peer": true + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "license": "MIT", + "peer": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "license": "MIT", + "peer": true + }, + "node_modules/fastq": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", + "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==", + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "license": "MIT", + "peer": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "license": "MIT", + "peer": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", + "license": "ISC", + "peer": true + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "license": "ISC", + "peer": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "license": "MIT" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "license": "MIT", + "peer": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC", + "peer": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "license": "MIT", + "peer": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "license": "MIT", + "peer": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "license": "MIT", + "peer": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "license": "MIT", + "peer": true + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "license": "MIT", + "peer": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "license": "MIT", + "peer": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "license": "MIT", + "peer": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "peer": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "license": "MIT" + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "license": "MIT", + "peer": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "license": "MIT", + "peer": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "license": "MIT", + "peer": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "peer": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", + "peer": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-api-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "license": "MIT", + "peer": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typescript": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.22.0.tgz", + "integrity": "sha512-Y2rj210FW1Wb6TWXzQc5+P+EWI9/zdS57hLEc0gnyuvdzWo8+Y8brKlbj0muejonhMI/xAZCnZZwjbIfv1CkOw==", + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.22.0", + "@typescript-eslint/parser": "8.22.0", + "@typescript-eslint/utils": "8.22.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true, + "license": "MIT" + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "license": "BSD-2-Clause", + "peer": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "peer": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.24.1", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz", + "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/package.json b/package.json index fb318b5..29f9988 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,16 @@ "files": ["dist"], "scripts": { "build": "bun build ./src/index.ts --outdir ./dist --target node", - "test": "bun test", + "test": "bun test ./src/test/**/*.test.ts", "format": "prettier --write 'src/**/*.ts'", "lint": "eslint . && tsc -b", "prepublishOnly": "bun run build" }, + "imports": { + "#src/*": "./src/*", + "#schemas/*": "./src/schemas/*", + "#types/*": "./src/types/*" + }, "dependencies": { "typescript-eslint": "^8.22.0", "zod": "^3.24.1" diff --git a/src/endpoints.ts b/src/endpoints.ts new file mode 100644 index 0000000..a95df7c --- /dev/null +++ b/src/endpoints.ts @@ -0,0 +1,10 @@ +export const endpoints = { + address: (address: string) => `/address/${address}`, + block: (heightOrHash: number | string) => `/block/${heightOrHash}`, + blockcount: '/blockcount', + blockhashLatest: '/blockhash', + blockhashByHeight: (height: number) => `/blockhash/${height}`, + blockheight: '/blockheight', + blocks: '/blocks', + blocktime: '/blocktime', +} as const; diff --git a/src/index.test.ts b/src/index.test.ts deleted file mode 100644 index 40e2ac2..0000000 --- a/src/index.test.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { expect, test, describe } from 'bun:test'; -import { OrdClient as OrdClient, BlockSchema } from './index'; - -describe('OrdClient', () => { - test('parse valid block', () => { - const validBlock = { - best_height: 864325, - hash: '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f', - height: 0, - inscriptions: [], - runes: [], - target: - '00000000ffff0000000000000000000000000000000000000000000000000000', - transactions: [ - { - version: 1, - lock_time: 0, - input: [ - { - previous_output: - '0000000000000000000000000000000000000000000000000000000000000000:4294967295', - script_sig: - '04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73', - sequence: 4294967295, - witness: [], - }, - ], - output: [ - { - value: 5000000000, - script_pubkey: - '4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac', - }, - ], - }, - ], - }; - - const result = BlockSchema.safeParse(validBlock); - expect(result.success).toBe(true); - }); - - test('parse invalid block height', () => { - const invalidBlock = { - best_height: '864325', - hash: '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f', - height: 0, - inscriptions: [], - runes: [], - target: - '00000000ffff0000000000000000000000000000000000000000000000000000', - transactions: [ - { - version: 1, - lock_time: 0, - input: [ - { - previous_output: - '0000000000000000000000000000000000000000000000000000000000000000:4294967295', - script_sig: - '04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73', - sequence: 4294967295, - witness: [], - }, - ], - output: [ - { - value: 5000000000, - script_pubkey: - '4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac', - }, - ], - }, - ], - }; - - const result = BlockSchema.safeParse(invalidBlock); - expect(result.success).toBe(false); - }); - - test('parse invalid block hash', () => { - const invalidBlock = { - best_height: 864325, - hash: '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26', - height: 0, - inscriptions: [], - runes: [], - target: - '00000000ffff0000000000000000000000000000000000000000000000000000', - transactions: [ - { - version: 1, - lock_time: 0, - input: [ - { - previous_output: - '0000000000000000000000000000000000000000000000000000000000000000:4294967295', - script_sig: - '04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73', - sequence: 4294967295, - witness: [], - }, - ], - output: [ - { - value: 5000000000, - script_pubkey: - '4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac', - }, - ], - }, - ], - }; - - const result = BlockSchema.safeParse(invalidBlock); - expect(result.success).toBe(false); - }); -}); - -describe('API Integration Tests', () => { - const client = new OrdClient('https://charlie.ordinals.net'); - - const TIMEOUT = 10000; - - test( - 'getBlock fetches genesis block by height', - async () => { - const block = await client.getBlock(0); - expect(block.height).toBe(0); - expect(block.hash).toBe( - '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f', - ); - }, - TIMEOUT, - ); - - test( - 'getBlock fetches genesis block by hash', - async () => { - const block = await client.getBlock( - '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f', - ); - expect(block.height).toBe(0); - expect(block.hash).toBe( - '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f', - ); - }, - TIMEOUT, - ); - - test( - 'getBlock handles non-existent block', - async () => { - try { - await client.getBlock(-1); - throw new Error('Should have thrown an error'); - } catch (error) { - expect(error).toBeDefined(); - } - }, - TIMEOUT, - ); - - test( - 'handles server errors gracefully', - async () => { - const badClient = new OrdClient('https://non.existent.api'); - try { - await badClient.getBlock(0); - throw new Error('Should have thrown an error'); - } catch (error) { - expect(error).toBeDefined(); - } - }, - TIMEOUT, - ); -}); diff --git a/src/index.ts b/src/index.ts index 54b66a6..ac8a90e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,47 +1,16 @@ import { z } from 'zod'; +import { endpoints } from 'src/endpoints'; +import { + BlockSchema, + BlockHashSchema, + AddressInfoSchema, + BlocksResponseSchema, +} from 'schemas'; +import type { Block, BlockHash, AddressInfo, BlocksResponse } from 'types'; -export const InputSchema = z.object({ - previous_output: z.string(), - script_sig: z.string(), - sequence: z.number().int().nonnegative(), - witness: z.array(z.string()), -}); - -export const OutputSchema = z.object({ - value: z.number().int().nonnegative(), - script_pubkey: z.string(), -}); - -export const TransactionSchema = z.object({ - version: z.number().int().nonnegative(), - lock_time: z.number().int().nonnegative(), - input: z.array(InputSchema), - output: z.array(OutputSchema), -}); - -const isHexString = (str: string) => /^[0-9a-fA-F]+$/.test(str); - -export const blockHashSchema = z - .string() - .length(64, 'Block hash must be exactly 64 characters long') - .refine( - isHexString, - 'Block hash must contain only hexadecimal characters (0-9, a-f, A-F)', - ); - -export type BlockHash = z.infer; - -export const BlockSchema = z.object({ - best_height: z.number().int().nonnegative(), - hash: blockHashSchema, - height: z.number().int().nonnegative(), - inscriptions: z.array(z.string()), - runes: z.array(z.string()), - target: z.string(), - transactions: z.array(TransactionSchema), -}); - -export type Block = z.infer; +type ApiResponse = + | { success: true; data: T } + | { success: false; error: string }; export class OrdClient { private headers: HeadersInit; @@ -56,14 +25,65 @@ export class OrdClient { }; } - async getBlock(heightOrHash: number | BlockHash): Promise { - const response = await fetch(`${this.baseUrl}/block/${heightOrHash}`, { + private async fetch( + endpoint: string, + schema: T, + ): Promise> { + const response = await fetch(`${this.baseUrl}${endpoint}`, { headers: this.headers, }); + if (!response.ok) { - throw new Error(); + throw new Error(`API request failed: ${response.statusText}`); + } + + const text = await response.text(); + const result = schema.safeParse(text); + + if (!result.success) { + try { + const json = JSON.parse(text); + const jsonResult = schema.safeParse(json); + if (jsonResult.success) { + return jsonResult.data; + } + } catch {} + + throw new Error(`Validation error: ${result.error.message}`); } - const data = await response.json(); - return BlockSchema.parse(data); + + return result.data; + } + + async getAddress(address: string): Promise { + return this.fetch(endpoints.address(address), AddressInfoSchema); + } + + async getBlock(heightOrHash: number | BlockHash): Promise { + return this.fetch(endpoints.block(heightOrHash), BlockSchema); + } + + async getBlockCount(): Promise { + return this.fetch(endpoints.blockcount, z.number().int().nonnegative()); + } + + async getBlockHashByHeight(height: number): Promise { + return this.fetch(endpoints.blockhashByHeight(height), BlockHashSchema); + } + + async getLatestBlockHash(): Promise { + return this.fetch(endpoints.blockhashLatest, BlockHashSchema); + } + + async getBlockHeight(): Promise { + return this.fetch(endpoints.blockheight, z.number().int().nonnegative()); + } + + async getBlocks(): Promise { + return this.fetch(endpoints.blocks, BlocksResponseSchema); + } + + async getBlockTime(): Promise { + return this.fetch(endpoints.blocktime, z.number().int()); } } diff --git a/src/schemas/address.ts b/src/schemas/address.ts new file mode 100644 index 0000000..9bcc042 --- /dev/null +++ b/src/schemas/address.ts @@ -0,0 +1,11 @@ +import { z } from 'zod'; +import { satoshi } from 'schemas'; + +export const RuneBalanceSchema = z.tuple([z.string(), z.string(), z.string()]); + +export const AddressInfoSchema = z.object({ + outputs: z.array(z.string()), + inscriptions: z.array(z.string()), + sat_balance: satoshi, + runes_balances: z.array(RuneBalanceSchema), +}); diff --git a/src/schemas/block.ts b/src/schemas/block.ts new file mode 100644 index 0000000..8796731 --- /dev/null +++ b/src/schemas/block.ts @@ -0,0 +1,28 @@ +import { z } from 'zod'; +import { blockHeight, TransactionSchema } from 'schemas'; + +const isHexString = (str: string) => /^[0-9a-fA-F]+$/.test(str); + +export const BlockHashSchema = z + .string() + .length(64, 'Block hash must be exactly 64 characters long') + .refine( + isHexString, + 'Block hash must contain only hexadecimal characters (0-9, a-f, A-F)', + ); + +export const BlockSchema = z.object({ + best_height: blockHeight, + hash: BlockHashSchema, + height: blockHeight, + inscriptions: z.array(z.string()), + runes: z.array(z.string()), + target: z.string(), + transactions: z.array(TransactionSchema), +}); + +export const BlocksResponseSchema = z.object({ + last: blockHeight, + blocks: z.array(BlockHashSchema), + featured_blocks: z.record(BlockHashSchema, z.array(z.string())), +}); diff --git a/src/schemas/index.ts b/src/schemas/index.ts new file mode 100644 index 0000000..80ef723 --- /dev/null +++ b/src/schemas/index.ts @@ -0,0 +1,4 @@ +export * from 'schemas/primitives'; +export * from 'schemas/transaction'; +export * from 'schemas/block'; +export * from 'schemas/address'; diff --git a/src/schemas/primitives.ts b/src/schemas/primitives.ts new file mode 100644 index 0000000..5132c2f --- /dev/null +++ b/src/schemas/primitives.ts @@ -0,0 +1,10 @@ +import { z } from 'zod'; + +export const hexString = (length?: number) => { + const base = z.string().regex(/^[0-9a-fA-F]+$/, 'Must be a hex string'); + return length ? base.length(length) : base; +}; + +export const satoshi = z.number().int().nonnegative(); +export const blockHeight = z.number().int().nonnegative(); +export const timestamp = z.number().int(); diff --git a/src/schemas/transaction.ts b/src/schemas/transaction.ts new file mode 100644 index 0000000..b391b80 --- /dev/null +++ b/src/schemas/transaction.ts @@ -0,0 +1,21 @@ +import { z } from 'zod'; +import { satoshi } from 'schemas'; + +export const InputSchema = z.object({ + previous_output: z.string(), + script_sig: z.string(), + sequence: z.number().int().nonnegative(), + witness: z.array(z.string()), +}); + +export const OutputSchema = z.object({ + value: satoshi, + script_pubkey: z.string(), +}); + +export const TransactionSchema = z.object({ + version: z.number().int().nonnegative(), + lock_time: z.number().int().nonnegative(), + input: z.array(InputSchema), + output: z.array(OutputSchema), +}); diff --git a/src/test/config/test-config.ts b/src/test/config/test-config.ts new file mode 100644 index 0000000..8c66854 --- /dev/null +++ b/src/test/config/test-config.ts @@ -0,0 +1,2 @@ +export const BASE_URL = 'https://charlie.ordinals.net'; +export const TIMEOUT = 10000; diff --git a/src/test/data/test-data.ts b/src/test/data/test-data.ts new file mode 100644 index 0000000..89d6280 --- /dev/null +++ b/src/test/data/test-data.ts @@ -0,0 +1,102 @@ +export const GENESIS_BLOCK = { + best_height: 864325, + hash: '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f', + height: 0, + inscriptions: [], + runes: [], + target: '00000000ffff0000000000000000000000000000000000000000000000000000', + transactions: [ + { + version: 1, + lock_time: 0, + input: [ + { + previous_output: + '0000000000000000000000000000000000000000000000000000000000000000:4294967295', + script_sig: + '04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73', + sequence: 4294967295, + witness: [], + }, + ], + output: [ + { + value: 5000000000, + script_pubkey: + '4104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac', + }, + ], + }, + ], +}; + +export const SAMPLE_ADDRESS = + 'bc1pyy0ttst33sgv9vx0jnqueca7vsqqupwu2t38l43pfgpwjrqvdddsq73hzp'; + +export const SAMPLE_ADDRESS_INFO = { + outputs: [ + '37bd80a1a6f763b556e6e061435fde3847765578a993fa0446023a0f94011d0a:240', + 'b59bc9542e2715cc9b4e21cf29e5f2e763e5eb924b3d98fd84947b5e78ec1476:0', + '11b9f231169f0f07270011aa6430f77cc7e99794446cc34e951d7e01614fe0bd:1701', + '44c6b5a3f23b1e8ffbadfcb618bb7a724172c49f2594de9abb39e1f30a0dadcc:1698', + 'e1380b2896ad2e47f67a07e2d44806ba225a33e0cd5a01b0aba3d44735a87fe6:1687', + 'e1380b2896ad2e47f67a07e2d44806ba225a33e0cd5a01b0aba3d44735a87fe6:1688', + ], + inscriptions: [ + '3beb59221cec3d1fbc189fc54933488a8015f4f25cabe9d41537bc45a63b0137i0', + '0000077c4851b026f4d19c25bf80de7b5b44b856da50d67ae8da304bd3be6999i5698', + ], + sat_balance: 3297, + runes_balances: [ + ['GREED•FRAGMENTS', '417', '∞'], + ['LIQUIDIUM•TOKEN', '117.42', '🫠'], + ['EPIC•EPIC•EPIC•EPIC', '20000', '💥'], + ], +}; + +export const SAMPLE_RUNE_BALANCE = ['TEST•RUNE', '100', '🎯']; + +export const SAMPLE_BLOCKS_RESPONSE = { + last: 1000, + blocks: [ + '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f', + '00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048', + ], + featured_blocks: { + '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f': [ + 'inscription1', + 'inscription2', + ], + }, +}; + +export const SAMPLE_TRANSACTION = { + version: 1, + lock_time: 0, + input: [ + { + previous_output: 'abc123:0', + script_sig: '76a914...', + sequence: 4294967295, + witness: [], + }, + ], + output: [ + { + value: 5000000000, + script_pubkey: '76a914...', + }, + ], +}; + +export const SAMPLE_INPUT = { + previous_output: 'abc123:0', + script_sig: '76a914...', + sequence: 4294967295, + witness: ['304502...'], +}; + +export const SAMPLE_OUTPUT = { + value: 5000000000, + script_pubkey: '76a914...', +}; diff --git a/src/test/integration/api.test.ts b/src/test/integration/api.test.ts new file mode 100644 index 0000000..d08b362 --- /dev/null +++ b/src/test/integration/api.test.ts @@ -0,0 +1,202 @@ +import { expect, test, describe, beforeAll } from 'bun:test'; +import { OrdClient } from '../../index'; +import { BASE_URL, TIMEOUT } from '../config/test-config'; +import { + GENESIS_BLOCK, + SAMPLE_ADDRESS, + SAMPLE_ADDRESS_INFO, +} from '../data/test-data'; + +describe('API Integration Tests', () => { + let client: OrdClient; + let errorClient: OrdClient; + + beforeAll(() => { + client = new OrdClient(BASE_URL); + errorClient = new OrdClient('https://invalid.api'); + }); + + describe('getBlock', () => { + test( + 'fetches genesis block successfully', + async () => { + const block = await client.getBlock(0); + expect(block.height).toBe(0); + expect(block.hash).toBe(GENESIS_BLOCK.hash); + }, + TIMEOUT, + ); + + test( + 'rejects negative block height', + async () => { + await expect(client.getBlock(-1)).rejects.toThrow(); + }, + TIMEOUT, + ); + + test( + 'handles server error', + async () => { + await expect(errorClient.getBlock(0)).rejects.toThrow(); + }, + TIMEOUT, + ); + }); + + describe('getAddress', () => { + test( + 'fetches address info successfully', + async () => { + const info = await client.getAddress(SAMPLE_ADDRESS); + expect(info).toEqual(SAMPLE_ADDRESS_INFO); + }, + TIMEOUT, + ); + + test( + 'rejects invalid address format', + async () => { + await expect(client.getAddress('invalid-address')).rejects.toThrow(); + }, + TIMEOUT, + ); + + test( + 'handles server error', + async () => { + await expect(errorClient.getAddress(SAMPLE_ADDRESS)).rejects.toThrow(); + }, + TIMEOUT, + ); + }); + + describe('getBlockCount', () => { + test( + 'returns block count successfully', + async () => { + const count = await client.getBlockCount(); + expect(count).toBeGreaterThan(0); + }, + TIMEOUT, + ); + + test( + 'handles server error', + async () => { + await expect(errorClient.getBlockCount()).rejects.toThrow(); + }, + TIMEOUT, + ); + }); + + describe('getBlockHashByHeight', () => { + test( + 'returns genesis block hash successfully', + async () => { + const hash = await client.getBlockHashByHeight(0); + expect(hash).toBe(GENESIS_BLOCK.hash); + }, + TIMEOUT, + ); + + test( + 'rejects negative height', + async () => { + await expect(client.getBlockHashByHeight(-1)).rejects.toThrow(); + }, + TIMEOUT, + ); + + test( + 'handles server error', + async () => { + await expect(errorClient.getBlockHashByHeight(0)).rejects.toThrow(); + }, + TIMEOUT, + ); + }); + + describe('getLatestBlockHash', () => { + test( + 'returns valid hash successfully', + async () => { + const hash = await client.getLatestBlockHash(); + expect(hash).toMatch(/^[0-9a-f]{64}$/); + }, + TIMEOUT, + ); + + test( + 'handles server error', + async () => { + await expect(errorClient.getLatestBlockHash()).rejects.toThrow(); + }, + TIMEOUT, + ); + }); + + describe('getBlockHeight', () => { + test( + 'returns height successfully', + async () => { + const height = await client.getBlockHeight(); + expect(height).toBeGreaterThan(0); + }, + TIMEOUT, + ); + + test( + 'handles server error', + async () => { + await expect(errorClient.getBlockHeight()).rejects.toThrow(); + }, + TIMEOUT, + ); + }); + + describe('getBlocks', () => { + test( + 'returns blocks list successfully', + async () => { + const blocksResponse = await client.getBlocks(); + + expect(typeof blocksResponse.last).toBe('number'); + expect(Array.isArray(blocksResponse.blocks)).toBe(true); + expect(typeof blocksResponse.featured_blocks).toBe('object'); + + if (blocksResponse.blocks.length > 0) { + expect(blocksResponse.blocks[0]).toMatch(/^[0-9a-f]{64}$/); + } + }, + TIMEOUT, + ); + + test( + 'handles server error', + async () => { + await expect(errorClient.getBlocks()).rejects.toThrow(); + }, + TIMEOUT, + ); + }); + + describe('getBlockTime', () => { + test( + 'returns timestamp successfully', + async () => { + const time = await client.getBlockTime(); + expect(time).toBeGreaterThan(0); + }, + TIMEOUT, + ); + + test( + 'handles server error', + async () => { + await expect(errorClient.getBlockTime()).rejects.toThrow(); + }, + TIMEOUT, + ); + }); +}); diff --git a/src/test/unit/schemas.test.ts b/src/test/unit/schemas.test.ts new file mode 100644 index 0000000..eb95b79 --- /dev/null +++ b/src/test/unit/schemas.test.ts @@ -0,0 +1,221 @@ +import { expect, test, describe } from 'bun:test'; +import { + BlockSchema, + BlockHashSchema, + BlocksResponseSchema, +} from '../../schemas/block'; +import { AddressInfoSchema, RuneBalanceSchema } from '../../schemas/address'; +import { + InputSchema, + OutputSchema, + TransactionSchema, +} from '../../schemas/transaction'; +import { + GENESIS_BLOCK, + SAMPLE_ADDRESS_INFO, + SAMPLE_BLOCKS_RESPONSE, + SAMPLE_TRANSACTION, + SAMPLE_INPUT, + SAMPLE_OUTPUT, + SAMPLE_RUNE_BALANCE, +} from '../data/test-data'; + +describe('Schema Validation', () => { + describe('Transaction Schemas', () => { + describe('InputSchema', () => { + test('validates valid input', () => { + expect(InputSchema.safeParse(SAMPLE_INPUT).success).toBe(true); + }); + + test('rejects invalid sequence', () => { + const invalidInput = { + ...SAMPLE_INPUT, + sequence: -1, + }; + expect(InputSchema.safeParse(invalidInput).success).toBe(false); + }); + + test('rejects missing field', () => { + const { script_sig, ...invalidInput } = SAMPLE_INPUT; + expect(InputSchema.safeParse(invalidInput).success).toBe(false); + }); + }); + + describe('OutputSchema', () => { + test('validates valid output', () => { + expect(OutputSchema.safeParse(SAMPLE_OUTPUT).success).toBe(true); + }); + + test('rejects negative value', () => { + const invalidOutput = { + ...SAMPLE_OUTPUT, + value: -5000000000, + }; + expect(OutputSchema.safeParse(invalidOutput).success).toBe(false); + }); + + test('rejects missing script_pubkey', () => { + const { script_pubkey, ...invalidOutput } = SAMPLE_OUTPUT; + expect(OutputSchema.safeParse(invalidOutput).success).toBe(false); + }); + }); + + describe('TransactionSchema', () => { + test('validates valid transaction', () => { + expect(TransactionSchema.safeParse(SAMPLE_TRANSACTION).success).toBe( + true, + ); + }); + + test('rejects invalid version', () => { + const invalidTx = { + ...SAMPLE_TRANSACTION, + version: -1, + }; + expect(TransactionSchema.safeParse(invalidTx).success).toBe(false); + }); + + test('rejects invalid input array', () => { + const invalidTx = { + ...SAMPLE_TRANSACTION, + input: [{ invalid: 'data' }], + }; + expect(TransactionSchema.safeParse(invalidTx).success).toBe(false); + }); + }); + }); + + describe('Block Schemas', () => { + describe('BlockHashSchema', () => { + test('validates valid block hash', () => { + const validHash = GENESIS_BLOCK.hash; + expect(BlockHashSchema.safeParse(validHash).success).toBe(true); + }); + + test('rejects invalid length', () => { + const shortHash = GENESIS_BLOCK.hash.slice(0, -1); // Remove last character + expect(BlockHashSchema.safeParse(shortHash).success).toBe(false); + }); + + test('rejects non-hex characters', () => { + const invalidHash = GENESIS_BLOCK.hash.replace('0', 'g'); + expect(BlockHashSchema.safeParse(invalidHash).success).toBe(false); + }); + }); + + describe('BlocksResponseSchema', () => { + test('validates valid blocks response', () => { + expect( + BlocksResponseSchema.safeParse(SAMPLE_BLOCKS_RESPONSE).success, + ).toBe(true); + }); + + test('validates empty blocks response', () => { + const emptyResponse = { + last: 0, + blocks: [], + featured_blocks: {}, + }; + expect(BlocksResponseSchema.safeParse(emptyResponse).success).toBe( + true, + ); + }); + + test('rejects invalid last height', () => { + const invalidResponse = { + ...SAMPLE_BLOCKS_RESPONSE, + last: -1, + }; + expect(BlocksResponseSchema.safeParse(invalidResponse).success).toBe( + false, + ); + }); + }); + + describe('BlockSchema', () => { + test('validates valid block', () => { + expect(BlockSchema.safeParse(GENESIS_BLOCK).success).toBe(true); + }); + + test('rejects invalid block height type', () => { + const invalidBlock = { + ...GENESIS_BLOCK, + best_height: '864325', // string instead of number + }; + expect(BlockSchema.safeParse(invalidBlock).success).toBe(false); + }); + + test('rejects invalid block hash', () => { + const invalidBlock = { + ...GENESIS_BLOCK, + hash: 'invalid_hash', + }; + expect(BlockSchema.safeParse(invalidBlock).success).toBe(false); + }); + + test('rejects negative height', () => { + const invalidBlock = { + ...GENESIS_BLOCK, + height: -1, + }; + expect(BlockSchema.safeParse(invalidBlock).success).toBe(false); + }); + }); + }); + + describe('Address Schemas', () => { + describe('RuneBalanceSchema', () => { + test('validates valid rune balance', () => { + expect(RuneBalanceSchema.safeParse(SAMPLE_RUNE_BALANCE).success).toBe( + true, + ); + }); + + test('rejects invalid tuple length', () => { + const invalidBalance = ['TEST•RUNE', '100']; + expect(RuneBalanceSchema.safeParse(invalidBalance).success).toBe(false); + }); + + test('rejects invalid value type', () => { + const invalidBalance = ['TEST•RUNE', 100, '🎯']; + expect(RuneBalanceSchema.safeParse(invalidBalance).success).toBe(false); + }); + }); + + describe('AddressInfoSchema', () => { + test('validates valid address info', () => { + expect(AddressInfoSchema.safeParse(SAMPLE_ADDRESS_INFO).success).toBe( + true, + ); + }); + + test('validates empty arrays', () => { + const emptyAddressInfo = { + outputs: [], + inscriptions: [], + sat_balance: 0, + runes_balances: [], + }; + expect(AddressInfoSchema.safeParse(emptyAddressInfo).success).toBe( + true, + ); + }); + + test('rejects negative sat balance', () => { + const invalidAddress = { + ...SAMPLE_ADDRESS_INFO, + sat_balance: -1, + }; + expect(AddressInfoSchema.safeParse(invalidAddress).success).toBe(false); + }); + + test('rejects invalid runes_balances format', () => { + const invalidAddress = { + ...SAMPLE_ADDRESS_INFO, + runes_balances: [['TEST•RUNE', 100, '🎯']], // number instead of string + }; + expect(AddressInfoSchema.safeParse(invalidAddress).success).toBe(false); + }); + }); + }); +}); diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..47c309f --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,14 @@ +import { z } from 'zod'; +import { + BlockSchema, + BlockHashSchema, + BlocksResponseSchema, + TransactionSchema, + AddressInfoSchema, +} from 'schemas'; + +export type Block = z.infer; +export type BlockHash = z.infer; +export type BlocksResponse = z.infer; +export type Transaction = z.infer; +export type AddressInfo = z.infer; diff --git a/tsconfig.json b/tsconfig.json index 267bdfa..c9c25c7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,14 @@ "module": "esnext", "moduleResolution": "bundler", "types": ["bun-types"], + "baseUrl": ".", + "paths": { + "src": ["src/*"], + "schemas": ["src/schemas"], + "schemas/*": ["src/schemas/*"], + "types": ["src/types"], + "types/*": ["src/types/*"], + }, "esModuleInterop": true, "strict": true, "skipLibCheck": true, From 46487af818e2805c58fa13aaebc2aa46c46beadb Mon Sep 17 00:00:00 2001 From: gmemez Date: Wed, 29 Jan 2025 19:37:51 +0700 Subject: [PATCH 2/3] pr fixes --- src/index.ts | 6 ++-- src/schemas/address.ts | 3 +- src/schemas/block.ts | 8 +++--- src/schemas/index.ts | 1 - src/schemas/inscription.ts | 49 ++++++++++++++++++++++++++++++++ src/schemas/primitives.ts | 10 ------- src/schemas/transaction.ts | 3 +- src/test/integration/api.test.ts | 34 +++++++++++----------- 8 files changed, 76 insertions(+), 38 deletions(-) create mode 100644 src/schemas/inscription.ts delete mode 100644 src/schemas/primitives.ts diff --git a/src/index.ts b/src/index.ts index ac8a90e..5953abb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -75,15 +75,15 @@ export class OrdClient { return this.fetch(endpoints.blockhashLatest, BlockHashSchema); } - async getBlockHeight(): Promise { + async getLatestBlockHeight(): Promise { return this.fetch(endpoints.blockheight, z.number().int().nonnegative()); } - async getBlocks(): Promise { + async getLatestBlocks(): Promise { return this.fetch(endpoints.blocks, BlocksResponseSchema); } - async getBlockTime(): Promise { + async getLatestBlockTime(): Promise { return this.fetch(endpoints.blocktime, z.number().int()); } } diff --git a/src/schemas/address.ts b/src/schemas/address.ts index 9bcc042..93641c3 100644 --- a/src/schemas/address.ts +++ b/src/schemas/address.ts @@ -1,11 +1,10 @@ import { z } from 'zod'; -import { satoshi } from 'schemas'; export const RuneBalanceSchema = z.tuple([z.string(), z.string(), z.string()]); export const AddressInfoSchema = z.object({ outputs: z.array(z.string()), inscriptions: z.array(z.string()), - sat_balance: satoshi, + sat_balance: z.number().int().nonnegative(), runes_balances: z.array(RuneBalanceSchema), }); diff --git a/src/schemas/block.ts b/src/schemas/block.ts index 8796731..7d17158 100644 --- a/src/schemas/block.ts +++ b/src/schemas/block.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { blockHeight, TransactionSchema } from 'schemas'; +import { TransactionSchema } from 'schemas'; const isHexString = (str: string) => /^[0-9a-fA-F]+$/.test(str); @@ -12,9 +12,9 @@ export const BlockHashSchema = z ); export const BlockSchema = z.object({ - best_height: blockHeight, + best_height: z.number().int().nonnegative(), hash: BlockHashSchema, - height: blockHeight, + height: z.number().int().nonnegative(), inscriptions: z.array(z.string()), runes: z.array(z.string()), target: z.string(), @@ -22,7 +22,7 @@ export const BlockSchema = z.object({ }); export const BlocksResponseSchema = z.object({ - last: blockHeight, + last: z.number().int().nonnegative(), blocks: z.array(BlockHashSchema), featured_blocks: z.record(BlockHashSchema, z.array(z.string())), }); diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 80ef723..f3e79ba 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -1,4 +1,3 @@ -export * from 'schemas/primitives'; export * from 'schemas/transaction'; export * from 'schemas/block'; export * from 'schemas/address'; diff --git a/src/schemas/inscription.ts b/src/schemas/inscription.ts new file mode 100644 index 0000000..f543bbb --- /dev/null +++ b/src/schemas/inscription.ts @@ -0,0 +1,49 @@ +import { z } from 'zod'; + +export const InscriptionContentSchema = z.object({ + body: z.string().optional(), + content_encoding: z.string().optional(), + content_length: z.number().optional(), + content_type: z.string(), +}); + +export const InscriptionSchema = z.object({ + address: z.string().optional(), + chain_stats: z.object({ + blocks_since_genesis: z.number(), + inscription_number: z.number(), + timestamp: z.number(), + }), + charms: z.array(z.string()), + content: InscriptionContentSchema, + content_length: z.number(), + content_type: z.string(), + genesis_fee: z.number().int().nonnegative(), + genesis_height: z.number(), + id: z.string(), + location: z.string(), + offset: z.number().optional(), + output: z.string(), + output_value: z.number().int().nonnegative(), + parent: z.string().optional(), + rune: z + .object({ + id: z.string(), + name: z.string(), + rune: z.string(), + supply: z.string(), + symbol: z.string().optional(), + timestamp: z.number(), + }) + .optional(), + sat: z.string().optional(), + timestamp: z.number(), +}); + +export const InscriptionIdSchema = z.string().regex(/^[0-9a-f]{64}i\d+$/); + +export const InscriptionsResponseSchema = z.object({ + inscriptions: z.array(InscriptionSchema), + page: z.number().optional(), + total_pages: z.number().optional(), +}); diff --git a/src/schemas/primitives.ts b/src/schemas/primitives.ts deleted file mode 100644 index 5132c2f..0000000 --- a/src/schemas/primitives.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { z } from 'zod'; - -export const hexString = (length?: number) => { - const base = z.string().regex(/^[0-9a-fA-F]+$/, 'Must be a hex string'); - return length ? base.length(length) : base; -}; - -export const satoshi = z.number().int().nonnegative(); -export const blockHeight = z.number().int().nonnegative(); -export const timestamp = z.number().int(); diff --git a/src/schemas/transaction.ts b/src/schemas/transaction.ts index b391b80..d7989b0 100644 --- a/src/schemas/transaction.ts +++ b/src/schemas/transaction.ts @@ -1,5 +1,4 @@ import { z } from 'zod'; -import { satoshi } from 'schemas'; export const InputSchema = z.object({ previous_output: z.string(), @@ -9,7 +8,7 @@ export const InputSchema = z.object({ }); export const OutputSchema = z.object({ - value: satoshi, + value: z.number().int().nonnegative(), script_pubkey: z.string(), }); diff --git a/src/test/integration/api.test.ts b/src/test/integration/api.test.ts index d08b362..f966ee6 100644 --- a/src/test/integration/api.test.ts +++ b/src/test/integration/api.test.ts @@ -9,11 +9,11 @@ import { describe('API Integration Tests', () => { let client: OrdClient; - let errorClient: OrdClient; + let invalidClient: OrdClient; beforeAll(() => { client = new OrdClient(BASE_URL); - errorClient = new OrdClient('https://invalid.api'); + invalidClient = new OrdClient('https://invalid.api'); }); describe('getBlock', () => { @@ -38,7 +38,7 @@ describe('API Integration Tests', () => { test( 'handles server error', async () => { - await expect(errorClient.getBlock(0)).rejects.toThrow(); + await expect(invalidClient.getBlock(0)).rejects.toThrow(); }, TIMEOUT, ); @@ -65,7 +65,9 @@ describe('API Integration Tests', () => { test( 'handles server error', async () => { - await expect(errorClient.getAddress(SAMPLE_ADDRESS)).rejects.toThrow(); + await expect( + invalidClient.getAddress(SAMPLE_ADDRESS), + ).rejects.toThrow(); }, TIMEOUT, ); @@ -84,7 +86,7 @@ describe('API Integration Tests', () => { test( 'handles server error', async () => { - await expect(errorClient.getBlockCount()).rejects.toThrow(); + await expect(invalidClient.getBlockCount()).rejects.toThrow(); }, TIMEOUT, ); @@ -111,7 +113,7 @@ describe('API Integration Tests', () => { test( 'handles server error', async () => { - await expect(errorClient.getBlockHashByHeight(0)).rejects.toThrow(); + await expect(invalidClient.getBlockHashByHeight(0)).rejects.toThrow(); }, TIMEOUT, ); @@ -130,17 +132,17 @@ describe('API Integration Tests', () => { test( 'handles server error', async () => { - await expect(errorClient.getLatestBlockHash()).rejects.toThrow(); + await expect(invalidClient.getLatestBlockHash()).rejects.toThrow(); }, TIMEOUT, ); }); - describe('getBlockHeight', () => { + describe('getLatestBlockHeight', () => { test( 'returns height successfully', async () => { - const height = await client.getBlockHeight(); + const height = await client.getLatestBlockHeight(); expect(height).toBeGreaterThan(0); }, TIMEOUT, @@ -149,17 +151,17 @@ describe('API Integration Tests', () => { test( 'handles server error', async () => { - await expect(errorClient.getBlockHeight()).rejects.toThrow(); + await expect(invalidClient.getLatestBlockHeight()).rejects.toThrow(); }, TIMEOUT, ); }); - describe('getBlocks', () => { + describe('getLatestBlocks', () => { test( 'returns blocks list successfully', async () => { - const blocksResponse = await client.getBlocks(); + const blocksResponse = await client.getLatestBlocks(); expect(typeof blocksResponse.last).toBe('number'); expect(Array.isArray(blocksResponse.blocks)).toBe(true); @@ -175,17 +177,17 @@ describe('API Integration Tests', () => { test( 'handles server error', async () => { - await expect(errorClient.getBlocks()).rejects.toThrow(); + await expect(invalidClient.getLatestBlocks()).rejects.toThrow(); }, TIMEOUT, ); }); - describe('getBlockTime', () => { + describe('getLatestBlockTime', () => { test( 'returns timestamp successfully', async () => { - const time = await client.getBlockTime(); + const time = await client.getLatestBlockTime(); expect(time).toBeGreaterThan(0); }, TIMEOUT, @@ -194,7 +196,7 @@ describe('API Integration Tests', () => { test( 'handles server error', async () => { - await expect(errorClient.getBlockTime()).rejects.toThrow(); + await expect(invalidClient.getLatestBlockTime()).rejects.toThrow(); }, TIMEOUT, ); From c3e86a49fb1a2782bf881ccef470615ae8e36ae3 Mon Sep 17 00:00:00 2001 From: gmemez Date: Wed, 29 Jan 2025 19:51:00 +0700 Subject: [PATCH 3/3] address type --- src/index.ts | 2 +- src/schemas/inscription.ts | 49 -------------------------------- src/test/integration/api.test.ts | 8 +++--- 3 files changed, 5 insertions(+), 54 deletions(-) delete mode 100644 src/schemas/inscription.ts diff --git a/src/index.ts b/src/index.ts index 5953abb..1467bd3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -55,7 +55,7 @@ export class OrdClient { return result.data; } - async getAddress(address: string): Promise { + async getAddressInfo(address: string): Promise { return this.fetch(endpoints.address(address), AddressInfoSchema); } diff --git a/src/schemas/inscription.ts b/src/schemas/inscription.ts deleted file mode 100644 index f543bbb..0000000 --- a/src/schemas/inscription.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { z } from 'zod'; - -export const InscriptionContentSchema = z.object({ - body: z.string().optional(), - content_encoding: z.string().optional(), - content_length: z.number().optional(), - content_type: z.string(), -}); - -export const InscriptionSchema = z.object({ - address: z.string().optional(), - chain_stats: z.object({ - blocks_since_genesis: z.number(), - inscription_number: z.number(), - timestamp: z.number(), - }), - charms: z.array(z.string()), - content: InscriptionContentSchema, - content_length: z.number(), - content_type: z.string(), - genesis_fee: z.number().int().nonnegative(), - genesis_height: z.number(), - id: z.string(), - location: z.string(), - offset: z.number().optional(), - output: z.string(), - output_value: z.number().int().nonnegative(), - parent: z.string().optional(), - rune: z - .object({ - id: z.string(), - name: z.string(), - rune: z.string(), - supply: z.string(), - symbol: z.string().optional(), - timestamp: z.number(), - }) - .optional(), - sat: z.string().optional(), - timestamp: z.number(), -}); - -export const InscriptionIdSchema = z.string().regex(/^[0-9a-f]{64}i\d+$/); - -export const InscriptionsResponseSchema = z.object({ - inscriptions: z.array(InscriptionSchema), - page: z.number().optional(), - total_pages: z.number().optional(), -}); diff --git a/src/test/integration/api.test.ts b/src/test/integration/api.test.ts index f966ee6..1b70e8f 100644 --- a/src/test/integration/api.test.ts +++ b/src/test/integration/api.test.ts @@ -44,11 +44,11 @@ describe('API Integration Tests', () => { ); }); - describe('getAddress', () => { + describe('getAddressInfo', () => { test( 'fetches address info successfully', async () => { - const info = await client.getAddress(SAMPLE_ADDRESS); + const info = await client.getAddressInfo(SAMPLE_ADDRESS); expect(info).toEqual(SAMPLE_ADDRESS_INFO); }, TIMEOUT, @@ -57,7 +57,7 @@ describe('API Integration Tests', () => { test( 'rejects invalid address format', async () => { - await expect(client.getAddress('invalid-address')).rejects.toThrow(); + await expect(client.getAddressInfo('invalid-address')).rejects.toThrow(); }, TIMEOUT, ); @@ -66,7 +66,7 @@ describe('API Integration Tests', () => { 'handles server error', async () => { await expect( - invalidClient.getAddress(SAMPLE_ADDRESS), + invalidClient.getAddressInfo(SAMPLE_ADDRESS), ).rejects.toThrow(); }, TIMEOUT,