@flowerforce/flowerbase 1.7.5 → 1.7.6-beta.1
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 +125 -1
- package/dist/auth/controller.d.ts.map +1 -1
- package/dist/auth/controller.js +11 -10
- package/dist/auth/plugins/jwt.js +1 -1
- package/dist/auth/providers/anon-user/controller.js +1 -1
- package/dist/auth/providers/custom-function/controller.d.ts.map +1 -1
- package/dist/auth/providers/custom-function/controller.js +28 -7
- package/dist/auth/providers/local-userpass/controller.d.ts.map +1 -1
- package/dist/auth/providers/local-userpass/controller.js +15 -14
- package/dist/auth/utils.d.ts +1 -0
- package/dist/auth/utils.d.ts.map +1 -1
- package/dist/constants.d.ts +11 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +14 -3
- package/dist/features/encryption/interface.d.ts +36 -0
- package/dist/features/encryption/interface.d.ts.map +1 -0
- package/dist/features/encryption/interface.js +2 -0
- package/dist/features/encryption/utils.d.ts +9 -0
- package/dist/features/encryption/utils.d.ts.map +1 -0
- package/dist/features/encryption/utils.js +34 -0
- package/dist/features/rules/utils.d.ts.map +1 -1
- package/dist/features/rules/utils.js +1 -11
- package/dist/features/triggers/index.d.ts.map +1 -1
- package/dist/features/triggers/index.js +5 -1
- package/dist/features/triggers/utils.js +3 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/dist/monitoring/plugin.d.ts.map +1 -1
- package/dist/monitoring/plugin.js +31 -0
- package/dist/monitoring/routes/users.d.ts.map +1 -1
- package/dist/monitoring/routes/users.js +7 -6
- package/dist/monitoring/utils.d.ts.map +1 -1
- package/dist/monitoring/utils.js +5 -4
- package/dist/services/api/index.d.ts +4 -0
- package/dist/services/api/index.d.ts.map +1 -1
- package/dist/services/api/utils.d.ts +1 -0
- package/dist/services/api/utils.d.ts.map +1 -1
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/mongodb-atlas/index.d.ts.map +1 -1
- package/dist/services/mongodb-atlas/index.js +9 -7
- package/dist/services/mongodb-atlas/model.d.ts +2 -1
- package/dist/services/mongodb-atlas/model.d.ts.map +1 -1
- package/dist/shared/handleUserDeletion.js +1 -1
- package/dist/shared/handleUserRegistration.js +2 -2
- package/dist/utils/context/helpers.d.ts +12 -0
- package/dist/utils/context/helpers.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +14 -3
- package/dist/utils/initializer/exposeRoutes.js +1 -1
- package/dist/utils/initializer/mongodbCSFLE.d.ts +69 -0
- package/dist/utils/initializer/mongodbCSFLE.d.ts.map +1 -0
- package/dist/utils/initializer/mongodbCSFLE.js +131 -0
- package/dist/utils/initializer/registerPlugins.d.ts +5 -1
- package/dist/utils/initializer/registerPlugins.d.ts.map +1 -1
- package/dist/utils/initializer/registerPlugins.js +27 -5
- package/dist/utils/rules-matcher/interface.d.ts +5 -1
- package/dist/utils/rules-matcher/interface.d.ts.map +1 -1
- package/dist/utils/rules-matcher/interface.js +2 -0
- package/dist/utils/rules-matcher/utils.d.ts.map +1 -1
- package/dist/utils/rules-matcher/utils.js +51 -16
- package/package.json +4 -2
- package/src/auth/__tests__/controller.test.ts +1 -0
- package/src/auth/controller.ts +12 -11
- package/src/auth/plugins/jwt.ts +2 -2
- package/src/auth/providers/anon-user/__tests__/controller.test.ts +1 -0
- package/src/auth/providers/anon-user/controller.ts +2 -2
- package/src/auth/providers/custom-function/controller.ts +29 -8
- package/src/auth/providers/local-userpass/controller.ts +16 -15
- package/src/auth/utils.ts +1 -0
- package/src/constants.ts +14 -4
- package/src/features/encryption/interface.ts +46 -0
- package/src/features/encryption/utils.ts +22 -0
- package/src/features/rules/utils.ts +1 -11
- package/src/features/triggers/__tests__/index.test.ts +1 -0
- package/src/features/triggers/index.ts +6 -2
- package/src/features/triggers/utils.ts +4 -4
- package/src/index.ts +10 -2
- package/src/monitoring/plugin.ts +33 -0
- package/src/monitoring/routes/users.ts +8 -7
- package/src/monitoring/ui.collections.js +7 -10
- package/src/monitoring/ui.css +383 -1
- package/src/monitoring/ui.endpoints.js +5 -10
- package/src/monitoring/ui.events.js +4 -6
- package/src/monitoring/ui.functions.js +64 -71
- package/src/monitoring/ui.html +8 -0
- package/src/monitoring/ui.js +189 -0
- package/src/monitoring/ui.shared.js +239 -3
- package/src/monitoring/ui.triggers.js +2 -3
- package/src/monitoring/ui.users.js +5 -9
- package/src/monitoring/utils.ts +6 -5
- package/src/services/mongodb-atlas/index.ts +10 -13
- package/src/services/mongodb-atlas/model.ts +3 -1
- package/src/shared/handleUserDeletion.ts +2 -2
- package/src/shared/handleUserRegistration.ts +3 -3
- package/src/types/fastify-raw-body.d.ts +0 -9
- package/src/utils/__tests__/mongodbCSFLE.test.ts +105 -0
- package/src/utils/__tests__/operators.test.ts +24 -0
- package/src/utils/__tests__/rule.test.ts +39 -0
- package/src/utils/__tests__/rulesMatcherInterfaces.test.ts +2 -0
- package/src/utils/index.ts +12 -1
- package/src/utils/initializer/exposeRoutes.ts +2 -2
- package/src/utils/initializer/mongodbCSFLE.ts +224 -0
- package/src/utils/initializer/registerPlugins.ts +45 -10
- package/src/utils/rules-matcher/interface.ts +5 -1
- package/src/utils/rules-matcher/utils.ts +78 -32
|
@@ -13,21 +13,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.loadRules = void 0;
|
|
16
|
-
const fs_1 = __importDefault(require("fs"));
|
|
17
16
|
const node_path_1 = __importDefault(require("node:path"));
|
|
18
17
|
const utils_1 = require("../../utils");
|
|
19
18
|
const loadRules = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (rootDir = process.cwd()) {
|
|
20
19
|
const rulesRoot = node_path_1.default.join(rootDir, 'data_sources', 'mongodb-atlas');
|
|
21
|
-
const
|
|
22
|
-
return fs_1.default.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
23
|
-
const fullPath = node_path_1.default.join(dir, entry.name);
|
|
24
|
-
if (entry.isDirectory()) {
|
|
25
|
-
return recursivelyCollectFiles(fullPath);
|
|
26
|
-
}
|
|
27
|
-
return entry.isFile() ? [fullPath] : [];
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
const files = recursivelyCollectFiles(rulesRoot);
|
|
20
|
+
const files = (0, utils_1.recursivelyCollectFiles)(rulesRoot);
|
|
31
21
|
const rulesFiles = files.filter((x) => x.endsWith('rules.json'));
|
|
32
22
|
const removeEmptyFieldRules = (rulesConfig) => {
|
|
33
23
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/triggers/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAA;AAG/C;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAU,0CAIpC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/triggers/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAA;AAG/C;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAU,0CAIpC,sBAAsB,kBAyExB,CAAA"}
|
|
@@ -32,6 +32,10 @@ const activateTriggers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fa
|
|
|
32
32
|
var _e;
|
|
33
33
|
console.log('START ACTIVATION TRIGGERS');
|
|
34
34
|
try {
|
|
35
|
+
// Ensure the changestream MongoDB client exist, or use the main client
|
|
36
|
+
if (!fastify.mongo[constants_1.CHANGESTREAM]) {
|
|
37
|
+
fastify.mongo[constants_1.CHANGESTREAM] = fastify.mongo;
|
|
38
|
+
}
|
|
35
39
|
const triggersToActivate = [...triggersList];
|
|
36
40
|
if (constants_1.AUTH_CONFIG.on_user_creation_function_name) {
|
|
37
41
|
const alreadyDeclared = triggersToActivate.some((trigger) => {
|
|
@@ -50,7 +54,7 @@ const activateTriggers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fa
|
|
|
50
54
|
config: {
|
|
51
55
|
isAutoTrigger: true,
|
|
52
56
|
collection: (_e = constants_1.AUTH_CONFIG.authCollection) !== null && _e !== void 0 ? _e : 'auth_users',
|
|
53
|
-
database: constants_1.
|
|
57
|
+
database: constants_1.AUTH_DB_NAME,
|
|
54
58
|
full_document: true,
|
|
55
59
|
full_document_before_change: false,
|
|
56
60
|
match: {},
|
|
@@ -220,11 +220,11 @@ const handleAuthenticationTrigger = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
220
220
|
const { database, isAutoTrigger, operation_types = [], operation_type } = config;
|
|
221
221
|
const providerFilter = normalizeProviders((_b = config.providers) !== null && _b !== void 0 ? _b : []);
|
|
222
222
|
const authCollection = (_c = constants_1.AUTH_CONFIG.authCollection) !== null && _c !== void 0 ? _c : 'auth_users';
|
|
223
|
-
const collection = app.mongo.client.db(database || constants_1.
|
|
223
|
+
const collection = app.mongo[constants_1.CHANGESTREAM].client.db(database || constants_1.AUTH_DB_NAME).collection(authCollection);
|
|
224
224
|
const operationCandidates = operation_type ? mapOpInverse[operation_type] : operation_types;
|
|
225
225
|
const normalizedOps = normalizeOperationTypes(operationCandidates);
|
|
226
226
|
const baseMeta = {
|
|
227
|
-
database: database || constants_1.
|
|
227
|
+
database: database || constants_1.AUTH_DB_NAME,
|
|
228
228
|
collection: authCollection,
|
|
229
229
|
operationTypes: normalizedOps,
|
|
230
230
|
providers: providerFilter,
|
|
@@ -575,7 +575,7 @@ const handleAuthenticationTrigger = (_a) => __awaiter(void 0, [_a], void 0, func
|
|
|
575
575
|
const handleDataBaseTrigger = (_a) => __awaiter(void 0, [_a], void 0, function* ({ config, triggerHandler, functionsList, services, app, triggerName, triggerType, functionName }) {
|
|
576
576
|
const { database, collection: collectionName, operation_types = [], match = {}, project = {} } = config;
|
|
577
577
|
const normalizedOperations = normalizeOperationTypes(operation_types);
|
|
578
|
-
const collection = app.mongo.client.db(database).collection(collectionName);
|
|
578
|
+
const collection = app.mongo[constants_1.CHANGESTREAM].client.db(database).collection(collectionName);
|
|
579
579
|
const pipeline = [
|
|
580
580
|
{
|
|
581
581
|
$match: Object.assign({ operationType: { $in: normalizedOperations } }, match)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
|
+
import { type MongoDbEncryptionConfig } from './utils/initializer/mongodbCSFLE';
|
|
2
3
|
export * from './model';
|
|
3
4
|
export type ALLOWED_METHODS = "GET" | "POST" | "PUT" | "DELETE";
|
|
4
5
|
export type CorsConfig = {
|
|
@@ -13,6 +14,7 @@ export type InitializeConfig = {
|
|
|
13
14
|
host?: string;
|
|
14
15
|
corsConfig?: CorsConfig;
|
|
15
16
|
basePath?: string;
|
|
17
|
+
mongodbEncryptionConfig?: MongoDbEncryptionConfig;
|
|
16
18
|
};
|
|
17
19
|
/**
|
|
18
20
|
* > Used to initialize fastify app
|
|
@@ -22,5 +24,5 @@ export type InitializeConfig = {
|
|
|
22
24
|
* @param port -> the serve port number
|
|
23
25
|
* @param mongodbUrl -> the database connection string
|
|
24
26
|
*/
|
|
25
|
-
export declare function initialize({ projectId, host, jwtSecret, port, mongodbUrl, corsConfig, basePath }: InitializeConfig): Promise<void>;
|
|
27
|
+
export declare function initialize({ projectId, host, jwtSecret, port, mongodbUrl, corsConfig, basePath, mongodbEncryptionConfig }: InitializeConfig): Promise<void>;
|
|
26
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAetB,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAC/E,cAAc,SAAS,CAAA;AAGvB,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAA;AAE/D,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,eAAe,EAAE,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;CAClD,CAAA;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,EAC/B,SAAS,EACT,IAA0B,EAC1B,SAAqC,EACrC,IAA0B,EAC1B,UAAuC,EACvC,UAAwC,EACxC,QAAQ,EACR,uBAAuB,EACxB,EAAE,gBAAgB,iBA6HlB"}
|
package/dist/index.js
CHANGED
|
@@ -57,8 +57,9 @@ const utils_1 = require("./features/endpoints/utils");
|
|
|
57
57
|
const functions_1 = require("./features/functions");
|
|
58
58
|
const utils_2 = require("./features/functions/utils");
|
|
59
59
|
const utils_3 = require("./features/rules/utils");
|
|
60
|
+
const utils_4 = require("./features/encryption/utils");
|
|
60
61
|
const triggers_1 = require("./features/triggers");
|
|
61
|
-
const
|
|
62
|
+
const utils_5 = require("./features/triggers/utils");
|
|
62
63
|
const services_1 = require("./services");
|
|
63
64
|
const state_1 = require("./state");
|
|
64
65
|
const exposeRoutes_1 = require("./utils/initializer/exposeRoutes");
|
|
@@ -73,7 +74,7 @@ __exportStar(require("./model"), exports);
|
|
|
73
74
|
* @param mongodbUrl -> the database connection string
|
|
74
75
|
*/
|
|
75
76
|
function initialize(_a) {
|
|
76
|
-
return __awaiter(this, arguments, void 0, function* ({ projectId, host = constants_1.DEFAULT_CONFIG.HOST, jwtSecret = constants_1.DEFAULT_CONFIG.JWT_SECRET, port = constants_1.DEFAULT_CONFIG.PORT, mongodbUrl = constants_1.DEFAULT_CONFIG.MONGODB_URL, corsConfig = constants_1.DEFAULT_CONFIG.CORS_OPTIONS, basePath }) {
|
|
77
|
+
return __awaiter(this, arguments, void 0, function* ({ projectId, host = constants_1.DEFAULT_CONFIG.HOST, jwtSecret = constants_1.DEFAULT_CONFIG.JWT_SECRET, port = constants_1.DEFAULT_CONFIG.PORT, mongodbUrl = constants_1.DEFAULT_CONFIG.MONGODB_URL, corsConfig = constants_1.DEFAULT_CONFIG.CORS_OPTIONS, basePath, mongodbEncryptionConfig }) {
|
|
77
78
|
var _b, _c;
|
|
78
79
|
if (!jwtSecret || jwtSecret.trim().length === 0) {
|
|
79
80
|
throw new Error('JWT secret missing: set JWT_SECRET or pass jwtSecret to initialize()');
|
|
@@ -93,12 +94,14 @@ function initialize(_a) {
|
|
|
93
94
|
logInfo("CURRENT HOST", host);
|
|
94
95
|
const functionsList = yield (0, utils_2.loadFunctions)(resolvedBasePath);
|
|
95
96
|
logInfo("Functions LOADED");
|
|
96
|
-
const triggersList = yield (0,
|
|
97
|
+
const triggersList = yield (0, utils_5.loadTriggers)(resolvedBasePath);
|
|
97
98
|
logInfo("Triggers LOADED");
|
|
98
99
|
const endpointsList = yield (0, utils_1.loadEndpoints)(resolvedBasePath);
|
|
99
100
|
logInfo("Endpoints LOADED");
|
|
100
101
|
const rulesList = yield (0, utils_3.loadRules)(resolvedBasePath);
|
|
101
102
|
logInfo("Rules LOADED");
|
|
103
|
+
const encryptionSchemas = yield (0, utils_4.loadEncryptionSchemas)(resolvedBasePath);
|
|
104
|
+
logInfo("Encryption schemas LOADED");
|
|
102
105
|
const stateConfig = {
|
|
103
106
|
functions: functionsList,
|
|
104
107
|
triggers: triggersList,
|
|
@@ -168,7 +171,9 @@ function initialize(_a) {
|
|
|
168
171
|
mongodbUrl,
|
|
169
172
|
jwtSecret,
|
|
170
173
|
functionsList,
|
|
171
|
-
corsConfig
|
|
174
|
+
corsConfig,
|
|
175
|
+
encryptionSchemas,
|
|
176
|
+
mongodbEncryptionConfig
|
|
172
177
|
});
|
|
173
178
|
logInfo('Plugins registration COMPLETED');
|
|
174
179
|
yield (0, exposeRoutes_1.exposeRoutes)(fastify);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/monitoring/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAA;AAE5E,OAAO,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/monitoring/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAA;AAE5E,OAAO,oBAAoB,CAAA;AA2B3B,QAAA,MAAM,sBAAsB,QACrB,eAAe,SACd;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,kBA4WH,CAAA;AAE1B,eAAe,sBAAsB,CAAA"}
|
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const websocket_1 = __importDefault(require("@fastify/websocket"));
|
|
16
16
|
const fastify_plugin_1 = __importDefault(require("fastify-plugin"));
|
|
17
17
|
require("@fastify/websocket");
|
|
18
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
19
|
const constants_1 = require("../constants");
|
|
19
20
|
const state_1 = require("../state");
|
|
20
21
|
const collections_1 = require("./routes/collections");
|
|
@@ -289,6 +290,36 @@ const createMonitoringPlugin = (0, fastify_plugin_1.default)((app_1, ...args_1)
|
|
|
289
290
|
reply.type('application/javascript').send(js);
|
|
290
291
|
}));
|
|
291
292
|
});
|
|
293
|
+
const resolveCodeMirrorAsset = (internalPath) => {
|
|
294
|
+
try {
|
|
295
|
+
return require.resolve(`codemirror/${internalPath}`);
|
|
296
|
+
}
|
|
297
|
+
catch (_a) {
|
|
298
|
+
return '';
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
const codemirrorAssets = {
|
|
302
|
+
'codemirror.js': resolveCodeMirrorAsset('lib/codemirror.js'),
|
|
303
|
+
'codemirror.css': resolveCodeMirrorAsset('lib/codemirror.css'),
|
|
304
|
+
'javascript.js': resolveCodeMirrorAsset('mode/javascript/javascript.js'),
|
|
305
|
+
'foldcode.js': resolveCodeMirrorAsset('addon/fold/foldcode.js'),
|
|
306
|
+
'foldgutter.js': resolveCodeMirrorAsset('addon/fold/foldgutter.js'),
|
|
307
|
+
'brace-fold.js': resolveCodeMirrorAsset('addon/fold/brace-fold.js'),
|
|
308
|
+
'comment-fold.js': resolveCodeMirrorAsset('addon/fold/comment-fold.js'),
|
|
309
|
+
'foldgutter.css': resolveCodeMirrorAsset('addon/fold/foldgutter.css')
|
|
310
|
+
};
|
|
311
|
+
Object.entries(codemirrorAssets).forEach(([assetName, relativePath]) => {
|
|
312
|
+
app.get(`${prefix}/vendor/codemirror/${assetName}`, (_req, reply) => __awaiter(void 0, void 0, void 0, function* () {
|
|
313
|
+
const assetPath = relativePath || '';
|
|
314
|
+
if (!assetPath || !fs_1.default.existsSync(assetPath)) {
|
|
315
|
+
reply.code(404).send(`${assetName} not found`);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const asset = fs_1.default.readFileSync(assetPath, 'utf8');
|
|
319
|
+
reply.header('Cache-Control', 'no-store');
|
|
320
|
+
reply.type(assetName.endsWith('.css') ? 'text/css' : 'application/javascript').send(asset);
|
|
321
|
+
}));
|
|
322
|
+
});
|
|
292
323
|
app.get(`${prefix}/ws`, { websocket: true }, (connection) => {
|
|
293
324
|
var _a;
|
|
294
325
|
const socket = (_a = connection.socket) !== null && _a !== void 0 ? _a : connection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/monitoring/routes/users.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAO9C,OAAO,EAAiB,YAAY,EAAY,MAAM,UAAU,CAAA;AAEhE,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CACxC,CAAA;AAYD,eAAO,MAAM,kBAAkB,GAAI,KAAK,eAAe,EAAE,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/monitoring/routes/users.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAO9C,OAAO,EAAiB,YAAY,EAAY,MAAM,UAAU,CAAA;AAEhE,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CACxC,CAAA;AAYD,eAAO,MAAM,kBAAkB,GAAI,KAAK,eAAe,EAAE,MAAM,cAAc,SAuP5E,CAAA"}
|
|
@@ -46,7 +46,8 @@ const registerUserRoutes = (app, deps) => {
|
|
|
46
46
|
const resolvedAuthLimit = Math.min(Number.isFinite(parsedAuthLimit) && parsedAuthLimit > 0 ? parsedAuthLimit : 100, 500);
|
|
47
47
|
const resolvedCustomLimit = Math.min(Number.isFinite(parsedCustomLimit) && parsedCustomLimit > 0 ? parsedCustomLimit : 25, 500);
|
|
48
48
|
const resolvedCustomPage = Math.max(Number.isFinite(parsedPage) && parsedPage > 0 ? parsedPage : 1, 1);
|
|
49
|
-
const
|
|
49
|
+
const authDb = app.mongo.client.db(constants_1.AUTH_DB_NAME);
|
|
50
|
+
const customDb = app.mongo.client.db(constants_1.DB_NAME);
|
|
50
51
|
const authCollection = (_h = constants_1.AUTH_CONFIG.authCollection) !== null && _h !== void 0 ? _h : 'auth_users';
|
|
51
52
|
const userCollection = constants_1.AUTH_CONFIG.userCollection;
|
|
52
53
|
const response = {
|
|
@@ -66,7 +67,7 @@ const registerUserRoutes = (app, deps) => {
|
|
|
66
67
|
]
|
|
67
68
|
}
|
|
68
69
|
: {};
|
|
69
|
-
const authItems = yield
|
|
70
|
+
const authItems = yield authDb
|
|
70
71
|
.collection(authCollection)
|
|
71
72
|
.find(authFilter)
|
|
72
73
|
.sort({ createdAt: -1, _id: -1 })
|
|
@@ -90,11 +91,11 @@ const registerUserRoutes = (app, deps) => {
|
|
|
90
91
|
]
|
|
91
92
|
}
|
|
92
93
|
: {};
|
|
93
|
-
const total = yield
|
|
94
|
+
const total = yield customDb.collection(userCollection).countDocuments(customFilter);
|
|
94
95
|
const totalPages = Math.max(1, Math.ceil(total / Math.max(resolvedCustomLimit, 1)));
|
|
95
96
|
const page = Math.min(resolvedCustomPage, totalPages);
|
|
96
97
|
const skip = Math.max(0, (page - 1) * resolvedCustomLimit);
|
|
97
|
-
const customItems = yield
|
|
98
|
+
const customItems = yield customDb
|
|
98
99
|
.collection(userCollection)
|
|
99
100
|
.find(customFilter)
|
|
100
101
|
.sort({ createdAt: -1, _id: -1 })
|
|
@@ -181,7 +182,7 @@ const registerUserRoutes = (app, deps) => {
|
|
|
181
182
|
reply.code(400);
|
|
182
183
|
return { error: passwordError };
|
|
183
184
|
}
|
|
184
|
-
const db = app.mongo.client.db(constants_1.
|
|
185
|
+
const db = app.mongo.client.db(constants_1.AUTH_DB_NAME);
|
|
185
186
|
const authCollection = (_a = constants_1.AUTH_CONFIG.authCollection) !== null && _a !== void 0 ? _a : 'auth_users';
|
|
186
187
|
const selector = {};
|
|
187
188
|
if (params.id && mongodb_1.ObjectId.isValid(params.id)) {
|
|
@@ -216,7 +217,7 @@ const registerUserRoutes = (app, deps) => {
|
|
|
216
217
|
var _a, _b;
|
|
217
218
|
const params = req.params;
|
|
218
219
|
const body = req.body;
|
|
219
|
-
const db = app.mongo.client.db(constants_1.
|
|
220
|
+
const db = app.mongo.client.db(constants_1.AUTH_DB_NAME);
|
|
220
221
|
const authCollection = (_a = constants_1.AUTH_CONFIG.authCollection) !== null && _a !== void 0 ? _a : 'auth_users';
|
|
221
222
|
const selector = {};
|
|
222
223
|
if (params.id && mongodb_1.ObjectId.isValid(params.id)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/monitoring/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAG9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAA;AAIxD,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,WAAW,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACtC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE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;AAED,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,EAAE,QAAQ,MAAM,aAiBtE,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,UAAU,MAAM,EAAE,QAAQ,MAAM,WAYzD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,KAAK,eAAe,EACpB,SAAS,MAAM,EACf,cAAc,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,iDAyDtC,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,eAAe,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;aAajE,CAAA"}
|
package/dist/monitoring/utils.js
CHANGED
|
@@ -332,7 +332,8 @@ const resolveUserContext = (app, userId, userPayload) => __awaiter(void 0, void
|
|
|
332
332
|
if (!userId)
|
|
333
333
|
return undefined;
|
|
334
334
|
const normalizedUserId = userId.trim();
|
|
335
|
-
const
|
|
335
|
+
const authDb = app.mongo.client.db(constants_1.AUTH_DB_NAME);
|
|
336
|
+
const customDb = app.mongo.client.db(constants_1.DB_NAME);
|
|
336
337
|
const authCollection = (_a = constants_1.AUTH_CONFIG.authCollection) !== null && _a !== void 0 ? _a : 'auth_users';
|
|
337
338
|
const userCollection = constants_1.AUTH_CONFIG.userCollection;
|
|
338
339
|
const userIdField = (_b = constants_1.AUTH_CONFIG.user_id_field) !== null && _b !== void 0 ? _b : 'id';
|
|
@@ -340,13 +341,13 @@ const resolveUserContext = (app, userId, userPayload) => __awaiter(void 0, void
|
|
|
340
341
|
const authSelector = isObjectId
|
|
341
342
|
? { _id: new mongodb_1.ObjectId(normalizedUserId) }
|
|
342
343
|
: { id: normalizedUserId };
|
|
343
|
-
const authUser = yield
|
|
344
|
+
const authUser = yield authDb.collection(authCollection).findOne(authSelector);
|
|
344
345
|
let customUser = null;
|
|
345
346
|
if (userCollection) {
|
|
346
347
|
const customSelector = { [userIdField]: normalizedUserId };
|
|
347
|
-
customUser = yield
|
|
348
|
+
customUser = yield customDb.collection(userCollection).findOne(customSelector);
|
|
348
349
|
if (!customUser && isObjectId) {
|
|
349
|
-
customUser = yield
|
|
350
|
+
customUser = yield customDb.collection(userCollection).findOne({ _id: new mongodb_1.ObjectId(normalizedUserId) });
|
|
350
351
|
}
|
|
351
352
|
}
|
|
352
353
|
const id = authUser && typeof authUser._id !== 'undefined'
|
|
@@ -30,6 +30,7 @@ declare const Api: (_app?: unknown, opt?: {
|
|
|
30
30
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
31
31
|
};
|
|
32
32
|
statusCode: number;
|
|
33
|
+
statusText: string;
|
|
33
34
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
34
35
|
trailers: Record<string, string>;
|
|
35
36
|
opaque: T;
|
|
@@ -58,6 +59,7 @@ declare const Api: (_app?: unknown, opt?: {
|
|
|
58
59
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
59
60
|
};
|
|
60
61
|
statusCode: number;
|
|
62
|
+
statusText: string;
|
|
61
63
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
62
64
|
trailers: Record<string, string>;
|
|
63
65
|
opaque: T;
|
|
@@ -86,6 +88,7 @@ declare const Api: (_app?: unknown, opt?: {
|
|
|
86
88
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
87
89
|
};
|
|
88
90
|
statusCode: number;
|
|
91
|
+
statusText: string;
|
|
89
92
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
90
93
|
trailers: Record<string, string>;
|
|
91
94
|
opaque: T;
|
|
@@ -114,6 +117,7 @@ declare const Api: (_app?: unknown, opt?: {
|
|
|
114
117
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
115
118
|
};
|
|
116
119
|
statusCode: number;
|
|
120
|
+
statusText: string;
|
|
117
121
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
118
122
|
trailers: Record<string, string>;
|
|
119
123
|
opaque: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxE;;GAEG;AACH,QAAA,MAAM,GAAG,GAAI,OAAO,OAAO,EAAE,MAAM;IAAE,UAAU,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE;UAG5D,CAAC,wCAAoD,SAAS
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxE;;GAEG;AACH,QAAA,MAAM,GAAG,GAAI,OAAO,OAAO,EAAE,MAAM;IAAE,UAAU,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE;UAG5D,CAAC,wCAAoD,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAuB7D,CAAC,gGASX,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+BD,CAAC,gGASV,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aA+BG,CAAC,wEAOb,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBlB,CAAA;AAED,eAAe,GAAG,CAAA"}
|
|
@@ -29,6 +29,7 @@ export declare const makeRequest: <T = null>({ method, url, headers, body, resol
|
|
|
29
29
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
30
30
|
};
|
|
31
31
|
statusCode: number;
|
|
32
|
+
statusText: string;
|
|
32
33
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
33
34
|
trailers: Record<string, string>;
|
|
34
35
|
opaque: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/services/api/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAgBlD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,GAAG,IAAI,EAAE,6CAMzC,iBAAiB
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/services/api/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAgBlD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,GAAG,IAAI,EAAE,6CAMzC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBnB,CAAA"}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export declare const services: {
|
|
|
27
27
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
28
28
|
};
|
|
29
29
|
statusCode: number;
|
|
30
|
+
statusText: string;
|
|
30
31
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
31
32
|
trailers: Record<string, string>;
|
|
32
33
|
opaque: T;
|
|
@@ -55,6 +56,7 @@ export declare const services: {
|
|
|
55
56
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
56
57
|
};
|
|
57
58
|
statusCode: number;
|
|
59
|
+
statusText: string;
|
|
58
60
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
59
61
|
trailers: Record<string, string>;
|
|
60
62
|
opaque: T;
|
|
@@ -83,6 +85,7 @@ export declare const services: {
|
|
|
83
85
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
84
86
|
};
|
|
85
87
|
statusCode: number;
|
|
88
|
+
statusText: string;
|
|
86
89
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
87
90
|
trailers: Record<string, string>;
|
|
88
91
|
opaque: T;
|
|
@@ -111,6 +114,7 @@ export declare const services: {
|
|
|
111
114
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
112
115
|
};
|
|
113
116
|
statusCode: number;
|
|
117
|
+
statusText: string;
|
|
114
118
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
115
119
|
trailers: Record<string, string>;
|
|
116
120
|
opaque: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;kBAMoG,CAAC;uBAAe,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;kBAMoG,CAAC;uBAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAA2hB,CAAC;uBAAe,CAAC;;;;;;;;;;;;;;;;sBAA0/F,CAAC;yBAAa,CAAC;;;;;;;;;;;CAD9rH,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/mongodb-atlas/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAGL,oBAAoB,EAErB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/mongodb-atlas/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAGL,oBAAoB,EAErB,MAAM,SAAS,CAAA;AAq0ChB,QAAA,MAAM,YAAY,EAAE,oBAwBlB,CAAA;AAEF,eAAe,YAAY,CAAA"}
|
|
@@ -32,6 +32,7 @@ const utils_1 = require("../../monitoring/utils");
|
|
|
32
32
|
const machines_1 = require("../../utils/roles/machines");
|
|
33
33
|
const utils_2 = require("../../utils/roles/machines/utils");
|
|
34
34
|
const monitoring_1 = require("../monitoring");
|
|
35
|
+
const constants_1 = require("../../constants");
|
|
35
36
|
const model_1 = require("./model");
|
|
36
37
|
const utils_3 = require("./utils");
|
|
37
38
|
//TODO aggiungere no-sql inject security
|
|
@@ -333,8 +334,9 @@ const areUpdatedFieldsAllowed = (filtered, updated, updatedPaths) => {
|
|
|
333
334
|
return (0, isEqual_1.default)(filtered, updated);
|
|
334
335
|
return updatedPaths.every((path) => (0, isEqual_1.default)((0, get_1.default)(filtered, path), (0, get_1.default)(updated, path)));
|
|
335
336
|
};
|
|
336
|
-
const getOperators = (
|
|
337
|
+
const getOperators = (mongo, { rules, dbName, collName, user, run_as_system, monitoringOrigin }) => {
|
|
337
338
|
var _a, _b;
|
|
339
|
+
const collection = mongo.client.db(dbName).collection(collName);
|
|
338
340
|
const normalizedRules = rules !== null && rules !== void 0 ? rules : {};
|
|
339
341
|
const collectionRules = normalizedRules[collName];
|
|
340
342
|
const filters = (_a = collectionRules === null || collectionRules === void 0 ? void 0 : collectionRules.filters) !== null && _a !== void 0 ? _a : [];
|
|
@@ -852,6 +854,7 @@ const getOperators = (collection, { rules, collName, user, run_as_system, monito
|
|
|
852
854
|
* This allows fine-grained control over what change events a user can observe, based on roles and filters.
|
|
853
855
|
*/
|
|
854
856
|
watch: (pipelineOrOptions = [], options) => {
|
|
857
|
+
const changestreamCollection = mongo[constants_1.CHANGESTREAM].client.db(dbName).collection(collName);
|
|
855
858
|
try {
|
|
856
859
|
const { pipeline, options: watchOptions, extraMatches } = resolveWatchArgs(pipelineOrOptions, options);
|
|
857
860
|
if (!run_as_system) {
|
|
@@ -867,7 +870,7 @@ const getOperators = (collection, { rules, collName, user, run_as_system, monito
|
|
|
867
870
|
}
|
|
868
871
|
: undefined;
|
|
869
872
|
const formattedPipeline = [firstStep, ...extraMatches, ...pipeline].filter(Boolean);
|
|
870
|
-
const result =
|
|
873
|
+
const result = changestreamCollection.watch(formattedPipeline, watchOptions);
|
|
871
874
|
const originalOn = result.on.bind(result);
|
|
872
875
|
/**
|
|
873
876
|
* Validates a change event against the user's roles.
|
|
@@ -917,7 +920,7 @@ const getOperators = (collection, { rules, collName, user, run_as_system, monito
|
|
|
917
920
|
return result;
|
|
918
921
|
}
|
|
919
922
|
// System mode: no filtering applied
|
|
920
|
-
const result =
|
|
923
|
+
const result = changestreamCollection.watch([...extraMatches, ...pipeline], watchOptions);
|
|
921
924
|
emitMongoEvent('watch');
|
|
922
925
|
return result;
|
|
923
926
|
}
|
|
@@ -1138,11 +1141,10 @@ const MongodbAtlas = (app, { rules, user, run_as_system, monitoring } = {}) => (
|
|
|
1138
1141
|
db: (dbName) => {
|
|
1139
1142
|
return {
|
|
1140
1143
|
collection: (collName) => {
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
return getOperators(collection, {
|
|
1144
|
-
rules,
|
|
1144
|
+
return getOperators(app.mongo, {
|
|
1145
|
+
dbName,
|
|
1145
1146
|
collName,
|
|
1147
|
+
rules,
|
|
1146
1148
|
user,
|
|
1147
1149
|
run_as_system,
|
|
1148
1150
|
monitoringOrigin: monitoring === null || monitoring === void 0 ? void 0 : monitoring.invokedFrom
|
|
@@ -22,10 +22,11 @@ export type GetValidRuleParams<T extends Role | Filter> = {
|
|
|
22
22
|
record?: WithId<Document> | Document | null;
|
|
23
23
|
};
|
|
24
24
|
type Method<T extends keyof Collection<Document>> = Collection<Document>[T];
|
|
25
|
-
export type GetOperatorsFunction = (
|
|
25
|
+
export type GetOperatorsFunction = (mongoInstance: FastifyInstance["mongo"], { rules, dbName, collName, user, run_as_system, monitoringOrigin }: {
|
|
26
26
|
user?: User;
|
|
27
27
|
rules?: Rules;
|
|
28
28
|
run_as_system?: boolean;
|
|
29
|
+
dbName: string;
|
|
29
30
|
collName: string;
|
|
30
31
|
monitoringOrigin?: string;
|
|
31
32
|
}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/services/mongodb-atlas/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,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A;AAED,MAAM,MAAM,sCAAsC,GAAG,uBAAuB,GAAG;IAC7E,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAGD,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,MAAM,WAAW;CAElB"}
|
|
@@ -40,7 +40,7 @@ const handleUserDeletion = (app, opt) => (_a) => __awaiter(void 0, [_a], void 0,
|
|
|
40
40
|
}
|
|
41
41
|
const { authCollection } = constants_1.AUTH_CONFIG;
|
|
42
42
|
const mongo = app === null || app === void 0 ? void 0 : app.mongo;
|
|
43
|
-
const db = mongo.client.db(constants_1.
|
|
43
|
+
const db = mongo.client.db(constants_1.AUTH_DB_NAME);
|
|
44
44
|
const collection = db.collection(authCollection);
|
|
45
45
|
let query;
|
|
46
46
|
if (id) {
|
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const constants_1 = require("../constants");
|
|
13
|
+
const monitoring_1 = require("../services/monitoring");
|
|
13
14
|
const state_1 = require("../state");
|
|
14
15
|
const context_1 = require("../utils/context");
|
|
15
16
|
const crypto_1 = require("../utils/crypto");
|
|
16
|
-
const monitoring_1 = require("../services/monitoring");
|
|
17
17
|
/**
|
|
18
18
|
* Register user
|
|
19
19
|
*
|
|
@@ -43,7 +43,7 @@ const handleUserRegistration = (app, opt) => (_a) => __awaiter(void 0, [_a], voi
|
|
|
43
43
|
const runConfirmationFunction = (localUserpassConfig === null || localUserpassConfig === void 0 ? void 0 : localUserpassConfig.runConfirmationFunction) === true;
|
|
44
44
|
const confirmationFunctionName = localUserpassConfig === null || localUserpassConfig === void 0 ? void 0 : localUserpassConfig.confirmationFunctionName;
|
|
45
45
|
const mongo = app === null || app === void 0 ? void 0 : app.mongo;
|
|
46
|
-
const db = mongo.client.db(constants_1.
|
|
46
|
+
const db = mongo.client.db(constants_1.AUTH_DB_NAME);
|
|
47
47
|
const hashedPassword = yield (0, crypto_1.hashPassword)(password);
|
|
48
48
|
const existingUser = yield (db === null || db === void 0 ? void 0 : db.collection(authCollection).findOne({ email }));
|
|
49
49
|
if (existingUser && !skipUserCheck) {
|
|
@@ -82,6 +82,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
82
82
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
83
83
|
};
|
|
84
84
|
statusCode: number;
|
|
85
|
+
statusText: string;
|
|
85
86
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
86
87
|
trailers: Record<string, string>;
|
|
87
88
|
opaque: T;
|
|
@@ -110,6 +111,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
110
111
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
111
112
|
};
|
|
112
113
|
statusCode: number;
|
|
114
|
+
statusText: string;
|
|
113
115
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
114
116
|
trailers: Record<string, string>;
|
|
115
117
|
opaque: T;
|
|
@@ -138,6 +140,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
138
140
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
139
141
|
};
|
|
140
142
|
statusCode: number;
|
|
143
|
+
statusText: string;
|
|
141
144
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
142
145
|
trailers: Record<string, string>;
|
|
143
146
|
opaque: T;
|
|
@@ -166,6 +169,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
166
169
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
167
170
|
};
|
|
168
171
|
statusCode: number;
|
|
172
|
+
statusText: string;
|
|
169
173
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
170
174
|
trailers: Record<string, string>;
|
|
171
175
|
opaque: T;
|
|
@@ -230,6 +234,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
230
234
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
231
235
|
};
|
|
232
236
|
statusCode: number;
|
|
237
|
+
statusText: string;
|
|
233
238
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
234
239
|
trailers: Record<string, string>;
|
|
235
240
|
opaque: T;
|
|
@@ -258,6 +263,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
258
263
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
259
264
|
};
|
|
260
265
|
statusCode: number;
|
|
266
|
+
statusText: string;
|
|
261
267
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
262
268
|
trailers: Record<string, string>;
|
|
263
269
|
opaque: T;
|
|
@@ -286,6 +292,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
286
292
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
287
293
|
};
|
|
288
294
|
statusCode: number;
|
|
295
|
+
statusText: string;
|
|
289
296
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
290
297
|
trailers: Record<string, string>;
|
|
291
298
|
opaque: T;
|
|
@@ -314,6 +321,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
314
321
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
315
322
|
};
|
|
316
323
|
statusCode: number;
|
|
324
|
+
statusText: string;
|
|
317
325
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
318
326
|
trailers: Record<string, string>;
|
|
319
327
|
opaque: T;
|
|
@@ -377,6 +385,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
377
385
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
378
386
|
};
|
|
379
387
|
statusCode: number;
|
|
388
|
+
statusText: string;
|
|
380
389
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
381
390
|
trailers: Record<string, string>;
|
|
382
391
|
opaque: T;
|
|
@@ -405,6 +414,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
405
414
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
406
415
|
};
|
|
407
416
|
statusCode: number;
|
|
417
|
+
statusText: string;
|
|
408
418
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
409
419
|
trailers: Record<string, string>;
|
|
410
420
|
opaque: T;
|
|
@@ -433,6 +443,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
433
443
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
434
444
|
};
|
|
435
445
|
statusCode: number;
|
|
446
|
+
statusText: string;
|
|
436
447
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
437
448
|
trailers: Record<string, string>;
|
|
438
449
|
opaque: T;
|
|
@@ -461,6 +472,7 @@ export declare const generateContextData: ({ user, services, app, rules, current
|
|
|
461
472
|
bytes: () => Uint8Array<ArrayBuffer>;
|
|
462
473
|
};
|
|
463
474
|
statusCode: number;
|
|
475
|
+
statusText: string;
|
|
464
476
|
headers: import("undici/types/header").IncomingHttpHeaders;
|
|
465
477
|
trailers: Record<string, string>;
|
|
466
478
|
opaque: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/utils/context/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAG1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAEvD,KAAK,QAAQ,GAAG;IACd,MAAM,EAAE,CACN,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACzC,MAAM,CAAA;IACX,MAAM,EAAE,CACN,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,YAAY,CAAC,EAAE,OAAO,EACtB,sBAAsB,CAAC,EA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