@3sixty/api-models 0.0.0-stage → 0.20.0-next.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.
Files changed (314) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +24 -2
  3. package/dist/es/errors/forbiddenError.js +23 -0
  4. package/dist/es/errors/forbiddenError.js.map +1 -0
  5. package/dist/es/errors/tooManyRequestsError.js +25 -0
  6. package/dist/es/errors/tooManyRequestsError.js.map +1 -0
  7. package/dist/es/factories/mimeTypeProcessorFactory.js +9 -0
  8. package/dist/es/factories/mimeTypeProcessorFactory.js.map +1 -0
  9. package/dist/es/factories/restClientProcessorFactory.js +9 -0
  10. package/dist/es/factories/restClientProcessorFactory.js.map +1 -0
  11. package/dist/es/factories/restRouteProcessorFactory.js +9 -0
  12. package/dist/es/factories/restRouteProcessorFactory.js.map +1 -0
  13. package/dist/es/factories/socketRouteProcessorFactory.js +9 -0
  14. package/dist/es/factories/socketRouteProcessorFactory.js.map +1 -0
  15. package/dist/es/helpers/httpErrorHelper.js +75 -0
  16. package/dist/es/helpers/httpErrorHelper.js.map +1 -0
  17. package/dist/es/helpers/httpHeaderHelper.js +120 -0
  18. package/dist/es/helpers/httpHeaderHelper.js.map +1 -0
  19. package/dist/es/helpers/httpParameterHelper.js +41 -0
  20. package/dist/es/helpers/httpParameterHelper.js.map +1 -0
  21. package/dist/es/helpers/httpUrlHelper.js +156 -0
  22. package/dist/es/helpers/httpUrlHelper.js.map +1 -0
  23. package/dist/es/helpers/scopeHelper.js +46 -0
  24. package/dist/es/helpers/scopeHelper.js.map +1 -0
  25. package/dist/es/index.js +78 -0
  26. package/dist/es/index.js.map +1 -0
  27. package/dist/es/models/IHealth.js +2 -0
  28. package/dist/es/models/IHealth.js.map +1 -0
  29. package/dist/es/models/api/IServerFavIconResponse.js +2 -0
  30. package/dist/es/models/api/IServerFavIconResponse.js.map +1 -0
  31. package/dist/es/models/api/IServerHealthResponse.js +2 -0
  32. package/dist/es/models/api/IServerHealthResponse.js.map +1 -0
  33. package/dist/es/models/api/IServerInfoResponse.js +2 -0
  34. package/dist/es/models/api/IServerInfoResponse.js.map +1 -0
  35. package/dist/es/models/api/IServerLivezResponse.js +2 -0
  36. package/dist/es/models/api/IServerLivezResponse.js.map +1 -0
  37. package/dist/es/models/api/IServerReadyzResponse.js +2 -0
  38. package/dist/es/models/api/IServerReadyzResponse.js.map +1 -0
  39. package/dist/es/models/api/IServerRootResponse.js +2 -0
  40. package/dist/es/models/api/IServerRootResponse.js.map +1 -0
  41. package/dist/es/models/api/IServerSpecResponse.js +2 -0
  42. package/dist/es/models/api/IServerSpecResponse.js.map +1 -0
  43. package/dist/es/models/client/IRestClientProcessor.js +2 -0
  44. package/dist/es/models/client/IRestClientProcessor.js.map +1 -0
  45. package/dist/es/models/client/IRestClientProcessorContext.js +2 -0
  46. package/dist/es/models/client/IRestClientProcessorContext.js.map +1 -0
  47. package/dist/es/models/config/IBaseRestClientConfig.js +2 -0
  48. package/dist/es/models/config/IBaseRestClientConfig.js.map +1 -0
  49. package/dist/es/models/config/IBaseSocketClientConfig.js +2 -0
  50. package/dist/es/models/config/IBaseSocketClientConfig.js.map +1 -0
  51. package/dist/es/models/healthCategory.js +17 -0
  52. package/dist/es/models/healthCategory.js.map +1 -0
  53. package/dist/es/models/healthStatus.js +21 -0
  54. package/dist/es/models/healthStatus.js.map +1 -0
  55. package/dist/es/models/httpContextIdKeys.js +42 -0
  56. package/dist/es/models/httpContextIdKeys.js.map +1 -0
  57. package/dist/es/models/protocol/IHttpRequest.js +2 -0
  58. package/dist/es/models/protocol/IHttpRequest.js.map +1 -0
  59. package/dist/es/models/protocol/IHttpRequestContext.js +2 -0
  60. package/dist/es/models/protocol/IHttpRequestContext.js.map +1 -0
  61. package/dist/es/models/protocol/IHttpRequestPathParams.js +4 -0
  62. package/dist/es/models/protocol/IHttpRequestPathParams.js.map +1 -0
  63. package/dist/es/models/protocol/IHttpRequestQuery.js +4 -0
  64. package/dist/es/models/protocol/IHttpRequestQuery.js.map +1 -0
  65. package/dist/es/models/protocol/IHttpResponse.js +2 -0
  66. package/dist/es/models/protocol/IHttpResponse.js.map +1 -0
  67. package/dist/es/models/protocol/IHttpServerRequest.js +2 -0
  68. package/dist/es/models/protocol/IHttpServerRequest.js.map +1 -0
  69. package/dist/es/models/protocol/ISocketRequestContext.js +2 -0
  70. package/dist/es/models/protocol/ISocketRequestContext.js.map +1 -0
  71. package/dist/es/models/protocol/ISocketServerRequest.js +2 -0
  72. package/dist/es/models/protocol/ISocketServerRequest.js.map +1 -0
  73. package/dist/es/models/requests/INoContentRequest.js +2 -0
  74. package/dist/es/models/requests/INoContentRequest.js.map +1 -0
  75. package/dist/es/models/responses/errors/IBadRequestResponse.js +2 -0
  76. package/dist/es/models/responses/errors/IBadRequestResponse.js.map +1 -0
  77. package/dist/es/models/responses/errors/IConflictResponse.js +2 -0
  78. package/dist/es/models/responses/errors/IConflictResponse.js.map +1 -0
  79. package/dist/es/models/responses/errors/IForbiddenResponse.js +2 -0
  80. package/dist/es/models/responses/errors/IForbiddenResponse.js.map +1 -0
  81. package/dist/es/models/responses/errors/IInternalServerErrorResponse.js +2 -0
  82. package/dist/es/models/responses/errors/IInternalServerErrorResponse.js.map +1 -0
  83. package/dist/es/models/responses/errors/INotFoundResponse.js +2 -0
  84. package/dist/es/models/responses/errors/INotFoundResponse.js.map +1 -0
  85. package/dist/es/models/responses/errors/INotImplementedResponse.js +2 -0
  86. package/dist/es/models/responses/errors/INotImplementedResponse.js.map +1 -0
  87. package/dist/es/models/responses/errors/ITooManyRequestsResponse.js +2 -0
  88. package/dist/es/models/responses/errors/ITooManyRequestsResponse.js.map +1 -0
  89. package/dist/es/models/responses/errors/IUnauthorizedResponse.js +2 -0
  90. package/dist/es/models/responses/errors/IUnauthorizedResponse.js.map +1 -0
  91. package/dist/es/models/responses/errors/IUnprocessableEntityResponse.js +2 -0
  92. package/dist/es/models/responses/errors/IUnprocessableEntityResponse.js.map +1 -0
  93. package/dist/es/models/responses/success/IAcceptedResponse.js +2 -0
  94. package/dist/es/models/responses/success/IAcceptedResponse.js.map +1 -0
  95. package/dist/es/models/responses/success/ICreatedResponse.js +2 -0
  96. package/dist/es/models/responses/success/ICreatedResponse.js.map +1 -0
  97. package/dist/es/models/responses/success/INoContentResponse.js +2 -0
  98. package/dist/es/models/responses/success/INoContentResponse.js.map +1 -0
  99. package/dist/es/models/responses/success/IOkResponse.js +2 -0
  100. package/dist/es/models/responses/success/IOkResponse.js.map +1 -0
  101. package/dist/es/models/routes/IBaseRoute.js +4 -0
  102. package/dist/es/models/routes/IBaseRoute.js.map +1 -0
  103. package/dist/es/models/routes/IBaseRouteEntryPoint.js +2 -0
  104. package/dist/es/models/routes/IBaseRouteEntryPoint.js.map +1 -0
  105. package/dist/es/models/routes/IRestRoute.js +2 -0
  106. package/dist/es/models/routes/IRestRoute.js.map +1 -0
  107. package/dist/es/models/routes/IRestRouteEntryPoint.js +2 -0
  108. package/dist/es/models/routes/IRestRouteEntryPoint.js.map +1 -0
  109. package/dist/es/models/routes/IRestRouteExample.js +4 -0
  110. package/dist/es/models/routes/IRestRouteExample.js.map +1 -0
  111. package/dist/es/models/routes/IRestRouteRequestExample.js +2 -0
  112. package/dist/es/models/routes/IRestRouteRequestExample.js.map +1 -0
  113. package/dist/es/models/routes/IRestRouteResponseAttachmentOptions.js +4 -0
  114. package/dist/es/models/routes/IRestRouteResponseAttachmentOptions.js.map +1 -0
  115. package/dist/es/models/routes/IRestRouteResponseExample.js +2 -0
  116. package/dist/es/models/routes/IRestRouteResponseExample.js.map +1 -0
  117. package/dist/es/models/routes/IRestRouteResponseOptions.js +2 -0
  118. package/dist/es/models/routes/IRestRouteResponseOptions.js.map +1 -0
  119. package/dist/es/models/routes/ISocketRoute.js +2 -0
  120. package/dist/es/models/routes/ISocketRoute.js.map +1 -0
  121. package/dist/es/models/routes/ISocketRouteEntryPoint.js +2 -0
  122. package/dist/es/models/routes/ISocketRouteEntryPoint.js.map +1 -0
  123. package/dist/es/models/routes/ITag.js +4 -0
  124. package/dist/es/models/routes/ITag.js.map +1 -0
  125. package/dist/es/models/routes/httpBodyLimit.js +17 -0
  126. package/dist/es/models/routes/httpBodyLimit.js.map +1 -0
  127. package/dist/es/models/server/IBaseRouteProcessor.js +2 -0
  128. package/dist/es/models/server/IBaseRouteProcessor.js.map +1 -0
  129. package/dist/es/models/server/IMimeTypeProcessor.js +2 -0
  130. package/dist/es/models/server/IMimeTypeProcessor.js.map +1 -0
  131. package/dist/es/models/server/IRestRouteProcessor.js +2 -0
  132. package/dist/es/models/server/IRestRouteProcessor.js.map +1 -0
  133. package/dist/es/models/server/ISocketRouteProcessor.js +2 -0
  134. package/dist/es/models/server/ISocketRouteProcessor.js.map +1 -0
  135. package/dist/es/models/server/IWebServer.js +2 -0
  136. package/dist/es/models/server/IWebServer.js.map +1 -0
  137. package/dist/es/models/server/IWebServerOptions.js +2 -0
  138. package/dist/es/models/server/IWebServerOptions.js.map +1 -0
  139. package/dist/es/models/services/IHealthApplicationCallback.js +2 -0
  140. package/dist/es/models/services/IHealthApplicationCallback.js.map +1 -0
  141. package/dist/es/models/services/IHealthComponent.js +2 -0
  142. package/dist/es/models/services/IHealthComponent.js.map +1 -0
  143. package/dist/es/models/services/IHealthProviderComponent.js +2 -0
  144. package/dist/es/models/services/IHealthProviderComponent.js.map +1 -0
  145. package/dist/es/models/services/IInformationComponent.js +2 -0
  146. package/dist/es/models/services/IInformationComponent.js.map +1 -0
  147. package/dist/es/models/services/IPlatformComponent.js +2 -0
  148. package/dist/es/models/services/IPlatformComponent.js.map +1 -0
  149. package/dist/es/models/services/IServerInfo.js +4 -0
  150. package/dist/es/models/services/IServerInfo.js.map +1 -0
  151. package/dist/es/models/services/ITenant.js +4 -0
  152. package/dist/es/models/services/ITenant.js.map +1 -0
  153. package/dist/es/models/services/ITenantAdminComponent.js +2 -0
  154. package/dist/es/models/services/ITenantAdminComponent.js.map +1 -0
  155. package/dist/types/errors/forbiddenError.d.ts +20 -0
  156. package/dist/types/errors/tooManyRequestsError.d.ts +22 -0
  157. package/dist/types/factories/mimeTypeProcessorFactory.d.ts +6 -0
  158. package/dist/types/factories/restClientProcessorFactory.d.ts +6 -0
  159. package/dist/types/factories/restRouteProcessorFactory.d.ts +6 -0
  160. package/dist/types/factories/socketRouteProcessorFactory.d.ts +6 -0
  161. package/dist/types/helpers/httpErrorHelper.d.ts +32 -0
  162. package/dist/types/helpers/httpHeaderHelper.d.ts +62 -0
  163. package/dist/types/helpers/httpParameterHelper.d.ts +29 -0
  164. package/dist/types/helpers/httpUrlHelper.d.ts +73 -0
  165. package/dist/types/helpers/scopeHelper.d.ts +27 -0
  166. package/dist/types/index.d.ts +75 -0
  167. package/dist/types/models/IHealth.d.ts +42 -0
  168. package/dist/types/models/api/IServerFavIconResponse.d.ts +23 -0
  169. package/dist/types/models/api/IServerHealthResponse.d.ts +14 -0
  170. package/dist/types/models/api/IServerInfoResponse.d.ts +10 -0
  171. package/dist/types/models/api/IServerLivezResponse.d.ts +16 -0
  172. package/dist/types/models/api/IServerReadyzResponse.d.ts +16 -0
  173. package/dist/types/models/api/IServerRootResponse.d.ts +16 -0
  174. package/dist/types/models/api/IServerSpecResponse.d.ts +14 -0
  175. package/dist/types/models/client/IRestClientProcessor.d.ts +22 -0
  176. package/dist/types/models/client/IRestClientProcessorContext.d.ts +42 -0
  177. package/dist/types/models/config/IBaseRestClientConfig.d.ts +46 -0
  178. package/dist/types/models/config/IBaseSocketClientConfig.d.ts +22 -0
  179. package/dist/types/models/healthCategory.d.ts +17 -0
  180. package/dist/types/models/healthStatus.d.ts +21 -0
  181. package/dist/types/models/httpContextIdKeys.d.ts +42 -0
  182. package/dist/types/models/protocol/IHttpRequest.d.ts +24 -0
  183. package/dist/types/models/protocol/IHttpRequestContext.d.ts +20 -0
  184. package/dist/types/models/protocol/IHttpRequestPathParams.d.ts +6 -0
  185. package/dist/types/models/protocol/IHttpRequestQuery.d.ts +6 -0
  186. package/dist/types/models/protocol/IHttpResponse.d.ts +18 -0
  187. package/dist/types/models/protocol/IHttpServerRequest.d.ts +15 -0
  188. package/dist/types/models/protocol/ISocketRequestContext.d.ts +10 -0
  189. package/dist/types/models/protocol/ISocketServerRequest.d.ts +10 -0
  190. package/dist/types/models/requests/INoContentRequest.d.ts +22 -0
  191. package/dist/types/models/responses/errors/IBadRequestResponse.d.ts +15 -0
  192. package/dist/types/models/responses/errors/IConflictResponse.d.ts +15 -0
  193. package/dist/types/models/responses/errors/IForbiddenResponse.d.ts +15 -0
  194. package/dist/types/models/responses/errors/IInternalServerErrorResponse.d.ts +15 -0
  195. package/dist/types/models/responses/errors/INotFoundResponse.d.ts +20 -0
  196. package/dist/types/models/responses/errors/INotImplementedResponse.d.ts +15 -0
  197. package/dist/types/models/responses/errors/ITooManyRequestsResponse.d.ts +15 -0
  198. package/dist/types/models/responses/errors/IUnauthorizedResponse.d.ts +15 -0
  199. package/dist/types/models/responses/errors/IUnprocessableEntityResponse.d.ts +15 -0
  200. package/dist/types/models/responses/success/IAcceptedResponse.d.ts +19 -0
  201. package/dist/types/models/responses/success/ICreatedResponse.d.ts +19 -0
  202. package/dist/types/models/responses/success/INoContentResponse.d.ts +10 -0
  203. package/dist/types/models/responses/success/IOkResponse.d.ts +10 -0
  204. package/dist/types/models/routes/IBaseRoute.d.ts +30 -0
  205. package/dist/types/models/routes/IBaseRouteEntryPoint.d.ts +22 -0
  206. package/dist/types/models/routes/IRestRoute.d.ts +80 -0
  207. package/dist/types/models/routes/IRestRouteEntryPoint.d.ts +6 -0
  208. package/dist/types/models/routes/IRestRouteExample.d.ts +13 -0
  209. package/dist/types/models/routes/IRestRouteRequestExample.d.ts +10 -0
  210. package/dist/types/models/routes/IRestRouteResponseAttachmentOptions.d.ts +17 -0
  211. package/dist/types/models/routes/IRestRouteResponseExample.d.ts +10 -0
  212. package/dist/types/models/routes/IRestRouteResponseOptions.d.ts +10 -0
  213. package/dist/types/models/routes/ISocketRoute.d.ts +41 -0
  214. package/dist/types/models/routes/ISocketRouteEntryPoint.d.ts +6 -0
  215. package/dist/types/models/routes/ITag.d.ts +13 -0
  216. package/dist/types/models/routes/httpBodyLimit.d.ts +17 -0
  217. package/dist/types/models/server/IBaseRouteProcessor.d.ts +49 -0
  218. package/dist/types/models/server/IMimeTypeProcessor.d.ts +17 -0
  219. package/dist/types/models/server/IRestRouteProcessor.d.ts +24 -0
  220. package/dist/types/models/server/ISocketRouteProcessor.d.ts +38 -0
  221. package/dist/types/models/server/IWebServer.d.ts +36 -0
  222. package/dist/types/models/server/IWebServerOptions.d.ts +54 -0
  223. package/dist/types/models/services/IHealthApplicationCallback.d.ts +6 -0
  224. package/dist/types/models/services/IHealthComponent.d.ts +16 -0
  225. package/dist/types/models/services/IHealthProviderComponent.d.ts +31 -0
  226. package/dist/types/models/services/IInformationComponent.d.ts +41 -0
  227. package/dist/types/models/services/IPlatformComponent.d.ts +24 -0
  228. package/dist/types/models/services/IServerInfo.d.ts +13 -0
  229. package/dist/types/models/services/ITenant.d.ts +37 -0
  230. package/dist/types/models/services/ITenantAdminComponent.d.ts +70 -0
  231. package/docs/changelog.md +0 -0
  232. package/docs/examples.md +200 -0
  233. package/docs/reference/classes/ForbiddenError.md +55 -0
  234. package/docs/reference/classes/HttpErrorHelper.md +99 -0
  235. package/docs/reference/classes/HttpHeaderHelper.md +182 -0
  236. package/docs/reference/classes/HttpParameterHelper.md +125 -0
  237. package/docs/reference/classes/HttpUrlHelper.md +262 -0
  238. package/docs/reference/classes/ScopeHelper.md +88 -0
  239. package/docs/reference/classes/TooManyRequestsError.md +67 -0
  240. package/docs/reference/index.md +92 -0
  241. package/docs/reference/interfaces/IAcceptedResponse.md +25 -0
  242. package/docs/reference/interfaces/IBadRequestResponse.md +19 -0
  243. package/docs/reference/interfaces/IBaseRestClientConfig.md +99 -0
  244. package/docs/reference/interfaces/IBaseRoute.md +57 -0
  245. package/docs/reference/interfaces/IBaseRouteEntryPoint.md +55 -0
  246. package/docs/reference/interfaces/IBaseRouteProcessor.md +146 -0
  247. package/docs/reference/interfaces/IBaseSocketClientConfig.md +35 -0
  248. package/docs/reference/interfaces/IConflictResponse.md +19 -0
  249. package/docs/reference/interfaces/ICreatedResponse.md +25 -0
  250. package/docs/reference/interfaces/IForbiddenResponse.md +19 -0
  251. package/docs/reference/interfaces/IHealth.md +71 -0
  252. package/docs/reference/interfaces/IHealthComponent.md +21 -0
  253. package/docs/reference/interfaces/IHealthProviderComponent.md +76 -0
  254. package/docs/reference/interfaces/IHttpRequest.md +46 -0
  255. package/docs/reference/interfaces/IHttpRequestContext.md +35 -0
  256. package/docs/reference/interfaces/IHttpRequestPathParams.md +7 -0
  257. package/docs/reference/interfaces/IHttpRequestQuery.md +7 -0
  258. package/docs/reference/interfaces/IHttpResponse.md +33 -0
  259. package/docs/reference/interfaces/IHttpServerRequest.md +81 -0
  260. package/docs/reference/interfaces/IInformationComponent.md +91 -0
  261. package/docs/reference/interfaces/IInternalServerErrorResponse.md +19 -0
  262. package/docs/reference/interfaces/IMimeTypeProcessor.md +43 -0
  263. package/docs/reference/interfaces/INoContentRequest.md +55 -0
  264. package/docs/reference/interfaces/INoContentResponse.md +11 -0
  265. package/docs/reference/interfaces/INotFoundResponse.md +27 -0
  266. package/docs/reference/interfaces/INotImplementedResponse.md +19 -0
  267. package/docs/reference/interfaces/IOkResponse.md +11 -0
  268. package/docs/reference/interfaces/IPlatformComponent.md +65 -0
  269. package/docs/reference/interfaces/IRestClientProcessor.md +69 -0
  270. package/docs/reference/interfaces/IRestClientProcessorContext.md +75 -0
  271. package/docs/reference/interfaces/IRestRoute.md +209 -0
  272. package/docs/reference/interfaces/IRestRouteExample.md +24 -0
  273. package/docs/reference/interfaces/IRestRouteProcessor.md +191 -0
  274. package/docs/reference/interfaces/IRestRouteRequestExample.md +45 -0
  275. package/docs/reference/interfaces/IRestRouteResponseAttachmentOptions.md +27 -0
  276. package/docs/reference/interfaces/IRestRouteResponseExample.md +45 -0
  277. package/docs/reference/interfaces/IRestRouteResponseOptions.md +11 -0
  278. package/docs/reference/interfaces/IServerFavIconResponse.md +33 -0
  279. package/docs/reference/interfaces/IServerHealthResponse.md +19 -0
  280. package/docs/reference/interfaces/IServerInfo.md +19 -0
  281. package/docs/reference/interfaces/IServerInfoResponse.md +11 -0
  282. package/docs/reference/interfaces/IServerLivezResponse.md +23 -0
  283. package/docs/reference/interfaces/IServerReadyzResponse.md +23 -0
  284. package/docs/reference/interfaces/IServerRootResponse.md +23 -0
  285. package/docs/reference/interfaces/IServerSpecResponse.md +19 -0
  286. package/docs/reference/interfaces/ISocketRequestContext.md +55 -0
  287. package/docs/reference/interfaces/ISocketRoute.md +162 -0
  288. package/docs/reference/interfaces/ISocketRouteProcessor.md +261 -0
  289. package/docs/reference/interfaces/ISocketServerRequest.md +93 -0
  290. package/docs/reference/interfaces/ITag.md +19 -0
  291. package/docs/reference/interfaces/ITenant.md +67 -0
  292. package/docs/reference/interfaces/ITenantAdminComponent.md +227 -0
  293. package/docs/reference/interfaces/ITooManyRequestsResponse.md +19 -0
  294. package/docs/reference/interfaces/IUnauthorizedResponse.md +19 -0
  295. package/docs/reference/interfaces/IUnprocessableEntityResponse.md +19 -0
  296. package/docs/reference/interfaces/IWebServer.md +109 -0
  297. package/docs/reference/interfaces/IWebServerOptions.md +113 -0
  298. package/docs/reference/type-aliases/HealthApplicationCallback.md +16 -0
  299. package/docs/reference/type-aliases/HealthCategory.md +5 -0
  300. package/docs/reference/type-aliases/HealthStatus.md +5 -0
  301. package/docs/reference/type-aliases/HttpBodyLimit.md +5 -0
  302. package/docs/reference/type-aliases/HttpContextIdKeys.md +5 -0
  303. package/docs/reference/type-aliases/IRestRouteEntryPoint.md +5 -0
  304. package/docs/reference/type-aliases/ISocketRouteEntryPoint.md +5 -0
  305. package/docs/reference/variables/HealthCategory.md +19 -0
  306. package/docs/reference/variables/HealthStatus.md +25 -0
  307. package/docs/reference/variables/HttpBodyLimit.md +19 -0
  308. package/docs/reference/variables/HttpContextIdKeys.md +56 -0
  309. package/docs/reference/variables/MimeTypeProcessorFactory.md +5 -0
  310. package/docs/reference/variables/RestClientProcessorFactory.md +5 -0
  311. package/docs/reference/variables/RestRouteProcessorFactory.md +5 -0
  312. package/docs/reference/variables/SocketRouteProcessorFactory.md +5 -0
  313. package/locales/en.json +8 -0
  314. package/package.json +53 -5
@@ -0,0 +1,49 @@
1
+ import type { IContextIds } from "@3sixty/context";
2
+ import type { IComponent } from "@3sixty/core";
3
+ import type { IHttpResponse } from "../protocol/IHttpResponse.js";
4
+ import type { IHttpServerRequest } from "../protocol/IHttpServerRequest.js";
5
+ import type { IBaseRoute } from "../routes/IBaseRoute.js";
6
+ /**
7
+ * The definition for a base processor for handling REST routes.
8
+ */
9
+ export interface IBaseRouteProcessor<T = IBaseRoute, R = IHttpServerRequest> extends IComponent {
10
+ /**
11
+ * Features supported by this processor.
12
+ * If a route has any of these features listed, this processor will be run for that route.
13
+ * If this is not implemented, the processor will run for all routes.
14
+ * @returns The features supported by this processor.
15
+ */
16
+ features?(): string[];
17
+ /**
18
+ * Pre process the REST request for the specified route.
19
+ * @param request The request to handle.
20
+ * @param response The response data to send if any.
21
+ * @param route The route being requested, if a matching one was found.
22
+ * @param contextIds The context IDs of the request.
23
+ * @param processorState The state handed through the processors.
24
+ * @param componentTypes The component types for the request.
25
+ * @param componentTypes.loggingComponentType The logging component type.
26
+ * @returns Promise that resolves when the request is processed.
27
+ */
28
+ pre?(request: R, response: IHttpResponse, route: T | undefined, contextIds: IContextIds, processorState: {
29
+ [id: string]: unknown;
30
+ }, componentTypes?: {
31
+ loggingComponentType?: string;
32
+ }): Promise<void>;
33
+ /**
34
+ * Post process the REST request for the specified route.
35
+ * @param request The request to handle.
36
+ * @param response The response data to send if any.
37
+ * @param route The route being requested, if a matching one was found.
38
+ * @param contextIds The context IDs of the request.
39
+ * @param processorState The state handed through the processors.
40
+ * @param componentTypes The component types for the request.
41
+ * @param componentTypes.loggingComponentType The logging component type.
42
+ * @returns Promise that resolves when the request is processed.
43
+ */
44
+ post?(request: R, response: IHttpResponse, route: T | undefined, contextIds: IContextIds, processorState: {
45
+ [id: string]: unknown;
46
+ }, componentTypes?: {
47
+ loggingComponentType?: string;
48
+ }): Promise<void>;
49
+ }
@@ -0,0 +1,17 @@
1
+ import type { IComponent } from "@3sixty/core";
2
+ /**
3
+ * The definition for a handler for a specific MIME type.
4
+ */
5
+ export interface IMimeTypeProcessor extends IComponent {
6
+ /**
7
+ * Get the MIME types that this handler can handle.
8
+ * @returns The MIME types that this handler can handle.
9
+ */
10
+ getTypes(): string[];
11
+ /**
12
+ * Handle content.
13
+ * @param body The body to process.
14
+ * @returns The processed body.
15
+ */
16
+ handle(body: Uint8Array): Promise<unknown>;
17
+ }
@@ -0,0 +1,24 @@
1
+ import type { IBaseRouteProcessor } from "./IBaseRouteProcessor.js";
2
+ import type { IHttpResponse } from "../protocol/IHttpResponse.js";
3
+ import type { IHttpServerRequest } from "../protocol/IHttpServerRequest.js";
4
+ import type { IRestRoute } from "../routes/IRestRoute.js";
5
+ /**
6
+ * The definition for a processor for handling REST routes.
7
+ */
8
+ export interface IRestRouteProcessor extends IBaseRouteProcessor<IRestRoute> {
9
+ /**
10
+ * Process the REST request for the specified route.
11
+ * @param request The request to handle.
12
+ * @param response The response data to send if any.
13
+ * @param route The route being requested, if a matching one was found.
14
+ * @param processorState The state handed through the processors.
15
+ * @param componentTypes The component types for the request.
16
+ * @param componentTypes.loggingComponentType The logging component type.
17
+ * @returns Promise that resolves when the request is processed.
18
+ */
19
+ process?(request: IHttpServerRequest, response: IHttpResponse, route: IRestRoute | undefined, processorState: {
20
+ [id: string]: unknown;
21
+ }, componentTypes?: {
22
+ loggingComponentType?: string;
23
+ }): Promise<void>;
24
+ }
@@ -0,0 +1,38 @@
1
+ import type { IBaseRouteProcessor } from "./IBaseRouteProcessor.js";
2
+ import type { IHttpResponse } from "../protocol/IHttpResponse.js";
3
+ import type { ISocketServerRequest } from "../protocol/ISocketServerRequest.js";
4
+ import type { ISocketRoute } from "../routes/ISocketRoute.js";
5
+ /**
6
+ * The definition for a processor for handling socket routes.
7
+ */
8
+ export interface ISocketRouteProcessor extends IBaseRouteProcessor<ISocketRoute, ISocketServerRequest> {
9
+ /**
10
+ * Process the connected event.
11
+ * @param request The server request object containing the socket id and other parameters.
12
+ * @param route The route being requested, if a matching one was found.
13
+ * @param loggingComponentType The logging component type for the request.
14
+ * @returns Promise that resolves when the request is processed.
15
+ */
16
+ connected?(request: ISocketServerRequest, route: ISocketRoute | undefined, loggingComponentType?: string): Promise<void>;
17
+ /**
18
+ * Process the disconnected event.
19
+ * @param request The server request object containing the socket id and other parameters.
20
+ * @param route The route being requested, if a matching one was found.
21
+ * @param loggingComponentType The logging component type for the request.
22
+ * @returns Promise that resolves when the request is processed.
23
+ */
24
+ disconnected?(request: ISocketServerRequest, route: ISocketRoute | undefined, loggingComponentType?: string): Promise<void>;
25
+ /**
26
+ * Process the REST request for the specified route.
27
+ * @param request The server request object containing the socket id and other parameters.
28
+ * @param response The response data to send if any.
29
+ * @param route The route being requested, if a matching one was found.
30
+ * @param processorState The state handed through the processors.
31
+ * @param responseEmitter The function to emit a response.
32
+ * @param loggingComponentType The logging component type for the request.
33
+ * @returns Promise that resolves when the request is processed.
34
+ */
35
+ process?(request: ISocketServerRequest, response: IHttpResponse, route: ISocketRoute | undefined, processorState: {
36
+ [id: string]: unknown;
37
+ }, responseEmitter: (topic: string, response: IHttpResponse) => Promise<void>, loggingComponentType?: string): Promise<void>;
38
+ }
@@ -0,0 +1,36 @@
1
+ import type { IComponent } from "@3sixty/core";
2
+ import type { IRestRouteProcessor } from "./IRestRouteProcessor.js";
3
+ import type { ISocketRouteProcessor } from "./ISocketRouteProcessor.js";
4
+ import type { IWebServerOptions } from "./IWebServerOptions.js";
5
+ import type { IRestRoute } from "../routes/IRestRoute.js";
6
+ import type { ISocketRoute } from "../routes/ISocketRoute.js";
7
+ /**
8
+ * Interface describing a web server.
9
+ */
10
+ export interface IWebServer<T> extends IComponent {
11
+ /**
12
+ * Get the web server instance.
13
+ * @returns The web server instance.
14
+ */
15
+ getInstance(): T;
16
+ /**
17
+ * Build the server.
18
+ * @param restRouteProcessors The processors for incoming requests over REST.
19
+ * @param restRoutes The REST routes.
20
+ * @param socketRouteProcessors The processors for incoming requests over Sockets.
21
+ * @param socketRoutes The socket routes.
22
+ * @param options Options for building the server.
23
+ * @returns A promise that resolves when the server is fully built and ready to start.
24
+ */
25
+ build(restRouteProcessors?: IRestRouteProcessor[], restRoutes?: IRestRoute[], socketRouteProcessors?: ISocketRouteProcessor[], socketRoutes?: ISocketRoute[], options?: IWebServerOptions): Promise<void>;
26
+ /**
27
+ * Start the server.
28
+ * @returns A promise that resolves when the server is listening for connections.
29
+ */
30
+ start(): Promise<void>;
31
+ /**
32
+ * Stop the server.
33
+ * @returns A promise that resolves when the server has shut down all connections.
34
+ */
35
+ stop(): Promise<void>;
36
+ }
@@ -0,0 +1,54 @@
1
+ import type { HttpMethod } from "@3sixty/web";
2
+ /**
3
+ * Options for the web server.
4
+ */
5
+ export interface IWebServerOptions {
6
+ /**
7
+ * The port to bind the web server to.
8
+ * @default 3000
9
+ */
10
+ port?: number;
11
+ /**
12
+ * The address to bind the web server to.
13
+ * @default localhost
14
+ */
15
+ host?: string;
16
+ /**
17
+ * The methods that the server accepts.
18
+ * @default ["GET", "PUT", "POST", "PATCH", "DELETE", "OPTIONS"]
19
+ */
20
+ methods?: HttpMethod[];
21
+ /**
22
+ * Any additional allowed headers.
23
+ */
24
+ allowedHeaders?: string[];
25
+ /**
26
+ * And additional exposed headers.
27
+ */
28
+ exposedHeaders?: string[];
29
+ /**
30
+ * The allowed CORS domains.
31
+ * @default ["*"]
32
+ */
33
+ corsOrigins?: string | string[];
34
+ /**
35
+ * The public origin of the server, used for constructing the request URL.
36
+ * If not provided, it will be determined from the incoming request.
37
+ */
38
+ publicOrigin?: string;
39
+ /**
40
+ * Named body size limits in bytes for REST routes, referenced by a route's bodyLimit name.
41
+ * Merged over the server's built-in limits; the "default" entry applies to routes with no bodyLimit name.
42
+ */
43
+ bodyLimits?: {
44
+ [name: string]: number;
45
+ };
46
+ /**
47
+ * Custom configuration for the web server.
48
+ */
49
+ customWebConfig?: unknown;
50
+ /**
51
+ * Custom configuration for the socket server.
52
+ */
53
+ customSocketConfig?: unknown;
54
+ }
@@ -0,0 +1,6 @@
1
+ import type { IHealth } from "../IHealth.js";
2
+ /**
3
+ * Callback invoked by a component to supply a deferred application health result.
4
+ * Only called when healthApplication returns undefined.
5
+ */
6
+ export type HealthApplicationCallback = (result: IHealth[]) => Promise<void>;
@@ -0,0 +1,16 @@
1
+ import type { IComponent } from "@3sixty/core";
2
+ import type { HealthStatus } from "../healthStatus.js";
3
+ import type { IHealth } from "../IHealth.js";
4
+ /**
5
+ * The health component for the server.
6
+ */
7
+ export interface IHealthComponent extends IComponent {
8
+ /**
9
+ * Get the server health.
10
+ * @returns The service health.
11
+ */
12
+ healthStatus(): Promise<{
13
+ status: HealthStatus;
14
+ components: IHealth[];
15
+ }>;
16
+ }
@@ -0,0 +1,31 @@
1
+ import type { IContextIds } from "@3sixty/context";
2
+ import type { IHealth } from "../IHealth.js";
3
+ import type { HealthApplicationCallback } from "./IHealthApplicationCallback.js";
4
+ /**
5
+ * The health provider component for the server.
6
+ */
7
+ export interface IHealthProviderComponent {
8
+ /**
9
+ * Returns the health status of the component.
10
+ * @returns The health status of the component, can return multiple entries for elements within the component.
11
+ */
12
+ health?(): Promise<IHealth[]>;
13
+ /**
14
+ * Initialize the application health processing for a component.
15
+ * @param contextIds The context IDs provisioned during the init pass.
16
+ * @returns A promise that resolves when the initialization is complete.
17
+ */
18
+ healthApplicationInit?(contextIds: IContextIds): Promise<void>;
19
+ /**
20
+ * Returns the application health status of the component, context IDs from init are set in the current context.
21
+ * Returns undefined when the result will be provided asynchronously via the callback.
22
+ * @param callback The callback to invoke when a deferred health result is ready.
23
+ * @returns The health status, or undefined if the result will be provided via the callback.
24
+ */
25
+ healthApplication?(callback: HealthApplicationCallback): Promise<IHealth[] | undefined>;
26
+ /**
27
+ * Teardown the application health processing for a component.
28
+ * @returns A promise that resolves when the teardown is complete.
29
+ */
30
+ healthApplicationTeardown?(): Promise<void>;
31
+ }
@@ -0,0 +1,41 @@
1
+ import type { IComponent } from "@3sixty/core";
2
+ import type { IServerInfo } from "./IServerInfo.js";
3
+ /**
4
+ * The information component for the server.
5
+ */
6
+ export interface IInformationComponent extends IComponent {
7
+ /**
8
+ * Get the root information.
9
+ * @returns The root information.
10
+ */
11
+ root(): Promise<string>;
12
+ /**
13
+ * Get the server information.
14
+ * @returns The service information.
15
+ */
16
+ info(): Promise<IServerInfo>;
17
+ /**
18
+ * Get the favicon.
19
+ * @returns The favicon.
20
+ */
21
+ favicon(): Promise<Uint8Array | undefined>;
22
+ /**
23
+ * Get the OpenAPI spec.
24
+ * @returns The OpenAPI spec.
25
+ */
26
+ spec(): Promise<unknown>;
27
+ /**
28
+ * Is the server live.
29
+ * @returns The livez status of the server.
30
+ */
31
+ livez(): Promise<{
32
+ status: "alive" | "dead";
33
+ }>;
34
+ /**
35
+ * Is the server ready.
36
+ * @returns The readyz status of the server.
37
+ */
38
+ readyz(): Promise<{
39
+ status: "ready" | "not ready";
40
+ }>;
41
+ }
@@ -0,0 +1,24 @@
1
+ import type { IContextIds } from "@3sixty/context";
2
+ import type { IComponent } from "@3sixty/core";
3
+ /**
4
+ * Interface for the platform component.
5
+ */
6
+ export interface IPlatformComponent extends IComponent {
7
+ /**
8
+ * Indicates whether the component is running in a multi-tenant environment.
9
+ * @returns True if the component is running in a multi-tenant environment, false otherwise.
10
+ */
11
+ isMultiTenant(): boolean;
12
+ /**
13
+ * Execute a method, if single tenant will run once, if multi-tenant will run for each tenant.
14
+ * @param method The method to run for each tenant, returning false will stop any further iterations.
15
+ * @returns A promise that resolves when the method has been executed for all applicable tenants.
16
+ */
17
+ execute(method: () => Promise<undefined | boolean> | Promise<void>): Promise<void>;
18
+ /**
19
+ * Get the local origin context IDs for the given URL.
20
+ * @param url The URL to check.
21
+ * @returns A promise that resolves to the context IDs if the URL is a local origin, undefined otherwise.
22
+ */
23
+ getLocalOriginContext(url: string): Promise<IContextIds | undefined>;
24
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The information about the server.
3
+ */
4
+ export interface IServerInfo {
5
+ /**
6
+ * The application name.
7
+ */
8
+ name: string;
9
+ /**
10
+ * The version of the server.
11
+ */
12
+ version: string;
13
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Model defining the tenant.
3
+ */
4
+ export interface ITenant {
5
+ /**
6
+ * The unique identifier for the tenant.
7
+ */
8
+ id: string;
9
+ /**
10
+ * The api key for the tenant.
11
+ */
12
+ apiKey: string;
13
+ /**
14
+ * The label of the tenant.
15
+ */
16
+ label: string;
17
+ /**
18
+ * The date the tenant was created.
19
+ */
20
+ dateCreated: string;
21
+ /**
22
+ * The date the tenant was modified.
23
+ */
24
+ dateModified: string;
25
+ /**
26
+ * The public origin available to the public for accessing the API.
27
+ */
28
+ publicOrigin?: string;
29
+ /**
30
+ * The organization id for the tenant.
31
+ */
32
+ organizationId: string;
33
+ /**
34
+ * Optional list of organization aliases that can are used for legacy lookups.
35
+ */
36
+ organizationIdLegacy?: string[];
37
+ }
@@ -0,0 +1,70 @@
1
+ import type { IComponent } from "@3sixty/core";
2
+ import type { EntityCondition } from "@3sixty/entity";
3
+ import type { ITenant } from "./ITenant.js";
4
+ /**
5
+ * Configuration for the tenant admin component
6
+ */
7
+ export interface ITenantAdminComponent extends IComponent {
8
+ /**
9
+ * Create a tenant.
10
+ * @param tenant The tenant to store.
11
+ * @returns The tenant id.
12
+ */
13
+ create(tenant: Omit<ITenant, "id" | "dateCreated" | "dateModified"> & {
14
+ id?: string;
15
+ }): Promise<string>;
16
+ /**
17
+ * Update a tenant.
18
+ * @param tenant The tenant to update.
19
+ * @returns A promise that resolves when the tenant has been updated.
20
+ */
21
+ update(tenant: Partial<Omit<ITenant, "dateCreated" | "dateModified">>): Promise<void>;
22
+ /**
23
+ * Get a tenant by its id.
24
+ * @param tenantId The id of the tenant.
25
+ * @returns The tenant.
26
+ * @throws Error if the tenant is not found.
27
+ */
28
+ get(tenantId: string): Promise<ITenant>;
29
+ /**
30
+ * Get a tenant by its api key.
31
+ * @param apiKey The api key of the tenant.
32
+ * @returns The tenant.
33
+ * @throws Error if the tenant is not found.
34
+ */
35
+ getByApiKey(apiKey: string): Promise<ITenant>;
36
+ /**
37
+ * Get a tenant by its public origin.
38
+ * @param publicOrigin The origin of the tenant.
39
+ * @returns The tenant.
40
+ * @throws Error if the tenant is not found.
41
+ */
42
+ getByPublicOrigin(publicOrigin: string): Promise<ITenant>;
43
+ /**
44
+ * Remove a tenant by its id.
45
+ * @param tenantId The id of the tenant.
46
+ * @returns A promise that resolves when the tenant has been removed.
47
+ * @throws Error if the tenant is not found.
48
+ */
49
+ remove(tenantId: string): Promise<void>;
50
+ /**
51
+ * Get a tenant by its organization id, optionally searching legacy ids.
52
+ * @param organizationId The organization id of the tenant.
53
+ * @param includeLegacy Whether to also search the legacy organization id array.
54
+ * @returns The tenant.
55
+ * @throws Error if the tenant is not found.
56
+ */
57
+ getTenantByOrganizationId(organizationId: string, includeLegacy?: boolean): Promise<ITenant>;
58
+ /**
59
+ * Query tenants with pagination.
60
+ * @param conditions The conditions to filter the tenants.
61
+ * @param properties The properties to include in the returned tenants.
62
+ * @param cursor The cursor to start from.
63
+ * @param limit The maximum number of tenants to return.
64
+ * @returns The tenants and the next cursor if more tenants are available.
65
+ */
66
+ query(conditions?: EntityCondition<ITenant>, properties?: (keyof ITenant)[], cursor?: string, limit?: number): Promise<{
67
+ tenants: ITenant[];
68
+ cursor?: string;
69
+ }>;
70
+ }
File without changes
@@ -0,0 +1,200 @@
1
+ # Models Examples
2
+
3
+ These snippets show practical helpers for URL manipulation, request parameter conversion, consistent error responses, and secure parameter encryption.
4
+
5
+ ## HttpUrlHelper
6
+
7
+ ```typescript
8
+ import { HttpUrlHelper } from '@3sixty/api-models';
9
+
10
+ const fullUrl = 'https://tenant.example.org/orders?page=2';
11
+
12
+ console.log(HttpUrlHelper.extractOrigin(fullUrl)); // https://tenant.example.org
13
+ console.log(HttpUrlHelper.extractPath(fullUrl)); // /orders
14
+ console.log(HttpUrlHelper.extractSearch(fullUrl)); // ?page=2
15
+ console.log(HttpUrlHelper.extractPathAndSearch(fullUrl)); // /orders?page=2
16
+ ```
17
+
18
+ ```typescript
19
+ import { HttpUrlHelper } from '@3sixty/api-models';
20
+
21
+ const combined = HttpUrlHelper.combineParts('https://tenant.example.org/', '/api/v1/orders');
22
+ const replaced = HttpUrlHelper.replaceOrigin(combined ?? '', 'https://edge.example.org');
23
+
24
+ console.log(combined); // https://tenant.example.org/api/v1/orders
25
+ console.log(replaced); // https://edge.example.org/api/v1/orders
26
+ ```
27
+
28
+ ## HttpParameterHelper
29
+
30
+ ```typescript
31
+ import { HttpParameterHelper } from '@3sixty/api-models';
32
+
33
+ const ids = HttpParameterHelper.arrayFromString('id-1,id-2,id-3');
34
+ const idsAsString = HttpParameterHelper.arrayToString(ids);
35
+
36
+ const filterObject = HttpParameterHelper.objectFromString('{"status":"active"}');
37
+ const filterString = HttpParameterHelper.objectToString(filterObject);
38
+
39
+ console.log(ids.length); // 3
40
+ console.log(idsAsString); // id-1,id-2,id-3
41
+ console.log(filterString); // {"status":"active"}
42
+ ```
43
+
44
+ ## HttpErrorHelper
45
+
46
+ ```typescript
47
+ import { HttpErrorHelper } from '@3sixty/api-models';
48
+
49
+ try {
50
+ throw new Error('Invalid request');
51
+ } catch (err) {
52
+ const mapped = HttpErrorHelper.processError(err, false);
53
+ const response: {
54
+ body?: unknown;
55
+ statusCode?: number;
56
+ headers?: { [id: string]: string };
57
+ } = {};
58
+ HttpErrorHelper.buildResponse(response, mapped.error, mapped.httpStatusCode);
59
+
60
+ console.log(response.statusCode); // 500
61
+ console.log(mapped.error.message); // Error: Invalid request
62
+ }
63
+ ```
64
+
65
+ ## IHostingComponent
66
+
67
+ When working with the hosting component, you can encrypt and decrypt query parameters for secure transmission. The encryption mechanism automatically handles salt generation to prevent rainbow table attacks.
68
+
69
+ ```typescript
70
+ import type { IComponent, IHttpRequestQuery } from '@3sixty/api-models';
71
+ import { ComponentFactory } from '@3sixty/core';
72
+
73
+ interface IHostingComponent extends IComponent {
74
+ addEncryptedParamsToUrl(url: string, params: IHttpRequestQuery): Promise<string>;
75
+ getDecryptedParamsFromQueryParams(
76
+ queryParams: IHttpRequestQuery | undefined,
77
+ keys: string[]
78
+ ): Promise<IHttpRequestQuery>;
79
+ encryptParam(paramValue: string): Promise<string>;
80
+ decryptParam(encryptedValue: string): Promise<string>;
81
+ }
82
+
83
+ // Get the hosting component from the component factory
84
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
85
+
86
+ // Encrypt parameters and add them to a URL
87
+ const baseUrl = 'https://api.example.com/callback';
88
+ const encrypted = await hosting.addEncryptedParamsToUrl(baseUrl, {
89
+ token: 'secret-token-123',
90
+ userId: 'user-456'
91
+ });
92
+ console.log(encrypted); // https://api.example.com/callback?x-enc-token=...&x-enc-userId=...
93
+ ```
94
+
95
+ ```typescript
96
+ import type { IHttpRequestQuery } from '@3sixty/api-models';
97
+ import { ComponentFactory } from '@3sixty/core';
98
+
99
+ interface IHostingComponent {
100
+ addEncryptedParamsToUrl(url: string, params: IHttpRequestQuery): Promise<string>;
101
+ getDecryptedParamsFromQueryParams(
102
+ queryParams: IHttpRequestQuery | undefined,
103
+ keys: string[]
104
+ ): Promise<IHttpRequestQuery>;
105
+ encryptQueryParams(
106
+ httpRequestQuery: IHttpRequestQuery | undefined,
107
+ keys: string[]
108
+ ): Promise<void>;
109
+ decryptQueryParams(
110
+ httpRequestQuery: IHttpRequestQuery | undefined,
111
+ keys: string[]
112
+ ): Promise<void>;
113
+ }
114
+
115
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
116
+
117
+ // Decrypt specific parameters from a query object
118
+ const queryParams: IHttpRequestQuery = {
119
+ 'x-enc-token': 'CngBAgMEBQYH...',
120
+ 'x-enc-userId': 'CxgICSoLDAwN...',
121
+ status: 'active'
122
+ };
123
+
124
+ const decrypted = await hosting.getDecryptedParamsFromQueryParams(queryParams, ['token', 'userId']);
125
+ console.log(decrypted); // { token: 'secret-token-123', userId: 'user-456' }
126
+ ```
127
+
128
+ ```typescript
129
+ import type { IHttpRequestQuery } from '@3sixty/api-models';
130
+ import { ComponentFactory } from '@3sixty/core';
131
+
132
+ interface IHostingComponent {
133
+ addTenantTokenToUrl(url: string, tenantId: string): Promise<string>;
134
+ getTenantTokenFromQueryParams(
135
+ queryParams: IHttpRequestQuery | undefined
136
+ ): Promise<string | undefined>;
137
+ }
138
+
139
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
140
+
141
+ // Add encrypted tenant token to a URL
142
+ const redirectUrl = 'https://tenant.example.com/dashboard';
143
+ const urlWithTenant = await hosting.addTenantTokenToUrl(
144
+ redirectUrl,
145
+ 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6'
146
+ );
147
+ console.log(urlWithTenant); // https://tenant.example.com/dashboard?x-enc-tenant-token=...
148
+ ```
149
+
150
+ ```typescript
151
+ import type { IHttpRequestQuery } from '@3sixty/api-models';
152
+ import { ComponentFactory } from '@3sixty/core';
153
+
154
+ interface IHostingComponent {
155
+ encryptQueryParams(
156
+ httpRequestQuery: IHttpRequestQuery | undefined,
157
+ keys: string[]
158
+ ): Promise<void>;
159
+ decryptQueryParams(
160
+ httpRequestQuery: IHttpRequestQuery | undefined,
161
+ keys: string[]
162
+ ): Promise<void>;
163
+ }
164
+
165
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
166
+
167
+ // Encrypt specific query parameters in place
168
+ const query: IHttpRequestQuery = {
169
+ token: 'secret-123',
170
+ apiKey: 'key-456',
171
+ status: 'active'
172
+ };
173
+
174
+ await hosting.encryptQueryParams(query, ['token', 'apiKey']);
175
+ console.log(query); // { 'x-enc-token': '...', 'x-enc-apiKey': '...', status: 'active' }
176
+
177
+ // Decrypt the parameters back to their original keys
178
+ await hosting.decryptQueryParams(query, ['token', 'apiKey']);
179
+ console.log(query); // { token: 'secret-123', apiKey: 'key-456', status: 'active' }
180
+ ```
181
+
182
+ ```typescript
183
+ import { ComponentFactory } from '@3sixty/core';
184
+
185
+ interface IHostingComponent {
186
+ encryptParam(paramValue: string): Promise<string>;
187
+ decryptParam(encryptedValue: string): Promise<string>;
188
+ }
189
+
190
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
191
+
192
+ // Encrypt a single parameter value
193
+ const plainText = 'confidential-data';
194
+ const encrypted = await hosting.encryptParam(plainText);
195
+ console.log(encrypted); // CngBAgMEBQYHCAkKCwwNDg8QERAh...
196
+
197
+ // Decrypt the parameter value
198
+ const decrypted = await hosting.decryptParam(encrypted);
199
+ console.log(decrypted); // confidential-data
200
+ ```