@minimaltech/node-infra 0.5.10-20 → 0.5.10-22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/authenticate/common/types.d.ts +33 -0
- package/dist/components/authenticate/common/types.d.ts.map +1 -1
- package/dist/components/authenticate/common/types.js +5 -0
- package/dist/components/authenticate/common/types.js.map +1 -1
- package/dist/components/authenticate/controllers/oauth2.controller.d.ts +41 -0
- package/dist/components/authenticate/controllers/oauth2.controller.d.ts.map +1 -1
- package/dist/components/authenticate/controllers/oauth2.controller.js +25 -3
- package/dist/components/authenticate/controllers/oauth2.controller.js.map +1 -1
- package/dist/components/authenticate/models/oauth2-scope.model.d.ts +6 -2
- package/dist/components/authenticate/models/oauth2-scope.model.d.ts.map +1 -1
- package/dist/components/authenticate/models/oauth2-scope.model.js +47 -0
- package/dist/components/authenticate/models/oauth2-scope.model.js.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/authorization-code.handler.d.ts.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/authorization-code.handler.js +20 -13
- package/dist/components/authenticate/oauth2-handlers/authorization-code.handler.js.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/base.d.ts +22 -5
- package/dist/components/authenticate/oauth2-handlers/base.d.ts.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/base.js +103 -28
- package/dist/components/authenticate/oauth2-handlers/base.js.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/config/index.d.ts +2 -0
- package/dist/components/authenticate/oauth2-handlers/config/index.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/config/index.js +18 -0
- package/dist/components/authenticate/oauth2-handlers/config/index.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/config/scope-config-validator.d.ts +46 -0
- package/dist/components/authenticate/oauth2-handlers/config/scope-config-validator.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/config/scope-config-validator.js +199 -0
- package/dist/components/authenticate/oauth2-handlers/config/scope-config-validator.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/constants/index.d.ts +2 -0
- package/dist/components/authenticate/oauth2-handlers/constants/index.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/constants/index.js +18 -0
- package/dist/components/authenticate/oauth2-handlers/constants/index.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/constants/scope-constants.d.ts +79 -0
- package/dist/components/authenticate/oauth2-handlers/constants/scope-constants.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/constants/scope-constants.js +117 -0
- package/dist/components/authenticate/oauth2-handlers/constants/scope-constants.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/data/index.d.ts +2 -0
- package/dist/components/authenticate/oauth2-handlers/data/index.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/data/index.js +18 -0
- package/dist/components/authenticate/oauth2-handlers/data/index.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/data/user-data-fetcher.d.ts +99 -0
- package/dist/components/authenticate/oauth2-handlers/data/user-data-fetcher.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/data/user-data-fetcher.js +371 -0
- package/dist/components/authenticate/oauth2-handlers/data/user-data-fetcher.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/index.d.ts +4 -0
- package/dist/components/authenticate/oauth2-handlers/index.d.ts.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/index.js +4 -0
- package/dist/components/authenticate/oauth2-handlers/index.js.map +1 -1
- package/dist/components/authenticate/oauth2-handlers/scope/index.d.ts +4 -0
- package/dist/components/authenticate/oauth2-handlers/scope/index.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/index.js +20 -0
- package/dist/components/authenticate/oauth2-handlers/scope/index.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-manager.d.ts +64 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-manager.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-manager.js +100 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-manager.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-parser.d.ts +49 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-parser.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-parser.js +89 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-parser.js.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-validator.d.ts +58 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-validator.d.ts.map +1 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-validator.js +165 -0
- package/dist/components/authenticate/oauth2-handlers/scope/scope-validator.js.map +1 -0
- package/dist/components/authenticate/services/index.d.ts +1 -0
- package/dist/components/authenticate/services/index.d.ts.map +1 -1
- package/dist/components/authenticate/services/index.js +1 -0
- package/dist/components/authenticate/services/index.js.map +1 -1
- package/dist/components/authenticate/services/oauth2-scope.service.d.ts +22 -0
- package/dist/components/authenticate/services/oauth2-scope.service.d.ts.map +1 -0
- package/dist/components/authenticate/services/oauth2-scope.service.js +63 -0
- package/dist/components/authenticate/services/oauth2-scope.service.js.map +1 -0
- package/dist/components/authenticate/services/oauth2.service.d.ts +2 -0
- package/dist/components/authenticate/services/oauth2.service.d.ts.map +1 -1
- package/dist/components/authenticate/services/oauth2.service.js +8 -3
- package/dist/components/authenticate/services/oauth2.service.js.map +1 -1
- package/dist/components/authenticate/views/pages/auth.ejs +6 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/mail/common/constants.d.ts +26 -0
- package/dist/components/mail/common/constants.d.ts.map +1 -0
- package/dist/components/mail/common/constants.js +37 -0
- package/dist/components/mail/common/constants.js.map +1 -0
- package/dist/components/mail/common/index.d.ts +4 -0
- package/dist/components/mail/common/index.d.ts.map +1 -0
- package/dist/components/mail/common/index.js +20 -0
- package/dist/components/mail/common/index.js.map +1 -0
- package/dist/components/mail/common/keys.d.ts +17 -0
- package/dist/components/mail/common/keys.d.ts.map +1 -0
- package/dist/components/mail/common/keys.js +24 -0
- package/dist/components/mail/common/keys.js.map +1 -0
- package/dist/components/mail/common/types.d.ts +168 -0
- package/dist/components/mail/common/types.d.ts.map +1 -0
- package/dist/components/mail/common/types.js +10 -0
- package/dist/components/mail/common/types.js.map +1 -0
- package/dist/components/mail/component.d.ts +12 -0
- package/dist/components/mail/component.d.ts.map +1 -0
- package/dist/components/mail/component.js +90 -0
- package/dist/components/mail/component.js.map +1 -0
- package/dist/components/mail/controllers/index.d.ts +2 -0
- package/dist/components/mail/controllers/index.d.ts.map +1 -0
- package/dist/components/mail/controllers/index.js +18 -0
- package/dist/components/mail/controllers/index.js.map +1 -0
- package/dist/components/mail/controllers/mail.controller.d.ts +24 -0
- package/dist/components/mail/controllers/mail.controller.d.ts.map +1 -0
- package/dist/components/mail/controllers/mail.controller.js +330 -0
- package/dist/components/mail/controllers/mail.controller.js.map +1 -0
- package/dist/components/mail/helpers/executors/bullmq-executor.helper.d.ts +48 -0
- package/dist/components/mail/helpers/executors/bullmq-executor.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/executors/bullmq-executor.helper.js +159 -0
- package/dist/components/mail/helpers/executors/bullmq-executor.helper.js.map +1 -0
- package/dist/components/mail/helpers/executors/direct-executor.helper.d.ts +14 -0
- package/dist/components/mail/helpers/executors/direct-executor.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/executors/direct-executor.helper.js +27 -0
- package/dist/components/mail/helpers/executors/direct-executor.helper.js.map +1 -0
- package/dist/components/mail/helpers/executors/index.d.ts +4 -0
- package/dist/components/mail/helpers/executors/index.d.ts.map +1 -0
- package/dist/components/mail/helpers/executors/index.js +20 -0
- package/dist/components/mail/helpers/executors/index.js.map +1 -0
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +22 -0
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.js +103 -0
- package/dist/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -0
- package/dist/components/mail/helpers/index.d.ts +3 -0
- package/dist/components/mail/helpers/index.d.ts.map +1 -0
- package/dist/components/mail/helpers/index.js +19 -0
- package/dist/components/mail/helpers/index.js.map +1 -0
- package/dist/components/mail/helpers/transports/index.d.ts +3 -0
- package/dist/components/mail/helpers/transports/index.d.ts.map +1 -0
- package/dist/components/mail/helpers/transports/index.js +19 -0
- package/dist/components/mail/helpers/transports/index.js.map +1 -0
- package/dist/components/mail/helpers/transports/mailgun-transport.helper.d.ts +11 -0
- package/dist/components/mail/helpers/transports/mailgun-transport.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/transports/mailgun-transport.helper.js +88 -0
- package/dist/components/mail/helpers/transports/mailgun-transport.helper.js.map +1 -0
- package/dist/components/mail/helpers/transports/nodemailer-transport.helper.d.ts +11 -0
- package/dist/components/mail/helpers/transports/nodemailer-transport.helper.d.ts.map +1 -0
- package/dist/components/mail/helpers/transports/nodemailer-transport.helper.js +67 -0
- package/dist/components/mail/helpers/transports/nodemailer-transport.helper.js.map +1 -0
- package/dist/components/mail/index.d.ts +8 -0
- package/dist/components/mail/index.d.ts.map +1 -0
- package/dist/components/mail/index.js +24 -0
- package/dist/components/mail/index.js.map +1 -0
- package/dist/components/mail/providers/index.d.ts +3 -0
- package/dist/components/mail/providers/index.d.ts.map +1 -0
- package/dist/components/mail/providers/index.js +19 -0
- package/dist/components/mail/providers/index.js.map +1 -0
- package/dist/components/mail/providers/mail-queue-executor.provider.d.ts +9 -0
- package/dist/components/mail/providers/mail-queue-executor.provider.d.ts.map +1 -0
- package/dist/components/mail/providers/mail-queue-executor.provider.js +41 -0
- package/dist/components/mail/providers/mail-queue-executor.provider.js.map +1 -0
- package/dist/components/mail/providers/mail-transport.provider.d.ts +15 -0
- package/dist/components/mail/providers/mail-transport.provider.d.ts.map +1 -0
- package/dist/components/mail/providers/mail-transport.provider.js +93 -0
- package/dist/components/mail/providers/mail-transport.provider.js.map +1 -0
- package/dist/components/mail/services/generator.service.d.ts +14 -0
- package/dist/components/mail/services/generator.service.d.ts.map +1 -0
- package/dist/components/mail/services/generator.service.js +70 -0
- package/dist/components/mail/services/generator.service.js.map +1 -0
- package/dist/components/mail/services/index.d.ts +4 -0
- package/dist/components/mail/services/index.d.ts.map +1 -0
- package/dist/components/mail/services/index.js +20 -0
- package/dist/components/mail/services/index.js.map +1 -0
- package/dist/components/mail/services/mail.service.d.ts +23 -0
- package/dist/components/mail/services/mail.service.d.ts.map +1 -0
- package/dist/components/mail/services/mail.service.js +178 -0
- package/dist/components/mail/services/mail.service.js.map +1 -0
- package/dist/components/mail/services/template-engine.service.d.ts +36 -0
- package/dist/components/mail/services/template-engine.service.d.ts.map +1 -0
- package/dist/components/mail/services/template-engine.service.js +126 -0
- package/dist/components/mail/services/template-engine.service.js.map +1 -0
- package/dist/components/mail/utilities/index.d.ts +3 -0
- package/dist/components/mail/utilities/index.d.ts.map +1 -0
- package/dist/components/mail/utilities/index.js +19 -0
- package/dist/components/mail/utilities/index.js.map +1 -0
- package/dist/components/mail/utilities/type.utility.d.ts +5 -0
- package/dist/components/mail/utilities/type.utility.d.ts.map +1 -0
- package/dist/components/mail/utilities/type.utility.js +34 -0
- package/dist/components/mail/utilities/type.utility.js.map +1 -0
- package/dist/components/mail/utilities/verification.utility.d.ts +3 -0
- package/dist/components/mail/utilities/verification.utility.d.ts.map +1 -0
- package/dist/components/mail/utilities/verification.utility.js +11 -0
- package/dist/components/mail/utilities/verification.utility.js.map +1 -0
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/module.utility.d.ts +5 -0
- package/dist/utilities/module.utility.d.ts.map +1 -0
- package/dist/utilities/module.utility.js +21 -0
- package/dist/utilities/module.utility.js.map +1 -0
- package/package.json +14 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScopeBuilder = exports.OAuth2Actions = exports.OAuth2Resources = void 0;
|
|
4
|
+
exports.createScopeBuilder = createScopeBuilder;
|
|
5
|
+
exports.buildScopeString = buildScopeString;
|
|
6
|
+
exports.buildScope = buildScope;
|
|
7
|
+
exports.parseScopeString = parseScopeString;
|
|
8
|
+
exports.OAuth2Resources = {
|
|
9
|
+
USER: 'user',
|
|
10
|
+
};
|
|
11
|
+
exports.OAuth2Actions = {
|
|
12
|
+
READ: 'read',
|
|
13
|
+
};
|
|
14
|
+
class ScopeBuilder {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.scopes = new Set();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Add a scope to the builder
|
|
20
|
+
* @param scope - Scope string (e.g., "user:read:basic")
|
|
21
|
+
* @returns This builder for chaining
|
|
22
|
+
*/
|
|
23
|
+
add(scope) {
|
|
24
|
+
this.scopes.add(scope);
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Add multiple scopes at once
|
|
29
|
+
* @param scopes - Array of scope strings
|
|
30
|
+
* @returns This builder for chaining
|
|
31
|
+
*/
|
|
32
|
+
addMultiple(scopes) {
|
|
33
|
+
scopes.forEach(scope => this.scopes.add(scope));
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build a scope string from resource, action, and path components
|
|
38
|
+
* @param resource - Resource name (e.g., 'user')
|
|
39
|
+
* @param action - Action name (e.g., 'read')
|
|
40
|
+
* @param path - Path components (e.g., ['basic'] or ['profile', 'firstName'])
|
|
41
|
+
* @returns This builder for chaining
|
|
42
|
+
*/
|
|
43
|
+
buildScope(resource, action, ...path) {
|
|
44
|
+
const scope = [resource, action, ...path].join(':');
|
|
45
|
+
this.scopes.add(scope);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Build the final scope string (space-separated)
|
|
50
|
+
* @returns Space-separated scope string
|
|
51
|
+
*/
|
|
52
|
+
build() {
|
|
53
|
+
return Array.from(this.scopes).join(' ');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get scopes as array
|
|
57
|
+
* @returns Array of scope strings
|
|
58
|
+
*/
|
|
59
|
+
toArray() {
|
|
60
|
+
return Array.from(this.scopes);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Clear all scopes
|
|
64
|
+
* @returns This builder for chaining
|
|
65
|
+
*/
|
|
66
|
+
clear() {
|
|
67
|
+
this.scopes.clear();
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get number of scopes
|
|
72
|
+
* @returns Number of scopes
|
|
73
|
+
*/
|
|
74
|
+
count() {
|
|
75
|
+
return this.scopes.size;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.ScopeBuilder = ScopeBuilder;
|
|
79
|
+
/**
|
|
80
|
+
* Helper function to create a new scope builder
|
|
81
|
+
* @returns New ScopeBuilder instance
|
|
82
|
+
*/
|
|
83
|
+
function createScopeBuilder() {
|
|
84
|
+
return new ScopeBuilder();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Helper function to build scope string from array
|
|
88
|
+
* @param scopes - Array of scope strings
|
|
89
|
+
* @returns Space-separated scope string
|
|
90
|
+
*/
|
|
91
|
+
function buildScopeString(...scopes) {
|
|
92
|
+
return scopes.join(' ');
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Helper function to build a single scope string
|
|
96
|
+
* @param resource - Resource name
|
|
97
|
+
* @param action - Action name
|
|
98
|
+
* @param path - Path components
|
|
99
|
+
* @returns Scope string in format "resource:action:path1:path2:..."
|
|
100
|
+
*/
|
|
101
|
+
function buildScope(resource, action, ...path) {
|
|
102
|
+
return [resource, action, ...path].join(':');
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Helper function to parse scope string into components
|
|
106
|
+
* @param scope - Scope string (e.g., "user:read:basic")
|
|
107
|
+
* @returns Object with resource, action, and path components or null if invalid
|
|
108
|
+
*/
|
|
109
|
+
function parseScopeString(scope) {
|
|
110
|
+
const parts = scope.split(':');
|
|
111
|
+
if (parts.length < 3) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const [resource, action, ...path] = parts;
|
|
115
|
+
return { resource, action, path };
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=scope-constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-constants.js","sourceRoot":"","sources":["../../../../../src/components/authenticate/oauth2-handlers/constants/scope-constants.ts"],"names":[],"mappings":";;;AAkFA,gDAEC;AAOD,4CAEC;AASD,gCAEC;AAOD,4CAWC;AA1HY,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,MAAM;CACJ,CAAC;AAEE,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX,MAAa,YAAY;IAAzB;QACU,WAAM,GAAgB,IAAI,GAAG,EAAE,CAAC;IAmE1C,CAAC;IAjEC;;;;OAIG;IACH,GAAG,CAAC,KAAa;QACf,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,MAAgB;QAC1B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,UAAU,CAAC,QAAgB,EAAE,MAAc,EAAE,GAAG,IAAc;QAC5D,MAAM,KAAK,GAAG,CAAC,Q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AAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC;IAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/authenticate/oauth2-handlers/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./user-data-fetcher"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/authenticate/oauth2-handlers/data/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { AnyObject, IdType, TInjectionGetter } from '../../../../common';
|
|
2
|
+
import { ScopeManager } from '../scope';
|
|
3
|
+
export interface IUserDataFetcherOptions {
|
|
4
|
+
injectionGetter: TInjectionGetter;
|
|
5
|
+
scopeManager: ScopeManager;
|
|
6
|
+
}
|
|
7
|
+
export interface IFetchByScopes {
|
|
8
|
+
userId: IdType;
|
|
9
|
+
grantedScopes: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare class UserDataFetcher {
|
|
12
|
+
private logger;
|
|
13
|
+
private injectionGetter;
|
|
14
|
+
private userRepositoryKey;
|
|
15
|
+
private scopeManager;
|
|
16
|
+
private relationMetadata;
|
|
17
|
+
constructor(opts: {
|
|
18
|
+
options: IUserDataFetcherOptions;
|
|
19
|
+
scope?: string;
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Build relation metadata from available scopes configuration
|
|
23
|
+
* Extracts relation type and groupBy settings from scope definitions
|
|
24
|
+
* @returns Map of relation name to metadata
|
|
25
|
+
*/
|
|
26
|
+
private buildRelationMetadata;
|
|
27
|
+
/**
|
|
28
|
+
* Fetch user data based on granted scopes
|
|
29
|
+
* Builds a single optimized query to UserRepository
|
|
30
|
+
* @param options - Fetch options containing userId and granted scopes
|
|
31
|
+
* @returns User data object
|
|
32
|
+
*/
|
|
33
|
+
fetchByScopes(options: IFetchByScopes): Promise<AnyObject>;
|
|
34
|
+
/**
|
|
35
|
+
* Build query structure from granted scopes
|
|
36
|
+
* Determines which base fields and relations to fetch
|
|
37
|
+
* @param scopes - Array of granted scope strings
|
|
38
|
+
* @returns Query structure with base fields and relation includes
|
|
39
|
+
*/
|
|
40
|
+
private buildQueryStructure;
|
|
41
|
+
/**
|
|
42
|
+
* Process a single scope path
|
|
43
|
+
* Determines if it's a base field, relation field, or scope group
|
|
44
|
+
* @param path - Scope path array
|
|
45
|
+
* @param relationFieldsMap - Map to collect relation fields
|
|
46
|
+
* @param baseFieldsSet - Set to collect base fields
|
|
47
|
+
*/
|
|
48
|
+
private processScope;
|
|
49
|
+
/**
|
|
50
|
+
* Expand a scope group into base fields and relations
|
|
51
|
+
* @param scopeGroup - Scope group definition
|
|
52
|
+
* @param relationFieldsMap - Map to collect relation fields
|
|
53
|
+
* @param baseFieldsSet - Set to collect base fields
|
|
54
|
+
*/
|
|
55
|
+
private expandScopeGroup;
|
|
56
|
+
/**
|
|
57
|
+
* Execute repository query with built structure
|
|
58
|
+
* @param userId - User ID to fetch
|
|
59
|
+
* @param structure - Query structure with fields and relations
|
|
60
|
+
* @returns User data object or null
|
|
61
|
+
*/
|
|
62
|
+
private executeQuery;
|
|
63
|
+
/**
|
|
64
|
+
* Fetch minimal user data (just ID)
|
|
65
|
+
* @param userId - User ID
|
|
66
|
+
* @returns User object with ID only
|
|
67
|
+
*/
|
|
68
|
+
fetchMinimal(userId: IdType): Promise<AnyObject>;
|
|
69
|
+
/**
|
|
70
|
+
* Flatten user data by removing internal fields and flattening relations
|
|
71
|
+
* - Base fields and primitives are kept as-is
|
|
72
|
+
* - hasOne relations are flattened with configured prefix
|
|
73
|
+
* - hasMany relations are grouped by configured field with prefix
|
|
74
|
+
* @param obj - Raw user object from repository
|
|
75
|
+
* @returns Flattened user data object
|
|
76
|
+
*/
|
|
77
|
+
private flattenUserData;
|
|
78
|
+
/**
|
|
79
|
+
* Check if value is a valid object for processing
|
|
80
|
+
*/
|
|
81
|
+
private isValidObject;
|
|
82
|
+
/**
|
|
83
|
+
* Check if a value is a primitive (non-object) type
|
|
84
|
+
*/
|
|
85
|
+
private isPrimitive;
|
|
86
|
+
/**
|
|
87
|
+
* Add base fields from the user object
|
|
88
|
+
*/
|
|
89
|
+
private addBaseFields;
|
|
90
|
+
/**
|
|
91
|
+
* Flatten hasOne relation with configured prefix
|
|
92
|
+
*/
|
|
93
|
+
private flattenHasOneRelation;
|
|
94
|
+
/**
|
|
95
|
+
* Flatten hasMany relation grouped by configured field with prefix
|
|
96
|
+
*/
|
|
97
|
+
private flattenHasManyRelation;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=user-data-fetcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-data-fetcher.d.ts","sourceRoot":"","sources":["../../../../../src/components/authenticate/oauth2-handlers/data/user-data-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,EAAiB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAIvF,OAAO,EAAqB,YAAY,EAAE,MAAM,UAAU,CAAC;AAG3D,MAAM,WAAW,uBAAuB;IACtC,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAYD,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,eAAe,CAAmB;IAC1C,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,gBAAgB,CAAiC;gBAE7C,IAAI,EAAE;QAAE,OAAO,EAAE,uBAAuB,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;IAkBtE;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAoC7B;;;;;OAKG;IACG,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC;IA4ChE;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAyC3B;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IA8DpB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAyBxB;;;;;OAKG;YACW,YAAY;IA2C1B;;;;OAIG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAmBtD;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAkCvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAIrB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,OAAO,CAAC,aAAa;IAuBrB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAgC7B;;OAEG;IACH,OAAO,CAAC,sBAAsB;CA8C/B"}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserDataFetcher = void 0;
|
|
4
|
+
const helpers_1 = require("../../../../helpers");
|
|
5
|
+
const utilities_1 = require("../../../../utilities");
|
|
6
|
+
const scope_1 = require("../scope");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
class UserDataFetcher {
|
|
9
|
+
constructor(opts) {
|
|
10
|
+
const { options, scope } = opts;
|
|
11
|
+
this.logger = helpers_1.LoggerFactory.getLogger([scope ?? UserDataFetcher.name]);
|
|
12
|
+
this.injectionGetter = options.injectionGetter;
|
|
13
|
+
this.userRepositoryKey = 'repositories.UserRepository';
|
|
14
|
+
this.scopeManager = options.scopeManager;
|
|
15
|
+
// Build relationMetadata dynamically from available scopes
|
|
16
|
+
this.relationMetadata = this.buildRelationMetadata();
|
|
17
|
+
this.logger.info('[constructor] Initialized | UserRepository: %s', this.userRepositoryKey);
|
|
18
|
+
this.logger.debug('[constructor] Relation metadata loaded: %s', Array.from(this.relationMetadata.keys()).join(', '));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build relation metadata from available scopes configuration
|
|
22
|
+
* Extracts relation type and groupBy settings from scope definitions
|
|
23
|
+
* @returns Map of relation name to metadata
|
|
24
|
+
*/
|
|
25
|
+
buildRelationMetadata() {
|
|
26
|
+
const metadata = new Map();
|
|
27
|
+
const availableScopes = this.scopeManager.getAvailableScopes();
|
|
28
|
+
for (const scopeDef of availableScopes) {
|
|
29
|
+
if (!scopeDef.relations) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
for (const relationDef of scopeDef.relations) {
|
|
33
|
+
// Skip if already registered (first definition wins)
|
|
34
|
+
if (metadata.has(relationDef.relation)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
// Default to 'hasOne' if type not specified
|
|
38
|
+
const relationType = relationDef.type ?? 'hasOne';
|
|
39
|
+
metadata.set(relationDef.relation, {
|
|
40
|
+
name: relationDef.relation,
|
|
41
|
+
type: relationType,
|
|
42
|
+
groupBy: relationDef.groupBy,
|
|
43
|
+
});
|
|
44
|
+
this.logger.debug('[buildRelationMetadata] Registered relation | name: %s | type: %s | groupBy: %s', relationDef.relation, relationType, relationDef.groupBy ?? 'none');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return metadata;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Fetch user data based on granted scopes
|
|
51
|
+
* Builds a single optimized query to UserRepository
|
|
52
|
+
* @param options - Fetch options containing userId and granted scopes
|
|
53
|
+
* @returns User data object
|
|
54
|
+
*/
|
|
55
|
+
async fetchByScopes(options) {
|
|
56
|
+
const { userId, grantedScopes } = options;
|
|
57
|
+
// Normalize and use default scopes if none provided
|
|
58
|
+
let scopesToUse = grantedScopes;
|
|
59
|
+
if (!scopesToUse || scopesToUse.length === 0) {
|
|
60
|
+
scopesToUse = this.scopeManager.getDefaultScopes();
|
|
61
|
+
this.logger.debug('[fetchByScopes] No scopes provided, using defaults: %s', scopesToUse.join(', '));
|
|
62
|
+
}
|
|
63
|
+
// Parse scopes and build query structure
|
|
64
|
+
const queryStructure = this.buildQueryStructure(scopesToUse);
|
|
65
|
+
// Execute query
|
|
66
|
+
try {
|
|
67
|
+
let userData = await this.executeQuery((0, utilities_1.int)(userId), queryStructure);
|
|
68
|
+
userData = this.flattenUserData(userData);
|
|
69
|
+
if (!userData) {
|
|
70
|
+
this.logger.error('[fetchByScopes] User not found | userId: %s', userId);
|
|
71
|
+
return { id: (0, utilities_1.int)(userId) };
|
|
72
|
+
}
|
|
73
|
+
this.logger.info('[fetchByScopes] User data fetched successfully | userId: %s | scopes: %s | relations: %s', userId, scopesToUse.join(', '), queryStructure.relations.map(r => r.relation).join(', '));
|
|
74
|
+
return userData;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
this.logger.error('[fetchByScopes] Error fetching user data | userId: %s | error: %s', userId, (0, utilities_1.getError)(error).message);
|
|
78
|
+
return { id: (0, utilities_1.int)(userId) };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Build query structure from granted scopes
|
|
83
|
+
* Determines which base fields and relations to fetch
|
|
84
|
+
* @param scopes - Array of granted scope strings
|
|
85
|
+
* @returns Query structure with base fields and relation includes
|
|
86
|
+
*/
|
|
87
|
+
buildQueryStructure(scopes) {
|
|
88
|
+
const parsedScopes = this.scopeManager.parseScopes(scopes);
|
|
89
|
+
const relationFieldsMap = new Map();
|
|
90
|
+
const baseFieldsSet = new Set(['id']); // Always include id
|
|
91
|
+
for (const parsed of parsedScopes) {
|
|
92
|
+
// Only handle 'user' resource
|
|
93
|
+
if (parsed.resource !== constants_1.OAuth2Resources.USER) {
|
|
94
|
+
this.logger.warn('[buildQueryStructure] Skipping non-user resource: %s', parsed.original);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
// Only handle 'read' action
|
|
98
|
+
if (parsed.action !== constants_1.OAuth2Actions.READ) {
|
|
99
|
+
this.logger.warn('[buildQueryStructure] Skipping non-read action: %s', parsed.original);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
this.processScope(parsed.path, relationFieldsMap, baseFieldsSet);
|
|
103
|
+
}
|
|
104
|
+
// Build relations array
|
|
105
|
+
const relations = Array.from(relationFieldsMap.entries()).map(([relation, fieldsSet]) => ({
|
|
106
|
+
relation,
|
|
107
|
+
fields: Array.from(fieldsSet).sort(),
|
|
108
|
+
}));
|
|
109
|
+
const baseFields = Array.from(baseFieldsSet).sort();
|
|
110
|
+
this.logger.debug('[buildQueryStructure] Query structure | Base fields: %s | Relations: %s', baseFields.join(', '), relations.map(r => `${r.relation}(${r.fields.join(',')})`).join(', '));
|
|
111
|
+
return { baseFields, relations };
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Process a single scope path
|
|
115
|
+
* Determines if it's a base field, relation field, or scope group
|
|
116
|
+
* @param path - Scope path array
|
|
117
|
+
* @param relationFieldsMap - Map to collect relation fields
|
|
118
|
+
* @param baseFieldsSet - Set to collect base fields
|
|
119
|
+
*/
|
|
120
|
+
processScope(path, relationFieldsMap, baseFieldsSet) {
|
|
121
|
+
if (path.length === 0) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const [firstPart, ...rest] = path;
|
|
125
|
+
const availableScopes = this.scopeManager.getAvailableScopes();
|
|
126
|
+
// Check if it's a relation with specific fields FIRST
|
|
127
|
+
// This must be checked before scope groups because identifiers can be both
|
|
128
|
+
const isRelation = availableScopes.some(s => s.relations?.some(r => r.relation === firstPart));
|
|
129
|
+
if (isRelation && rest.length > 0) {
|
|
130
|
+
// It's a relation field: user:read:profile:firstName or user:read:identifiers:identifier
|
|
131
|
+
const relation = firstPart;
|
|
132
|
+
const field = rest.join('.');
|
|
133
|
+
// Validate field is allowed (now returns array of actual fields)
|
|
134
|
+
const allowedFields = this.scopeManager.isFieldAllowed(relation, field);
|
|
135
|
+
if (allowedFields.length > 0) {
|
|
136
|
+
if (!relationFieldsMap.has(relation)) {
|
|
137
|
+
relationFieldsMap.set(relation, new Set());
|
|
138
|
+
}
|
|
139
|
+
// Add all resolved fields (handles both direct fields and aliases)
|
|
140
|
+
allowedFields.forEach(f => relationFieldsMap.get(relation).add(f));
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
this.logger.warn('[processScope] Field not allowed | relation: %s | field: %s', relation, field);
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
// Check if it's a scope group identifier (only if not a relation with fields)
|
|
148
|
+
const scopeGroup = availableScopes.find(s => s.identifier === firstPart);
|
|
149
|
+
if (scopeGroup) {
|
|
150
|
+
// It's a scope group, expand it
|
|
151
|
+
this.expandScopeGroup(scopeGroup, relationFieldsMap, baseFieldsSet);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
// It's a base field: user:read:id
|
|
155
|
+
if (path.length === 1) {
|
|
156
|
+
const field = firstPart;
|
|
157
|
+
const resolvedFields = this.scopeManager.isFieldAllowed(scope_1.BASE_FIELDS_SCOPE, field);
|
|
158
|
+
if (resolvedFields.length > 0) {
|
|
159
|
+
resolvedFields.forEach(f => baseFieldsSet.add(f));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.logger.warn('[processScope] Base field not allowed | field: %s', field);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Expand a scope group into base fields and relations
|
|
168
|
+
* @param scopeGroup - Scope group definition
|
|
169
|
+
* @param relationFieldsMap - Map to collect relation fields
|
|
170
|
+
* @param baseFieldsSet - Set to collect base fields
|
|
171
|
+
*/
|
|
172
|
+
expandScopeGroup(scopeGroup, relationFieldsMap, baseFieldsSet) {
|
|
173
|
+
// Add base fields
|
|
174
|
+
if (scopeGroup.fields) {
|
|
175
|
+
scopeGroup.fields.forEach(field => baseFieldsSet.add(field));
|
|
176
|
+
}
|
|
177
|
+
// Add relations
|
|
178
|
+
if (scopeGroup.relations) {
|
|
179
|
+
for (const relationDef of scopeGroup.relations) {
|
|
180
|
+
if (!relationFieldsMap.has(relationDef.relation)) {
|
|
181
|
+
relationFieldsMap.set(relationDef.relation, new Set());
|
|
182
|
+
}
|
|
183
|
+
const fieldsSet = relationFieldsMap.get(relationDef.relation);
|
|
184
|
+
if (relationDef.fields) {
|
|
185
|
+
relationDef.fields.forEach(field => fieldsSet.add(field));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Execute repository query with built structure
|
|
192
|
+
* @param userId - User ID to fetch
|
|
193
|
+
* @param structure - Query structure with fields and relations
|
|
194
|
+
* @returns User data object or null
|
|
195
|
+
*/
|
|
196
|
+
async executeQuery(userId, structure) {
|
|
197
|
+
const userRepository = this.injectionGetter(this.userRepositoryKey);
|
|
198
|
+
const filter = {
|
|
199
|
+
where: { id: userId },
|
|
200
|
+
fields: structure.baseFields,
|
|
201
|
+
};
|
|
202
|
+
// Add relation includes
|
|
203
|
+
if (structure.relations.length > 0) {
|
|
204
|
+
filter.include = structure.relations.map(r => {
|
|
205
|
+
// Always include 'id' and 'userId' (foreign key) in relation fields
|
|
206
|
+
// This ensures hasMany relations work correctly and foreign key is always returned
|
|
207
|
+
const relationFields = [...r.fields];
|
|
208
|
+
// Add 'id' if not present (primary key of related entity)
|
|
209
|
+
if (!relationFields.includes('id')) {
|
|
210
|
+
relationFields.unshift('id');
|
|
211
|
+
}
|
|
212
|
+
// Add 'userId' if not present (foreign key for hasMany/hasOne relations)
|
|
213
|
+
if (!relationFields.includes('userId')) {
|
|
214
|
+
relationFields.push('userId');
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
relation: r.relation,
|
|
218
|
+
scope: { fields: relationFields },
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
this.logger.debug('[executeQuery] Repository filter: %j', filter);
|
|
223
|
+
return userRepository.findOne(filter);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Fetch minimal user data (just ID)
|
|
227
|
+
* @param userId - User ID
|
|
228
|
+
* @returns User object with ID only
|
|
229
|
+
*/
|
|
230
|
+
async fetchMinimal(userId) {
|
|
231
|
+
try {
|
|
232
|
+
const userRepository = this.injectionGetter(this.userRepositoryKey);
|
|
233
|
+
const userData = await userRepository.findOne({
|
|
234
|
+
where: { id: (0, utilities_1.int)(userId) },
|
|
235
|
+
fields: ['id'],
|
|
236
|
+
});
|
|
237
|
+
return userData ?? { id: (0, utilities_1.int)(userId) };
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
this.logger.error('[fetchMinimal] Error fetching user | userId: %s | error: %s', userId, (0, utilities_1.getError)(error).message);
|
|
241
|
+
return { id: (0, utilities_1.int)(userId) };
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Flatten user data by removing internal fields and flattening relations
|
|
246
|
+
* - Base fields and primitives are kept as-is
|
|
247
|
+
* - hasOne relations are flattened with configured prefix
|
|
248
|
+
* - hasMany relations are grouped by configured field with prefix
|
|
249
|
+
* @param obj - Raw user object from repository
|
|
250
|
+
* @returns Flattened user data object
|
|
251
|
+
*/
|
|
252
|
+
flattenUserData(obj) {
|
|
253
|
+
if (!this.isValidObject(obj)) {
|
|
254
|
+
return obj;
|
|
255
|
+
}
|
|
256
|
+
const result = {};
|
|
257
|
+
const relations = new Set(this.relationMetadata.keys());
|
|
258
|
+
const INTERNAL_SKIP_FIELDS = new Set(['id', 'userId']);
|
|
259
|
+
// Process base fields
|
|
260
|
+
this.addBaseFields(obj, result, relations);
|
|
261
|
+
// Process relations
|
|
262
|
+
for (const [relationName, metadata] of this.relationMetadata) {
|
|
263
|
+
switch (metadata.type) {
|
|
264
|
+
case 'hasOne': {
|
|
265
|
+
this.flattenHasOneRelation(relationName, metadata, obj, result, INTERNAL_SKIP_FIELDS);
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
268
|
+
case 'hasMany': {
|
|
269
|
+
this.flattenHasManyRelation(relationName, metadata, obj, result, INTERNAL_SKIP_FIELDS);
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
default: {
|
|
273
|
+
this.logger.warn(`Unknown relation type for ${relationName}: ${metadata.type}`);
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return result;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Check if value is a valid object for processing
|
|
282
|
+
*/
|
|
283
|
+
isValidObject(obj) {
|
|
284
|
+
return obj !== null && obj !== undefined && typeof obj === 'object';
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Check if a value is a primitive (non-object) type
|
|
288
|
+
*/
|
|
289
|
+
isPrimitive(value) {
|
|
290
|
+
return value !== null && value !== undefined && typeof value !== 'object';
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Add base fields from the user object
|
|
294
|
+
*/
|
|
295
|
+
addBaseFields(obj, result, relationsToSkip) {
|
|
296
|
+
// Always include top-level id
|
|
297
|
+
if (obj.id !== undefined) {
|
|
298
|
+
result.id = obj.id;
|
|
299
|
+
}
|
|
300
|
+
// Add other primitive fields, excluding relations
|
|
301
|
+
for (const key in obj) {
|
|
302
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key) ||
|
|
303
|
+
key === 'id' ||
|
|
304
|
+
relationsToSkip.has(key)) {
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
const value = obj[key];
|
|
308
|
+
if (this.isPrimitive(value)) {
|
|
309
|
+
result[key] = value;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Flatten hasOne relation with configured prefix
|
|
315
|
+
*/
|
|
316
|
+
flattenHasOneRelation(relationName, metadata, obj, result, internalFields) {
|
|
317
|
+
if (!this.isValidObject(obj[relationName])) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const prefix = metadata.name;
|
|
321
|
+
for (const key in obj[relationName]) {
|
|
322
|
+
if (!Object.prototype.hasOwnProperty.call(obj[relationName], key) ||
|
|
323
|
+
internalFields.has(key)) {
|
|
324
|
+
continue;
|
|
325
|
+
}
|
|
326
|
+
const value = obj[relationName][key];
|
|
327
|
+
if (!this.isPrimitive(value)) {
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
const serializedValue = value instanceof Date ? value.toISOString() : value;
|
|
331
|
+
const fieldName = `${prefix}_${key}`;
|
|
332
|
+
result[fieldName] = serializedValue;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Flatten hasMany relation grouped by configured field with prefix
|
|
337
|
+
*/
|
|
338
|
+
flattenHasManyRelation(relationName, metadata, obj, result, internalFields) {
|
|
339
|
+
if (!Array.isArray(obj[relationName])) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const groupByField = metadata.groupBy;
|
|
343
|
+
if (!groupByField) {
|
|
344
|
+
this.logger.warn(`flattenHasManyRelation (${relationName}) skipped: no groupBy field configured`);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
obj[relationName].forEach((item) => {
|
|
348
|
+
if (!this.isValidObject(item)) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
const groupValue = item[groupByField];
|
|
352
|
+
if (!groupValue) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
for (const key in item) {
|
|
356
|
+
if (!Object.prototype.hasOwnProperty.call(item, key) ||
|
|
357
|
+
internalFields.has(key) ||
|
|
358
|
+
key === groupByField) {
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
const value = item[key];
|
|
362
|
+
if (this.isPrimitive(value)) {
|
|
363
|
+
const fieldName = `${groupValue}_${key}`;
|
|
364
|
+
result[fieldName] = value;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
exports.UserDataFetcher = UserDataFetcher;
|
|
371
|
+
//# sourceMappingURL=user-data-fetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-data-fetcher.js","sourceRoot":"","sources":["../../../../../src/components/authenticate/oauth2-handlers/data/user-data-fetcher.ts"],"names":[],"mappings":";;;AACA,uCAA6D;AAC7D,2CAA4C;AAE5C,oCAA2D;AAC3D,4CAA8D;AAsB9D,MAAa,eAAe;IAO1B,YAAY,IAA0D;QACpE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;QAEhC,IAAI,CAAC,MAAM,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MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC;QACtC,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,2BAA2B,YAAY,wCAAwC,CAChF,CAAC;YACF,OAAO;QACT,CAAC;QAED,GAAG,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,IAAS,EAAE,EAAE;YACtC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC9B,OAAO;YACT,CAAC;YAED,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;YACtC,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,OAAO;YACT,CAAC;YAED,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,IACE,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC;oBAChD,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC;oBACvB,GAAG,KAAK,YAAY,EACpB,CAAC;oBACD,SAAS;gBACX,CAAC;gBAED,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;gBACxB,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;oBAC5B,MAAM,SAAS,GAAG,GAAG,UAAU,IAAI,GAAG,EAAE,CAAC;oBACzC,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtfD,0CAsfC"}
|
|
@@ -3,4 +3,8 @@ export * from './oauth2';
|
|
|
3
3
|
export * from './authorization-code.handler';
|
|
4
4
|
export * from './client-credential.handler';
|
|
5
5
|
export * from './password.handler';
|
|
6
|
+
export * from './config';
|
|
7
|
+
export * from './constants';
|
|
8
|
+
export * from './data';
|
|
9
|
+
export * from './scope';
|
|
6
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/authenticate/oauth2-handlers/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AAEzB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/authenticate/oauth2-handlers/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AAEzB,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|