lumen-framework 3.0.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 (302) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +164 -0
  3. package/bin/lumen +275 -0
  4. package/dist/cli.cjs +3002 -0
  5. package/dist/cli.cjs.map +7 -0
  6. package/dist/index.js +6515 -0
  7. package/dist/index.js.map +7 -0
  8. package/dist/index.mjs +6480 -0
  9. package/dist/index.mjs.map +7 -0
  10. package/dist/types/constants.d.ts +7 -0
  11. package/dist/types/errors/controller-missing-error.d.ts +7 -0
  12. package/dist/types/errors/serializer-missing-error.d.ts +7 -0
  13. package/dist/types/index.d.ts +6 -0
  14. package/dist/types/interfaces.d.ts +12 -0
  15. package/dist/types/packages/application/index.d.ts +97 -0
  16. package/dist/types/packages/application/initialize.d.ts +6 -0
  17. package/dist/types/packages/application/interfaces.d.ts +16 -0
  18. package/dist/types/packages/application/utils/create-controller.d.ts +12 -0
  19. package/dist/types/packages/application/utils/create-serializer.d.ts +4 -0
  20. package/dist/types/packages/application/utils/normalize-port.d.ts +4 -0
  21. package/dist/types/packages/cli/commands/build.d.ts +1 -0
  22. package/dist/types/packages/cli/commands/create.d.ts +4 -0
  23. package/dist/types/packages/cli/commands/dbcreate.d.ts +4 -0
  24. package/dist/types/packages/cli/commands/dbdrop.d.ts +4 -0
  25. package/dist/types/packages/cli/commands/dbmigrate.d.ts +4 -0
  26. package/dist/types/packages/cli/commands/dbrollback.d.ts +4 -0
  27. package/dist/types/packages/cli/commands/dbseed.d.ts +4 -0
  28. package/dist/types/packages/cli/commands/destroy.d.ts +11 -0
  29. package/dist/types/packages/cli/commands/generate.d.ts +10 -0
  30. package/dist/types/packages/cli/commands/index.d.ts +12 -0
  31. package/dist/types/packages/cli/commands/repl.d.ts +1 -0
  32. package/dist/types/packages/cli/commands/serve.d.ts +8 -0
  33. package/dist/types/packages/cli/commands/test.d.ts +4 -0
  34. package/dist/types/packages/cli/constants.d.ts +2 -0
  35. package/dist/types/packages/cli/errors/database-config-missing.d.ts +4 -0
  36. package/dist/types/packages/cli/generator/constants.d.ts +5 -0
  37. package/dist/types/packages/cli/generator/index.d.ts +11 -0
  38. package/dist/types/packages/cli/generator/interfaces.d.ts +9 -0
  39. package/dist/types/packages/cli/generator/utils/create-generator.d.ts +9 -0
  40. package/dist/types/packages/cli/generator/utils/generate-type.d.ts +33 -0
  41. package/dist/types/packages/cli/generator/utils/generator-for.d.ts +2 -0
  42. package/dist/types/packages/cli/generator/utils/log.d.ts +4 -0
  43. package/dist/types/packages/cli/generator/utils/migration-conflict.d.ts +6 -0
  44. package/dist/types/packages/cli/templates/application.d.ts +5 -0
  45. package/dist/types/packages/cli/templates/config.d.ts +5 -0
  46. package/dist/types/packages/cli/templates/controller.d.ts +5 -0
  47. package/dist/types/packages/cli/templates/database.d.ts +5 -0
  48. package/dist/types/packages/cli/templates/empty-migration.d.ts +5 -0
  49. package/dist/types/packages/cli/templates/eslint-config.d.ts +5 -0
  50. package/dist/types/packages/cli/templates/gitignore.d.ts +5 -0
  51. package/dist/types/packages/cli/templates/license.d.ts +5 -0
  52. package/dist/types/packages/cli/templates/middleware.d.ts +5 -0
  53. package/dist/types/packages/cli/templates/model-migration.d.ts +5 -0
  54. package/dist/types/packages/cli/templates/model.d.ts +5 -0
  55. package/dist/types/packages/cli/templates/package-json.d.ts +5 -0
  56. package/dist/types/packages/cli/templates/readme.d.ts +5 -0
  57. package/dist/types/packages/cli/templates/routes.d.ts +5 -0
  58. package/dist/types/packages/cli/templates/seed.d.ts +5 -0
  59. package/dist/types/packages/cli/templates/serializer.d.ts +5 -0
  60. package/dist/types/packages/cli/templates/util.d.ts +5 -0
  61. package/dist/types/packages/cli/utils/create-prompt.d.ts +4 -0
  62. package/dist/types/packages/cli/utils/driver-for.d.ts +1 -0
  63. package/dist/types/packages/cli/utils/indent.d.ts +1 -0
  64. package/dist/types/packages/compiler/index.d.ts +11 -0
  65. package/dist/types/packages/compiler/interfaces.d.ts +1 -0
  66. package/dist/types/packages/compiler/utils/create-boot-script.d.ts +6 -0
  67. package/dist/types/packages/compiler/utils/create-manifest.d.ts +6 -0
  68. package/dist/types/packages/compiler/utils/format-name.d.ts +5 -0
  69. package/dist/types/packages/config/index.d.ts +3 -0
  70. package/dist/types/packages/config/interfaces.d.ts +6 -0
  71. package/dist/types/packages/controller/constants.d.ts +2 -0
  72. package/dist/types/packages/controller/index.d.ts +591 -0
  73. package/dist/types/packages/controller/interfaces.d.ts +13 -0
  74. package/dist/types/packages/controller/utils/find-many.d.ts +6 -0
  75. package/dist/types/packages/controller/utils/find-one.d.ts +6 -0
  76. package/dist/types/packages/controller/utils/params-to-query.d.ts +16 -0
  77. package/dist/types/packages/controller/utils/resolve-relationships.d.ts +5 -0
  78. package/dist/types/packages/database/attribute/index.d.ts +6 -0
  79. package/dist/types/packages/database/attribute/interfaces.d.ts +6 -0
  80. package/dist/types/packages/database/attribute/utils/create-attribute.d.ts +5 -0
  81. package/dist/types/packages/database/attribute/utils/create-getter.d.ts +3 -0
  82. package/dist/types/packages/database/attribute/utils/create-normalizer.d.ts +1 -0
  83. package/dist/types/packages/database/attribute/utils/create-setter.d.ts +8 -0
  84. package/dist/types/packages/database/change-set/index.d.ts +10 -0
  85. package/dist/types/packages/database/constants.d.ts +3 -0
  86. package/dist/types/packages/database/errors/config-missing-error.d.ts +4 -0
  87. package/dist/types/packages/database/errors/index.d.ts +5 -0
  88. package/dist/types/packages/database/errors/invalid-driver-error.d.ts +7 -0
  89. package/dist/types/packages/database/errors/migrations-pending-error.d.ts +7 -0
  90. package/dist/types/packages/database/errors/model-missing-error.d.ts +7 -0
  91. package/dist/types/packages/database/errors/unique-constraint-error.d.ts +4 -0
  92. package/dist/types/packages/database/index.d.ts +26 -0
  93. package/dist/types/packages/database/initialize.d.ts +6 -0
  94. package/dist/types/packages/database/interfaces.d.ts +85 -0
  95. package/dist/types/packages/database/migration/index.d.ts +12 -0
  96. package/dist/types/packages/database/migration/interfaces.d.ts +4 -0
  97. package/dist/types/packages/database/migration/utils/generate-timestamp.d.ts +2 -0
  98. package/dist/types/packages/database/model/index.d.ts +1046 -0
  99. package/dist/types/packages/database/model/initialize-class.d.ts +10 -0
  100. package/dist/types/packages/database/model/interfaces.d.ts +14 -0
  101. package/dist/types/packages/database/model/utils/get-columns.d.ts +5 -0
  102. package/dist/types/packages/database/model/utils/persistence.d.ts +18 -0
  103. package/dist/types/packages/database/model/utils/process-write-error.d.ts +4 -0
  104. package/dist/types/packages/database/model/utils/run-hooks.d.ts +6 -0
  105. package/dist/types/packages/database/model/utils/validate.d.ts +5 -0
  106. package/dist/types/packages/database/query/errors/index.d.ts +1 -0
  107. package/dist/types/packages/database/query/errors/record-not-found-error.d.ts +6 -0
  108. package/dist/types/packages/database/query/index.d.ts +38 -0
  109. package/dist/types/packages/database/query/runner/constants.d.ts +2 -0
  110. package/dist/types/packages/database/query/runner/index.d.ts +9 -0
  111. package/dist/types/packages/database/query/runner/utils/build-results.d.ts +10 -0
  112. package/dist/types/packages/database/query/runner/utils/get-find-param.d.ts +2 -0
  113. package/dist/types/packages/database/query/utils/format-select.d.ts +5 -0
  114. package/dist/types/packages/database/query/utils/scopes-for.d.ts +2 -0
  115. package/dist/types/packages/database/relationship/index.d.ts +11 -0
  116. package/dist/types/packages/database/relationship/interfaces.d.ts +12 -0
  117. package/dist/types/packages/database/relationship/utils/getters.d.ts +14 -0
  118. package/dist/types/packages/database/relationship/utils/inverse-setters.d.ts +15 -0
  119. package/dist/types/packages/database/relationship/utils/setters.d.ts +14 -0
  120. package/dist/types/packages/database/relationship/utils/unassociate.d.ts +5 -0
  121. package/dist/types/packages/database/relationship/utils/update-relationship.d.ts +5 -0
  122. package/dist/types/packages/database/relationship/utils/validate-type.d.ts +2 -0
  123. package/dist/types/packages/database/transaction/index.d.ts +16 -0
  124. package/dist/types/packages/database/transaction/interfaces.d.ts +5 -0
  125. package/dist/types/packages/database/utils/connect.d.ts +6 -0
  126. package/dist/types/packages/database/utils/create-migrations.d.ts +5 -0
  127. package/dist/types/packages/database/utils/normalize-model-name.d.ts +5 -0
  128. package/dist/types/packages/database/utils/pending-migrations.d.ts +4 -0
  129. package/dist/types/packages/database/utils/type-for-column.d.ts +5 -0
  130. package/dist/types/packages/database/validation/errors/index.d.ts +1 -0
  131. package/dist/types/packages/database/validation/errors/validation-error.d.ts +7 -0
  132. package/dist/types/packages/database/validation/index.d.ts +13 -0
  133. package/dist/types/packages/database/validation/interfaces.d.ts +5 -0
  134. package/dist/types/packages/freezeable/constants.d.ts +1 -0
  135. package/dist/types/packages/freezeable/index.d.ts +3 -0
  136. package/dist/types/packages/freezeable/map/index.d.ts +11 -0
  137. package/dist/types/packages/freezeable/set/index.d.ts +11 -0
  138. package/dist/types/packages/freezeable/utils/freeze.d.ts +20 -0
  139. package/dist/types/packages/freezeable/utils/is-frozen.d.ts +4 -0
  140. package/dist/types/packages/fs/index.d.ts +52 -0
  141. package/dist/types/packages/fs/interfaces.d.ts +19 -0
  142. package/dist/types/packages/fs/utils/create-path-remover.d.ts +5 -0
  143. package/dist/types/packages/fs/utils/create-resolver.d.ts +4 -0
  144. package/dist/types/packages/fs/utils/exists.d.ts +4 -0
  145. package/dist/types/packages/fs/utils/is-js-file.d.ts +4 -0
  146. package/dist/types/packages/fs/utils/parse-path.d.ts +5 -0
  147. package/dist/types/packages/fs/utils/rmrf.d.ts +5 -0
  148. package/dist/types/packages/fs/watcher/index.d.ts +13 -0
  149. package/dist/types/packages/fs/watcher/initialize.d.ts +5 -0
  150. package/dist/types/packages/fs/watcher/interfaces.d.ts +3 -0
  151. package/dist/types/packages/jsonapi/constants.d.ts +2 -0
  152. package/dist/types/packages/jsonapi/errors/index.d.ts +3 -0
  153. package/dist/types/packages/jsonapi/errors/invalid-content-type-error.d.ts +8 -0
  154. package/dist/types/packages/jsonapi/errors/not-acceptable-error.d.ts +8 -0
  155. package/dist/types/packages/jsonapi/errors/unsupported-media-type-error.d.ts +8 -0
  156. package/dist/types/packages/jsonapi/index.d.ts +5 -0
  157. package/dist/types/packages/jsonapi/interfaces.d.ts +66 -0
  158. package/dist/types/packages/jsonapi/utils/has-media-type.d.ts +4 -0
  159. package/dist/types/packages/jsonapi/utils/is-jsonapi.d.ts +4 -0
  160. package/dist/types/packages/loader/builder/index.d.ts +6 -0
  161. package/dist/types/packages/loader/builder/interfaces.d.ts +10 -0
  162. package/dist/types/packages/loader/builder/utils/create-children-builder.d.ts +2 -0
  163. package/dist/types/packages/loader/builder/utils/create-parent-builder.d.ts +2 -0
  164. package/dist/types/packages/loader/builder/utils/sort-by-namespace.d.ts +5 -0
  165. package/dist/types/packages/loader/index.d.ts +8 -0
  166. package/dist/types/packages/loader/interfaces.d.ts +4 -0
  167. package/dist/types/packages/loader/resolver/index.d.ts +7 -0
  168. package/dist/types/packages/loader/resolver/utils/closest-ancestor.d.ts +2 -0
  169. package/dist/types/packages/loader/resolver/utils/closest-child.d.ts +2 -0
  170. package/dist/types/packages/loader/utils/bundle-for.d.ts +5 -0
  171. package/dist/types/packages/loader/utils/format-key.d.ts +4 -0
  172. package/dist/types/packages/logger/constants.d.ts +8 -0
  173. package/dist/types/packages/logger/index.d.ts +182 -0
  174. package/dist/types/packages/logger/interfaces.d.ts +17 -0
  175. package/dist/types/packages/logger/request-logger/index.d.ts +6 -0
  176. package/dist/types/packages/logger/request-logger/interfaces.d.ts +25 -0
  177. package/dist/types/packages/logger/request-logger/templates.d.ts +9 -0
  178. package/dist/types/packages/logger/request-logger/utils/filter-params.d.ts +4 -0
  179. package/dist/types/packages/logger/request-logger/utils/log-json.d.ts +10 -0
  180. package/dist/types/packages/logger/request-logger/utils/log-text.d.ts +10 -0
  181. package/dist/types/packages/logger/utils/line.d.ts +4 -0
  182. package/dist/types/packages/logger/utils/sql.d.ts +4 -0
  183. package/dist/types/packages/logger/writer/constants.d.ts +3 -0
  184. package/dist/types/packages/logger/writer/index.d.ts +6 -0
  185. package/dist/types/packages/logger/writer/interfaces.d.ts +2 -0
  186. package/dist/types/packages/logger/writer/utils/format-message.d.ts +9 -0
  187. package/dist/types/packages/lumenify/index.d.ts +11 -0
  188. package/dist/types/packages/lumenify/utils/create-response-proxy.d.ts +8 -0
  189. package/dist/types/packages/pm/cluster/index.d.ts +21 -0
  190. package/dist/types/packages/pm/cluster/interfaces.d.ts +7 -0
  191. package/dist/types/packages/pm/index.d.ts +6 -0
  192. package/dist/types/packages/router/definitions/context/index.d.ts +11 -0
  193. package/dist/types/packages/router/definitions/context/utils/create-definition-group.d.ts +7 -0
  194. package/dist/types/packages/router/definitions/context/utils/create-definition.d.ts +10 -0
  195. package/dist/types/packages/router/definitions/context/utils/normalize-resource-args.d.ts +12 -0
  196. package/dist/types/packages/router/definitions/index.d.ts +10 -0
  197. package/dist/types/packages/router/definitions/interfaces.d.ts +7 -0
  198. package/dist/types/packages/router/index.d.ts +18 -0
  199. package/dist/types/packages/router/interfaces.d.ts +18 -0
  200. package/dist/types/packages/router/namespace/index.d.ts +20 -0
  201. package/dist/types/packages/router/namespace/interfaces.d.ts +9 -0
  202. package/dist/types/packages/router/namespace/utils/normalize-name.d.ts +4 -0
  203. package/dist/types/packages/router/namespace/utils/normalize-path.d.ts +4 -0
  204. package/dist/types/packages/router/resource/index.d.ts +13 -0
  205. package/dist/types/packages/router/resource/interfaces.d.ts +5 -0
  206. package/dist/types/packages/router/resource/utils/normalize-only.d.ts +5 -0
  207. package/dist/types/packages/router/route/action/constants.d.ts +1 -0
  208. package/dist/types/packages/router/route/action/enhancers/resource.d.ts +5 -0
  209. package/dist/types/packages/router/route/action/enhancers/track-perf.d.ts +5 -0
  210. package/dist/types/packages/router/route/action/index.d.ts +9 -0
  211. package/dist/types/packages/router/route/action/interfaces.d.ts +2 -0
  212. package/dist/types/packages/router/route/action/utils/create-page-links.d.ts +12 -0
  213. package/dist/types/packages/router/route/action/utils/get-action-name.d.ts +5 -0
  214. package/dist/types/packages/router/route/action/utils/get-controller-name.d.ts +5 -0
  215. package/dist/types/packages/router/route/constants.d.ts +1 -0
  216. package/dist/types/packages/router/route/index.d.ts +28 -0
  217. package/dist/types/packages/router/route/interfaces.d.ts +10 -0
  218. package/dist/types/packages/router/route/params/errors/index.d.ts +5 -0
  219. package/dist/types/packages/router/route/params/errors/invalid-parameter-error.d.ts +8 -0
  220. package/dist/types/packages/router/route/params/errors/parameter-not-nullable-error.d.ts +9 -0
  221. package/dist/types/packages/router/route/params/errors/parameter-required-error.d.ts +8 -0
  222. package/dist/types/packages/router/route/params/errors/parameter-type-error.d.ts +9 -0
  223. package/dist/types/packages/router/route/params/errors/parameter-value-error.d.ts +9 -0
  224. package/dist/types/packages/router/route/params/errors/resource-mismatch-error.d.ts +8 -0
  225. package/dist/types/packages/router/route/params/index.d.ts +18 -0
  226. package/dist/types/packages/router/route/params/interfaces.d.ts +25 -0
  227. package/dist/types/packages/router/route/params/parameter/index.d.ts +14 -0
  228. package/dist/types/packages/router/route/params/parameter/interfaces.d.ts +4 -0
  229. package/dist/types/packages/router/route/params/parameter/utils/validate-value.d.ts +5 -0
  230. package/dist/types/packages/router/route/params/parameter-group/index.d.ts +14 -0
  231. package/dist/types/packages/router/route/params/parameter-group/utils/has-required-params.d.ts +5 -0
  232. package/dist/types/packages/router/route/params/utils/get-data-params.d.ts +6 -0
  233. package/dist/types/packages/router/route/params/utils/get-default-collection-params.d.ts +6 -0
  234. package/dist/types/packages/router/route/params/utils/get-default-member-params.d.ts +5 -0
  235. package/dist/types/packages/router/route/params/utils/get-query-params.d.ts +14 -0
  236. package/dist/types/packages/router/route/params/utils/get-url-params.d.ts +5 -0
  237. package/dist/types/packages/router/route/params/utils/validate-resource-id.d.ts +5 -0
  238. package/dist/types/packages/router/route/params/utils/validate-type.d.ts +5 -0
  239. package/dist/types/packages/router/route/utils/get-dynamic-segments.d.ts +4 -0
  240. package/dist/types/packages/router/route/utils/get-static-path.d.ts +4 -0
  241. package/dist/types/packages/router/utils/create-replacer.d.ts +5 -0
  242. package/dist/types/packages/serializer/index.d.ts +521 -0
  243. package/dist/types/packages/serializer/interfaces.d.ts +7 -0
  244. package/dist/types/packages/server/constants.d.ts +2 -0
  245. package/dist/types/packages/server/index.d.ts +27 -0
  246. package/dist/types/packages/server/interfaces.d.ts +18 -0
  247. package/dist/types/packages/server/request/constants.d.ts +2 -0
  248. package/dist/types/packages/server/request/index.d.ts +8 -0
  249. package/dist/types/packages/server/request/interfaces.d.ts +63 -0
  250. package/dist/types/packages/server/request/parser/constants.d.ts +6 -0
  251. package/dist/types/packages/server/request/parser/errors/index.d.ts +1 -0
  252. package/dist/types/packages/server/request/parser/errors/malformed-request-error.d.ts +8 -0
  253. package/dist/types/packages/server/request/parser/index.d.ts +5 -0
  254. package/dist/types/packages/server/request/parser/utils/format.d.ts +17 -0
  255. package/dist/types/packages/server/request/parser/utils/parse-nested-object.d.ts +4 -0
  256. package/dist/types/packages/server/request/parser/utils/parse-read.d.ts +5 -0
  257. package/dist/types/packages/server/request/parser/utils/parse-write.d.ts +5 -0
  258. package/dist/types/packages/server/request/utils/get-domain.d.ts +5 -0
  259. package/dist/types/packages/server/responder/index.d.ts +5 -0
  260. package/dist/types/packages/server/responder/utils/data-for.d.ts +5 -0
  261. package/dist/types/packages/server/responder/utils/has-content-type.d.ts +2 -0
  262. package/dist/types/packages/server/responder/utils/normalize.d.ts +7 -0
  263. package/dist/types/packages/server/response/index.d.ts +5 -0
  264. package/dist/types/packages/server/response/interfaces.d.ts +22 -0
  265. package/dist/types/packages/server/utils/create-server-error.d.ts +7 -0
  266. package/dist/types/packages/server/utils/set-cors-headers.d.ts +3 -0
  267. package/dist/types/packages/server/utils/validate-accept.d.ts +4 -0
  268. package/dist/types/packages/server/utils/validate-content-type.d.ts +4 -0
  269. package/dist/types/packages/template/index.d.ts +8 -0
  270. package/dist/types/packages/template/utils/insert-values.d.ts +4 -0
  271. package/dist/types/utils/chain.d.ts +5 -0
  272. package/dist/types/utils/compact.d.ts +11 -0
  273. package/dist/types/utils/compose.d.ts +19 -0
  274. package/dist/types/utils/create-query-string.d.ts +6 -0
  275. package/dist/types/utils/diff.d.ts +4 -0
  276. package/dist/types/utils/entries.d.ts +4 -0
  277. package/dist/types/utils/env.d.ts +3 -0
  278. package/dist/types/utils/exec.d.ts +5 -0
  279. package/dist/types/utils/github.d.ts +9 -0
  280. package/dist/types/utils/has-own-property.d.ts +1 -0
  281. package/dist/types/utils/insert.d.ts +4 -0
  282. package/dist/types/utils/is-buffer.d.ts +4 -0
  283. package/dist/types/utils/is-null.d.ts +4 -0
  284. package/dist/types/utils/is-object.d.ts +17 -0
  285. package/dist/types/utils/is-undefined.d.ts +4 -0
  286. package/dist/types/utils/k.d.ts +10 -0
  287. package/dist/types/utils/map-to-object.d.ts +1 -0
  288. package/dist/types/utils/merge.d.ts +4 -0
  289. package/dist/types/utils/omit.d.ts +9 -0
  290. package/dist/types/utils/pick.d.ts +11 -0
  291. package/dist/types/utils/present.d.ts +4 -0
  292. package/dist/types/utils/promise-hash.d.ts +9 -0
  293. package/dist/types/utils/proxy.d.ts +6 -0
  294. package/dist/types/utils/range.d.ts +4 -0
  295. package/dist/types/utils/set-type.d.ts +11 -0
  296. package/dist/types/utils/sleep.d.ts +4 -0
  297. package/dist/types/utils/stringify.d.ts +4 -0
  298. package/dist/types/utils/transform-keys.d.ts +29 -0
  299. package/dist/types/utils/try-catch.d.ts +55 -0
  300. package/dist/types/utils/underscore.d.ts +4 -0
  301. package/dist/types/utils/uniq.d.ts +4 -0
  302. package/package.json +87 -0
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function parseNestedObject(source: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,5 @@
1
+ import type { Request } from '../../interfaces';
2
+ /**
3
+ * @private
4
+ */
5
+ export default function parseRead({ method, url: { query } }: Request): Record<string, unknown>;
@@ -0,0 +1,5 @@
1
+ import type { Request } from '../../interfaces';
2
+ /**
3
+ * @private
4
+ */
5
+ export default function parseWrite(req: Request): Promise<Record<string, unknown>>;
@@ -0,0 +1,5 @@
1
+ import type { Request } from '../interfaces';
2
+ /**
3
+ * @private
4
+ */
5
+ export default function getDomain({ headers, connection: { encrypted } }: Request): string;
@@ -0,0 +1,5 @@
1
+ import type { Request, Response } from '../index';
2
+ /**
3
+ * @private
4
+ */
5
+ export declare function createResponder(req: Request, res: Response): (data?: unknown) => void;
@@ -0,0 +1,5 @@
1
+ import type { JSONAPI$Document } from '../../../jsonapi';
2
+ /**
3
+ * @private
4
+ */
5
+ export default function dataFor(status: number, err?: Error): string | JSONAPI$Document;
@@ -0,0 +1,2 @@
1
+ import type { Response } from '../../index';
2
+ export default function hasContentType(res: Response): boolean;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function normalize(data?: unknown): {
5
+ statusCode: number | undefined;
6
+ data: string;
7
+ };
@@ -0,0 +1,5 @@
1
+ import type { Response, Response$opts } from './interfaces';
2
+ /**
3
+ * @private
4
+ */
5
+ export declare function createResponse(res: any, opts: Response$opts): Response;
@@ -0,0 +1,22 @@
1
+ import type { Writable } from 'stream';
2
+ import type Logger from '../../logger';
3
+ type Response$stat = {
4
+ type: string;
5
+ name: string;
6
+ duration: number;
7
+ controller: string;
8
+ };
9
+ export type Response$opts = {
10
+ logger: Logger;
11
+ };
12
+ export interface Response extends Writable {
13
+ [key: string]: unknown;
14
+ stats: Array<Response$stat>;
15
+ logger: Logger;
16
+ statusCode: number;
17
+ statusMessage: string;
18
+ getHeader(name: string): string | void;
19
+ setHeader(name: string, value: string): void;
20
+ removeHeader(name: string): void;
21
+ }
22
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { Server$Error } from '../interfaces';
2
+ type Constructor<T> = new (...args: Array<any>) => T;
3
+ /**
4
+ * @private
5
+ */
6
+ export default function createServerError<T extends object>(Target: Constructor<T>, statusCode: number): Constructor<T & Server$Error>;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { Response } from '../index';
2
+ import type { Server$cors } from '../interfaces';
3
+ export default function setCORSHeaders(res: Response, { origin, methods, headers, enabled }: Server$cors): void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function validateAccept(contentType?: string): true;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function validateContentType(contentType?: string): true;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Used as a template tag, so `strings` arrives as a TemplateStringsArray —
3
+ * typed as `readonly string[]`, which also accepts a plain array.
4
+ *
5
+ * @private
6
+ */
7
+ export default function template(strings: readonly string[], ...values: unknown[]): string;
8
+ export { default as insertValues } from './utils/insert-values';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function insertValues(strings: readonly string[], ...values: unknown[]): string;
@@ -0,0 +1,5 @@
1
+ import type { Chain } from '../interfaces';
2
+ /**
3
+ * @private
4
+ */
5
+ export default function chain<T>(source: T): Chain<T>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Removes null/undefined entries from an array or object.
3
+ *
4
+ * Overloaded because the two inputs behave differently: an array keeps its
5
+ * element type, while an object may lose keys — hence `Partial<T>` rather than
6
+ * Flow's `T`.
7
+ *
8
+ * @private
9
+ */
10
+ export default function compact<T>(source: T[]): T[];
11
+ export default function compact<T extends object>(source: T): Partial<T>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * A single stage of a composed pipeline.
3
+ *
4
+ * @private
5
+ */
6
+ type Stage = (value: any) => any;
7
+ /**
8
+ * @private
9
+ */
10
+ export declare function tap<T>(input: T): T;
11
+ /**
12
+ * @private
13
+ */
14
+ export declare function compose<T, U>(main: (input: any) => U, ...etc: Stage[]): (input: T) => U;
15
+ /**
16
+ * @private
17
+ */
18
+ export declare function composeAsync<T, U>(main: (input: any) => Promise<U>, ...etc: Stage[]): (input: T | Promise<T>) => Promise<U>;
19
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A replacement for querystring.stringify that supports nested objects.
3
+ *
4
+ * @private
5
+ */
6
+ export default function createQueryString(src: Record<string, unknown>, prop?: string): string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export declare function map<K, V>(a: Map<K, V>, b: Map<K, V>): Map<K, V>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function entries<T>(source: Record<string, T>): Array<[string, T]>;
@@ -0,0 +1,3 @@
1
+ export declare const isDevelopment: () => boolean;
2
+ export declare const isProduction: () => boolean;
3
+ export declare const isTest: () => boolean;
@@ -0,0 +1,5 @@
1
+ import type { ExecOptions } from 'child_process';
2
+ /**
3
+ * @private
4
+ */
5
+ export default function exec(cmd: string, opts?: ExecOptions): Promise<[string, string]>;
@@ -0,0 +1,9 @@
1
+ type Options = {
2
+ line?: number;
3
+ branch?: string;
4
+ };
5
+ /**
6
+ * @private
7
+ */
8
+ export declare function fileLink(path: string, opts?: Options): string;
9
+ export {};
@@ -0,0 +1 @@
1
+ export default function hasOwnProperty(target: object, key: string): boolean;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function insert<T, U extends T[]>(target: U, items: T[]): U;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function isBuffer(value: unknown): value is Buffer;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function isNull(value: unknown): value is null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Determine wether or not a value is an Object.
3
+ *
4
+ * @example
5
+ * const a = null;
6
+ * const b = [];
7
+ * const c = {};
8
+ *
9
+ * console.log(typeof a, typeof b, typeof c);
10
+ * // => 'object', 'object', 'object' 👎
11
+ *
12
+ * console.log(isObject(a), isObject(b), isObject(c));
13
+ * // => false, false, true 👍
14
+ *
15
+ * @private
16
+ */
17
+ export default function isObject(value: unknown): value is Record<string, unknown>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function isUndefined(value: unknown): value is undefined;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A utility function that always returns `this` based on it's current
3
+ * context.
4
+ *
5
+ * A common use case for the K function is a default parameter for optional
6
+ * callback functions or general function arguments.
7
+ *
8
+ * @private
9
+ */
10
+ export default function K(this: unknown): unknown;
@@ -0,0 +1 @@
1
+ export default function mapToObject<T>(source: Map<string, T>): Record<string, T>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function merge<T extends object, U extends object>(dest: T, source: U): T & U;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns a copy of `src` without `omitted` keys.
3
+ *
4
+ * Typed as `Partial<T>` rather than Flow's `T`, since the omitted keys are by
5
+ * definition absent from the result.
6
+ *
7
+ * @private
8
+ */
9
+ export default function omit<T extends object>(src: T, ...omitted: string[]): Partial<T>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Returns a copy of `src` containing only `keys` whose values are defined.
3
+ *
4
+ * The result is `Partial<T>` rather than Flow's `T`: keys may be dropped, both
5
+ * because the caller asked for a subset and because undefined values are
6
+ * filtered out. The cast is confined to the return, where the dynamic key
7
+ * access makes the shape unknowable to the compiler.
8
+ *
9
+ * @private
10
+ */
11
+ export default function pick<T extends object>(src: T, ...keys: string[]): Partial<T>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function present(...values: unknown[]): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Resolves every value of an object, returning an object of the same shape with
3
+ * each promise unwrapped.
4
+ *
5
+ * @private
6
+ */
7
+ export default function promiseHash<T extends Record<string, unknown>>(promises: T): Promise<{
8
+ [K in keyof T]: Awaited<T[K]>;
9
+ }>;
@@ -0,0 +1,6 @@
1
+ type ProxyGet<T extends object> = (target: T, key: string, receiver: unknown) => unknown;
2
+ /**
3
+ * @private
4
+ */
5
+ export declare function trapGet<T extends object>(traps: Record<string, unknown>): ProxyGet<T>;
6
+ export {};
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function range(start: number, end: number): Generator<number, void, void>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Escape hatch that existed to coerce Flow into accepting the return type of a
3
+ * polymorphic higher-order function.
4
+ *
5
+ * NOTE: this util is a Flow-era crutch. TypeScript's generics express the same
6
+ * intent directly, so calls to `setType` should be removed as their callers are
7
+ * converted — at which point this file can go away entirely.
8
+ *
9
+ * @private
10
+ */
11
+ export default function setType<T>(fn: () => T): T;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function sleep(amount: number): Promise<void>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function stringify(value?: unknown, spaces?: number): string;
@@ -0,0 +1,29 @@
1
+ type Transformer = (key: string) => string;
2
+ /**
3
+ * Rewrites an object's keys with `transformer`.
4
+ *
5
+ * Overloaded rather than Flow's `T -> T`, which was inaccurate: transforming
6
+ * keys produces a differently-shaped object, so the object form returns
7
+ * `Record<string, unknown>`. Arrays are passed through as a shallow copy (their
8
+ * keys are not transformed), so they keep their element type.
9
+ *
10
+ * @private
11
+ */
12
+ export declare function transformKeys<T>(source: T[], transformer: Transformer, deep?: boolean): T[];
13
+ export declare function transformKeys(source: object, transformer: Transformer, deep?: boolean): Record<string, unknown>;
14
+ /**
15
+ * @private
16
+ */
17
+ export declare function camelizeKeys<T>(source: T[], deep?: boolean): T[];
18
+ export declare function camelizeKeys(source: object, deep?: boolean): Record<string, unknown>;
19
+ /**
20
+ * @private
21
+ */
22
+ export declare function dasherizeKeys<T>(source: T[], deep?: boolean): T[];
23
+ export declare function dasherizeKeys(source: object, deep?: boolean): Record<string, unknown>;
24
+ /**
25
+ * @private
26
+ */
27
+ export declare function underscoreKeys<T>(source: T[], deep?: boolean): T[];
28
+ export declare function underscoreKeys(source: object, deep?: boolean): Record<string, unknown>;
29
+ export {};
@@ -0,0 +1,55 @@
1
+ /**
2
+ * A utility function used for wrapping async code that would otherwise need a
3
+ * try-catch block.
4
+ *
5
+ * V8 deoptimizes functions when running into try-catch catch due to the
6
+ * unpredictable nature of the code. The `tryCatch` utility function is a way
7
+ * to "have your cake and eat it too". Since the inner function (`fn`) will not
8
+ * become deoptimized by V8 for including a standard try-catch block, we don't
9
+ * have to sacrifice as much perf for error handling expensive computations.
10
+ *
11
+ * The `tryCatch` utility is also very useful when you want to perform a noop
12
+ * when an error is thrown as the catch argument (`rescue`) is optional unlike
13
+ * a traditional try-catch block.
14
+ *
15
+ * @example
16
+ * tryCatch(() => {
17
+ * const n = Math.floor(Math.random() * 6);
18
+ *
19
+ * if (n >= 4) {
20
+ * throw new Error('You lose!');
21
+ * } else {
22
+ * return Promise.resolve(n);
23
+ * }
24
+ * }, err => {
25
+ * console.error(err);
26
+ * }).then(luckyNumber => {
27
+ * console.log(`Your lucky number is ${luckyNumber}.`);
28
+ * });
29
+ *
30
+ * @private
31
+ */
32
+ export default function tryCatch<T>(fn: () => Promise<T>, rescue?: (err: unknown) => unknown): Promise<T | undefined>;
33
+ /**
34
+ * A syncronous implementation of the `tryCatch` utility.
35
+ *
36
+ * @example
37
+ * const luckyNumber = tryCatchSync(() => {
38
+ * const n = Math.floor(Math.random() * 6);
39
+ *
40
+ * if (n >= 4) {
41
+ * throw new Error('You lose!');
42
+ * } else {
43
+ * return n;
44
+ * }
45
+ * }, err => {
46
+ * console.error(err);
47
+ * });
48
+ *
49
+ * if (luckyNumber) {
50
+ * console.log(`Your lucky number is ${luckyNumber}.`);
51
+ * }
52
+ *
53
+ * @private
54
+ */
55
+ export declare function tryCatchSync<T>(fn: () => T, rescue?: (err: unknown) => unknown): T | undefined;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function underscore(source?: string, upper?: boolean): string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @private
3
+ */
4
+ export default function uniq<T>(src: T[], ...keys: string[]): T[];
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "lumen-framework",
3
+ "version": "3.0.0",
4
+ "description": "Build scalable, Node.js-powered REST APIs with almost no code.",
5
+ "repository": "github:nickschot/lux",
6
+ "keywords": [
7
+ "mvc",
8
+ "api",
9
+ "lux",
10
+ "lumen",
11
+ "jsonapi",
12
+ "json-api",
13
+ "rest",
14
+ "framework"
15
+ ],
16
+ "main": "dist/index.js",
17
+ "module": "dist/index.mjs",
18
+ "types": "./dist/types/index.d.ts",
19
+ "bin": {
20
+ "lumen": "bin/lumen"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "bin",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
28
+ "scripts": {
29
+ "build": "node build.mjs",
30
+ "build:types": "tsc -p tsconfig.build.json",
31
+ "prepack": "pnpm run build && pnpm run build:types",
32
+ "clean": "shx rm -rf coverage dist test/test-app/dist",
33
+ "typecheck": "tsc --noEmit",
34
+ "lint": "eslint .",
35
+ "format": "prettier --write .",
36
+ "format:check": "prettier --check .",
37
+ "test": "vitest run",
38
+ "debugger": "node --enable-source-maps test/utils/debugger/dist/debug.js",
39
+ "build:debugger": "node test/utils/debugger/build.mjs"
40
+ },
41
+ "author": "Nick Schot <nickschot@gmail.com>",
42
+ "contributors": [
43
+ {
44
+ "name": "Zachary Golba",
45
+ "url": "https://github.com/zacharygolba"
46
+ }
47
+ ],
48
+ "license": "MIT",
49
+ "bugs": {
50
+ "url": "https://github.com/nickschot/lux/issues"
51
+ },
52
+ "engines": {
53
+ "node": ">= 20"
54
+ },
55
+ "packageManager": "pnpm@10.34.5",
56
+ "dependencies": {
57
+ "ansi-regex": "^5.0.1",
58
+ "chalk": "^4.1.2",
59
+ "commander": "^2.20.3",
60
+ "esbuild": "^0.28.1",
61
+ "fb-watchman": "^2.0.2",
62
+ "inflection": "^1.13.4",
63
+ "knex": "^3.3.0",
64
+ "ora": "^5.4.1"
65
+ },
66
+ "devDependencies": {
67
+ "@eslint/js": "^9.39.5",
68
+ "@types/inflection": "1.13.2",
69
+ "@types/node": "^20.19.43",
70
+ "@vitest/coverage-v8": "^4.1.10",
71
+ "eslint": "^9.39.5",
72
+ "eslint-config-prettier": "^10.1.8",
73
+ "faker": "4.1.0",
74
+ "globals": "^17.7.0",
75
+ "lumen-framework": "link:.",
76
+ "node-fetch": "^2.7.0",
77
+ "prettier": "^3.9.5",
78
+ "shx": "^0.3.4",
79
+ "sinon": "2.2.0",
80
+ "typescript": "^6.0.3",
81
+ "typescript-eslint": "^8.64.0",
82
+ "vitest": "^4.1.10"
83
+ },
84
+ "volta": {
85
+ "node": "20.20.2"
86
+ }
87
+ }