@cieloazul310/jclub-financial-data 0.0.1-alpha.2 → 0.0.1-alpha.3
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/dist/index.cjs +12 -3
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +10 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
let fs_promises = require("fs/promises");
|
|
2
2
|
let path = require("path");
|
|
3
|
+
let _cieloazul310_jclub_financial_utils = require("@cieloazul310/jclub-financial-utils");
|
|
3
4
|
|
|
4
5
|
//#region src/index.ts
|
|
5
6
|
const base = (0, path.resolve)(__dirname);
|
|
@@ -10,7 +11,7 @@ async function loadJsonSync(file) {
|
|
|
10
11
|
return null;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
|
-
const clubs =
|
|
14
|
+
const clubs = (0, _cieloazul310_jclub_financial_utils.getAllClubs)().map(({ slug }) => slug);
|
|
14
15
|
async function getDataByClub(club) {
|
|
15
16
|
const dir = (0, path.join)(base, club);
|
|
16
17
|
try {
|
|
@@ -21,14 +22,20 @@ async function getDataByClub(club) {
|
|
|
21
22
|
return [];
|
|
22
23
|
}
|
|
23
24
|
}
|
|
25
|
+
async function getExtendedDataByClub(club) {
|
|
26
|
+
return (0, _cieloazul310_jclub_financial_utils.extendClubData)(await getDataByClub(club));
|
|
27
|
+
}
|
|
24
28
|
async function getDataByYear(year) {
|
|
25
29
|
const output = [];
|
|
26
|
-
for (const club of
|
|
30
|
+
for (const club of clubs) {
|
|
27
31
|
const item = await loadJsonSync((0, path.join)(base, club, String(year) + ".json"));
|
|
28
32
|
if (item) output.push(item);
|
|
29
33
|
}
|
|
30
34
|
return output;
|
|
31
35
|
}
|
|
36
|
+
async function getExtendedDataByYear(year) {
|
|
37
|
+
return (0, _cieloazul310_jclub_financial_utils.extendYearData)(await getDataByYear(year), await getDataByYear(year - 1));
|
|
38
|
+
}
|
|
32
39
|
async function getDatum(club, year) {
|
|
33
40
|
return await loadJsonSync((0, path.join)(base, club, String(year) + ".json"));
|
|
34
41
|
}
|
|
@@ -37,4 +44,6 @@ async function getDatum(club, year) {
|
|
|
37
44
|
exports.clubs = clubs;
|
|
38
45
|
exports.getDataByClub = getDataByClub;
|
|
39
46
|
exports.getDataByYear = getDataByYear;
|
|
40
|
-
exports.getDatum = getDatum;
|
|
47
|
+
exports.getDatum = getDatum;
|
|
48
|
+
exports.getExtendedDataByClub = getExtendedDataByClub;
|
|
49
|
+
exports.getExtendedDataByYear = getExtendedDataByYear;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { FinancialDatum } from "@cieloazul310/jclub-financial-utils/types";
|
|
1
|
+
import { ExtendedFinancialDatum, FinancialDatum } from "@cieloazul310/jclub-financial-utils/types";
|
|
2
2
|
|
|
3
3
|
//#region src/index.d.ts
|
|
4
4
|
declare const clubs: string[];
|
|
5
5
|
declare function getDataByClub(club: string): Promise<FinancialDatum[]>;
|
|
6
|
+
declare function getExtendedDataByClub(club: string): Promise<ExtendedFinancialDatum[]>;
|
|
6
7
|
declare function getDataByYear(year: number): Promise<FinancialDatum[]>;
|
|
8
|
+
declare function getExtendedDataByYear(year: number): Promise<ExtendedFinancialDatum[]>;
|
|
7
9
|
declare function getDatum(club: string, year: number): Promise<FinancialDatum | null>;
|
|
8
10
|
//#endregion
|
|
9
|
-
export { clubs, getDataByClub, getDataByYear, getDatum };
|
|
11
|
+
export { clubs, getDataByClub, getDataByYear, getDatum, getExtendedDataByClub, getExtendedDataByYear };
|
|
10
12
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { readFile, readdir } from "fs/promises";
|
|
4
4
|
import { join, resolve } from "path";
|
|
5
|
+
import { extendClubData, extendYearData, getAllClubs } from "@cieloazul310/jclub-financial-utils";
|
|
5
6
|
|
|
6
7
|
//#region ../../node_modules/tsdown/esm-shims.js
|
|
7
8
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -18,7 +19,7 @@ async function loadJsonSync(file) {
|
|
|
18
19
|
return null;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
const clubs =
|
|
22
|
+
const clubs = getAllClubs().map(({ slug }) => slug);
|
|
22
23
|
async function getDataByClub(club) {
|
|
23
24
|
const dir = join(base, club);
|
|
24
25
|
try {
|
|
@@ -29,18 +30,24 @@ async function getDataByClub(club) {
|
|
|
29
30
|
return [];
|
|
30
31
|
}
|
|
31
32
|
}
|
|
33
|
+
async function getExtendedDataByClub(club) {
|
|
34
|
+
return extendClubData(await getDataByClub(club));
|
|
35
|
+
}
|
|
32
36
|
async function getDataByYear(year) {
|
|
33
37
|
const output = [];
|
|
34
|
-
for (const club of
|
|
38
|
+
for (const club of clubs) {
|
|
35
39
|
const item = await loadJsonSync(join(base, club, String(year) + ".json"));
|
|
36
40
|
if (item) output.push(item);
|
|
37
41
|
}
|
|
38
42
|
return output;
|
|
39
43
|
}
|
|
44
|
+
async function getExtendedDataByYear(year) {
|
|
45
|
+
return extendYearData(await getDataByYear(year), await getDataByYear(year - 1));
|
|
46
|
+
}
|
|
40
47
|
async function getDatum(club, year) {
|
|
41
48
|
return await loadJsonSync(join(base, club, String(year) + ".json"));
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
//#endregion
|
|
45
|
-
export { clubs, getDataByClub, getDataByYear, getDatum };
|
|
52
|
+
export { clubs, getDataByClub, getDataByYear, getDatum, getExtendedDataByClub, getExtendedDataByYear };
|
|
46
53
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cieloazul310/jclub-financial-data",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/cieloazul310/jclub-financial-table",
|
|
6
6
|
"author": {
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"build:types": "tsx ./scripts/build-types.ts"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@cieloazul310/jclub-financial-utils": "^0.0.1-alpha.
|
|
68
|
+
"@cieloazul310/jclub-financial-utils": "^0.0.1-alpha.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@repo/eslint-config": "^0.0.1-alpha.
|
|
72
|
-
"@repo/typescript-config": "^0.0.1-alpha.
|
|
71
|
+
"@repo/eslint-config": "^0.0.1-alpha.3",
|
|
72
|
+
"@repo/typescript-config": "^0.0.1-alpha.3",
|
|
73
73
|
"@types/node": "^24.9.1",
|
|
74
74
|
"eslint": "^9.34.0",
|
|
75
75
|
"tsdown": "^0.18.2",
|