@molochko-dev/data 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.
package/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { EnumItem } from './src/types'
2
+
3
+ console.info('SDFSDFSDFSDFSDFFSD')
4
+ const a:EnumItem = { id: "sdfsdf", label: "sdfsdfd"}
5
+ const isType = <Type>(thing: any): thing is Type => true;
6
+
7
+ console.info('isType', isType<EnumItem>(a))
package/jest.config.js ADDED
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ transform: {'^.+\\.ts?$': 'ts-jest'},
3
+ testEnvironment: 'node',
4
+ testRegex: '/test/.*\\.(test|spec)?\\.(ts|tsx)$',
5
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
6
+ }
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@molochko-dev/data",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "types": "dist/types.ts",
7
+ "author": "plcgi1@gmail.com",
8
+ "license": "ISC",
9
+ "repository": "git@github.com:plcgi1/molochko-data.git",
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "test": "jest --config=jest.config.js",
13
+ "format": "prettier --write \"src/**/*.ts\""
14
+ },
15
+ "keywords": [
16
+ "molochko-data"
17
+ ],
18
+ "devDependencies": {
19
+ "@babel/parser": "^7.22.5",
20
+ "@types/node": "^9.4.6",
21
+ "jest": "^29.5.0",
22
+ "prettier": "^2.8.8",
23
+ "ts-jest": "^29.1.0",
24
+ "tslint": "^6.1.3",
25
+ "typescript": "~4.8.2"
26
+ },
27
+ "dependencies": {
28
+ "@types/jest": "^29.5.2"
29
+ }
30
+ }
package/src/breed.ts ADDED
@@ -0,0 +1,320 @@
1
+ import { EnumItem } from "./types";
2
+ import { asObject } from "./helpers";
3
+
4
+ const BREED: EnumItem[] = [
5
+ { label: "AMERICAN LINEBACK", id: "LD" },
6
+ { label: "AYRSHIRE", id: "A" },
7
+ {
8
+ label: "AYRSHIRE",
9
+ id: "AY",
10
+ },
11
+ { label: "BROWN SWISS", id: "B" },
12
+ { label: "BROWN SWISS", id: "BS" },
13
+ {
14
+ label: "GIROLANDO",
15
+ id: "GO",
16
+ },
17
+ { label: "GUERNSEY", id: "G" },
18
+ { label: "GUERNSEY", id: "GU" },
19
+ {
20
+ label: "HOLSTEIN",
21
+ id: "H",
22
+ },
23
+ { label: "HOLSTEIN", id: "HO" },
24
+ { label: "JERSEY", id: "J" },
25
+ {
26
+ label: "JERSEY",
27
+ id: "JE",
28
+ },
29
+ { label: "RED & WHITE HOLSTEIN", id: "WW" },
30
+ {
31
+ label: "RED SINDHI",
32
+ id: "ES",
33
+ },
34
+ { label: "SHORTHORN (Milking)", id: "M" },
35
+ {
36
+ label: "SHORTHORN (Milking)",
37
+ id: "MS",
38
+ },
39
+ { label: "INTERNATIONAL RED DAIRY", id: "RE" },
40
+ {
41
+ label: "MILKING DEVON",
42
+ id: "MD",
43
+ },
44
+ { label: "NORWEGIAN RED AND WHITE", id: "NR" },
45
+ {
46
+ label: "SWEDISH RED AND WHITE",
47
+ id: "SR",
48
+ },
49
+ { label: "DAIRY CROSSBREEDS", id: "X" },
50
+ {
51
+ label: "DAIRY CROSSBREEDS",
52
+ id: "XD",
53
+ },
54
+ { label: "DAIRY x BEEF CROSSBREEDS", id: "XX" },
55
+ {
56
+ label: "CANGAIAN",
57
+ id: "CAN",
58
+ },
59
+ { label: "GUZERA LEITEIRO", id: "GZ" },
60
+ { label: "SINDHI", id: "SDI" },
61
+ {
62
+ label: "GUZOLANDO",
63
+ id: "GUZ",
64
+ },
65
+ { label: "JERSOLANDA", id: "HJ" },
66
+ {
67
+ label: "AMERICAN ABERDEEN",
68
+ id: "AD",
69
+ },
70
+ { label: "AFRICANDER", id: "AF" },
71
+ { label: "AMERICAN AKAUSHI", id: "AA" },
72
+ {
73
+ label: "ANGUS",
74
+ id: "AN",
75
+ },
76
+ { label: "ANGUS PLUS", id: "NP" },
77
+ { label: "ANKINA", id: "AK" },
78
+ {
79
+ label: "ANKOLEWATUSI",
80
+ id: "AW",
81
+ },
82
+ { label: "AMERICAN BREED", id: "AE" },
83
+ {
84
+ label: "AMERICAN BUCKING",
85
+ id: "MB",
86
+ },
87
+ { label: "AMERIFAX", id: "AM" },
88
+ { label: "BARZONA", id: "BA" },
89
+ {
90
+ label: "BEEFALO",
91
+ id: "BE",
92
+ },
93
+ { label: "BEEF FRIESIAN", id: "BF" },
94
+ {
95
+ label: "BEEFMASTER",
96
+ id: "BM",
97
+ },
98
+ { label: "BELGIAN BLUE", id: "BB" },
99
+ {
100
+ label: "BELTED GALLOWAY",
101
+ id: "BG",
102
+ },
103
+ { label: "BLACK MAXIMIZER", id: "BX" },
104
+ {
105
+ label: "BLONDE d'AQUITAINE",
106
+ id: "BD",
107
+ },
108
+ { label: "BONSMARA", id: "NS" },
109
+ { label: "BRAFORD", id: "BO" },
110
+ {
111
+ label: "BRAHMAN",
112
+ id: "BR",
113
+ },
114
+ { label: "BRAHMOUSIN", id: "BI" },
115
+ { label: "BRALER", id: "BL" },
116
+ {
117
+ label: "BRANGUS",
118
+ id: "BN",
119
+ },
120
+ { label: "BRAUNVEIH", id: "BU" },
121
+ {
122
+ label: "BRITISH WHITE",
123
+ id: "BW",
124
+ },
125
+ { label: "BROWN SWISS (beef)", id: "SB" },
126
+ {
127
+ label: "BUELINGO",
128
+ id: "BQ",
129
+ },
130
+ { label: "CANADIENNE", id: "CN" },
131
+ { label: "CANCHIM", id: "CC" },
132
+ {
133
+ label: "CARACU",
134
+ id: "CR",
135
+ },
136
+ { label: "CHARBRAY", id: "CB" },
137
+ { label: "CHAROLAIS", id: "CH" },
138
+ {
139
+ label: "CHI-ANGUS",
140
+ id: "CG",
141
+ },
142
+ { label: "CHIANINA", id: "CA" },
143
+ { label: "CHI-MAINE", id: "CM" },
144
+ {
145
+ label: "DEVON",
146
+ id: "DE",
147
+ },
148
+ { label: "DEXTER", id: "DR" },
149
+ { label: "DUTCH BELTED", id: "DL" },
150
+ {
151
+ label: "ERINGER",
152
+ id: "ER",
153
+ },
154
+ { label: "FLAMANDE", id: "F" },
155
+ { label: "FLAMANDE", id: "FA" },
156
+ {
157
+ label: "FLECKVIEH",
158
+ id: "FL",
159
+ },
160
+ { label: "FLORIDA CRACKER", id: "FC" },
161
+ { label: "FRIBOURG", id: "FR" },
162
+ {
163
+ label: "GALLOWAY",
164
+ id: "GA",
165
+ },
166
+ { label: "GELBRAY", id: "GE" },
167
+ { label: "GELBVIEH", id: "GV" },
168
+ {
169
+ label: "GRAUVIEH",
170
+ id: "GI",
171
+ },
172
+ { label: "GRONNINGEN", id: "GR" },
173
+ { label: "GUZERAT", id: "GZ" },
174
+ {
175
+ label: "GYR (or Gir)",
176
+ id: "GY",
177
+ },
178
+ { label: "HAYS CONVERTER", id: "HC" },
179
+ {
180
+ label: "HEREFORD (black)",
181
+ id: "HB",
182
+ },
183
+ { label: "HEREFORD (horned)", id: "HH" },
184
+ {
185
+ label: "HEREFORD (polled)",
186
+ id: "HP",
187
+ },
188
+ { label: "HIGHLAND (Scotch)", id: "SH" },
189
+ {
190
+ label: "HYBRID (Alberta)",
191
+ id: "HY",
192
+ },
193
+ { label: "INDU BRAZIL", id: "IB" },
194
+ {
195
+ label: "IRISH BLACK",
196
+ id: "IK",
197
+ },
198
+ { label: "KOBE (Wagyu)", id: "KB" },
199
+ { label: "LOWLINE", id: "LO" },
200
+ {
201
+ label: "LIMOUSIN",
202
+ id: "LM",
203
+ },
204
+ { label: "LINCOLN RED", id: "LR" },
205
+ { label: "LUING", id: "LU" },
206
+ {
207
+ label: "MAINE-ANJOU",
208
+ id: "MA",
209
+ },
210
+ { label: "MANDALONG SPECIAL", id: "ML" },
211
+ {
212
+ label: "MARCHIGIANA",
213
+ id: "MR",
214
+ },
215
+ { label: "MAREMMANA", id: "ME" },
216
+ {
217
+ label: "MASHONA",
218
+ id: "MH",
219
+ },
220
+ { label: "MEXICAN CORRIENTE", id: "MC" },
221
+ {
222
+ label: "MINIATURE ZEBU",
223
+ id: "MZ",
224
+ },
225
+ { label: "MONTBELIARDE", id: "MO" },
226
+ {
227
+ label: "MUESE-RHINE-ISSEL",
228
+ id: "MI",
229
+ },
230
+ { label: "MURRAH", id: "MU" },
231
+ { label: "MURRAY GREY", id: "MG" },
232
+ {
233
+ label: "NELLORE",
234
+ id: "NE",
235
+ },
236
+ { label: "NORMANDE", id: "NO" },
237
+ { label: "PARTHENAISE", id: "PA" },
238
+ {
239
+ label: "PIEDMONTESE",
240
+ id: "PI",
241
+ },
242
+ { label: "PINZGAUER", id: "PZ" },
243
+ { label: "RANGER", id: "RA" },
244
+ {
245
+ label: "RED ANGUS",
246
+ id: "AR",
247
+ },
248
+ { label: "RED BRAHMAN", id: "RR" },
249
+ { label: "RED BRANGUS", id: "RB" },
250
+ {
251
+ label: "RED DANE",
252
+ id: "RD",
253
+ },
254
+ { label: "RED POLL", id: "RP" },
255
+ { label: "ROMAGNOLA", id: "RN" },
256
+ {
257
+ label: "ROMOSINUANO",
258
+ id: "RS",
259
+ },
260
+ { label: "ROTBUNTE", id: "RO" },
261
+ { label: "SAHIWAL", id: "SW" },
262
+ {
263
+ label: "SALERS",
264
+ id: "SA",
265
+ },
266
+ { label: "SANTA GERTRUDIS", id: "SG" },
267
+ {
268
+ label: "SENEPOL",
269
+ id: "SE",
270
+ },
271
+ { label: "SHORTHORN (beef Scotch)", id: "SS" },
272
+ {
273
+ label: "SHORTHORN (Polled)",
274
+ id: "SP",
275
+ },
276
+ { label: "SHORTHORN (Illwara)", id: "IS" },
277
+ {
278
+ label: "SIMBRAH",
279
+ id: "SI",
280
+ },
281
+ { label: "SIMMENTAL", id: "SM" },
282
+ { label: "SOUTH DEVON", id: "DS" },
283
+ {
284
+ label: "SOUTH POLL",
285
+ id: "OP",
286
+ },
287
+ { label: "SPECKLE PARK", id: "SK" },
288
+ { label: "SUSSEX", id: "SX" },
289
+ {
290
+ label: "TABAPUA",
291
+ id: "TB",
292
+ },
293
+ { label: "TARENTAISE", id: "TA" },
294
+ {
295
+ label: "TAURINDICUS",
296
+ id: "TN",
297
+ },
298
+ { label: "TEXAS LONGHORN", id: "TL" },
299
+ { label: "TULI", id: "TI" },
300
+ {
301
+ label: "WELSH BLACK",
302
+ id: "WB",
303
+ },
304
+ { label: "WEST FLEMISH RED", id: "WF" },
305
+ {
306
+ label: "WHITE ANGUS (Ona)",
307
+ id: "WA",
308
+ },
309
+ { label: "WHITE PARK", id: "WP" },
310
+ {
311
+ label: "CROSSBREEDS (TWINNER)",
312
+ id: "XT",
313
+ },
314
+ { label: "BEEF CROSSBREEDS", id: "XB" },
315
+ { label: "GUZERA", id: "GT" },
316
+ ];
317
+
318
+ const BREED_AS_OBJECT = asObject(BREED);
319
+
320
+ export { BREED, BREED_AS_OBJECT };
package/src/enums.ts ADDED
@@ -0,0 +1,272 @@
1
+ import { EnumItem } from "./types";
2
+ import { asObject } from "./helpers";
3
+
4
+ const BCRYPT_SALT: number = 12;
5
+
6
+ const SYSTEM_USER_ROLES: EnumItem[] = [
7
+ {
8
+ id: "user",
9
+ label: "User",
10
+ },
11
+ {
12
+ id: "admin",
13
+ label: "Admin",
14
+ },
15
+ {
16
+ id: "root",
17
+ label: "Tsar",
18
+ },
19
+ ];
20
+
21
+ const SYSTEM_USER_ROLES_AS_OBJECT = asObject(SYSTEM_USER_ROLES);
22
+
23
+ const USER_STATUSES: EnumItem[] = [
24
+ {
25
+ id: "waiting",
26
+ label: "Waiting for confirmation",
27
+ },
28
+ {
29
+ id: "ready",
30
+ label: "Ready",
31
+ },
32
+ {
33
+ id: "blocked",
34
+ label: "Blocked",
35
+ },
36
+ {
37
+ id: "deleted",
38
+ label: "Deleted",
39
+ },
40
+ ];
41
+
42
+ const USER_STATUSES_AS_OBJECT = asObject(USER_STATUSES);
43
+
44
+ const TOKEN_TYPE: EnumItem[] = [
45
+ {
46
+ id: "confirm",
47
+ label: "Confirm",
48
+ },
49
+ {
50
+ id: "auth",
51
+ label: "Auth",
52
+ },
53
+ {
54
+ id: "refresh",
55
+ label: "Refresh",
56
+ },
57
+ {
58
+ id: "resetPassword",
59
+ label: "Reset password",
60
+ },
61
+ {
62
+ id: "invite",
63
+ label: "Invite",
64
+ },
65
+ ];
66
+ const TOKEN_TYPES_AS_OBJECT = asObject(TOKEN_TYPE);
67
+
68
+ const ANIMAL_GENDER: EnumItem[] = [
69
+ {
70
+ id: "cow",
71
+ label: "Cow",
72
+ },
73
+ {
74
+ id: "bull",
75
+ label: "Bull",
76
+ },
77
+ ];
78
+ const ANIMAL_GENDER_AS_OBJECT = asObject(ANIMAL_GENDER);
79
+
80
+ const ANIMAL_STATUS: EnumItem[] = [
81
+ {
82
+ id: "heifer",
83
+ color: "magenta",
84
+ label: "Телка",
85
+ },
86
+ {
87
+ id: "bred",
88
+ color: "blue",
89
+ label: "Осемененная",
90
+ },
91
+ {
92
+ id: "pregnant",
93
+ label: "Стельная",
94
+ color: "volcano",
95
+ },
96
+ {
97
+ id: "open",
98
+ label: "Яловая",
99
+ color: "orange",
100
+ },
101
+ {
102
+ id: "fresh",
103
+ label: "Новотельная",
104
+ color: "gold",
105
+ },
106
+ {
107
+ id: "dry",
108
+ label: "Сухостой",
109
+ color: "lime",
110
+ },
111
+ {
112
+ id: "dnb",
113
+ label: "Брак",
114
+ color: "green",
115
+ },
116
+ {
117
+ id: "sold",
118
+ label: "Продана",
119
+ color: "cyan",
120
+ },
121
+ {
122
+ id: "died",
123
+ label: "Сдохла",
124
+ color: "red",
125
+ },
126
+ ];
127
+ const ANIMAL_STATUS_AS_OBJECT = asObject(ANIMAL_STATUS);
128
+
129
+ const EVENT_TYPES: EnumItem[] = [
130
+ {
131
+ id: "otel",
132
+ label: "ОТЕЛ",
133
+ },
134
+ {
135
+ id: "recheck",
136
+ label: "ПЕРЕПРОВЕРИТЬ",
137
+ },
138
+ {
139
+ id: "ohota",
140
+ label: "ОХОТА",
141
+ },
142
+ {
143
+ id: "osemenenie",
144
+ label: "ОСЕМЕНЕНИЕ",
145
+ },
146
+ {
147
+ id: "stelnaya",
148
+ label: "СТЕЛЬНАЯ",
149
+ },
150
+ {
151
+ id: "yalovaya",
152
+ label: "ЯЛОВАЯ (НЕ СТЕЛЬНАЯ)",
153
+ },
154
+ {
155
+ id: "stelneotpos",
156
+ label: "СТЕЛЬНАЯ НЕ ОТ ПОС ОСЕМЕНЕНИЯ",
157
+ },
158
+ {
159
+ id: "perevod",
160
+ label: "ПЕРЕВОД",
161
+ },
162
+ {
163
+ id: "kbiku",
164
+ label: "КБЫКУ",
165
+ },
166
+ {
167
+ id: "suhostoi",
168
+ label: "СУХОСТОЙ",
169
+ },
170
+ {
171
+ id: "abort",
172
+ label: "АБОРТ",
173
+ },
174
+ {
175
+ id: "neosem",
176
+ label: "НЕОСЕМ (БРАК)",
177
+ },
178
+ {
179
+ id: "prodazha",
180
+ label: "ПРОДАЖА",
181
+ },
182
+ {
183
+ id: "pala",
184
+ label: "ПАЛА",
185
+ },
186
+ {
187
+ id: "zamenaNomera",
188
+ label: "ЗАМЕНА НОМЕРА",
189
+ },
190
+ {
191
+ id: "obrKopit",
192
+ label: "ОБРАБОТКА КОПЫТ",
193
+ },
194
+ {
195
+ id: "pozSuhostoi",
196
+ label: "ПОЗСУХОСТОЙ",
197
+ },
198
+ {
199
+ id: "ves",
200
+ label: "ВЕС",
201
+ },
202
+ {
203
+ id: "rost",
204
+ label: "РОСТ",
205
+ },
206
+ {
207
+ id: "upitannost",
208
+ label: "УПИТАННОСТЬ",
209
+ },
210
+ {
211
+ id: "zaboi",
212
+ label: "ЗАБОЙ",
213
+ },
214
+ {
215
+ id: "sinchronizatsia",
216
+ label: "СИНХРОНИЗАЦИЯ",
217
+ },
218
+ ];
219
+ const EVENT_TYPES_AS_OBJECT = asObject(EVENT_TYPES);
220
+
221
+ const SEED_TYPE: EnumItem[] = [
222
+ {
223
+ id: "traditional",
224
+ label: "Традиционное",
225
+ },
226
+ {
227
+ id: "sexytelka",
228
+ label: "Сексированное телка",
229
+ },
230
+ {
231
+ id: "sexybull",
232
+ label: "Сексированное бычок",
233
+ },
234
+ {
235
+ id: "meat",
236
+ label: "Мясное",
237
+ },
238
+ {
239
+ id: "meatSexyTelka",
240
+ label: "Мясное сексированное телка",
241
+ },
242
+ {
243
+ id: "meatSexyBull",
244
+ label: "Мясное сексированное бычок",
245
+ },
246
+ ];
247
+ const SEED_TYPE_AS_OBJECT = asObject(SEED_TYPE);
248
+
249
+ const SEED_STATUS: EnumItem[] = [
250
+ { id: "active", label: "Активно" },
251
+ { id: "notActive", label: "Не Активно" },
252
+ ];
253
+ const SEED_STATUS_AS_OBJECT = asObject(SEED_STATUS);
254
+
255
+ export {
256
+ BCRYPT_SALT,
257
+ SYSTEM_USER_ROLES,
258
+ SYSTEM_USER_ROLES_AS_OBJECT,
259
+ USER_STATUSES,
260
+ USER_STATUSES_AS_OBJECT,
261
+ TOKEN_TYPE,
262
+ TOKEN_TYPES_AS_OBJECT,
263
+ ANIMAL_GENDER,
264
+ ANIMAL_GENDER_AS_OBJECT,
265
+ ANIMAL_STATUS,
266
+ ANIMAL_STATUS_AS_OBJECT,
267
+ EVENT_TYPES,
268
+ EVENT_TYPES_AS_OBJECT,
269
+ SEED_TYPE,
270
+ SEED_TYPE_AS_OBJECT,
271
+ SEED_STATUS_AS_OBJECT,
272
+ };
package/src/helpers.ts ADDED
@@ -0,0 +1,11 @@
1
+ import { EnumItem, EnumArrayAsObject } from "./types";
2
+
3
+ export function asObject(arrayOfObjects: EnumItem[]): EnumArrayAsObject {
4
+ const result: EnumArrayAsObject = {};
5
+
6
+ arrayOfObjects.forEach((item) => {
7
+ result[item.id] = item.id;
8
+ });
9
+
10
+ return result;
11
+ }
package/src/index.ts ADDED
@@ -0,0 +1,6 @@
1
+ import * as dataEnums from "./enums";
2
+ import { BREED, BREED_AS_OBJECT } from "./breed";
3
+ import * as typeDefinitions from "./types";
4
+
5
+ export const enums = { ...dataEnums, BREED, BREED_AS_OBJECT };
6
+ export const types = typeDefinitions;
package/src/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ exports.__esModule = true;
package/src/types.ts ADDED
@@ -0,0 +1,7 @@
1
+ export interface EnumItem {
2
+ readonly id: string;
3
+ readonly label: string;
4
+ readonly color?: string;
5
+ }
6
+
7
+ export type EnumArrayAsObject = { [key: string]: string };
package/tsconfig.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
4
+ "target": "ES6",
5
+ "module": "commonjs",
6
+ /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
7
+ /* Specify library files to be included in the compilation. */
8
+ "lib": ["ES2022", "es7", "es6", "dom"],
9
+ /* Generates corresponding '.d.ts' file. */
10
+ "declaration": true,
11
+ /* Redirect output structure to the directory. */
12
+ "outDir": "dist",
13
+ /* Enable all strict type-checking options. */
14
+ "strict": true,
15
+ /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
16
+ "esModuleInterop": true
17
+ },
18
+ "exclude": [
19
+ "node_modules",
20
+ "dist",
21
+ "test"
22
+ ],
23
+ "include": [
24
+ "./src"
25
+ ]
26
+ }