fnapi-js 1.0.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.
@@ -0,0 +1,251 @@
1
+ class CosmeticType {
2
+ static TYPES = {
3
+ CHARACTER: {
4
+ value: 'outfit',
5
+ backendValue: 'AthenaCharacter'
6
+ },
7
+ EMOTE: {
8
+ value: 'emote',
9
+ backendValue: 'AthenaDance'
10
+ },
11
+ WRAP: {
12
+ value: 'wrap',
13
+ backendValue: 'AthenaItemWrap'
14
+ },
15
+ EMOJI: {
16
+ value: 'emoji',
17
+ backendValue: 'AthenaEmoji'
18
+ },
19
+ GLIDER: {
20
+ value: 'glider',
21
+ backendValue: 'AthenaGlider'
22
+ },
23
+ SPRAY: {
24
+ value: 'spray',
25
+ backendValue: 'AthenaSpray'
26
+ },
27
+ LOADINGSCREEN: {
28
+ value: 'loadingscreen',
29
+ backendValue: 'AthenaLoadingScreen'
30
+ },
31
+ CONTRAIL: {
32
+ value: 'contrail',
33
+ backendValue: 'AthenaSkyDiveContrail'
34
+ },
35
+ SHOES: {
36
+ value: 'shoe',
37
+ backendValue: 'CosmeticShoes'
38
+ },
39
+ PICKAXE: {
40
+ value: 'pickaxe',
41
+ backendValue: 'AthenaPickaxe'
42
+ },
43
+ BACKPACK: {
44
+ value: 'backpack',
45
+ backendValue: 'AthenaBackpack'
46
+ },
47
+ VEHICLES_SKIN: {
48
+ value: 'skin',
49
+ backendValue: 'VehicleCosmetics_Skin'
50
+ },
51
+ MUSICPACK: {
52
+ value: 'lobby music',
53
+ backendValue: 'AthenaMusicPack'
54
+ },
55
+ VEHICLES_WHEEL: {
56
+ value: 'wheel',
57
+ backendValue: 'VehicleCosmetics_Wheel'
58
+ },
59
+ JUNOBUILDINGPROP: {
60
+ value: 'decor bundle',
61
+ backendValue: 'JunoBuildingProp'
62
+ },
63
+ VEHICLES_BOOSTER: {
64
+ value: 'turbo',
65
+ backendValue: 'VehicleCosmetics_Booster'
66
+ },
67
+ JUNOBUILDINGSET: {
68
+ value: 'build',
69
+ backendValue: 'JunoBuildingSet'
70
+ },
71
+ VEHICLES_DRIFTTRAIL: {
72
+ value: 'trail',
73
+ backendValue: 'VehicleCosmetics_DriftTrail'
74
+ },
75
+ SPARKSGUITAR: {
76
+ value: 'guitar',
77
+ backendValue: 'SparksGuitar'
78
+ },
79
+ VEHICLES_BODY: {
80
+ value: 'body',
81
+ backendValue: 'VehicleCosmetics_Body'
82
+ },
83
+ SPARKSBASS: {
84
+ value: 'bass',
85
+ backendValue: 'SparksBass'
86
+ },
87
+ SPARKSDRUM: {
88
+ value: 'drums',
89
+ backendValue: 'SparksDrum'
90
+ },
91
+ SPARKSMIC: {
92
+ value: 'microphone',
93
+ backendValue: 'SparksMic'
94
+ },
95
+ SPARKSKEYBOARD: {
96
+ value: 'keytar',
97
+ backendValue: 'SparksKeyboard'
98
+ },
99
+ SPARKSAURA: {
100
+ value: 'aura',
101
+ backendValue: 'SparksAura'
102
+ },
103
+ TOY: {
104
+ value: 'toy',
105
+ backendValue: 'AthenaToy'
106
+ },
107
+ PETCARRIER: {
108
+ value: 'pet',
109
+ backendValue: 'AthenaPetCarrier'
110
+ },
111
+ PET: {
112
+ value: 'pet',
113
+ backendValue: 'AthenaPet'
114
+ }
115
+ };
116
+
117
+ static outfit() {
118
+ return this.TYPES.CHARACTER.value;
119
+ }
120
+
121
+ static character() {
122
+ return this.TYPES.CHARACTER.value;
123
+ }
124
+
125
+ static emote() {
126
+ return this.TYPES.EMOTE.value;
127
+ }
128
+
129
+ static dance() {
130
+ return this.TYPES.EMOTE.value;
131
+ }
132
+
133
+ static wrap() {
134
+ return this.TYPES.WRAP.value;
135
+ }
136
+
137
+ static emoji() {
138
+ return this.TYPES.EMOJI.value;
139
+ }
140
+
141
+ static glider() {
142
+ return this.TYPES.GLIDER.value;
143
+ }
144
+
145
+ static spray() {
146
+ return this.TYPES.SPRAY.value;
147
+ }
148
+
149
+ static loadingscreen() {
150
+ return this.TYPES.LOADINGSCREEN.value;
151
+ }
152
+
153
+ static contrail() {
154
+ return this.TYPES.CONTRAIL.value;
155
+ }
156
+
157
+ static shoes() {
158
+ return this.TYPES.SHOES.value;
159
+ }
160
+
161
+ static pickaxe() {
162
+ return this.TYPES.PICKAXE.value;
163
+ }
164
+
165
+ static backpack() {
166
+ return this.TYPES.BACKPACK.value;
167
+ }
168
+
169
+ static vehicleskin() {
170
+ return this.TYPES.VEHICLES_SKIN.value;
171
+ }
172
+
173
+ static musicpack() {
174
+ return this.TYPES.MUSICPACK.value;
175
+ }
176
+
177
+ static vehiclewheel() {
178
+ return this.TYPES.VEHICLES_WHEEL.value;
179
+ }
180
+
181
+ static junobuildingprop() {
182
+ return this.TYPES.JUNOBUILDINGPROP.value;
183
+ }
184
+
185
+ static vehiclebooster() {
186
+ return this.TYPES.VEHICLES_BOOSTER.value;
187
+ }
188
+
189
+ static junobuildingset() {
190
+ return this.TYPES.JUNOBUILDINGSET.value;
191
+ }
192
+
193
+ static vehicledrifttrail() {
194
+ return this.TYPES.VEHICLES_DRIFTTRAIL.value;
195
+ }
196
+
197
+ static sparksguitar() {
198
+ return this.TYPES.SPARKSGUITAR.value;
199
+ }
200
+
201
+ static vehiclebody() {
202
+ return this.TYPES.VEHICLES_BODY.value;
203
+ }
204
+
205
+ static sparksbass() {
206
+ return this.TYPES.SPARKSBASS.value;
207
+ }
208
+
209
+ static sparksdrum() {
210
+ return this.TYPES.SPARKSDRUM.value;
211
+ }
212
+
213
+ static sparksmic() {
214
+ return this.TYPES.SPARKSMIC.value;
215
+ }
216
+
217
+ static sparkskeyboard() {
218
+ return this.TYPES.SPARKSKEYBOARD.value;
219
+ }
220
+
221
+ static sparksaura() {
222
+ return this.TYPES.SPARKSAURA.value;
223
+ }
224
+
225
+ static toy() {
226
+ return this.TYPES.TOY.value;
227
+ }
228
+
229
+ static petcarrier() {
230
+ return this.TYPES.PETCARRIER.value;
231
+ }
232
+
233
+ static pet() {
234
+ return this.TYPES.PET.value;
235
+ }
236
+
237
+ static getBackendValue(type) {
238
+ const found = Object.values(this.TYPES).find(t => t.value === type);
239
+ return found ? found.backendValue : null;
240
+ }
241
+
242
+ static isValid(type) {
243
+ return Object.values(this.TYPES).some(t => t.value === type);
244
+ }
245
+
246
+ static getAll() {
247
+ return Object.values(this.TYPES).map(t => t.value);
248
+ }
249
+ }
250
+
251
+ export default CosmeticType;
@@ -0,0 +1,58 @@
1
+ class Language {
2
+ static LANGS = {
3
+ "arabic": "ar",
4
+ "german": "de",
5
+ "english": "en",
6
+ "spanish": "es",
7
+ "spanishLatinAmerica": "es-419",
8
+ "french": "fr",
9
+ "indonesian": "id",
10
+ "italian": "it",
11
+ "japanese": "ja",
12
+ "korean": "ko",
13
+ "polish": "pl",
14
+ "portugueseBrazil": "pt-BR",
15
+ "russian": "ru",
16
+ "thai": "th",
17
+ "turkish": "tr",
18
+ "vietnamese": "vi",
19
+ "chineseSimplified": "zh-Hans",
20
+ "chineseTraditional": "zh-Hant"
21
+ }
22
+
23
+ static arabic() { return this.LANGS.arabic }
24
+ static german() { return this.LANGS.german }
25
+ static english() { return this.LANGS.english }
26
+ static spanish() { return this.LANGS.spanish }
27
+ static spanishLatinAmerica() { return this.LANGS.spanishLatinAmerica }
28
+ static french() { return this.LANGS.french }
29
+ static indonesian() { return this.LANGS.indonesian }
30
+ static italian() { return this.LANGS.italian }
31
+ static japanese() { return this.LANGS.japanese }
32
+ static korean() { return this.LANGS.korean }
33
+ static polish() { return this.LANGS.polish }
34
+ static portugueseBrazil() { return this.LANGS.portugueseBrazil }
35
+ static russian() { return this.LANGS.russian }
36
+ static thai() { return this.LANGS.thai }
37
+ static turkish() { return this.LANGS.turkish }
38
+ static vietnamese() { return this.LANGS.vietnamese }
39
+ static chineseSimplified() { return this.LANGS.chineseSimplified }
40
+ static chineseTraditional() { return this.LANGS.chineseTraditional }
41
+
42
+ static getAll() {
43
+ return Object.values(this.LANGS);
44
+ }
45
+
46
+ static isValid(lang) {
47
+ if (Object.values(this.LANGS).includes(lang)) {
48
+ return true;
49
+ }
50
+
51
+ if (Object.keys(this.LANGS).includes(lang)) {
52
+ return true;
53
+ }
54
+ return false;
55
+ }
56
+ }
57
+
58
+ export default Language;
@@ -0,0 +1,14 @@
1
+ class MatchMethod {
2
+ static FULL = 'full';
3
+ static CONTAINS = 'contains';
4
+ static STARTS = 'starts';
5
+ static ENDS = 'ends';
6
+
7
+ static full() { return this.FULL; }
8
+ static exact() { return this.FULL; }
9
+ static contains() { return this.CONTAINS; }
10
+ static starts() { return this.STARTS; }
11
+ static ends() { return this.ENDS; }
12
+ }
13
+
14
+ export default MatchMethod;
@@ -0,0 +1,62 @@
1
+ class RequestFlags {
2
+ static FLAGS = {
3
+ NONE: 0,
4
+ INCLUDE_PATHS: 1 << 0, // 1
5
+ INCLUDE_GAMEPLAY_TAGS: 1 << 1, // 2
6
+ INCLUDE_SHOP_HISTORY: 1 << 2 // 4
7
+ };
8
+
9
+
10
+ static multiple(...flags) {
11
+ const combined = flags.reduce((acc, flag) => acc | flag, 0);
12
+ return `0x${combined.toString(16)}`;
13
+ }
14
+
15
+
16
+ static hasFlag(value, flag) {
17
+ const numValue = typeof value === 'string' ?
18
+ parseInt(value.replace('0x', ''), 16) : value;
19
+ return (numValue & flag) === flag;
20
+ }
21
+
22
+ static getSetFlags(value) {
23
+ const numValue = typeof value === 'string' ?
24
+ parseInt(value.replace('0x', ''), 16) : value;
25
+ return Object.entries(this.FLAGS)
26
+ .filter(([key, flag]) =>
27
+ flag !== 0 && this.hasFlag(numValue, flag)
28
+ )
29
+ .map(([key, flag]) => key);
30
+ }
31
+
32
+ static all() {
33
+ return this.multiple(
34
+ this.FLAGS.INCLUDE_PATHS,
35
+ this.FLAGS.INCLUDE_GAMEPLAY_TAGS,
36
+ this.FLAGS.INCLUDE_SHOP_HISTORY
37
+ );
38
+ }
39
+
40
+ static paths() {
41
+ return this.multiple(this.FLAGS.INCLUDE_PATHS);
42
+ }
43
+
44
+ static gameplayTags() {
45
+ return this.multiple(this.FLAGS.INCLUDE_GAMEPLAY_TAGS);
46
+ }
47
+
48
+ static shopHistory() {
49
+ return this.multiple(this.FLAGS.INCLUDE_SHOP_HISTORY);
50
+ }
51
+
52
+ static none() {
53
+ return this.FLAGS.NONE;
54
+ }
55
+
56
+ static safeGet(obj, path, defaultValue = null) {
57
+ return path.split('.')
58
+ .reduce((acc, part) => acc && acc[part], obj) ?? defaultValue;
59
+ }
60
+ }
61
+
62
+ export default RequestFlags;
@@ -0,0 +1,15 @@
1
+ class StatsImage {
2
+ static ALL = 'all';
3
+ static KBM = 'keyboardMouse';
4
+ static GAMEPAD = 'gamepad';
5
+ static TOUCH = 'touch';
6
+ static NONE = 'none';
7
+
8
+ static all() { return this.ALL; }
9
+ static keyboardMouse() { return this.KBM; }
10
+ static gamepad() { return this.GAMEPAD; }
11
+ static touch() { return this.TOUCH; }
12
+ static none() { return this.NONE; }
13
+ }
14
+
15
+ export default StatsImage;
@@ -0,0 +1,9 @@
1
+ class TimeWindow {
2
+ static LIFETIME = 'lifetime';
3
+ static SEASON = 'season';
4
+
5
+ static lifetime() { return this.LIFETIME; }
6
+ static season() { return this.SEASON; }
7
+ }
8
+
9
+ export default TimeWindow;
@@ -0,0 +1,30 @@
1
+ class Response {
2
+ constructor(status, responseData, headers = {}) {
3
+ this._status = status;
4
+ this._data = responseData;
5
+ this._headers = headers;
6
+ this._timestamp = new Date();
7
+ }
8
+
9
+ isSuccess() {
10
+ return this._status >= 200 && this._status < 300;
11
+ }
12
+
13
+ isError() {
14
+ return this._status >= 400;
15
+ }
16
+
17
+ body() {
18
+ return this._data;
19
+ }
20
+
21
+ headers() {
22
+ return this._headers;
23
+ }
24
+
25
+ status() {
26
+ return this._status;
27
+ }
28
+ }
29
+
30
+ export default Response;