@api3/commons 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -59
- package/dist/blockchain-utilities/derivation.d.ts +3 -0
- package/dist/blockchain-utilities/derivation.d.ts.map +1 -1
- package/dist/blockchain-utilities/derivation.js +19 -1
- package/dist/blockchain-utilities/derivation.js.map +1 -1
- package/dist/blockchain-utilities/schema.js.map +1 -1
- package/dist/config-hash/index.js.map +1 -1
- package/dist/eslint/jest.js +7 -7
- package/dist/eslint/jest.js.map +1 -1
- package/dist/eslint/next-js.js +1 -1
- package/dist/eslint/next-js.js.map +1 -1
- package/dist/eslint/react.js +10 -10
- package/dist/eslint/react.js.map +1 -1
- package/dist/eslint/universal.js +60 -60
- package/dist/eslint/universal.js.map +1 -1
- package/dist/http/index.d.ts +4 -2
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +10 -5
- package/dist/http/index.js.map +1 -1
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +9 -1
- package/dist/logger/index.js.map +1 -1
- package/dist/processing/processing.js.map +1 -1
- package/dist/processing/unsafe-evaluate.js.map +1 -1
- package/dist/processing/vm-timers.js.map +1 -1
- package/package.json +21 -17
- package/src/blockchain-utilities/derivation.test.ts +153 -81
- package/src/blockchain-utilities/derivation.ts +23 -0
- package/src/http/index.test.ts +4 -6
- package/src/http/index.ts +14 -6
- package/src/logger/index.test.ts +94 -83
- package/src/logger/index.ts +9 -1
package/README.md
CHANGED
|
@@ -8,23 +8,16 @@ duplication. The package is cross platform and can be used in Node.js and browse
|
|
|
8
8
|
|
|
9
9
|
The commons library is a collection of multiple modules, with each module having its own README that you can refer to.
|
|
10
10
|
|
|
11
|
-
## Related repositories
|
|
12
|
-
|
|
13
|
-
- [promise-utils](https://github.com/api3dao/promise-utils)
|
|
14
|
-
- [ois](https://github.com/api3dao/ois)
|
|
15
|
-
- [chains](https://github.com/api3dao/chains)
|
|
16
|
-
- [contracts](https://github.com/api3dao/contracts)
|
|
17
|
-
|
|
18
11
|
## Getting started
|
|
19
12
|
|
|
20
13
|
```sh
|
|
21
14
|
# Feel free to use your favorite package manager
|
|
22
|
-
pnpm
|
|
15
|
+
pnpm i @api3/commons
|
|
23
16
|
```
|
|
24
17
|
|
|
25
18
|
Read the documentation and sources of each module how to use it in the project.
|
|
26
19
|
|
|
27
|
-
|
|
20
|
+
## Modules
|
|
28
21
|
|
|
29
22
|
- [blockchain-utilities](./src/blockchain-utilities/README.md)
|
|
30
23
|
- [config-hash](./src/config-hash/README.md)
|
|
@@ -51,56 +44,13 @@ manually, by adding the following to your `tsconfig.json`:
|
|
|
51
44
|
}
|
|
52
45
|
```
|
|
53
46
|
|
|
54
|
-
##
|
|
55
|
-
|
|
56
|
-
To release a new version follow these steps:
|
|
57
|
-
|
|
58
|
-
1. `git checkout main && git pull` - Always publish from up to date `main` branch. Also, ensure that the working
|
|
59
|
-
directory is clean (has no uncommitted changes).
|
|
60
|
-
2. `pnpm version [major|minor|patch]` - Choose the right version bump. This will bump the version, create a git tag and
|
|
61
|
-
commit it.
|
|
62
|
-
3. `pnpm publish --access public` - Build the package and publish the new version to NPM.
|
|
63
|
-
4. `git push --follow-tags` - Push the tagged commit upstream. If you don't have access to push directly to main branch,
|
|
64
|
-
create a separate branch and open a PR. This PR must be merged using the "Rebase and merge" strategy to preserve the
|
|
65
|
-
git tag.
|
|
66
|
-
5. Create a new [release on GitHub](https://github.com/api3dao/commons/releases). Use the "Generate release notes"
|
|
67
|
-
feature to generate the release notes from the PR titles.
|
|
68
|
-
|
|
69
|
-
## Development notes
|
|
70
|
-
|
|
71
|
-
### Adding new common utility
|
|
72
|
-
|
|
73
|
-
1. Create a new directory in `src` with the name of the utility.
|
|
74
|
-
2. Create `index.ts` file in the directory. This file will be the entry point for the utility.
|
|
75
|
-
3. Re-export the new utility from `universal-index.ts` or `node-index.ts` file.
|
|
76
|
-
4. Create a `README.md` with documentation.
|
|
77
|
-
|
|
78
|
-
#### Testing the package locally
|
|
79
|
-
|
|
80
|
-
It is preferred (simpler and faster) to test the package using the `file:` protocol.
|
|
81
|
-
|
|
82
|
-
1. Implement some changes and run `pnpm run build` to build the commons package.
|
|
83
|
-
2. In some other project, specify `file:<RELATIVE_PATH_TO_COMMONS>`. For example: `"@api3/commons": "file:../commons"`.
|
|
84
|
-
3. Re-install the dependencies in the project (doesn't matter what package manager you use). For example: `pnpm i`.
|
|
85
|
-
|
|
86
|
-
You can repeat the above steps as many times as you want. The package will be re-installed from the local directory with
|
|
87
|
-
the locally built content.
|
|
88
|
-
|
|
89
|
-
##### Using Verdaccio
|
|
47
|
+
## Related repositories
|
|
90
48
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
[
|
|
49
|
+
- [promise-utils](https://github.com/api3dao/promise-utils)
|
|
50
|
+
- [ois](https://github.com/api3dao/ois)
|
|
51
|
+
- [chains](https://github.com/api3dao/chains)
|
|
52
|
+
- [contracts](https://github.com/api3dao/contracts)
|
|
94
53
|
|
|
95
|
-
|
|
96
|
-
https://verdaccio.org/docs/installation.
|
|
97
|
-
2. Implement and commit your changes. You should have a clean working tree.
|
|
98
|
-
3. `pnpm version minor --no-git-tag-version` - Will bump the `package.json` version. Feel free to replace `minor` with a
|
|
99
|
-
`path` or `major` if necessary.
|
|
100
|
-
4. `pnpm publish --access public --registry http://localhost:4873 --no-git-checks` - Will do the publishing to the local
|
|
101
|
-
registry. It will disable git checks (which ensure that the working tree is clean).
|
|
102
|
-
5. You can now install the package in the target repository. Use
|
|
103
|
-
`pnpm add @api3/commons --registry http://localhost:4873`.
|
|
54
|
+
## For developers
|
|
104
55
|
|
|
105
|
-
|
|
106
|
-
via `rm -rf $HOME/.local/share/verdaccio/storage`.
|
|
56
|
+
Please refer to the [developer instructions](./dev-README.md) for details.
|
|
@@ -18,4 +18,7 @@ export declare const fromBytes32String: (input: Hex) => string;
|
|
|
18
18
|
export declare const deriveSponsorWallet: (airnodeMnemonic: Mnemonic, dapiName: string, protocolId: ProtocolId) => ethers.Wallet;
|
|
19
19
|
export declare const deriveBeaconId: (airnodeAddress: Address, templateId: Hex) => string;
|
|
20
20
|
export declare const deriveBeaconSetId: (beaconIds: Hex[]) => string;
|
|
21
|
+
export declare const deriveHdNodeFromXpub: (xpub: string) => ethers.utils.HDNode;
|
|
22
|
+
export declare const verifyAirnodeXpub: (airnodeXpub: string, airnodeAddress: Address) => ethers.utils.HDNode;
|
|
23
|
+
export declare function deriveSponsorWalletAddress(airnodeXpub: string, sponsorAddress: Address, protocolId: ProtocolId, airnodeAddress?: Address): string;
|
|
21
24
|
//# sourceMappingURL=derivation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivation.d.ts","sourceRoot":"","sources":["../../src/blockchain-utilities/derivation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEvD,eAAO,MAAM,YAAY;;;;;;CAMf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE1E,eAAO,MAAM,kBAAkB,YAAa,OAAO,cAAc,GAAG,qBAAqB,GAAG,WACe,CAAC;AAE5G,eAAO,MAAM,kBAAkB,eAAgB,GAAG,qBAAqB,GAAG,WACa,CAAC;AAExF,eAAO,MAAM,gBAAgB,aAAc,MAAM,gBAAgB,MAAM,WACsC,CAAC;AAE9G,eAAO,MAAM,iBAAiB,oBAAqB,QAAQ,WACwC,CAAC;AAEpG,wBAAgB,kCAAkC,CAAC,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,UAQjG;AAED,eAAO,MAAM,eAAe,UAAW,MAAM,WAA4C,CAAC;AAE1F,eAAO,MAAM,iBAAiB,UAAW,GAAG,WAA2C,CA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AU,MAAM,wBAA8C,CAAC;AAEhG,eAAO,MAAM,iBAAiB,gBAAiB,MAAM,kBAAkB,OAAO,KAAG,OAAO,KAAK,CAAC,MAQ7F,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,OAAO,EACvB,UAAU,EAAE,UAAU,EACtB,cAAc,CAAC,EAAE,OAAO,UAKzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deriveBeaconSetId = exports.deriveBeaconId = exports.deriveSponsorWallet = exports.fromBytes32String = exports.toBytes32String = exports.deriveWalletPathFromSponsorAddress = exports.deriveAirnodeXpub = exports.deriveEndpointId = exports.deriveTemplateIdV1 = exports.deriveTemplateIdV0 = exports.PROTOCOL_IDS = void 0;
|
|
3
|
+
exports.deriveSponsorWalletAddress = exports.verifyAirnodeXpub = exports.deriveHdNodeFromXpub = exports.deriveBeaconSetId = exports.deriveBeaconId = exports.deriveSponsorWallet = exports.fromBytes32String = exports.toBytes32String = exports.deriveWalletPathFromSponsorAddress = exports.deriveAirnodeXpub = exports.deriveEndpointId = exports.deriveTemplateIdV1 = exports.deriveTemplateIdV0 = exports.PROTOCOL_IDS = void 0;
|
|
4
4
|
const ethers_1 = require("ethers");
|
|
5
5
|
exports.PROTOCOL_IDS = {
|
|
6
6
|
RRP: '1',
|
|
@@ -44,4 +44,22 @@ const deriveBeaconSetId = (beaconIds) =>
|
|
|
44
44
|
// By convention beacon IDs are sorted alphabetically - the ordering impacts the resulting hash.
|
|
45
45
|
ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.defaultAbiCoder.encode(['bytes32[]'], [beaconIds]));
|
|
46
46
|
exports.deriveBeaconSetId = deriveBeaconSetId;
|
|
47
|
+
const deriveHdNodeFromXpub = (xpub) => ethers_1.ethers.utils.HDNode.fromExtendedKey(xpub);
|
|
48
|
+
exports.deriveHdNodeFromXpub = deriveHdNodeFromXpub;
|
|
49
|
+
const verifyAirnodeXpub = (airnodeXpub, airnodeAddress) => {
|
|
50
|
+
// The xpub is expected to belong to the hardened path m/44'/60'/0' so we must derive the child default derivation
|
|
51
|
+
// path m/44'/60'/0'/0/0 to compare it and check if xpub belongs to the Airnode wallet.
|
|
52
|
+
const hdNode = (0, exports.deriveHdNodeFromXpub)(airnodeXpub);
|
|
53
|
+
if (airnodeAddress !== hdNode.derivePath('0/0').address) {
|
|
54
|
+
throw new Error(`xpub does not belong to Airnode: ${airnodeAddress}`);
|
|
55
|
+
}
|
|
56
|
+
return hdNode;
|
|
57
|
+
};
|
|
58
|
+
exports.verifyAirnodeXpub = verifyAirnodeXpub;
|
|
59
|
+
function deriveSponsorWalletAddress(airnodeXpub, sponsorAddress, protocolId, airnodeAddress) {
|
|
60
|
+
const hdNode = airnodeAddress ? (0, exports.verifyAirnodeXpub)(airnodeXpub, airnodeAddress) : (0, exports.deriveHdNodeFromXpub)(airnodeXpub);
|
|
61
|
+
const derivationPath = deriveWalletPathFromSponsorAddress(sponsorAddress, protocolId);
|
|
62
|
+
return hdNode.derivePath(derivationPath).address;
|
|
63
|
+
}
|
|
64
|
+
exports.deriveSponsorWalletAddress = deriveSponsorWalletAddress;
|
|
47
65
|
//# sourceMappingURL=derivation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivation.js","sourceRoot":"","sources":["../../src/blockchain-utilities/derivation.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAInB,QAAA,YAAY,GAAG;IAC1B,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,WAAW,EAAE,GAAG;IAChB,WAAW,EAAE,GAAG;IAChB,SAAS,EAAE,GAAG;CACN,CAAC;AAIJ,MAAM,kBAAkB,GAAG,CAAC,OAAgB,EAAE,UAAe,EAAE,iBAAsB,EAAE,EAAE,CAC9F,eAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,SAA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;AACnD,CAAC;AATD,gEASC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/blockchain-utilities/schema.ts"],"names":[],"mappings":";;;AAAA,uDAA6C;AAC7C,mCAAgC;AAChC,6BAAwB;AAEX,QAAA,SAAS,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,4BAA4B,CAAC,CAAC;AAI9E,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC/D,MAAM,cAAc,GAAG,IAAA,sBAAM,EAAC,GAAG,EAAE,CAAC,eAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/blockchain-utilities/schema.ts"],"names":[],"mappings":";;;AAAA,uDAA6C;AAC7C,mCAAgC;AAChC,6BAAwB;AAEX,QAAA,SAAS,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,4BAA4B,CAAC,CAAC;AAI9E,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IAC/D,MAAM,cAAc,GAAG,IAAA,sBAAM,EAAC,GAAG,EAAE,CAAC,eAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC5B,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;QAC9E,OAAO,OAAC,CAAC,KAAK,CAAC;IACjB,CAAC;IAED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AAE,CAAC,KAAK,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAA9F,QAAA,gBAAgB,oBAA8E"}
|
package/dist/eslint/jest.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
module.exports = {
|
|
3
3
|
parser: '@typescript-eslint/parser',
|
|
4
4
|
parserOptions: {
|
|
5
|
-
ecmaVersion: 2022,
|
|
5
|
+
ecmaVersion: 2022, // Enable parsing modern ECMAScript features.
|
|
6
6
|
sourceType: 'module', // Enable the use of ES6 import/export syntax.
|
|
7
7
|
},
|
|
8
8
|
env: {
|
|
@@ -19,13 +19,13 @@ module.exports = {
|
|
|
19
19
|
plugins: ['jest'],
|
|
20
20
|
extends: ['plugin:jest/all', 'plugin:jest-formatting/recommended'],
|
|
21
21
|
rules: {
|
|
22
|
-
'jest/prefer-expect-assertions': 'off',
|
|
23
|
-
'jest/prefer-each': 'off',
|
|
24
|
-
'jest/require-top-level-describe': 'off',
|
|
25
|
-
'jest/max-expects': 'off',
|
|
26
|
-
'jest/valid-title': 'off',
|
|
22
|
+
'jest/prefer-expect-assertions': 'off', // While useful, enforcing this can lead to verbose tests.
|
|
23
|
+
'jest/prefer-each': 'off', // We find traditional for-loops more readable in certain contexts.
|
|
24
|
+
'jest/require-top-level-describe': 'off', // Multiple top-level describe blocks or tests can be acceptable.
|
|
25
|
+
'jest/max-expects': 'off', // Limiting expect statements is beneficial, but enforcing a strict count can be restrictive.
|
|
26
|
+
'jest/valid-title': 'off', // This restriction can prevent using titles like "<function-name>.name".
|
|
27
27
|
'jest/no-hooks': [
|
|
28
|
-
'error',
|
|
28
|
+
'error', // We advocate for setup functions over beforeXXX hooks. However, afterXyz hooks are sometimes indispensable, like for resetting Jest timers. See: https://kentcdodds.com/blog/avoid-nesting-when-youre-testing#inline-it.
|
|
29
29
|
{
|
|
30
30
|
allow: ['afterEach', 'afterAll'],
|
|
31
31
|
},
|
package/dist/eslint/jest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../../src/eslint/jest.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"jest.js","sourceRoot":"","sources":["../../src/eslint/jest.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI,EAAE,6CAA6C;QAChE,UAAU,EAAE,QAAQ,EAAE,8CAA8C;KACrE;IACD,GAAG,EAAE;QACH,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;KACd;IACD,8DAA8D;IAC9D,SAAS,EAAE;QACT;YACE,KAAK,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,CAAC;YACzE,GAAG,EAAE;gBACH,IAAI,EAAE,IAAI;aACX;YACD,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,OAAO,EAAE,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;YAClE,KAAK,EAAE;gBACL,+BAA+B,EAAE,KAAK,EAAE,0DAA0D;gBAClG,kBAAkB,EAAE,KAAK,EAAE,mEAAmE;gBAC9F,iCAAiC,EAAE,KAAK,EAAE,iEAAiE;gBAC3G,kBAAkB,EAAE,KAAK,EAAE,6FAA6F;gBACxH,kBAAkB,EAAE,KAAK,EAAE,yEAAyE;gBACpG,eAAe,EAAE;oBACf,OAAO,EAAE,0NAA0N;oBACnO;wBACE,KAAK,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC;qBACjC;iBACF;gBACD,wBAAwB,EAAE,KAAK,EAAE,yGAAyG;aAC3I;SACF;KACF;CACF,CAAC"}
|
package/dist/eslint/next-js.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-js.js","sourceRoot":"","sources":["../../src/eslint/next-js.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"next-js.js","sourceRoot":"","sources":["../../src/eslint/next-js.js"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI,EAAE,gDAAgD;QACnE,YAAY,EAAE;YACZ,GAAG,EAAE,IAAI,EAAE,sBAAsB;SAClC;QACD,UAAU,EAAE,QAAQ,EAAE,mCAAmC;KAC1D;IACD,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ;SAClB;KACF;IACD,GAAG,EAAE;QACH,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;KACd;IACD,OAAO,EAAE;QACP,sBAAsB,EAAE,kGAAkG;KAC3H;IACD,SAAS,EAAE;QACT;YACE,KAAK,EAAE,CAAC,YAAY,CAAC;YACrB,KAAK,EAAE;gBACL,0BAA0B,EAAE,KAAK;gBACjC,8BAA8B,EAAE,OAAO,EAAE,0DAA0D;aACpG;SACF;KACF;CACF,CAAC"}
|
package/dist/eslint/react.js
CHANGED
|
@@ -6,7 +6,7 @@ const { universalRestrictedImportsConfig, universalImportOrderConfig } = require
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
parser: '@typescript-eslint/parser',
|
|
8
8
|
parserOptions: {
|
|
9
|
-
ecmaVersion: 2022,
|
|
9
|
+
ecmaVersion: 2022, // Enable parsing of modern ECMAScript features.
|
|
10
10
|
ecmaFeatures: {
|
|
11
11
|
jsx: true, // Support JSX syntax.
|
|
12
12
|
},
|
|
@@ -42,18 +42,18 @@ module.exports = {
|
|
|
42
42
|
'react/forbid-component-props': ['error', { forbid: [] }],
|
|
43
43
|
'react/forbid-dom-props': ['error', { forbid: [] }],
|
|
44
44
|
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never', propElementValues: 'always' }],
|
|
45
|
-
'react/jsx-curly-newline': 'off',
|
|
46
|
-
'react/jsx-filename-extension': 'off',
|
|
45
|
+
'react/jsx-curly-newline': 'off', // Conflicts with prettier.
|
|
46
|
+
'react/jsx-filename-extension': 'off', // We use .tsx extension.
|
|
47
47
|
'react/jsx-handler-names': 'off',
|
|
48
|
-
'react/jsx-indent': 'off',
|
|
49
|
-
'react/jsx-indent-props': 'off',
|
|
50
|
-
'react/jsx-max-depth': 'off',
|
|
51
|
-
'react/jsx-max-props-per-line': 'off',
|
|
52
|
-
'react/jsx-newline': 'off',
|
|
53
|
-
'react/jsx-no-bind': 'off',
|
|
48
|
+
'react/jsx-indent': 'off', // Conflicts with prettier.
|
|
49
|
+
'react/jsx-indent-props': 'off', // Conflicts with prettier.
|
|
50
|
+
'react/jsx-max-depth': 'off', // Conflicts with prettier.
|
|
51
|
+
'react/jsx-max-props-per-line': 'off', // Conflicts with prettier.
|
|
52
|
+
'react/jsx-newline': 'off', // Conflicts with prettier.
|
|
53
|
+
'react/jsx-no-bind': 'off', // Conflicts with prettier.
|
|
54
54
|
'react/jsx-no-leaked-render': 'off',
|
|
55
55
|
'react/jsx-no-literals': 'off',
|
|
56
|
-
'react/jsx-one-expression-per-line': 'off',
|
|
56
|
+
'react/jsx-one-expression-per-line': 'off', // Conflicts with prettier.
|
|
57
57
|
'react/jsx-props-no-spreading': 'off',
|
|
58
58
|
'react/jsx-sort-props': 'off',
|
|
59
59
|
'react/no-multi-comp': 'off',
|
package/dist/eslint/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/eslint/react.js"],"names":[],"mappings":";AAAA,mFAAmF;AACnF,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEpC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AE,gCAAgC,EAAE;gBAC1C,KAAK,EAAE;oBACL;wBACE,IAAI,EAAE,OAAO;wBACb,WAAW,EAAE,CAAC,SAAS,CAAC;wBACxB,OAAO,EACL,uHAAuH;qBAC1H;iBACF;aACF,CAAC;SACH;QAED,mCAAmC;QACnC,qBAAqB,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC3C;CACF,CAAC"}
|
package/dist/eslint/universal.js
CHANGED
|
@@ -4,7 +4,7 @@ const { universalRestrictedImportsConfig, universalImportOrderConfig } = require
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
parser: '@typescript-eslint/parser',
|
|
6
6
|
parserOptions: {
|
|
7
|
-
ecmaVersion: 2022,
|
|
7
|
+
ecmaVersion: 2022, // Allows for the parsing of modern ECMAScript features.
|
|
8
8
|
sourceType: 'module', // Allows for the use of imports.
|
|
9
9
|
},
|
|
10
10
|
env: {
|
|
@@ -26,22 +26,22 @@ module.exports = {
|
|
|
26
26
|
camelcase: 'error',
|
|
27
27
|
curly: ['error', 'multi-line', 'consistent'],
|
|
28
28
|
eqeqeq: 'error',
|
|
29
|
-
'no-await-in-loop': 'off',
|
|
29
|
+
'no-await-in-loop': 'off', // Too restrictive, often false yields to more verbose code.
|
|
30
30
|
'no-console': ['error', { allow: ['info', 'groupCollapsed', 'groupEnd'] }],
|
|
31
|
-
'no-constant-condition': 'off',
|
|
32
|
-
'no-fallthrough': 'off',
|
|
31
|
+
'no-constant-condition': 'off', // Writing a "while(true)"" loop is often the most readable way to express the intent.
|
|
32
|
+
'no-fallthrough': 'off', // Does not work well with typescript exhaustive enums.
|
|
33
33
|
'no-inline-comments': 'off',
|
|
34
34
|
'no-lonely-if': 'error',
|
|
35
35
|
'no-nested-ternary': 'error',
|
|
36
36
|
'no-new-wrappers': 'error',
|
|
37
|
-
'no-return-await': 'off',
|
|
38
|
-
'no-unexpected-multiline': 'off',
|
|
39
|
-
'no-unused-expressions': 'off',
|
|
37
|
+
'no-return-await': 'off', // Superceded by @typescript-eslint/return-await.
|
|
38
|
+
'no-unexpected-multiline': 'off', // Conflicts with prettier.
|
|
39
|
+
'no-unused-expressions': 'off', // Superceded by @typescript-eslint/no-unused-expressions.
|
|
40
40
|
'object-shorthand': 'error',
|
|
41
41
|
'prefer-destructuring': [
|
|
42
42
|
'error',
|
|
43
43
|
{
|
|
44
|
-
array: false,
|
|
44
|
+
array: false, // For arrays it is often confusing to use destructuring.
|
|
45
45
|
object: true,
|
|
46
46
|
},
|
|
47
47
|
{
|
|
@@ -83,24 +83,24 @@ module.exports = {
|
|
|
83
83
|
},
|
|
84
84
|
],
|
|
85
85
|
/* Rule overrides for "unicorn" plugin */
|
|
86
|
-
'unicorn/consistent-function-scoping': 'off',
|
|
87
|
-
'unicorn/no-abusive-eslint-disable': 'off',
|
|
88
|
-
'unicorn/no-array-callback-reference': 'error',
|
|
89
|
-
'unicorn/no-array-reduce': 'off',
|
|
90
|
-
'unicorn/no-nested-ternary': 'off',
|
|
91
|
-
'unicorn/no-null': 'off',
|
|
92
|
-
'unicorn/no-object-as-default-parameter': 'off',
|
|
93
|
-
'unicorn/no-useless-undefined': ['error', { checkArguments: false }],
|
|
94
|
-
'unicorn/prefer-module': 'off',
|
|
95
|
-
'unicorn/prevent-abbreviations': 'off',
|
|
86
|
+
'unicorn/consistent-function-scoping': 'off', // Disabling due to the rule's constraints conflicting with established patterns, especially in test suites where local helper or mocking functions are prevalent and do not necessitate exports.
|
|
87
|
+
'unicorn/no-abusive-eslint-disable': 'off', // Already covered by different ruleset.
|
|
88
|
+
'unicorn/no-array-callback-reference': 'error', // Explicitly turned on, because it was initially disabled and "point free" notation was enforced using "functional/prefer-tacit". That said, the point free pattern is dangerous in JS. See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-callback-reference.md.
|
|
89
|
+
'unicorn/no-array-reduce': 'off', // We are OK with using reduce occasionally, but I agree with the author that the code using reduce can easily get complex.
|
|
90
|
+
'unicorn/no-nested-ternary': 'off', // This rule is smarter than the standard ESLint rule, but conflicts with prettier so it needs to be turned off. Nested ternaries are very unreadable so it's OK if all of them are flagged.
|
|
91
|
+
'unicorn/no-null': 'off', // We use both null and undefined for representing three state objects. We could use a string union instead, but using combination of null and undefined is less verbose.
|
|
92
|
+
'unicorn/no-object-as-default-parameter': 'off', // Too restrictive. TypeScript can ensure that the default value matches the type.
|
|
93
|
+
'unicorn/no-useless-undefined': ['error', { checkArguments: false }], // We need to disable "checkArguments", because if a function expects a value of type "T | undefined" the undefined value needs to be passed explicitly.
|
|
94
|
+
'unicorn/prefer-module': 'off', // We use CJS for configuration files and tests. There is no rush to migrate to ESM and the configuration files are probably not yet ready for ESM yet.
|
|
95
|
+
'unicorn/prevent-abbreviations': 'off', // This rule reports many false positives and leads to more verbose code.
|
|
96
96
|
/* Rule overrides for "import" plugin */
|
|
97
97
|
'import/no-default-export': 'error',
|
|
98
98
|
'import/no-duplicates': 'error',
|
|
99
99
|
'import/no-named-as-default': 'off',
|
|
100
|
-
'import/no-unresolved': 'off',
|
|
100
|
+
'import/no-unresolved': 'off', // Does not accept exports keyword. See: https://github.com/import-js/eslint-plugin-import/issues/1810.
|
|
101
101
|
'import/order': ['error', universalImportOrderConfig],
|
|
102
102
|
/* Rule overrides for "@typescript-eslint" plugin */
|
|
103
|
-
'@typescript-eslint/comma-dangle': 'off',
|
|
103
|
+
'@typescript-eslint/comma-dangle': 'off', // Conflicts with prettier.
|
|
104
104
|
'@typescript-eslint/consistent-type-exports': [
|
|
105
105
|
'error',
|
|
106
106
|
{
|
|
@@ -111,17 +111,17 @@ module.exports = {
|
|
|
111
111
|
'error',
|
|
112
112
|
{
|
|
113
113
|
prefer: 'type-imports',
|
|
114
|
-
disallowTypeAnnotations: false,
|
|
114
|
+
disallowTypeAnnotations: false, // It is quite common to do so. See: https://typescript-eslint.io/rules/consistent-type-imports/#disallowtypeannotations.
|
|
115
115
|
fixStyle: 'inline-type-imports',
|
|
116
116
|
},
|
|
117
117
|
],
|
|
118
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
119
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
120
|
-
'@typescript-eslint/indent': 'off',
|
|
121
|
-
'@typescript-eslint/init-declarations': 'off',
|
|
122
|
-
'@typescript-eslint/lines-around-comment': 'off',
|
|
123
|
-
'@typescript-eslint/member-delimiter-style': 'off',
|
|
124
|
-
'@typescript-eslint/member-ordering': 'off',
|
|
118
|
+
'@typescript-eslint/explicit-function-return-type': 'off', // Prefer inferring types to explicit annotations.
|
|
119
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off', // We export lot of functions in order to test them. Typing them all is not a good idea.
|
|
120
|
+
'@typescript-eslint/indent': 'off', // Conflicts with prettier.
|
|
121
|
+
'@typescript-eslint/init-declarations': 'off', // Too restrictive, TS is able to infer if value is initialized or not. This pattern does not work with declaring a variable and then initializing it conditionally (or later).
|
|
122
|
+
'@typescript-eslint/lines-around-comment': 'off', // Do not agree with this rule.
|
|
123
|
+
'@typescript-eslint/member-delimiter-style': 'off', // Conflicts with prettier.
|
|
124
|
+
'@typescript-eslint/member-ordering': 'off', // Does not have a fixer. Also, sometimes it's beneficial to group related members together.
|
|
125
125
|
'@typescript-eslint/naming-convention': 'off',
|
|
126
126
|
'@typescript-eslint/no-confusing-void-expression': [
|
|
127
127
|
'error',
|
|
@@ -129,53 +129,53 @@ module.exports = {
|
|
|
129
129
|
ignoreArrowShorthand: true, // See: https://typescript-eslint.io/rules/no-confusing-void-expression/#ignorearrowshorthand.
|
|
130
130
|
},
|
|
131
131
|
],
|
|
132
|
-
'@typescript-eslint/no-empty-function': 'off',
|
|
133
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
134
|
-
'@typescript-eslint/no-extra-parens': 'off',
|
|
135
|
-
'@typescript-eslint/no-magic-numbers': 'off',
|
|
132
|
+
'@typescript-eslint/no-empty-function': 'off', // Too restrictive, often false yields to more verbose code.
|
|
133
|
+
'@typescript-eslint/no-explicit-any': 'off', // Using "any" is sometimes necessary.
|
|
134
|
+
'@typescript-eslint/no-extra-parens': 'off', // Conflicts with prettier.
|
|
135
|
+
'@typescript-eslint/no-magic-numbers': 'off', // Too restrictive. There is often nothing wrong with inlining numbers.
|
|
136
136
|
'@typescript-eslint/no-misused-promises': [
|
|
137
137
|
'error',
|
|
138
138
|
{
|
|
139
139
|
checksVoidReturn: {
|
|
140
|
-
arguments: false,
|
|
140
|
+
arguments: false, // It's common to pass async function where one expects a function returning void.
|
|
141
141
|
attributes: false, // It's common to pass async function where one expects a function returning void.
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
144
|
],
|
|
145
|
-
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
146
|
-
'@typescript-eslint/no-require-imports': 'off',
|
|
145
|
+
'@typescript-eslint/no-non-null-assertion': 'off', // Too restrictive. The inference is often not powerful enough or there is not enough context.
|
|
146
|
+
'@typescript-eslint/no-require-imports': 'off', // We use a similar rule called "@typescript-eslint/no-var-imports" which bans require imports alltogether.
|
|
147
147
|
'@typescript-eslint/no-restricted-imports': ['error', universalRestrictedImportsConfig],
|
|
148
|
-
'@typescript-eslint/no-shadow': 'off',
|
|
149
|
-
'@typescript-eslint/no-type-alias': 'off',
|
|
150
|
-
'@typescript-eslint/no-unnecessary-condition': 'off',
|
|
151
|
-
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
152
|
-
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
153
|
-
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
154
|
-
'@typescript-eslint/no-unsafe-return': 'off',
|
|
148
|
+
'@typescript-eslint/no-shadow': 'off', // It is often valid to shadow variable (e.g. for the lack of a better name).
|
|
149
|
+
'@typescript-eslint/no-type-alias': 'off', // The rule is deprecated and "@typescript-eslint/consistent-type-definitions" is used instead.
|
|
150
|
+
'@typescript-eslint/no-unnecessary-condition': 'off', // Suggests removing useful conditionals for index signatures and arrays. Would require enabling additional strict checks in TS, which is hard to ask.
|
|
151
|
+
'@typescript-eslint/no-unsafe-argument': 'off', // Too restrictive, often false yields to more verbose code.
|
|
152
|
+
'@typescript-eslint/no-unsafe-assignment': 'off', // Too restrictive, often false yields to more verbose code.
|
|
153
|
+
'@typescript-eslint/no-unsafe-member-access': 'off', // Too restrictive, often false yields to more verbose code.
|
|
154
|
+
'@typescript-eslint/no-unsafe-return': 'off', // Too restrictive, often false yields to more verbose code.
|
|
155
155
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', vars: 'all' }],
|
|
156
|
-
'@typescript-eslint/no-use-before-define': 'off',
|
|
157
|
-
'@typescript-eslint/object-curly-spacing': 'off',
|
|
156
|
+
'@typescript-eslint/no-use-before-define': 'off', // Too restrictive, does not have a fixer and is not important.
|
|
157
|
+
'@typescript-eslint/object-curly-spacing': 'off', // Conflicts with prettier.
|
|
158
158
|
'@typescript-eslint/prefer-nullish-coalescing': [
|
|
159
159
|
'error',
|
|
160
160
|
{
|
|
161
161
|
ignoreConditionalTests: true, // Its more intuitive to use logical operators in conditionals.
|
|
162
162
|
},
|
|
163
163
|
],
|
|
164
|
-
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
|
165
|
-
'@typescript-eslint/quotes': 'off',
|
|
166
|
-
'@typescript-eslint/semi': 'off',
|
|
167
|
-
'@typescript-eslint/space-before-function-paren': 'off',
|
|
168
|
-
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
169
|
-
'@typescript-eslint/unbound-method': 'off',
|
|
164
|
+
'@typescript-eslint/prefer-readonly-parameter-types': 'off', // Too restrictive, often false yields to more verbose code.
|
|
165
|
+
'@typescript-eslint/quotes': 'off', // Conflicts with prettier.
|
|
166
|
+
'@typescript-eslint/semi': 'off', // Conflicts with prettier.
|
|
167
|
+
'@typescript-eslint/space-before-function-paren': 'off', // Conflicts with prettier.
|
|
168
|
+
'@typescript-eslint/strict-boolean-expressions': 'off', // While the rule is reasonable, it is often convenient and intended to just check whether the value is not null or undefined. Enabling this rule would make the code more verbose. See: https://typescript-eslint.io/rules/strict-boolean-expressions/
|
|
169
|
+
'@typescript-eslint/unbound-method': 'off', // Reports issues for common patterns in tests (e.g. "expect(logger.warn)..."). Often the issue yields false positives.
|
|
170
170
|
/* Rule overrides for "functional" plugin */
|
|
171
|
-
'functional/no-classes': 'error',
|
|
171
|
+
'functional/no-classes': 'error', // Functions are all we need.
|
|
172
172
|
'functional/no-promise-reject': 'error',
|
|
173
|
-
'functional/no-try-statements': 'error',
|
|
174
|
-
'functional/prefer-tacit': 'off',
|
|
173
|
+
'functional/no-try-statements': 'error', // Use go utils instead.
|
|
174
|
+
'functional/prefer-tacit': 'off', // The rule is dangerous. See: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-array-callback-reference.md.
|
|
175
175
|
/* Overrides for "lodash" plugin */
|
|
176
|
-
'lodash/import-scope': ['error', 'member'],
|
|
177
|
-
'lodash/path-style': 'off',
|
|
178
|
-
'lodash/prefer-lodash-method': 'off',
|
|
176
|
+
'lodash/import-scope': ['error', 'member'], // We prefer member imports in node.js code. This is not recommended for FE projects, because lodash can't be tree shaken (written in CJS not ESM). This rule should be overridden for FE projects (and we do so in React ruleset).
|
|
177
|
+
'lodash/path-style': 'off', // Can potentially trigger TS errors. Both variants have use cases when they are more readable.
|
|
178
|
+
'lodash/prefer-lodash-method': 'off', // Disagree with this rule. Using the native method is often simpler.
|
|
179
179
|
/* Rule overrides for other plugins and rules */
|
|
180
180
|
// This rule unfortunately does not detect deprecated properties. See:
|
|
181
181
|
// https://github.com/gund/eslint-plugin-deprecation/issues/13/
|
|
@@ -191,10 +191,10 @@ module.exports = {
|
|
|
191
191
|
plugins: ['jest'],
|
|
192
192
|
extends: ['plugin:jest/all', 'plugin:jest-formatting/recommended'],
|
|
193
193
|
rules: {
|
|
194
|
-
'jest/prefer-expect-assertions': 'off',
|
|
195
|
-
'jest/prefer-each': 'off',
|
|
196
|
-
'jest/require-top-level-describe': 'off',
|
|
197
|
-
'jest/max-expects': 'off',
|
|
194
|
+
'jest/prefer-expect-assertions': 'off', // Enabling this option would result in excessively verbose code.
|
|
195
|
+
'jest/prefer-each': 'off', // We prefer the traditional for loop.
|
|
196
|
+
'jest/require-top-level-describe': 'off', // This is not a good pattern. There is nothing wrong with having multiple top level describe blocks or tests.
|
|
197
|
+
'jest/max-expects': 'off', // It's good to limit the number of expects in a test, but this rule is too strict.
|
|
198
198
|
'jest/valid-title': 'off', // Prevents using "<function-name>.name" as a test name
|
|
199
199
|
},
|
|
200
200
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal.js","sourceRoot":"","sources":["../../src/eslint/universal.js"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,MAAM,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE/F,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"universal.js","sourceRoot":"","sources":["../../src/eslint/universal.js"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,MAAM,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE/F,MAAM,CAAC,OAAO,GAAG;IACf,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE;QACb,WAAW,EAAE,IAAI,EAAE,wDAAwD;QAC3E,UAAU,EAAE,QAAQ,EAAE,iCAAiC;KACxD;IACD,GAAG,EAAE;QACH,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;KACd;IACD,OAAO,EAAE;QACP,oBAAoB;QACpB,+BAA+B;QAC/B,2BAA2B;QAC3B,0BAA0B;QAC1B,4BAA4B;QAC5B,4BAA4B;QAC5B,2BAA2B;KAC5B;IACD,OAAO,EAAE,CAAC,oBAAoB,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,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EAAE,KAAK,EAAE,mFAAmF;gBAC9G,kBAAkB,EAAE,KAAK,EAAE,uDAAuD;aACnF;SACF;KACF;CACF,CAAC"}
|
package/dist/http/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Method, type AxiosError
|
|
1
|
+
import { type Method, type AxiosError } from 'axios';
|
|
2
2
|
export interface Request {
|
|
3
3
|
readonly method: Method;
|
|
4
4
|
readonly url: string;
|
|
@@ -8,7 +8,7 @@ export interface Request {
|
|
|
8
8
|
readonly body?: unknown;
|
|
9
9
|
}
|
|
10
10
|
export interface ErrorResponse {
|
|
11
|
-
readonly
|
|
11
|
+
readonly response: unknown;
|
|
12
12
|
readonly message: string;
|
|
13
13
|
readonly code: string | undefined;
|
|
14
14
|
}
|
|
@@ -17,11 +17,13 @@ interface ExecuteRequestSuccess<T> {
|
|
|
17
17
|
success: true;
|
|
18
18
|
errorData: undefined;
|
|
19
19
|
data: T;
|
|
20
|
+
statusCode: number;
|
|
20
21
|
}
|
|
21
22
|
interface ExecuteRequestError {
|
|
22
23
|
success: false;
|
|
23
24
|
errorData: ErrorResponse;
|
|
24
25
|
data: undefined;
|
|
26
|
+
statusCode: number | undefined;
|
|
25
27
|
}
|
|
26
28
|
export type ExecuteRequestResult<T> = ExecuteRequestError | ExecuteRequestSuccess<T>;
|
|
27
29
|
export declare function executeRequest<T>(request: Request): Promise<ExecuteRequestResult<T>>;
|
package/dist/http/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAsB,MAAM,OAAO,CAAC;AAIhF,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,eAAO,MAAM,qBAAqB,UAAW,UAAU,KAAG,aAOzD,CAAC;AAEF,UAAU,qBAAqB,CAAC,CAAC;IAC/B,OAAO,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,CAAC,CAAC;IACR,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,UAAU,mBAAmB;IAC3B,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,EAAE,aAAa,CAAC;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI,mBAAmB,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAErF,wBAAsB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAwB1F"}
|
package/dist/http/index.js
CHANGED
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.executeRequest = exports.extractAxiosErrorData = void 0;
|
|
7
7
|
const promise_utils_1 = require("@api3/promise-utils");
|
|
8
8
|
const axios_1 = __importDefault(require("axios"));
|
|
9
|
-
const pick_1 = __importDefault(require("lodash/pick"));
|
|
10
9
|
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
11
10
|
const extractAxiosErrorData = (error) => {
|
|
12
11
|
// Inspired by: https://axios-http.com/docs/handling_errors
|
|
13
12
|
return {
|
|
14
|
-
|
|
13
|
+
response: error.response?.data,
|
|
15
14
|
message: error.message,
|
|
16
15
|
code: error.code,
|
|
17
16
|
};
|
|
@@ -27,10 +26,16 @@ async function executeRequest(request) {
|
|
|
27
26
|
params: queryParams,
|
|
28
27
|
timeout,
|
|
29
28
|
}));
|
|
30
|
-
if (!goAxios.success)
|
|
31
|
-
return {
|
|
29
|
+
if (!goAxios.success) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
errorData: (0, exports.extractAxiosErrorData)(goAxios.error),
|
|
33
|
+
data: undefined,
|
|
34
|
+
statusCode: goAxios.error.status,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
32
37
|
const response = goAxios.data;
|
|
33
|
-
return { success: true, errorData: undefined, data: response.data };
|
|
38
|
+
return { success: true, errorData: undefined, data: response.data, statusCode: response.status };
|
|
34
39
|
}
|
|
35
40
|
exports.executeRequest = executeRequest;
|
|
36
41
|
//# sourceMappingURL=index.js.map
|
package/dist/http/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAyC;AACzC,kDAAgF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAyC;AACzC,kDAAgF;AAEhF,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAiB3B,MAAM,qBAAqB,GAAG,CAAC,KAAiB,EAAiB,EAAE;IACxE,2DAA2D;IAC3D,OAAO;QACL,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,qBAAqB,yBAOhC;AAiBK,KAAK,UAAU,cAAc,CAAI,OAAgB;IACtD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,OAAO,GAAG,kBAAkB,EAAE,GAAG,OAAO,CAAC;IAEpG,MAAM,OAAO,GAAG,MAAM,IAAA,kBAAE,EAAwC,KAAK,IAAI,EAAE,CACzE,IAAA,eAAK,EAAC;QACJ,GAAG;QACH,MAAM;QACN,OAAO;QACP,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,WAAW;QACnB,OAAO;KACR,CAAC,CACH,CAAC;IACF,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,IAAA,6BAAqB,EAAC,OAAO,CAAC,KAAK,CAAC;YAC/C,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;SACjC,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAE9B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;AACnG,CAAC;AAxBD,wCAwBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AACA,OAAO,OAAO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