diff --git a/README.md b/README.md index 8af6d4e..e9db081 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Orion’s SDK is free to use and does not require an API key or registration. Re - [Orderbook stream](#orderbook-stream) - [Orion Aggregator WS Stream Unsubscribing](#orion-aggregator-ws-stream-unsubscribing) - [Price Feed Websocket Stream](#price-feed-websocket-stream) -- [About our fetching system](#about-our-fetching-system) +- [Data fetching](#data-fetching) - [Using contracts](#using-contracts) - [Utils](#utils) - [Parsing trade transactions](#parsing-trade-transactions) @@ -615,17 +615,7 @@ lastPriceSubscription.unsubscribe(); orionUnit.priceFeed.ws.unsubscribe("lastPrice", lastPriceSubscription.id); ``` -## About our fetching system - -Data fetching is often a pain. Network issue, fetching library errors, server errors, wrong response data. We want to be able to handle all these errors in a human way and be sure that we get the expected data. - -1. We overcome the limitations of exception handling (for example, in the `catch` block, the thrown exception can be anything) with [neverthrow](https://github.com/supermacro/neverthrow). -2. Predictability (validation) is provided to us by [zod](https://github.com/colinhacks/zod) - -We have two options for interacting with our services. - -1. [**Verbose**](./src/fetchWithValidation.ts). Provides a result object that can be successful or not. Provides data to handle fetching error: http code, http status, response body, response status and .etc) -2. [**Simple Fetch**](./src/simpleFetch.ts). Is a wrapper over a verbose way. Allows you to "just fetch" (perhaps as you usually do) +## Data fetching ```ts // Verbose way example diff --git a/package-lock.json b/package-lock.json index 726ac2f..adc4563 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,50 +1,50 @@ { "name": "@orionprotocol/sdk", - "version": "0.17.31", + "version": "0.17.38", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@orionprotocol/sdk", - "version": "0.17.31", + "version": "0.17.38", "license": "ISC", "dependencies": { "@babel/runtime": "^7.21.0", "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/providers": "^5.7.2", "@lukeed/csprng": "^1.0.1", - "@orionprotocol/contracts": "0.4.0", + "@orionprotocol/contracts": "0.5.0", "bignumber.js": "^9.1.1", "bson-objectid": "^2.0.4", "buffer": "^6.0.3", "crypto-browserify": "^3.12.0", "ethers": "^5.6.2", "express": "^4.18.2", - "isomorphic-unfetch": "^3.1.0", "isomorphic-ws": "^5.0.0", "just-clone": "^6.2.0", "merge-anything": "^5.1.4", "neverthrow": "^6.0.0", + "simple-typed-fetch": "^0.1.4", "stream-browserify": "^3.0.0", "tiny-invariant": "^1.3.1", "ts-is-present": "^1.2.2", "ts-node": "^10.9.1", "uuid": "^9.0.0", - "ws": "^8.12.1", + "ws": "^8.13.0", "zod": "3.21.4" }, "devDependencies": { - "@babel/core": "^7.21.0", + "@babel/core": "^7.21.3", "@tsconfig/strictest": "^1.0.2", "@types/express": "^4.17.17", - "@types/jest": "^29.4.0", - "@types/node": "^18.14.6", + "@types/jest": "^29.5.0", + "@types/node": "^18.15.6", "@types/node-fetch": "^2.6.2", "@types/socket.io-client": "1.4.33", "@types/uuid": "^9.0.1", "@types/ws": "^8.5.4", - "@typescript-eslint/eslint-plugin": "^5.54.1", - "@typescript-eslint/parser": "^5.54.1", + "@typescript-eslint/eslint-plugin": "^5.56.0", + "@typescript-eslint/parser": "^5.56.0", "babel-loader": "^9.1.2", "concurrently": "^7.6.0", "eslint": "^8.35.0", @@ -60,9 +60,12 @@ "jest": "^29.5.0", "ts-jest": "^29.0.5", "ts-loader": "^9.4.2", - "typescript": "^4.9.5", - "webpack": "^5.75.0", + "typescript": "^5.0.2", + "webpack": "^5.76.3", "webpack-cli": "^5.0.1" + }, + "engines": { + "node": ">=18.0.0" } }, "node_modules/@ampproject/remapping": { @@ -100,21 +103,21 @@ } }, "node_modules/@babel/core": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.0.tgz", - "integrity": "sha512-PuxUbxcW6ZYe656yL3EAhpy7qXKq0DmYsrJLpbB8XrsCP9Nm+XCg9XFMb5vIDliPD7+U/+M+QJlH17XOcB7eXA==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.21.3.tgz", + "integrity": "sha512-qIJONzoa/qiHghnm0l1n4i/6IIziDpzqc36FBs4pzMhDUraHqponwJLiAKm1hGLP3OSB/TVNz6rMwVGpwxxySw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.21.0", + "@babel/generator": "^7.21.3", "@babel/helper-compilation-targets": "^7.20.7", - "@babel/helper-module-transforms": "^7.21.0", + "@babel/helper-module-transforms": "^7.21.2", "@babel/helpers": "^7.21.0", - "@babel/parser": "^7.21.0", + "@babel/parser": "^7.21.3", "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.0", - "@babel/types": "^7.21.0", + "@babel/traverse": "^7.21.3", + "@babel/types": "^7.21.3", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -130,12 +133,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.21.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.1.tgz", - "integrity": "sha512-1lT45bAYlQhFn/BHivJs43AiW2rg3/UbLyShGfF3C0KmHvO5fSghWd5kBJy30kpRRucGzXStvnnCFniCR2kXAA==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.3.tgz", + "integrity": "sha512-QS3iR1GYC/YGUnW7IdggFeN5c1poPUurnGttOV/bZgPGV+izC/D8HnD6DLwod0fsatNyVn1G3EVWMYIF0nHbeA==", "dev": true, "dependencies": { - "@babel/types": "^7.21.0", + "@babel/types": "^7.21.3", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -346,9 +349,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.2.tgz", - "integrity": "sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.3.tgz", + "integrity": "sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -565,19 +568,19 @@ } }, "node_modules/@babel/traverse": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.2.tgz", - "integrity": "sha512-ts5FFU/dSUPS13tv8XiEObDu9K+iagEKME9kAbaP7r0Y9KtZJZ+NGndDvWoRAYNpeWafbpFeki3q9QoMD6gxyw==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.3.tgz", + "integrity": "sha512-XLyopNeaTancVitYZe2MlUEvgKb6YVVPXzofHgqHijCImG33b/uTurMS488ht/Hbsb2XK3U2BnSTxKVNGV3nGQ==", "dev": true, "dependencies": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.21.1", + "@babel/generator": "^7.21.3", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.21.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.2", - "@babel/types": "^7.21.2", + "@babel/parser": "^7.21.3", + "@babel/types": "^7.21.3", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -586,9 +589,9 @@ } }, "node_modules/@babel/types": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.2.tgz", - "integrity": "sha512-3wRZSs7jiFaB8AjxiiD+VqN5DTG2iRvJGQ+qYFrs/654lg6kGTQWIOFjlBo5RaXuAZjBmP3+OQH4dmhqiiyYxw==", + "version": "7.21.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.3.tgz", + "integrity": "sha512-sBGdETxC+/M4o/zKC0sl6sjWv62WFR/uzxrJ6uYyMLZOUlPnwzw0tKgVHOXxaAd5l2g8pEDM5RZ495GPQI77kg==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.19.4", @@ -635,9 +638,9 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz", - "integrity": "sha512-gB8T4H4DEfX2IV9zGDJPOBgP1e/DbfCPDTtEqUMckpvzS1OYtva8JdFYBqMwYk7xAQ429WGF/UPqn8uQ//h2vQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", "dev": true, "dependencies": { "eslint-visitor-keys": "^3.3.0" @@ -2326,9 +2329,9 @@ } }, "node_modules/@orionprotocol/contracts": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@orionprotocol/contracts/-/contracts-0.4.0.tgz", - "integrity": "sha512-n2/eOIcuS6TscnsZvZ5aV8d19WFJmuEoaP90iay9HIgVAXhJLvOaRkP4WPyKfniJCfIPIycF55Fr++SO42WXmQ==" + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@orionprotocol/contracts/-/contracts-0.5.0.tgz", + "integrity": "sha512-IxHNiS+ZV2GF8aGWjwxuU3QFsqxEoDsiObqLoaUlfSWHY+ljYZBX+LbC/9ytil0TBQtfAKpFYUWnO1+6vswnVw==" }, "node_modules/@sinclair/typebox": { "version": "0.25.23", @@ -2523,9 +2526,9 @@ } }, "node_modules/@types/jest": { - "version": "29.4.1", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.4.1.tgz", - "integrity": "sha512-zDQSWXG+ZkEvs2zFFMszePhx4euKz+Yt3Gg1P+RHjfJBinTTr6L2DEyovO4V/WrKXuF0Dgn56GWGZPDa6TW9eQ==", + "version": "29.5.0", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.0.tgz", + "integrity": "sha512-3Emr5VOl/aoBwnWcH/EFQvlSAmjV+XtV9GGu5mwdYew5vhQh0IUZx/60x0TzHDu09Bi7HMx10t/namdJw5QIcg==", "dev": true, "dependencies": { "expect": "^29.0.0", @@ -2551,9 +2554,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.14.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.6.tgz", - "integrity": "sha512-93+VvleD3mXwlLI/xASjw0FzKcwzl3OdTCzm1LaRfqgS21gfFtK3zDXM5Op9TeeMsJVOaJ2VRDpT9q4Y3d0AvA==" + "version": "18.15.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.7.tgz", + "integrity": "sha512-LFmUbFunqmBn26wJZgZPYZPrDR1RwGOu2v79Mgcka1ndO6V0/cwjivPTc4yoK6n9kmw4/ls1r8cLrvh2iMibFA==" }, "node_modules/@types/node-fetch": { "version": "2.6.2", @@ -2642,15 +2645,15 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.55.0.tgz", - "integrity": "sha512-IZGc50rtbjk+xp5YQoJvmMPmJEYoC53SiKPXyqWfv15XoD2Y5Kju6zN0DwlmaGJp1Iw33JsWJcQ7nw0lGCGjVg==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.56.0.tgz", + "integrity": "sha512-ZNW37Ccl3oMZkzxrYDUX4o7cnuPgU+YrcaYXzsRtLB16I1FR5SHMqga3zGsaSliZADCWo2v8qHWqAYIj8nWCCg==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.55.0", - "@typescript-eslint/type-utils": "5.55.0", - "@typescript-eslint/utils": "5.55.0", + "@typescript-eslint/scope-manager": "5.56.0", + "@typescript-eslint/type-utils": "5.56.0", + "@typescript-eslint/utils": "5.56.0", "debug": "^4.3.4", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", @@ -2675,53 +2678,6 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.55.0.tgz", - "integrity": "sha512-OK+cIO1ZGhJYNCL//a3ROpsd83psf4dUJ4j7pdNVzd5DmIk+ffkuUIX2vcZQbEW/IR41DYsfJTB19tpCboxQuw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/visitor-keys": "5.55.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", - "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", - "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -2738,14 +2694,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.55.0.tgz", - "integrity": "sha512-ppvmeF7hvdhUUZWSd2EEWfzcFkjJzgNQzVST22nzg958CR+sphy8A6K7LXQZd6V75m1VKjp+J4g/PCEfSCmzhw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.56.0.tgz", + "integrity": "sha512-sn1OZmBxUsgxMmR8a8U5QM/Wl+tyqlH//jTqCg8daTAmhAk26L2PFhcqPLlYBhYUJMZJK276qLXlHN3a83o2cg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.55.0", - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/typescript-estree": "5.55.0", + "@typescript-eslint/scope-manager": "5.56.0", + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/typescript-estree": "5.56.0", "debug": "^4.3.4" }, "engines": { @@ -2764,103 +2720,14 @@ } } }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.55.0.tgz", - "integrity": "sha512-OK+cIO1ZGhJYNCL//a3ROpsd83psf4dUJ4j7pdNVzd5DmIk+ffkuUIX2vcZQbEW/IR41DYsfJTB19tpCboxQuw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/visitor-keys": "5.55.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", - "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz", - "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/visitor-keys": "5.55.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", - "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/parser/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.54.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.1.tgz", - "integrity": "sha512-zWKuGliXxvuxyM71UA/EcPxaviw39dB2504LqAmFDjmkpO8qNLHcmzlh6pbHs1h/7YQ9bnsO8CCcYCSA8sykUg==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.56.0.tgz", + "integrity": "sha512-jGYKyt+iBakD0SA5Ww8vFqGpoV2asSjwt60Gl6YcO8ksQ8s2HlUEyHBMSa38bdLopYqGf7EYQMUIGdT/Luw+sw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.54.1", - "@typescript-eslint/visitor-keys": "5.54.1" + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/visitor-keys": "5.56.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2871,13 +2738,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.55.0.tgz", - "integrity": "sha512-ObqxBgHIXj8rBNm0yh8oORFrICcJuZPZTqtAFh0oZQyr5DnAHZWfyw54RwpEEH+fD8suZaI0YxvWu5tYE/WswA==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.56.0.tgz", + "integrity": "sha512-8WxgOgJjWRy6m4xg9KoSHPzBNZeQbGlQOH7l2QEhQID/+YseaFxg5J/DLwWSsi9Axj4e/cCiKx7PVzOq38tY4A==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.55.0", - "@typescript-eslint/utils": "5.55.0", + "@typescript-eslint/typescript-estree": "5.56.0", + "@typescript-eslint/utils": "5.56.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, @@ -2897,82 +2764,10 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", - "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz", - "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/visitor-keys": "5.55.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", - "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@typescript-eslint/types": { - "version": "5.54.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.1.tgz", - "integrity": "sha512-G9+1vVazrfAfbtmCapJX8jRo2E4MDXxgm/IMOF4oGh3kq7XuK3JRkOg6y2Qu1VsTRmWETyTkWt1wxy7X7/yLkw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.56.0.tgz", + "integrity": "sha512-JyAzbTJcIyhuUhogmiu+t79AkdnqgPUEsxMTMc/dCZczGMJQh1MK2wgrju++yMN6AWroVAy2jxyPcPr3SWCq5w==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2983,13 +2778,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.54.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.1.tgz", - "integrity": "sha512-bjK5t+S6ffHnVwA0qRPTZrxKSaFYocwFIkZx5k7pvWfsB1I57pO/0M0Skatzzw1sCkjJ83AfGTL0oFIFiDX3bg==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.56.0.tgz", + "integrity": "sha512-41CH/GncsLXOJi0jb74SnC7jVPWeVJ0pxQj8bOjH1h2O26jXN3YHKDT1ejkVz5YeTEQPeLCCRY0U2r68tfNOcg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.54.1", - "@typescript-eslint/visitor-keys": "5.54.1", + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/visitor-keys": "5.56.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -3025,17 +2820,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.55.0.tgz", - "integrity": "sha512-FkW+i2pQKcpDC3AY6DU54yl8Lfl14FVGYDgBTyGKB75cCwV3KpkpTMFi9d9j2WAJ4271LR2HeC5SEWF/CZmmfw==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.56.0.tgz", + "integrity": "sha512-XhZDVdLnUJNtbzaJeDSCIYaM+Tgr59gZGbFuELgF7m0IY03PlciidS7UQNKLE0+WpUTn1GlycEr6Ivb/afjbhA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.55.0", - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/typescript-estree": "5.55.0", + "@typescript-eslint/scope-manager": "5.56.0", + "@typescript-eslint/types": "5.56.0", + "@typescript-eslint/typescript-estree": "5.56.0", "eslint-scope": "^5.1.1", "semver": "^7.3.7" }, @@ -3050,80 +2845,6 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.55.0.tgz", - "integrity": "sha512-OK+cIO1ZGhJYNCL//a3ROpsd83psf4dUJ4j7pdNVzd5DmIk+ffkuUIX2vcZQbEW/IR41DYsfJTB19tpCboxQuw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/visitor-keys": "5.55.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.55.0.tgz", - "integrity": "sha512-M4iRh4AG1ChrOL6Y+mETEKGeDnT7Sparn6fhZ5LtVJF1909D5O4uqK+C5NPbLmpfZ0XIIxCdwzKiijpZUOvOug==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.55.0.tgz", - "integrity": "sha512-I7X4A9ovA8gdpWMpr7b1BN9eEbvlEtWhQvpxp/yogt48fy9Lj3iE3ild/1H3jKBBIYj5YYJmS2+9ystVhC7eaQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "@typescript-eslint/visitor-keys": "5.55.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.55.0.tgz", - "integrity": "sha512-q2dlHHwWgirKh1D3acnuApXG+VNXpEY5/AwRxDVuEQpxWaB0jCDe0jFMVMALJ3ebSfuOVE8/rMS+9ZOYGg1GWw==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.55.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/utils/node_modules/semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -3140,12 +2861,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.54.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.1.tgz", - "integrity": "sha512-q8iSoHTgwCfgcRJ2l2x+xCbu8nBlRAlsQ33k24Adj8eoVBE0f8dUeI+bAa8F84Mv05UGbAx57g2zrRsYIooqQg==", + "version": "5.56.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.56.0.tgz", + "integrity": "sha512-1mFdED7u5bZpX6Xxf5N9U2c18sb+8EvU3tyOIj6LQZ5OOvnmj8BVeNNP603OFPm5KkS1a7IvCIcwrdHXaEMG/Q==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.54.1", + "@typescript-eslint/types": "5.56.0", "eslint-visitor-keys": "^3.3.0" }, "engines": { @@ -4534,6 +4255,14 @@ "node": "*" } }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "engines": { + "node": ">= 12" + } + }, "node_modules/date-fns": { "version": "2.29.3", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", @@ -5752,6 +5481,28 @@ "bser": "2.1.1" } }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -5872,6 +5623,17 @@ "node": ">= 6" } }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -6691,15 +6453,6 @@ "node": ">=0.10.0" } }, - "node_modules/isomorphic-unfetch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz", - "integrity": "sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==", - "dependencies": { - "node-fetch": "^2.6.1", - "unfetch": "^4.2.0" - } - }, "node_modules/isomorphic-ws": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", @@ -8827,23 +8580,22 @@ "resolved": "https://registry.npmjs.org/neverthrow/-/neverthrow-6.0.0.tgz", "integrity": "sha512-kPZKRs4VkdloCGQXPoP84q4sT/1Z+lYM61AXyV8wWa2hnuo5KpPBF2S3crSFnMrOgUISmEBP8Vo/ngGZX60NhA==" }, - "node_modules/node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" } + ], + "engines": { + "node": ">=10.5.0" } }, "node_modules/node-int64": { @@ -9936,6 +9688,47 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/simple-typed-fetch": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/simple-typed-fetch/-/simple-typed-fetch-0.1.4.tgz", + "integrity": "sha512-8rZej+msT/VUdrN+j3HUmfrudOfTYfgrqZ9EuuyGifSGtUdVzmYP4IhXRNxDvEl2VF6oGi36SPYiWLdZHPQhZg==", + "dependencies": { + "isomorphic-unfetch": "^4.0.2", + "neverthrow": "^6.0.0", + "zod": "^3.21.4" + } + }, + "node_modules/simple-typed-fetch/node_modules/isomorphic-unfetch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/isomorphic-unfetch/-/isomorphic-unfetch-4.0.2.tgz", + "integrity": "sha512-1Yd+CF/7al18/N2BDbsLBcp6RO3tucSW+jcLq24dqdX5MNbCNTw1z4BsGsp4zNmjr/Izm2cs/cEqZPp4kvWSCA==", + "dependencies": { + "node-fetch": "^3.2.0", + "unfetch": "^5.0.0" + } + }, + "node_modules/simple-typed-fetch/node_modules/node-fetch": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.1.tgz", + "integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/simple-typed-fetch/node_modules/unfetch": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-5.0.0.tgz", + "integrity": "sha512-3xM2c89siXg0nHvlmYsQ2zkLASvVMBisZm5lF3gFDqfF2xonNStDJyMpvaOBe0a1Edxmqrf2E0HBdmy9QyZaeg==" + }, "node_modules/sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -10304,11 +10097,6 @@ "node": ">=0.6" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", @@ -10633,15 +10421,15 @@ } }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", + "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=12.20" } }, "node_modules/unbox-primitive": { @@ -10659,11 +10447,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/unfetch": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/unfetch/-/unfetch-4.2.0.tgz", - "integrity": "sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==" - }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -10777,15 +10560,18 @@ "node": ">=10.13.0" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "node_modules/web-streams-polyfill": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "engines": { + "node": ">= 8" + } }, "node_modules/webpack": { - "version": "5.76.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.0.tgz", - "integrity": "sha512-l5sOdYBDunyf72HW8dF23rFtWq/7Zgvt/9ftMof71E/yUb1YLOBmTgA2K4vQthB3kotMrSj609txVE0dnr2fjA==", + "version": "5.76.3", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.3.tgz", + "integrity": "sha512-18Qv7uGPU8b2vqGeEEObnfICyw2g39CHlDEK4I7NK13LOur1d0HGmGNKGT58Eluwddpn3oEejwvBPoP4M7/KSA==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.3", @@ -10923,15 +10709,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -11048,9 +10825,9 @@ } }, "node_modules/ws": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.12.1.tgz", - "integrity": "sha512-1qo+M9Ba+xNhPB+YTWUlK6M17brTut5EXbcBaMRN5pH5dFrXz7lzz1ChFSUq3bOUl8yEvSenhHmYUNJxFzdJew==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "engines": { "node": ">=10.0.0" }, diff --git a/package.json b/package.json index 6490fd0..7b86b70 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,13 @@ { "name": "@orionprotocol/sdk", - "version": "0.17.37", + "version": "0.17.38", "description": "Orion Protocol SDK", "main": "./lib/esm/index.js", "module": "./lib/esm/index.js", "types": "./lib/esm/index.d.ts", + "engines": { + "node": ">=18.0.0" + }, "scripts": { "start": "npm run build && node lib/esm/index.js", "develop": "concurrently -i -k -p \"[{name}]\" -n \"Node,TypeScript\" -c \"yellow.bold,cyan.bold\" \"yarn watch-js\" \"yarn watch-ts\"", @@ -39,17 +42,17 @@ "url": "https://github.com/orionprotocol/sdk/issues" }, "devDependencies": { + "@babel/core": "^7.21.3", "@tsconfig/strictest": "^1.0.2", "@types/express": "^4.17.17", - "@types/jest": "^29.4.0", - "@types/node": "^18.14.6", + "@types/jest": "^29.5.0", + "@types/node": "^18.15.6", "@types/node-fetch": "^2.6.2", "@types/socket.io-client": "1.4.33", "@types/uuid": "^9.0.1", "@types/ws": "^8.5.4", - "@typescript-eslint/eslint-plugin": "^5.54.1", - "@typescript-eslint/parser": "^5.54.1", - "@babel/core": "^7.21.0", + "@typescript-eslint/eslint-plugin": "^5.56.0", + "@typescript-eslint/parser": "^5.56.0", "babel-loader": "^9.1.2", "concurrently": "^7.6.0", "eslint": "^8.35.0", @@ -65,8 +68,8 @@ "jest": "^29.5.0", "ts-jest": "^29.0.5", "ts-loader": "^9.4.2", - "typescript": "^4.9.5", - "webpack": "^5.75.0", + "typescript": "^5.0.2", + "webpack": "^5.76.3", "webpack-cli": "^5.0.1" }, "dependencies": { @@ -74,24 +77,24 @@ "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/providers": "^5.7.2", "@lukeed/csprng": "^1.0.1", - "@orionprotocol/contracts": "0.4.0", + "@orionprotocol/contracts": "0.5.0", "bignumber.js": "^9.1.1", "bson-objectid": "^2.0.4", "buffer": "^6.0.3", "crypto-browserify": "^3.12.0", "ethers": "^5.6.2", "express": "^4.18.2", - "isomorphic-unfetch": "^3.1.0", "isomorphic-ws": "^5.0.0", "just-clone": "^6.2.0", "merge-anything": "^5.1.4", "neverthrow": "^6.0.0", + "simple-typed-fetch": "^0.1.4", "stream-browserify": "^3.0.0", "tiny-invariant": "^1.3.1", "ts-is-present": "^1.2.2", "ts-node": "^10.9.1", "uuid": "^9.0.0", - "ws": "^8.12.1", + "ws": "^8.13.0", "zod": "3.21.4" }, "homepage": "https://github.com/orionprotocol/sdk#readme", diff --git a/src/Orion/bridge/getHistory.ts b/src/Orion/bridge/getHistory.ts index fffe0de..34396b3 100644 --- a/src/Orion/bridge/getHistory.ts +++ b/src/Orion/bridge/getHistory.ts @@ -1,9 +1,9 @@ import { ethers } from 'ethers'; import type OrionUnit from '../../OrionUnit'; -import simpleFetch from '../../simpleFetch'; import type { SupportedChainId } from '../../types'; import { isValidChainId } from '../../utils'; import ObjectID from 'bson-objectid'; +import { simpleFetch } from 'simple-typed-fetch'; const getHistory = async (units: OrionUnit[], address: string, limit = 1000) => { if (!ethers.utils.isAddress(address)) throw new Error(`Invalid address: ${address}`); diff --git a/src/Orion/bridge/swap.ts b/src/Orion/bridge/swap.ts index 502b72e..9633234 100644 --- a/src/Orion/bridge/swap.ts +++ b/src/Orion/bridge/swap.ts @@ -12,12 +12,12 @@ import { WITHDRAW_GAS_LIMIT } from '../../constants'; import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency'; -import simpleFetch from '../../simpleFetch'; import { denormalizeNumber, generateSecret, normalizeNumber, toUpperCase } from '../../utils'; import type { SupportedChainId } from '../../types'; import type Orion from '..'; import type { z } from 'zod'; import type { placeAtomicSwapSchema } from '../../services/OrionAggregator/schemas'; +import { simpleFetch } from 'simple-typed-fetch'; type Params = { assetName: string diff --git a/src/Orion/index.ts b/src/Orion/index.ts index 72439ea..bd3c0b3 100644 --- a/src/Orion/index.ts +++ b/src/Orion/index.ts @@ -5,11 +5,11 @@ import { chains, envs } from '../config'; import type { networkCodes } from '../constants'; import OrionUnit from '../OrionUnit'; import { ReferralSystem } from '../services/ReferralSystem'; -import simpleFetch from '../simpleFetch'; import type { SupportedChainId, DeepPartial, VerboseOrionUnitConfig, KnownEnv } from '../types'; import { isValidChainId } from '../utils'; import swap from './bridge/swap'; import getHistory from './bridge/getHistory'; +import { simpleFetch } from 'simple-typed-fetch'; type EnvConfig = { analyticsAPI: string diff --git a/src/OrionUnit/Exchange/deposit.ts b/src/OrionUnit/Exchange/deposit.ts index ed1c1db..1ded4f4 100644 --- a/src/OrionUnit/Exchange/deposit.ts +++ b/src/OrionUnit/Exchange/deposit.ts @@ -9,7 +9,7 @@ import { } from '../../constants'; import { denormalizeNumber, normalizeNumber } from '../../utils'; import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency'; -import simpleFetch from '../../simpleFetch'; +import { simpleFetch } from 'simple-typed-fetch'; export type DepositParams = { asset: string diff --git a/src/OrionUnit/Exchange/getSwapInfo.ts b/src/OrionUnit/Exchange/getSwapInfo.ts index 0d1e13f..4eec736 100644 --- a/src/OrionUnit/Exchange/getSwapInfo.ts +++ b/src/OrionUnit/Exchange/getSwapInfo.ts @@ -1,10 +1,10 @@ import BigNumber from 'bignumber.js'; import { ethers } from 'ethers'; +import { simpleFetch } from 'simple-typed-fetch'; import { NATIVE_CURRENCY_PRECISION, SWAP_THROUGH_ORION_POOL_GAS_LIMIT } from '../../constants'; import type { OrionAggregator } from '../../services/OrionAggregator'; import type { OrionBlockchain } from '../../services/OrionBlockchain'; -import simpleFetch from '../../simpleFetch'; import { calculateFeeInFeeAsset, denormalizeNumber, getNativeCryptocurrency } from '../../utils'; export type GetSwapInfoParams = { diff --git a/src/OrionUnit/Exchange/swapLimit.ts b/src/OrionUnit/Exchange/swapLimit.ts index b504f17..bba6e23 100644 --- a/src/OrionUnit/Exchange/swapLimit.ts +++ b/src/OrionUnit/Exchange/swapLimit.ts @@ -7,11 +7,11 @@ import getAvailableSources from '../../utils/getAvailableFundsSources'; import type OrionUnit from '..'; import { INTERNAL_ORION_PRECISION, NATIVE_CURRENCY_PRECISION, SWAP_THROUGH_ORION_POOL_GAS_LIMIT } from '../../constants'; import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency'; -import simpleFetch from '../../simpleFetch'; import { calculateFeeInFeeAsset, denormalizeNumber, normalizeNumber } from '../../utils'; import { signOrder } from '../../crypt'; import type orderSchema from '../../services/OrionAggregator/schemas/orderSchema'; import type { z } from 'zod'; +import { simpleFetch } from 'simple-typed-fetch'; export type SwapLimitParams = { type: 'exactSpend' | 'exactReceive' diff --git a/src/OrionUnit/Exchange/swapMarket.ts b/src/OrionUnit/Exchange/swapMarket.ts index 92755ea..23f47a7 100644 --- a/src/OrionUnit/Exchange/swapMarket.ts +++ b/src/OrionUnit/Exchange/swapMarket.ts @@ -6,12 +6,12 @@ import BalanceGuard from '../../BalanceGuard'; import getAvailableSources from '../../utils/getAvailableFundsSources'; import { INTERNAL_ORION_PRECISION, NATIVE_CURRENCY_PRECISION, SWAP_THROUGH_ORION_POOL_GAS_LIMIT } from '../../constants'; import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency'; -import simpleFetch from '../../simpleFetch'; import { calculateFeeInFeeAsset, denormalizeNumber, normalizeNumber } from '../../utils'; import { signOrder } from '../../crypt'; import type orderSchema from '../../services/OrionAggregator/schemas/orderSchema'; import type { z } from 'zod'; import type { SwapLimitParams } from './swapLimit'; +import { simpleFetch } from 'simple-typed-fetch'; export type SwapMarketParams = Omit & { slippagePercent: BigNumber.Value diff --git a/src/OrionUnit/Exchange/withdraw.ts b/src/OrionUnit/Exchange/withdraw.ts index 014ff65..459d16b 100644 --- a/src/OrionUnit/Exchange/withdraw.ts +++ b/src/OrionUnit/Exchange/withdraw.ts @@ -9,7 +9,7 @@ import { } from '../../constants'; import { denormalizeNumber, normalizeNumber } from '../../utils'; import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency'; -import simpleFetch from '../../simpleFetch'; +import { simpleFetch } from 'simple-typed-fetch'; export type WithdrawParams = { asset: string diff --git a/src/OrionUnit/FarmingManager/index.ts b/src/OrionUnit/FarmingManager/index.ts index 5f51345..311e6cd 100644 --- a/src/OrionUnit/FarmingManager/index.ts +++ b/src/OrionUnit/FarmingManager/index.ts @@ -1,10 +1,10 @@ import { Exchange__factory, IUniswapV2Pair__factory, IUniswapV2Router__factory } from '@orionprotocol/contracts'; import BigNumber from 'bignumber.js'; import { ethers } from 'ethers'; +import { simpleFetch } from 'simple-typed-fetch'; import type OrionUnit from '..'; import BalanceGuard from '../../BalanceGuard'; import { ADD_LIQUIDITY_GAS_LIMIT, INTERNAL_ORION_PRECISION, NATIVE_CURRENCY_PRECISION } from '../../constants'; -import simpleFetch from '../../simpleFetch'; import { denormalizeNumber, normalizeNumber } from '../../utils'; import getBalances from '../../utils/getBalances'; import getNativeCryptocurrency from '../../utils/getNativeCryptocurrency'; diff --git a/src/__tests__/basic.test.ts b/src/__tests__/basic.test.ts index 6672965..c207cf1 100644 --- a/src/__tests__/basic.test.ts +++ b/src/__tests__/basic.test.ts @@ -1,6 +1,5 @@ import Orion from '../Orion'; import { ReferralSystem } from '../services/ReferralSystem'; -import simpleFetch from '../simpleFetch'; import { SupportedChainId } from '../types'; import express from 'express'; import WebSocket from 'ws'; @@ -10,6 +9,7 @@ import { createHttpTerminator, } from 'http-terminator'; import { ethers } from 'ethers'; +import { simpleFetch } from 'simple-typed-fetch'; jest.setTimeout(10000); diff --git a/src/fetchWithValidation.ts b/src/fetchWithValidation.ts deleted file mode 100644 index f0b227b..0000000 --- a/src/fetchWithValidation.ts +++ /dev/null @@ -1,154 +0,0 @@ -import type { Schema, z } from 'zod'; -import fetch from 'isomorphic-unfetch'; - -import { - err, fromPromise, fromThrowable, ok, -} from 'neverthrow'; - -export default async function fetchWithValidation( - url: string, - schema: Schema, - options?: RequestInit, - errorSchema?: Schema, -) { - // Cases: - // fetchError (no network, connection refused, connection break) - // unknownFetchThrow - // unknownGetTextError - // unknownGetTextUnknownError - // serverError - // jsonParseError - // jsonParseUnknownError - // clientErrorWithResponsePayload - // clientErrorPayloadParseError - // clientError - // payloadParseError - // payload - - const fetchResult = await fromPromise(fetch(url, { - ...options ?? {}, - headers: { - 'Cache-Control': 'no-store, max-age=0', - ...(options ? options.headers : {}), - }, - }), (e) => { - if (e instanceof Error) { - return err({ - type: 'fetchError' as const, - url, - message: e.message, - error: e, - }); - } - return err({ - type: 'unknownFetchThrow' as const, - url, - message: 'Unknown fetch error', - error: e, - }); - }); - - if (fetchResult.isErr()) return fetchResult.error; - - const response = fetchResult.value; - - const textResult = await fromPromise(response.text(), (e) => { - if (e instanceof Error) { - return err({ - type: 'unknownGetTextError' as const, - url, - message: `Can't get response content: ${e.message}`, - error: e, - }); - } - return err({ - type: 'unknownGetTextUnknownError' as const, - url, - message: "Can't get response content: unknown error", - error: e, - }); - }); - - if (textResult.isErr()) return textResult.error; - - const text = textResult.value; - - if (response.status >= 500) { // Server error - return err({ - type: 'serverError' as const, - url, - message: `Server error: ${response.status} ${response.statusText}`, - status: response.status, - text, - }); - } - - const safeParseJson = fromThrowable(JSON.parse, (e) => { - if (e instanceof Error) { - return err({ - type: 'jsonParseError' as const, - url, - message: e.message, - error: e, - }); - } - return err({ - type: 'jsonParseUnknownError' as const, - url, - message: 'Unknown JSON parse error', - error: e, - }); - }); - - const jsonResult = safeParseJson(text); - - if (jsonResult.isErr()) { - const textPayload = schema.safeParse(text); - if (textPayload.success) return ok(textPayload.data); - return jsonResult.error; - } - - const json: unknown = jsonResult.value; - - if (response.status >= 400) { // Client error - if (errorSchema) { - const serverError = errorSchema.safeParse(json); - if (serverError.success) { - return err({ - type: 'clientErrorWithResponsePayload' as const, - url, - message: `Client error: ${response.status} ${response.statusText}. Server error: ${JSON.stringify(serverError.data)}`, - status: response.status, - payload: serverError.data, - }); - } - return err({ - type: 'clientErrorPayloadParseError' as const, - url, - message: 'Can\'t recognize error message. Response: ' + text, - status: response.status, - text, - error: serverError.error, - }); - } - return err({ - type: 'clientError' as const, - url, - message: `Error: ${response.status} ${response.statusText}. Response: ${text}`, - status: response.status, - text, - }); - } - - const payload = schema.safeParse(json); - if (!payload.success) { - const issuesMessages = payload.error.issues.map((issue) => `[${issue.path.join('.')}] ${issue.message}`).join(', '); - return err({ - type: 'payloadParseError' as const, - url, - message: `Can't recognize response payload: ${issuesMessages}`, - error: payload.error, - }); - } - return ok(payload.data); -} diff --git a/src/index.ts b/src/index.ts index 0945827..4a09da8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,15 +1,14 @@ import BigNumber from 'bignumber.js'; - +import { simpleFetch, fetchWithValidation } from 'simple-typed-fetch'; BigNumber.config({ EXPONENTIAL_AT: 1e+9 }); export * as config from './config'; export { default as OrionUnit } from './OrionUnit'; export { default as Orion } from './Orion'; export { default as initOrionUnit } from './initOrionUnit'; -export { default as fetchWithValidation } from './fetchWithValidation'; -export { default as simpleFetch } from './simpleFetch'; export * as utils from './utils'; export * as services from './services'; export * as crypt from './crypt'; export * from './constants'; export * from './types'; +export { simpleFetch, fetchWithValidation }; diff --git a/src/services/OrionAggregator/index.ts b/src/services/OrionAggregator/index.ts index 374b720..2f8f38f 100644 --- a/src/services/OrionAggregator/index.ts +++ b/src/services/OrionAggregator/index.ts @@ -1,6 +1,5 @@ import type BigNumber from 'bignumber.js'; import { z } from 'zod'; -import fetchWithValidation from '../../fetchWithValidation'; import swapInfoSchema from './schemas/swapInfoSchema'; import exchangeInfoSchema from './schemas/exchangeInfoSchema'; import cancelOrderSchema from './schemas/cancelOrderSchema'; @@ -20,6 +19,7 @@ import httpToWS from '../../utils/httpToWS'; import { ethers } from 'ethers'; import orderSchema from './schemas/orderSchema'; import { exchanges } from '../../constants'; +import { fetchWithValidation } from 'simple-typed-fetch'; class OrionAggregator { private readonly apiUrl: string; diff --git a/src/services/OrionBlockchain/index.ts b/src/services/OrionBlockchain/index.ts index 0c5db43..b48974f 100644 --- a/src/services/OrionBlockchain/index.ts +++ b/src/services/OrionBlockchain/index.ts @@ -1,5 +1,4 @@ import { z } from 'zod'; -import fetchWithValidation from '../../fetchWithValidation'; import { IDOSchema, atomicHistorySchema, poolsConfigSchema, poolsInfoSchema, infoSchema, historySchema, @@ -18,6 +17,7 @@ import type redeemOrderSchema from '../OrionAggregator/schemas/redeemOrderSchema import { sourceAtomicHistorySchema, targetAtomicHistorySchema } from './schemas/atomicHistorySchema'; import { makePartial } from '../../utils'; import type { networkCodes } from '../../constants'; +import { fetchWithValidation } from 'simple-typed-fetch'; type IAdminAuthHeaders = { auth: string diff --git a/src/services/PriceFeed/index.ts b/src/services/PriceFeed/index.ts index ffd6dca..61f74a5 100644 --- a/src/services/PriceFeed/index.ts +++ b/src/services/PriceFeed/index.ts @@ -1,4 +1,4 @@ -import fetchWithValidation from '../../fetchWithValidation'; +import { fetchWithValidation } from 'simple-typed-fetch'; import type { Exchange } from '../../types'; import { statisticsOverviewSchema, topPairsStatisticsSchema } from './schemas'; import candlesSchema from './schemas/candlesSchema'; diff --git a/src/services/ReferralSystem/index.ts b/src/services/ReferralSystem/index.ts index 8da976c..79aaa8a 100644 --- a/src/services/ReferralSystem/index.ts +++ b/src/services/ReferralSystem/index.ts @@ -1,4 +1,4 @@ -import fetchWithValidation from '../../fetchWithValidation'; +import { fetchWithValidation } from 'simple-typed-fetch'; import { errorSchema, miniStatsSchema, diff --git a/src/simpleFetch.ts b/src/simpleFetch.ts deleted file mode 100644 index aa63e01..0000000 --- a/src/simpleFetch.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { Schema, z } from 'zod'; -import fetchWithValidation from './fetchWithValidation'; - -// https://stackoverflow.com/a/64919133 -class Wrapper { - // eslint-disable-next-line class-methods-use-this - wrapped( - url: string, - schema: Schema, - options?: RequestInit, - errorSchema?: Schema, - ) { - return fetchWithValidation(url, schema, options, errorSchema); - } -} - -type FetchWithValidationInternalType = ReturnType['wrapped']> - -export default function simpleFetch( - f: (...params: P) => FetchWithValidationInternalType, -) { - return async (...params: Parameters) => { - const result = await f(...params); - if (result.isErr()) { - const { message, url } = result.error; - throw new Error(`${message} (${url})`); - } - return result.value; - }; -} diff --git a/tsconfig.json b/tsconfig.json index 2a50607..eb40d19 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -102,6 +102,7 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "noUncheckedIndexedAccess": true, - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true, /* Skip type checking all .d.ts files. */ + "importsNotUsedAsValues": null } } \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 715cd18..486c445 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -6,6 +6,22 @@ module.exports = (env, argv) => { entry: { index: path.resolve(__dirname, "./lib/esm/index.js") }, + externals: [ + 'node:util', + 'node:zlib', + 'node:url', + 'node:stream', + 'node:stream/web', + 'node:process', + 'node:path', + 'node:net', + 'node:http', + 'node:https', + 'node:fs', + 'node:buffer', + 'worker_threads', + 'unfetch' + ], output: { path: path.resolve(__dirname, "./lib/umd"), // builds to ./lib/umd/ filename: "[name].js", // index.js @@ -17,6 +33,7 @@ module.exports = (env, argv) => { rules: [{ test: /\.t|js$/, use: "babel-loader" }] }, resolve: { + extensions: ['.ts', '.js'], fallback: { "crypto": require.resolve("crypto-browserify"), "buffer": require.resolve("buffer/"),