@sdflc/backend-helpers 1.0.25 → 1.0.26
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/README.md +175 -0
- package/build/baseCore.js +2 -2
- package/build/baseGateway.d.ts +2 -1
- package/build/baseGateway.js +20 -8
- package/build/constants.js +5 -0
- package/build/dbMigratorAndSeeder.js +5 -1
- package/build/dbSeeder.js +5 -1
- package/build/dbTableHelpers.d.ts +2 -0
- package/build/dbTableHelpers.js +27 -2
- package/build/index.d.ts +1 -1
- package/build/index.js +3 -1
- package/build/interfaces/BaseGatewayInterface.d.ts +1 -0
- package/package.json +68 -68
package/README.md
CHANGED
|
@@ -1,3 +1,178 @@
|
|
|
1
1
|
# Backend Helpers
|
|
2
2
|
|
|
3
3
|
This library has a variety of classes and functions to simplify building backend applications with the specific architecture within `@sdflc` ecosystem.
|
|
4
|
+
|
|
5
|
+
## Classes
|
|
6
|
+
|
|
7
|
+
### BaseCore
|
|
8
|
+
|
|
9
|
+
This is the class that should be extended when you create a new core class. This is where all the business logic should be happeninng when processing request.
|
|
10
|
+
|
|
11
|
+
#### Constructor
|
|
12
|
+
|
|
13
|
+
Here are the props to be passed to the BaseCore constructor:
|
|
14
|
+
|
|
15
|
+
- db: Database - an object of Database class
|
|
16
|
+
- context?: any - the request context where you can add all you need, optional
|
|
17
|
+
- gateway?: any - main gateway class object that will be working with DB or 3rd part API
|
|
18
|
+
- gateways?: any - an object
|
|
19
|
+
- isProduction: boolean - true when the app is in production
|
|
20
|
+
- logLevel: LoggerLevels - log leves: 0 - none, 1 - errors, 2 - warnings, 3 - messages, 4 - all
|
|
21
|
+
- logger?: Logger - object of Logger class to be used as logger
|
|
22
|
+
- name?: string - name of the core
|
|
23
|
+
- requestId: string - Unique ID of a request processed, can be used for troubleshooting
|
|
24
|
+
- doAuth: boolean - call authorize method or not an incoming request
|
|
25
|
+
- doingWhat?: BaseCoreDoingWhatInterface - an object with text descriptions of each action, used to generate generic error message sent to user on an exception
|
|
26
|
+
- validators?: BaseCoreValidatorsInterface - an object with validator functions to be used to validate incoming data
|
|
27
|
+
- gwSpace?: BaseGateway - gateway to find a space, i.e. configration of the app. Each app can have several configurations to be used as one instance for different applications
|
|
28
|
+
- interserviceApiKey?: string - API key to be used to authenticate incoming request from another microservice, optional
|
|
29
|
+
- jwtSecret?: string - secret to be used to validate Authorize Bearer token on incoming request, optional
|
|
30
|
+
- verifytokenArgs?: VerifyUserTokenArgs - optional parameters for JWT token validation, like algorithm, etc
|
|
31
|
+
|
|
32
|
+
#### getDb()
|
|
33
|
+
|
|
34
|
+
#### getRequestId()
|
|
35
|
+
|
|
36
|
+
#### getContext(key?: string)
|
|
37
|
+
|
|
38
|
+
#### getGateways()
|
|
39
|
+
|
|
40
|
+
#### success(data: any, code?: number): any
|
|
41
|
+
|
|
42
|
+
#### failure(code: number, errorMsg: string, data?: any)
|
|
43
|
+
|
|
44
|
+
#### validationFailure(ex: any): any
|
|
45
|
+
|
|
46
|
+
#### exceptionFailure(ex: any, doingWhat: string | any, data?: any)
|
|
47
|
+
|
|
48
|
+
#### checkResult(args: any)
|
|
49
|
+
|
|
50
|
+
#### runAction(opt: CoreActionInterface)
|
|
51
|
+
|
|
52
|
+
#### Default Actions
|
|
53
|
+
|
|
54
|
+
##### list(args: any)
|
|
55
|
+
|
|
56
|
+
##### get(args: any)
|
|
57
|
+
|
|
58
|
+
##### getMany(args: any)
|
|
59
|
+
|
|
60
|
+
##### create(args: any)
|
|
61
|
+
|
|
62
|
+
##### createMany(args: any)
|
|
63
|
+
|
|
64
|
+
##### update(args: any)
|
|
65
|
+
|
|
66
|
+
##### updateMany(args: any)
|
|
67
|
+
|
|
68
|
+
##### set(args: any)
|
|
69
|
+
|
|
70
|
+
##### remove(args: any)
|
|
71
|
+
|
|
72
|
+
##### removeMany(args: any)
|
|
73
|
+
|
|
74
|
+
#### Default Action related events
|
|
75
|
+
|
|
76
|
+
##### beforeList(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
77
|
+
|
|
78
|
+
##### afterList(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
79
|
+
|
|
80
|
+
##### beforeCreate(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
81
|
+
|
|
82
|
+
##### afterCreate(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
83
|
+
|
|
84
|
+
##### beforeCreateMany(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
85
|
+
|
|
86
|
+
##### afterCreateMany(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
87
|
+
|
|
88
|
+
##### beforeUpdate(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
89
|
+
|
|
90
|
+
##### afterUpdate(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
91
|
+
|
|
92
|
+
##### beforeUpdateMany(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
93
|
+
|
|
94
|
+
#### afterUpdateMany(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
95
|
+
|
|
96
|
+
##### beforeSet(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
97
|
+
|
|
98
|
+
##### afterSet(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
99
|
+
|
|
100
|
+
##### beforeRemove(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
101
|
+
|
|
102
|
+
##### afterRemove(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
103
|
+
|
|
104
|
+
##### beforeRemoveMany(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
105
|
+
|
|
106
|
+
##### afterRemoveMany(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
107
|
+
|
|
108
|
+
##### onException(params: any, opt?: BaseCoreActionsInterface): Promise<any>
|
|
109
|
+
|
|
110
|
+
#### Authorization
|
|
111
|
+
|
|
112
|
+
#### authenticate(params: any, opt?: BaseCoreActionsInterface)
|
|
113
|
+
|
|
114
|
+
### BaseGateway
|
|
115
|
+
|
|
116
|
+
This is the class that should be extended when you create a new gateway class. This is where your code works with database or 3rd party API or do some works of the lowest level. Gateways are used by the core classes to actually do the job to implement one or another business logic.
|
|
117
|
+
|
|
118
|
+
#### constructor(props: BaseGatewayInterface)
|
|
119
|
+
|
|
120
|
+
#### generateId(args?: any)
|
|
121
|
+
|
|
122
|
+
#### onListFilter(query: any, filterParams: any)
|
|
123
|
+
|
|
124
|
+
#### onUpdateFilter(query: any, filterParams: any)
|
|
125
|
+
|
|
126
|
+
#### onRemoveFilter(query: any, filterParams: any)
|
|
127
|
+
|
|
128
|
+
#### transformOnCreate(args: any)
|
|
129
|
+
|
|
130
|
+
#### transformOnUpdate(params: any, where?: any)
|
|
131
|
+
|
|
132
|
+
#### transformOnRemove(args?: any)
|
|
133
|
+
|
|
134
|
+
#### getDb()
|
|
135
|
+
|
|
136
|
+
#### getBuilder()
|
|
137
|
+
|
|
138
|
+
#### getIdField()
|
|
139
|
+
|
|
140
|
+
#### getCore()
|
|
141
|
+
|
|
142
|
+
#### setCore(core: BaseCore)
|
|
143
|
+
|
|
144
|
+
#### get(id: any)
|
|
145
|
+
|
|
146
|
+
#### getMany(ids: any[])
|
|
147
|
+
|
|
148
|
+
#### list(args?: ListArgsInterface)
|
|
149
|
+
|
|
150
|
+
#### create(args: any)
|
|
151
|
+
|
|
152
|
+
#### update(where: any, params: any)
|
|
153
|
+
|
|
154
|
+
#### updateMany(params: any): Promise<any[]>
|
|
155
|
+
|
|
156
|
+
#### increment(where: any, params: any)
|
|
157
|
+
|
|
158
|
+
#### decrement(where: any, params: any)
|
|
159
|
+
|
|
160
|
+
#### set(params: any): Promise<any[]>
|
|
161
|
+
|
|
162
|
+
#### remove(where: any, hardRemove = false)
|
|
163
|
+
|
|
164
|
+
### buildDefaultGatewayProps = (args: any)
|
|
165
|
+
|
|
166
|
+
This function builds configuration object for a gateways inherited from the BaseGateway classs
|
|
167
|
+
|
|
168
|
+
### BaseController
|
|
169
|
+
|
|
170
|
+
Base constroller class is used to create request handlers for RESTful API and provides some methods to simplify the task of working with requests and responses
|
|
171
|
+
|
|
172
|
+
#### json(method: any)
|
|
173
|
+
|
|
174
|
+
### Application Context
|
|
175
|
+
|
|
176
|
+
#### createApiContext = async (args: ApiContextInterface)
|
|
177
|
+
|
|
178
|
+
#### createContextDefault = async (args: any)
|
package/build/baseCore.js
CHANGED
|
@@ -53,10 +53,10 @@ var utils_1 = require("@sdflc/utils");
|
|
|
53
53
|
var userToken_1 = require("./userToken");
|
|
54
54
|
var baseGateway_1 = require("./baseGateway");
|
|
55
55
|
var utils_2 = require("./utils");
|
|
56
|
-
var defaultAfterAndBefore = function (params
|
|
56
|
+
var defaultAfterAndBefore = function (params /*, opt?: BaseCoreActionsInterface*/) {
|
|
57
57
|
return params;
|
|
58
58
|
};
|
|
59
|
-
var defaultValidate = function (params, opt) {
|
|
59
|
+
var defaultValidate = function ( /*params: any, opt?: BaseCoreActionsInterface*/) {
|
|
60
60
|
return [true, {}];
|
|
61
61
|
};
|
|
62
62
|
var defaultValidators = {
|
package/build/baseGateway.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { BaseCore } from './baseCore';
|
|
|
3
3
|
declare class BaseGateway {
|
|
4
4
|
protected config: BaseGatewayInterface;
|
|
5
5
|
protected loader: any;
|
|
6
|
+
protected insertChunkSize: number;
|
|
6
7
|
protected returnFields: any[];
|
|
7
8
|
constructor(props: BaseGatewayInterface);
|
|
8
9
|
generateId(args?: any): Promise<any>;
|
|
@@ -20,7 +21,7 @@ declare class BaseGateway {
|
|
|
20
21
|
get(id: any): Promise<any>;
|
|
21
22
|
getMany(ids: any[]): Promise<any>;
|
|
22
23
|
list(args?: ListArgsInterface): Promise<any>;
|
|
23
|
-
create(args: any): Promise<any>;
|
|
24
|
+
create(args: any): Promise<any[]>;
|
|
24
25
|
update(where: any, params: any): Promise<any>;
|
|
25
26
|
updateMany(params: any): Promise<any[]>;
|
|
26
27
|
increment(where: any, params: any): Promise<any>;
|
package/build/baseGateway.js
CHANGED
|
@@ -52,6 +52,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
53
|
exports.BaseGateway = void 0;
|
|
54
54
|
var lodash_1 = require("lodash");
|
|
55
|
+
var utils_1 = require("@sdflc/utils");
|
|
55
56
|
var dataCache_1 = require("./dataCache");
|
|
56
57
|
var constants_1 = __importDefault(require("./constants"));
|
|
57
58
|
var ID_FIELD = constants_1.default.ID_FIELD;
|
|
@@ -61,7 +62,9 @@ var defaultUpdateRemoveFilter = function (config) { return function (query, para
|
|
|
61
62
|
}; };
|
|
62
63
|
var BaseGateway = /** @class */ (function () {
|
|
63
64
|
function BaseGateway(props) {
|
|
65
|
+
var _a;
|
|
64
66
|
this.config = props;
|
|
67
|
+
this.insertChunkSize = (_a = props === null || props === void 0 ? void 0 : props.insertChunkSize) !== null && _a !== void 0 ? _a : 2500;
|
|
65
68
|
this.returnFields =
|
|
66
69
|
Array.isArray(this.config.returnFields) && this.config.returnFields.length > 0
|
|
67
70
|
? this.config.returnFields
|
|
@@ -238,15 +241,12 @@ var BaseGateway = /** @class */ (function () {
|
|
|
238
241
|
};
|
|
239
242
|
BaseGateway.prototype.create = function (args) {
|
|
240
243
|
return __awaiter(this, void 0, void 0, function () {
|
|
241
|
-
var objects, idx, len, arg, id, obj, items;
|
|
244
|
+
var objects, idx, len, arg, id, obj, result, chunks, idx, len, items;
|
|
242
245
|
return __generator(this, function (_a) {
|
|
243
246
|
switch (_a.label) {
|
|
244
247
|
case 0:
|
|
245
|
-
objects =
|
|
246
|
-
if (!
|
|
247
|
-
args = [args];
|
|
248
|
-
}
|
|
249
|
-
if (args.length === 0) {
|
|
248
|
+
objects = (0, lodash_1.castArray)(args);
|
|
249
|
+
if (!args || objects.length === 0) {
|
|
250
250
|
return [2 /*return*/, []];
|
|
251
251
|
}
|
|
252
252
|
idx = 0, len = args.length;
|
|
@@ -265,10 +265,22 @@ var BaseGateway = /** @class */ (function () {
|
|
|
265
265
|
case 4:
|
|
266
266
|
++idx;
|
|
267
267
|
return [3 /*break*/, 1];
|
|
268
|
-
case 5:
|
|
268
|
+
case 5:
|
|
269
|
+
result = [];
|
|
270
|
+
chunks = (0, utils_1.arrToChunks)(objects, this.insertChunkSize);
|
|
271
|
+
idx = 0, len = chunks.length;
|
|
272
|
+
_a.label = 6;
|
|
269
273
|
case 6:
|
|
274
|
+
if (!(idx < len)) return [3 /*break*/, 9];
|
|
275
|
+
return [4 /*yield*/, this.getBuilder().insert(chunks[idx]).returning(this.returnFields)];
|
|
276
|
+
case 7:
|
|
270
277
|
items = _a.sent();
|
|
271
|
-
|
|
278
|
+
result.push.apply(result, items);
|
|
279
|
+
_a.label = 8;
|
|
280
|
+
case 8:
|
|
281
|
+
++idx;
|
|
282
|
+
return [3 /*break*/, 6];
|
|
283
|
+
case 9: return [2 /*return*/, result];
|
|
272
284
|
}
|
|
273
285
|
});
|
|
274
286
|
});
|
package/build/constants.js
CHANGED
|
@@ -17,6 +17,11 @@ var FIELDS = {
|
|
|
17
17
|
USER_ID: 'user_id',
|
|
18
18
|
ORDER_NO: 'order_no',
|
|
19
19
|
SPACE_ID: 'space_id',
|
|
20
|
+
DISPLAY_NAME: 'display_name',
|
|
21
|
+
NAME: 'name',
|
|
22
|
+
USERNAME: 'username',
|
|
23
|
+
EMAIL: 'email',
|
|
24
|
+
PHONE: 'phone',
|
|
20
25
|
};
|
|
21
26
|
var ID_FIELD = FIELDS.ID;
|
|
22
27
|
exports.default = {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/build/dbSeeder.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -4,6 +4,8 @@ export declare const addOrderNo: (table: any, opt?: any) => any;
|
|
|
4
4
|
export declare const addAmount: (table: any, fieldName: string) => any;
|
|
5
5
|
export declare const addSpaceId: (table: any, opt?: any) => any;
|
|
6
6
|
export declare const addUserId: (table: any, opt?: any) => any;
|
|
7
|
+
export declare const addAccountId: (table: any, opt?: any) => any;
|
|
8
|
+
export declare const addLang: (table: any, opt?: any) => any;
|
|
7
9
|
export declare const defaultFields: (opt?: any) => {
|
|
8
10
|
[x: number]: string;
|
|
9
11
|
};
|
package/build/dbTableHelpers.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.defaultFields = exports.addUserId = exports.addSpaceId = exports.addAmount = exports.addOrderNo = exports.dbFieldAddDefaults = void 0;
|
|
6
|
+
exports.defaultFields = exports.addLang = exports.addAccountId = exports.addUserId = exports.addSpaceId = exports.addAmount = exports.addOrderNo = exports.dbFieldAddDefaults = void 0;
|
|
7
7
|
var utils_1 = require("@sdflc/utils");
|
|
8
8
|
var constants_1 = __importDefault(require("./constants"));
|
|
9
9
|
var FIELDS = constants_1.default.FIELDS;
|
|
@@ -65,11 +65,36 @@ exports.addSpaceId = addSpaceId;
|
|
|
65
65
|
var addUserId = function (table, opt) {
|
|
66
66
|
var chain = table.uuid(FIELDS.USER_ID).notNullable().comment('Reference to the user table');
|
|
67
67
|
if ((opt === null || opt === void 0 ? void 0 : opt.addForeignKey) === true) {
|
|
68
|
-
table.foreign(FIELDS.
|
|
68
|
+
table.foreign(FIELDS.USER_ID).references("user.".concat(FIELDS.ID)).onUpdate('CASCADE').onDelete('CASCADE');
|
|
69
|
+
}
|
|
70
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.addIndex) === true) {
|
|
71
|
+
table.index([FIELDS.USER_ID]);
|
|
69
72
|
}
|
|
70
73
|
return chain;
|
|
71
74
|
};
|
|
72
75
|
exports.addUserId = addUserId;
|
|
76
|
+
var addAccountId = function (table, opt) {
|
|
77
|
+
var chain = table.uuid(FIELDS.ACCOUNT_ID).notNullable().comment('Reference to the user table');
|
|
78
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.addForeignKey) === true) {
|
|
79
|
+
table.foreign(FIELDS.ACCOUNT_ID).references("account.".concat(FIELDS.ID)).onUpdate('CASCADE').onDelete('CASCADE');
|
|
80
|
+
}
|
|
81
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.addIndex) === true) {
|
|
82
|
+
table.index([FIELDS.ACCOUNT_ID]);
|
|
83
|
+
}
|
|
84
|
+
return chain;
|
|
85
|
+
};
|
|
86
|
+
exports.addAccountId = addAccountId;
|
|
87
|
+
var addLang = function (table, opt) {
|
|
88
|
+
var chain = table.text(FIELDS.LANG).defaultTo('en').notNullable().comment('Language, example: en, ru, en_CA, etc');
|
|
89
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.addForeignKey) === true) {
|
|
90
|
+
table.foreign(FIELDS.LANG).references("language.".concat(FIELDS.ID)).onUpdate('CASCADE').onDelete('CASCADE');
|
|
91
|
+
}
|
|
92
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.addIndex) === true) {
|
|
93
|
+
table.index([FIELDS.LANG]);
|
|
94
|
+
}
|
|
95
|
+
return chain;
|
|
96
|
+
};
|
|
97
|
+
exports.addLang = addLang;
|
|
73
98
|
var defaultFields = function (opt) {
|
|
74
99
|
var _a;
|
|
75
100
|
var addUserInfo = (opt || {}).addUserInfo;
|
package/build/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { BaseGateway } from './baseGateway';
|
|
|
13
13
|
export { BaseCore } from './baseCore';
|
|
14
14
|
export { createApiContext, createContextDefault } from './apiContext';
|
|
15
15
|
export { BaseController } from './baseController';
|
|
16
|
-
export { dbFieldAddDefaults, addOrderNo, addAmount, addSpaceId, addUserId, defaultFields } from './dbTableHelpers';
|
|
16
|
+
export { dbFieldAddDefaults, addOrderNo, addAmount, addSpaceId, addUserId, addAccountId, addLang, defaultFields, } from './dbTableHelpers';
|
|
17
17
|
export { buildDefaultResolvers } from './resolversHelpers';
|
|
18
18
|
export { createUserToken, verifyUserToken } from './userToken';
|
|
19
19
|
export { constants };
|
package/build/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkPassword = exports.getSaltAndHash = exports.buildDefaultGatewayProps = exports.constants = exports.verifyUserToken = exports.createUserToken = exports.buildDefaultResolvers = exports.defaultFields = exports.addUserId = exports.addSpaceId = exports.addAmount = exports.addOrderNo = exports.dbFieldAddDefaults = exports.BaseController = exports.createContextDefault = exports.createApiContext = exports.BaseCore = exports.BaseGateway = exports.DataCache = exports.createErrorOnCheckError = exports.checkArray = exports.createRedisClient = exports.buildKnexConfig = exports.dbSeed = exports.DbMigratorAndSeeder = exports.dbRunMigrations = exports.dbTransformSeedsToObject = exports.dbReset = exports.dbWipe = exports.dbClean = exports.dbListTables = exports.dbCleanTable = exports.Database = exports.buildConfig = void 0;
|
|
6
|
+
exports.checkPassword = exports.getSaltAndHash = exports.buildDefaultGatewayProps = exports.constants = exports.verifyUserToken = exports.createUserToken = exports.buildDefaultResolvers = exports.defaultFields = exports.addLang = exports.addAccountId = exports.addUserId = exports.addSpaceId = exports.addAmount = exports.addOrderNo = exports.dbFieldAddDefaults = exports.BaseController = exports.createContextDefault = exports.createApiContext = exports.BaseCore = exports.BaseGateway = exports.DataCache = exports.createErrorOnCheckError = exports.checkArray = exports.createRedisClient = exports.buildKnexConfig = exports.dbSeed = exports.DbMigratorAndSeeder = exports.dbRunMigrations = exports.dbTransformSeedsToObject = exports.dbReset = exports.dbWipe = exports.dbClean = exports.dbListTables = exports.dbCleanTable = exports.Database = exports.buildConfig = void 0;
|
|
7
7
|
var constants_1 = __importDefault(require("./constants"));
|
|
8
8
|
exports.constants = constants_1.default;
|
|
9
9
|
var configBulder_1 = require("./configBulder");
|
|
@@ -46,6 +46,8 @@ Object.defineProperty(exports, "addOrderNo", { enumerable: true, get: function (
|
|
|
46
46
|
Object.defineProperty(exports, "addAmount", { enumerable: true, get: function () { return dbTableHelpers_1.addAmount; } });
|
|
47
47
|
Object.defineProperty(exports, "addSpaceId", { enumerable: true, get: function () { return dbTableHelpers_1.addSpaceId; } });
|
|
48
48
|
Object.defineProperty(exports, "addUserId", { enumerable: true, get: function () { return dbTableHelpers_1.addUserId; } });
|
|
49
|
+
Object.defineProperty(exports, "addAccountId", { enumerable: true, get: function () { return dbTableHelpers_1.addAccountId; } });
|
|
50
|
+
Object.defineProperty(exports, "addLang", { enumerable: true, get: function () { return dbTableHelpers_1.addLang; } });
|
|
49
51
|
Object.defineProperty(exports, "defaultFields", { enumerable: true, get: function () { return dbTableHelpers_1.defaultFields; } });
|
|
50
52
|
var resolversHelpers_1 = require("./resolversHelpers");
|
|
51
53
|
Object.defineProperty(exports, "buildDefaultResolvers", { enumerable: true, get: function () { return resolversHelpers_1.buildDefaultResolvers; } });
|
package/package.json
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@sdflc/backend-helpers",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Set of helper functions and classes to simplify building backend apps within @sdflc ecosystem",
|
|
5
|
-
"main": "build/index.js",
|
|
6
|
-
"types": "build/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"build/**/*"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "rimraf ./build && tsc",
|
|
12
|
-
"lint": "eslint . --ext .ts --fix",
|
|
13
|
-
"test": "echo No Tests Available Yet",
|
|
14
|
-
"testToDo": "jest --config jest.config.ts",
|
|
15
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
|
16
|
-
"prepare": "husky install && npm run build",
|
|
17
|
-
"prepare1": "husky install",
|
|
18
|
-
"prepublishOnly": "npm test && npm run lint",
|
|
19
|
-
"preversion": "npm run lint",
|
|
20
|
-
"version": "npm run format && git add -A src",
|
|
21
|
-
"postversion": "git push && git push --tags"
|
|
22
|
-
},
|
|
23
|
-
"author": "Sergey Demidenko",
|
|
24
|
-
"license": "ISC",
|
|
25
|
-
"peerDependencies": {},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@types/bcrypt": "^5.0.0",
|
|
28
|
-
"@types/bluebird": "^3.5.36",
|
|
29
|
-
"@types/dotenv-safe": "^8.1.2",
|
|
30
|
-
"@types/jest": "^26.0.24",
|
|
31
|
-
"@types/jsonwebtoken": "^8.5.8",
|
|
32
|
-
"@types/lodash": "^4.14.179",
|
|
33
|
-
"@types/node": "^14.18.12",
|
|
34
|
-
"@types/redis": "^2.8.32",
|
|
35
|
-
"@types/uuid": "^8.3.4",
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
37
|
-
"@typescript-eslint/parser": "^4.33.0",
|
|
38
|
-
"eslint": "^7.32.0",
|
|
39
|
-
"eslint-config-prettier": "^6.15.0",
|
|
40
|
-
"eslint-plugin-jest": "^24.7.0",
|
|
41
|
-
"eslint-plugin-prettier": "^3.4.1",
|
|
42
|
-
"eslint-plugin-react": "^7.29.1",
|
|
43
|
-
"husky": "^6.0.0",
|
|
44
|
-
"jest": "^26.6.3",
|
|
45
|
-
"prettier": "^2.5.1",
|
|
46
|
-
"rimraf": "^3.0.2",
|
|
47
|
-
"run-script-os": "^1.1.3",
|
|
48
|
-
"ts-jest": "^26.4.4",
|
|
49
|
-
"ts-node": "^9.0.0",
|
|
50
|
-
"typescript": "^4.5.5"
|
|
51
|
-
},
|
|
52
|
-
"dependencies": {
|
|
53
|
-
"@sdflc/api-helpers": "^1.1.8",
|
|
54
|
-
"@sdflc/utils": "^1.0.18",
|
|
55
|
-
"bcrypt": "^5.0.1",
|
|
56
|
-
"bluebird": "^3.7.2",
|
|
57
|
-
"dataloader": "^2.0.0",
|
|
58
|
-
"dayjs": "^1.10.7",
|
|
59
|
-
"dotenv-safe": "^8.2.0",
|
|
60
|
-
"jsonwebtoken": "^8.5.1",
|
|
61
|
-
"knex": "^0.95.15",
|
|
62
|
-
"lodash": "^4.17.20",
|
|
63
|
-
"pg": "^8.7.3",
|
|
64
|
-
"redis": "^3.1.2",
|
|
65
|
-
"redis-dataloader": "^1.0.2",
|
|
66
|
-
"uuid": "^8.3.2"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@sdflc/backend-helpers",
|
|
3
|
+
"version": "1.0.26",
|
|
4
|
+
"description": "Set of helper functions and classes to simplify building backend apps within @sdflc ecosystem",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"types": "build/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"build/**/*"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "rimraf ./build && tsc",
|
|
12
|
+
"lint": "eslint . --ext .ts --fix",
|
|
13
|
+
"test": "echo No Tests Available Yet",
|
|
14
|
+
"testToDo": "jest --config jest.config.ts",
|
|
15
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
16
|
+
"prepare": "husky install && npm run build",
|
|
17
|
+
"prepare1": "husky install",
|
|
18
|
+
"prepublishOnly": "npm test && npm run lint",
|
|
19
|
+
"preversion": "npm run lint",
|
|
20
|
+
"version": "npm run format && git add -A src",
|
|
21
|
+
"postversion": "git push && git push --tags"
|
|
22
|
+
},
|
|
23
|
+
"author": "Sergey Demidenko",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"peerDependencies": {},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/bcrypt": "^5.0.0",
|
|
28
|
+
"@types/bluebird": "^3.5.36",
|
|
29
|
+
"@types/dotenv-safe": "^8.1.2",
|
|
30
|
+
"@types/jest": "^26.0.24",
|
|
31
|
+
"@types/jsonwebtoken": "^8.5.8",
|
|
32
|
+
"@types/lodash": "^4.14.179",
|
|
33
|
+
"@types/node": "^14.18.12",
|
|
34
|
+
"@types/redis": "^2.8.32",
|
|
35
|
+
"@types/uuid": "^8.3.4",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
37
|
+
"@typescript-eslint/parser": "^4.33.0",
|
|
38
|
+
"eslint": "^7.32.0",
|
|
39
|
+
"eslint-config-prettier": "^6.15.0",
|
|
40
|
+
"eslint-plugin-jest": "^24.7.0",
|
|
41
|
+
"eslint-plugin-prettier": "^3.4.1",
|
|
42
|
+
"eslint-plugin-react": "^7.29.1",
|
|
43
|
+
"husky": "^6.0.0",
|
|
44
|
+
"jest": "^26.6.3",
|
|
45
|
+
"prettier": "^2.5.1",
|
|
46
|
+
"rimraf": "^3.0.2",
|
|
47
|
+
"run-script-os": "^1.1.3",
|
|
48
|
+
"ts-jest": "^26.4.4",
|
|
49
|
+
"ts-node": "^9.0.0",
|
|
50
|
+
"typescript": "^4.5.5"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@sdflc/api-helpers": "^1.1.8",
|
|
54
|
+
"@sdflc/utils": "^1.0.18",
|
|
55
|
+
"bcrypt": "^5.0.1",
|
|
56
|
+
"bluebird": "^3.7.2",
|
|
57
|
+
"dataloader": "^2.0.0",
|
|
58
|
+
"dayjs": "^1.10.7",
|
|
59
|
+
"dotenv-safe": "^8.2.0",
|
|
60
|
+
"jsonwebtoken": "^8.5.1",
|
|
61
|
+
"knex": "^0.95.15",
|
|
62
|
+
"lodash": "^4.17.20",
|
|
63
|
+
"pg": "^8.7.3",
|
|
64
|
+
"redis": "^3.1.2",
|
|
65
|
+
"redis-dataloader": "^1.0.2",
|
|
66
|
+
"uuid": "^8.3.2"
|
|
67
|
+
}
|
|
68
|
+
}
|