@dismissible/nestjs-api 0.0.2-canary.8976e84.0 → 0.0.2-canary.b0d8bfe.0
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/config/.env.yaml +34 -1
- package/jest.config.ts +23 -1
- package/jest.e2e-config.ts +2 -1
- package/package.json +22 -13
- package/project.json +7 -4
- package/scripts/performance-test.config.json +29 -0
- package/scripts/performance-test.ts +845 -0
- package/src/app-test.factory.ts +8 -1
- package/src/app.module.ts +13 -1
- package/src/app.setup.ts +40 -5
- package/src/bootstrap.ts +8 -3
- package/src/config/app.config.spec.ts +117 -0
- package/src/config/app.config.ts +5 -0
- package/src/config/config.module.spec.ts +0 -2
- package/src/config/default-app.config.spec.ts +74 -0
- package/src/config/default-app.config.ts +15 -0
- package/src/cors/cors.config.spec.ts +162 -0
- package/src/cors/cors.config.ts +37 -0
- package/src/cors/index.ts +1 -0
- package/src/health/health.controller.spec.ts +7 -31
- package/src/health/health.controller.ts +4 -5
- package/src/health/health.module.ts +2 -3
- package/src/health/index.ts +0 -1
- package/src/helmet/helmet.config.spec.ts +197 -0
- package/src/helmet/helmet.config.ts +60 -0
- package/src/helmet/index.ts +1 -0
- package/src/server/server.config.spec.ts +65 -0
- package/src/swagger/swagger.config.spec.ts +113 -0
- package/src/swagger/swagger.config.ts +2 -10
- package/src/swagger/swagger.factory.spec.ts +125 -0
- package/src/swagger/swagger.factory.ts +0 -1
- package/src/validation/index.ts +1 -0
- package/src/validation/validation.config.ts +47 -0
- package/test/config/.env.yaml +23 -0
- package/test/config-jwt-auth/.env.yaml +26 -0
- package/test/dismiss.e2e-spec.ts +61 -0
- package/test/full-cycle.e2e-spec.ts +55 -0
- package/test/get-or-create.e2e-spec.ts +51 -0
- package/test/jwt-auth.e2e-spec.ts +335 -0
- package/test/restore.e2e-spec.ts +61 -0
- package/tsconfig.e2e.json +12 -0
- package/tsconfig.spec.json +12 -0
- package/src/app.e2e-spec.ts +0 -221
- package/src/health/health.service.spec.ts +0 -46
- package/src/health/health.service.ts +0 -16
package/config/.env.yaml
CHANGED
|
@@ -4,5 +4,38 @@ server:
|
|
|
4
4
|
swagger:
|
|
5
5
|
enabled: ${DISMISSIBLE_SWAGGER_ENABLED:-true}
|
|
6
6
|
|
|
7
|
+
helmet:
|
|
8
|
+
enabled: ${DISMISSIBLE_HELMET_ENABLED:-true}
|
|
9
|
+
contentSecurityPolicy: ${DISMISSIBLE_HELMET_CSP:-false}
|
|
10
|
+
crossOriginEmbedderPolicy: ${DISMISSIBLE_HELMET_COEP:-false}
|
|
11
|
+
hstsMaxAge: ${DISMISSIBLE_HELMET_HSTS_MAX_AGE:-31536000}
|
|
12
|
+
hstsIncludeSubDomains: ${DISMISSIBLE_HELMET_HSTS_INCLUDE_SUBDOMAINS:-true}
|
|
13
|
+
hstsPreload: ${DISMISSIBLE_HELMET_HSTS_PRELOAD:-false}
|
|
14
|
+
|
|
15
|
+
cors:
|
|
16
|
+
enabled: ${DISMISSIBLE_CORS_ENABLED:-true}
|
|
17
|
+
origins: ${DISMISSIBLE_CORS_ORIGINS:-http://localhost:3001,http://localhost:5173}
|
|
18
|
+
methods: ${DISMISSIBLE_CORS_METHODS:-GET,POST,DELETE,OPTIONS}
|
|
19
|
+
allowedHeaders: ${DISMISSIBLE_CORS_ALLOWED_HEADERS:-Content-Type,Authorization,x-request-id}
|
|
20
|
+
credentials: ${DISMISSIBLE_CORS_CREDENTIALS:-true}
|
|
21
|
+
maxAge: ${DISMISSIBLE_CORS_MAX_AGE:-86400}
|
|
22
|
+
|
|
7
23
|
db:
|
|
8
|
-
connectionString: ${DISMISSIBLE_POSTGRES_STORAGE_CONNECTION_STRING:-
|
|
24
|
+
connectionString: ${DISMISSIBLE_POSTGRES_STORAGE_CONNECTION_STRING:-postgresql://postgres:postgres@localhost:5432/dismissible}
|
|
25
|
+
|
|
26
|
+
jwtAuth:
|
|
27
|
+
enabled: ${DISMISSIBLE_JWT_AUTH_ENABLED:-false}
|
|
28
|
+
wellKnownUrl: ${DISMISSIBLE_JWT_AUTH_WELL_KNOWN_URL:-}
|
|
29
|
+
issuer: ${DISMISSIBLE_JWT_AUTH_ISSUER:-}
|
|
30
|
+
audience: ${DISMISSIBLE_JWT_AUTH_AUDIENCE:-}
|
|
31
|
+
algorithms:
|
|
32
|
+
- ${DISMISSIBLE_JWT_AUTH_ALGORITHMS:-RS256}
|
|
33
|
+
jwksCacheDuration: ${DISMISSIBLE_JWT_AUTH_JWKS_CACHE_DURATION:-600000}
|
|
34
|
+
requestTimeout: ${DISMISSIBLE_JWT_AUTH_REQUEST_TIMEOUT:-30000}
|
|
35
|
+
priority: ${DISMISSIBLE_JWT_AUTH_PRIORITY:--100}
|
|
36
|
+
|
|
37
|
+
validation:
|
|
38
|
+
disableErrorMessages: ${DISMISSIBLE_VALIDATION_DISABLE_ERROR_MESSAGES:-true}
|
|
39
|
+
whitelist: ${DISMISSIBLE_VALIDATION_WHITELIST:-true}
|
|
40
|
+
forbidNonWhitelisted: ${DISMISSIBLE_VALIDATION_FORBID_NON_WHITELISTED:-true}
|
|
41
|
+
transform: ${DISMISSIBLE_VALIDATION_TRANSFORM:-true}
|
package/jest.config.ts
CHANGED
|
@@ -3,11 +3,33 @@ export default {
|
|
|
3
3
|
preset: '../jest.preset.js',
|
|
4
4
|
testEnvironment: 'node',
|
|
5
5
|
transform: {
|
|
6
|
-
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.json' }],
|
|
6
|
+
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
|
|
7
7
|
},
|
|
8
8
|
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
9
9
|
coverageDirectory: '../coverage/api',
|
|
10
10
|
testMatch: ['**/*.spec.ts'],
|
|
11
11
|
testPathIgnorePatterns: ['\\.e2e-spec\\.ts$'],
|
|
12
12
|
transformIgnorePatterns: ['node_modules/(?!(nest-typed-config|uuid)/)'],
|
|
13
|
+
collectCoverageFrom: [
|
|
14
|
+
'src/**/*.ts',
|
|
15
|
+
'!src/**/*.spec.ts',
|
|
16
|
+
'!src/**/*.e2e-spec.ts',
|
|
17
|
+
'!src/**/*.interface.ts',
|
|
18
|
+
'!src/**/*.dto.ts',
|
|
19
|
+
'!src/**/*.enum.ts',
|
|
20
|
+
'!src/**/index.ts',
|
|
21
|
+
'!src/**/*.module.ts',
|
|
22
|
+
'!src/main.ts',
|
|
23
|
+
'!src/bootstrap.ts',
|
|
24
|
+
'!src/app.setup.ts',
|
|
25
|
+
'!src/app-test.factory.ts',
|
|
26
|
+
],
|
|
27
|
+
coverageThreshold: {
|
|
28
|
+
global: {
|
|
29
|
+
branches: 80,
|
|
30
|
+
functions: 80,
|
|
31
|
+
lines: 80,
|
|
32
|
+
statements: 80,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
13
35
|
};
|
package/jest.e2e-config.ts
CHANGED
|
@@ -3,10 +3,11 @@ export default {
|
|
|
3
3
|
preset: '../jest.preset.js',
|
|
4
4
|
testEnvironment: 'node',
|
|
5
5
|
transform: {
|
|
6
|
-
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.json' }],
|
|
6
|
+
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.e2e.json' }],
|
|
7
7
|
},
|
|
8
8
|
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
9
9
|
coverageDirectory: '../coverage/api-e2e',
|
|
10
10
|
testMatch: ['**/*.e2e-spec.ts'],
|
|
11
11
|
transformIgnorePatterns: ['node_modules/(?!(nest-typed-config|uuid)/)'],
|
|
12
|
+
maxWorkers: 1,
|
|
12
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dismissible/nestjs-api",
|
|
3
|
-
"version": "0.0.2-canary.
|
|
3
|
+
"version": "0.0.2-canary.b0d8bfe.0",
|
|
4
4
|
"description": "Dismissible API application",
|
|
5
5
|
"main": "./src/main.js",
|
|
6
6
|
"types": "./src/main.d.ts",
|
|
@@ -15,21 +15,30 @@
|
|
|
15
15
|
"dismissible-api": "./src/main.js"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"start": "node src/main.js"
|
|
18
|
+
"start": "node src/main.js",
|
|
19
|
+
"prisma:generate": "npx dismissible-prisma generate",
|
|
20
|
+
"prisma:migrate:deploy": "npx dismissible-prisma migrate deploy",
|
|
21
|
+
"prisma:migrate:dev": "npx dismissible-prisma migrate dev",
|
|
22
|
+
"prisma:db:push": "npx dismissible-prisma db push",
|
|
23
|
+
"prisma:studio": "npx dismissible-prisma studio"
|
|
19
24
|
},
|
|
20
25
|
"dependencies": {
|
|
21
|
-
"@dismissible/nestjs-dismissible": "^0.0.2-canary.
|
|
22
|
-
"@dismissible/nestjs-dismissible-item": "^0.0.2-canary.
|
|
23
|
-
"@dismissible/nestjs-
|
|
24
|
-
"@dismissible/nestjs-
|
|
25
|
-
"@dismissible/nestjs-
|
|
26
|
-
"@nestjs
|
|
27
|
-
"@nestjs/
|
|
28
|
-
"@nestjs/
|
|
29
|
-
"@nestjs/
|
|
26
|
+
"@dismissible/nestjs-dismissible": "^0.0.2-canary.b0d8bfe.0",
|
|
27
|
+
"@dismissible/nestjs-dismissible-item": "^0.0.2-canary.b0d8bfe.0",
|
|
28
|
+
"@dismissible/nestjs-jwt-auth-hook": "^0.0.2-canary.b0d8bfe.0",
|
|
29
|
+
"@dismissible/nestjs-storage": "^0.0.2-canary.b0d8bfe.0",
|
|
30
|
+
"@dismissible/nestjs-postgres-storage": "^0.0.2-canary.b0d8bfe.0",
|
|
31
|
+
"@dismissible/nestjs-logger": "^0.0.2-canary.b0d8bfe.0",
|
|
32
|
+
"@nestjs/common": "^11.1.10",
|
|
33
|
+
"@nestjs/core": "^11.1.10",
|
|
34
|
+
"@nestjs/platform-fastify": "^11.1.10",
|
|
35
|
+
"fastify": "^5.6.2",
|
|
36
|
+
"@fastify/helmet": "^13.0.2",
|
|
37
|
+
"@fastify/static": "^8.3.0",
|
|
38
|
+
"@nestjs/swagger": "^11.2.3",
|
|
30
39
|
"class-transformer": "^0.5.1",
|
|
31
|
-
"class-validator": "^0.14.
|
|
32
|
-
"nest-typed-config": "^2.
|
|
40
|
+
"class-validator": "^0.14.3",
|
|
41
|
+
"nest-typed-config": "^2.10.1",
|
|
33
42
|
"reflect-metadata": "^0.2.2",
|
|
34
43
|
"rxjs": "^7.8.2"
|
|
35
44
|
},
|
package/project.json
CHANGED
|
@@ -65,22 +65,25 @@
|
|
|
65
65
|
"prisma:generate": {
|
|
66
66
|
"executor": "nx:run-commands",
|
|
67
67
|
"options": {
|
|
68
|
-
"command": "
|
|
68
|
+
"command": "npm run prisma:generate",
|
|
69
|
+
"cwd": "api"
|
|
69
70
|
}
|
|
70
71
|
},
|
|
71
72
|
"prisma:migrate": {
|
|
72
73
|
"executor": "nx:run-commands",
|
|
73
74
|
"options": {
|
|
74
|
-
"command": "
|
|
75
|
+
"command": "npm run prisma:migrate:dev",
|
|
76
|
+
"cwd": "api"
|
|
75
77
|
}
|
|
76
78
|
},
|
|
77
79
|
"prisma:push": {
|
|
78
80
|
"executor": "nx:run-commands",
|
|
79
81
|
"options": {
|
|
80
|
-
"command": "
|
|
82
|
+
"command": "npm run prisma:db:push",
|
|
83
|
+
"cwd": "api"
|
|
81
84
|
}
|
|
82
85
|
},
|
|
83
|
-
"
|
|
86
|
+
"publish": {
|
|
84
87
|
"executor": "nx:run-commands",
|
|
85
88
|
"options": {
|
|
86
89
|
"command": "npm publish --access public",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"presets": {
|
|
3
|
+
"light": {
|
|
4
|
+
"createCount": 50,
|
|
5
|
+
"getCount": 50,
|
|
6
|
+
"connections": 5,
|
|
7
|
+
"duration": 5
|
|
8
|
+
},
|
|
9
|
+
"medium": {
|
|
10
|
+
"createCount": 100,
|
|
11
|
+
"getCount": 100,
|
|
12
|
+
"connections": 10,
|
|
13
|
+
"duration": 10
|
|
14
|
+
},
|
|
15
|
+
"heavy": {
|
|
16
|
+
"createCount": 500,
|
|
17
|
+
"getCount": 500,
|
|
18
|
+
"connections": 25,
|
|
19
|
+
"duration": 30
|
|
20
|
+
},
|
|
21
|
+
"stress": {
|
|
22
|
+
"createCount": 1000,
|
|
23
|
+
"getCount": 1000,
|
|
24
|
+
"connections": 50,
|
|
25
|
+
"duration": 60
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"default": "medium"
|
|
29
|
+
}
|