@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.
Files changed (269) hide show
  1. package/build/src/browser.d.ts +0 -3
  2. package/build/src/browser.d.ts.map +1 -1
  3. package/build/src/browser.js +0 -3
  4. package/build/src/browser.js.map +1 -1
  5. package/build/src/index.d.ts +2 -5
  6. package/build/src/index.d.ts.map +1 -1
  7. package/build/src/index.js +2 -5
  8. package/build/src/index.js.map +1 -1
  9. package/build/src/lib/logging/DefaultLogger.d.ts +14 -0
  10. package/build/src/lib/logging/DefaultLogger.d.ts.map +1 -1
  11. package/build/src/lib/logging/DefaultLogger.js +27 -0
  12. package/build/src/lib/logging/DefaultLogger.js.map +1 -1
  13. package/build/src/lib/logging/index.d.ts +4 -0
  14. package/build/src/lib/logging/index.d.ts.map +1 -0
  15. package/build/src/lib/logging/index.js +10 -0
  16. package/build/src/lib/logging/index.js.map +1 -0
  17. package/build/src/modeling/DomainValidation.d.ts +78 -0
  18. package/build/src/modeling/DomainValidation.d.ts.map +1 -1
  19. package/build/src/modeling/DomainValidation.js +78 -0
  20. package/build/src/modeling/DomainValidation.js.map +1 -1
  21. package/build/src/modeling/validation/entity_validation.d.ts +17 -3
  22. package/build/src/modeling/validation/entity_validation.d.ts.map +1 -1
  23. package/build/src/modeling/validation/entity_validation.js +51 -10
  24. package/build/src/modeling/validation/entity_validation.js.map +1 -1
  25. package/build/src/models/ClientCertificate.d.ts +1 -1
  26. package/build/src/models/ClientCertificate.js.map +1 -1
  27. package/build/src/models/RequestConfig.d.ts +1 -1
  28. package/build/src/models/RequestConfig.js.map +1 -1
  29. package/build/src/models/SerializableError.d.ts +1 -1
  30. package/build/src/models/SerializableError.d.ts.map +1 -1
  31. package/build/src/models/SerializableError.js.map +1 -1
  32. package/build/src/proxy/RequestProxy.d.ts.map +1 -1
  33. package/build/src/proxy/RequestProxy.js +2 -2
  34. package/build/src/proxy/RequestProxy.js.map +1 -1
  35. package/build/src/runtime/http-engine/CoreEngine.d.ts +218 -139
  36. package/build/src/runtime/http-engine/CoreEngine.d.ts.map +1 -1
  37. package/build/src/runtime/http-engine/CoreEngine.js +716 -870
  38. package/build/src/runtime/http-engine/CoreEngine.js.map +1 -1
  39. package/build/src/runtime/http-engine/PayloadSupport.d.ts.map +1 -1
  40. package/build/src/runtime/http-engine/PayloadSupport.js +2 -1
  41. package/build/src/runtime/http-engine/PayloadSupport.js.map +1 -1
  42. package/build/src/runtime/http-engine/auth/AuthManager.d.ts +73 -0
  43. package/build/src/runtime/http-engine/auth/AuthManager.d.ts.map +1 -0
  44. package/build/src/runtime/http-engine/auth/AuthManager.js +186 -0
  45. package/build/src/runtime/http-engine/auth/AuthManager.js.map +1 -0
  46. package/build/src/runtime/http-engine/auth/index.d.ts +2 -0
  47. package/build/src/runtime/http-engine/auth/index.d.ts.map +1 -0
  48. package/build/src/runtime/http-engine/auth/index.js +2 -0
  49. package/build/src/runtime/http-engine/auth/index.js.map +1 -0
  50. package/build/src/runtime/http-engine/certificates/CertificateManager.d.ts +11 -0
  51. package/build/src/runtime/http-engine/certificates/CertificateManager.d.ts.map +1 -0
  52. package/build/src/runtime/http-engine/certificates/CertificateManager.js +76 -0
  53. package/build/src/runtime/http-engine/certificates/CertificateManager.js.map +1 -0
  54. package/build/src/runtime/http-engine/certificates/index.d.ts +2 -0
  55. package/build/src/runtime/http-engine/certificates/index.d.ts.map +1 -0
  56. package/build/src/runtime/http-engine/certificates/index.js +2 -0
  57. package/build/src/runtime/http-engine/certificates/index.js.map +1 -0
  58. package/build/src/runtime/http-engine/compression/CompressionManager.d.ts +25 -0
  59. package/build/src/runtime/http-engine/compression/CompressionManager.d.ts.map +1 -0
  60. package/build/src/runtime/http-engine/compression/CompressionManager.js +89 -0
  61. package/build/src/runtime/http-engine/compression/CompressionManager.js.map +1 -0
  62. package/build/src/runtime/http-engine/compression/index.d.ts +2 -0
  63. package/build/src/runtime/http-engine/compression/index.d.ts.map +1 -0
  64. package/build/src/runtime/http-engine/compression/index.js +2 -0
  65. package/build/src/runtime/http-engine/compression/index.js.map +1 -0
  66. package/build/src/runtime/http-engine/connections/ConnectionManager.d.ts +57 -0
  67. package/build/src/runtime/http-engine/connections/ConnectionManager.d.ts.map +1 -0
  68. package/build/src/runtime/http-engine/connections/ConnectionManager.js +78 -0
  69. package/build/src/runtime/http-engine/connections/ConnectionManager.js.map +1 -0
  70. package/build/src/runtime/http-engine/connections/DigestAuthHandler.d.ts +70 -0
  71. package/build/src/runtime/http-engine/connections/DigestAuthHandler.d.ts.map +1 -0
  72. package/build/src/runtime/http-engine/connections/DigestAuthHandler.js +184 -0
  73. package/build/src/runtime/http-engine/connections/DigestAuthHandler.js.map +1 -0
  74. package/build/src/runtime/http-engine/connections/DirectConnection.d.ts +22 -0
  75. package/build/src/runtime/http-engine/connections/DirectConnection.d.ts.map +1 -0
  76. package/build/src/runtime/http-engine/connections/DirectConnection.js +105 -0
  77. package/build/src/runtime/http-engine/connections/DirectConnection.js.map +1 -0
  78. package/build/src/runtime/http-engine/connections/ProxyAuthHandler.d.ts +60 -0
  79. package/build/src/runtime/http-engine/connections/ProxyAuthHandler.d.ts.map +1 -0
  80. package/build/src/runtime/http-engine/connections/ProxyAuthHandler.js +138 -0
  81. package/build/src/runtime/http-engine/connections/ProxyAuthHandler.js.map +1 -0
  82. package/build/src/runtime/http-engine/connections/ProxyConnection.d.ts +14 -0
  83. package/build/src/runtime/http-engine/connections/ProxyConnection.d.ts.map +1 -0
  84. package/build/src/runtime/http-engine/connections/ProxyConnection.js +47 -0
  85. package/build/src/runtime/http-engine/connections/ProxyConnection.js.map +1 -0
  86. package/build/src/runtime/http-engine/connections/TunnelConnection.d.ts +13 -0
  87. package/build/src/runtime/http-engine/connections/TunnelConnection.d.ts.map +1 -0
  88. package/build/src/runtime/http-engine/connections/TunnelConnection.js +175 -0
  89. package/build/src/runtime/http-engine/connections/TunnelConnection.js.map +1 -0
  90. package/build/src/runtime/http-engine/connections/index.d.ts +7 -0
  91. package/build/src/runtime/http-engine/connections/index.d.ts.map +1 -0
  92. package/build/src/runtime/http-engine/connections/index.js +7 -0
  93. package/build/src/runtime/http-engine/connections/index.js.map +1 -0
  94. package/build/src/runtime/http-engine/constants.d.ts +69 -0
  95. package/build/src/runtime/http-engine/constants.d.ts.map +1 -0
  96. package/build/src/runtime/http-engine/constants.js +90 -0
  97. package/build/src/runtime/http-engine/constants.js.map +1 -0
  98. package/build/src/runtime/http-engine/cookies/CookieProcessor.d.ts +5 -0
  99. package/build/src/runtime/http-engine/cookies/CookieProcessor.d.ts.map +1 -0
  100. package/build/src/runtime/http-engine/cookies/CookieProcessor.js +20 -0
  101. package/build/src/runtime/http-engine/cookies/CookieProcessor.js.map +1 -0
  102. package/build/src/runtime/http-engine/cookies/index.d.ts +2 -0
  103. package/build/src/runtime/http-engine/cookies/index.d.ts.map +1 -0
  104. package/build/src/runtime/http-engine/cookies/index.js +2 -0
  105. package/build/src/runtime/http-engine/cookies/index.js.map +1 -0
  106. package/build/src/runtime/http-engine/errors/HttpEngineErrors.d.ts +156 -0
  107. package/build/src/runtime/http-engine/errors/HttpEngineErrors.d.ts.map +1 -0
  108. package/build/src/runtime/http-engine/errors/HttpEngineErrors.js +227 -0
  109. package/build/src/runtime/http-engine/errors/HttpEngineErrors.js.map +1 -0
  110. package/build/src/runtime/http-engine/errors/index.d.ts +2 -0
  111. package/build/src/runtime/http-engine/errors/index.d.ts.map +1 -0
  112. package/build/src/runtime/http-engine/errors/index.js +2 -0
  113. package/build/src/runtime/http-engine/errors/index.js.map +1 -0
  114. package/build/src/runtime/http-engine/message/MessageBuilder.d.ts +66 -0
  115. package/build/src/runtime/http-engine/message/MessageBuilder.d.ts.map +1 -0
  116. package/build/src/runtime/http-engine/message/MessageBuilder.js +161 -0
  117. package/build/src/runtime/http-engine/message/MessageBuilder.js.map +1 -0
  118. package/build/src/runtime/http-engine/message/MessageProcessor.d.ts +27 -0
  119. package/build/src/runtime/http-engine/message/MessageProcessor.d.ts.map +1 -0
  120. package/build/src/runtime/http-engine/message/MessageProcessor.js +51 -0
  121. package/build/src/runtime/http-engine/message/MessageProcessor.js.map +1 -0
  122. package/build/src/runtime/http-engine/message/index.d.ts +3 -0
  123. package/build/src/runtime/http-engine/message/index.d.ts.map +1 -0
  124. package/build/src/runtime/http-engine/message/index.js +3 -0
  125. package/build/src/runtime/http-engine/message/index.js.map +1 -0
  126. package/build/src/runtime/http-engine/ntlm/NtlmAuth.d.ts +2 -8
  127. package/build/src/runtime/http-engine/ntlm/NtlmAuth.d.ts.map +1 -1
  128. package/build/src/runtime/http-engine/ntlm/NtlmAuth.js +11 -5
  129. package/build/src/runtime/http-engine/ntlm/NtlmAuth.js.map +1 -1
  130. package/build/src/runtime/http-engine/ntlm/NtlmMessage.js +6 -6
  131. package/build/src/runtime/http-engine/ntlm/NtlmMessage.js.map +1 -1
  132. package/build/src/runtime/http-engine/parsers/BodyParser.d.ts +39 -0
  133. package/build/src/runtime/http-engine/parsers/BodyParser.d.ts.map +1 -0
  134. package/build/src/runtime/http-engine/parsers/BodyParser.js +145 -0
  135. package/build/src/runtime/http-engine/parsers/BodyParser.js.map +1 -0
  136. package/build/src/runtime/http-engine/parsers/HeadersParser.d.ts +29 -0
  137. package/build/src/runtime/http-engine/parsers/HeadersParser.d.ts.map +1 -0
  138. package/build/src/runtime/http-engine/parsers/HeadersParser.js +88 -0
  139. package/build/src/runtime/http-engine/parsers/HeadersParser.js.map +1 -0
  140. package/build/src/runtime/http-engine/parsers/HttpResponseParser.d.ts +91 -0
  141. package/build/src/runtime/http-engine/parsers/HttpResponseParser.d.ts.map +1 -0
  142. package/build/src/runtime/http-engine/parsers/HttpResponseParser.js +236 -0
  143. package/build/src/runtime/http-engine/parsers/HttpResponseParser.js.map +1 -0
  144. package/build/src/runtime/http-engine/parsers/StatusParser.d.ts +20 -0
  145. package/build/src/runtime/http-engine/parsers/StatusParser.d.ts.map +1 -0
  146. package/build/src/runtime/http-engine/parsers/StatusParser.js +51 -0
  147. package/build/src/runtime/http-engine/parsers/StatusParser.js.map +1 -0
  148. package/build/src/runtime/http-engine/parsers/index.d.ts +5 -0
  149. package/build/src/runtime/http-engine/parsers/index.d.ts.map +1 -0
  150. package/build/src/runtime/http-engine/parsers/index.js +5 -0
  151. package/build/src/runtime/http-engine/parsers/index.js.map +1 -0
  152. package/build/src/runtime/http-engine/response/ResponseProcessor.d.ts +22 -0
  153. package/build/src/runtime/http-engine/response/ResponseProcessor.d.ts.map +1 -0
  154. package/build/src/runtime/http-engine/response/ResponseProcessor.js +25 -0
  155. package/build/src/runtime/http-engine/response/ResponseProcessor.js.map +1 -0
  156. package/build/src/runtime/http-engine/response/index.d.ts +2 -0
  157. package/build/src/runtime/http-engine/response/index.d.ts.map +1 -0
  158. package/build/src/runtime/http-engine/response/index.js +2 -0
  159. package/build/src/runtime/http-engine/response/index.js.map +1 -0
  160. package/build/src/runtime/http-engine/statistics/StatisticsProcessor.d.ts +7 -0
  161. package/build/src/runtime/http-engine/statistics/StatisticsProcessor.d.ts.map +1 -0
  162. package/build/src/runtime/http-engine/statistics/StatisticsProcessor.js +40 -0
  163. package/build/src/runtime/http-engine/statistics/StatisticsProcessor.js.map +1 -0
  164. package/build/src/runtime/http-engine/statistics/index.d.ts +2 -0
  165. package/build/src/runtime/http-engine/statistics/index.d.ts.map +1 -0
  166. package/build/src/runtime/http-engine/statistics/index.js +2 -0
  167. package/build/src/runtime/http-engine/statistics/index.js.map +1 -0
  168. package/build/src/runtime/http-engine/url/UrlProcessor.d.ts +24 -0
  169. package/build/src/runtime/http-engine/url/UrlProcessor.d.ts.map +1 -0
  170. package/build/src/runtime/http-engine/url/UrlProcessor.js +50 -0
  171. package/build/src/runtime/http-engine/url/UrlProcessor.js.map +1 -0
  172. package/build/src/runtime/http-engine/url/index.d.ts +2 -0
  173. package/build/src/runtime/http-engine/url/index.d.ts.map +1 -0
  174. package/build/src/runtime/http-engine/url/index.js +2 -0
  175. package/build/src/runtime/http-engine/url/index.js.map +1 -0
  176. package/build/src/runtime/http-runner/HttpRequestRunner.d.ts +3 -3
  177. package/build/src/runtime/http-runner/HttpRequestRunner.d.ts.map +1 -1
  178. package/build/src/runtime/http-runner/HttpRequestRunner.js.map +1 -1
  179. package/build/src/runtime/node/InteropInterfaces.d.ts +3 -3
  180. package/build/src/runtime/node/InteropInterfaces.d.ts.map +1 -1
  181. package/build/src/runtime/node/InteropInterfaces.js.map +1 -1
  182. package/build/src/runtime/node/ProjectRequestRunner.d.ts +2 -2
  183. package/build/src/runtime/node/ProjectRequestRunner.d.ts.map +1 -1
  184. package/build/src/runtime/node/ProjectRequestRunner.js.map +1 -1
  185. package/build/src/runtime/node/ProjectRunner.d.ts.map +1 -1
  186. package/build/src/runtime/node/ProjectRunner.js +2 -2
  187. package/build/src/runtime/node/ProjectRunner.js.map +1 -1
  188. package/build/tsconfig.tsbuildinfo +1 -1
  189. package/package.json +2 -2
  190. package/src/lib/logging/DefaultLogger.ts +32 -0
  191. package/src/modeling/DomainValidation.ts +78 -0
  192. package/src/modeling/validation/entity_validation.ts +59 -10
  193. package/src/models/ClientCertificate.ts +1 -1
  194. package/src/models/RequestConfig.ts +1 -1
  195. package/src/models/SerializableError.ts +1 -1
  196. package/src/proxy/RequestProxy.ts +2 -2
  197. package/src/runtime/http-engine/CoreEngine.ts +858 -893
  198. package/src/runtime/http-engine/PayloadSupport.ts +2 -1
  199. package/src/runtime/http-engine/auth/AuthManager.ts +242 -0
  200. package/src/runtime/http-engine/certificates/CertificateManager.ts +74 -0
  201. package/src/runtime/http-engine/compression/CompressionManager.ts +99 -0
  202. package/src/runtime/http-engine/connections/ConnectionManager.ts +123 -0
  203. package/src/runtime/http-engine/connections/DigestAuthHandler.ts +238 -0
  204. package/src/runtime/http-engine/connections/DirectConnection.ts +134 -0
  205. package/src/runtime/http-engine/connections/ProxyAuthHandler.ts +179 -0
  206. package/src/runtime/http-engine/connections/ProxyConnection.ts +55 -0
  207. package/src/runtime/http-engine/connections/TunnelConnection.ts +192 -0
  208. package/src/runtime/http-engine/constants.ts +103 -0
  209. package/src/runtime/http-engine/cookies/CookieProcessor.ts +25 -0
  210. package/src/runtime/http-engine/errors/HttpEngineErrors.ts +319 -0
  211. package/src/runtime/http-engine/message/MessageBuilder.ts +201 -0
  212. package/src/runtime/http-engine/message/MessageProcessor.ts +73 -0
  213. package/src/runtime/http-engine/ntlm/NtlmAuth.ts +16 -13
  214. package/src/runtime/http-engine/ntlm/NtlmMessage.ts +6 -6
  215. package/src/runtime/http-engine/parsers/BodyParser.ts +171 -0
  216. package/src/runtime/http-engine/parsers/HeadersParser.ts +103 -0
  217. package/src/runtime/http-engine/parsers/HttpResponseParser.ts +280 -0
  218. package/src/runtime/http-engine/parsers/StatusParser.ts +69 -0
  219. package/src/runtime/http-engine/response/ResponseProcessor.ts +46 -0
  220. package/src/runtime/http-engine/statistics/StatisticsProcessor.ts +52 -0
  221. package/src/runtime/http-engine/url/UrlProcessor.ts +55 -0
  222. package/src/runtime/http-runner/HttpRequestRunner.ts +3 -3
  223. package/src/runtime/node/InteropInterfaces.ts +3 -3
  224. package/src/runtime/node/ProjectRequestRunner.ts +2 -2
  225. package/src/runtime/node/ProjectRunner.ts +2 -2
  226. package/tests/servers/ProxyServer.ts +32 -19
  227. package/tests/servers/express-routes/ApiEndpoint.ts +24 -0
  228. package/tests/servers/express-routes/BasicAuthRoute.ts +36 -0
  229. package/tests/servers/express-routes/BearerAuthRoute.ts +35 -0
  230. package/tests/servers/express-routes/NTLMRoute.ts +2 -3
  231. package/tests/servers/express-routes/PostApi.ts +15 -2
  232. package/tests/servers/express-routes/RedirectsApi.ts +12 -1
  233. package/tests/servers/express-routes/ResponsesApi.ts +1 -1
  234. package/tests/servers/express-routes/StreamApi.ts +19 -0
  235. package/tests/servers/oauth2mock/ServerMock.js +1 -1
  236. package/tests/unit/modeling/validation/entity_validation.spec.ts +95 -0
  237. package/tests/unit/runtime/http-engine/HttpResponseParser.spec.ts +337 -0
  238. package/tests/unit/runtime/http-engine/abort.spec.ts +4 -5
  239. package/tests/unit/runtime/http-engine/auth.spec.ts +7 -58
  240. package/tests/unit/runtime/http-engine/certificates/CertificateManager.spec.ts +482 -0
  241. package/tests/unit/runtime/http-engine/certificates.spec.ts +2 -2
  242. package/tests/unit/runtime/http-engine/compression/CompressionManager.spec.ts +498 -0
  243. package/tests/unit/runtime/http-engine/compression.spec.ts +3 -72
  244. package/tests/unit/runtime/http-engine/connections/ConnectionManager.spec.ts +379 -0
  245. package/tests/unit/runtime/http-engine/connections/DigestAuthHandler.spec.ts +164 -0
  246. package/tests/unit/runtime/http-engine/core_engine.spec.ts +561 -0
  247. package/tests/unit/runtime/http-engine/engine_statuses.spec.ts +2 -2
  248. package/tests/unit/runtime/http-engine/events.spec.ts +2 -2
  249. package/tests/unit/runtime/http-engine/headers.spec.ts +2 -88
  250. package/tests/unit/runtime/http-engine/hosts.spec.ts +2 -2
  251. package/tests/unit/runtime/http-engine/http-get.spec.ts +2 -2
  252. package/tests/unit/runtime/http-engine/http-post.spec.ts +2 -2
  253. package/tests/unit/runtime/http-engine/logger.spec.ts +0 -8
  254. package/tests/unit/runtime/http-engine/message.spec.ts +2 -194
  255. package/tests/unit/runtime/http-engine/params.spec.ts +4 -4
  256. package/tests/unit/runtime/http-engine/proxy.spec.ts +15 -14
  257. package/tests/unit/runtime/http-engine/redirects.spec.ts +2 -2
  258. package/tests/unit/runtime/http-engine/responses.spec.ts +170 -277
  259. package/tests/unit/runtime/http-engine/timeout.spec.ts +3 -3
  260. package/tests/unit/runtime/http-engine/timings.spec.ts +2 -2
  261. package/tests/unit/runtime/proxy/HttpProjectProxy.spec.ts +25 -28
  262. package/tests/unit/runtime/runners/project_runner.spec.ts +2 -2
  263. package/tests/unit/runtime/runners/request_runner.spec.ts +2 -2
  264. package/build/src/runtime/http-engine/HttpEngine.d.ts +0 -311
  265. package/build/src/runtime/http-engine/HttpEngine.d.ts.map +0 -1
  266. package/build/src/runtime/http-engine/HttpEngine.js +0 -802
  267. package/build/src/runtime/http-engine/HttpEngine.js.map +0 -1
  268. package/src/runtime/http-engine/HttpEngine.ts +0 -952
  269. 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.12",
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 the entity key or a DomainEntity object.
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 primary = this.validatePrimaryKey(entity)
45
- results.push(...primary)
46
- const minimum = this.minimumRequiredProperties(entity)
47
- results.push(...minimum)
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 uniqueName = this.uniqueName(entity)
51
- results.push(...uniqueName)
51
+ const unique = this.uniqueName(entity)
52
+ results.push(...unique)
52
53
  return results
53
54
  }
54
55
 
55
56
  /**
56
- * Validates the entity against the primary key validation rules.
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
- if (!entity.hasProperties() && !entity.hasAssociations()) {
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({
@@ -37,7 +37,7 @@ export interface ICertificateData {
37
37
  export interface ICertificate {
38
38
  kind: typeof Kind
39
39
  /**
40
- * The data store key to refer.
40
+ * The data store key to refer under which this certificate is stored.
41
41
  */
42
42
  key: string
43
43
  /**
@@ -56,7 +56,7 @@ export interface IRequestBaseConfig {
56
56
  */
57
57
  proxyPassword?: string
58
58
  /**
59
- * THe type of proxy authentication to use.
59
+ * The type of proxy authentication to use.
60
60
  */
61
61
  proxyAuthorization?: 'Basic'
62
62
  /**
@@ -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 = new DummyLogger()
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