@sdflc/backend-helpers 1.0.51 → 1.0.53

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.
@@ -1,7 +1,8 @@
1
- import { Logger } from '@sdflc/utils';
1
+ import { Logger, MeasureTool } from '@sdflc/utils';
2
2
  import { Database } from './Database';
3
3
  import { BaseCorePropsInterface, BaseCoreActionsInterface, CoreActionInterface, JwtTokenSecretAndSettings, ApiContext } from './interfaces';
4
4
  declare class BaseCore {
5
+ protected measureTool: MeasureTool;
5
6
  protected config: BaseCorePropsInterface;
6
7
  protected logger: Logger;
7
8
  constructor(props: BaseCorePropsInterface);
package/build/BaseCore.js CHANGED
@@ -30,6 +30,7 @@ const defaultValidators = {
30
30
  };
31
31
  class BaseCore {
32
32
  constructor(props) {
33
+ this.measureTool = new utils_1.MeasureTool();
33
34
  this.config = props;
34
35
  this.logger = props.logger;
35
36
  }
@@ -121,9 +122,19 @@ class BaseCore {
121
122
  // If we process action with the same requestId as requestId passed to the constructor it means
122
123
  // we are processing the same request from FE and can skip some of the operations like transactions and etc
123
124
  const sameRequest = !!this.config.context.requestId && (args === null || args === void 0 ? void 0 : args.requestId) === this.config.context.requestId;
125
+ // TODO: Calculate total thread block time between async calls withing the request
126
+ // this.measureTool.threadBlockTime(doingWhat, ({ name, durationMs }: any) => {
127
+ // this.logger.debug(`The ${name} blocked thread for the time of ${durationMs} ms`);
128
+ // });
129
+ this.logger.log(`The ${doingWhat} started:`, args);
130
+ this.measureTool.start();
124
131
  let step = doingWhat || '';
125
132
  const setStep = (stepName) => {
126
- step = stepName;
133
+ step = stepName || step;
134
+ const time = this.measureTool.addCheckpoint(stepName);
135
+ if (stepName) {
136
+ this.logger.debug(`${time.name}. Since last step: ${time.durationMs} ms`);
137
+ }
127
138
  };
128
139
  const actionOpt = {
129
140
  core: this,
@@ -137,13 +148,17 @@ class BaseCore {
137
148
  yield this.getDb().startTransaction();
138
149
  }
139
150
  if (doAuth === true || (doAuth == null && this.config.doAuth)) {
151
+ this.measureTool.addCheckpoint('Authenticate request: start');
140
152
  const [authResult, errMsg] = yield this.authenticate(opt, actionOpt);
153
+ this.measureTool.addCheckpoint('Authenticate request: end');
141
154
  if (!authResult) {
142
155
  return new api_helpers_1.OpResult({ code: api_helpers_1.OP_RESULT_CODES.UNAUTHORIZED }).addError('', errMsg);
143
156
  }
144
157
  }
145
158
  else {
159
+ this.measureTool.addCheckpoint('Find space: start');
146
160
  const [spaceResult, errMsg] = yield this.findSpace();
161
+ this.measureTool.addCheckpoint('Find space: end');
147
162
  if (spaceResult !== true) {
148
163
  return new api_helpers_1.OpResult({ code: api_helpers_1.OP_RESULT_CODES.UNAUTHORIZED }).addError('', errMsg);
149
164
  }
@@ -151,6 +166,7 @@ class BaseCore {
151
166
  }
152
167
  let validatedItems = {};
153
168
  if (typeof validate === 'function') {
169
+ this.measureTool.addCheckpoint('Validate parameters: start');
154
170
  // If we have validator provided, use it to validate data before running action
155
171
  // validator is expected to return an array:
156
172
  // [0] - true or validation error object,
@@ -163,14 +179,19 @@ class BaseCore {
163
179
  }
164
180
  // If validator returned null then consider the validation passed
165
181
  result = result != null ? result : true;
182
+ this.measureTool.addCheckpoint('Validate parameters: end');
166
183
  if (result !== true) {
167
184
  // if there was an error then `result` is expected to be an object with the same structure as the checkit library does
168
185
  yield this.checkResult({ hasTransaction, result, sameRequest });
169
186
  return result.code != null ? result : new api_helpers_1.OpResult({ code: api_helpers_1.OP_RESULT_CODES.VALIDATION_FAILED });
170
187
  }
171
188
  }
189
+ let time = this.measureTool.stop();
190
+ this.logger.debug(`Authorization and validation time for the ${doingWhat} took ${time.durationMs} ms`);
172
191
  const result = yield action(args, Object.assign(Object.assign({}, actionOpt), { validatedItems }));
173
192
  yield this.checkResult({ hasTransaction, result, sameRequest });
193
+ time = this.measureTool.stop(doingWhat);
194
+ this.logger.debug(`The ${time.name} process time is ${time.durationMs} ms`);
174
195
  return result;
175
196
  }
176
197
  catch (ex) {
@@ -184,6 +205,8 @@ class BaseCore {
184
205
  message: `${step} failed on ${doingWhat}`,
185
206
  };
186
207
  }
208
+ const time = this.measureTool.stop(doingWhat);
209
+ this.logger.debug(`The ${time.name} process time is ${time.durationMs} ms`);
187
210
  return this.exceptionFailure(ex, what);
188
211
  }
189
212
  });
@@ -197,7 +220,6 @@ class BaseCore {
197
220
  accessRights: [utils_1.ACCESS_RIGHTS.LIST],
198
221
  action: (args, opt) => __awaiter(this, void 0, void 0, function* () {
199
222
  var _d;
200
- this.logger.log(`Requesting a list for ${this.config.name}:`, args);
201
223
  const object = yield this.beforeList(args, opt);
202
224
  const items = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.list(object));
203
225
  const result = yield this.afterList(items, opt);
@@ -219,7 +241,6 @@ class BaseCore {
219
241
  action: (args) => __awaiter(this, void 0, void 0, function* () {
220
242
  var _d;
221
243
  const { id } = args || {};
222
- this.logger.log(`Requesting an item for ${this.config.name}:`, args);
223
244
  const item = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.get(id));
224
245
  return this.success([item], item ? api_helpers_1.OP_RESULT_CODES.OK : api_helpers_1.OP_RESULT_CODES.NOT_FOUND);
225
246
  }),
@@ -238,7 +259,6 @@ class BaseCore {
238
259
  action: (args) => __awaiter(this, void 0, void 0, function* () {
239
260
  var _d;
240
261
  const { ids } = args || {};
241
- this.logger.log(`Requesting multiple items for ${this.config.name}:`, args);
242
262
  const items = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.getMany(ids));
243
263
  return this.success(items, items.length > 0 ? api_helpers_1.OP_RESULT_CODES.OK : api_helpers_1.OP_RESULT_CODES.NOT_FOUND);
244
264
  }),
@@ -257,7 +277,6 @@ class BaseCore {
257
277
  action: (args, opt) => __awaiter(this, void 0, void 0, function* () {
258
278
  var _d;
259
279
  const { params } = args || {};
260
- this.logger.log(`Requesting creation of an item for ${this.config.name}:`, args);
261
280
  const object = yield this.beforeCreate(params, opt);
262
281
  const item = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.create(object));
263
282
  const result = yield this.afterCreate(item, opt);
@@ -278,7 +297,6 @@ class BaseCore {
278
297
  action: (args, opt) => __awaiter(this, void 0, void 0, function* () {
279
298
  var _d;
280
299
  const { params } = args || {};
281
- this.logger.log(`Requesting creation of multiple items for ${this.config.name}:`, args);
282
300
  const objects = yield this.beforeCreateMany(params, opt);
283
301
  const items = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.create(objects));
284
302
  const result = yield this.afterCreateMany(items, opt);
@@ -299,7 +317,6 @@ class BaseCore {
299
317
  action: (args, opt) => __awaiter(this, void 0, void 0, function* () {
300
318
  var _d;
301
319
  const { where, params } = args || {};
302
- this.logger.log(`Requesting update of an item for ${this.config.name}:`, args);
303
320
  const object = yield this.beforeUpdate(params, opt);
304
321
  const item = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.update(where, object));
305
322
  const result = yield this.afterUpdate(item, opt);
@@ -320,7 +337,6 @@ class BaseCore {
320
337
  action: (args, opt) => __awaiter(this, void 0, void 0, function* () {
321
338
  var _d;
322
339
  const { params } = args || {};
323
- this.logger.log(`Requesting update of an item for ${this.config.name}:`, args);
324
340
  const object = yield this.beforeUpdateMany(params, opt);
325
341
  const items = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.updateMany(object));
326
342
  const result = yield this.afterUpdateMany(items, opt);
@@ -341,7 +357,6 @@ class BaseCore {
341
357
  action: (args, opt /* { setStep, validatedItems, sameRequest } */) => __awaiter(this, void 0, void 0, function* () {
342
358
  var _d;
343
359
  const { params } = args || {};
344
- this.logger.log(`Requesting setting of item(s) for ${this.config.name}:`, args);
345
360
  const object = yield this.beforeSet(params, opt);
346
361
  const items = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.set(object));
347
362
  const result = yield this.afterSet(items, opt);
@@ -362,7 +377,6 @@ class BaseCore {
362
377
  action: (args, opt) => __awaiter(this, void 0, void 0, function* () {
363
378
  var _d;
364
379
  const { where } = args || {};
365
- this.logger.log(`Requesting removal of an item for ${this.config.name}:`, args);
366
380
  const object = yield this.beforeRemove(where, opt);
367
381
  const items = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.remove(object));
368
382
  const result = yield this.afterRemove(items, opt);
@@ -383,7 +397,6 @@ class BaseCore {
383
397
  action: (args, opt) => __awaiter(this, void 0, void 0, function* () {
384
398
  var _d;
385
399
  const { where } = args || {};
386
- this.logger.log(`Requesting removal of multiple items for ${this.config.name}:`, args);
387
400
  const object = yield this.beforeRemoveMany(where, opt);
388
401
  const items = yield ((_d = this.getContext().gateways[this.config.gatewayName]) === null || _d === void 0 ? void 0 : _d.remove(object));
389
402
  const result = yield this.afterRemoveMany(items, opt);
@@ -86,7 +86,7 @@ class BaseGateway {
86
86
  const { hasStatus, hasVersion } = this.config;
87
87
  const idName = this.getIdField();
88
88
  if (filterParams[idName]) {
89
- query.where(idName, filterParams[idName]);
89
+ query.whereIn(idName, (0, lodash_1.castArray)(filterParams[idName]));
90
90
  }
91
91
  if (hasVersion) {
92
92
  if (filterParams[constants_1.FIELDS.VERSION] != null && !isNaN(filterParams[constants_1.FIELDS.VERSION])) {
@@ -2,6 +2,12 @@ import { OpResult } from '@sdflc/api-helpers';
2
2
  import { BaseCoreActionsInterface, CommonValidatorArgs } from './interfaces';
3
3
  export declare const shouldHaveParams: (args: any) => boolean[] | OpResult[];
4
4
  export declare const shouldHaveId: (id: any) => boolean[] | OpResult[];
5
+ export declare const validateSingleIntId: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
6
+ export declare const validateSingleUuidId: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
7
+ export declare const validateSingleTextId: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
8
+ export declare const validateMultipleIntIds: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
9
+ export declare const validateMultipleUuidIds: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
10
+ export declare const validateMultipleTextIds: (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
5
11
  export declare const validateList: ({ rules }: CommonValidatorArgs) => (args: any, opt: BaseCoreActionsInterface) => Promise<OpResult[] | {}[]>;
6
12
  export declare const validateCreate: ({ rules }: CommonValidatorArgs) => (args: any, opt: BaseCoreActionsInterface) => Promise<{}[] | {}[]>;
7
13
  export declare const validateUpdate: ({ rules }: CommonValidatorArgs) => (args: any, opt: BaseCoreActionsInterface) => Promise<{}[] | {}[]>;
@@ -8,10 +8,86 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.validateUpdate = exports.validateCreate = exports.validateList = exports.shouldHaveId = exports.shouldHaveParams = void 0;
15
+ exports.validateUpdate = exports.validateCreate = exports.validateList = exports.validateMultipleTextIds = exports.validateMultipleUuidIds = exports.validateMultipleIntIds = exports.validateSingleTextId = exports.validateSingleUuidId = exports.validateSingleIntId = exports.shouldHaveId = exports.shouldHaveParams = void 0;
13
16
  const api_helpers_1 = require("@sdflc/api-helpers");
14
17
  const checkItHelpers_1 = require("./checkItHelpers");
18
+ const checkit_1 = __importDefault(require("checkit"));
19
+ const rulesSingleIntId = new checkit_1.default({
20
+ id: [
21
+ {
22
+ rule: 'required',
23
+ message: 'ID is required',
24
+ },
25
+ {
26
+ rule: 'integer',
27
+ message: 'ID should be an integer',
28
+ },
29
+ ],
30
+ });
31
+ const rulesSingleUuidId = new checkit_1.default({
32
+ id: [
33
+ {
34
+ rule: 'required',
35
+ message: 'ID is required',
36
+ },
37
+ {
38
+ rule: 'uuid',
39
+ message: 'ID should be an integer',
40
+ },
41
+ ],
42
+ });
43
+ const rulesSingleTextId = new checkit_1.default({
44
+ id: [
45
+ {
46
+ rule: 'required',
47
+ message: 'ID is required',
48
+ },
49
+ {
50
+ rule: 'string',
51
+ message: 'ID should be a string',
52
+ },
53
+ ],
54
+ });
55
+ const rulesMultipleIntIds = new checkit_1.default({
56
+ ids: [
57
+ {
58
+ rule: 'required',
59
+ message: 'IDs is required',
60
+ },
61
+ {
62
+ rule: 'array',
63
+ message: 'IDs should be an array of integer',
64
+ },
65
+ ],
66
+ });
67
+ const rulesMultipleUuidIds = new checkit_1.default({
68
+ ids: [
69
+ {
70
+ rule: 'required',
71
+ message: 'IDs is required',
72
+ },
73
+ {
74
+ rule: 'array',
75
+ message: 'IDs should be an array of UUIDs',
76
+ },
77
+ ],
78
+ });
79
+ const rulesMultipleTextIds = new checkit_1.default({
80
+ ids: [
81
+ {
82
+ rule: 'required',
83
+ message: 'IDs is required',
84
+ },
85
+ {
86
+ rule: 'array',
87
+ message: 'IDs should be an array of strings',
88
+ },
89
+ ],
90
+ });
15
91
  const shouldHaveParams = (args) => {
16
92
  const keys = Object.keys(args || {});
17
93
  if (keys.length === 0) {
@@ -31,6 +107,54 @@ const shouldHaveId = (id) => {
31
107
  return [true];
32
108
  };
33
109
  exports.shouldHaveId = shouldHaveId;
110
+ const validateSingleIntId = (args, opt) => __awaiter(void 0, void 0, void 0, function* () {
111
+ const [result] = rulesSingleIntId.validateSync(args);
112
+ if (result) {
113
+ return [(0, checkItHelpers_1.createErrorOnCheckError)(result)];
114
+ }
115
+ return [true, {}];
116
+ });
117
+ exports.validateSingleIntId = validateSingleIntId;
118
+ const validateSingleUuidId = (args, opt) => __awaiter(void 0, void 0, void 0, function* () {
119
+ const [result] = rulesSingleUuidId.validateSync(args);
120
+ if (result) {
121
+ return [(0, checkItHelpers_1.createErrorOnCheckError)(result)];
122
+ }
123
+ return [true, {}];
124
+ });
125
+ exports.validateSingleUuidId = validateSingleUuidId;
126
+ const validateSingleTextId = (args, opt) => __awaiter(void 0, void 0, void 0, function* () {
127
+ const [result] = rulesSingleTextId.validateSync(args);
128
+ if (result) {
129
+ return [(0, checkItHelpers_1.createErrorOnCheckError)(result)];
130
+ }
131
+ return [true, {}];
132
+ });
133
+ exports.validateSingleTextId = validateSingleTextId;
134
+ const validateMultipleIntIds = (args, opt) => __awaiter(void 0, void 0, void 0, function* () {
135
+ const [result] = rulesMultipleIntIds.validateSync(args);
136
+ if (result) {
137
+ return [(0, checkItHelpers_1.createErrorOnCheckError)(result)];
138
+ }
139
+ return [true, {}];
140
+ });
141
+ exports.validateMultipleIntIds = validateMultipleIntIds;
142
+ const validateMultipleUuidIds = (args, opt) => __awaiter(void 0, void 0, void 0, function* () {
143
+ const [result] = rulesMultipleUuidIds.validateSync(args);
144
+ if (result) {
145
+ return [(0, checkItHelpers_1.createErrorOnCheckError)(result)];
146
+ }
147
+ return [true, {}];
148
+ });
149
+ exports.validateMultipleUuidIds = validateMultipleUuidIds;
150
+ const validateMultipleTextIds = (args, opt) => __awaiter(void 0, void 0, void 0, function* () {
151
+ const [result] = rulesMultipleTextIds.validateSync(args);
152
+ if (result) {
153
+ return [(0, checkItHelpers_1.createErrorOnCheckError)(result)];
154
+ }
155
+ return [true, {}];
156
+ });
157
+ exports.validateMultipleTextIds = validateMultipleTextIds;
34
158
  const validateList = ({ rules }) =>
35
159
  // eslint-disable-next-line
36
160
  (args, opt) => __awaiter(void 0, void 0, void 0, function* () {
@@ -36,6 +36,26 @@ const SQLS = {
36
36
  FROM INFORMATION_SCHEMA.TABLES';
37
37
  `,
38
38
  },
39
+ mssql: {
40
+ listTablesSchema: (appSettings) => `
41
+ SELECT TABLE_NAME as table_name
42
+ FROM INFORMATION_SCHEMA.TABLES
43
+ WHERE TABLE_SCHEMA = '${appSettings === null || appSettings === void 0 ? void 0 : appSettings.dbSchema}';
44
+ `,
45
+ listTables: () => `
46
+ SELECT TABLE_NAME as table_name
47
+ FROM INFORMATION_SCHEMA.TABLES
48
+ `,
49
+ dropTablesSchema: (appSettings) => `
50
+ SELECT 'DROP TABLE IF EXISTS [${appSettings === null || appSettings === void 0 ? void 0 : appSettings.dbSchema}].[' + TABLE_NAME + '];' as cmd
51
+ FROM INFORMATION_SCHEMA.TABLES
52
+ WHERE TABLE_SCHEMA = '${appSettings === null || appSettings === void 0 ? void 0 : appSettings.dbSchema}';
53
+ `,
54
+ dropTables: () => `
55
+ SELECT 'DROP TABLE IF EXISTS ' + TABLE_NAME + ';' as cmd
56
+ FROM INFORMATION_SCHEMA.TABLES';
57
+ `,
58
+ },
39
59
  };
40
60
  /**
41
61
  * Removes all the records from provided table.
@@ -9,10 +9,14 @@ const dbFieldAddDefaults = (table, opt) => {
9
9
  table
10
10
  .integer(constants_1.FIELDS.STATUS)
11
11
  .defaultTo(utils_1.STATUSES.ACTIVE)
12
- .comment('The field is used to specify record status: 50 - Test, 100 - Active, 200 - Draft, 300 - Pending, 1000 - Blocked, 5000 - Disabled, 10000 - Removed');
12
+ .comment((opt === null || opt === void 0 ? void 0 : opt.statusComment) ||
13
+ 'The field is used to specify record status: 50 - Test, 100 - Active, 200 - Draft, 300 - Pending, 1000 - Blocked, 5000 - Disabled, 10000 - Removed');
13
14
  }
14
15
  if (addVersion) {
15
- table.integer(constants_1.FIELDS.VERSION).defaultTo(0).comment('The field is used to control versioning');
16
+ table
17
+ .integer(constants_1.FIELDS.VERSION)
18
+ .defaultTo(0)
19
+ .comment((opt === null || opt === void 0 ? void 0 : opt.versionComment) || 'The field is used to control versioning');
16
20
  }
17
21
  if (addUserInfo) {
18
22
  table.uuid(constants_1.FIELDS.CREATED_BY).comment('ID of user who created the record');
package/build/index.d.ts CHANGED
@@ -17,4 +17,4 @@ export { dbFieldAddDefaults, addOrderNo, addAmount, addSpaceId, addUserId, addAc
17
17
  export { buildDefaultResolvers } from './resolversHelpers';
18
18
  export { createUserToken, verifyUserToken } from './userToken';
19
19
  export { getSaltAndHash, checkPassword } from './passwordHelpers';
20
- export { shouldHaveParams, shouldHaveId, validateList, validateCreate, validateUpdate } from './commonValidators';
20
+ export * from './commonValidators';
package/build/index.js CHANGED
@@ -1,6 +1,20 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
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);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateUpdate = exports.validateCreate = exports.validateList = exports.shouldHaveId = exports.shouldHaveParams = exports.checkPassword = exports.getSaltAndHash = 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 = exports.HEADERS = exports.FIELDS = exports.ID_FIELD = void 0;
17
+ exports.checkPassword = exports.getSaltAndHash = 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 = exports.HEADERS = exports.FIELDS = exports.ID_FIELD = void 0;
4
18
  var constants_1 = require("./constants");
5
19
  Object.defineProperty(exports, "ID_FIELD", { enumerable: true, get: function () { return constants_1.ID_FIELD; } });
6
20
  Object.defineProperty(exports, "FIELDS", { enumerable: true, get: function () { return constants_1.FIELDS; } });
@@ -56,9 +70,4 @@ Object.defineProperty(exports, "verifyUserToken", { enumerable: true, get: funct
56
70
  var passwordHelpers_1 = require("./passwordHelpers");
57
71
  Object.defineProperty(exports, "getSaltAndHash", { enumerable: true, get: function () { return passwordHelpers_1.getSaltAndHash; } });
58
72
  Object.defineProperty(exports, "checkPassword", { enumerable: true, get: function () { return passwordHelpers_1.checkPassword; } });
59
- var commonValidators_1 = require("./commonValidators");
60
- Object.defineProperty(exports, "shouldHaveParams", { enumerable: true, get: function () { return commonValidators_1.shouldHaveParams; } });
61
- Object.defineProperty(exports, "shouldHaveId", { enumerable: true, get: function () { return commonValidators_1.shouldHaveId; } });
62
- Object.defineProperty(exports, "validateList", { enumerable: true, get: function () { return commonValidators_1.validateList; } });
63
- Object.defineProperty(exports, "validateCreate", { enumerable: true, get: function () { return commonValidators_1.validateCreate; } });
64
- Object.defineProperty(exports, "validateUpdate", { enumerable: true, get: function () { return commonValidators_1.validateUpdate; } });
73
+ __exportStar(require("./commonValidators"), exports);
@@ -4,4 +4,6 @@ export interface DbFieldAddDefaultInterface {
4
4
  addStatus?: boolean;
5
5
  skipTimestamps?: boolean;
6
6
  skipRemovedAtStr?: boolean;
7
+ statusComment?: string;
8
+ versionComment?: string;
7
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdflc/backend-helpers",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "description": "Set of helper functions and classes to simplify building backend apps within @sdflc ecosystem",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",