@sonarwatch/portfolio-core 0.4.27 → 0.4.29
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/CHANGELOG.md +39 -22
- package/package.json +1 -1
- package/src/Fetcher.d.ts +1 -1
- package/src/Fetcher.js +11 -8
- package/src/Fetcher.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,34 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
-
## [0.4.
|
|
5
|
+
## [0.4.29](https://github.com/sonarwatch/portfolio/compare/core-0.4.28...core-0.4.29) (2023-07-13)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
## [0.4.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## [0.4.25](https://github.com/sonarwatch/portfolio/compare/core-0.4.24...core-0.4.25) (2023-07-13)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## [0.4.24](https://github.com/sonarwatch/portfolio/compare/core-0.4.23...core-0.4.24) (2023-07-12)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## [0.4.23](https://github.com/sonarwatch/portfolio/compare/core-0.4.22...core-0.4.23) (2023-07-12)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## [0.4.22](https://github.com/sonarwatch/portfolio/compare/core-0.4.21...core-0.4.22) (2023-07-12)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## [0.4.21](https://github.com/sonarwatch/portfolio/compare/core-0.4.20...core-0.4.21) (2023-07-12)
|
|
9
|
+
## [0.4.29](https://github.com/sonarwatch/portfolio/compare/core-0.4.28...core-0.4.29) (2023-07-13)
|
|
30
10
|
|
|
31
11
|
|
|
32
12
|
|
|
13
|
+
## [0.4.28](https://github.com/sonarwatch/portfolio/compare/core-0.4.27...core-0.4.28) (2023-07-13)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Reverts
|
|
17
|
+
|
|
18
|
+
* Revert "fix" ([a93952e](https://github.com/sonarwatch/portfolio/commit/a93952e9e6ad61547691bf5e00af35a892a0b81c))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.4.27](https://github.com/sonarwatch/portfolio/compare/core-0.4.26...core-0.4.27) (2023-07-13)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [0.4.26](https://github.com/sonarwatch/portfolio/compare/core-0.4.25...core-0.4.26) (2023-07-13)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [0.4.25](https://github.com/sonarwatch/portfolio/compare/core-0.4.24...core-0.4.25) (2023-07-13)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [0.4.24](https://github.com/sonarwatch/portfolio/compare/core-0.4.23...core-0.4.24) (2023-07-12)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [0.4.23](https://github.com/sonarwatch/portfolio/compare/core-0.4.22...core-0.4.23) (2023-07-12)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [0.4.22](https://github.com/sonarwatch/portfolio/compare/core-0.4.21...core-0.4.22) (2023-07-12)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## [0.4.21](https://github.com/sonarwatch/portfolio/compare/core-0.4.20...core-0.4.21) (2023-07-12)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
33
50
|
## [0.4.20](https://github.com/sonarwatch/portfolio/compare/core-0.4.19...core-0.4.20) (2023-07-10)
|
|
34
51
|
|
|
35
52
|
|
package/package.json
CHANGED
package/src/Fetcher.d.ts
CHANGED
|
@@ -24,6 +24,6 @@ export type FetchersResult = {
|
|
|
24
24
|
elements: PortfolioElement[];
|
|
25
25
|
errors: Record<string, string>;
|
|
26
26
|
};
|
|
27
|
-
export declare function runFetchers(owner: string, fetchers: Fetcher[], cache: Cache): Promise<FetchersResult>;
|
|
27
|
+
export declare function runFetchers(owner: string, addressSystem: AddressSystemType, fetchers: Fetcher[], cache: Cache): Promise<FetchersResult>;
|
|
28
28
|
export declare function runFetchersByNetworkId(owner: string, networkId: NetworkIdType, fetchers: Fetcher[], cache: Cache): Promise<FetchersResult>;
|
|
29
29
|
export declare function runFetcher(owner: string, fetcher: Fetcher, cache: Cache): Promise<FetcherResult>;
|
package/src/Fetcher.js
CHANGED
|
@@ -12,20 +12,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.runFetcher = exports.runFetchersByNetworkId = exports.runFetchers = void 0;
|
|
13
13
|
const constants_1 = require("./constants");
|
|
14
14
|
const utils_1 = require("./utils");
|
|
15
|
-
function runFetchers(owner, fetchers, cache) {
|
|
15
|
+
function runFetchers(owner, addressSystem, fetchers, cache) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const addressSystem = (0, utils_1.getAddressSystem)(owner);
|
|
18
|
-
if (!addressSystem)
|
|
19
|
-
throw new Error(`Owner address does not correspond to any address system: ${owner}`);
|
|
20
17
|
const fOwner = (0, utils_1.formatAddress)(owner, addressSystem);
|
|
21
|
-
const
|
|
22
|
-
|
|
18
|
+
const isFetchersValids = fetchers.every((f) => constants_1.networks[f.networkId].addressSystem === addressSystem);
|
|
19
|
+
if (!isFetchersValids)
|
|
20
|
+
throw new Error(`Not all fetchers have the right address system: ${addressSystem}`);
|
|
21
|
+
const promises = fetchers.map((f) => f.executor(fOwner, cache));
|
|
23
22
|
const result = yield Promise.allSettled(promises);
|
|
24
23
|
const failedFetcherIds = [];
|
|
25
24
|
const succeededFetcherIds = [];
|
|
26
25
|
const errors = {};
|
|
27
26
|
const elements = result.flatMap((r, index) => {
|
|
28
|
-
const fetcherId =
|
|
27
|
+
const fetcherId = fetchers[index].id;
|
|
29
28
|
if (r.status === 'rejected') {
|
|
30
29
|
failedFetcherIds.push(fetcherId);
|
|
31
30
|
errors[fetcherId] = r.reason.message || 'Unknown error';
|
|
@@ -49,7 +48,11 @@ function runFetchers(owner, fetchers, cache) {
|
|
|
49
48
|
exports.runFetchers = runFetchers;
|
|
50
49
|
function runFetchersByNetworkId(owner, networkId, fetchers, cache) {
|
|
51
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
|
|
51
|
+
const isFetchersValids = fetchers.every((f) => f.networkId === networkId);
|
|
52
|
+
if (!isFetchersValids)
|
|
53
|
+
throw new Error(`Not all fetchers have the right network id: ${networkId}`);
|
|
54
|
+
const { addressSystem } = constants_1.networks[networkId];
|
|
55
|
+
return runFetchers(owner, addressSystem, fetchers, cache);
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
58
|
exports.runFetchersByNetworkId = runFetchersByNetworkId;
|
package/src/Fetcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fetcher.js","sourceRoot":"","sources":["../../../../packages/core/src/Fetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,2CAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"Fetcher.js","sourceRoot":"","sources":["../../../../packages/core/src/Fetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,2CAAuC;AACvC,mCAAkE;AA+BlE,SAAsB,WAAW,CAC/B,KAAa,EACb,aAAgC,EAChC,QAAmB,EACnB,KAAY;;QAEZ,MAAM,MAAM,GAAG,IAAA,qBAAa,EAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QACnD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CACrC,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,aAAa,KAAK,aAAa,CAC7D,CAAC;QACF,IAAI,CAAC,gBAAgB;YACnB,MAAM,IAAI,KAAK,CACb,mDAAmD,aAAa,EAAE,CACnE,C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