@sdflc/backend-helpers 1.0.20 → 1.0.23
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/build/apiContext.js +5 -5
- package/build/appBaseCore.d.ts +9 -0
- package/build/appBaseCore.js +91 -0
- package/build/baseCore.d.ts +21 -20
- package/build/baseCore.js +190 -53
- package/build/baseGateway.d.ts +8 -7
- package/build/baseGateway.js +141 -62
- package/build/baseGatewayHelpers.js +7 -6
- package/build/checkItHelpers.js +1 -1
- package/build/configBulder.js +4 -4
- package/build/constants.d.ts +5 -2
- package/build/constants.js +22 -35
- package/build/dataCache.js +1 -1
- package/build/database.js +2 -2
- package/build/dbHelpers.js +3 -3
- package/build/dbMigratorAndSeeder.js +10 -10
- package/build/dbSeeder.js +6 -6
- package/build/dbTableHelpers.d.ts +7 -0
- package/build/dbTableHelpers.js +58 -12
- package/build/index.d.ts +2 -0
- package/build/index.js +6 -1
- package/build/interfaces/AppBaseCoreInterface.d.ts +6 -0
- package/build/interfaces/AppBaseCoreInterface.js +2 -0
- package/build/interfaces/BaseGatewayInterface.d.ts +1 -1
- package/build/interfaces/index.d.ts +1 -0
- package/build/knexConfigBuilder.js +5 -5
- package/build/passwordHelpers.d.ts +5 -0
- package/build/passwordHelpers.js +76 -0
- package/build/resolversHelpers.js +11 -12
- package/package.json +21 -19
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { DbFieldAddDefaultInterface } from './interfaces';
|
|
2
2
|
declare const dbFieldAddDefaults: (table: any, opt?: DbFieldAddDefaultInterface | undefined) => void;
|
|
3
|
+
export declare const addOrderNo: (table: any, opt?: any) => any;
|
|
4
|
+
export declare const addAmount: (table: any, fieldName: string) => any;
|
|
5
|
+
export declare const addSpaceId: (table: any, opt?: any) => any;
|
|
6
|
+
export declare const addUserId: (table: any, opt?: any) => any;
|
|
7
|
+
export declare const defaultFields: (opt?: any) => {
|
|
8
|
+
[x: number]: string;
|
|
9
|
+
};
|
|
3
10
|
export { dbFieldAddDefaults };
|
package/build/dbTableHelpers.js
CHANGED
|
@@ -3,38 +3,84 @@ 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.dbFieldAddDefaults = void 0;
|
|
6
|
+
exports.dbFieldAddDefaults = exports.defaultFields = exports.addUserId = exports.addSpaceId = exports.addAmount = exports.addOrderNo = void 0;
|
|
7
|
+
var utils_1 = require("@sdflc/utils");
|
|
7
8
|
var constants_1 = __importDefault(require("./constants"));
|
|
9
|
+
var FIELDS = constants_1.default.FIELDS;
|
|
8
10
|
var dbFieldAddDefaults = function (table, opt) {
|
|
9
11
|
var _a = opt || {}, addUserInfo = _a.addUserInfo, addVersion = _a.addVersion, addStatus = _a.addStatus, skipTimestamps = _a.skipTimestamps, skipRemovedAtStr = _a.skipRemovedAtStr;
|
|
10
12
|
if (addStatus) {
|
|
11
13
|
table
|
|
12
|
-
.integer(
|
|
13
|
-
.defaultTo(
|
|
14
|
-
.comment('The field is used to specify record status: 50 - Test, 100 - Active, 200 - Draft, 300 -
|
|
14
|
+
.integer(FIELDS.STATUS)
|
|
15
|
+
.defaultTo(utils_1.STATUSES.ACTIVE)
|
|
16
|
+
.comment('The field is used to specify record status: 50 - Test, 100 - Active, 200 - Draft, 300 - Pending, 1000 - Blocked, 5000 - Disabled, 10000 - Removed');
|
|
15
17
|
}
|
|
16
18
|
if (addVersion) {
|
|
17
|
-
table.integer(
|
|
19
|
+
table.integer(FIELDS.VERSION).defaultTo(0).comment('The field is used to control versioning');
|
|
18
20
|
}
|
|
19
21
|
if (addUserInfo) {
|
|
20
|
-
table.uuid(
|
|
21
|
-
table.uuid(
|
|
22
|
-
table.uuid(
|
|
22
|
+
table.uuid(FIELDS.CREATED_BY).comment('ID of user who created the record');
|
|
23
|
+
table.uuid(FIELDS.UPDATED_BY).comment('ID of the last user who update the record');
|
|
24
|
+
table.uuid(FIELDS.REMOVED_BY).comment('ID of user who removed the record');
|
|
23
25
|
}
|
|
24
26
|
if (skipTimestamps !== true) {
|
|
25
27
|
table.timestamps(true, true);
|
|
26
28
|
table
|
|
27
|
-
.dateTime(
|
|
29
|
+
.dateTime(FIELDS.REMOVED_AT)
|
|
28
30
|
.comment('Date and time of removal. As it is nullable it cannot be used in any unique index');
|
|
29
31
|
if (skipRemovedAtStr !== true) {
|
|
30
|
-
table.text(
|
|
32
|
+
table.text(FIELDS.REMOVED_AT_STR).defaultTo('').comment('Used to create unique indexes.');
|
|
31
33
|
}
|
|
34
|
+
table.index([FIELDS.CREATED_AT]);
|
|
35
|
+
table.index([FIELDS.UPDATED_AT]);
|
|
32
36
|
}
|
|
33
37
|
if (addStatus) {
|
|
34
|
-
table.index([
|
|
38
|
+
table.index([FIELDS.STATUS]);
|
|
35
39
|
}
|
|
36
40
|
if (skipRemovedAtStr !== true) {
|
|
37
|
-
table.index([
|
|
41
|
+
table.index([FIELDS.REMOVED_AT_STR]);
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
44
|
exports.dbFieldAddDefaults = dbFieldAddDefaults;
|
|
45
|
+
var addOrderNo = function (table, opt) {
|
|
46
|
+
var chain = table.text(FIELDS.ORDER_NO).notNullable().defaultTo('10000000');
|
|
47
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.addIndex) === true) {
|
|
48
|
+
table.index([FIELDS.ORDER_NO]);
|
|
49
|
+
}
|
|
50
|
+
return chain;
|
|
51
|
+
};
|
|
52
|
+
exports.addOrderNo = addOrderNo;
|
|
53
|
+
var addAmount = function (table, fieldName) {
|
|
54
|
+
return table.decimal(fieldName, 19, 4);
|
|
55
|
+
};
|
|
56
|
+
exports.addAmount = addAmount;
|
|
57
|
+
var addSpaceId = function (table, opt) {
|
|
58
|
+
var chain = table.text(FIELDS.SPACE_ID).notNullable().comment('Reference to the space table');
|
|
59
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.addForeignKey) === true) {
|
|
60
|
+
table.foreign(FIELDS.SPACE_ID).references("space.".concat(FIELDS.ID)).onUpdate('CASCADE').onDelete('CASCADE');
|
|
61
|
+
}
|
|
62
|
+
return chain;
|
|
63
|
+
};
|
|
64
|
+
exports.addSpaceId = addSpaceId;
|
|
65
|
+
var addUserId = function (table, opt) {
|
|
66
|
+
var chain = table.uuid(FIELDS.USER_ID).notNullable().comment('Reference to the user table');
|
|
67
|
+
if ((opt === null || opt === void 0 ? void 0 : opt.addForeignKey) === true) {
|
|
68
|
+
table.foreign(FIELDS.userId).references("user.".concat(FIELDS.ID)).onUpdate('CASCADE').onDelete('CASCADE');
|
|
69
|
+
}
|
|
70
|
+
return chain;
|
|
71
|
+
};
|
|
72
|
+
exports.addUserId = addUserId;
|
|
73
|
+
var defaultFields = function (opt) {
|
|
74
|
+
var _a;
|
|
75
|
+
var addUserInfo = (opt || {}).addUserInfo;
|
|
76
|
+
var obj = (_a = {},
|
|
77
|
+
_a[FIELDS.CREATED_AT] = '2021-01-01T00:00:00Z',
|
|
78
|
+
_a[FIELDS.UPDATED_AT] = '2021-01-01T00:00:00Z',
|
|
79
|
+
_a);
|
|
80
|
+
if (addUserInfo === true) {
|
|
81
|
+
obj[FIELDS.CREATED_BY] = utils_1.UUID_EMPTY;
|
|
82
|
+
obj[FIELDS.UPDATED_BY] = utils_1.UUID_EMPTY;
|
|
83
|
+
}
|
|
84
|
+
return obj;
|
|
85
|
+
};
|
|
86
|
+
exports.defaultFields = defaultFields;
|
package/build/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { checkArray, createErrorOnCheckError } from './checkItHelpers';
|
|
|
11
11
|
export { DataCache } from './dataCache';
|
|
12
12
|
export { BaseGateway } from './baseGateway';
|
|
13
13
|
export { BaseCore } from './baseCore';
|
|
14
|
+
export { AppBaseCore } from './appBaseCore';
|
|
14
15
|
export { createApiContext, createContextDefault } from './apiContext';
|
|
15
16
|
export { BaseController } from './baseController';
|
|
16
17
|
export { dbFieldAddDefaults } from './dbTableHelpers';
|
|
@@ -18,3 +19,4 @@ export { buildDefaultResolvers } from './resolversHelpers';
|
|
|
18
19
|
export { createUserToken, verifyUserToken } from './userToken';
|
|
19
20
|
export { constants };
|
|
20
21
|
export { buildDefaultGatewayProps } from './baseGatewayHelpers';
|
|
22
|
+
export { getSaltAndHash, checkPassword } from './passwordHelpers';
|
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.buildDefaultGatewayProps = exports.constants = exports.verifyUserToken = exports.createUserToken = exports.buildDefaultResolvers = 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.dbFieldAddDefaults = exports.BaseController = exports.createContextDefault = exports.createApiContext = exports.AppBaseCore = 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");
|
|
@@ -35,6 +35,8 @@ var baseGateway_1 = require("./baseGateway");
|
|
|
35
35
|
Object.defineProperty(exports, "BaseGateway", { enumerable: true, get: function () { return baseGateway_1.BaseGateway; } });
|
|
36
36
|
var baseCore_1 = require("./baseCore");
|
|
37
37
|
Object.defineProperty(exports, "BaseCore", { enumerable: true, get: function () { return baseCore_1.BaseCore; } });
|
|
38
|
+
var appBaseCore_1 = require("./appBaseCore");
|
|
39
|
+
Object.defineProperty(exports, "AppBaseCore", { enumerable: true, get: function () { return appBaseCore_1.AppBaseCore; } });
|
|
38
40
|
var apiContext_1 = require("./apiContext");
|
|
39
41
|
Object.defineProperty(exports, "createApiContext", { enumerable: true, get: function () { return apiContext_1.createApiContext; } });
|
|
40
42
|
Object.defineProperty(exports, "createContextDefault", { enumerable: true, get: function () { return apiContext_1.createContextDefault; } });
|
|
@@ -49,3 +51,6 @@ Object.defineProperty(exports, "createUserToken", { enumerable: true, get: funct
|
|
|
49
51
|
Object.defineProperty(exports, "verifyUserToken", { enumerable: true, get: function () { return userToken_1.verifyUserToken; } });
|
|
50
52
|
var baseGatewayHelpers_1 = require("./baseGatewayHelpers");
|
|
51
53
|
Object.defineProperty(exports, "buildDefaultGatewayProps", { enumerable: true, get: function () { return baseGatewayHelpers_1.buildDefaultGatewayProps; } });
|
|
54
|
+
var passwordHelpers_1 = require("./passwordHelpers");
|
|
55
|
+
Object.defineProperty(exports, "getSaltAndHash", { enumerable: true, get: function () { return passwordHelpers_1.getSaltAndHash; } });
|
|
56
|
+
Object.defineProperty(exports, "checkPassword", { enumerable: true, get: function () { return passwordHelpers_1.checkPassword; } });
|
|
@@ -16,7 +16,7 @@ export interface BaseGatewayInterface {
|
|
|
16
16
|
noCache?: boolean;
|
|
17
17
|
idGenerator?(args?: any): any;
|
|
18
18
|
insertFormatter?(args?: any): any;
|
|
19
|
-
updateFormatter?(args?: any): any;
|
|
19
|
+
updateFormatter?(args?: any, where?: any): any;
|
|
20
20
|
updateFilter?(query: any, params: any): any;
|
|
21
21
|
removeFormatter?(args?: any): any;
|
|
22
22
|
removeFilter?(query: any, params: any): any;
|
|
@@ -5,6 +5,7 @@ export { ListArgsInterface } from './ListArgsInterface';
|
|
|
5
5
|
export { SortItemInterface } from './SortItemInterface';
|
|
6
6
|
export { PaginationInterface } from './PaginationInterface';
|
|
7
7
|
export { BaseCoreInterface } from './BaseCoreInterface';
|
|
8
|
+
export { AppBaseCoreInterface } from './AppBaseCoreInterface';
|
|
8
9
|
export { CoreActionInterface } from './CoreActionInterface';
|
|
9
10
|
export { ApiContextInterface } from './ApiContextInterface';
|
|
10
11
|
export { DbFieldAddDefaultInterface } from './DbFieldAddDefaultInterface';
|
|
@@ -26,14 +26,14 @@ var camelResponse = function (result) {
|
|
|
26
26
|
if (!result || result.rows) {
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
29
|
-
return utils_1.camelKeys(result);
|
|
29
|
+
return (0, utils_1.camelKeys)(result);
|
|
30
30
|
};
|
|
31
31
|
var buildKnexConfig = function (dirName, appConfig) {
|
|
32
32
|
var dbType = appConfig.dbType, dbHost = appConfig.dbHost, dbPort = appConfig.dbPort, dbName = appConfig.dbName, dbSchema = appConfig.dbSchema, dbUser = appConfig.dbUser, dbPassword = appConfig.dbPassword, debug = appConfig.debug, nodeEnv = appConfig.nodeEnv, migrationsTemplateFileName = appConfig.migrationsTemplateFileName, migrationsFolder = appConfig.migrationsFolder, migrationsTable = appConfig.migrationsTable, useSchemaForMigrationsTable = appConfig.useSchemaForMigrationsTable, seedsFolder = appConfig.seedsFolder, seedsFolderDev = appConfig.seedsFolderDev, seedsFolderProd = appConfig.seedsFolderProd;
|
|
33
33
|
var sharedConfig = {
|
|
34
34
|
client: dbType || 'pg',
|
|
35
35
|
postProcessResponse: camelResponse,
|
|
36
|
-
wrapIdentifier: function (value, origImpl) { return (value === '*' ? origImpl(value) : origImpl(lodash_1.snakeCase(value))); },
|
|
36
|
+
wrapIdentifier: function (value, origImpl) { return (value === '*' ? origImpl(value) : origImpl((0, lodash_1.snakeCase)(value))); },
|
|
37
37
|
connection: {
|
|
38
38
|
host: dbHost,
|
|
39
39
|
port: dbPort,
|
|
@@ -48,18 +48,18 @@ var buildKnexConfig = function (dirName, appConfig) {
|
|
|
48
48
|
stub: path_1.default.join(dirName, migrationsTemplateFileName || defaultMigrationsTemplateFileName),
|
|
49
49
|
directory: path_1.default.join(dirName, migrationsFolder || defaultMigrationsFolder),
|
|
50
50
|
tableName: migrationsTable ||
|
|
51
|
-
""
|
|
51
|
+
"".concat(useSchemaForMigrationsTable ? "".concat(dbSchema, ".") : '').concat(migrationsTable || defaultMigrationsTable),
|
|
52
52
|
}, seeds: {
|
|
53
53
|
directory: path_1.default.join(dirName, seedsFolderDev || seedsFolder || defaultSeedsFolder),
|
|
54
54
|
} }),
|
|
55
55
|
production: __assign(__assign({}, sharedConfig), { debug: debug, migrations: {
|
|
56
56
|
directory: path_1.default.join(dirName, migrationsFolder || defaultMigrationsFolder),
|
|
57
57
|
tableName: migrationsTable ||
|
|
58
|
-
""
|
|
58
|
+
"".concat(useSchemaForMigrationsTable ? "".concat(dbSchema, ".") : '').concat(migrationsTable || defaultMigrationsTable),
|
|
59
59
|
}, seeds: {
|
|
60
60
|
directory: path_1.default.join(dirName, seedsFolderProd || seedsFolder || defaultSeedsFolder),
|
|
61
61
|
} }),
|
|
62
62
|
};
|
|
63
|
-
return lodash_1.get(config, nodeEnv);
|
|
63
|
+
return (0, lodash_1.get)(config, nodeEnv);
|
|
64
64
|
};
|
|
65
65
|
exports.buildKnexConfig = buildKnexConfig;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.checkPassword = exports.getSaltAndHash = void 0;
|
|
43
|
+
var bcrypt_1 = __importDefault(require("bcrypt"));
|
|
44
|
+
var getSaltAndHash = function (password, saltRounds) {
|
|
45
|
+
if (saltRounds === void 0) { saltRounds = 10; }
|
|
46
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var salt, hash;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0: return [4 /*yield*/, bcrypt_1.default.genSalt(saltRounds)];
|
|
51
|
+
case 1:
|
|
52
|
+
salt = _a.sent();
|
|
53
|
+
return [4 /*yield*/, bcrypt_1.default.hash(password, salt)];
|
|
54
|
+
case 2:
|
|
55
|
+
hash = _a.sent();
|
|
56
|
+
return [2 /*return*/, {
|
|
57
|
+
salt: salt,
|
|
58
|
+
hash: hash,
|
|
59
|
+
}];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
exports.getSaltAndHash = getSaltAndHash;
|
|
65
|
+
var checkPassword = function (password, hashedPassword) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
var isCorrect;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0: return [4 /*yield*/, bcrypt_1.default.compare(password, hashedPassword)];
|
|
70
|
+
case 1:
|
|
71
|
+
isCorrect = _a.sent();
|
|
72
|
+
return [2 /*return*/, isCorrect];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}); };
|
|
76
|
+
exports.checkPassword = checkPassword;
|
|
@@ -17,56 +17,55 @@ var buildDefaultResolvers = function (args) {
|
|
|
17
17
|
var Query = __assign({}, (query || {}));
|
|
18
18
|
var Mutation = __assign({}, (mutation || {}));
|
|
19
19
|
if (disableList !== true) {
|
|
20
|
-
Query[prefix
|
|
20
|
+
Query["".concat(prefix, "List")] = function (parent, args, context) {
|
|
21
21
|
return context[core].list(args);
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
if (disableGet !== true) {
|
|
25
|
-
Query[prefix
|
|
25
|
+
Query["".concat(prefix, "Get")] = function (parent, args, context) {
|
|
26
26
|
return context[core].get(args);
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
if (disableGetMany !== true) {
|
|
30
|
-
Query[prefix
|
|
30
|
+
Query["".concat(prefix, "GetMany")] = function (parent, args, context) {
|
|
31
31
|
return context[core].getMany(args);
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
if (disableCreate !== true) {
|
|
35
|
-
Mutation[prefix
|
|
35
|
+
Mutation["".concat(prefix, "Create")] = function (parent, args, context) {
|
|
36
36
|
return context[core].create(args);
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
if (disableCreateMany !== true) {
|
|
40
|
-
Mutation[prefix
|
|
40
|
+
Mutation["".concat(prefix, "CreateMany")] = function (parent, args, context) {
|
|
41
41
|
return context[core].createMany(args);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
if (disableUpdate !== true) {
|
|
45
|
-
Mutation[prefix
|
|
45
|
+
Mutation["".concat(prefix, "Update")] = function (parent, args, context) {
|
|
46
46
|
return context[core].update(args);
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
if (disableUpdateMany !== true) {
|
|
50
|
-
Mutation[prefix
|
|
50
|
+
Mutation["".concat(prefix, "UpdateMany")] = function (parent, args, context) {
|
|
51
51
|
return context[core].updateMany(args);
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
if (disableSet !== true) {
|
|
55
|
-
Mutation[prefix
|
|
55
|
+
Mutation["".concat(prefix, "Set")] = function (parent, args, context) {
|
|
56
56
|
return context[core].set(args);
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
if (disableRemove !== true) {
|
|
60
|
-
Mutation[prefix
|
|
60
|
+
Mutation["".concat(prefix, "Remove")] = function (parent, args, context) {
|
|
61
61
|
return context[core].remove(args);
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
if (disableRemoveMany !== true) {
|
|
65
|
-
Mutation[prefix
|
|
65
|
+
Mutation["".concat(prefix, "RemoveMany")] = function (parent, args, context) {
|
|
66
66
|
return context[core].removeMany(args);
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
return __assign({ Query: Query,
|
|
70
|
-
Mutation: Mutation }, (types || {}));
|
|
69
|
+
return __assign({ Query: Query, Mutation: Mutation }, (types || {}));
|
|
71
70
|
};
|
|
72
71
|
exports.buildDefaultResolvers = buildDefaultResolvers;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdflc/backend-helpers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
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",
|
|
@@ -24,41 +24,43 @@
|
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"peerDependencies": {},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@types/
|
|
28
|
-
"@types/
|
|
29
|
-
"@types/
|
|
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",
|
|
30
31
|
"@types/jsonwebtoken": "^8.5.8",
|
|
31
|
-
"@types/lodash": "^4.14.
|
|
32
|
-
"@types/node": "^14.
|
|
33
|
-
"@types/redis": "^2.8.
|
|
34
|
-
"@types/uuid": "^8.3.
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
36
|
-
"@typescript-eslint/parser": "^4.
|
|
37
|
-
"eslint": "^7.
|
|
32
|
+
"@types/lodash": "^4.14.178",
|
|
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",
|
|
38
39
|
"eslint-config-prettier": "^6.15.0",
|
|
39
|
-
"eslint-plugin-jest": "^24.
|
|
40
|
-
"eslint-plugin-prettier": "^3.1
|
|
41
|
-
"eslint-plugin-react": "^7.
|
|
40
|
+
"eslint-plugin-jest": "^24.7.0",
|
|
41
|
+
"eslint-plugin-prettier": "^3.4.1",
|
|
42
|
+
"eslint-plugin-react": "^7.28.0",
|
|
42
43
|
"husky": "^6.0.0",
|
|
43
44
|
"jest": "^26.6.3",
|
|
44
|
-
"prettier": "^2.
|
|
45
|
+
"prettier": "^2.5.1",
|
|
45
46
|
"rimraf": "^3.0.2",
|
|
46
47
|
"run-script-os": "^1.1.3",
|
|
47
48
|
"ts-jest": "^26.4.4",
|
|
48
49
|
"ts-node": "^9.0.0",
|
|
49
|
-
"typescript": "^4.
|
|
50
|
+
"typescript": "^4.5.5"
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"@sdflc/api-helpers": "^1.1.7",
|
|
53
|
-
"@sdflc/utils": "^1.0.
|
|
54
|
+
"@sdflc/utils": "^1.0.18",
|
|
55
|
+
"bcrypt": "^5.0.1",
|
|
54
56
|
"bluebird": "^3.7.2",
|
|
55
57
|
"dataloader": "^2.0.0",
|
|
56
58
|
"dayjs": "^1.10.7",
|
|
57
59
|
"dotenv-safe": "^8.2.0",
|
|
58
60
|
"jsonwebtoken": "^8.5.1",
|
|
59
|
-
"knex": "^0.95.
|
|
61
|
+
"knex": "^0.95.15",
|
|
60
62
|
"lodash": "^4.17.20",
|
|
61
|
-
"pg": "^8.
|
|
63
|
+
"pg": "^8.7.3",
|
|
62
64
|
"redis": "^3.1.2",
|
|
63
65
|
"redis-dataloader": "^1.0.2",
|
|
64
66
|
"uuid": "^8.3.2"
|