@api-client/core 0.18.12 → 0.18.14
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/build/src/browser.d.ts +0 -3
- package/build/src/browser.d.ts.map +1 -1
- package/build/src/browser.js +0 -3
- package/build/src/browser.js.map +1 -1
- package/build/src/index.d.ts +2 -5
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +2 -5
- package/build/src/index.js.map +1 -1
- package/build/src/lib/logging/DefaultLogger.d.ts +14 -0
- package/build/src/lib/logging/DefaultLogger.d.ts.map +1 -1
- package/build/src/lib/logging/DefaultLogger.js +27 -0
- package/build/src/lib/logging/DefaultLogger.js.map +1 -1
- package/build/src/lib/logging/index.d.ts +4 -0
- package/build/src/lib/logging/index.d.ts.map +1 -0
- package/build/src/lib/logging/index.js +10 -0
- package/build/src/lib/logging/index.js.map +1 -0
- package/build/src/modeling/DomainValidation.d.ts +78 -0
- package/build/src/modeling/DomainValidation.d.ts.map +1 -1
- package/build/src/modeling/DomainValidation.js +78 -0
- package/build/src/modeling/DomainValidation.js.map +1 -1
- package/build/src/modeling/validation/entity_validation.d.ts +17 -3
- package/build/src/modeling/validation/entity_validation.d.ts.map +1 -1
- package/build/src/modeling/validation/entity_validation.js +51 -10
- package/build/src/modeling/validation/entity_validation.js.map +1 -1
- package/build/src/models/ClientCertificate.d.ts +1 -1
- package/build/src/models/ClientCertificate.js.map +1 -1
- package/build/src/models/RequestConfig.d.ts +1 -1
- package/build/src/models/RequestConfig.js.map +1 -1
- package/build/src/models/SerializableError.d.ts +1 -1
- package/build/src/models/SerializableError.d.ts.map +1 -1
- package/build/src/models/SerializableError.js.map +1 -1
- package/build/src/proxy/RequestProxy.d.ts.map +1 -1
- package/build/src/proxy/RequestProxy.js +2 -2
- package/build/src/proxy/RequestProxy.js.map +1 -1
- package/build/src/runtime/http-engine/CoreEngine.d.ts +218 -139
- package/build/src/runtime/http-engine/CoreEngine.d.ts.map +1 -1
- package/build/src/runtime/http-engine/CoreEngine.js +716 -870
- package/build/src/runtime/http-engine/CoreEngine.js.map +1 -1
- package/build/src/runtime/http-engine/PayloadSupport.d.ts.map +1 -1
- package/build/src/runtime/http-engine/PayloadSupport.js +2 -1
- package/build/src/runtime/http-engine/PayloadSupport.js.map +1 -1
- package/build/src/runtime/http-engine/auth/AuthManager.d.ts +73 -0
- package/build/src/runtime/http-engine/auth/AuthManager.d.ts.map +1 -0
- package/build/src/runtime/http-engine/auth/AuthManager.js +186 -0
- package/build/src/runtime/http-engine/auth/AuthManager.js.map +1 -0
- package/build/src/runtime/http-engine/auth/index.d.ts +2 -0
- package/build/src/runtime/http-engine/auth/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/auth/index.js +2 -0
- package/build/src/runtime/http-engine/auth/index.js.map +1 -0
- package/build/src/runtime/http-engine/certificates/CertificateManager.d.ts +11 -0
- package/build/src/runtime/http-engine/certificates/CertificateManager.d.ts.map +1 -0
- package/build/src/runtime/http-engine/certificates/CertificateManager.js +76 -0
- package/build/src/runtime/http-engine/certificates/CertificateManager.js.map +1 -0
- package/build/src/runtime/http-engine/certificates/index.d.ts +2 -0
- package/build/src/runtime/http-engine/certificates/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/certificates/index.js +2 -0
- package/build/src/runtime/http-engine/certificates/index.js.map +1 -0
- package/build/src/runtime/http-engine/compression/CompressionManager.d.ts +25 -0
- package/build/src/runtime/http-engine/compression/CompressionManager.d.ts.map +1 -0
- package/build/src/runtime/http-engine/compression/CompressionManager.js +89 -0
- package/build/src/runtime/http-engine/compression/CompressionManager.js.map +1 -0
- package/build/src/runtime/http-engine/compression/index.d.ts +2 -0
- package/build/src/runtime/http-engine/compression/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/compression/index.js +2 -0
- package/build/src/runtime/http-engine/compression/index.js.map +1 -0
- package/build/src/runtime/http-engine/connections/ConnectionManager.d.ts +57 -0
- package/build/src/runtime/http-engine/connections/ConnectionManager.d.ts.map +1 -0
- package/build/src/runtime/http-engine/connections/ConnectionManager.js +78 -0
- package/build/src/runtime/http-engine/connections/ConnectionManager.js.map +1 -0
- package/build/src/runtime/http-engine/connections/DigestAuthHandler.d.ts +70 -0
- package/build/src/runtime/http-engine/connections/DigestAuthHandler.d.ts.map +1 -0
- package/build/src/runtime/http-engine/connections/DigestAuthHandler.js +184 -0
- package/build/src/runtime/http-engine/connections/DigestAuthHandler.js.map +1 -0
- package/build/src/runtime/http-engine/connections/DirectConnection.d.ts +22 -0
- package/build/src/runtime/http-engine/connections/DirectConnection.d.ts.map +1 -0
- package/build/src/runtime/http-engine/connections/DirectConnection.js +105 -0
- package/build/src/runtime/http-engine/connections/DirectConnection.js.map +1 -0
- package/build/src/runtime/http-engine/connections/ProxyAuthHandler.d.ts +60 -0
- package/build/src/runtime/http-engine/connections/ProxyAuthHandler.d.ts.map +1 -0
- package/build/src/runtime/http-engine/connections/ProxyAuthHandler.js +138 -0
- package/build/src/runtime/http-engine/connections/ProxyAuthHandler.js.map +1 -0
- package/build/src/runtime/http-engine/connections/ProxyConnection.d.ts +14 -0
- package/build/src/runtime/http-engine/connections/ProxyConnection.d.ts.map +1 -0
- package/build/src/runtime/http-engine/connections/ProxyConnection.js +47 -0
- package/build/src/runtime/http-engine/connections/ProxyConnection.js.map +1 -0
- package/build/src/runtime/http-engine/connections/TunnelConnection.d.ts +13 -0
- package/build/src/runtime/http-engine/connections/TunnelConnection.d.ts.map +1 -0
- package/build/src/runtime/http-engine/connections/TunnelConnection.js +175 -0
- package/build/src/runtime/http-engine/connections/TunnelConnection.js.map +1 -0
- package/build/src/runtime/http-engine/connections/index.d.ts +7 -0
- package/build/src/runtime/http-engine/connections/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/connections/index.js +7 -0
- package/build/src/runtime/http-engine/connections/index.js.map +1 -0
- package/build/src/runtime/http-engine/constants.d.ts +69 -0
- package/build/src/runtime/http-engine/constants.d.ts.map +1 -0
- package/build/src/runtime/http-engine/constants.js +90 -0
- package/build/src/runtime/http-engine/constants.js.map +1 -0
- package/build/src/runtime/http-engine/cookies/CookieProcessor.d.ts +5 -0
- package/build/src/runtime/http-engine/cookies/CookieProcessor.d.ts.map +1 -0
- package/build/src/runtime/http-engine/cookies/CookieProcessor.js +20 -0
- package/build/src/runtime/http-engine/cookies/CookieProcessor.js.map +1 -0
- package/build/src/runtime/http-engine/cookies/index.d.ts +2 -0
- package/build/src/runtime/http-engine/cookies/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/cookies/index.js +2 -0
- package/build/src/runtime/http-engine/cookies/index.js.map +1 -0
- package/build/src/runtime/http-engine/errors/HttpEngineErrors.d.ts +156 -0
- package/build/src/runtime/http-engine/errors/HttpEngineErrors.d.ts.map +1 -0
- package/build/src/runtime/http-engine/errors/HttpEngineErrors.js +227 -0
- package/build/src/runtime/http-engine/errors/HttpEngineErrors.js.map +1 -0
- package/build/src/runtime/http-engine/errors/index.d.ts +2 -0
- package/build/src/runtime/http-engine/errors/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/errors/index.js +2 -0
- package/build/src/runtime/http-engine/errors/index.js.map +1 -0
- package/build/src/runtime/http-engine/message/MessageBuilder.d.ts +66 -0
- package/build/src/runtime/http-engine/message/MessageBuilder.d.ts.map +1 -0
- package/build/src/runtime/http-engine/message/MessageBuilder.js +161 -0
- package/build/src/runtime/http-engine/message/MessageBuilder.js.map +1 -0
- package/build/src/runtime/http-engine/message/MessageProcessor.d.ts +27 -0
- package/build/src/runtime/http-engine/message/MessageProcessor.d.ts.map +1 -0
- package/build/src/runtime/http-engine/message/MessageProcessor.js +51 -0
- package/build/src/runtime/http-engine/message/MessageProcessor.js.map +1 -0
- package/build/src/runtime/http-engine/message/index.d.ts +3 -0
- package/build/src/runtime/http-engine/message/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/message/index.js +3 -0
- package/build/src/runtime/http-engine/message/index.js.map +1 -0
- package/build/src/runtime/http-engine/ntlm/NtlmAuth.d.ts +2 -8
- package/build/src/runtime/http-engine/ntlm/NtlmAuth.d.ts.map +1 -1
- package/build/src/runtime/http-engine/ntlm/NtlmAuth.js +11 -5
- package/build/src/runtime/http-engine/ntlm/NtlmAuth.js.map +1 -1
- package/build/src/runtime/http-engine/ntlm/NtlmMessage.js +6 -6
- package/build/src/runtime/http-engine/ntlm/NtlmMessage.js.map +1 -1
- package/build/src/runtime/http-engine/parsers/BodyParser.d.ts +39 -0
- package/build/src/runtime/http-engine/parsers/BodyParser.d.ts.map +1 -0
- package/build/src/runtime/http-engine/parsers/BodyParser.js +145 -0
- package/build/src/runtime/http-engine/parsers/BodyParser.js.map +1 -0
- package/build/src/runtime/http-engine/parsers/HeadersParser.d.ts +29 -0
- package/build/src/runtime/http-engine/parsers/HeadersParser.d.ts.map +1 -0
- package/build/src/runtime/http-engine/parsers/HeadersParser.js +88 -0
- package/build/src/runtime/http-engine/parsers/HeadersParser.js.map +1 -0
- package/build/src/runtime/http-engine/parsers/HttpResponseParser.d.ts +91 -0
- package/build/src/runtime/http-engine/parsers/HttpResponseParser.d.ts.map +1 -0
- package/build/src/runtime/http-engine/parsers/HttpResponseParser.js +236 -0
- package/build/src/runtime/http-engine/parsers/HttpResponseParser.js.map +1 -0
- package/build/src/runtime/http-engine/parsers/StatusParser.d.ts +20 -0
- package/build/src/runtime/http-engine/parsers/StatusParser.d.ts.map +1 -0
- package/build/src/runtime/http-engine/parsers/StatusParser.js +51 -0
- package/build/src/runtime/http-engine/parsers/StatusParser.js.map +1 -0
- package/build/src/runtime/http-engine/parsers/index.d.ts +5 -0
- package/build/src/runtime/http-engine/parsers/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/parsers/index.js +5 -0
- package/build/src/runtime/http-engine/parsers/index.js.map +1 -0
- package/build/src/runtime/http-engine/response/ResponseProcessor.d.ts +22 -0
- package/build/src/runtime/http-engine/response/ResponseProcessor.d.ts.map +1 -0
- package/build/src/runtime/http-engine/response/ResponseProcessor.js +25 -0
- package/build/src/runtime/http-engine/response/ResponseProcessor.js.map +1 -0
- package/build/src/runtime/http-engine/response/index.d.ts +2 -0
- package/build/src/runtime/http-engine/response/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/response/index.js +2 -0
- package/build/src/runtime/http-engine/response/index.js.map +1 -0
- package/build/src/runtime/http-engine/statistics/StatisticsProcessor.d.ts +7 -0
- package/build/src/runtime/http-engine/statistics/StatisticsProcessor.d.ts.map +1 -0
- package/build/src/runtime/http-engine/statistics/StatisticsProcessor.js +40 -0
- package/build/src/runtime/http-engine/statistics/StatisticsProcessor.js.map +1 -0
- package/build/src/runtime/http-engine/statistics/index.d.ts +2 -0
- package/build/src/runtime/http-engine/statistics/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/statistics/index.js +2 -0
- package/build/src/runtime/http-engine/statistics/index.js.map +1 -0
- package/build/src/runtime/http-engine/url/UrlProcessor.d.ts +24 -0
- package/build/src/runtime/http-engine/url/UrlProcessor.d.ts.map +1 -0
- package/build/src/runtime/http-engine/url/UrlProcessor.js +50 -0
- package/build/src/runtime/http-engine/url/UrlProcessor.js.map +1 -0
- package/build/src/runtime/http-engine/url/index.d.ts +2 -0
- package/build/src/runtime/http-engine/url/index.d.ts.map +1 -0
- package/build/src/runtime/http-engine/url/index.js +2 -0
- package/build/src/runtime/http-engine/url/index.js.map +1 -0
- package/build/src/runtime/http-runner/HttpRequestRunner.d.ts +3 -3
- package/build/src/runtime/http-runner/HttpRequestRunner.d.ts.map +1 -1
- package/build/src/runtime/http-runner/HttpRequestRunner.js.map +1 -1
- package/build/src/runtime/node/InteropInterfaces.d.ts +3 -3
- package/build/src/runtime/node/InteropInterfaces.d.ts.map +1 -1
- package/build/src/runtime/node/InteropInterfaces.js.map +1 -1
- package/build/src/runtime/node/ProjectRequestRunner.d.ts +2 -2
- package/build/src/runtime/node/ProjectRequestRunner.d.ts.map +1 -1
- package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
- package/build/src/runtime/node/ProjectRunner.d.ts.map +1 -1
- package/build/src/runtime/node/ProjectRunner.js +2 -2
- package/build/src/runtime/node/ProjectRunner.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/lib/logging/DefaultLogger.ts +32 -0
- package/src/modeling/DomainValidation.ts +78 -0
- package/src/modeling/validation/entity_validation.ts +59 -10
- package/src/models/ClientCertificate.ts +1 -1
- package/src/models/RequestConfig.ts +1 -1
- package/src/models/SerializableError.ts +1 -1
- package/src/proxy/RequestProxy.ts +2 -2
- package/src/runtime/http-engine/CoreEngine.ts +858 -893
- package/src/runtime/http-engine/PayloadSupport.ts +2 -1
- package/src/runtime/http-engine/auth/AuthManager.ts +242 -0
- package/src/runtime/http-engine/certificates/CertificateManager.ts +74 -0
- package/src/runtime/http-engine/compression/CompressionManager.ts +99 -0
- package/src/runtime/http-engine/connections/ConnectionManager.ts +123 -0
- package/src/runtime/http-engine/connections/DigestAuthHandler.ts +238 -0
- package/src/runtime/http-engine/connections/DirectConnection.ts +134 -0
- package/src/runtime/http-engine/connections/ProxyAuthHandler.ts +179 -0
- package/src/runtime/http-engine/connections/ProxyConnection.ts +55 -0
- package/src/runtime/http-engine/connections/TunnelConnection.ts +192 -0
- package/src/runtime/http-engine/constants.ts +103 -0
- package/src/runtime/http-engine/cookies/CookieProcessor.ts +25 -0
- package/src/runtime/http-engine/errors/HttpEngineErrors.ts +319 -0
- package/src/runtime/http-engine/message/MessageBuilder.ts +201 -0
- package/src/runtime/http-engine/message/MessageProcessor.ts +73 -0
- package/src/runtime/http-engine/ntlm/NtlmAuth.ts +16 -13
- package/src/runtime/http-engine/ntlm/NtlmMessage.ts +6 -6
- package/src/runtime/http-engine/parsers/BodyParser.ts +171 -0
- package/src/runtime/http-engine/parsers/HeadersParser.ts +103 -0
- package/src/runtime/http-engine/parsers/HttpResponseParser.ts +280 -0
- package/src/runtime/http-engine/parsers/StatusParser.ts +69 -0
- package/src/runtime/http-engine/response/ResponseProcessor.ts +46 -0
- package/src/runtime/http-engine/statistics/StatisticsProcessor.ts +52 -0
- package/src/runtime/http-engine/url/UrlProcessor.ts +55 -0
- package/src/runtime/http-runner/HttpRequestRunner.ts +3 -3
- package/src/runtime/node/InteropInterfaces.ts +3 -3
- package/src/runtime/node/ProjectRequestRunner.ts +2 -2
- package/src/runtime/node/ProjectRunner.ts +2 -2
- package/tests/servers/ProxyServer.ts +32 -19
- package/tests/servers/express-routes/ApiEndpoint.ts +24 -0
- package/tests/servers/express-routes/BasicAuthRoute.ts +36 -0
- package/tests/servers/express-routes/BearerAuthRoute.ts +35 -0
- package/tests/servers/express-routes/NTLMRoute.ts +2 -3
- package/tests/servers/express-routes/PostApi.ts +15 -2
- package/tests/servers/express-routes/RedirectsApi.ts +12 -1
- package/tests/servers/express-routes/ResponsesApi.ts +1 -1
- package/tests/servers/express-routes/StreamApi.ts +19 -0
- package/tests/servers/oauth2mock/ServerMock.js +1 -1
- package/tests/unit/modeling/validation/entity_validation.spec.ts +95 -0
- package/tests/unit/runtime/http-engine/HttpResponseParser.spec.ts +337 -0
- package/tests/unit/runtime/http-engine/abort.spec.ts +4 -5
- package/tests/unit/runtime/http-engine/auth.spec.ts +7 -58
- package/tests/unit/runtime/http-engine/certificates/CertificateManager.spec.ts +482 -0
- package/tests/unit/runtime/http-engine/certificates.spec.ts +2 -2
- package/tests/unit/runtime/http-engine/compression/CompressionManager.spec.ts +498 -0
- package/tests/unit/runtime/http-engine/compression.spec.ts +3 -72
- package/tests/unit/runtime/http-engine/connections/ConnectionManager.spec.ts +379 -0
- package/tests/unit/runtime/http-engine/connections/DigestAuthHandler.spec.ts +164 -0
- package/tests/unit/runtime/http-engine/core_engine.spec.ts +561 -0
- package/tests/unit/runtime/http-engine/engine_statuses.spec.ts +2 -2
- package/tests/unit/runtime/http-engine/events.spec.ts +2 -2
- package/tests/unit/runtime/http-engine/headers.spec.ts +2 -88
- package/tests/unit/runtime/http-engine/hosts.spec.ts +2 -2
- package/tests/unit/runtime/http-engine/http-get.spec.ts +2 -2
- package/tests/unit/runtime/http-engine/http-post.spec.ts +2 -2
- package/tests/unit/runtime/http-engine/logger.spec.ts +0 -8
- package/tests/unit/runtime/http-engine/message.spec.ts +2 -194
- package/tests/unit/runtime/http-engine/params.spec.ts +4 -4
- package/tests/unit/runtime/http-engine/proxy.spec.ts +15 -14
- package/tests/unit/runtime/http-engine/redirects.spec.ts +2 -2
- package/tests/unit/runtime/http-engine/responses.spec.ts +170 -277
- package/tests/unit/runtime/http-engine/timeout.spec.ts +3 -3
- package/tests/unit/runtime/http-engine/timings.spec.ts +2 -2
- package/tests/unit/runtime/proxy/HttpProjectProxy.spec.ts +25 -28
- package/tests/unit/runtime/runners/project_runner.spec.ts +2 -2
- package/tests/unit/runtime/runners/request_runner.spec.ts +2 -2
- package/build/src/runtime/http-engine/HttpEngine.d.ts +0 -311
- package/build/src/runtime/http-engine/HttpEngine.d.ts.map +0 -1
- package/build/src/runtime/http-engine/HttpEngine.js +0 -802
- package/build/src/runtime/http-engine/HttpEngine.js.map +0 -1
- package/src/runtime/http-engine/HttpEngine.ts +0 -952
- package/tests/unit/runtime/http-engine/connecting.spec.ts +0 -140
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@api-client/core",
|
|
3
3
|
"description": "The API Client's core client library. Works in NodeJS and in a ES enabled browser.",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.14",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./browser.js": {
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
"dompurify": "^3.2.6",
|
|
98
98
|
"jsdom": "^26.1.0",
|
|
99
99
|
"nanoid": "^5.1.5",
|
|
100
|
+
"tslog": "^4.9.3",
|
|
100
101
|
"ws": "^8.12.0",
|
|
101
102
|
"xpath": "^0.0.34"
|
|
102
103
|
},
|
|
@@ -136,7 +137,6 @@
|
|
|
136
137
|
"globals": "^16.0.0",
|
|
137
138
|
"husky": "^9.0.11",
|
|
138
139
|
"lint-staged": "^16.0.0",
|
|
139
|
-
"nock": "^14.0.1",
|
|
140
140
|
"oauth2-mock-server": "^8.0.0",
|
|
141
141
|
"prettier": "^3.5.1",
|
|
142
142
|
"schema-org-json-schemas": "^2.1.4",
|
|
@@ -1,20 +1,52 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { Logger } from './Logger.js'
|
|
3
3
|
|
|
4
|
+
export enum LogLevel {
|
|
5
|
+
Silly,
|
|
6
|
+
Debug,
|
|
7
|
+
Verbose,
|
|
8
|
+
Info,
|
|
9
|
+
Warn,
|
|
10
|
+
Error,
|
|
11
|
+
Silent,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface LoggerConfig {
|
|
15
|
+
level?: LogLevel
|
|
16
|
+
}
|
|
17
|
+
|
|
4
18
|
export class DefaultLogger extends Logger {
|
|
19
|
+
level: LogLevel = LogLevel.Info
|
|
20
|
+
|
|
21
|
+
constructor(config: LoggerConfig = {}) {
|
|
22
|
+
super()
|
|
23
|
+
if (typeof config.level !== 'undefined') {
|
|
24
|
+
this.level = config.level
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
5
28
|
warn(...args: unknown[]): void {
|
|
29
|
+
if (this.level > LogLevel.Warn) return
|
|
6
30
|
console.warn(...args)
|
|
7
31
|
}
|
|
32
|
+
|
|
8
33
|
info(...args: unknown[]): void {
|
|
34
|
+
if (this.level > LogLevel.Info) return
|
|
9
35
|
console.info(...args)
|
|
10
36
|
}
|
|
37
|
+
|
|
11
38
|
error(...args: unknown[]): void {
|
|
39
|
+
if (this.level > LogLevel.Error) return
|
|
12
40
|
console.error(...args)
|
|
13
41
|
}
|
|
42
|
+
|
|
14
43
|
log(...args: unknown[]): void {
|
|
44
|
+
if (this.level > LogLevel.Debug) return
|
|
15
45
|
console.log(...args)
|
|
16
46
|
}
|
|
47
|
+
|
|
17
48
|
debug(...args: unknown[]): void {
|
|
49
|
+
if (this.level > LogLevel.Debug) return
|
|
18
50
|
console.debug(...args)
|
|
19
51
|
}
|
|
20
52
|
}
|
|
@@ -6,6 +6,75 @@ import { EntityValidation } from './validation/entity_validation.js'
|
|
|
6
6
|
import { PropertyValidation } from './validation/property_validation.js'
|
|
7
7
|
import { SemanticValidation } from './validation/semantic_validation.js'
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* DomainValidation performs comprehensive validation on a data domain and its components.
|
|
11
|
+
*
|
|
12
|
+
* This class orchestrates validation across all domain elements including entities, properties,
|
|
13
|
+
* associations, and semantics. It ensures that the data domain is well-formed and follows
|
|
14
|
+
* established conventions before it can be published or used in API generation.
|
|
15
|
+
*
|
|
16
|
+
* ## Validation Scope
|
|
17
|
+
*
|
|
18
|
+
* The validation process covers:
|
|
19
|
+
* - **Entities**: Structure, naming, primary keys, and inheritance
|
|
20
|
+
* - **Properties**: Naming conventions, data types, and constraints
|
|
21
|
+
* - **Associations**: Relationships, targets, and naming
|
|
22
|
+
* - **Semantics**: Recommended patterns and best practices
|
|
23
|
+
*
|
|
24
|
+
* ## Validation Severity Levels
|
|
25
|
+
*
|
|
26
|
+
* - **Error**: Blocking issues that prevent domain publication
|
|
27
|
+
* - **Warning**: Issues that may cause problems but don't block publication
|
|
28
|
+
* - **Info**: Recommendations for best practices
|
|
29
|
+
*
|
|
30
|
+
* ## Usage
|
|
31
|
+
*
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const domain = new DataDomain()
|
|
34
|
+
* // ... add entities, properties, associations
|
|
35
|
+
*
|
|
36
|
+
* const validator = new DomainValidation(domain)
|
|
37
|
+
* const report = validator.validate()
|
|
38
|
+
*
|
|
39
|
+
* if (report.canProceed) {
|
|
40
|
+
* // Domain is valid and can be published
|
|
41
|
+
* } else {
|
|
42
|
+
* // Handle validation errors
|
|
43
|
+
* console.log(report.impact)
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* ## Validation Rules
|
|
48
|
+
*
|
|
49
|
+
* ### Entity Validation Rules
|
|
50
|
+
* - **Primary Key**: Each entity must have a primary key (can be inherited)
|
|
51
|
+
* - **Minimum Properties**: Entities should have properties or associations (can be inherited)
|
|
52
|
+
* - **Naming**: Entity names must follow PostgreSQL naming conventions
|
|
53
|
+
* - **Uniqueness**: Entity names must be unique within the domain
|
|
54
|
+
*
|
|
55
|
+
* ### Property Validation Rules
|
|
56
|
+
* - **Naming**: Properties must follow PostgreSQL column naming conventions
|
|
57
|
+
* - **Length**: Names must be 2-59 characters long
|
|
58
|
+
* - **Format**: Names must start with letter/underscore, contain only alphanumeric/underscore
|
|
59
|
+
* - **Reserved Words**: Names cannot be PostgreSQL reserved keywords
|
|
60
|
+
* - **Case**: Snake case is recommended (lowercase with underscores)
|
|
61
|
+
*
|
|
62
|
+
* ### Association Validation Rules
|
|
63
|
+
* - **Targets**: Associations must have at least one target entity
|
|
64
|
+
* - **Target Existence**: Target entities must exist in the domain
|
|
65
|
+
* - **Naming**: Same rules as properties
|
|
66
|
+
*
|
|
67
|
+
* ### Semantic Validation Rules
|
|
68
|
+
* - **User Entity**: Recommended to have at least one entity with User semantic
|
|
69
|
+
* - **Timestamps**: Recommended to have CreatedTimestamp and UpdatedTimestamp properties
|
|
70
|
+
* - **Soft Delete**: Recommended to have soft delete capability for entities
|
|
71
|
+
* - **Data Types**: Semantic-specific data type validation
|
|
72
|
+
*
|
|
73
|
+
* @see {@link EntityValidation} for detailed entity validation rules
|
|
74
|
+
* @see {@link PropertyValidation} for detailed property validation rules
|
|
75
|
+
* @see {@link AssociationValidation} for detailed association validation rules
|
|
76
|
+
* @see {@link SemanticValidation} for detailed semantic validation rules
|
|
77
|
+
*/
|
|
9
78
|
export class DomainValidation {
|
|
10
79
|
private root: DataDomain
|
|
11
80
|
|
|
@@ -13,6 +82,15 @@ export class DomainValidation {
|
|
|
13
82
|
this.root = root
|
|
14
83
|
}
|
|
15
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Performs comprehensive validation on the entire data domain.
|
|
87
|
+
*
|
|
88
|
+
* This method validates all entities, properties, associations, and semantics
|
|
89
|
+
* in the domain. It returns a detailed report of all validation issues found,
|
|
90
|
+
* categorized by severity level.
|
|
91
|
+
*
|
|
92
|
+
* @returns A comprehensive validation report with all issues found
|
|
93
|
+
*/
|
|
16
94
|
validate(): DomainImpactReport {
|
|
17
95
|
const result: DomainImpactReport = {
|
|
18
96
|
key: '',
|
|
@@ -17,7 +17,8 @@ export class EntityValidation {
|
|
|
17
17
|
/**
|
|
18
18
|
* Performs all the validation rules on the entity.
|
|
19
19
|
* If you are interested in a specific rule, use the specific method.
|
|
20
|
-
* @param target The target entity to validate. Can be a string with
|
|
20
|
+
* @param target The target entity to validate. Can be a string with
|
|
21
|
+
* the entity key or a DomainEntity object.
|
|
21
22
|
*/
|
|
22
23
|
validate(target: string | DomainEntity): DomainValidation[] {
|
|
23
24
|
const results: DomainValidation[] = []
|
|
@@ -41,21 +42,20 @@ export class EntityValidation {
|
|
|
41
42
|
})
|
|
42
43
|
return results
|
|
43
44
|
}
|
|
44
|
-
const
|
|
45
|
-
results.push(...
|
|
46
|
-
const
|
|
47
|
-
results.push(...
|
|
45
|
+
const primaryKey = this.validatePrimaryKey(entity)
|
|
46
|
+
results.push(...primaryKey)
|
|
47
|
+
const minimumProperties = this.minimumRequiredProperties(entity)
|
|
48
|
+
results.push(...minimumProperties)
|
|
48
49
|
const name = this.validateName(entity)
|
|
49
50
|
results.push(...name)
|
|
50
|
-
const
|
|
51
|
-
results.push(...
|
|
51
|
+
const unique = this.uniqueName(entity)
|
|
52
|
+
results.push(...unique)
|
|
52
53
|
return results
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
|
-
* Validates the entity
|
|
57
|
+
* Validates the entity primary key.
|
|
57
58
|
* @param entity The entity to validate
|
|
58
|
-
* @returns The list of validation messages.
|
|
59
59
|
*/
|
|
60
60
|
validatePrimaryKey(entity: DomainEntity): DomainValidation[] {
|
|
61
61
|
const results: DomainValidation[] = []
|
|
@@ -76,13 +76,62 @@ export class EntityValidation {
|
|
|
76
76
|
return results
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Checks if an entity has properties through its entire inheritance chain.
|
|
81
|
+
* This includes direct properties and properties inherited from any level of parent entities.
|
|
82
|
+
* @param entity The entity to check
|
|
83
|
+
* @returns True if the entity has properties either directly or through inheritance
|
|
84
|
+
*/
|
|
85
|
+
private hasPropertiesInherited(entity: DomainEntity): boolean {
|
|
86
|
+
// Check direct properties first
|
|
87
|
+
if (entity.hasProperties()) {
|
|
88
|
+
return true
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Check all parents recursively
|
|
92
|
+
for (const parent of entity.listParents()) {
|
|
93
|
+
if (this.hasPropertiesInherited(parent)) {
|
|
94
|
+
return true
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return false
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Checks if an entity has associations through its entire inheritance chain.
|
|
103
|
+
* This includes direct associations and associations inherited from any level of parent entities.
|
|
104
|
+
* @param entity The entity to check
|
|
105
|
+
* @returns True if the entity has associations either directly or through inheritance
|
|
106
|
+
*/
|
|
107
|
+
private hasAssociationsInherited(entity: DomainEntity): boolean {
|
|
108
|
+
// Check direct associations first
|
|
109
|
+
if (entity.hasAssociations()) {
|
|
110
|
+
return true
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Check all parents recursively
|
|
114
|
+
for (const parent of entity.listParents()) {
|
|
115
|
+
if (this.hasAssociationsInherited(parent)) {
|
|
116
|
+
return true
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return false
|
|
121
|
+
}
|
|
122
|
+
|
|
79
123
|
/**
|
|
80
124
|
* Checks if the entity has the minimum required properties.
|
|
81
125
|
* @param entity The entity to validate
|
|
82
126
|
*/
|
|
83
127
|
minimumRequiredProperties(entity: DomainEntity): DomainValidation[] {
|
|
84
128
|
const results: DomainValidation[] = []
|
|
85
|
-
|
|
129
|
+
|
|
130
|
+
// Check if entity has properties or associations through entire inheritance chain
|
|
131
|
+
const hasProperties = this.hasPropertiesInherited(entity)
|
|
132
|
+
const hasAssociations = this.hasAssociationsInherited(entity)
|
|
133
|
+
|
|
134
|
+
if (!hasProperties && !hasAssociations) {
|
|
86
135
|
const message = `The "${entity.info.getLabel()}" entity has no properties. It will be ignored.`
|
|
87
136
|
const help = `Entities that have no properties are ignored in the data domain. No schema will be generated for it.`
|
|
88
137
|
results.push({
|
|
@@ -23,7 +23,7 @@ export class SerializableError {
|
|
|
23
23
|
return this.stackValue
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
readonly name = 'SerializableError'
|
|
26
|
+
readonly name: string = 'SerializableError'
|
|
27
27
|
|
|
28
28
|
constructor(message?: string | Error, options: IErrorOptions | number | string = {}) {
|
|
29
29
|
if (typeof message === 'string') {
|
|
@@ -3,12 +3,12 @@ import { IRequestAuthorization } from '../models/RequestAuthorization.js'
|
|
|
3
3
|
import { IRequestConfig } from '../models/RequestConfig.js'
|
|
4
4
|
import Proxy, { IProxyResult } from './Proxy.js'
|
|
5
5
|
import { HttpCertificate } from '../models/ClientCertificate.js'
|
|
6
|
-
import { DummyLogger } from '../lib/logging/DummyLogger.js'
|
|
7
6
|
import { HttpRequestRunner } from '../runtime/http-runner/HttpRequestRunner.js'
|
|
8
7
|
import { IRequestLog } from '../models/RequestLog.js'
|
|
9
8
|
import { IHttpFlow } from '../models/http-flows/HttpFlows.js'
|
|
10
9
|
import { IHttpAssertion } from '../models/http-flows/HttpAssertion.js'
|
|
11
10
|
import { Exception } from '../exceptions/exception.js'
|
|
11
|
+
import { createLogger } from '../lib/logging/index.js'
|
|
12
12
|
|
|
13
13
|
export interface IRequestProxyInit {
|
|
14
14
|
kind: typeof HttpRequestKind
|
|
@@ -78,7 +78,7 @@ export default class RequestProxy extends Proxy {
|
|
|
78
78
|
const { request, authorization, certificate, config = {}, variables = {}, flows, assertions } = data
|
|
79
79
|
const factory = new HttpRequestRunner()
|
|
80
80
|
factory.variables = variables
|
|
81
|
-
factory.logger =
|
|
81
|
+
factory.logger = createLogger()
|
|
82
82
|
factory.config = { ...config, enabled: true } as IRequestConfig
|
|
83
83
|
if (Array.isArray(authorization) && authorization.length) {
|
|
84
84
|
factory.authorization = authorization
|