@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
package/HOWTO.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# HOWTO — @futdevpro/fdp-e2e-helpers
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm i
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Build
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm run build-base # rimraf ./build && tsc — no tests
|
|
13
|
+
pnpm run build # build-base + jasmine + npm publish (CI uses this)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Test
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pnpm test # build-base + jasmine
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Local linkage (consumer projects, dev-only)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# In this package:
|
|
26
|
+
pnpm run build-tgz
|
|
27
|
+
|
|
28
|
+
# In the consumer project (e.g. fdp-token-service):
|
|
29
|
+
pnpm add file:../tgz-collection/fdp-e2e-helpers/futdevpro-fdp-e2e-helpers-XX.XX.X.tgz
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Publish (manual — CI handles it automatically on master push)
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm run build # builds + tests + publishes
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Adding a new util
|
|
39
|
+
|
|
40
|
+
1. New file: `src/_collections/<slug>.util.ts`
|
|
41
|
+
2. Spec: `src/_collections/<slug>.util.spec.ts`
|
|
42
|
+
3. Export from `src/index.ts`
|
|
43
|
+
4. Interface in `src/_models/interfaces/<slug>-options.interface.ts` (if needed)
|
|
44
|
+
5. Backlog entry: `_specifications/BACKLOG.md`
|
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Future Development Program Ltd. (HU)
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @futdevpro/fdp-e2e-helpers
|
|
2
|
+
|
|
3
|
+
Shared E2E test helpers for FDP-stack apps. Stateless utility-collection — **NOT a framework**.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
This package extracts cross-project E2E helper utilities that wire into existing
|
|
8
|
+
`@futdevpro/fdp-templates` + `@futdevpro/fdp-templates-nts` server-side endpoints.
|
|
9
|
+
The server-half (e.g. `validateE2EKey`, `hardDeleteUserBySystem`,
|
|
10
|
+
`hardDeleteUserDataCollection`) is **already shipped**; this package fills the
|
|
11
|
+
client-half so individual project `e2e/` folders don't reinvent the wheel.
|
|
12
|
+
|
|
13
|
+
## First util: `E2E_HardDelete_Util`
|
|
14
|
+
|
|
15
|
+
Calls the FDP auth-service cascading hard-delete endpoint:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { E2E_HardDelete_Util } from '@futdevpro/fdp-e2e-helpers';
|
|
19
|
+
|
|
20
|
+
await E2E_HardDelete_Util.deleteAccount({
|
|
21
|
+
authServiceUrl: 'http://localhost:48005',
|
|
22
|
+
accountId: '<account-id>',
|
|
23
|
+
e2eKey: process.env.E2E_HARD_DELETE_KEY!,
|
|
24
|
+
timeoutMs: 30000, // optional, default 30s
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The endpoint hit is `DELETE /auth-api/auth-redirect/e2e/user/hard-delete` —
|
|
29
|
+
server-side this triggers cascading delete across all registered services
|
|
30
|
+
(spec REQ-USER-004 in `LIVE-projects/fdp-e2e-full/__specifications/sections/
|
|
31
|
+
user-management.md`).
|
|
32
|
+
|
|
33
|
+
### Production safety (defense-in-depth)
|
|
34
|
+
|
|
35
|
+
- **Client-side guard**: hostnames containing `production` or word-bounded `prod`
|
|
36
|
+
throw `FDP-E2E-HD-PROD-GUARD` BEFORE any HTTP call.
|
|
37
|
+
- **Server-side guard**: the FDPNTS endpoint enforces `env in {local, test}` and
|
|
38
|
+
validates the `X-E2E-Key` header against `E2E_HARD_DELETE_KEY` env.
|
|
39
|
+
- **Server env loader**: `global-env-settings.util.ts` THROWS if
|
|
40
|
+
`E2E_HARD_DELETE_KEY` is set on a production environment.
|
|
41
|
+
|
|
42
|
+
## Why stateless `*_Util` (not singleton service)
|
|
43
|
+
|
|
44
|
+
- Multi-worker parallel-test-safe — no shared instance state across Playwright
|
|
45
|
+
workers.
|
|
46
|
+
- Pure function call signature, no setup/teardown.
|
|
47
|
+
- Singletons (e.g. `E2E_UserManagerService`) come later when stateful cleanup
|
|
48
|
+
tracking is needed.
|
|
49
|
+
|
|
50
|
+
## Status
|
|
51
|
+
|
|
52
|
+
| Layer | Status |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `E2E_HardDelete_Util` (account cascade) | ✅ v01.15.0 |
|
|
55
|
+
| `E2E_UserManagerService` lift-up | ⏳ next PR |
|
|
56
|
+
| `E2E_ConfigService` lift-up | ⏳ later |
|
|
57
|
+
| `E2E_UiHelperService` lift-up | ⏳ later (Playwright dep boundary TBD) |
|
|
58
|
+
|
|
59
|
+
See `_specifications/BACKLOG.md` for the full roadmap.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { E2E_HardDelete_Options_Interface } from '../_models/interfaces/e2e-hard-delete-options.interface';
|
|
2
|
+
/**
|
|
3
|
+
* E2E_HardDelete_Util — kliens-oldali wrapper az FDP auth-service E2E hard-delete
|
|
4
|
+
* cascading endpoint-ehez.
|
|
5
|
+
*
|
|
6
|
+
* Spec hatter (fdp-e2e-full REQ-USER-004):
|
|
7
|
+
* - DELETE /auth-api/auth-redirect/e2e/user/hard-delete
|
|
8
|
+
* - Headers: X-E2E-Key
|
|
9
|
+
* - Body: { accountId: string }
|
|
10
|
+
* - Server-side flow: auth-redirect -> account-DS hardDelete -> loop minden regisztralt
|
|
11
|
+
* service -> DELETE /user/e2e/hard-delete/:userId -> service-self user-DS
|
|
12
|
+
* hardDeleteUserDataCollection (abstract, descendant-service override).
|
|
13
|
+
*
|
|
14
|
+
* Server-half implementacios helye (mar shipped):
|
|
15
|
+
* - fdp-templates-nts: `auth.service-base.ts:validateE2EKey`, `user.controller.ts:
|
|
16
|
+
* hardDeleteUserDataCollection`, `user.data-service.ts:hardDeleteUserBySystem`
|
|
17
|
+
* - fdp-templates: `auth-api-env-settings.const:hardDeleteAccount` endpoint URL
|
|
18
|
+
* - fdp-auth-service: `account.controller.ts:e2e/hard-delete/:accountId` cascading
|
|
19
|
+
*
|
|
20
|
+
* Stateless static class — multi-worker parallel-test-safe (NO singleton-state).
|
|
21
|
+
* Production defense-in-depth: hostname "prod"/"production" substring eseten throw
|
|
22
|
+
* BEFORE HTTP-call.
|
|
23
|
+
*
|
|
24
|
+
* Naming convention: dynamo-nts `*_Util` postfix + `E2E_` prefix (token-service
|
|
25
|
+
* `_shared/_services/e2e-*` pattern-mirror).
|
|
26
|
+
*/
|
|
27
|
+
export declare class E2E_HardDelete_Util {
|
|
28
|
+
/**
|
|
29
|
+
* Endpoint path (relative). A `authServiceUrl`-hez konkatenalva ad teljes URL-t.
|
|
30
|
+
* Tukrozi a server-side fdp-templates `auth-api-env-settings.const`
|
|
31
|
+
* authRoute.hardDeleteAccount mintat — de a util a auth-redirect facade-on at hiv,
|
|
32
|
+
* NEM a kozvetlen account-controller-en.
|
|
33
|
+
*/
|
|
34
|
+
static readonly ENDPOINT_PATH: string;
|
|
35
|
+
/**
|
|
36
|
+
* Account cascade hard-delete egy E2E test futashoz.
|
|
37
|
+
* Az auth-service `/auth-redirect/e2e/user/hard-delete` endpoint-jat hivja,
|
|
38
|
+
* ami a server-side cascade-et indit: auth-service -> account-DS -> loop
|
|
39
|
+
* minden regisztralt service -> user-DS hardDelete (per-service abstract impl).
|
|
40
|
+
*
|
|
41
|
+
* @param options - authServiceUrl, accountId, e2eKey, timeoutMs?
|
|
42
|
+
* @throws DyFM_Error ha:
|
|
43
|
+
* - production hostname detected (client-side guard, `FDP-E2E-HD-PROD-GUARD`)
|
|
44
|
+
* - HTTP 403 (server prod-env block, `FDP-E2E-HD-403`)
|
|
45
|
+
* - HTTP 401 (E2E key mismatch, `FDP-E2E-HD-401`)
|
|
46
|
+
* - HTTP 404 (account not found, `FDP-E2E-HD-404`)
|
|
47
|
+
* - HTTP 5xx (server-side cascade failure, `FDP-E2E-HD-5XX`)
|
|
48
|
+
* - timeout (`FDP-E2E-HD-TIMEOUT`)
|
|
49
|
+
* - network / unknown error (`FDP-E2E-HD-NETWORK`)
|
|
50
|
+
*/
|
|
51
|
+
static deleteAccount(options: E2E_HardDelete_Options_Interface): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Client-side production-guard: ha az authServiceUrl hostname-ben "prod"/"production"
|
|
54
|
+
* substring szerepel, AZONNAL throw — meg HTTP-hivas elott.
|
|
55
|
+
*
|
|
56
|
+
* Defense-in-depth a server-side prod-env-check mellett (`global-env-settings.util.ts:139`).
|
|
57
|
+
* Egy esetleges misconfigured server is megakad ezen.
|
|
58
|
+
*/
|
|
59
|
+
static assertNotProductionUrl(authServiceUrl: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Helper: hostname extract egy URL-bol. Robusztus malformed-URL-re is.
|
|
62
|
+
*/
|
|
63
|
+
static extractHostname(url: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Helper: HTTP-status -> DyFM_Error mapping.
|
|
66
|
+
*/
|
|
67
|
+
private static buildHttpError;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=e2e-hard-delete.util.d.ts.map
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.E2E_HardDelete_Util = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
+
const fsm_dynamo_1 = require("@futdevpro/fsm-dynamo");
|
|
7
|
+
/**
|
|
8
|
+
* E2E_HardDelete_Util — kliens-oldali wrapper az FDP auth-service E2E hard-delete
|
|
9
|
+
* cascading endpoint-ehez.
|
|
10
|
+
*
|
|
11
|
+
* Spec hatter (fdp-e2e-full REQ-USER-004):
|
|
12
|
+
* - DELETE /auth-api/auth-redirect/e2e/user/hard-delete
|
|
13
|
+
* - Headers: X-E2E-Key
|
|
14
|
+
* - Body: { accountId: string }
|
|
15
|
+
* - Server-side flow: auth-redirect -> account-DS hardDelete -> loop minden regisztralt
|
|
16
|
+
* service -> DELETE /user/e2e/hard-delete/:userId -> service-self user-DS
|
|
17
|
+
* hardDeleteUserDataCollection (abstract, descendant-service override).
|
|
18
|
+
*
|
|
19
|
+
* Server-half implementacios helye (mar shipped):
|
|
20
|
+
* - fdp-templates-nts: `auth.service-base.ts:validateE2EKey`, `user.controller.ts:
|
|
21
|
+
* hardDeleteUserDataCollection`, `user.data-service.ts:hardDeleteUserBySystem`
|
|
22
|
+
* - fdp-templates: `auth-api-env-settings.const:hardDeleteAccount` endpoint URL
|
|
23
|
+
* - fdp-auth-service: `account.controller.ts:e2e/hard-delete/:accountId` cascading
|
|
24
|
+
*
|
|
25
|
+
* Stateless static class — multi-worker parallel-test-safe (NO singleton-state).
|
|
26
|
+
* Production defense-in-depth: hostname "prod"/"production" substring eseten throw
|
|
27
|
+
* BEFORE HTTP-call.
|
|
28
|
+
*
|
|
29
|
+
* Naming convention: dynamo-nts `*_Util` postfix + `E2E_` prefix (token-service
|
|
30
|
+
* `_shared/_services/e2e-*` pattern-mirror).
|
|
31
|
+
*/
|
|
32
|
+
class E2E_HardDelete_Util {
|
|
33
|
+
/**
|
|
34
|
+
* Endpoint path (relative). A `authServiceUrl`-hez konkatenalva ad teljes URL-t.
|
|
35
|
+
* Tukrozi a server-side fdp-templates `auth-api-env-settings.const`
|
|
36
|
+
* authRoute.hardDeleteAccount mintat — de a util a auth-redirect facade-on at hiv,
|
|
37
|
+
* NEM a kozvetlen account-controller-en.
|
|
38
|
+
*/
|
|
39
|
+
static ENDPOINT_PATH = '/auth-api/auth-redirect/e2e/user/hard-delete';
|
|
40
|
+
/**
|
|
41
|
+
* Account cascade hard-delete egy E2E test futashoz.
|
|
42
|
+
* Az auth-service `/auth-redirect/e2e/user/hard-delete` endpoint-jat hivja,
|
|
43
|
+
* ami a server-side cascade-et indit: auth-service -> account-DS -> loop
|
|
44
|
+
* minden regisztralt service -> user-DS hardDelete (per-service abstract impl).
|
|
45
|
+
*
|
|
46
|
+
* @param options - authServiceUrl, accountId, e2eKey, timeoutMs?
|
|
47
|
+
* @throws DyFM_Error ha:
|
|
48
|
+
* - production hostname detected (client-side guard, `FDP-E2E-HD-PROD-GUARD`)
|
|
49
|
+
* - HTTP 403 (server prod-env block, `FDP-E2E-HD-403`)
|
|
50
|
+
* - HTTP 401 (E2E key mismatch, `FDP-E2E-HD-401`)
|
|
51
|
+
* - HTTP 404 (account not found, `FDP-E2E-HD-404`)
|
|
52
|
+
* - HTTP 5xx (server-side cascade failure, `FDP-E2E-HD-5XX`)
|
|
53
|
+
* - timeout (`FDP-E2E-HD-TIMEOUT`)
|
|
54
|
+
* - network / unknown error (`FDP-E2E-HD-NETWORK`)
|
|
55
|
+
*/
|
|
56
|
+
static async deleteAccount(options) {
|
|
57
|
+
E2E_HardDelete_Util.assertNotProductionUrl(options.authServiceUrl);
|
|
58
|
+
const fullUrl = `${options.authServiceUrl}${E2E_HardDelete_Util.ENDPOINT_PATH}`;
|
|
59
|
+
const timeoutMs = options.timeoutMs ?? 30000;
|
|
60
|
+
fsm_dynamo_1.DyFM_Log.info(`[E2E_HardDelete] DELETE ${fullUrl} (accountId=${options.accountId})`);
|
|
61
|
+
try {
|
|
62
|
+
const response = await axios_1.default.request({
|
|
63
|
+
method: 'DELETE',
|
|
64
|
+
url: fullUrl,
|
|
65
|
+
headers: {
|
|
66
|
+
'X-E2E-Key': options.e2eKey,
|
|
67
|
+
'Content-Type': 'application/json',
|
|
68
|
+
},
|
|
69
|
+
data: {
|
|
70
|
+
accountId: options.accountId,
|
|
71
|
+
},
|
|
72
|
+
timeout: timeoutMs,
|
|
73
|
+
validateStatus: () => true,
|
|
74
|
+
});
|
|
75
|
+
if (response.status >= 200 && response.status < 300) {
|
|
76
|
+
fsm_dynamo_1.DyFM_Log.info(`[E2E_HardDelete] Cascade-delete success for accountId=${options.accountId}`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
throw E2E_HardDelete_Util.buildHttpError(response.status, response.data, options.accountId);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (fsm_dynamo_1.DyFM_Error.isDyFMError(error)) {
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
const axiosErr = error;
|
|
86
|
+
if (axiosErr.code === 'ECONNABORTED' || axiosErr.message?.includes('timeout')) {
|
|
87
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
88
|
+
message: `E2E hard-delete timeout after ${timeoutMs}ms for accountId=${options.accountId}`,
|
|
89
|
+
errorCode: 'FDP-E2E-HD-TIMEOUT',
|
|
90
|
+
error: error,
|
|
91
|
+
issuerService: 'E2E_HardDelete_Util',
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
95
|
+
message: `E2E hard-delete network/unknown error: ${axiosErr.message || 'unknown'}`,
|
|
96
|
+
errorCode: 'FDP-E2E-HD-NETWORK',
|
|
97
|
+
error: error,
|
|
98
|
+
issuerService: 'E2E_HardDelete_Util',
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Client-side production-guard: ha az authServiceUrl hostname-ben "prod"/"production"
|
|
104
|
+
* substring szerepel, AZONNAL throw — meg HTTP-hivas elott.
|
|
105
|
+
*
|
|
106
|
+
* Defense-in-depth a server-side prod-env-check mellett (`global-env-settings.util.ts:139`).
|
|
107
|
+
* Egy esetleges misconfigured server is megakad ezen.
|
|
108
|
+
*/
|
|
109
|
+
static assertNotProductionUrl(authServiceUrl) {
|
|
110
|
+
const hostname = E2E_HardDelete_Util.extractHostname(authServiceUrl);
|
|
111
|
+
const lowerHostname = hostname.toLowerCase();
|
|
112
|
+
if (lowerHostname.includes('production') || /(^|\W)prod(\W|$)/.test(lowerHostname)) {
|
|
113
|
+
throw new fsm_dynamo_1.DyFM_Error({
|
|
114
|
+
message: `Refused: authServiceUrl hostname "${hostname}" contains production indicator. ` +
|
|
115
|
+
`E2E hard-delete is only allowed against local/test environments.`,
|
|
116
|
+
errorCode: 'FDP-E2E-HD-PROD-GUARD',
|
|
117
|
+
issuerService: 'E2E_HardDelete_Util',
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Helper: hostname extract egy URL-bol. Robusztus malformed-URL-re is.
|
|
123
|
+
*/
|
|
124
|
+
static extractHostname(url) {
|
|
125
|
+
try {
|
|
126
|
+
return new URL(url).hostname;
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
const match = url.match(/^(?:https?:\/\/)?([^/:?#]+)/i);
|
|
130
|
+
return match ? match[1] : url;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Helper: HTTP-status -> DyFM_Error mapping.
|
|
135
|
+
*/
|
|
136
|
+
static buildHttpError(status, responseBody, accountId) {
|
|
137
|
+
const bodyStr = typeof responseBody === 'string'
|
|
138
|
+
? responseBody
|
|
139
|
+
: JSON.stringify(responseBody ?? {}).substring(0, 300);
|
|
140
|
+
if (status === 401) {
|
|
141
|
+
return new fsm_dynamo_1.DyFM_Error({
|
|
142
|
+
message: `E2E hard-delete HTTP 401 (E2E key mismatch / unauthorized) for accountId=${accountId}: ${bodyStr}`,
|
|
143
|
+
errorCode: 'FDP-E2E-HD-401',
|
|
144
|
+
issuerService: 'E2E_HardDelete_Util',
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (status === 403) {
|
|
148
|
+
return new fsm_dynamo_1.DyFM_Error({
|
|
149
|
+
message: `E2E hard-delete HTTP 403 (server prod-env block) for accountId=${accountId}: ${bodyStr}`,
|
|
150
|
+
errorCode: 'FDP-E2E-HD-403',
|
|
151
|
+
issuerService: 'E2E_HardDelete_Util',
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (status === 404) {
|
|
155
|
+
return new fsm_dynamo_1.DyFM_Error({
|
|
156
|
+
message: `E2E hard-delete HTTP 404 (account not found) for accountId=${accountId}: ${bodyStr}`,
|
|
157
|
+
errorCode: 'FDP-E2E-HD-404',
|
|
158
|
+
issuerService: 'E2E_HardDelete_Util',
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
if (status >= 500) {
|
|
162
|
+
return new fsm_dynamo_1.DyFM_Error({
|
|
163
|
+
message: `E2E hard-delete HTTP ${status} (server cascade failure) for accountId=${accountId}: ${bodyStr}`,
|
|
164
|
+
errorCode: 'FDP-E2E-HD-5XX',
|
|
165
|
+
issuerService: 'E2E_HardDelete_Util',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return new fsm_dynamo_1.DyFM_Error({
|
|
169
|
+
message: `E2E hard-delete unexpected HTTP ${status} for accountId=${accountId}: ${bodyStr}`,
|
|
170
|
+
errorCode: 'FDP-E2E-HD-UNKNOWN',
|
|
171
|
+
issuerService: 'E2E_HardDelete_Util',
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
exports.E2E_HardDelete_Util = E2E_HardDelete_Util;
|
|
176
|
+
//# sourceMappingURL=e2e-hard-delete.util.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E_UniqueGenerator_Util — egyedi email, username, password generalas
|
|
3
|
+
* parallel-safe modon az E2E teszteleshez.
|
|
4
|
+
*
|
|
5
|
+
* Lift-and-shift a fdp-token-service `e2e/src/_shared/_utils/e2e-unique-generator.util.ts`-bol
|
|
6
|
+
* (BL-20260518-004). Pure static class — multi-worker safe (NO instance state,
|
|
7
|
+
* spec REQ-STRATEGY-000 parallel teszt-futas alapja).
|
|
8
|
+
*
|
|
9
|
+
* Pattern: `<prefix>-<testContext>-<timestamp>-<random>` formatum. A timestamp+random
|
|
10
|
+
* kombinacio race-condition-free egy worker-en belul; cross-worker collision-rate
|
|
11
|
+
* ~1/10000 (random 0..9999 + ms-precision timestamp).
|
|
12
|
+
*/
|
|
13
|
+
export declare class E2E_UniqueGenerator_Util {
|
|
14
|
+
/**
|
|
15
|
+
* Egyedi email cim generalasa.
|
|
16
|
+
*
|
|
17
|
+
* Formatum: `<prefix>-<testContext>-<timestamp>-<random>@test.futdevpro.hu`
|
|
18
|
+
* A `@test.futdevpro.hu` domain spec-elt (REQ-USER-003 test domain email-ek)
|
|
19
|
+
* — production-safety: csak ez a domain valid e2e-hez.
|
|
20
|
+
*
|
|
21
|
+
* @param prefix - Email prefix (pl. 'user', 'admin', 'tester')
|
|
22
|
+
* @param testContext - Teszt kontextus (pl. 'registration-flow', 'login-test')
|
|
23
|
+
* @returns Egyedi email cim
|
|
24
|
+
*/
|
|
25
|
+
static generateUniqueEmail(prefix: string, testContext: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Egyedi username generalasa.
|
|
28
|
+
*
|
|
29
|
+
* Formatum: `<prefix>-<testContext>-<timestamp>-<random>`.
|
|
30
|
+
* Spec REQ-FDP-PROTECTED-USERNAME-001 nem erinti a tesz-username-eket
|
|
31
|
+
* (a protected-list adminisztrativ nevekre vonatkozik, nem e2e-prefixre).
|
|
32
|
+
*
|
|
33
|
+
* @param prefix - Username prefix
|
|
34
|
+
* @param testContext - Teszt kontextus
|
|
35
|
+
* @returns Egyedi username
|
|
36
|
+
*/
|
|
37
|
+
static generateUniqueUsername(prefix: string, testContext: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Egyedi password generalasa.
|
|
40
|
+
*
|
|
41
|
+
* Formatum: `<prefix>-<timestamp>-<random>`.
|
|
42
|
+
* **Megj.**: ez NEM crypto-strength generator — csak unique-marker E2E
|
|
43
|
+
* teszthez. Production-password-flow tesztelesehez kulon helper (kovetkezo
|
|
44
|
+
* BL-tetel) jonne password-policy-aware generator-ral.
|
|
45
|
+
*
|
|
46
|
+
* @param prefix - Password prefix
|
|
47
|
+
* @returns Egyedi password
|
|
48
|
+
*/
|
|
49
|
+
static generateUniquePassword(prefix: string): string;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=e2e-unique-generator.util.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.E2E_UniqueGenerator_Util = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* E2E_UniqueGenerator_Util — egyedi email, username, password generalas
|
|
6
|
+
* parallel-safe modon az E2E teszteleshez.
|
|
7
|
+
*
|
|
8
|
+
* Lift-and-shift a fdp-token-service `e2e/src/_shared/_utils/e2e-unique-generator.util.ts`-bol
|
|
9
|
+
* (BL-20260518-004). Pure static class — multi-worker safe (NO instance state,
|
|
10
|
+
* spec REQ-STRATEGY-000 parallel teszt-futas alapja).
|
|
11
|
+
*
|
|
12
|
+
* Pattern: `<prefix>-<testContext>-<timestamp>-<random>` formatum. A timestamp+random
|
|
13
|
+
* kombinacio race-condition-free egy worker-en belul; cross-worker collision-rate
|
|
14
|
+
* ~1/10000 (random 0..9999 + ms-precision timestamp).
|
|
15
|
+
*/
|
|
16
|
+
class E2E_UniqueGenerator_Util {
|
|
17
|
+
/**
|
|
18
|
+
* Egyedi email cim generalasa.
|
|
19
|
+
*
|
|
20
|
+
* Formatum: `<prefix>-<testContext>-<timestamp>-<random>@test.futdevpro.hu`
|
|
21
|
+
* A `@test.futdevpro.hu` domain spec-elt (REQ-USER-003 test domain email-ek)
|
|
22
|
+
* — production-safety: csak ez a domain valid e2e-hez.
|
|
23
|
+
*
|
|
24
|
+
* @param prefix - Email prefix (pl. 'user', 'admin', 'tester')
|
|
25
|
+
* @param testContext - Teszt kontextus (pl. 'registration-flow', 'login-test')
|
|
26
|
+
* @returns Egyedi email cim
|
|
27
|
+
*/
|
|
28
|
+
static generateUniqueEmail(prefix, testContext) {
|
|
29
|
+
const timestamp = Date.now();
|
|
30
|
+
const random = Math.floor(Math.random() * 10000);
|
|
31
|
+
return `${prefix}-${testContext}-${timestamp}-${random}@test.futdevpro.hu`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Egyedi username generalasa.
|
|
35
|
+
*
|
|
36
|
+
* Formatum: `<prefix>-<testContext>-<timestamp>-<random>`.
|
|
37
|
+
* Spec REQ-FDP-PROTECTED-USERNAME-001 nem erinti a tesz-username-eket
|
|
38
|
+
* (a protected-list adminisztrativ nevekre vonatkozik, nem e2e-prefixre).
|
|
39
|
+
*
|
|
40
|
+
* @param prefix - Username prefix
|
|
41
|
+
* @param testContext - Teszt kontextus
|
|
42
|
+
* @returns Egyedi username
|
|
43
|
+
*/
|
|
44
|
+
static generateUniqueUsername(prefix, testContext) {
|
|
45
|
+
const timestamp = Date.now();
|
|
46
|
+
const random = Math.floor(Math.random() * 10000);
|
|
47
|
+
return `${prefix}-${testContext}-${timestamp}-${random}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Egyedi password generalasa.
|
|
51
|
+
*
|
|
52
|
+
* Formatum: `<prefix>-<timestamp>-<random>`.
|
|
53
|
+
* **Megj.**: ez NEM crypto-strength generator — csak unique-marker E2E
|
|
54
|
+
* teszthez. Production-password-flow tesztelesehez kulon helper (kovetkezo
|
|
55
|
+
* BL-tetel) jonne password-policy-aware generator-ral.
|
|
56
|
+
*
|
|
57
|
+
* @param prefix - Password prefix
|
|
58
|
+
* @returns Egyedi password
|
|
59
|
+
*/
|
|
60
|
+
static generateUniquePassword(prefix) {
|
|
61
|
+
const timestamp = Date.now();
|
|
62
|
+
const random = Math.floor(Math.random() * 10000);
|
|
63
|
+
return `${prefix}-${timestamp}-${random}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.E2E_UniqueGenerator_Util = E2E_UniqueGenerator_Util;
|
|
67
|
+
//# sourceMappingURL=e2e-unique-generator.util.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options interface a `E2E_HardDelete_Util.deleteAccount()` hivashoz.
|
|
3
|
+
*
|
|
4
|
+
* Spec REQ-USER-004 (fdp-e2e-full): cascading account hard-delete az auth-redirect
|
|
5
|
+
* endpoint-en at — account-DS->loop->user-DS-ek mind a regisztralt service-eken.
|
|
6
|
+
*
|
|
7
|
+
* Production safety: server-side enforce-elt (FDPNTS `auth.service-base.validateE2EKey`
|
|
8
|
+
* + `global-env-settings.util` prod-env-check). A util client-oldali defense-in-depth
|
|
9
|
+
* guard-ot is alkalmaz (lasd `E2E_HardDelete_Util.deleteAccount` prod-substring check).
|
|
10
|
+
*/
|
|
11
|
+
export interface E2E_HardDelete_Options_Interface {
|
|
12
|
+
/**
|
|
13
|
+
* Auth-service base URL — pl. 'http://localhost:48005' vagy 'https://test.auth.futdevpro.hu'.
|
|
14
|
+
* A util ezen az URL-en hivja a `/auth-api/auth-redirect/e2e/user/hard-delete` endpoint-ot.
|
|
15
|
+
*
|
|
16
|
+
* Production-guard: a hostname-ben szereplo "prod" vagy "production" substring eseten
|
|
17
|
+
* a util AZONNAL throw-ol HTTP-hivas elott (defense-in-depth a server-side check mellett).
|
|
18
|
+
*/
|
|
19
|
+
authServiceUrl: string;
|
|
20
|
+
/**
|
|
21
|
+
* A torlendo account ID-je (`Account_DataModel._id`). A server-side cascade ennek
|
|
22
|
+
* alapjan torli az accountot es az osszes hozzakapcsolt service-en a user-eket.
|
|
23
|
+
*/
|
|
24
|
+
accountId: string;
|
|
25
|
+
/**
|
|
26
|
+
* X-E2E-Key header ertek. Az env-var `E2E_HARD_DELETE_KEY`-vel kell matchelnie
|
|
27
|
+
* a server-en (FDPNTS_keysEnvSERVER_settings.e2eHardDeleteKey).
|
|
28
|
+
*/
|
|
29
|
+
e2eKey: string;
|
|
30
|
+
/**
|
|
31
|
+
* Request timeout milliseconds-ben. Default: 30000 (30s).
|
|
32
|
+
* A cascade-delete tobb service-t erint, ezert szukseges hosszabb timeout.
|
|
33
|
+
*/
|
|
34
|
+
timeoutMs?: number;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=e2e-hard-delete-options.interface.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E Test Config Interface.
|
|
3
|
+
*
|
|
4
|
+
* Lift-and-shift a fdp-token-service `e2e/src/_shared/_interfaces/
|
|
5
|
+
* e2e-test-config.interface.ts`-bol (BL-20260518-005).
|
|
6
|
+
*
|
|
7
|
+
* Spec hatter (fdp-e2e-full REQ-ARCH-002-01-01): a shared layer E2E_ConfigService
|
|
8
|
+
* mezoi — environment, kliens + szerver URL-ek.
|
|
9
|
+
*/
|
|
10
|
+
export interface E2E_TestConfig_Interface {
|
|
11
|
+
/**
|
|
12
|
+
* Kornyezet (local / test / prod). A prod tilos (E2E_ConfigService prod-guard dob).
|
|
13
|
+
*/
|
|
14
|
+
environment: string;
|
|
15
|
+
/**
|
|
16
|
+
* Client base URL (pl. Angular app), pl. 'http://localhost:4215'.
|
|
17
|
+
*/
|
|
18
|
+
clientUrl: string;
|
|
19
|
+
/**
|
|
20
|
+
* Server base URL (pl. Express API), pl. 'http://localhost:39155'.
|
|
21
|
+
*/
|
|
22
|
+
serverUrl: string;
|
|
23
|
+
/**
|
|
24
|
+
* Auth-service base URL (FDP auth service) — E2E_HardDelete_Util.deleteAccount
|
|
25
|
+
* authServiceUrl-jehez.
|
|
26
|
+
*/
|
|
27
|
+
authServiceUrl?: string;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=e2e-test-config.interface.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E User Interface.
|
|
3
|
+
*
|
|
4
|
+
* A teszteleshez hasznalt user adatok kontraktja. Lift-and-shift a
|
|
5
|
+
* fdp-token-service `e2e/src/_shared/_interfaces/e2e-user.interface.ts`-ből,
|
|
6
|
+
* BL-20260518-004 lift-up scope.
|
|
7
|
+
*
|
|
8
|
+
* Spec hatter (fdp-e2e-full REQ-USER-001): Persistent + Temporary user-tipusok.
|
|
9
|
+
*/
|
|
10
|
+
export interface E2E_User_Interface {
|
|
11
|
+
/**
|
|
12
|
+
* User email cime — egyedi azonosito a teszt kontextusban.
|
|
13
|
+
*/
|
|
14
|
+
email: string;
|
|
15
|
+
/**
|
|
16
|
+
* User felhasznaloneve — szinten egyedi, generalva.
|
|
17
|
+
*/
|
|
18
|
+
username: string;
|
|
19
|
+
/**
|
|
20
|
+
* User jelszava — random/predetermined.
|
|
21
|
+
*/
|
|
22
|
+
password: string;
|
|
23
|
+
/**
|
|
24
|
+
* User ID — opcionalis, csak akkor van kitoltve, ha a user mar letre van hozva
|
|
25
|
+
* (registration flow utan).
|
|
26
|
+
*/
|
|
27
|
+
userId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Account ID — opcionalis, hard-delete cascade-hez szukseges
|
|
30
|
+
* (E2E_HardDelete_Util.deleteAccount input).
|
|
31
|
+
*/
|
|
32
|
+
accountId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Jelzi, hogy ez egy persistent user (allando teszt user) vagy temporary user
|
|
35
|
+
* (cleanup-keszseggel). Spec REQ-USER-001-01 vs REQ-USER-001-02.
|
|
36
|
+
*/
|
|
37
|
+
isPersistent: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* User letrehozasanak idopontja.
|
|
40
|
+
*/
|
|
41
|
+
createdAt: Date;
|
|
42
|
+
/**
|
|
43
|
+
* Melyik teszt/scenario hozta letre ezt a user-t.
|
|
44
|
+
* Csak temporary user-eknel van kitoltve.
|
|
45
|
+
*/
|
|
46
|
+
testContext?: string;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=e2e-user.interface.d.ts.map
|