@mharj/openweathermap 0.0.1

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 (38) hide show
  1. package/README.md +7 -0
  2. package/dist/OpenWeatherV2.d.ts +108 -0
  3. package/dist/OpenWeatherV2.js +174 -0
  4. package/dist/OpenWeatherV2.js.map +1 -0
  5. package/dist/index.d.ts +4 -0
  6. package/dist/index.js +8 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/interfaces/IOpenWeatherV2.d.ts +7 -0
  9. package/dist/interfaces/IOpenWeatherV2.js +3 -0
  10. package/dist/interfaces/IOpenWeatherV2.js.map +1 -0
  11. package/dist/interfaces/index.d.ts +1 -0
  12. package/dist/interfaces/index.js +5 -0
  13. package/dist/interfaces/index.js.map +1 -0
  14. package/dist/lib/fetchUtils.d.ts +5 -0
  15. package/dist/lib/fetchUtils.js +17 -0
  16. package/dist/lib/fetchUtils.js.map +1 -0
  17. package/dist/lib/index.d.ts +1 -0
  18. package/dist/lib/index.js +5 -0
  19. package/dist/lib/index.js.map +1 -0
  20. package/dist/types/ISO3166-Countries.d.ts +7 -0
  21. package/dist/types/ISO3166-Countries.js +260 -0
  22. package/dist/types/ISO3166-Countries.js.map +1 -0
  23. package/dist/types/index.d.ts +11 -0
  24. package/dist/types/index.js +11 -0
  25. package/dist/types/index.js.map +1 -0
  26. package/dist/types/v2/Icon.d.ts +17 -0
  27. package/dist/types/v2/Icon.js +19 -0
  28. package/dist/types/v2/Icon.js.map +1 -0
  29. package/dist/types/v2/Language.d.ts +4 -0
  30. package/dist/types/v2/Language.js +53 -0
  31. package/dist/types/v2/Language.js.map +1 -0
  32. package/dist/types/v2/index.d.ts +229 -0
  33. package/dist/types/v2/index.js +80 -0
  34. package/dist/types/v2/index.js.map +1 -0
  35. package/dist/types/v2/weatherIdGroup.d.ts +262 -0
  36. package/dist/types/v2/weatherIdGroup.js +317 -0
  37. package/dist/types/v2/weatherIdGroup.js.map +1 -0
  38. package/package.json +89 -0
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertWeatherDataV2 = exports.isWeatherDataV2 = exports.weatherDataV2Schema = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const Icon_1 = require("./Icon");
6
+ const weatherIdGroup_1 = require("./weatherIdGroup");
7
+ const zod_1 = require("zod");
8
+ tslib_1.__exportStar(require("./Icon"), exports);
9
+ tslib_1.__exportStar(require("./Language"), exports);
10
+ tslib_1.__exportStar(require("./weatherIdGroup"), exports);
11
+ const coordSchema = zod_1.z.object({
12
+ lon: zod_1.z.number(),
13
+ lat: zod_1.z.number(),
14
+ });
15
+ const weatherSchema = zod_1.z.object({
16
+ description: zod_1.z.string(),
17
+ icon: Icon_1.iconSchema,
18
+ id: weatherIdGroup_1.weatherIdSchema,
19
+ main: zod_1.z.string(),
20
+ });
21
+ const mainSchema = zod_1.z.object({
22
+ grnd_level: zod_1.z.number().optional(),
23
+ humidity: zod_1.z.number(),
24
+ pressure: zod_1.z.number(),
25
+ sea_level: zod_1.z.number().optional(),
26
+ temp: zod_1.z.number(),
27
+ temp_max: zod_1.z.number(),
28
+ temp_min: zod_1.z.number(),
29
+ });
30
+ const windSchema = zod_1.z.object({
31
+ speed: zod_1.z.number(),
32
+ deg: zod_1.z.number(),
33
+ });
34
+ const rainSchema = zod_1.z.object({
35
+ '1h': zod_1.z.number(),
36
+ '3h': zod_1.z.number(),
37
+ });
38
+ const snowSchema = zod_1.z.object({
39
+ '1h': zod_1.z.number(),
40
+ '3h': zod_1.z.number(),
41
+ });
42
+ const sysSchema = zod_1.z.object({
43
+ country: zod_1.z.string(),
44
+ id: zod_1.z.number(),
45
+ message: zod_1.z.number().optional(),
46
+ sunrise: zod_1.z.number(),
47
+ sunset: zod_1.z.number(),
48
+ type: zod_1.z.number(),
49
+ });
50
+ /**
51
+ * @internal
52
+ */
53
+ exports.weatherDataV2Schema = zod_1.z.object({
54
+ base: zod_1.z.string(),
55
+ clouds: zod_1.z.object({
56
+ all: zod_1.z.number(),
57
+ }),
58
+ cod: zod_1.z.number(),
59
+ coord: coordSchema,
60
+ dt: zod_1.z.number(),
61
+ id: zod_1.z.number(),
62
+ main: mainSchema,
63
+ name: zod_1.z.string(),
64
+ rain: rainSchema.optional(),
65
+ snow: snowSchema.optional(),
66
+ sys: sysSchema,
67
+ timezone: zod_1.z.number(),
68
+ visibility: zod_1.z.number(),
69
+ weather: zod_1.z.array(weatherSchema),
70
+ wind: windSchema,
71
+ });
72
+ function isWeatherDataV2(data) {
73
+ return exports.weatherDataV2Schema.safeParse(data).success;
74
+ }
75
+ exports.isWeatherDataV2 = isWeatherDataV2;
76
+ function assertWeatherDataV2(data) {
77
+ exports.weatherDataV2Schema.parse(data);
78
+ }
79
+ exports.assertWeatherDataV2 = assertWeatherDataV2;
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"./src/","sources":["types/v2/index.ts"],"names":[],"mappings":";;;;AAAA,iCAAkC;AAClC,qDAAiD;AACjD,6BAAsB;AACtB,iDAAuB;AACvB,qDAA2B;AAC3B,2DAAiC;AAEjC,MAAM,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5B,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9B,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,IAAI,EAAE,iBAAU;IAChB,EAAE,EAAE,gCAAe;IACnB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,QAAQ,EAAE,OAAC,CAAC,MAAM,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M,EAAE;KACf,CAAC;IACF,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,WAAW;IAClB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE;IAC3B,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE;IAC3B,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,OAAC,CAAC,KAAK,CAAC,aAAa,CAAC;IAC/B,IAAI,EAAE,UAAU;CAChB,CAAC,CAAC;AAIH,SAAgB,eAAe,CAAC,IAAa;IAC5C,OAAO,2BAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;AACpD,CAAC;AAFD,0CAEC;AAED,SAAgB,mBAAmB,CAAC,IAAa;IAChD,2BAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAFD,kDAEC","sourcesContent":["import {iconSchema} from './Icon';\nimport {weatherIdSchema} from './weatherIdGroup';\nimport {z} from 'zod';\nexport * from './Icon';\nexport * from './Language';\nexport * from './weatherIdGroup';\n\nconst coordSchema = z.object({\n\tlon: z.number(),\n\tlat: z.number(),\n});\n\nconst weatherSchema = z.object({\n\tdescription: z.string(),\n\ticon: iconSchema,\n\tid: weatherIdSchema,\n\tmain: z.string(),\n});\n\nconst mainSchema = z.object({\n\tgrnd_level: z.number().optional(),\n\thumidity: z.number(),\n\tpressure: z.number(),\n\tsea_level: z.number().optional(),\n\ttemp: z.number(),\n\ttemp_max: z.number(),\n\ttemp_min: z.number(),\n});\n\nconst windSchema = z.object({\n\tspeed: z.number(),\n\tdeg: z.number(),\n});\n\nconst rainSchema = z.object({\n\t'1h': z.number(),\n\t'3h': z.number(),\n});\n\nconst snowSchema = z.object({\n\t'1h': z.number(),\n\t'3h': z.number(),\n});\n\nconst sysSchema = z.object({\n\tcountry: z.string(),\n\tid: z.number(),\n\tmessage: z.number().optional(),\n\tsunrise: z.number(),\n\tsunset: z.number(),\n\ttype: z.number(),\n});\n\n/**\n * @internal\n */\nexport const weatherDataV2Schema = z.object({\n\tbase: z.string(),\n\tclouds: z.object({\n\t\tall: z.number(),\n\t}),\n\tcod: z.number(),\n\tcoord: coordSchema,\n\tdt: z.number(),\n\tid: z.number(),\n\tmain: mainSchema,\n\tname: z.string(),\n\train: rainSchema.optional(),\n\tsnow: snowSchema.optional(),\n\tsys: sysSchema,\n\ttimezone: z.number(),\n\tvisibility: z.number(),\n\tweather: z.array(weatherSchema),\n\twind: windSchema,\n});\n\nexport type WeatherDataV2 = z.infer<typeof weatherDataV2Schema>;\n\nexport function isWeatherDataV2(data: unknown): data is WeatherDataV2 {\n\treturn weatherDataV2Schema.safeParse(data).success;\n}\n\nexport function assertWeatherDataV2(data: unknown): asserts data is WeatherDataV2 {\n\tweatherDataV2Schema.parse(data);\n}\n"]}
@@ -0,0 +1,262 @@
1
+ import { Option } from 'mharj-result';
2
+ import { z } from 'zod';
3
+ /**
4
+ * This is a list of weather ids, groups and descriptions from OpenWeatherMap API
5
+ */
6
+ export declare const weatherIdGroup: readonly [{
7
+ readonly id: 200;
8
+ readonly group: "thunderstorm";
9
+ readonly description: "thunderstorm_with_light_rain";
10
+ }, {
11
+ readonly id: 201;
12
+ readonly group: "thunderstorm";
13
+ readonly description: "thunderstorm_with_rain";
14
+ }, {
15
+ readonly id: 202;
16
+ readonly group: "thunderstorm";
17
+ readonly description: "thunderstorm_with_heavy_rain";
18
+ }, {
19
+ readonly id: 210;
20
+ readonly group: "thunderstorm";
21
+ readonly description: "light_thunderstorm";
22
+ }, {
23
+ readonly id: 211;
24
+ readonly group: "thunderstorm";
25
+ readonly description: "thunderstorm";
26
+ }, {
27
+ readonly id: 212;
28
+ readonly group: "thunderstorm";
29
+ readonly description: "heavy_thunderstorm";
30
+ }, {
31
+ readonly id: 221;
32
+ readonly group: "thunderstorm";
33
+ readonly description: "ragged_thunderstorm";
34
+ }, {
35
+ readonly id: 230;
36
+ readonly group: "thunderstorm";
37
+ readonly description: "thunderstorm_with_light_drizzle";
38
+ }, {
39
+ readonly id: 231;
40
+ readonly group: "thunderstorm";
41
+ readonly description: "thunderstorm_with_drizzle";
42
+ }, {
43
+ readonly id: 232;
44
+ readonly group: "thunderstorm";
45
+ readonly description: "thunderstorm_with_heavy_drizzle";
46
+ }, {
47
+ readonly id: 300;
48
+ readonly group: "drizzle";
49
+ readonly description: "light_intensity_drizzle";
50
+ }, {
51
+ readonly id: 301;
52
+ readonly group: "drizzle";
53
+ readonly description: "drizzle";
54
+ }, {
55
+ readonly id: 302;
56
+ readonly group: "drizzle";
57
+ readonly description: "heavy_intensity_drizzle";
58
+ }, {
59
+ readonly id: 310;
60
+ readonly group: "drizzle";
61
+ readonly description: "light_intensity_drizzle_rain";
62
+ }, {
63
+ readonly id: 311;
64
+ readonly group: "drizzle";
65
+ readonly description: "drizzle_rain";
66
+ }, {
67
+ readonly id: 312;
68
+ readonly group: "drizzle";
69
+ readonly description: "heavy_intensity_drizzle_rain";
70
+ }, {
71
+ readonly id: 313;
72
+ readonly group: "drizzle";
73
+ readonly description: "shower_rain_and_drizzle";
74
+ }, {
75
+ readonly id: 314;
76
+ readonly group: "drizzle";
77
+ readonly description: "heavy_shower_rain_and_drizzle";
78
+ }, {
79
+ readonly id: 321;
80
+ readonly group: "drizzle";
81
+ readonly description: "shower_drizzle";
82
+ }, {
83
+ readonly id: 500;
84
+ readonly group: "rain";
85
+ readonly description: "light_rain";
86
+ }, {
87
+ readonly id: 501;
88
+ readonly group: "rain";
89
+ readonly description: "moderate_rain";
90
+ }, {
91
+ readonly id: 502;
92
+ readonly group: "rain";
93
+ readonly description: "heavy_intensity_rain";
94
+ }, {
95
+ readonly id: 503;
96
+ readonly group: "rain";
97
+ readonly description: "very_heavy_rain";
98
+ }, {
99
+ readonly id: 504;
100
+ readonly group: "rain";
101
+ readonly description: "extreme_rain";
102
+ }, {
103
+ readonly id: 511;
104
+ readonly group: "rain";
105
+ readonly description: "freezing_rain";
106
+ }, {
107
+ readonly id: 520;
108
+ readonly group: "rain";
109
+ readonly description: "light_intensity_shower_rain";
110
+ }, {
111
+ readonly id: 521;
112
+ readonly group: "rain";
113
+ readonly description: "shower_rain";
114
+ }, {
115
+ readonly id: 522;
116
+ readonly group: "rain";
117
+ readonly description: "heavy_intensity_shower_rain";
118
+ }, {
119
+ readonly id: 531;
120
+ readonly group: "rain";
121
+ readonly description: "ragged_shower_rain";
122
+ }, {
123
+ readonly id: 600;
124
+ readonly group: "snow";
125
+ readonly description: "light_snow";
126
+ }, {
127
+ readonly id: 601;
128
+ readonly group: "snow";
129
+ readonly description: "snow";
130
+ }, {
131
+ readonly id: 602;
132
+ readonly group: "snow";
133
+ readonly description: "heavy_snow";
134
+ }, {
135
+ readonly id: 611;
136
+ readonly group: "snow";
137
+ readonly description: "sleet";
138
+ }, {
139
+ readonly id: 612;
140
+ readonly group: "snow";
141
+ readonly description: "light_shower_sleet";
142
+ }, {
143
+ readonly id: 613;
144
+ readonly group: "snow";
145
+ readonly description: "shower_sleet";
146
+ }, {
147
+ readonly id: 615;
148
+ readonly group: "snow";
149
+ readonly description: "light_rain_and_snow";
150
+ }, {
151
+ readonly id: 616;
152
+ readonly group: "snow";
153
+ readonly description: "rain_and_snow";
154
+ }, {
155
+ readonly id: 620;
156
+ readonly group: "snow";
157
+ readonly description: "light_shower_snow";
158
+ }, {
159
+ readonly id: 621;
160
+ readonly group: "snow";
161
+ readonly description: "shower_snow";
162
+ }, {
163
+ readonly id: 622;
164
+ readonly group: "snow";
165
+ readonly description: "heavy_shower_snow";
166
+ }, {
167
+ readonly id: 701;
168
+ readonly group: "atmosphere";
169
+ readonly description: "mist";
170
+ }, {
171
+ readonly id: 711;
172
+ readonly group: "atmosphere";
173
+ readonly description: "smoke";
174
+ }, {
175
+ readonly id: 721;
176
+ readonly group: "atmosphere";
177
+ readonly description: "haze";
178
+ }, {
179
+ readonly id: 731;
180
+ readonly group: "atmosphere";
181
+ readonly description: "sand_dust_whirls";
182
+ }, {
183
+ readonly id: 741;
184
+ readonly group: "atmosphere";
185
+ readonly description: "fog";
186
+ }, {
187
+ readonly id: 751;
188
+ readonly group: "atmosphere";
189
+ readonly description: "sand";
190
+ }, {
191
+ readonly id: 761;
192
+ readonly group: "atmosphere";
193
+ readonly description: "dust";
194
+ }, {
195
+ readonly id: 762;
196
+ readonly group: "atmosphere";
197
+ readonly description: "volcanic_ash";
198
+ }, {
199
+ readonly id: 771;
200
+ readonly group: "atmosphere";
201
+ readonly description: "squalls";
202
+ }, {
203
+ readonly id: 781;
204
+ readonly group: "atmosphere";
205
+ readonly description: "tornado";
206
+ }, {
207
+ readonly id: 800;
208
+ readonly group: "clear";
209
+ readonly description: "clear_sky";
210
+ }, {
211
+ readonly id: 801;
212
+ readonly group: "clouds";
213
+ readonly description: "few_clouds_11-25_percent";
214
+ }, {
215
+ readonly id: 802;
216
+ readonly group: "clouds";
217
+ readonly description: "scattered_clouds_25-50_percent";
218
+ }, {
219
+ readonly id: 803;
220
+ readonly group: "clouds";
221
+ readonly description: "broken_clouds_51-84_percent";
222
+ }, {
223
+ readonly id: 804;
224
+ readonly group: "clouds";
225
+ readonly description: "overcast_clouds_85-100_percent";
226
+ }];
227
+ export type WeatherID = (typeof weatherIdGroup)[number]['id'];
228
+ /**
229
+ * WeatherGroup: "clouds" | "rain" | "snow" | "thunderstorm" | "drizzle" | "atmosphere" | "clear"
230
+ */
231
+ export type WeatherGroup = (typeof weatherIdGroup)[number]['group'];
232
+ /**
233
+ * List for weather description key types from OpenWeatherMap API based on weather id.
234
+ *
235
+ * This list of keys can be used to translate weather id to human readable description with different languages.
236
+ * @example
237
+ * const i18Weather: Record<WeatherDescription, string> = {
238
+ * clear_sky: 'Clear sky',
239
+ * ...
240
+ * }
241
+ */
242
+ export type WeatherDescription = (typeof weatherIdGroup)[number]['description'];
243
+ /**
244
+ * Weather id schema
245
+ * @internal
246
+ */
247
+ export declare const weatherIdSchema: z.ZodType<771 | 200 | 201 | 202 | 210 | 211 | 212 | 221 | 230 | 231 | 232 | 300 | 301 | 302 | 310 | 311 | 312 | 313 | 314 | 321 | 500 | 501 | 502 | 503 | 504 | 511 | 520 | 521 | 522 | 531 | 600 | 601 | 602 | 611 | 612 | 613 | 615 | 616 | 620 | 621 | 622 | 701 | 711 | 721 | 731 | 741 | 751 | 761 | 762 | 781 | 800 | 801 | 802 | 803 | 804, z.ZodTypeDef, 771 | 200 | 201 | 202 | 210 | 211 | 212 | 221 | 230 | 231 | 232 | 300 | 301 | 302 | 310 | 311 | 312 | 313 | 314 | 321 | 500 | 501 | 502 | 503 | 504 | 511 | 520 | 521 | 522 | 531 | 600 | 601 | 602 | 611 | 612 | 613 | 615 | 616 | 620 | 621 | 622 | 701 | 711 | 721 | 731 | 741 | 751 | 761 | 762 | 781 | 800 | 801 | 802 | 803 | 804>;
248
+ /**
249
+ * get weather description key from weather id
250
+ * @param id - weather id
251
+ * @returns {Option<WeatherDescription>} option for weather description key
252
+ * @example
253
+ * const weatherComponent = ({data}) => {
254
+ * const key = getWeatherV2Description(data.weather[0]?.id).unwrapOr('unknown');
255
+ * return (
256
+ * <div>
257
+ * {t(`weather:${key}`}
258
+ * </div>
259
+ * );
260
+ * }
261
+ */
262
+ export declare function getWeatherV2Description(id: WeatherID | undefined): Option<WeatherDescription>;
@@ -0,0 +1,317 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWeatherV2Description = exports.weatherIdSchema = exports.weatherIdGroup = void 0;
4
+ const mharj_result_1 = require("mharj-result");
5
+ const zod_1 = require("zod");
6
+ /**
7
+ * This is a list of weather ids, groups and descriptions from OpenWeatherMap API
8
+ */
9
+ exports.weatherIdGroup = [
10
+ {
11
+ id: 200,
12
+ group: 'thunderstorm',
13
+ description: 'thunderstorm_with_light_rain',
14
+ },
15
+ {
16
+ id: 201,
17
+ group: 'thunderstorm',
18
+ description: 'thunderstorm_with_rain',
19
+ },
20
+ {
21
+ id: 202,
22
+ group: 'thunderstorm',
23
+ description: 'thunderstorm_with_heavy_rain',
24
+ },
25
+ {
26
+ id: 210,
27
+ group: 'thunderstorm',
28
+ description: 'light_thunderstorm',
29
+ },
30
+ {
31
+ id: 211,
32
+ group: 'thunderstorm',
33
+ description: 'thunderstorm',
34
+ },
35
+ {
36
+ id: 212,
37
+ group: 'thunderstorm',
38
+ description: 'heavy_thunderstorm',
39
+ },
40
+ {
41
+ id: 221,
42
+ group: 'thunderstorm',
43
+ description: 'ragged_thunderstorm',
44
+ },
45
+ {
46
+ id: 230,
47
+ group: 'thunderstorm',
48
+ description: 'thunderstorm_with_light_drizzle',
49
+ },
50
+ {
51
+ id: 231,
52
+ group: 'thunderstorm',
53
+ description: 'thunderstorm_with_drizzle',
54
+ },
55
+ {
56
+ id: 232,
57
+ group: 'thunderstorm',
58
+ description: 'thunderstorm_with_heavy_drizzle',
59
+ },
60
+ {
61
+ id: 300,
62
+ group: 'drizzle',
63
+ description: 'light_intensity_drizzle',
64
+ },
65
+ {
66
+ id: 301,
67
+ group: 'drizzle',
68
+ description: 'drizzle',
69
+ },
70
+ {
71
+ id: 302,
72
+ group: 'drizzle',
73
+ description: 'heavy_intensity_drizzle',
74
+ },
75
+ {
76
+ id: 310,
77
+ group: 'drizzle',
78
+ description: 'light_intensity_drizzle_rain',
79
+ },
80
+ {
81
+ id: 311,
82
+ group: 'drizzle',
83
+ description: 'drizzle_rain',
84
+ },
85
+ {
86
+ id: 312,
87
+ group: 'drizzle',
88
+ description: 'heavy_intensity_drizzle_rain',
89
+ },
90
+ {
91
+ id: 313,
92
+ group: 'drizzle',
93
+ description: 'shower_rain_and_drizzle',
94
+ },
95
+ {
96
+ id: 314,
97
+ group: 'drizzle',
98
+ description: 'heavy_shower_rain_and_drizzle',
99
+ },
100
+ {
101
+ id: 321,
102
+ group: 'drizzle',
103
+ description: 'shower_drizzle',
104
+ },
105
+ {
106
+ id: 500,
107
+ group: 'rain',
108
+ description: 'light_rain',
109
+ },
110
+ {
111
+ id: 501,
112
+ group: 'rain',
113
+ description: 'moderate_rain',
114
+ },
115
+ {
116
+ id: 502,
117
+ group: 'rain',
118
+ description: 'heavy_intensity_rain',
119
+ },
120
+ {
121
+ id: 503,
122
+ group: 'rain',
123
+ description: 'very_heavy_rain',
124
+ },
125
+ {
126
+ id: 504,
127
+ group: 'rain',
128
+ description: 'extreme_rain',
129
+ },
130
+ {
131
+ id: 511,
132
+ group: 'rain',
133
+ description: 'freezing_rain',
134
+ },
135
+ {
136
+ id: 520,
137
+ group: 'rain',
138
+ description: 'light_intensity_shower_rain',
139
+ },
140
+ {
141
+ id: 521,
142
+ group: 'rain',
143
+ description: 'shower_rain',
144
+ },
145
+ {
146
+ id: 522,
147
+ group: 'rain',
148
+ description: 'heavy_intensity_shower_rain',
149
+ },
150
+ {
151
+ id: 531,
152
+ group: 'rain',
153
+ description: 'ragged_shower_rain',
154
+ },
155
+ {
156
+ id: 600,
157
+ group: 'snow',
158
+ description: 'light_snow',
159
+ },
160
+ {
161
+ id: 601,
162
+ group: 'snow',
163
+ description: 'snow',
164
+ },
165
+ {
166
+ id: 602,
167
+ group: 'snow',
168
+ description: 'heavy_snow',
169
+ },
170
+ {
171
+ id: 611,
172
+ group: 'snow',
173
+ description: 'sleet',
174
+ },
175
+ {
176
+ id: 612,
177
+ group: 'snow',
178
+ description: 'light_shower_sleet',
179
+ },
180
+ {
181
+ id: 613,
182
+ group: 'snow',
183
+ description: 'shower_sleet',
184
+ },
185
+ {
186
+ id: 615,
187
+ group: 'snow',
188
+ description: 'light_rain_and_snow',
189
+ },
190
+ {
191
+ id: 616,
192
+ group: 'snow',
193
+ description: 'rain_and_snow',
194
+ },
195
+ {
196
+ id: 620,
197
+ group: 'snow',
198
+ description: 'light_shower_snow',
199
+ },
200
+ {
201
+ id: 621,
202
+ group: 'snow',
203
+ description: 'shower_snow',
204
+ },
205
+ {
206
+ id: 622,
207
+ group: 'snow',
208
+ description: 'heavy_shower_snow',
209
+ },
210
+ {
211
+ id: 701,
212
+ group: 'atmosphere',
213
+ description: 'mist',
214
+ },
215
+ {
216
+ id: 711,
217
+ group: 'atmosphere',
218
+ description: 'smoke',
219
+ },
220
+ {
221
+ id: 721,
222
+ group: 'atmosphere',
223
+ description: 'haze',
224
+ },
225
+ {
226
+ id: 731,
227
+ group: 'atmosphere',
228
+ description: 'sand_dust_whirls',
229
+ },
230
+ {
231
+ id: 741,
232
+ group: 'atmosphere',
233
+ description: 'fog',
234
+ },
235
+ {
236
+ id: 751,
237
+ group: 'atmosphere',
238
+ description: 'sand',
239
+ },
240
+ {
241
+ id: 761,
242
+ group: 'atmosphere',
243
+ description: 'dust',
244
+ },
245
+ {
246
+ id: 762,
247
+ group: 'atmosphere',
248
+ description: 'volcanic_ash',
249
+ },
250
+ {
251
+ id: 771,
252
+ group: 'atmosphere',
253
+ description: 'squalls',
254
+ },
255
+ {
256
+ id: 781,
257
+ group: 'atmosphere',
258
+ description: 'tornado',
259
+ },
260
+ {
261
+ id: 800,
262
+ group: 'clear',
263
+ description: 'clear_sky',
264
+ },
265
+ {
266
+ id: 801,
267
+ group: 'clouds',
268
+ description: 'few_clouds_11-25_percent',
269
+ },
270
+ {
271
+ id: 802,
272
+ group: 'clouds',
273
+ description: 'scattered_clouds_25-50_percent',
274
+ },
275
+ {
276
+ id: 803,
277
+ group: 'clouds',
278
+ description: 'broken_clouds_51-84_percent',
279
+ },
280
+ {
281
+ id: 804,
282
+ group: 'clouds',
283
+ description: 'overcast_clouds_85-100_percent',
284
+ },
285
+ ];
286
+ /**
287
+ * Weather id schema
288
+ * @internal
289
+ */
290
+ exports.weatherIdSchema = zod_1.z.custom((val) => {
291
+ if (typeof val !== 'number') {
292
+ return { message: 'Expected a number', success: false };
293
+ }
294
+ if (!exports.weatherIdGroup.find((x) => x.id === val)) {
295
+ return { message: 'Expected a valid weather id', success: false };
296
+ }
297
+ return val;
298
+ });
299
+ /**
300
+ * get weather description key from weather id
301
+ * @param id - weather id
302
+ * @returns {Option<WeatherDescription>} option for weather description key
303
+ * @example
304
+ * const weatherComponent = ({data}) => {
305
+ * const key = getWeatherV2Description(data.weather[0]?.id).unwrapOr('unknown');
306
+ * return (
307
+ * <div>
308
+ * {t(`weather:${key}`}
309
+ * </div>
310
+ * );
311
+ * }
312
+ */
313
+ function getWeatherV2Description(id) {
314
+ return (0, mharj_result_1.undefinedOptionWrap)(exports.weatherIdGroup.find((x) => x.id === id)?.description);
315
+ }
316
+ exports.getWeatherV2Description = getWeatherV2Description;
317
+ //# sourceMappingURL=weatherIdGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weatherIdGroup.js","sourceRoot":"./src/","sources":["types/v2/weatherIdGroup.ts"],"names":[],"mappings":";;;AAAA,+CAAyD;AACzD,6BAAsB;AAEtB;;GAEG;AACU,QAAA,cAAc,GAAG;IAC7B;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,8BAA8B;KAC3C;IACD;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,wBAAwB;KACrC;IACD;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,8BAA8B;KAC3C;IACD;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,oBAAoB;KACjC;IACD;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,cAAc;KAC3B;IACD;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,cAAc;QACrB,WAAW,EAAE,oBAAoB;KACjC;IACD;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,cA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0BAA0B;KACvC;IACD;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,gCAAgC;KAC7C;IACD;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,6BAA6B;KAC1C;IACD;QACC,EAAE,EAAE,GAAG;QACP,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,gCAAgC;KAC7C;CACQ,CAAC;AAqBX;;;GAGG;AACU,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAY,CAAC,GAAG,EAAE,EAAE;IAC1D,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC5B,OAAO,EAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC;KACtD;IACD,IAAI,CAAC,sBAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE;QAC9C,OAAO,EAAC,OAAO,EAAE,6BAA6B,EAAE,OAAO,EAAE,KAAK,EAAC,CAAC;KAChE;IACD,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,SAAgB,uBAAuB,CAAC,EAAyB;IAChE,OAAO,IAAA,kCAAmB,EAAC,sBAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;AAClF,CAAC;AAFD,0DAEC","sourcesContent":["import {Option, undefinedOptionWrap} from 'mharj-result';\nimport {z} from 'zod';\n\n/**\n * This is a list of weather ids, groups and descriptions from OpenWeatherMap API\n */\nexport const weatherIdGroup = [\n\t{\n\t\tid: 200,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'thunderstorm_with_light_rain',\n\t},\n\t{\n\t\tid: 201,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'thunderstorm_with_rain',\n\t},\n\t{\n\t\tid: 202,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'thunderstorm_with_heavy_rain',\n\t},\n\t{\n\t\tid: 210,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'light_thunderstorm',\n\t},\n\t{\n\t\tid: 211,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'thunderstorm',\n\t},\n\t{\n\t\tid: 212,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'heavy_thunderstorm',\n\t},\n\t{\n\t\tid: 221,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'ragged_thunderstorm',\n\t},\n\t{\n\t\tid: 230,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'thunderstorm_with_light_drizzle',\n\t},\n\t{\n\t\tid: 231,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'thunderstorm_with_drizzle',\n\t},\n\t{\n\t\tid: 232,\n\t\tgroup: 'thunderstorm',\n\t\tdescription: 'thunderstorm_with_heavy_drizzle',\n\t},\n\t{\n\t\tid: 300,\n\t\tgroup: 'drizzle',\n\t\tdescription: 'light_intensity_drizzle',\n\t},\n\t{\n\t\tid: 301,\n\t\tgroup: 'drizzle',\n\t\tdescription: 'drizzle',\n\t},\n\t{\n\t\tid: 302,\n\t\tgroup: 'drizzle',\n\t\tdescription: 'heavy_intensity_drizzle',\n\t},\n\t{\n\t\tid: 310,\n\t\tgroup: 'drizzle',\n\t\tdescription: 'light_intensity_drizzle_rain',\n\t},\n\t{\n\t\tid: 311,\n\t\tgroup: 'drizzle',\n\t\tdescription: 'drizzle_rain',\n\t},\n\t{\n\t\tid: 312,\n\t\tgroup: 'drizzle',\n\t\tdescription: 'heavy_intensity_drizzle_rain',\n\t},\n\t{\n\t\tid: 313,\n\t\tgroup: 'drizzle',\n\t\tdescription: 'shower_rain_and_drizzle',\n\t},\n\t{\n\t\tid: 314,\n\t\tgroup: 'drizzle',\n\t\tdescription: 'heavy_shower_rain_and_drizzle',\n\t},\n\t{\n\t\tid: 321,\n\t\tgroup: 'drizzle',\n\t\tdescription: 'shower_drizzle',\n\t},\n\t{\n\t\tid: 500,\n\t\tgroup: 'rain',\n\t\tdescription: 'light_rain',\n\t},\n\t{\n\t\tid: 501,\n\t\tgroup: 'rain',\n\t\tdescription: 'moderate_rain',\n\t},\n\t{\n\t\tid: 502,\n\t\tgroup: 'rain',\n\t\tdescription: 'heavy_intensity_rain',\n\t},\n\t{\n\t\tid: 503,\n\t\tgroup: 'rain',\n\t\tdescription: 'very_heavy_rain',\n\t},\n\t{\n\t\tid: 504,\n\t\tgroup: 'rain',\n\t\tdescription: 'extreme_rain',\n\t},\n\t{\n\t\tid: 511,\n\t\tgroup: 'rain',\n\t\tdescription: 'freezing_rain',\n\t},\n\t{\n\t\tid: 520,\n\t\tgroup: 'rain',\n\t\tdescription: 'light_intensity_shower_rain',\n\t},\n\t{\n\t\tid: 521,\n\t\tgroup: 'rain',\n\t\tdescription: 'shower_rain',\n\t},\n\t{\n\t\tid: 522,\n\t\tgroup: 'rain',\n\t\tdescription: 'heavy_intensity_shower_rain',\n\t},\n\t{\n\t\tid: 531,\n\t\tgroup: 'rain',\n\t\tdescription: 'ragged_shower_rain',\n\t},\n\t{\n\t\tid: 600,\n\t\tgroup: 'snow',\n\t\tdescription: 'light_snow',\n\t},\n\t{\n\t\tid: 601,\n\t\tgroup: 'snow',\n\t\tdescription: 'snow',\n\t},\n\t{\n\t\tid: 602,\n\t\tgroup: 'snow',\n\t\tdescription: 'heavy_snow',\n\t},\n\t{\n\t\tid: 611,\n\t\tgroup: 'snow',\n\t\tdescription: 'sleet',\n\t},\n\t{\n\t\tid: 612,\n\t\tgroup: 'snow',\n\t\tdescription: 'light_shower_sleet',\n\t},\n\t{\n\t\tid: 613,\n\t\tgroup: 'snow',\n\t\tdescription: 'shower_sleet',\n\t},\n\t{\n\t\tid: 615,\n\t\tgroup: 'snow',\n\t\tdescription: 'light_rain_and_snow',\n\t},\n\t{\n\t\tid: 616,\n\t\tgroup: 'snow',\n\t\tdescription: 'rain_and_snow',\n\t},\n\t{\n\t\tid: 620,\n\t\tgroup: 'snow',\n\t\tdescription: 'light_shower_snow',\n\t},\n\t{\n\t\tid: 621,\n\t\tgroup: 'snow',\n\t\tdescription: 'shower_snow',\n\t},\n\t{\n\t\tid: 622,\n\t\tgroup: 'snow',\n\t\tdescription: 'heavy_shower_snow',\n\t},\n\t{\n\t\tid: 701,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'mist',\n\t},\n\t{\n\t\tid: 711,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'smoke',\n\t},\n\t{\n\t\tid: 721,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'haze',\n\t},\n\t{\n\t\tid: 731,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'sand_dust_whirls',\n\t},\n\t{\n\t\tid: 741,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'fog',\n\t},\n\t{\n\t\tid: 751,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'sand',\n\t},\n\t{\n\t\tid: 761,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'dust',\n\t},\n\t{\n\t\tid: 762,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'volcanic_ash',\n\t},\n\t{\n\t\tid: 771,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'squalls',\n\t},\n\t{\n\t\tid: 781,\n\t\tgroup: 'atmosphere',\n\t\tdescription: 'tornado',\n\t},\n\t{\n\t\tid: 800,\n\t\tgroup: 'clear',\n\t\tdescription: 'clear_sky',\n\t},\n\t{\n\t\tid: 801,\n\t\tgroup: 'clouds',\n\t\tdescription: 'few_clouds_11-25_percent',\n\t},\n\t{\n\t\tid: 802,\n\t\tgroup: 'clouds',\n\t\tdescription: 'scattered_clouds_25-50_percent',\n\t},\n\t{\n\t\tid: 803,\n\t\tgroup: 'clouds',\n\t\tdescription: 'broken_clouds_51-84_percent',\n\t},\n\t{\n\t\tid: 804,\n\t\tgroup: 'clouds',\n\t\tdescription: 'overcast_clouds_85-100_percent',\n\t},\n] as const;\n\nexport type WeatherID = (typeof weatherIdGroup)[number]['id'];\n\n/**\n * WeatherGroup: \"clouds\" | \"rain\" | \"snow\" | \"thunderstorm\" | \"drizzle\" | \"atmosphere\" | \"clear\"\n */\nexport type WeatherGroup = (typeof weatherIdGroup)[number]['group'];\n\n/**\n * List for weather description key types from OpenWeatherMap API based on weather id.\n *\n * This list of keys can be used to translate weather id to human readable description with different languages.\n * @example\n * const i18Weather: Record<WeatherDescription, string> = {\n * clear_sky: 'Clear sky',\n * ...\n * }\n */\nexport type WeatherDescription = (typeof weatherIdGroup)[number]['description'];\n\n/**\n * Weather id schema\n * @internal\n */\nexport const weatherIdSchema = z.custom<WeatherID>((val) => {\n\tif (typeof val !== 'number') {\n\t\treturn {message: 'Expected a number', success: false};\n\t}\n\tif (!weatherIdGroup.find((x) => x.id === val)) {\n\t\treturn {message: 'Expected a valid weather id', success: false};\n\t}\n\treturn val;\n});\n\n/**\n * get weather description key from weather id\n * @param id - weather id\n * @returns {Option<WeatherDescription>} option for weather description key\n * @example\n * const weatherComponent = ({data}) => {\n * const key = getWeatherV2Description(data.weather[0]?.id).unwrapOr('unknown');\n * return (\n * <div>\n * {t(`weather:${key}`}\n * </div>\n * );\n * }\n */\nexport function getWeatherV2Description(id: WeatherID | undefined): Option<WeatherDescription> {\n\treturn undefinedOptionWrap(weatherIdGroup.find((x) => x.id === id)?.description);\n}\n"]}