@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,71 @@
1
+ {
2
+ "name": "クラブ",
3
+ "fullname": "呼称",
4
+ "id": "id",
5
+ "year": "年",
6
+ "category": "所属",
7
+ "license": "ライセンス",
8
+ "revenue": "営業収入",
9
+ "sponsor": "スポンサー収入",
10
+ "ticket": "入場料収入",
11
+ "broadcast": "Jリーグ配分金",
12
+ "academy_rev": "アカデミー関連収入",
13
+ "women_rev": "女子チーム関連収入",
14
+ "goods_rev": "物販収入",
15
+ "transfer_rev": "移籍補償金等収入",
16
+ "transfer_int_rev": "国外クラブからの収入",
17
+ "transfer_dom_rev": "国内クラブからの収入",
18
+ "other_revs": "その他収入",
19
+ "expense": "営業費用",
20
+ "salary": "チーム人件費",
21
+ "transfer_exp": "移籍関連費用",
22
+ "transfer_int_exp": "国外クラブからの移籍に関する費用",
23
+ "transfer_dom_exp": "国内クラブからの移籍に関する費用",
24
+ "manage_exp": "事業費",
25
+ "general_exp": "総事業費",
26
+ "game_exp": "試合関連経費",
27
+ "team_exp": "トップチーム運営経費",
28
+ "academy_exp": "アカデミー運営経費",
29
+ "women_exp": "女子チーム運営経費",
30
+ "goods_exp": "物販関連費",
31
+ "other_cost": "その他売上原価",
32
+ "sga": "販売費および一般管理費",
33
+ "op_profit": "営業利益",
34
+ "no_rev": "営業外収益",
35
+ "no_exp": "営業外費用",
36
+ "ordinary_profit": "経常利益",
37
+ "sp_rev": "特別利益",
38
+ "sp_exp": "特別損失",
39
+ "profit_before_tax": "税引前当期利益",
40
+ "related_revenue": "関連する法人の営業収入",
41
+ "tax": "法人税および住民税等",
42
+ "profit": "当期純利益",
43
+ "curr_assets": "流動資産",
44
+ "fixed_assets": "固定資産等",
45
+ "assets": "総資産(資産の部)",
46
+ "curr_liabilities": "流動負債",
47
+ "fixed_liabilities": "固定負債",
48
+ "liabilities": "総負債(負債の部)",
49
+ "capital_stock": "資本金",
50
+ "capital_surplus": "資本剰余金等",
51
+ "retained_earnings": "利益剰余金",
52
+ "net_worth": "純資産(純資産の部)",
53
+ "rank": "順位",
54
+ "points": "勝ち点",
55
+ "ppg": "PPG",
56
+ "elevation": "昇降格",
57
+ "league_attd": "リーグ戦入場者数",
58
+ "league_games": "リーグ戦ホーム試合数",
59
+ "leaguecup_attd": "リーグカップ入場者数",
60
+ "leaguecup_games": "リーグカップホーム試合数",
61
+ "po_attd": "PO入場者数",
62
+ "po_games": "POホーム試合数",
63
+ "acl_attd": "ACL入場者数",
64
+ "acl_games": "ACLホーム試合数",
65
+ "second_attd": "セカンドチーム入場者数",
66
+ "second_games": "セカンドチームホーム試合数",
67
+ "all_attd": "年間総入場者数",
68
+ "all_games": "年間ホーム試合数",
69
+ "average_attd": "リーグ戦平均入場者数",
70
+ "unit_price": "客単価"
71
+ }
@@ -0,0 +1,173 @@
1
+ [
2
+ {
3
+ "id": "2005",
4
+ "year": 2005,
5
+ "categories": [
6
+ "J1",
7
+ "J2"
8
+ ]
9
+ },
10
+ {
11
+ "id": "2006",
12
+ "year": 2006,
13
+ "categories": [
14
+ "J1",
15
+ "J2"
16
+ ]
17
+ },
18
+ {
19
+ "id": "2007",
20
+ "year": 2007,
21
+ "categories": [
22
+ "J1",
23
+ "J2"
24
+ ]
25
+ },
26
+ {
27
+ "id": "2008",
28
+ "year": 2008,
29
+ "categories": [
30
+ "J1",
31
+ "J2"
32
+ ]
33
+ },
34
+ {
35
+ "id": "2009",
36
+ "year": 2009,
37
+ "categories": [
38
+ "J1",
39
+ "J2"
40
+ ]
41
+ },
42
+ {
43
+ "id": "2010",
44
+ "year": 2010,
45
+ "categories": [
46
+ "J1",
47
+ "J2"
48
+ ]
49
+ },
50
+ {
51
+ "id": "2011",
52
+ "year": 2011,
53
+ "categories": [
54
+ "J1",
55
+ "J2"
56
+ ]
57
+ },
58
+ {
59
+ "id": "2012",
60
+ "year": 2012,
61
+ "categories": [
62
+ "J1",
63
+ "J2"
64
+ ]
65
+ },
66
+ {
67
+ "id": "2013",
68
+ "year": 2013,
69
+ "categories": [
70
+ "J1",
71
+ "J2"
72
+ ]
73
+ },
74
+ {
75
+ "id": "2014",
76
+ "year": 2014,
77
+ "categories": [
78
+ "J1",
79
+ "J2",
80
+ "J3"
81
+ ]
82
+ },
83
+ {
84
+ "id": "2015",
85
+ "year": 2015,
86
+ "categories": [
87
+ "J1",
88
+ "J2",
89
+ "J3"
90
+ ]
91
+ },
92
+ {
93
+ "id": "2016",
94
+ "year": 2016,
95
+ "categories": [
96
+ "J1",
97
+ "J2",
98
+ "J3"
99
+ ]
100
+ },
101
+ {
102
+ "id": "2017",
103
+ "year": 2017,
104
+ "categories": [
105
+ "J1",
106
+ "J2",
107
+ "J3"
108
+ ]
109
+ },
110
+ {
111
+ "id": "2018",
112
+ "year": 2018,
113
+ "categories": [
114
+ "J1",
115
+ "J2",
116
+ "J3"
117
+ ]
118
+ },
119
+ {
120
+ "id": "2019",
121
+ "year": 2019,
122
+ "categories": [
123
+ "J1",
124
+ "J2",
125
+ "J3"
126
+ ]
127
+ },
128
+ {
129
+ "id": "2020",
130
+ "year": 2020,
131
+ "categories": [
132
+ "J1",
133
+ "J2",
134
+ "J3"
135
+ ]
136
+ },
137
+ {
138
+ "id": "2021",
139
+ "year": 2021,
140
+ "categories": [
141
+ "J1",
142
+ "J2",
143
+ "J3"
144
+ ]
145
+ },
146
+ {
147
+ "id": "2022",
148
+ "year": 2022,
149
+ "categories": [
150
+ "J1",
151
+ "J2",
152
+ "J3"
153
+ ]
154
+ },
155
+ {
156
+ "id": "2023",
157
+ "year": 2023,
158
+ "categories": [
159
+ "J1",
160
+ "J2",
161
+ "J3"
162
+ ]
163
+ },
164
+ {
165
+ "id": "2024",
166
+ "year": 2024,
167
+ "categories": [
168
+ "J1",
169
+ "J2",
170
+ "J3"
171
+ ]
172
+ }
173
+ ]
@@ -0,0 +1,39 @@
1
+ import type { FinancialDatum } from "./types";
2
+ import dictionary from "./data/dictionary.json";
3
+
4
+ const has = Object.prototype.hasOwnProperty;
5
+
6
+ function isDirectoryKey(
7
+ key: string,
8
+ ): key is keyof Omit<FinancialDatum, "slug"> {
9
+ return has.call(dictionary, key);
10
+ }
11
+
12
+ /**
13
+ * プロパティ名から日本語ラベルを取得する
14
+ * @param key FinancialDatum のプロパティ名
15
+ * @returns 日本語ラベル。未定義のキーの場合はキー名をそのまま返す
16
+ */
17
+ export function getLabel(key: string): string {
18
+ if (isDirectoryKey(key)) return dictionary[key];
19
+ return key;
20
+ }
21
+
22
+ /**
23
+ * プロパティ名から日本語ラベルを取得する(オプションつき)
24
+ * @param key FinancialDatum のプロパティ名
25
+ * @param options fallback や後処理のオプション
26
+ * @returns 日本語ラベル
27
+ */
28
+ export function getLabelWithOptions(
29
+ key: keyof Omit<FinancialDatum, "slug">,
30
+ options?: {
31
+ /** キーが未定義の場合のフォールバック。省略時はキー名を返す */
32
+ fallback?: string;
33
+ /** ラベルに対する後処理 */
34
+ transform?: (label: string) => string;
35
+ },
36
+ ): string {
37
+ const label = dictionary[key] ?? options?.fallback ?? key;
38
+ return options?.transform ? options.transform(label) : label;
39
+ }
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./all-fields";
2
+ export * from "./clubs";
3
+ export * from "./dictionary";
4
+ export * from "./years";
5
+ export * from "./types";
@@ -0,0 +1,16 @@
1
+ export type ClubInfo = {
2
+ id: string;
3
+ slug: string;
4
+ name: string;
5
+ fullname: string;
6
+ short_name: string;
7
+ company: string;
8
+ category: string;
9
+ hometown: string;
10
+ area?: string | null;
11
+ period: number;
12
+ website: string | null;
13
+ settlement?: string | null;
14
+ relatedCompanies?: string[] | null;
15
+ annotation?: string[] | null;
16
+ };
@@ -0,0 +1,161 @@
1
+ export type General = {
2
+ id: string;
3
+ name: string;
4
+ slug: string;
5
+ fullname: string;
6
+ year: number;
7
+ category: string;
8
+ license: string | null;
9
+ };
10
+ export type SeasonResult = {
11
+ rank: number;
12
+ points: number;
13
+ ppg: number;
14
+ elevation: "昇格" | "降格" | null;
15
+ };
16
+ export type PL = {
17
+ /** 営業収入 */
18
+ revenue: number;
19
+ /** 営業費用 */
20
+ expense: number;
21
+ /** 営業利益 */
22
+ op_profit: number;
23
+ /** 営業外収入 */
24
+ no_rev: number | null;
25
+ /** 営業外費用 */
26
+ no_exp: number | null;
27
+ /** 経常利益 */
28
+ ordinary_profit: number;
29
+ /** 特別利益 */
30
+ sp_rev: number | null;
31
+ /** 特別損失 */
32
+ sp_exp: number | null;
33
+ /** 税引前当期利益 */
34
+ profit_before_tax: number | null;
35
+ /** 法人税および住民税等 */
36
+ tax: number | null;
37
+ /** 当期純利益 */
38
+ profit: number;
39
+ /** 関連する法人の営業収入 */
40
+ related_revenue: number | null;
41
+ };
42
+ export type BS = {
43
+ /** 流動資産 */
44
+ curr_assets: number | null;
45
+ /** 固定資産等 */
46
+ fixed_assets: number | null;
47
+ /** 総資産 */
48
+ assets: number | null;
49
+ /** 流動負債 */
50
+ curr_liabilities: number | null;
51
+ /** 固定負債 */
52
+ fixed_liabilities: number | null;
53
+ /** 総負債 */
54
+ liabilities: number | null;
55
+ /** 純資産 */
56
+ net_worth: number | null;
57
+ /** 資本金 */
58
+ capital_stock: number | null;
59
+ /** 資本剰余金 */
60
+ capital_surplus: number | null;
61
+ /** 利益剰余金 */
62
+ retained_earnings: number | null;
63
+ /** 当期純利益 */
64
+ profit: number;
65
+ };
66
+ export type Revenue = {
67
+ /** 営業収入 */
68
+ revenue: number;
69
+ /** 広告料収入 */
70
+ sponsor: number | null;
71
+ /** 入場料収入 */
72
+ ticket: number | null;
73
+ /** Jリーグ配分金 */
74
+ broadcast: number | null;
75
+ /** アカデミー関連収入 */
76
+ academy_rev: number | null;
77
+ /** 女子チーム関連収入 */
78
+ women_rev: number | null;
79
+ /** 物販収入 */
80
+ goods_rev: number | null;
81
+ /** 移籍補償金等収入 */
82
+ transfer_rev: number | null;
83
+ /** 国外クラブからの収入 */
84
+ transfer_int_rev: number | null;
85
+ /** 国内クラブからの収入 */
86
+ transfer_dom_rev: number | null;
87
+ /** その他収入 */
88
+ other_revs: number | null;
89
+ /** 関連する法人の営業収入 */
90
+ related_revenue: number | null;
91
+ };
92
+ export type Expense = {
93
+ /** 営業費用 */
94
+ expense: number;
95
+ /** チーム人件費 */
96
+ salary: number | null;
97
+ /** 移籍関連費用 */
98
+ transfer_exp: number | null;
99
+ /** 国外クラブからの移籍に関する費用 */
100
+ transfer_int_exp: number | null;
101
+ /** 国内クラブからの移籍に関する費用 */
102
+ transfer_dom_exp: number | null;
103
+ /** 事業費 */
104
+ manage_exp: number | null;
105
+ /** 総事業費 */
106
+ general_exp: number | null;
107
+ /** 試合関連経費 */
108
+ game_exp: number | null;
109
+ /** トップチーム運営経費 */
110
+ team_exp: number | null;
111
+ /** アカデミー関連経費 */
112
+ academy_exp: number | null;
113
+ /** 女子チーム運営経費 */
114
+ women_exp: number | null;
115
+ /** 物販関連費 */
116
+ goods_exp: number | null;
117
+ /** その他売上原価 */
118
+ other_cost: number | null;
119
+ /** 販売費および一般管理費 */
120
+ sga: number | null;
121
+ };
122
+ export type Attd = {
123
+ /** 入場料収入 */
124
+ ticket: number | null;
125
+ /** リーグ戦入場者数 */
126
+ league_attd: number;
127
+ /** リーグ戦ホーム試合数 */
128
+ league_games: number;
129
+ /** リーグカップ入場者数 */
130
+ leaguecup_attd: number | null;
131
+ /** リーグカップホーム試合数 */
132
+ leaguecup_games: number | null;
133
+ /** PO入場者数 */
134
+ po_attd: number | null;
135
+ /** POホーム試合数 */
136
+ po_games: number | null;
137
+ /** ACL入場者数 */
138
+ acl_attd: number | null;
139
+ /** ACLホーム試合数 */
140
+ acl_games: number | null;
141
+ /** セカンドチーム入場者数 */
142
+ second_attd: number | null;
143
+ /** セカンドチームホーム試合数 */
144
+ second_games: number | null;
145
+ /** 総入場者数 */
146
+ all_attd: number;
147
+ /** ホーム総試合数 */
148
+ all_games: number;
149
+ /** リーグ戦平均入場者数 */
150
+ average_attd: number;
151
+ /** 客単価 */
152
+ unit_price: number | null;
153
+ };
154
+
155
+ export type FinancialDatum = General &
156
+ SeasonResult &
157
+ PL &
158
+ BS &
159
+ Revenue &
160
+ Expense &
161
+ Attd;
@@ -0,0 +1,3 @@
1
+ export * from "./club";
2
+ export * from "./data";
3
+ export * from "./year";
@@ -0,0 +1,5 @@
1
+ export type YearInfo = {
2
+ id: string;
3
+ year: number;
4
+ categories: ("J1" | "J2" | "J3")[];
5
+ };
package/src/years.ts ADDED
@@ -0,0 +1,6 @@
1
+ import type { YearInfo } from "./types";
2
+ import years from "./data/years.json";
3
+
4
+ export function getAllYears() {
5
+ return years as YearInfo[];
6
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "@repo/typescript-config/base.json",
3
+ "include": ["scripts", "src", "tsdown.config.ts", "__tests__"]
4
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/*", "src/types/*"],
5
+ format: {
6
+ esm: {
7
+ target: ["esnext"],
8
+ },
9
+ cjs: {
10
+ target: ["node22"],
11
+ },
12
+ },
13
+ clean: true,
14
+ dts: true,
15
+ });
package/years.yml ADDED
@@ -0,0 +1,111 @@
1
+ - id: "2005"
2
+ year: 2005
3
+ categories:
4
+ - J1
5
+ - J2
6
+ - id: "2006"
7
+ year: 2006
8
+ categories:
9
+ - J1
10
+ - J2
11
+ - id: "2007"
12
+ year: 2007
13
+ categories:
14
+ - J1
15
+ - J2
16
+ - id: "2008"
17
+ year: 2008
18
+ categories:
19
+ - J1
20
+ - J2
21
+ - id: "2009"
22
+ year: 2009
23
+ categories:
24
+ - J1
25
+ - J2
26
+ - id: "2010"
27
+ year: 2010
28
+ categories:
29
+ - J1
30
+ - J2
31
+ - id: "2011"
32
+ year: 2011
33
+ categories:
34
+ - J1
35
+ - J2
36
+ - id: "2012"
37
+ year: 2012
38
+ categories:
39
+ - J1
40
+ - J2
41
+ - id: "2013"
42
+ year: 2013
43
+ categories:
44
+ - J1
45
+ - J2
46
+ - id: "2014"
47
+ year: 2014
48
+ categories:
49
+ - J1
50
+ - J2
51
+ - J3
52
+ - id: "2015"
53
+ year: 2015
54
+ categories:
55
+ - J1
56
+ - J2
57
+ - J3
58
+ - id: "2016"
59
+ year: 2016
60
+ categories:
61
+ - J1
62
+ - J2
63
+ - J3
64
+ - id: "2017"
65
+ year: 2017
66
+ categories:
67
+ - J1
68
+ - J2
69
+ - J3
70
+ - id: "2018"
71
+ year: 2018
72
+ categories:
73
+ - J1
74
+ - J2
75
+ - J3
76
+ - id: "2019"
77
+ year: 2019
78
+ categories:
79
+ - J1
80
+ - J2
81
+ - J3
82
+ - id: "2020"
83
+ year: 2020
84
+ categories:
85
+ - J1
86
+ - J2
87
+ - J3
88
+ - id: "2021"
89
+ year: 2021
90
+ categories:
91
+ - J1
92
+ - J2
93
+ - J3
94
+ - id: "2022"
95
+ year: 2022
96
+ categories:
97
+ - J1
98
+ - J2
99
+ - J3
100
+ - id: "2023"
101
+ year: 2023
102
+ categories:
103
+ - J1
104
+ - J2
105
+ - J3
106
+ - id: "2024"
107
+ year: 2024
108
+ categories:
109
+ - J1
110
+ - J2
111
+ - J3