@vroskus/library-datahandler 1.0.23 → 1.0.24
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/dist/index.js +9 -9
- package/package.json +9 -10
package/dist/index.js
CHANGED
|
@@ -108,7 +108,7 @@ class DatabaseService {
|
|
|
108
108
|
});
|
|
109
109
|
const modelInstances = yield model.findAll(queryParams);
|
|
110
110
|
if (modelInstances.length > 1) {
|
|
111
|
-
throw new library_error_1.CustomError('Multiple records found', library_error_1.
|
|
111
|
+
throw new library_error_1.CustomError('Multiple records found', library_error_1.BaseErrorKey.multipleRecordsFoundError, {
|
|
112
112
|
data: {
|
|
113
113
|
amount: modelInstances.length,
|
|
114
114
|
modelName,
|
|
@@ -240,7 +240,7 @@ class DatabaseService {
|
|
|
240
240
|
});
|
|
241
241
|
const modelInstances = yield model.findAll(queryParams);
|
|
242
242
|
if (modelInstances.length > 1) {
|
|
243
|
-
throw new library_error_1.CustomError('Multiple records found', library_error_1.
|
|
243
|
+
throw new library_error_1.CustomError('Multiple records found', library_error_1.BaseErrorKey.multipleRecordsFoundError, {
|
|
244
244
|
data: {
|
|
245
245
|
amount: modelInstances.length,
|
|
246
246
|
modelName,
|
|
@@ -317,7 +317,7 @@ class DatabaseService {
|
|
|
317
317
|
});
|
|
318
318
|
const modelInstances = yield model.findAll(queryParams);
|
|
319
319
|
if (modelInstances.length > 1) {
|
|
320
|
-
throw new library_error_1.CustomError('Multiple records found', library_error_1.
|
|
320
|
+
throw new library_error_1.CustomError('Multiple records found', library_error_1.BaseErrorKey.multipleRecordsFoundError, {
|
|
321
321
|
data: {
|
|
322
322
|
amount: modelInstances.length,
|
|
323
323
|
modelName,
|
|
@@ -326,7 +326,7 @@ class DatabaseService {
|
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
if (modelInstances.length === 0) {
|
|
329
|
-
throw new library_error_1.CustomError('Record was not found', library_error_1.
|
|
329
|
+
throw new library_error_1.CustomError('Record was not found', library_error_1.BaseErrorKey.entityNotFoundError, {
|
|
330
330
|
data: {
|
|
331
331
|
modelName,
|
|
332
332
|
request,
|
|
@@ -452,7 +452,7 @@ class DatabaseService {
|
|
|
452
452
|
pivot,
|
|
453
453
|
});
|
|
454
454
|
if (!result || (result && result.length !== 1)) {
|
|
455
|
-
throw new library_error_1.CustomError('Already associatied records', library_error_1.
|
|
455
|
+
throw new library_error_1.CustomError('Already associatied records', library_error_1.BaseErrorKey.alreadyAssociatedRecordsError, {
|
|
456
456
|
data: {
|
|
457
457
|
model1: modelName,
|
|
458
458
|
model1id: id,
|
|
@@ -479,7 +479,7 @@ class DatabaseService {
|
|
|
479
479
|
modelName,
|
|
480
480
|
});
|
|
481
481
|
if (!result || (result && result !== 1)) {
|
|
482
|
-
throw new library_error_1.CustomError('Not associatied records', library_error_1.
|
|
482
|
+
throw new library_error_1.CustomError('Not associatied records', library_error_1.BaseErrorKey.notAssociatedRecordsError, {
|
|
483
483
|
data: {
|
|
484
484
|
model1: modelName,
|
|
485
485
|
model1id: id,
|
|
@@ -557,7 +557,7 @@ _DatabaseService_instances = new WeakSet(), _DatabaseService_init = function _Da
|
|
|
557
557
|
return models;
|
|
558
558
|
}, _DatabaseService_getModel = function _DatabaseService_getModel({ modelName, }) {
|
|
559
559
|
if (!lodash_1.default.has(this.models, modelName)) {
|
|
560
|
-
throw new library_error_1.CustomError('Invalid model name', library_error_1.
|
|
560
|
+
throw new library_error_1.CustomError('Invalid model name', library_error_1.BaseErrorKey.invalidModelNameError, {
|
|
561
561
|
data: {
|
|
562
562
|
modelName,
|
|
563
563
|
},
|
|
@@ -571,7 +571,7 @@ _DatabaseService_instances = new WeakSet(), _DatabaseService_init = function _Da
|
|
|
571
571
|
});
|
|
572
572
|
const modelInstance = yield model.findByPk(id);
|
|
573
573
|
if (modelInstance === null) {
|
|
574
|
-
throw new library_error_1.CustomError('Record was not found', library_error_1.
|
|
574
|
+
throw new library_error_1.CustomError('Record was not found', library_error_1.BaseErrorKey.entityNotFoundError, {
|
|
575
575
|
data: {
|
|
576
576
|
id,
|
|
577
577
|
modelName,
|
|
@@ -638,7 +638,7 @@ _DatabaseService_instances = new WeakSet(), _DatabaseService_init = function _Da
|
|
|
638
638
|
through: pivot,
|
|
639
639
|
} : {};
|
|
640
640
|
if (typeof modelInstance[actionMethod] !== 'function') {
|
|
641
|
-
throw new library_error_1.CustomError('Association action method not found', library_error_1.
|
|
641
|
+
throw new library_error_1.CustomError('Association action method not found', library_error_1.BaseErrorKey.associationActionMethodNotFoundError, {
|
|
642
642
|
data: {
|
|
643
643
|
action,
|
|
644
644
|
associationModelId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vroskus/library-datahandler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "Data Handler",
|
|
5
5
|
"author": "Vilius Roškus <vilius@regattas.eu>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
"test:e2e": "echo 'No tests'"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@vroskus/library-error": "1.0.
|
|
23
|
+
"@vroskus/library-error": "1.0.19",
|
|
24
24
|
"lodash": "4.17.21",
|
|
25
|
-
"mysql2": "3.
|
|
25
|
+
"mysql2": "3.9.1",
|
|
26
26
|
"pg-hstore": "2.3.4",
|
|
27
27
|
"pluralize": "8.0.0",
|
|
28
|
-
"sequelize": "6.
|
|
28
|
+
"sequelize": "6.37.1",
|
|
29
29
|
"uuid": "9.0.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/jest": "29.5.
|
|
32
|
+
"@types/jest": "29.5.12",
|
|
33
33
|
"@types/lodash": "4.14.202",
|
|
34
|
-
"@types/node": "20.11.
|
|
34
|
+
"@types/node": "20.11.20",
|
|
35
35
|
"@types/sequelize": "4.28.20",
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "
|
|
37
|
-
"@typescript-eslint/parser": "
|
|
38
|
-
"eslint": "8.
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "7.0.2",
|
|
37
|
+
"@typescript-eslint/parser": "7.0.2",
|
|
38
|
+
"eslint": "8.57.0",
|
|
39
39
|
"eslint-config-airbnb-base": "15.0.0",
|
|
40
40
|
"eslint-config-airbnb-typescript": "17.1.0",
|
|
41
41
|
"eslint-config-problems": "8.0.0",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"eslint-plugin-import-newlines": "1.3.4",
|
|
44
44
|
"eslint-plugin-perfectionist": "2.5.0",
|
|
45
45
|
"eslint-plugin-react": "7.33.2",
|
|
46
|
-
"npm-check": "6.0.1",
|
|
47
46
|
"sqlite3": "5.1.6",
|
|
48
47
|
"typescript": "5.3.3"
|
|
49
48
|
}
|