@futdevpro/fdp-e2e-helpers 1.15.9
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/HOWTO.md +44 -0
- package/LICENSE +15 -0
- package/README.md +59 -0
- package/build/_collections/e2e-hard-delete.util.d.ts +69 -0
- package/build/_collections/e2e-hard-delete.util.js +176 -0
- package/build/_collections/e2e-unique-generator.util.d.ts +51 -0
- package/build/_collections/e2e-unique-generator.util.js +67 -0
- package/build/_models/interfaces/e2e-hard-delete-options.interface.d.ts +36 -0
- package/build/_models/interfaces/e2e-hard-delete-options.interface.js +3 -0
- package/build/_models/interfaces/e2e-test-config.interface.d.ts +29 -0
- package/build/_models/interfaces/e2e-test-config.interface.js +3 -0
- package/build/_models/interfaces/e2e-user.interface.d.ts +48 -0
- package/build/_models/interfaces/e2e-user.interface.js +3 -0
- package/build/_services/e2e-config.service.d.ts +93 -0
- package/build/_services/e2e-config.service.js +177 -0
- package/build/_services/e2e-logger.service.d.ts +71 -0
- package/build/_services/e2e-logger.service.js +114 -0
- package/build/_services/e2e-user-manager.service.d.ts +87 -0
- package/build/_services/e2e-user-manager.service.js +183 -0
- package/build/index.d.ts +9 -0
- package/build/index.js +15 -0
- package/package.json +98 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { DyNTS_SingletonService } from '@futdevpro/nts-dynamo';
|
|
2
|
+
import { E2E_TestConfig_Interface } from '../_models/interfaces/e2e-test-config.interface';
|
|
3
|
+
/**
|
|
4
|
+
* E2E_ConfigService — env-var-szintu config loader az E2E teszt-flow-hoz.
|
|
5
|
+
*
|
|
6
|
+
* Lift-and-shift a fdp-token-service `e2e/src/_shared/_services/e2e-config.service.ts`-bol
|
|
7
|
+
* (BL-20260518-005). Eltereesek az eredetihez kepest:
|
|
8
|
+
* - **prod-env GUARD**: az `initialize()` dob ha `environment: 'prod' | 'production'` —
|
|
9
|
+
* spec REQ-USER-004-02-03 (production-safety) defense-in-depth a config-loader-on.
|
|
10
|
+
* - **persistentUserAccountId getter**: a `getPersistentUserAccountId()` env-var loader
|
|
11
|
+
* a HardDelete-cascade-hez (`E2E_PERSISTENT_USER_ACCOUNT_ID`).
|
|
12
|
+
* - **authServiceUrl getter**: a `getAuthServiceUrl()` env-var loader az `E2E_AUTH_SERVICE_URL`-bol,
|
|
13
|
+
* a `E2E_HardDelete_Util.deleteAccount` baseUrl-jenek.
|
|
14
|
+
*
|
|
15
|
+
* Pattern: singleton-service `extends DyNTS_SingletonService` — peerDep
|
|
16
|
+
* @futdevpro/nts-dynamo szukseges. Spec REQ-ARCH-002-01-01.
|
|
17
|
+
*
|
|
18
|
+
* Env-var-ok (mind opcionalis kiveve a HardDelete-credentials-eket):
|
|
19
|
+
* - E2E_ENVIRONMENT (default: 'local')
|
|
20
|
+
* - E2E_CLIENT_URL (default: 'http://localhost:4215')
|
|
21
|
+
* - E2E_SERVER_URL (default: 'http://localhost:39155')
|
|
22
|
+
* - E2E_AUTH_SERVICE_URL (no default — required ha HardDelete kell)
|
|
23
|
+
* - E2E_PERSISTENT_USER_EMAIL (required ha persistent user kell)
|
|
24
|
+
* - E2E_PERSISTENT_USER_PASSWORD (required ha persistent user kell)
|
|
25
|
+
* - E2E_PERSISTENT_USER_ACCOUNT_ID (required ha persistent user hard-delete-elhetoseg kell)
|
|
26
|
+
* - E2E_HARD_DELETE_KEY (required ha HardDelete kell — X-E2E-Key header value)
|
|
27
|
+
*/
|
|
28
|
+
export declare class E2E_ConfigService extends DyNTS_SingletonService {
|
|
29
|
+
/**
|
|
30
|
+
* Singleton instance getter.
|
|
31
|
+
*/
|
|
32
|
+
static getInstance(): E2E_ConfigService;
|
|
33
|
+
/**
|
|
34
|
+
* Private constructor — defense-in-depth a singleton-enforcement-hez.
|
|
35
|
+
* Pattern conform a token-service eredetijével + a többi E2E_*Service-szel
|
|
36
|
+
* (E2E_LoggerService, E2E_UserManagerService).
|
|
37
|
+
*/
|
|
38
|
+
private constructor();
|
|
39
|
+
private config;
|
|
40
|
+
/**
|
|
41
|
+
* Konfiguracio inicializalasa.
|
|
42
|
+
* Ha a `config` param meg van adva, az kerul be allitva (tesztek-eljaras-explicit).
|
|
43
|
+
* Egyebkent env-var-okbol toltjuk be (dotenv .env file is olvashato).
|
|
44
|
+
*
|
|
45
|
+
* **PROD-GUARD**: ha environment 'prod' / 'production' / 'PROD' / ... — dob.
|
|
46
|
+
*
|
|
47
|
+
* @param config - Opcionalis explicit config (test-injection)
|
|
48
|
+
* @throws DyFM_Error `FDP-E2E-CFG-INIT-PROD-GUARD` ha env prod/production
|
|
49
|
+
*/
|
|
50
|
+
initialize(config?: E2E_TestConfig_Interface): void;
|
|
51
|
+
/**
|
|
52
|
+
* Konfiguracio lekerese.
|
|
53
|
+
* @throws DyFM_Error `FDP-E2E-CFG-NOT-INIT` ha initialize() meg nem hivva.
|
|
54
|
+
*/
|
|
55
|
+
getConfig(): E2E_TestConfig_Interface;
|
|
56
|
+
/**
|
|
57
|
+
* Kornyezet lekerese.
|
|
58
|
+
*/
|
|
59
|
+
getEnvironment(): string;
|
|
60
|
+
/**
|
|
61
|
+
* Client base URL lekerese.
|
|
62
|
+
*/
|
|
63
|
+
getClientUrl(): string;
|
|
64
|
+
/**
|
|
65
|
+
* Server base URL lekerese.
|
|
66
|
+
*/
|
|
67
|
+
getServerUrl(): string;
|
|
68
|
+
/**
|
|
69
|
+
* Auth-service base URL lekerese (HardDelete-cascade-hez).
|
|
70
|
+
* @throws DyFM_Error `FDP-E2E-CFG-NO-AUTH-URL` ha sem config-ban sem env-ben nincs.
|
|
71
|
+
*/
|
|
72
|
+
getAuthServiceUrl(): string;
|
|
73
|
+
/**
|
|
74
|
+
* Persistent user email lekerese az env-bol.
|
|
75
|
+
*/
|
|
76
|
+
getPersistentUserEmail(): string;
|
|
77
|
+
/**
|
|
78
|
+
* Persistent user password lekerese az env-bol.
|
|
79
|
+
*/
|
|
80
|
+
getPersistentUserPassword(): string;
|
|
81
|
+
/**
|
|
82
|
+
* Persistent user account ID lekerese az env-bol (HardDelete cascade-hez).
|
|
83
|
+
*/
|
|
84
|
+
getPersistentUserAccountId(): string;
|
|
85
|
+
/**
|
|
86
|
+
* HardDelete E2E key (X-E2E-Key header value) lekerese az env-bol.
|
|
87
|
+
* @throws DyFM_Error `FDP-E2E-CFG-NO-HD-KEY` ha env-ben nincs.
|
|
88
|
+
*/
|
|
89
|
+
getHardDeleteKey(): string;
|
|
90
|
+
private requireConfig;
|
|
91
|
+
private requireEnvVar;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=e2e-config.service.d.ts.map
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.E2E_ConfigService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
6
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
7
|
+
const nts_dynamo_1 = require("@futdevpro/nts-dynamo");
|
|
8
|
+
/**
|
|
9
|
+
* E2E_ConfigService — env-var-szintu config loader az E2E teszt-flow-hoz.
|
|
10
|
+
*
|
|
11
|
+
* Lift-and-shift a fdp-token-service `e2e/src/_shared/_services/e2e-config.service.ts`-bol
|
|
12
|
+
* (BL-20260518-005). Eltereesek az eredetihez kepest:
|
|
13
|
+
* - **prod-env GUARD**: az `initialize()` dob ha `environment: 'prod' | 'production'` —
|
|
14
|
+
* spec REQ-USER-004-02-03 (production-safety) defense-in-depth a config-loader-on.
|
|
15
|
+
* - **persistentUserAccountId getter**: a `getPersistentUserAccountId()` env-var loader
|
|
16
|
+
* a HardDelete-cascade-hez (`E2E_PERSISTENT_USER_ACCOUNT_ID`).
|
|
17
|
+
* - **authServiceUrl getter**: a `getAuthServiceUrl()` env-var loader az `E2E_AUTH_SERVICE_URL`-bol,
|
|
18
|
+
* a `E2E_HardDelete_Util.deleteAccount` baseUrl-jenek.
|
|
19
|
+
*
|
|
20
|
+
* Pattern: singleton-service `extends DyNTS_SingletonService` — peerDep
|
|
21
|
+
* @futdevpro/nts-dynamo szukseges. Spec REQ-ARCH-002-01-01.
|
|
22
|
+
*
|
|
23
|
+
* Env-var-ok (mind opcionalis kiveve a HardDelete-credentials-eket):
|
|
24
|
+
* - E2E_ENVIRONMENT (default: 'local')
|
|
25
|
+
* - E2E_CLIENT_URL (default: 'http://localhost:4215')
|
|
26
|
+
* - E2E_SERVER_URL (default: 'http://localhost:39155')
|
|
27
|
+
* - E2E_AUTH_SERVICE_URL (no default — required ha HardDelete kell)
|
|
28
|
+
* - E2E_PERSISTENT_USER_EMAIL (required ha persistent user kell)
|
|
29
|
+
* - E2E_PERSISTENT_USER_PASSWORD (required ha persistent user kell)
|
|
30
|
+
* - E2E_PERSISTENT_USER_ACCOUNT_ID (required ha persistent user hard-delete-elhetoseg kell)
|
|
31
|
+
* - E2E_HARD_DELETE_KEY (required ha HardDelete kell — X-E2E-Key header value)
|
|
32
|
+
*/
|
|
33
|
+
class E2E_ConfigService extends nts_dynamo_1.DyNTS_SingletonService {
|
|
34
|
+
/**
|
|
35
|
+
* Singleton instance getter.
|
|
36
|
+
*/
|
|
37
|
+
static getInstance() {
|
|
38
|
+
return E2E_ConfigService.getSingletonInstance();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Private constructor — defense-in-depth a singleton-enforcement-hez.
|
|
42
|
+
* Pattern conform a token-service eredetijével + a többi E2E_*Service-szel
|
|
43
|
+
* (E2E_LoggerService, E2E_UserManagerService).
|
|
44
|
+
*/
|
|
45
|
+
constructor() {
|
|
46
|
+
super();
|
|
47
|
+
}
|
|
48
|
+
config = null;
|
|
49
|
+
/**
|
|
50
|
+
* Konfiguracio inicializalasa.
|
|
51
|
+
* Ha a `config` param meg van adva, az kerul be allitva (tesztek-eljaras-explicit).
|
|
52
|
+
* Egyebkent env-var-okbol toltjuk be (dotenv .env file is olvashato).
|
|
53
|
+
*
|
|
54
|
+
* **PROD-GUARD**: ha environment 'prod' / 'production' / 'PROD' / ... — dob.
|
|
55
|
+
*
|
|
56
|
+
* @param config - Opcionalis explicit config (test-injection)
|
|
57
|
+
* @throws DyFM_Error `FDP-E2E-CFG-INIT-PROD-GUARD` ha env prod/production
|
|
58
|
+
*/
|
|
59
|
+
initialize(config) {
|
|
60
|
+
// .env file olvasasa (no-op ha nincs)
|
|
61
|
+
dotenv.config();
|
|
62
|
+
if (config) {
|
|
63
|
+
this.config = config;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const environment = process.env.E2E_ENVIRONMENT || 'local';
|
|
67
|
+
const clientUrl = process.env.E2E_CLIENT_URL || 'http://localhost:4215';
|
|
68
|
+
const serverUrl = process.env.E2E_SERVER_URL || 'http://localhost:39155';
|
|
69
|
+
const authServiceUrl = process.env.E2E_AUTH_SERVICE_URL;
|
|
70
|
+
this.config = { environment, clientUrl, serverUrl, authServiceUrl };
|
|
71
|
+
}
|
|
72
|
+
// PROD-GUARD — defense-in-depth a server-side E2E endpoint env-check mellett
|
|
73
|
+
const lowerEnv = this.config.environment.toLowerCase();
|
|
74
|
+
if (lowerEnv === 'prod' || lowerEnv === 'production') {
|
|
75
|
+
this.config = null;
|
|
76
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
77
|
+
message: `Refused: E2E_ConfigService initialized with environment "${lowerEnv}". ` +
|
|
78
|
+
`E2E testing is only allowed in local/test environments.`,
|
|
79
|
+
errorCode: 'FDP-E2E-CFG-INIT-PROD-GUARD',
|
|
80
|
+
issuerService: 'E2E_ConfigService',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
fsm_dynamo_1.DyFM_Log.info(`[E2E_Config] Initialized for environment: ${this.config.environment}`);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Konfiguracio lekerese.
|
|
87
|
+
* @throws DyFM_Error `FDP-E2E-CFG-NOT-INIT` ha initialize() meg nem hivva.
|
|
88
|
+
*/
|
|
89
|
+
getConfig() {
|
|
90
|
+
return this.requireConfig('getConfig');
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Kornyezet lekerese.
|
|
94
|
+
*/
|
|
95
|
+
getEnvironment() {
|
|
96
|
+
return this.requireConfig('getEnvironment').environment;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Client base URL lekerese.
|
|
100
|
+
*/
|
|
101
|
+
getClientUrl() {
|
|
102
|
+
return this.requireConfig('getClientUrl').clientUrl;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Server base URL lekerese.
|
|
106
|
+
*/
|
|
107
|
+
getServerUrl() {
|
|
108
|
+
return this.requireConfig('getServerUrl').serverUrl;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Auth-service base URL lekerese (HardDelete-cascade-hez).
|
|
112
|
+
* @throws DyFM_Error `FDP-E2E-CFG-NO-AUTH-URL` ha sem config-ban sem env-ben nincs.
|
|
113
|
+
*/
|
|
114
|
+
getAuthServiceUrl() {
|
|
115
|
+
const cfg = this.requireConfig('getAuthServiceUrl');
|
|
116
|
+
const value = cfg.authServiceUrl || process.env.E2E_AUTH_SERVICE_URL || '';
|
|
117
|
+
if (!value) {
|
|
118
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
119
|
+
message: 'E2E_AUTH_SERVICE_URL is not set in environment, nor in injected config.',
|
|
120
|
+
errorCode: 'FDP-E2E-CFG-NO-AUTH-URL',
|
|
121
|
+
issuerService: 'E2E_ConfigService',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Persistent user email lekerese az env-bol.
|
|
128
|
+
*/
|
|
129
|
+
getPersistentUserEmail() {
|
|
130
|
+
return this.requireEnvVar('E2E_PERSISTENT_USER_EMAIL', 'FDP-E2E-CFG-NO-PERS-EMAIL');
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Persistent user password lekerese az env-bol.
|
|
134
|
+
*/
|
|
135
|
+
getPersistentUserPassword() {
|
|
136
|
+
return this.requireEnvVar('E2E_PERSISTENT_USER_PASSWORD', 'FDP-E2E-CFG-NO-PERS-PW');
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Persistent user account ID lekerese az env-bol (HardDelete cascade-hez).
|
|
140
|
+
*/
|
|
141
|
+
getPersistentUserAccountId() {
|
|
142
|
+
return this.requireEnvVar('E2E_PERSISTENT_USER_ACCOUNT_ID', 'FDP-E2E-CFG-NO-PERS-ACC');
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* HardDelete E2E key (X-E2E-Key header value) lekerese az env-bol.
|
|
146
|
+
* @throws DyFM_Error `FDP-E2E-CFG-NO-HD-KEY` ha env-ben nincs.
|
|
147
|
+
*/
|
|
148
|
+
getHardDeleteKey() {
|
|
149
|
+
return this.requireEnvVar('E2E_HARD_DELETE_KEY', 'FDP-E2E-CFG-NO-HD-KEY');
|
|
150
|
+
}
|
|
151
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
152
|
+
// INTERNAL HELPERS
|
|
153
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
154
|
+
requireConfig(fnName) {
|
|
155
|
+
if (!this.config) {
|
|
156
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
157
|
+
message: `${fnName}: config not initialized — call initialize() first.`,
|
|
158
|
+
errorCode: 'FDP-E2E-CFG-NOT-INIT',
|
|
159
|
+
issuerService: 'E2E_ConfigService',
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return this.config;
|
|
163
|
+
}
|
|
164
|
+
requireEnvVar(name, errorCode) {
|
|
165
|
+
const value = process.env[name] || '';
|
|
166
|
+
if (!value) {
|
|
167
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
168
|
+
message: `${name} environment variable is not set.`,
|
|
169
|
+
errorCode: errorCode,
|
|
170
|
+
issuerService: 'E2E_ConfigService',
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
return value;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
exports.E2E_ConfigService = E2E_ConfigService;
|
|
177
|
+
//# sourceMappingURL=e2e-config.service.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { DyNTS_SingletonService } from '@futdevpro/nts-dynamo';
|
|
2
|
+
import { E2E_User_Interface } from '../_models/interfaces/e2e-user.interface';
|
|
3
|
+
/**
|
|
4
|
+
* E2E_LoggerService — strukturalt logging E2E test-flow-hoz metadata-val
|
|
5
|
+
* (user + environment + scenario + duration).
|
|
6
|
+
*
|
|
7
|
+
* Lift-and-shift a fdp-token-service `e2e/src/_shared/_services/
|
|
8
|
+
* e2e-logger.service.ts`-bol (BL-20260518-006).
|
|
9
|
+
*
|
|
10
|
+
* Pure logging facade — singleton-instance, NO state, csak `DyFM_Log` wrapper-ek
|
|
11
|
+
* konzisztens `[E2E]` prefix + structured metadata-payload-tal. A `DyFM_Log`
|
|
12
|
+
* sajat reporter-ek (console + fajl + Discord) konfiguralhatok az fsm-dynamo
|
|
13
|
+
* `DyFM_global_settings.logSettings`-en at — itt csak a hivasok mintazatat
|
|
14
|
+
* standardizaljuk.
|
|
15
|
+
*
|
|
16
|
+
* Pattern: singleton-service `extends DyNTS_SingletonService` — peerDep
|
|
17
|
+
* @futdevpro/nts-dynamo szukseges. Spec REQ-ARCH-002-01-06.
|
|
18
|
+
*
|
|
19
|
+
* 4 method:
|
|
20
|
+
* - logTestStart -> DyFM_Log.info `[E2E] Test started: <name>`
|
|
21
|
+
* - logTestSuccess -> DyFM_Log.success `[E2E] Test passed: <name> (<dur>ms)`
|
|
22
|
+
* - logTestFailure -> DyFM_Log.error `[E2E] Test failed: <name>`
|
|
23
|
+
* - logUserAction -> DyFM_Log.info `[E2E] User action: <action>`
|
|
24
|
+
*/
|
|
25
|
+
export declare class E2E_LoggerService extends DyNTS_SingletonService {
|
|
26
|
+
/**
|
|
27
|
+
* Singleton instance getter.
|
|
28
|
+
*/
|
|
29
|
+
static getInstance(): E2E_LoggerService;
|
|
30
|
+
/**
|
|
31
|
+
* Private constructor — defense-in-depth a singleton-enforcement-hez.
|
|
32
|
+
* Eredeti pattern conform (token-service e2e-logger.service.ts precedens).
|
|
33
|
+
* Csak a `getSingletonInstance()` (DyNTS_SingletonServiceBase) hozhat letre instance-t.
|
|
34
|
+
*/
|
|
35
|
+
private constructor();
|
|
36
|
+
/**
|
|
37
|
+
* Teszt indulasanak logolasa.
|
|
38
|
+
*
|
|
39
|
+
* @param testName - A teszt neve (pl. 'registration-flow-success')
|
|
40
|
+
* @param module - Modul/scenario-csoport (pl. 'auth', 'token-purchase')
|
|
41
|
+
* @param environment - Aktualis environment (`E2E_ConfigService.getEnvironment()`)
|
|
42
|
+
* @param user - Opcionalis: a teszt-user (persistent vagy temporary)
|
|
43
|
+
*/
|
|
44
|
+
logTestStart(testName: string, module: string, environment: string, user?: E2E_User_Interface): void;
|
|
45
|
+
/**
|
|
46
|
+
* Teszt sikeres befejezesenek logolasa.
|
|
47
|
+
*
|
|
48
|
+
* @param testName - A teszt neve
|
|
49
|
+
* @param module - Modul/scenario-csoport
|
|
50
|
+
* @param duration - Teszt futasi ido milliszekundumban
|
|
51
|
+
*/
|
|
52
|
+
logTestSuccess(testName: string, module: string, duration: number): void;
|
|
53
|
+
/**
|
|
54
|
+
* Teszt hiba logolasa.
|
|
55
|
+
*
|
|
56
|
+
* @param testName - A teszt neve
|
|
57
|
+
* @param module - Modul/scenario-csoport
|
|
58
|
+
* @param error - A felmerult hiba objektum (message + stack kerul a payload-ba)
|
|
59
|
+
* @param user - Opcionalis: a teszt-user (debug-konzumpcio)
|
|
60
|
+
*/
|
|
61
|
+
logTestFailure(testName: string, module: string, error: Error, user?: E2E_User_Interface): void;
|
|
62
|
+
/**
|
|
63
|
+
* User action logolasa.
|
|
64
|
+
*
|
|
65
|
+
* @param action - Action tipusa (pl. 'login-attempt', 'registration-submit',
|
|
66
|
+
* 'temporary-user-created')
|
|
67
|
+
* @param user - A user akivel az action tortent
|
|
68
|
+
*/
|
|
69
|
+
logUserAction(action: string, user: E2E_User_Interface): void;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=e2e-logger.service.d.ts.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.E2E_LoggerService = void 0;
|
|
4
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
5
|
+
const nts_dynamo_1 = require("@futdevpro/nts-dynamo");
|
|
6
|
+
/**
|
|
7
|
+
* E2E_LoggerService — strukturalt logging E2E test-flow-hoz metadata-val
|
|
8
|
+
* (user + environment + scenario + duration).
|
|
9
|
+
*
|
|
10
|
+
* Lift-and-shift a fdp-token-service `e2e/src/_shared/_services/
|
|
11
|
+
* e2e-logger.service.ts`-bol (BL-20260518-006).
|
|
12
|
+
*
|
|
13
|
+
* Pure logging facade — singleton-instance, NO state, csak `DyFM_Log` wrapper-ek
|
|
14
|
+
* konzisztens `[E2E]` prefix + structured metadata-payload-tal. A `DyFM_Log`
|
|
15
|
+
* sajat reporter-ek (console + fajl + Discord) konfiguralhatok az fsm-dynamo
|
|
16
|
+
* `DyFM_global_settings.logSettings`-en at — itt csak a hivasok mintazatat
|
|
17
|
+
* standardizaljuk.
|
|
18
|
+
*
|
|
19
|
+
* Pattern: singleton-service `extends DyNTS_SingletonService` — peerDep
|
|
20
|
+
* @futdevpro/nts-dynamo szukseges. Spec REQ-ARCH-002-01-06.
|
|
21
|
+
*
|
|
22
|
+
* 4 method:
|
|
23
|
+
* - logTestStart -> DyFM_Log.info `[E2E] Test started: <name>`
|
|
24
|
+
* - logTestSuccess -> DyFM_Log.success `[E2E] Test passed: <name> (<dur>ms)`
|
|
25
|
+
* - logTestFailure -> DyFM_Log.error `[E2E] Test failed: <name>`
|
|
26
|
+
* - logUserAction -> DyFM_Log.info `[E2E] User action: <action>`
|
|
27
|
+
*/
|
|
28
|
+
class E2E_LoggerService extends nts_dynamo_1.DyNTS_SingletonService {
|
|
29
|
+
/**
|
|
30
|
+
* Singleton instance getter.
|
|
31
|
+
*/
|
|
32
|
+
static getInstance() {
|
|
33
|
+
return E2E_LoggerService.getSingletonInstance();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Private constructor — defense-in-depth a singleton-enforcement-hez.
|
|
37
|
+
* Eredeti pattern conform (token-service e2e-logger.service.ts precedens).
|
|
38
|
+
* Csak a `getSingletonInstance()` (DyNTS_SingletonServiceBase) hozhat letre instance-t.
|
|
39
|
+
*/
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Teszt indulasanak logolasa.
|
|
45
|
+
*
|
|
46
|
+
* @param testName - A teszt neve (pl. 'registration-flow-success')
|
|
47
|
+
* @param module - Modul/scenario-csoport (pl. 'auth', 'token-purchase')
|
|
48
|
+
* @param environment - Aktualis environment (`E2E_ConfigService.getEnvironment()`)
|
|
49
|
+
* @param user - Opcionalis: a teszt-user (persistent vagy temporary)
|
|
50
|
+
*/
|
|
51
|
+
logTestStart(testName, module, environment, user) {
|
|
52
|
+
const metadata = {
|
|
53
|
+
testName: testName,
|
|
54
|
+
module: module,
|
|
55
|
+
environment: environment,
|
|
56
|
+
userEmail: user?.email,
|
|
57
|
+
isPersistent: user?.isPersistent,
|
|
58
|
+
};
|
|
59
|
+
fsm_dynamo_1.DyFM_Log.info(`[E2E] Test started: ${testName}`, metadata);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Teszt sikeres befejezesenek logolasa.
|
|
63
|
+
*
|
|
64
|
+
* @param testName - A teszt neve
|
|
65
|
+
* @param module - Modul/scenario-csoport
|
|
66
|
+
* @param duration - Teszt futasi ido milliszekundumban
|
|
67
|
+
*/
|
|
68
|
+
logTestSuccess(testName, module, duration) {
|
|
69
|
+
const metadata = {
|
|
70
|
+
testName: testName,
|
|
71
|
+
module: module,
|
|
72
|
+
duration: duration,
|
|
73
|
+
};
|
|
74
|
+
fsm_dynamo_1.DyFM_Log.success(`[E2E] Test passed: ${testName} (${duration}ms)`, metadata);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Teszt hiba logolasa.
|
|
78
|
+
*
|
|
79
|
+
* @param testName - A teszt neve
|
|
80
|
+
* @param module - Modul/scenario-csoport
|
|
81
|
+
* @param error - A felmerult hiba objektum (message + stack kerul a payload-ba)
|
|
82
|
+
* @param user - Opcionalis: a teszt-user (debug-konzumpcio)
|
|
83
|
+
*/
|
|
84
|
+
logTestFailure(testName, module, error, user) {
|
|
85
|
+
const metadata = {
|
|
86
|
+
testName: testName,
|
|
87
|
+
module: module,
|
|
88
|
+
errorMessage: error.message,
|
|
89
|
+
errorStack: error.stack,
|
|
90
|
+
userEmail: user?.email,
|
|
91
|
+
isPersistent: user?.isPersistent,
|
|
92
|
+
};
|
|
93
|
+
fsm_dynamo_1.DyFM_Log.error(`[E2E] Test failed: ${testName}`, metadata);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* User action logolasa.
|
|
97
|
+
*
|
|
98
|
+
* @param action - Action tipusa (pl. 'login-attempt', 'registration-submit',
|
|
99
|
+
* 'temporary-user-created')
|
|
100
|
+
* @param user - A user akivel az action tortent
|
|
101
|
+
*/
|
|
102
|
+
logUserAction(action, user) {
|
|
103
|
+
const metadata = {
|
|
104
|
+
action: action,
|
|
105
|
+
userEmail: user.email,
|
|
106
|
+
username: user.username,
|
|
107
|
+
isPersistent: user.isPersistent,
|
|
108
|
+
testContext: user.testContext,
|
|
109
|
+
};
|
|
110
|
+
fsm_dynamo_1.DyFM_Log.info(`[E2E] User action: ${action}`, metadata);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.E2E_LoggerService = E2E_LoggerService;
|
|
114
|
+
//# sourceMappingURL=e2e-logger.service.js.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DyNTS_SingletonService } from '@futdevpro/nts-dynamo';
|
|
2
|
+
import { E2E_User_Interface } from '../_models/interfaces/e2e-user.interface';
|
|
3
|
+
/**
|
|
4
|
+
* E2E_UserManagerService — persistent + temporary user-ek kezelese az E2E
|
|
5
|
+
* teszt-ciklusban.
|
|
6
|
+
*
|
|
7
|
+
* Lift-and-shift a fdp-token-service `e2e/src/_shared/_services/e2e-user-manager.service.ts`-bol
|
|
8
|
+
* (BL-20260518-003). FONTOS valtozasok a token-service eredetijehez kepest:
|
|
9
|
+
* - `deleteTemporaryUser()` TODO-stub-jat valodi impl-be hoztuk: most az
|
|
10
|
+
* `E2E_HardDelete_Util.deleteAccount()`-ot hivja (BL-20260518-004 + BL-001 osszekoteshez).
|
|
11
|
+
* - `getPersistentUser()`-bol az `E2E_ConfigService`-fuggoseget kihagytuk —
|
|
12
|
+
* a config explicit `setPersistentUser()` setter-en at kerul be (decoupled
|
|
13
|
+
* a config-service-tol, amig BL-005 lift-up nem kerul be a csomagba).
|
|
14
|
+
*
|
|
15
|
+
* Pattern: singleton-service `extends DyNTS_SingletonService` — peerDep
|
|
16
|
+
* @futdevpro/nts-dynamo szukseges. Spec REQ-USER-001 + REQ-USER-002 user-lifecycle.
|
|
17
|
+
*/
|
|
18
|
+
export declare class E2E_UserManagerService extends DyNTS_SingletonService {
|
|
19
|
+
/**
|
|
20
|
+
* Singleton instance getter — peerDep-mentes elerheteloseg a consumer-eknek.
|
|
21
|
+
*/
|
|
22
|
+
static getInstance(): E2E_UserManagerService;
|
|
23
|
+
/**
|
|
24
|
+
* Private constructor — defense-in-depth a singleton-enforcement-hez.
|
|
25
|
+
* Pattern conform a token-service eredetijével + a többi E2E_*Service-szel
|
|
26
|
+
* (E2E_LoggerService, E2E_ConfigService).
|
|
27
|
+
*/
|
|
28
|
+
private constructor();
|
|
29
|
+
private persistentUser;
|
|
30
|
+
private temporaryUsers;
|
|
31
|
+
private authServiceUrl;
|
|
32
|
+
private e2eKey;
|
|
33
|
+
/**
|
|
34
|
+
* Persistent user explicit setter — a config-service decoupling miatt nincs
|
|
35
|
+
* implicit config-loader, a consumer adja meg. BL-005 lift-up utan opcionalisan
|
|
36
|
+
* a config-service is hozhatja.
|
|
37
|
+
*
|
|
38
|
+
* @param user - Persistent user adatai (email, username, password, accountId?)
|
|
39
|
+
*/
|
|
40
|
+
setPersistentUser(user: E2E_User_Interface): void;
|
|
41
|
+
/**
|
|
42
|
+
* Hard-delete cascade config beallitasa (a temporary-user-cleanup-hoz).
|
|
43
|
+
* A consumer cycle-elejen egyszer hivja, utana minden delete ezt hasznalja.
|
|
44
|
+
*
|
|
45
|
+
* @param config - authServiceUrl + e2eKey (X-E2E-Key header value)
|
|
46
|
+
*/
|
|
47
|
+
setHardDeleteConfig(config: {
|
|
48
|
+
authServiceUrl: string;
|
|
49
|
+
e2eKey: string;
|
|
50
|
+
}): void;
|
|
51
|
+
/**
|
|
52
|
+
* Persistent user lekerese (cache-elt).
|
|
53
|
+
*
|
|
54
|
+
* @returns Persistent user
|
|
55
|
+
* @throws DyFM_Error ha persistent user meg nincs setelve (setPersistentUser hivas hianyzik)
|
|
56
|
+
*/
|
|
57
|
+
getPersistentUser(): E2E_User_Interface;
|
|
58
|
+
/**
|
|
59
|
+
* Temporary user letrehozasa egyedi email + username + password generatorral.
|
|
60
|
+
* A user az `temporaryUsers` listaba kerul cleanup-tracking-hez (cleanupAllTemporaryUsers).
|
|
61
|
+
*
|
|
62
|
+
* @param testContext - A teszt/scenario neve (pl. 'registration-flow', 'login-test')
|
|
63
|
+
* @param accountId - Opcionalis: ha mar letrehozott account, az ID it-t adjuk a hard-delete-hez
|
|
64
|
+
* @returns A letrehozott (tracking-ba felvett) temporary user
|
|
65
|
+
*/
|
|
66
|
+
createTemporaryUser(testContext: string, accountId?: string): E2E_User_Interface;
|
|
67
|
+
/**
|
|
68
|
+
* Temporary user torlese — hard-delete cascade-pel az auth-service-en at.
|
|
69
|
+
* A `setHardDeleteConfig()` hivasa szukseges elotte (kulonben dob).
|
|
70
|
+
*
|
|
71
|
+
* @param user - A torlendo user. Ha `isPersistent: true`, dob (NEM lehet persistentet torolni).
|
|
72
|
+
* @throws DyFM_Error ha (a) user persistent, (b) hard-delete config nincs setelve,
|
|
73
|
+
* (c) accountId nincs setelve, (d) cascade-delete HTTP hiba.
|
|
74
|
+
*/
|
|
75
|
+
deleteTemporaryUser(user: E2E_User_Interface): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Osszes tracking-ba felvett temporary user hard-delete-cascade-pel torlese.
|
|
78
|
+
* Cycle-vegi cleanup — hibatkereles: egy user fail-e NEM blokkolja a tobbit
|
|
79
|
+
* (try/catch per-user + warn log).
|
|
80
|
+
*/
|
|
81
|
+
cleanupAllTemporaryUsers(): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Tracking-list lekerese (read-only) — debug/inspection celokra.
|
|
84
|
+
*/
|
|
85
|
+
getTemporaryUsers(): E2E_User_Interface[];
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=e2e-user-manager.service.d.ts.map
|