@cieloazul310/jclub-financial-utils 0.0.1-alpha.0

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.
Files changed (100) hide show
  1. package/.turbo/turbo-build.log +93 -0
  2. package/CHANGELOG.md +7 -0
  3. package/__tests__/club.test.ts +40 -0
  4. package/__tests__/dictionary.test.ts +26 -0
  5. package/__tests__/years.test.ts +11 -0
  6. package/clubs.yml +850 -0
  7. package/dictionary.yml +69 -0
  8. package/dist/all-fields.cjs +96 -0
  9. package/dist/all-fields.d.cts +14 -0
  10. package/dist/all-fields.d.cts.map +1 -0
  11. package/dist/all-fields.d.mts +14 -0
  12. package/dist/all-fields.d.mts.map +1 -0
  13. package/dist/all-fields.mjs +89 -0
  14. package/dist/all-fields.mjs.map +1 -0
  15. package/dist/club-CCls7mTR.mjs +1 -0
  16. package/dist/club-CYJ2Any-.cjs +0 -0
  17. package/dist/club-CcV6Gouv.d.mts +20 -0
  18. package/dist/club-CcV6Gouv.d.mts.map +1 -0
  19. package/dist/club-DConAzRZ.d.cts +20 -0
  20. package/dist/club-DConAzRZ.d.cts.map +1 -0
  21. package/dist/clubs-B6WFNimH.cjs +910 -0
  22. package/dist/clubs-BF9Y0ITz.mjs +893 -0
  23. package/dist/clubs-BF9Y0ITz.mjs.map +1 -0
  24. package/dist/clubs.cjs +5 -0
  25. package/dist/clubs.d.cts +10 -0
  26. package/dist/clubs.d.cts.map +1 -0
  27. package/dist/clubs.d.mts +10 -0
  28. package/dist/clubs.d.mts.map +1 -0
  29. package/dist/clubs.mjs +3 -0
  30. package/dist/data-BI1o8Mn-.mjs +1 -0
  31. package/dist/data-B_nPtYBn.cjs +0 -0
  32. package/dist/data-Bs9dSa_0.d.cts +158 -0
  33. package/dist/data-Bs9dSa_0.d.cts.map +1 -0
  34. package/dist/data-c1kTjXyV.d.mts +158 -0
  35. package/dist/data-c1kTjXyV.d.mts.map +1 -0
  36. package/dist/dictionary-BzN32kPK.cjs +113 -0
  37. package/dist/dictionary-LXXa4AIA.mjs +102 -0
  38. package/dist/dictionary-LXXa4AIA.mjs.map +1 -0
  39. package/dist/dictionary.cjs +4 -0
  40. package/dist/dictionary.d.cts +26 -0
  41. package/dist/dictionary.d.cts.map +1 -0
  42. package/dist/dictionary.d.mts +26 -0
  43. package/dist/dictionary.d.mts.map +1 -0
  44. package/dist/dictionary.mjs +3 -0
  45. package/dist/index.cjs +20 -0
  46. package/dist/index.d.cts +9 -0
  47. package/dist/index.d.mts +9 -0
  48. package/dist/index.mjs +7 -0
  49. package/dist/types/club.cjs +0 -0
  50. package/dist/types/club.d.cts +2 -0
  51. package/dist/types/club.d.mts +2 -0
  52. package/dist/types/club.mjs +1 -0
  53. package/dist/types/data.cjs +0 -0
  54. package/dist/types/data.d.cts +2 -0
  55. package/dist/types/data.d.mts +2 -0
  56. package/dist/types/data.mjs +1 -0
  57. package/dist/types/index.cjs +0 -0
  58. package/dist/types/index.d.cts +4 -0
  59. package/dist/types/index.d.mts +4 -0
  60. package/dist/types/index.mjs +1 -0
  61. package/dist/types/year.cjs +0 -0
  62. package/dist/types/year.d.cts +2 -0
  63. package/dist/types/year.d.mts +2 -0
  64. package/dist/types/year.mjs +1 -0
  65. package/dist/year-0HxxyYb_.mjs +1 -0
  66. package/dist/year-C02MQex_.d.mts +9 -0
  67. package/dist/year-C02MQex_.d.mts.map +1 -0
  68. package/dist/year-CSrJssAF.d.cts +9 -0
  69. package/dist/year-CSrJssAF.d.cts.map +1 -0
  70. package/dist/year-dUgWR1aM.cjs +0 -0
  71. package/dist/years-6Ii8ZNVQ.mjs +157 -0
  72. package/dist/years-6Ii8ZNVQ.mjs.map +1 -0
  73. package/dist/years-DRN0nquf.cjs +162 -0
  74. package/dist/years.cjs +3 -0
  75. package/dist/years.d.cts +8 -0
  76. package/dist/years.d.cts.map +1 -0
  77. package/dist/years.d.mts +8 -0
  78. package/dist/years.d.mts.map +1 -0
  79. package/dist/years.mjs +3 -0
  80. package/eslint.config.mjs +4 -0
  81. package/package.json +66 -0
  82. package/scripts/build-clubs.ts +18 -0
  83. package/scripts/build-dictionary.ts +18 -0
  84. package/scripts/build-years.ts +18 -0
  85. package/scripts/build.ts +21 -0
  86. package/src/all-fields.ts +100 -0
  87. package/src/clubs.ts +20 -0
  88. package/src/data/clubs.json +949 -0
  89. package/src/data/dictionary.json +71 -0
  90. package/src/data/years.json +173 -0
  91. package/src/dictionary.ts +39 -0
  92. package/src/index.ts +5 -0
  93. package/src/types/club.ts +16 -0
  94. package/src/types/data.ts +161 -0
  95. package/src/types/index.ts +3 -0
  96. package/src/types/year.ts +5 -0
  97. package/src/years.ts +6 -0
  98. package/tsconfig.json +4 -0
  99. package/tsdown.config.ts +15 -0
  100. package/years.yml +111 -0
@@ -0,0 +1,100 @@
1
+ import type {
2
+ General,
3
+ SeasonResult,
4
+ PL,
5
+ BS,
6
+ Revenue,
7
+ Expense,
8
+ Attd,
9
+ FinancialDatum,
10
+ } from "./types/data";
11
+
12
+ export const generalFields: (keyof General | keyof SeasonResult)[] = [
13
+ "fullname",
14
+ "license",
15
+ "rank",
16
+ "points",
17
+ "ppg",
18
+ "elevation",
19
+ ];
20
+
21
+ export const plFields: (keyof PL)[] = [
22
+ "revenue",
23
+ "expense",
24
+ "op_profit",
25
+ "no_rev",
26
+ "no_exp",
27
+ "ordinary_profit",
28
+ "sp_rev",
29
+ "sp_exp",
30
+ "profit_before_tax",
31
+ "tax",
32
+ "profit",
33
+ "related_revenue",
34
+ ];
35
+ export const bsFields: (keyof BS)[] = [
36
+ "assets",
37
+ "curr_assets",
38
+ "fixed_assets",
39
+ "liabilities",
40
+ "curr_liabilities",
41
+ "fixed_liabilities",
42
+ "net_worth",
43
+ "capital_stock",
44
+ "capital_surplus",
45
+ "retained_earnings",
46
+ ];
47
+ export const revenueFields: (keyof Revenue)[] = [
48
+ "sponsor",
49
+ "ticket",
50
+ "broadcast",
51
+ "academy_rev",
52
+ "women_rev",
53
+ "goods_rev",
54
+ "transfer_rev",
55
+ "transfer_int_rev",
56
+ "transfer_dom_rev",
57
+ "other_revs",
58
+ ];
59
+ export const expenseFields: (keyof Expense)[] = [
60
+ "salary",
61
+ "transfer_exp",
62
+ "transfer_int_exp",
63
+ "transfer_dom_exp",
64
+ "game_exp",
65
+ "team_exp",
66
+ "academy_exp",
67
+ "women_exp",
68
+ "goods_exp",
69
+ "other_cost",
70
+ "manage_exp",
71
+ "sga",
72
+ ];
73
+ export const attdFields: (keyof Attd)[] = [
74
+ "all_attd",
75
+ "all_games",
76
+ "average_attd",
77
+ "unit_price",
78
+ "league_attd",
79
+ "league_games",
80
+ "leaguecup_attd",
81
+ "leaguecup_games",
82
+ "po_attd",
83
+ "po_games",
84
+ "acl_attd",
85
+ "acl_games",
86
+ "second_attd",
87
+ "second_games",
88
+ ];
89
+
90
+ export const allSortableFields = [
91
+ ...plFields,
92
+ ...bsFields,
93
+ ...revenueFields,
94
+ ...expenseFields,
95
+ ...attdFields,
96
+ ];
97
+ export const allFields: (keyof FinancialDatum)[] = [
98
+ ...generalFields,
99
+ ...allSortableFields,
100
+ ];
package/src/clubs.ts ADDED
@@ -0,0 +1,20 @@
1
+ import type { ClubInfo } from "./types";
2
+ import clubs from "./data/clubs.json";
3
+
4
+ export function getAllClubs() {
5
+ return clubs as ClubInfo[];
6
+ }
7
+
8
+ export function getClubBySlug(slug: string) {
9
+ const clubs = getAllClubs();
10
+ return clubs.find((club) => club.slug === slug);
11
+ }
12
+
13
+ export function getClubsByCategory(category: string) {
14
+ const clubs = getAllClubs();
15
+ return clubs.filter((club) =>
16
+ ["J1", "J2", "J3"].includes(category)
17
+ ? club.category === category
18
+ : ["JFL"].includes(club.category),
19
+ );
20
+ }