@rvoh/psychic 0.24.1

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 (354) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +19 -0
  3. package/dist/cjs/src/bin/helpers/enumsAndTheirValues.js +17 -0
  4. package/dist/cjs/src/bin/helpers/enumsFileStr.js +21 -0
  5. package/dist/cjs/src/bin/helpers/generateRouteTypes.js +16 -0
  6. package/dist/cjs/src/bin/helpers/printRoutes.js +54 -0
  7. package/dist/cjs/src/bin/index.js +79 -0
  8. package/dist/cjs/src/cli/helpers/TypesBuilder.js +26 -0
  9. package/dist/cjs/src/cli/index.js +76 -0
  10. package/dist/cjs/src/controller/decorators.js +85 -0
  11. package/dist/cjs/src/controller/hooks.js +29 -0
  12. package/dist/cjs/src/controller/index.js +571 -0
  13. package/dist/cjs/src/encrypt/internal-encrypt.js +43 -0
  14. package/dist/cjs/src/env/Loader.js +26 -0
  15. package/dist/cjs/src/error/db/failed-to-connect.js +17 -0
  16. package/dist/cjs/src/error/db/index.js +16 -0
  17. package/dist/cjs/src/error/db/missing-options.js +17 -0
  18. package/dist/cjs/src/error/encrypt/missing-cookie-encryption-options.js +27 -0
  19. package/dist/cjs/src/error/http/BadGateway.js +9 -0
  20. package/dist/cjs/src/error/http/BadRequest.js +9 -0
  21. package/dist/cjs/src/error/http/Conflict.js +9 -0
  22. package/dist/cjs/src/error/http/ContentTooLarge.js +9 -0
  23. package/dist/cjs/src/error/http/ExpectationFailed.js +9 -0
  24. package/dist/cjs/src/error/http/FailedDependency.js +9 -0
  25. package/dist/cjs/src/error/http/Forbidden.js +9 -0
  26. package/dist/cjs/src/error/http/GatewayTimeout.js +9 -0
  27. package/dist/cjs/src/error/http/Gone.js +9 -0
  28. package/dist/cjs/src/error/http/ImATeapot.js +9 -0
  29. package/dist/cjs/src/error/http/InsufficientStorage.js +9 -0
  30. package/dist/cjs/src/error/http/InternalServerError.js +9 -0
  31. package/dist/cjs/src/error/http/Locked.js +9 -0
  32. package/dist/cjs/src/error/http/MethodNotAllowed.js +9 -0
  33. package/dist/cjs/src/error/http/MisdirectedRequest.js +9 -0
  34. package/dist/cjs/src/error/http/NotAcceptable.js +9 -0
  35. package/dist/cjs/src/error/http/NotExtended.js +9 -0
  36. package/dist/cjs/src/error/http/NotFound.js +9 -0
  37. package/dist/cjs/src/error/http/NotImplemented.js +9 -0
  38. package/dist/cjs/src/error/http/PaymentRequired.js +9 -0
  39. package/dist/cjs/src/error/http/PreconditionFailed.js +9 -0
  40. package/dist/cjs/src/error/http/PreconditionRequired.js +9 -0
  41. package/dist/cjs/src/error/http/ProxyAuthenticationRequired.js +9 -0
  42. package/dist/cjs/src/error/http/RequestHeaderFieldsTooLarge.js +9 -0
  43. package/dist/cjs/src/error/http/ServiceUnavailable.js +9 -0
  44. package/dist/cjs/src/error/http/TooManyRequests.js +9 -0
  45. package/dist/cjs/src/error/http/Unauthorized.js +9 -0
  46. package/dist/cjs/src/error/http/UnavailableForLegalReasons.js +9 -0
  47. package/dist/cjs/src/error/http/UnprocessableContent.js +9 -0
  48. package/dist/cjs/src/error/http/UnsupportedMediaType.js +9 -0
  49. package/dist/cjs/src/error/http/index.js +22 -0
  50. package/dist/cjs/src/error/http/router/index.js +18 -0
  51. package/dist/cjs/src/error/http/router/missing-controller-method.js +20 -0
  52. package/dist/cjs/src/error/http/router/missing-controller.js +17 -0
  53. package/dist/cjs/src/error/http/status-codes.js +311 -0
  54. package/dist/cjs/src/error/model/index.js +5 -0
  55. package/dist/cjs/src/error/openapi/CannotFlattenMultiplePolymorphicRendersOneAssociations.js +22 -0
  56. package/dist/cjs/src/error/psychic-application/init-missing-api-root.js +21 -0
  57. package/dist/cjs/src/error/psychic-application/init-missing-call-to-load-controllers.js +21 -0
  58. package/dist/cjs/src/error/psychic-application/init-missing-routes-callback.js +23 -0
  59. package/dist/cjs/src/error/psychic-application/invalid-encryption-key.js +20 -0
  60. package/dist/cjs/src/error/router/cannot-find-inferred-controller-from-provided-namespace.js +42 -0
  61. package/dist/cjs/src/error/router/cannot-infer-controller-from-top-level-route.js +39 -0
  62. package/dist/cjs/src/error/ws/MissingWsRedisConnection.js +32 -0
  63. package/dist/cjs/src/generate/controller.js +107 -0
  64. package/dist/cjs/src/generate/helpers/addResourceToRoutes.js +64 -0
  65. package/dist/cjs/src/generate/helpers/generateControllerContent.js +191 -0
  66. package/dist/cjs/src/generate/helpers/generateControllerSpecContent.js +9 -0
  67. package/dist/cjs/src/generate/helpers/generateResourceControllerSpecContent.js +199 -0
  68. package/dist/cjs/src/generate/helpers/migrationTimestamp.js +6 -0
  69. package/dist/cjs/src/generate/resource.js +19 -0
  70. package/dist/cjs/src/helpers/EnvInternal.js +5 -0
  71. package/dist/cjs/src/helpers/autogeneratedFileDisclaimer.js +71 -0
  72. package/dist/cjs/src/helpers/cookieMaxAgeFromCookieOpts.js +20 -0
  73. package/dist/cjs/src/helpers/error/errorIsRescuableHttpError.js +8 -0
  74. package/dist/cjs/src/helpers/error/httpErrorClasses.js +76 -0
  75. package/dist/cjs/src/helpers/importFileWithDefault.js +14 -0
  76. package/dist/cjs/src/helpers/importFileWithNamedExport.js +12 -0
  77. package/dist/cjs/src/helpers/isOpenapiError.js +6 -0
  78. package/dist/cjs/src/helpers/isUuid.js +8 -0
  79. package/dist/cjs/src/helpers/loadEnv.js +5 -0
  80. package/dist/cjs/src/helpers/openapiJsonPath.js +9 -0
  81. package/dist/cjs/src/helpers/pascalizeFileName.js +10 -0
  82. package/dist/cjs/src/helpers/path/psychicFileAndDirPaths.js +16 -0
  83. package/dist/cjs/src/helpers/path/psychicPath.js +18 -0
  84. package/dist/cjs/src/helpers/path/relativePsychicPath.js +43 -0
  85. package/dist/cjs/src/helpers/path/updirsFromPath.js +11 -0
  86. package/dist/cjs/src/helpers/path.js +11 -0
  87. package/dist/cjs/src/helpers/pathifyNestedObject.js +14 -0
  88. package/dist/cjs/src/helpers/sspawn.js +26 -0
  89. package/dist/cjs/src/helpers/typeHelpers.js +2 -0
  90. package/dist/cjs/src/helpers/typechecks.js +20 -0
  91. package/dist/cjs/src/i18n/conf/I18nDefaultLocales.js +31 -0
  92. package/dist/cjs/src/i18n/conf/types.js +2 -0
  93. package/dist/cjs/src/i18n/provider.js +96 -0
  94. package/dist/cjs/src/index.js +104 -0
  95. package/dist/cjs/src/openapi-renderer/app.js +153 -0
  96. package/dist/cjs/src/openapi-renderer/body-segment.js +514 -0
  97. package/dist/cjs/src/openapi-renderer/defaults.js +84 -0
  98. package/dist/cjs/src/openapi-renderer/endpoint.js +930 -0
  99. package/dist/cjs/src/openapi-renderer/helpers/isBlankDescription.js +13 -0
  100. package/dist/cjs/src/openapi-renderer/helpers/openapiRoute.js +7 -0
  101. package/dist/cjs/src/openapi-renderer/serializer.js +321 -0
  102. package/dist/cjs/src/psychic-application/cache.js +17 -0
  103. package/dist/cjs/src/psychic-application/helpers/PsychicImporter.js +15 -0
  104. package/dist/cjs/src/psychic-application/helpers/globalControllerKeyFromPath.js +11 -0
  105. package/dist/cjs/src/psychic-application/helpers/import/importControllers.js +56 -0
  106. package/dist/cjs/src/psychic-application/helpers/loadAppEnv.js +5 -0
  107. package/dist/cjs/src/psychic-application/helpers/lookupClassByGlobalName.js +16 -0
  108. package/dist/cjs/src/psychic-application/index.js +346 -0
  109. package/dist/cjs/src/psychic-application/logo.js +77 -0
  110. package/dist/cjs/src/psychic-application/types.js +2 -0
  111. package/dist/cjs/src/router/helpers.js +138 -0
  112. package/dist/cjs/src/router/index.js +282 -0
  113. package/dist/cjs/src/router/route-manager.js +14 -0
  114. package/dist/cjs/src/router/types.js +6 -0
  115. package/dist/cjs/src/server/front-end-client.js +15 -0
  116. package/dist/cjs/src/server/helpers/startPsychicServer.js +39 -0
  117. package/dist/cjs/src/server/index.js +192 -0
  118. package/dist/cjs/src/server/params.js +370 -0
  119. package/dist/cjs/src/session/index.js +38 -0
  120. package/dist/esm/src/bin/helpers/enumsAndTheirValues.js +14 -0
  121. package/dist/esm/src/bin/helpers/enumsFileStr.js +18 -0
  122. package/dist/esm/src/bin/helpers/generateRouteTypes.js +13 -0
  123. package/dist/esm/src/bin/helpers/printRoutes.js +51 -0
  124. package/dist/esm/src/bin/index.js +76 -0
  125. package/dist/esm/src/cli/helpers/TypesBuilder.js +23 -0
  126. package/dist/esm/src/cli/index.js +73 -0
  127. package/dist/esm/src/controller/decorators.js +81 -0
  128. package/dist/esm/src/controller/hooks.js +25 -0
  129. package/dist/esm/src/controller/index.js +566 -0
  130. package/dist/esm/src/encrypt/internal-encrypt.js +40 -0
  131. package/dist/esm/src/env/Loader.js +24 -0
  132. package/dist/esm/src/error/db/failed-to-connect.js +14 -0
  133. package/dist/esm/src/error/db/index.js +13 -0
  134. package/dist/esm/src/error/db/missing-options.js +14 -0
  135. package/dist/esm/src/error/encrypt/missing-cookie-encryption-options.js +24 -0
  136. package/dist/esm/src/error/http/BadGateway.js +6 -0
  137. package/dist/esm/src/error/http/BadRequest.js +6 -0
  138. package/dist/esm/src/error/http/Conflict.js +6 -0
  139. package/dist/esm/src/error/http/ContentTooLarge.js +6 -0
  140. package/dist/esm/src/error/http/ExpectationFailed.js +6 -0
  141. package/dist/esm/src/error/http/FailedDependency.js +6 -0
  142. package/dist/esm/src/error/http/Forbidden.js +6 -0
  143. package/dist/esm/src/error/http/GatewayTimeout.js +6 -0
  144. package/dist/esm/src/error/http/Gone.js +6 -0
  145. package/dist/esm/src/error/http/ImATeapot.js +6 -0
  146. package/dist/esm/src/error/http/InsufficientStorage.js +6 -0
  147. package/dist/esm/src/error/http/InternalServerError.js +6 -0
  148. package/dist/esm/src/error/http/Locked.js +6 -0
  149. package/dist/esm/src/error/http/MethodNotAllowed.js +6 -0
  150. package/dist/esm/src/error/http/MisdirectedRequest.js +6 -0
  151. package/dist/esm/src/error/http/NotAcceptable.js +6 -0
  152. package/dist/esm/src/error/http/NotExtended.js +6 -0
  153. package/dist/esm/src/error/http/NotFound.js +6 -0
  154. package/dist/esm/src/error/http/NotImplemented.js +6 -0
  155. package/dist/esm/src/error/http/PaymentRequired.js +6 -0
  156. package/dist/esm/src/error/http/PreconditionFailed.js +6 -0
  157. package/dist/esm/src/error/http/PreconditionRequired.js +6 -0
  158. package/dist/esm/src/error/http/ProxyAuthenticationRequired.js +6 -0
  159. package/dist/esm/src/error/http/RequestHeaderFieldsTooLarge.js +6 -0
  160. package/dist/esm/src/error/http/ServiceUnavailable.js +6 -0
  161. package/dist/esm/src/error/http/TooManyRequests.js +6 -0
  162. package/dist/esm/src/error/http/Unauthorized.js +6 -0
  163. package/dist/esm/src/error/http/UnavailableForLegalReasons.js +6 -0
  164. package/dist/esm/src/error/http/UnprocessableContent.js +6 -0
  165. package/dist/esm/src/error/http/UnsupportedMediaType.js +6 -0
  166. package/dist/esm/src/error/http/index.js +19 -0
  167. package/dist/esm/src/error/http/router/index.js +15 -0
  168. package/dist/esm/src/error/http/router/missing-controller-method.js +17 -0
  169. package/dist/esm/src/error/http/router/missing-controller.js +14 -0
  170. package/dist/esm/src/error/http/status-codes.js +309 -0
  171. package/dist/esm/src/error/model/index.js +2 -0
  172. package/dist/esm/src/error/openapi/CannotFlattenMultiplePolymorphicRendersOneAssociations.js +19 -0
  173. package/dist/esm/src/error/psychic-application/init-missing-api-root.js +18 -0
  174. package/dist/esm/src/error/psychic-application/init-missing-call-to-load-controllers.js +18 -0
  175. package/dist/esm/src/error/psychic-application/init-missing-routes-callback.js +20 -0
  176. package/dist/esm/src/error/psychic-application/invalid-encryption-key.js +17 -0
  177. package/dist/esm/src/error/router/cannot-find-inferred-controller-from-provided-namespace.js +39 -0
  178. package/dist/esm/src/error/router/cannot-infer-controller-from-top-level-route.js +36 -0
  179. package/dist/esm/src/error/ws/MissingWsRedisConnection.js +29 -0
  180. package/dist/esm/src/generate/controller.js +104 -0
  181. package/dist/esm/src/generate/helpers/addResourceToRoutes.js +60 -0
  182. package/dist/esm/src/generate/helpers/generateControllerContent.js +188 -0
  183. package/dist/esm/src/generate/helpers/generateControllerSpecContent.js +6 -0
  184. package/dist/esm/src/generate/helpers/generateResourceControllerSpecContent.js +196 -0
  185. package/dist/esm/src/generate/helpers/migrationTimestamp.js +3 -0
  186. package/dist/esm/src/generate/resource.js +16 -0
  187. package/dist/esm/src/helpers/EnvInternal.js +3 -0
  188. package/dist/esm/src/helpers/autogeneratedFileDisclaimer.js +68 -0
  189. package/dist/esm/src/helpers/cookieMaxAgeFromCookieOpts.js +17 -0
  190. package/dist/esm/src/helpers/error/errorIsRescuableHttpError.js +5 -0
  191. package/dist/esm/src/helpers/error/httpErrorClasses.js +72 -0
  192. package/dist/esm/src/helpers/importFileWithDefault.js +11 -0
  193. package/dist/esm/src/helpers/importFileWithNamedExport.js +9 -0
  194. package/dist/esm/src/helpers/isOpenapiError.js +3 -0
  195. package/dist/esm/src/helpers/isUuid.js +5 -0
  196. package/dist/esm/src/helpers/loadEnv.js +3 -0
  197. package/dist/esm/src/helpers/openapiJsonPath.js +6 -0
  198. package/dist/esm/src/helpers/pascalizeFileName.js +7 -0
  199. package/dist/esm/src/helpers/path/psychicFileAndDirPaths.js +13 -0
  200. package/dist/esm/src/helpers/path/psychicPath.js +15 -0
  201. package/dist/esm/src/helpers/path/relativePsychicPath.js +39 -0
  202. package/dist/esm/src/helpers/path/updirsFromPath.js +8 -0
  203. package/dist/esm/src/helpers/path.js +7 -0
  204. package/dist/esm/src/helpers/pathifyNestedObject.js +11 -0
  205. package/dist/esm/src/helpers/sspawn.js +22 -0
  206. package/dist/esm/src/helpers/typeHelpers.js +1 -0
  207. package/dist/esm/src/helpers/typechecks.js +16 -0
  208. package/dist/esm/src/i18n/conf/I18nDefaultLocales.js +29 -0
  209. package/dist/esm/src/i18n/conf/types.js +1 -0
  210. package/dist/esm/src/i18n/provider.js +89 -0
  211. package/dist/esm/src/index.js +50 -0
  212. package/dist/esm/src/openapi-renderer/app.js +150 -0
  213. package/dist/esm/src/openapi-renderer/body-segment.js +511 -0
  214. package/dist/esm/src/openapi-renderer/defaults.js +81 -0
  215. package/dist/esm/src/openapi-renderer/endpoint.js +925 -0
  216. package/dist/esm/src/openapi-renderer/helpers/isBlankDescription.js +10 -0
  217. package/dist/esm/src/openapi-renderer/helpers/openapiRoute.js +4 -0
  218. package/dist/esm/src/openapi-renderer/serializer.js +318 -0
  219. package/dist/esm/src/psychic-application/cache.js +12 -0
  220. package/dist/esm/src/psychic-application/helpers/PsychicImporter.js +12 -0
  221. package/dist/esm/src/psychic-application/helpers/globalControllerKeyFromPath.js +8 -0
  222. package/dist/esm/src/psychic-application/helpers/import/importControllers.js +51 -0
  223. package/dist/esm/src/psychic-application/helpers/loadAppEnv.js +3 -0
  224. package/dist/esm/src/psychic-application/helpers/lookupClassByGlobalName.js +13 -0
  225. package/dist/esm/src/psychic-application/index.js +343 -0
  226. package/dist/esm/src/psychic-application/logo.js +73 -0
  227. package/dist/esm/src/psychic-application/types.js +1 -0
  228. package/dist/esm/src/router/helpers.js +127 -0
  229. package/dist/esm/src/router/index.js +277 -0
  230. package/dist/esm/src/router/route-manager.js +11 -0
  231. package/dist/esm/src/router/types.js +3 -0
  232. package/dist/esm/src/server/front-end-client.js +12 -0
  233. package/dist/esm/src/server/helpers/startPsychicServer.js +35 -0
  234. package/dist/esm/src/server/index.js +189 -0
  235. package/dist/esm/src/server/params.js +365 -0
  236. package/dist/esm/src/session/index.js +35 -0
  237. package/dist/types/src/bin/helpers/enumsAndTheirValues.d.ts +1 -0
  238. package/dist/types/src/bin/helpers/enumsFileStr.d.ts +1 -0
  239. package/dist/types/src/bin/helpers/generateRouteTypes.d.ts +2 -0
  240. package/dist/types/src/bin/helpers/printRoutes.d.ts +1 -0
  241. package/dist/types/src/bin/index.d.ts +12 -0
  242. package/dist/types/src/cli/helpers/TypesBuilder.d.ts +7 -0
  243. package/dist/types/src/cli/index.d.ts +8 -0
  244. package/dist/types/src/controller/decorators.d.ts +28 -0
  245. package/dist/types/src/controller/hooks.d.ts +13 -0
  246. package/dist/types/src/controller/index.d.ts +209 -0
  247. package/dist/types/src/encrypt/internal-encrypt.d.ts +6 -0
  248. package/dist/types/src/env/Loader.d.ts +8 -0
  249. package/dist/types/src/error/db/failed-to-connect.d.ts +4 -0
  250. package/dist/types/src/error/db/index.d.ts +5 -0
  251. package/dist/types/src/error/db/missing-options.d.ts +4 -0
  252. package/dist/types/src/error/encrypt/missing-cookie-encryption-options.d.ts +3 -0
  253. package/dist/types/src/error/http/BadGateway.d.ts +4 -0
  254. package/dist/types/src/error/http/BadRequest.d.ts +4 -0
  255. package/dist/types/src/error/http/Conflict.d.ts +4 -0
  256. package/dist/types/src/error/http/ContentTooLarge.d.ts +4 -0
  257. package/dist/types/src/error/http/ExpectationFailed.d.ts +4 -0
  258. package/dist/types/src/error/http/FailedDependency.d.ts +4 -0
  259. package/dist/types/src/error/http/Forbidden.d.ts +4 -0
  260. package/dist/types/src/error/http/GatewayTimeout.d.ts +4 -0
  261. package/dist/types/src/error/http/Gone.d.ts +4 -0
  262. package/dist/types/src/error/http/ImATeapot.d.ts +4 -0
  263. package/dist/types/src/error/http/InsufficientStorage.d.ts +4 -0
  264. package/dist/types/src/error/http/InternalServerError.d.ts +4 -0
  265. package/dist/types/src/error/http/Locked.d.ts +4 -0
  266. package/dist/types/src/error/http/MethodNotAllowed.d.ts +4 -0
  267. package/dist/types/src/error/http/MisdirectedRequest.d.ts +4 -0
  268. package/dist/types/src/error/http/NotAcceptable.d.ts +4 -0
  269. package/dist/types/src/error/http/NotExtended.d.ts +4 -0
  270. package/dist/types/src/error/http/NotFound.d.ts +4 -0
  271. package/dist/types/src/error/http/NotImplemented.d.ts +4 -0
  272. package/dist/types/src/error/http/PaymentRequired.d.ts +4 -0
  273. package/dist/types/src/error/http/PreconditionFailed.d.ts +4 -0
  274. package/dist/types/src/error/http/PreconditionRequired.d.ts +4 -0
  275. package/dist/types/src/error/http/ProxyAuthenticationRequired.d.ts +4 -0
  276. package/dist/types/src/error/http/RequestHeaderFieldsTooLarge.d.ts +4 -0
  277. package/dist/types/src/error/http/ServiceUnavailable.d.ts +4 -0
  278. package/dist/types/src/error/http/TooManyRequests.d.ts +4 -0
  279. package/dist/types/src/error/http/Unauthorized.d.ts +4 -0
  280. package/dist/types/src/error/http/UnavailableForLegalReasons.d.ts +4 -0
  281. package/dist/types/src/error/http/UnprocessableContent.d.ts +4 -0
  282. package/dist/types/src/error/http/UnsupportedMediaType.d.ts +4 -0
  283. package/dist/types/src/error/http/index.d.ts +10 -0
  284. package/dist/types/src/error/http/router/index.d.ts +6 -0
  285. package/dist/types/src/error/http/router/missing-controller-method.d.ts +7 -0
  286. package/dist/types/src/error/http/router/missing-controller.d.ts +6 -0
  287. package/dist/types/src/error/http/status-codes.d.ts +312 -0
  288. package/dist/types/src/error/model/index.d.ts +2 -0
  289. package/dist/types/src/error/openapi/CannotFlattenMultiplePolymorphicRendersOneAssociations.d.ts +7 -0
  290. package/dist/types/src/error/psychic-application/init-missing-api-root.d.ts +4 -0
  291. package/dist/types/src/error/psychic-application/init-missing-call-to-load-controllers.d.ts +4 -0
  292. package/dist/types/src/error/psychic-application/init-missing-routes-callback.d.ts +4 -0
  293. package/dist/types/src/error/psychic-application/invalid-encryption-key.d.ts +4 -0
  294. package/dist/types/src/error/router/cannot-find-inferred-controller-from-provided-namespace.d.ts +15 -0
  295. package/dist/types/src/error/router/cannot-infer-controller-from-top-level-route.d.ts +8 -0
  296. package/dist/types/src/error/ws/MissingWsRedisConnection.d.ts +3 -0
  297. package/dist/types/src/generate/controller.d.ts +7 -0
  298. package/dist/types/src/generate/helpers/addResourceToRoutes.d.ts +7 -0
  299. package/dist/types/src/generate/helpers/generateControllerContent.d.ts +8 -0
  300. package/dist/types/src/generate/helpers/generateControllerSpecContent.d.ts +1 -0
  301. package/dist/types/src/generate/helpers/generateResourceControllerSpecContent.d.ts +6 -0
  302. package/dist/types/src/generate/helpers/migrationTimestamp.d.ts +1 -0
  303. package/dist/types/src/generate/resource.d.ts +5 -0
  304. package/dist/types/src/helpers/EnvInternal.d.ts +7 -0
  305. package/dist/types/src/helpers/autogeneratedFileDisclaimer.d.ts +1 -0
  306. package/dist/types/src/helpers/cookieMaxAgeFromCookieOpts.d.ts +2 -0
  307. package/dist/types/src/helpers/error/errorIsRescuableHttpError.d.ts +1 -0
  308. package/dist/types/src/helpers/error/httpErrorClasses.d.ts +3 -0
  309. package/dist/types/src/helpers/importFileWithDefault.d.ts +1 -0
  310. package/dist/types/src/helpers/importFileWithNamedExport.d.ts +1 -0
  311. package/dist/types/src/helpers/isOpenapiError.d.ts +8 -0
  312. package/dist/types/src/helpers/isUuid.d.ts +1 -0
  313. package/dist/types/src/helpers/loadEnv.d.ts +1 -0
  314. package/dist/types/src/helpers/openapiJsonPath.d.ts +1 -0
  315. package/dist/types/src/helpers/pascalizeFileName.d.ts +1 -0
  316. package/dist/types/src/helpers/path/psychicFileAndDirPaths.d.ts +5 -0
  317. package/dist/types/src/helpers/path/psychicPath.d.ts +4 -0
  318. package/dist/types/src/helpers/path/relativePsychicPath.d.ts +3 -0
  319. package/dist/types/src/helpers/path/updirsFromPath.d.ts +1 -0
  320. package/dist/types/src/helpers/path.d.ts +2 -0
  321. package/dist/types/src/helpers/pathifyNestedObject.d.ts +5 -0
  322. package/dist/types/src/helpers/sspawn.d.ts +2 -0
  323. package/dist/types/src/helpers/typeHelpers.d.ts +4 -0
  324. package/dist/types/src/helpers/typechecks.d.ts +2 -0
  325. package/dist/types/src/i18n/conf/I18nDefaultLocales.d.ts +2 -0
  326. package/dist/types/src/i18n/conf/types.d.ts +45 -0
  327. package/dist/types/src/i18n/provider.d.ts +26 -0
  328. package/dist/types/src/index.d.ts +61 -0
  329. package/dist/types/src/openapi-renderer/app.d.ts +21 -0
  330. package/dist/types/src/openapi-renderer/body-segment.d.ts +153 -0
  331. package/dist/types/src/openapi-renderer/defaults.d.ts +5 -0
  332. package/dist/types/src/openapi-renderer/endpoint.d.ts +410 -0
  333. package/dist/types/src/openapi-renderer/helpers/isBlankDescription.d.ts +1 -0
  334. package/dist/types/src/openapi-renderer/helpers/openapiRoute.d.ts +1 -0
  335. package/dist/types/src/openapi-renderer/serializer.d.ts +76 -0
  336. package/dist/types/src/psychic-application/cache.d.ts +4 -0
  337. package/dist/types/src/psychic-application/helpers/PsychicImporter.d.ts +4 -0
  338. package/dist/types/src/psychic-application/helpers/globalControllerKeyFromPath.d.ts +1 -0
  339. package/dist/types/src/psychic-application/helpers/import/importControllers.d.ts +5 -0
  340. package/dist/types/src/psychic-application/helpers/loadAppEnv.d.ts +1 -0
  341. package/dist/types/src/psychic-application/helpers/lookupClassByGlobalName.d.ts +1 -0
  342. package/dist/types/src/psychic-application/index.d.ts +164 -0
  343. package/dist/types/src/psychic-application/logo.d.ts +2 -0
  344. package/dist/types/src/psychic-application/types.d.ts +6 -0
  345. package/dist/types/src/router/helpers.d.ts +26 -0
  346. package/dist/types/src/router/index.d.ts +55 -0
  347. package/dist/types/src/router/route-manager.d.ts +17 -0
  348. package/dist/types/src/router/types.d.ts +11 -0
  349. package/dist/types/src/server/front-end-client.d.ts +5 -0
  350. package/dist/types/src/server/helpers/startPsychicServer.d.ts +14 -0
  351. package/dist/types/src/server/index.d.ts +34 -0
  352. package/dist/types/src/server/params.d.ts +80 -0
  353. package/dist/types/src/session/index.d.ts +12 -0
  354. package/package.json +98 -0
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class MissingCookieEncryptionOpts extends Error {
4
+ get message() {
5
+ return `
6
+ In order to use the Encrypt library to encrypt cookies,
7
+ encryption keys must be provided to psychic:
8
+
9
+ // conf/app.ts
10
+ export default (psy: PsychicApplication) => {
11
+ dream.set('encryption', {
12
+ cookies: {
13
+ current: {
14
+ algorithm: 'aes-256-gcm',
15
+ key: process.env.COOKIE_ENCRYPTION_KEY!
16
+ },
17
+ }
18
+ })
19
+ }
20
+
21
+ A valid encryption key can be generated using:
22
+
23
+ Encrypt.generateKey()
24
+ `;
25
+ }
26
+ }
27
+ exports.default = MissingCookieEncryptionOpts;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusBadGateway extends index_js_1.default {
5
+ get status() {
6
+ return 502;
7
+ }
8
+ }
9
+ exports.default = HttpStatusBadGateway;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusBadRequest extends index_js_1.default {
5
+ get status() {
6
+ return 400;
7
+ }
8
+ }
9
+ exports.default = HttpStatusBadRequest;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusConflict extends index_js_1.default {
5
+ get status() {
6
+ return 409;
7
+ }
8
+ }
9
+ exports.default = HttpStatusConflict;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusContentTooLarge extends index_js_1.default {
5
+ get status() {
6
+ return 413;
7
+ }
8
+ }
9
+ exports.default = HttpStatusContentTooLarge;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusExpectationFailed extends index_js_1.default {
5
+ get status() {
6
+ return 417;
7
+ }
8
+ }
9
+ exports.default = HttpStatusExpectationFailed;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusFailedDependency extends index_js_1.default {
5
+ get status() {
6
+ return 424;
7
+ }
8
+ }
9
+ exports.default = HttpStatusFailedDependency;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusForbidden extends index_js_1.default {
5
+ get status() {
6
+ return 403;
7
+ }
8
+ }
9
+ exports.default = HttpStatusForbidden;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusGatewayTimeout extends index_js_1.default {
5
+ get status() {
6
+ return 504;
7
+ }
8
+ }
9
+ exports.default = HttpStatusGatewayTimeout;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusGone extends index_js_1.default {
5
+ get status() {
6
+ return 410;
7
+ }
8
+ }
9
+ exports.default = HttpStatusGone;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusImATeapot extends index_js_1.default {
5
+ get status() {
6
+ return 418;
7
+ }
8
+ }
9
+ exports.default = HttpStatusImATeapot;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusInsufficientStorage extends index_js_1.default {
5
+ get status() {
6
+ return 507;
7
+ }
8
+ }
9
+ exports.default = HttpStatusInsufficientStorage;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusInternalServerError extends index_js_1.default {
5
+ get status() {
6
+ return 500;
7
+ }
8
+ }
9
+ exports.default = HttpStatusInternalServerError;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusLocked extends index_js_1.default {
5
+ get status() {
6
+ return 423;
7
+ }
8
+ }
9
+ exports.default = HttpStatusLocked;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusMethodNotAllowed extends index_js_1.default {
5
+ get status() {
6
+ return 405;
7
+ }
8
+ }
9
+ exports.default = HttpStatusMethodNotAllowed;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusMisdirectedRequest extends index_js_1.default {
5
+ get status() {
6
+ return 421;
7
+ }
8
+ }
9
+ exports.default = HttpStatusMisdirectedRequest;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusNotAcceptable extends index_js_1.default {
5
+ get status() {
6
+ return 406;
7
+ }
8
+ }
9
+ exports.default = HttpStatusNotAcceptable;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusNotExtended extends index_js_1.default {
5
+ get status() {
6
+ return 510;
7
+ }
8
+ }
9
+ exports.default = HttpStatusNotExtended;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusNotFound extends index_js_1.default {
5
+ get status() {
6
+ return 404;
7
+ }
8
+ }
9
+ exports.default = HttpStatusNotFound;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusNotImplemented extends index_js_1.default {
5
+ get status() {
6
+ return 501;
7
+ }
8
+ }
9
+ exports.default = HttpStatusNotImplemented;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusPaymentRequired extends index_js_1.default {
5
+ get status() {
6
+ return 402;
7
+ }
8
+ }
9
+ exports.default = HttpStatusPaymentRequired;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusPreconditionFailed extends index_js_1.default {
5
+ get status() {
6
+ return 412;
7
+ }
8
+ }
9
+ exports.default = HttpStatusPreconditionFailed;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusPreconditionRequired extends index_js_1.default {
5
+ get status() {
6
+ return 428;
7
+ }
8
+ }
9
+ exports.default = HttpStatusPreconditionRequired;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusProxyAuthenticationRequired extends index_js_1.default {
5
+ get status() {
6
+ return 407;
7
+ }
8
+ }
9
+ exports.default = HttpStatusProxyAuthenticationRequired;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusRequestHeaderFieldsTooLarge extends index_js_1.default {
5
+ get status() {
6
+ return 431;
7
+ }
8
+ }
9
+ exports.default = HttpStatusRequestHeaderFieldsTooLarge;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusServiceUnavailable extends index_js_1.default {
5
+ get status() {
6
+ return 503;
7
+ }
8
+ }
9
+ exports.default = HttpStatusServiceUnavailable;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusTooManyRequests extends index_js_1.default {
5
+ get status() {
6
+ return 429;
7
+ }
8
+ }
9
+ exports.default = HttpStatusTooManyRequests;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusUnauthorized extends index_js_1.default {
5
+ get status() {
6
+ return 401;
7
+ }
8
+ }
9
+ exports.default = HttpStatusUnauthorized;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusUnavailableForLegalReasons extends index_js_1.default {
5
+ get status() {
6
+ return 451;
7
+ }
8
+ }
9
+ exports.default = HttpStatusUnavailableForLegalReasons;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusUnprocessableContent extends index_js_1.default {
5
+ get status() {
6
+ return 422;
7
+ }
8
+ }
9
+ exports.default = HttpStatusUnprocessableContent;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class HttpStatusUnsupportedMediaType extends index_js_1.default {
5
+ get status() {
6
+ return 415;
7
+ }
8
+ }
9
+ exports.default = HttpStatusUnsupportedMediaType;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class HttpError extends Error {
4
+ data;
5
+ get status() {
6
+ throw new Error('Must define status on child class');
7
+ }
8
+ /**
9
+ * @params.data - Whatever is passed here will be json
10
+ * stringified and rendered as the response body.
11
+ */
12
+ constructor(
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ data = undefined) {
15
+ super();
16
+ this.data = data;
17
+ }
18
+ get message() {
19
+ return `Http status ${this.status} thrown`;
20
+ }
21
+ }
22
+ exports.default = HttpError;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("../index.js");
4
+ class RouterError extends index_js_1.default {
5
+ get status() {
6
+ return 500;
7
+ }
8
+ get messageString() {
9
+ throw new Error('Must define messageString in child error class');
10
+ }
11
+ get message() {
12
+ return `
13
+ A Router error occured, causing psychic to crash. The message recieved was:
14
+ ${this.messageString}
15
+ `;
16
+ }
17
+ }
18
+ exports.default = RouterError;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class RouterMissingControllerMethod extends index_js_1.default {
5
+ controllerPath;
6
+ method;
7
+ get messageString() {
8
+ return `\
9
+ The method on the controller you are attempting to load was not found:
10
+ controller: ${this.controllerPath}
11
+ method: ${this.method}
12
+ `;
13
+ }
14
+ constructor(controllerPath, method) {
15
+ super();
16
+ this.controllerPath = controllerPath;
17
+ this.method = method;
18
+ }
19
+ }
20
+ exports.default = RouterMissingControllerMethod;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const index_js_1 = require("./index.js");
4
+ class RouterMissingController extends index_js_1.default {
5
+ controllerPath;
6
+ get messageString() {
7
+ return `\
8
+ The controller you are attempting to load was not found:
9
+ ${this.controllerPath}
10
+ `;
11
+ }
12
+ constructor(controllerPath) {
13
+ super();
14
+ this.controllerPath = controllerPath;
15
+ }
16
+ }
17
+ exports.default = RouterMissingController;