@sonarwatch/portfolio-core 0.4.47 → 0.4.49
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 +53 -45
- package/package.json +1 -1
- package/src/Fetcher.d.ts +9 -5
- package/src/Fetcher.js +25 -17
- package/src/Fetcher.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,54 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
-
## [0.4.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## [0.4.46](https://github.com/sonarwatch/portfolio/compare/core-0.4.45...core-0.4.46) (2023-07-17)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## [0.4.45](https://github.com/sonarwatch/portfolio/compare/core-0.4.44...core-0.4.45) (2023-07-16)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## [0.4.44](https://github.com/sonarwatch/portfolio/compare/core-0.4.43...core-0.4.44) (2023-07-16)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## [0.4.43](https://github.com/sonarwatch/portfolio/compare/core-0.4.42...core-0.4.43) (2023-07-16)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## [0.4.42](https://github.com/sonarwatch/portfolio/compare/core-0.4.41...core-0.4.42) (2023-07-16)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## [0.4.41](https://github.com/sonarwatch/portfolio/compare/core-0.4.40...core-0.4.41) (2023-07-16)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## [0.4.40](https://github.com/sonarwatch/portfolio/compare/core-0.4.39...core-0.4.40) (2023-07-16)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## [0.4.39](https://github.com/sonarwatch/portfolio/compare/core-0.4.38...core-0.4.39) (2023-07-16)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## [0.4.38](https://github.com/sonarwatch/portfolio/compare/core-0.4.37...core-0.4.38) (2023-07-16)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## [0.4.37](https://github.com/sonarwatch/portfolio/compare/core-0.4.36...core-0.4.37) (2023-07-16)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## [0.4.36](https://github.com/sonarwatch/portfolio/compare/core-0.4.35...core-0.4.36) (2023-07-16)
|
|
5
|
+
## [0.4.49](https://github.com/sonarwatch/portfolio/compare/core-0.4.48...core-0.4.49) (2023-07-19)
|
|
50
6
|
|
|
51
7
|
|
|
52
8
|
|
|
9
|
+
## [0.4.48](https://github.com/sonarwatch/portfolio/compare/core-0.4.47...core-0.4.48) (2023-07-18)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [0.4.47](https://github.com/sonarwatch/portfolio/compare/core-0.4.46...core-0.4.47) (2023-07-17)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.4.46](https://github.com/sonarwatch/portfolio/compare/core-0.4.45...core-0.4.46) (2023-07-17)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## [0.4.45](https://github.com/sonarwatch/portfolio/compare/core-0.4.44...core-0.4.45) (2023-07-16)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [0.4.44](https://github.com/sonarwatch/portfolio/compare/core-0.4.43...core-0.4.44) (2023-07-16)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [0.4.43](https://github.com/sonarwatch/portfolio/compare/core-0.4.42...core-0.4.43) (2023-07-16)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [0.4.42](https://github.com/sonarwatch/portfolio/compare/core-0.4.41...core-0.4.42) (2023-07-16)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [0.4.41](https://github.com/sonarwatch/portfolio/compare/core-0.4.40...core-0.4.41) (2023-07-16)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [0.4.40](https://github.com/sonarwatch/portfolio/compare/core-0.4.39...core-0.4.40) (2023-07-16)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## [0.4.39](https://github.com/sonarwatch/portfolio/compare/core-0.4.38...core-0.4.39) (2023-07-16)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## [0.4.38](https://github.com/sonarwatch/portfolio/compare/core-0.4.37...core-0.4.38) (2023-07-16)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [0.4.37](https://github.com/sonarwatch/portfolio/compare/core-0.4.36...core-0.4.37) (2023-07-16)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## [0.4.36](https://github.com/sonarwatch/portfolio/compare/core-0.4.35...core-0.4.36) (2023-07-16)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
53
61
|
## [0.4.35](https://github.com/sonarwatch/portfolio/compare/core-0.4.34...core-0.4.35) (2023-07-14)
|
|
54
62
|
|
|
55
63
|
|
package/package.json
CHANGED
package/src/Fetcher.d.ts
CHANGED
|
@@ -12,17 +12,21 @@ export type FetcherResult = {
|
|
|
12
12
|
owner: string;
|
|
13
13
|
fetcherId: string;
|
|
14
14
|
networdkId: NetworkIdType;
|
|
15
|
-
elements: PortfolioElement[];
|
|
16
15
|
duration: number;
|
|
16
|
+
elements: PortfolioElement[];
|
|
17
|
+
};
|
|
18
|
+
export type FetcherReport = {
|
|
19
|
+
id: string;
|
|
20
|
+
status: 'succeeded' | 'failed';
|
|
21
|
+
duration?: number;
|
|
22
|
+
error?: string;
|
|
17
23
|
};
|
|
18
24
|
export type FetchersResult = {
|
|
25
|
+
date: number;
|
|
19
26
|
owner: string;
|
|
20
27
|
addressSystem: AddressSystemType;
|
|
21
|
-
|
|
22
|
-
succeededFetcherIds: string[];
|
|
23
|
-
failedFetcherIds: string[];
|
|
28
|
+
fetcherReports: FetcherReport[];
|
|
24
29
|
elements: PortfolioElement[];
|
|
25
|
-
errors: Record<string, string>;
|
|
26
30
|
};
|
|
27
31
|
export declare function runFetchers(owner: string, addressSystem: AddressSystemType, fetchers: Fetcher[], cache: Cache): Promise<FetchersResult>;
|
|
28
32
|
export declare function runFetchersByNetworkId(owner: string, networkId: NetworkIdType, fetchers: Fetcher[], cache: Cache): Promise<FetchersResult>;
|
package/src/Fetcher.js
CHANGED
|
@@ -18,30 +18,38 @@ function runFetchers(owner, addressSystem, fetchers, cache) {
|
|
|
18
18
|
const isFetchersValids = fetchers.every((f) => constants_1.networks[f.networkId].addressSystem === addressSystem);
|
|
19
19
|
if (!isFetchersValids)
|
|
20
20
|
throw new Error(`Not all fetchers have the right address system: ${addressSystem}`);
|
|
21
|
-
const promises = fetchers.map((f) =>
|
|
21
|
+
const promises = fetchers.map((f) => runFetcher(fOwner, f, cache));
|
|
22
22
|
const result = yield Promise.allSettled(promises);
|
|
23
|
-
const
|
|
24
|
-
const succeededFetcherIds = [];
|
|
25
|
-
const errors = {};
|
|
23
|
+
const fReports = [];
|
|
26
24
|
const elements = result.flatMap((r, index) => {
|
|
27
|
-
|
|
28
|
-
if (r.status === '
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
let fReport;
|
|
26
|
+
if (r.status === 'fulfilled') {
|
|
27
|
+
fReport = {
|
|
28
|
+
id: fetchers[index].id,
|
|
29
|
+
status: 'succeeded',
|
|
30
|
+
duration: r.value.duration,
|
|
31
|
+
error: undefined,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
fReport = {
|
|
36
|
+
id: fetchers[index].id,
|
|
37
|
+
status: 'failed',
|
|
38
|
+
duration: undefined,
|
|
39
|
+
error: r.reason.message || 'Unknown error',
|
|
40
|
+
};
|
|
32
41
|
}
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
fReports.push(fReport);
|
|
43
|
+
if (r.status === 'rejected')
|
|
44
|
+
return [];
|
|
45
|
+
return r.value.elements;
|
|
35
46
|
});
|
|
36
|
-
const fetcherIds = failedFetcherIds.concat(succeededFetcherIds);
|
|
37
47
|
return {
|
|
48
|
+
date: Date.now(),
|
|
38
49
|
owner: fOwner,
|
|
39
50
|
addressSystem,
|
|
40
|
-
|
|
41
|
-
succeededFetcherIds,
|
|
42
|
-
failedFetcherIds,
|
|
51
|
+
fetcherReports: fReports,
|
|
43
52
|
elements,
|
|
44
|
-
errors,
|
|
45
53
|
};
|
|
46
54
|
});
|
|
47
55
|
}
|
|
@@ -65,8 +73,8 @@ function runFetcher(owner, fetcher, cache) {
|
|
|
65
73
|
owner: fOwner,
|
|
66
74
|
fetcherId: fetcher.id,
|
|
67
75
|
networdkId: fetcher.networkId,
|
|
68
|
-
elements,
|
|
69
76
|
duration: Date.now() - startDate,
|
|
77
|
+
elements,
|
|
70
78
|
};
|
|
71
79
|
});
|
|
72
80
|
}
|
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,mCAAkE;
|
|
1
|
+
{"version":3,"file":"Fetcher.js","sourceRoot":"","sources":["../../../../packages/core/src/Fetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,2CAAuC;AACvC,mCAAkE;AAoClE,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,C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