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,591 @@
1
+ import type Serializer from '../serializer';
2
+ import type { Model, ModelClass, Query } from '../database';
3
+ import type { Request, Response } from '../server';
4
+ import type { Controller$opts, Controller$beforeAction, Controller$afterAction } from './interfaces';
5
+ /**
6
+ * ## Overview
7
+ *
8
+ * The Controller class is responsible for taking in requests from the outside
9
+ * world and returning the appropriate response.
10
+ *
11
+ * Think of a Controller as a server at a restaurant. A client makes a request
12
+ * to an application, that request is routed to the appropriate Controller and
13
+ * then the Controller interprets the request and returns data relative to what
14
+ * the client has request.
15
+ *
16
+ * #### Actions
17
+ *
18
+ * Controller actions are functions that call on a Controller in response to an
19
+ * incoming HTTP request. The job of Controller actions are to return the data
20
+ * that the Lumen Application will respond with.
21
+ *
22
+ * There is no special API for Controller actions. They are simply functions
23
+ * that return a value. If an action returns a Query or Promise the resolved
24
+ * value will be used rather than the immediate return value of the action.
25
+ *
26
+ * Below you will find a table showing the different types of responses you can
27
+ * get from different action return values. Keep in mind, Lumen is agnostic to
28
+ * whether or not the value is returned synchronously or resolved from a
29
+ * Promise.
30
+ *
31
+ * | Return/Resolved Value | Response |
32
+ * |------------------------------|--------------------------------------------|
33
+ * | Array<Model> or Model | Serialized JSON String |
34
+ * | Array or Object Literal | JSON String |
35
+ * | String Literal | Plain Text |
36
+ * | Number Literal | [HTTP Status Code](https://goo.gl/T2lMc7) |
37
+ * | true | [204 No Content](https://goo.gl/GxKoqz) |
38
+ * | false | [401 Unauthorized](https://goo.gl/60QqCW) |
39
+ *
40
+ * **Built-In Actions**
41
+ *
42
+ * Built-in actions refer to Controller actions that you get for free when
43
+ * extending the Controller class (show, index, create, update, destroy). These
44
+ * actions are highly optimized to load only the attributes and relationships
45
+ * that are defined in the resolved Serializer for a Controller.
46
+ *
47
+ * If applicable, built-in actions support the following features described in
48
+ * the [JSON API specification](http://jsonapi.org/):
49
+ *
50
+ * - [Sorting](http://jsonapi.org/format/#fetching-sorting)
51
+ * - [Filtering](http://jsonapi.org/format/#fetching-filtering)
52
+ * - [Pagination](http://jsonapi.org/format/#fetching-pagination)
53
+ * - [Sparse Fieldsets](http://jsonapi.org/format/#fetching-sparse-fieldsets)
54
+ * - [Including Related Resources](http://jsonapi.org/format/#fetching-includes)
55
+ *
56
+ * **Extending Built-In Actions**
57
+ *
58
+ * Considering the amount of functionality built-in actions provide, you will
59
+ * rarely need to override the default behavior of a built-in action. In the
60
+ * event that you do need to override a built-in action, you have the ability to
61
+ * opt back into the built-in logic by calling the super class.
62
+ *
63
+ * Read actions such as index and show return a Query which allows us to chain
64
+ * methods to the super call. In the following example we will extend the
65
+ * default behavior of the index action to only match records that meet an
66
+ * additional hard-coded set of conditions. We will still be able to use all of
67
+ * the functionality that the built-in index action provides.
68
+ *
69
+ * ```javascript
70
+ * // app/controllers/posts.js
71
+ * import { Controller } from 'lumen-framework';
72
+ *
73
+ * class PostsController extends Controller {
74
+ * index(request, response) {
75
+ * return super.index(request, response).where({
76
+ * isPublic: true
77
+ * });
78
+ * }
79
+ * }
80
+ *
81
+ * export default PostsController;
82
+ * ```
83
+ *
84
+ * **Custom Actions**
85
+ *
86
+ * Sometimes it is necessary to add a custom action to a Controller. Lumen allows
87
+ * you to do so by adding an instance method to a Controller. In the following
88
+ * example you will see how to add a custom action with the name `check` to a
89
+ * Controller. We are implementing this action to use as a health check for the
90
+ * application so we want to return the `Number` literal `204`.
91
+ *
92
+ * ```javascript
93
+ * // app/controllers/health.js
94
+ * import { Controller } from 'lumen-framework';
95
+ *
96
+ * class HealthController extends Controller {
97
+ * async check() {
98
+ * return 204;
99
+ * }
100
+ * }
101
+ *
102
+ * export default HealthController;
103
+ * ```
104
+ *
105
+ * The example above is nice but we can make the code a bit more concise with an
106
+ * Arrow `Function`.
107
+ *
108
+ * ```javascript
109
+ * // app/controllers/health.js
110
+ * import { Controller } from 'lumen-framework';
111
+ *
112
+ * class HealthController extends Controller {
113
+ * check = async () => 204;
114
+ * }
115
+ *
116
+ * export default HealthController;
117
+ * ```
118
+ *
119
+ * Using an Arrow Function instead of a traditional method Controller can be
120
+ * useful when immediately returning a value. However, there are a few downsides
121
+ * to using an Arrow `Function` for a Controller action, such as not being able
122
+ * to call the `super class`. This can be an issue if you are looking to extend
123
+ * a built-in action.
124
+ *
125
+ * Another use case for a custom action could be to return a specific scope of
126
+ * data from a `Model`. Let's implement
127
+ * a custom `drafts` route on a `PostsController`.
128
+ *
129
+ * ```javascript
130
+ * // app/controllers/posts.js
131
+ * import { Controller } from 'lumen-framework';
132
+ * import Post from 'app/models/posts';
133
+ *
134
+ * class PostsController extends Controller {
135
+ * drafts() {
136
+ * return Post.where({
137
+ * isPublic: false
138
+ * });
139
+ * }
140
+ * }
141
+ *
142
+ * export default PostsController;
143
+ * ```
144
+ *
145
+ * While the example above works, we would have to implement all the custom
146
+ * logic that we get for free with built-in actions. Since we aren't getting too
147
+ * crazy with our custom action we can likely just call the `index` action and
148
+ * chain a `.where()` to it.
149
+ *
150
+ * ```javascript
151
+ * // app/controllers/posts.js
152
+ * import { Controller } from 'lumen-framework';
153
+ *
154
+ * class PostsController extends Controller {
155
+ * drafts(request, response) {
156
+ * return this.index(request, response).where({
157
+ * isPublic: false
158
+ * });
159
+ * }
160
+ * }
161
+ *
162
+ * export default PostsController;
163
+ * ```
164
+ *
165
+ * Now we can sort, filter, and paginate our custom `drafts` route!
166
+ *
167
+ * #### Middleware
168
+ *
169
+ * Middleware can be a very powerful tool in many Node.js server frameworks. Lumen
170
+ * is no exception. Middleware can be used to execute logic before or after a
171
+ * Controller action is executed.
172
+ *
173
+ * There are two hooks where you can execute middleware functions,
174
+ * `beforeAction` and `afterAction`. Functions added to the `beforeAction` hook
175
+ * will execute before the Controller action and functions added to the
176
+ * `afterAction` hook will be executed after the `Controller` action.
177
+ *
178
+ * **Context**
179
+ *
180
+ * Middleware functions will be bound to the Controller they are added to upon
181
+ * the start of an Application.
182
+ *
183
+ * Due to the lexical binding of arrow functions, if you need to use the `this`
184
+ * keyword within a middleware function, declare the middleware function using
185
+ * the `function` keyword and not as an arrow function.
186
+ *
187
+ * **Scoping Middleware**
188
+ *
189
+ * Middleware is scoped by Controller and includes a parent Controller's
190
+ * middleware recursively until the parent Controller is the root
191
+ * `ApplicationController`. This allows you to implement custom logic that can
192
+ * be executed for resources, namespaces, or an entire Application.
193
+ *
194
+ * Let's say we want to require authentication for every route in our
195
+ * Application. All we have to do is move our authentication middleware function
196
+ * from the example above to the `ApplicationController`.
197
+ *
198
+ * ```javascript
199
+ * // app/controllers/application.js
200
+ * import { Controller } from 'lumen-framework';
201
+ *
202
+ * class ApplicationController extends Controller {
203
+ * beforeAction = [
204
+ * async function authenticate(request) {
205
+ * if (!request.currentUser) {
206
+ * // 401 Unauthorized
207
+ * return false;
208
+ * }
209
+ * }
210
+ * ];
211
+ * }
212
+ *
213
+ * export default ApplicationController;
214
+ * ```
215
+ *
216
+ * **Execuation Order**
217
+ *
218
+ * Understanding the execution order of middleware functions and a `Controller`
219
+ * action is essential to productivity with Lumen. Depending on what you use case
220
+ * is, you may want your function to execute at different times in the
221
+ * `request` / `response` cycle.
222
+ *
223
+ * 1. Parent `Controller` `beforeAction` hooks
224
+ * 2. `Controller` `beforeAction` hooks
225
+ * 3. `Controller` Action
226
+ * 4. `Controller` `afterAction` hooks
227
+ * 5. Parent `Controller` `afterAction` hooks
228
+ *
229
+ * **Modules**
230
+ *
231
+ * It is considered a best practice to define your middleware functions in
232
+ * separate file and export them for use throughout an Application. Typically
233
+ * this is done within an `app/middleware` directory.
234
+ *
235
+ * ```javascript
236
+ * // app/middleware/authenticate.js
237
+ * export default async function authenticate(request) {
238
+ * if (!request.currentUser) {
239
+ * // 401 Unauthorized
240
+ * return false;
241
+ * }
242
+ * }
243
+ * ```
244
+ *
245
+ * This keeps the Controller code clean, easier to read, and easier to modify.
246
+ *
247
+ * ```javascript
248
+ * // app/controllers/application.js
249
+ * import { Controller } from 'lumen-framework';
250
+ * import authenticate from 'app/middleware/authenticate';
251
+ *
252
+ * class ApplicationController extends Controller {
253
+ * beforeAction = [
254
+ * authenticate
255
+ * ];
256
+ * }
257
+ *
258
+ * export default ApplicationController;
259
+ * ```
260
+ *
261
+ * @class Controller
262
+ * @public
263
+ */
264
+ declare class Controller {
265
+ /**
266
+ * An array of custom query parameter keys that are allowed to reach a
267
+ * Controller instance from an incoming `HTTP` request.
268
+ *
269
+ * For security reasons, query parameters passed to Controller actions from an
270
+ * incoming request other than sort, filter, and page must have their key
271
+ * whitelisted.
272
+ *
273
+ * ```javascript
274
+ * class UsersController extends Controller {
275
+ * // Allow the following custom query parameters to be used for this
276
+ * // Controller's actions.
277
+ * query = [
278
+ * 'cache'
279
+ * ];
280
+ * }
281
+ * ```
282
+ *
283
+ * @property query
284
+ * @type {Array}
285
+ * @default []
286
+ * @public
287
+ */
288
+ query: Array<string>;
289
+ /**
290
+ * An array of sort query parameter values that are allowed to reach a
291
+ * Controller instance from an incoming `HTTP` request.
292
+ *
293
+ * If you do not override this property all of the attributes specified in the
294
+ * Serializer that represents a Controller's resource. If the Serializer
295
+ * cannot be resolved, this property will default to an empty array.
296
+ *
297
+ * @property sort
298
+ * @type {Array}
299
+ * @default []
300
+ * @public
301
+ */
302
+ sort: Array<string>;
303
+ /**
304
+ * An array of filter query parameter keys that are allowed to reach a
305
+ * Controller instance from an incoming `HTTP` request.
306
+ *
307
+ * If you do not override this property all of the attributes specified in the
308
+ * Serializer that represents a Controller's resource. If the Serializer
309
+ * cannot be resolved, this property will default to an empty array.
310
+ *
311
+ * @property filter
312
+ * @type {Array}
313
+ * @default []
314
+ * @public
315
+ */
316
+ filter: Array<string>;
317
+ /**
318
+ * An array of parameter keys that are allowed to reach a Controller instance
319
+ * from an incoming `POST` or `PATCH` request body.
320
+ *
321
+ * If you do not override this property all of the attributes specified in the
322
+ * Serializer that represents a Controller's resource. If the Serializer
323
+ * cannot be resolved, this property will default to an empty array.
324
+ *
325
+ * @property params
326
+ * @type {Array}
327
+ * @default []
328
+ * @public
329
+ */
330
+ params: Array<string>;
331
+ /**
332
+ * Functions to execute on each request handled by a `Controller` before the
333
+ * `Controller` action is executed.
334
+ *
335
+ * Functions added to the `beforeAction` hook behave similarly to `Controller`
336
+ * actions, however, they are expected to return `undefined`. If a middleware
337
+ * function returns a value other than `undefined` the `request` / `response`
338
+ * cycle will end before remaining middleware and/or Controller actions are
339
+ * executed. This makes the `beforeAction` hook a very powerful tool for
340
+ * dealing with many common tasks, such as authentication.
341
+ *
342
+ * Functions called from the `beforeAction` hook will have `request` and
343
+ * `response` objects passed as arguments.
344
+ *
345
+ * **Example:**
346
+ *
347
+ * ```javascript
348
+ * import { Controller } from 'lumen-framework';
349
+ *
350
+ * const UNSAFE_METHODS = /(?:POST|PATCH|DELETE)/i;
351
+ *
352
+ * function isAdmin(user) {
353
+ * if (user) {
354
+ * return user.isAdmin;
355
+ * }
356
+ *
357
+ * return false;
358
+ * }
359
+ *
360
+ * async function authentication(request) {
361
+ * const { method, currentUser } = request;
362
+ * const isUnsafe = UNSAFE_METHODS.test(method);
363
+ *
364
+ * if (isUnsafe && !isAdmin(currentUser)) {
365
+ * return false; // 401 Unauthorized if the current user is not an admin.
366
+ * }
367
+ * }
368
+ *
369
+ * class PostsController extends Controller {
370
+ * beforeAction = [
371
+ * authentication
372
+ * ];
373
+ * }
374
+ *
375
+ * export default PostsController;
376
+ * ```
377
+ *
378
+ * @property beforeAction
379
+ * @type {Array}
380
+ * @default []
381
+ * @public
382
+ */
383
+ beforeAction: Array<Controller$beforeAction>;
384
+ /**
385
+ * Functions to execute on each request handled by a `Controller` after the
386
+ * `Controller` action is executed.
387
+ *
388
+ * Functions called from the `afterAction` hook will have `request` and
389
+ * `response` objects passed as arguments as well as a third `payload`
390
+ * argument. The `payload` argument is a reference to the resolved data of
391
+ * the Controller action that was called within the current `request` /
392
+ * `response` cycle. You need to explicitly return this `payload` in order for
393
+ * the afterAction to resolve with it's data. If you return a modified value
394
+ * from a function added to the `afterAction` hook, that value will be used
395
+ * instead of the resolved data from the preceding Controller action.
396
+ * Subsequent hooks called from an `afterAction` hook will will use the value
397
+ * returned or resolved from the preceding hook. This makes `afterAction` a
398
+ * great place to modify the data you are sending back to the client.
399
+ *
400
+ * **Example:**
401
+ *
402
+ * ```javascript
403
+ * import { Controller } from 'lumen-framework';
404
+ *
405
+ * async function addCopyright(request, response, payload) {
406
+ * const { action } = request;
407
+ *
408
+ * if (payload && action !== preflight) {
409
+ * return {
410
+ * ...payload,
411
+ * meta: {
412
+ * copyright: '2016 (c) Postlight'
413
+ * }
414
+ * };
415
+ * }
416
+ *
417
+ * return payload;
418
+ * }
419
+ *
420
+ * class ApplicationController extends Controller {
421
+ * afterAction = [
422
+ * addCopyright
423
+ * ];
424
+ * }
425
+ *
426
+ * export default ApplicationController;
427
+ * ```
428
+ *
429
+ * @property afterAction
430
+ * @type {Array}
431
+ * @default []
432
+ * @public
433
+ */
434
+ afterAction: Array<Controller$afterAction>;
435
+ /**
436
+ * The default amount of items to include per each response of the index
437
+ * action if a `?page[size]` query parameter is not specified.
438
+ *
439
+ * @property defaultPerPage
440
+ * @type {Number}
441
+ * @default 25
442
+ * @public
443
+ */
444
+ defaultPerPage: number;
445
+ /**
446
+ * The resolved Model for a Controller instance.
447
+ *
448
+ * @property model
449
+ * @type {Model}
450
+ * @private
451
+ */
452
+ model: ModelClass<Model>;
453
+ /**
454
+ * A reference to the root Controller for the namespace that a Controller
455
+ * instance is a member of.
456
+ *
457
+ * @property parent
458
+ * @type {?Controller}
459
+ * @private
460
+ */
461
+ parent: Controller | null;
462
+ /**
463
+ * The namespace that a Controller instance is a member of.
464
+ *
465
+ * @property namespace
466
+ * @type {String}
467
+ * @private
468
+ */
469
+ namespace: string;
470
+ /**
471
+ * The resolved Serializer for a Controller instance.
472
+ *
473
+ * @property serializer
474
+ * @type {Serializer}
475
+ * @private
476
+ */
477
+ serializer: Serializer<Model>;
478
+ /**
479
+ * A Map instance containing a reference to all the Controller within an
480
+ * Application instance.
481
+ *
482
+ * @property controllers
483
+ * @type {Map}
484
+ * @private
485
+ */
486
+ controllers: Map<string, Controller>;
487
+ /**
488
+ * A boolean value representing whether or not a Controller instance has a
489
+ * Model.
490
+ *
491
+ * @property hasModel
492
+ * @type {Boolean}
493
+ * @private
494
+ */
495
+ hasModel: boolean;
496
+ /**
497
+ * A boolean value representing whether or not a Controller instance is within
498
+ * a namespace.
499
+ *
500
+ * @property hasNamespace
501
+ * @type {Boolean}
502
+ * @private
503
+ */
504
+ hasNamespace: boolean;
505
+ /**
506
+ * A boolean value representing whether or not a Controller instance has a
507
+ * Serializer.
508
+ *
509
+ * @property hasSerializer
510
+ * @type {Boolean}
511
+ * @private
512
+ */
513
+ hasSerializer: boolean;
514
+ constructor({ model, namespace, serializer }: Controller$opts);
515
+ /**
516
+ * This method supports filtering, sorting, pagination, including
517
+ * relationships, and sparse fieldsets via query parameters. For more
518
+ * information, see the [fetching resources](https://goo.gl/q7FVgZ) section of
519
+ * the JSON API specification.
520
+ *
521
+ * @method index
522
+ * @param {Request} request - The request object.
523
+ * @param {Response} response - The response object.
524
+ * @return {Promise} Resolves with an array of Model instances.
525
+ * @public
526
+ */
527
+ index(req: Request): Query<Array<Model>>;
528
+ /**
529
+ * This method supports including relationships, and sparse fieldsets via
530
+ * query parameters. For more information, see the [fetching resources](
531
+ * https://goo.gl/q7FVgZ) section of the JSON API specification.
532
+ *
533
+ * @method show
534
+ * @param {Request} request - The request object.
535
+ * @param {Response} response - The response object.
536
+ * @return {Promise} Resolves with a Model instance with the id equal to the
537
+ * id url parameter.
538
+ * @public
539
+ */
540
+ show(req: Request): Query<Model>;
541
+ /**
542
+ * Create and return a single Model instance that the Controller instance
543
+ * represents. For more information, see the [creating resources](
544
+ * https://goo.gl/4Obc9t) section of the JSON API specification.
545
+ *
546
+ * @method create
547
+ * @param {Request} request - The request object.
548
+ * @param {Response} response - The response object.
549
+ * @return {Promise} Resolves with the newly created Model instance.
550
+ * @public
551
+ */
552
+ create(req: Request, res: Response): Promise<Model>;
553
+ /**
554
+ * Update and return a single Model instance that the Controller instance
555
+ * represents. For more information, see the [updating resources](
556
+ * https://goo.gl/o2ZdOR)section of the JSON API specification.
557
+ *
558
+ * @method update
559
+ * @param {Request} request - The request object.
560
+ * @param {Response} response - The response object.
561
+ * @return {Promise} Resolves with the updated Model if changes occur.
562
+ * Resolves with the number `204` if no changes occur.
563
+ * @public
564
+ */
565
+ update(req: Request): Promise<number | Model>;
566
+ /**
567
+ * Destroy a single Model instance that the Controller instance represents.
568
+ * For more information, see the [deleting resources](https://goo.gl/nUZn8t)
569
+ * section of the JSON API specification.
570
+ *
571
+ * @method destroy
572
+ * @param {Request} request - The request object.
573
+ * @param {Response} response - The response object.
574
+ * @return {Promise} Resolves with the number `204`.
575
+ * @public
576
+ */
577
+ destroy(req: Request): Promise<number>;
578
+ /**
579
+ * Respond to HEAD or OPTIONS requests.
580
+ *
581
+ * @method preflight
582
+ * @param {Request} request - The request object.
583
+ * @param {Response} response - The response object.
584
+ * @return {Promise} Resolves with the number `204`.
585
+ * @public
586
+ */
587
+ preflight(): Promise<number>;
588
+ }
589
+ export default Controller;
590
+ export { BUILT_IN_ACTIONS } from './constants';
591
+ export type { Controller$opts, Controller$builtIn, Controller$beforeAction, Controller$afterAction } from './interfaces';
@@ -0,0 +1,13 @@
1
+ import type { Model, ModelClass, Query } from '../database';
2
+ import type { Request, Response } from '../server';
3
+ import type Serializer from '../serializer';
4
+ export type Controller$opts = {
5
+ model?: ModelClass<Model>;
6
+ namespace?: string;
7
+ serializer?: Serializer<Model>;
8
+ };
9
+ export type Controller$builtIn = 'show' | 'index' | 'create' | 'update' | 'destroy';
10
+ export type Controller$beforeAction = (request: Request, response: Response) => Promise<unknown>;
11
+ export type Controller$afterAction = (request: Request, response: Response, responseData?: unknown) => Promise<unknown>;
12
+ export type Controller$findOne<T extends Model> = (request: Request) => Query<T>;
13
+ export type Controller$findMany<T extends Model> = (request: Request) => Query<Array<T>>;
@@ -0,0 +1,6 @@
1
+ import type { Model, ModelClass, Query } from '../../database';
2
+ import type { Request } from '../../server';
3
+ /**
4
+ * @private
5
+ */
6
+ export default function findMany<T extends Model>(model: ModelClass<T>, req: Request): Query<Array<Model>>;
@@ -0,0 +1,6 @@
1
+ import type { Model, ModelClass, Query } from '../../database';
2
+ import type { Request } from '../../server';
3
+ /**
4
+ * @private
5
+ */
6
+ export default function findOne<T extends Model>(model: ModelClass<T>, req: Request): Query<T>;
@@ -0,0 +1,16 @@
1
+ import type { ModelClass } from '../../database';
2
+ import type { Request$params } from '../../server';
3
+ type Controller$query = {
4
+ id?: number | string | Buffer;
5
+ filter?: Record<string, unknown>;
6
+ select: Array<string>;
7
+ page?: number;
8
+ limit?: number;
9
+ sort?: [string, string];
10
+ include: Record<string, Array<string>>;
11
+ };
12
+ /**
13
+ * @private
14
+ */
15
+ export default function paramsToQuery(model: ModelClass, { id, page, sort, filter, fields, include }: Request$params): Controller$query;
16
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Model, ModelClass } from '../../database';
2
+ /**
3
+ * @private
4
+ */
5
+ export default function resolveRelationships<T extends Model>(model: ModelClass<T>, relationships?: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,6 @@
1
+ import type { Attribute$meta } from './interfaces';
2
+ /**
3
+ * @private
4
+ */
5
+ export declare function createAttribute(opts: Attribute$meta): PropertyDescriptor;
6
+ export type { Attribute$meta } from './interfaces';
@@ -0,0 +1,6 @@
1
+ export type Attribute$meta = {
2
+ key: string;
3
+ type: string;
4
+ nullable: boolean;
5
+ defaultValue: unknown;
6
+ };
@@ -0,0 +1,5 @@
1
+ import type { Attribute$meta } from '../index';
2
+ /**
3
+ * @private
4
+ */
5
+ export default function createAttribute(opts: Attribute$meta): PropertyDescriptor;
@@ -0,0 +1,3 @@
1
+ import type Model from '../../model';
2
+ import type { Attribute$meta } from '../index';
3
+ export default function createGetter({ key, defaultValue }: Attribute$meta): (this: Model) => unknown;
@@ -0,0 +1 @@
1
+ export default function createNormalizer(type: string): (value: unknown) => unknown;
@@ -0,0 +1,8 @@
1
+ import type Model from '../../model';
2
+ import type { Attribute$meta } from '../index';
3
+ /**
4
+ * @private
5
+ */
6
+ export default function createSetter({ key, nullable, normalize, defaultValue }: Attribute$meta & {
7
+ normalize: (value: unknown) => unknown;
8
+ }): (this: Model, value?: unknown) => void;
@@ -0,0 +1,10 @@
1
+ import type { Model } from '../index';
2
+ declare class ChangeSet extends Map<string, any> {
3
+ isPersisted: boolean;
4
+ constructor(data?: Record<string, unknown>);
5
+ set(key: string, value: any): this;
6
+ persist(group?: Array<ChangeSet>): this;
7
+ unpersist(): this;
8
+ applyTo(target: Model): ChangeSet;
9
+ }
10
+ export default ChangeSet;