a
This commit is contained in:
1
backend/node_modules/kareem/.nyc_output/fa57d6c4-9e78-4624-9229-f77b87a07481.json
generated
vendored
Normal file
1
backend/node_modules/kareem/.nyc_output/fa57d6c4-9e78-4624-9229-f77b87a07481.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
backend/node_modules/kareem/.nyc_output/processinfo/fa57d6c4-9e78-4624-9229-f77b87a07481.json
generated
vendored
Normal file
1
backend/node_modules/kareem/.nyc_output/processinfo/fa57d6c4-9e78-4624-9229-f77b87a07481.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"parent":null,"pid":2678345,"argv":["/home/v/.nvm/versions/node/v20.18.1/bin/node","/home/v/Desktop/MongoDB/kareem/node_modules/.bin/mocha","./test/examples.test.js","./test/misc.test.js","./test/post.test.js","./test/pre.test.js","./test/wrap.test.js"],"execArgv":[],"cwd":"/home/v/Desktop/MongoDB/kareem","time":1756153005026,"ppid":2678334,"coverageFilename":"/home/v/Desktop/MongoDB/kareem/.nyc_output/fa57d6c4-9e78-4624-9229-f77b87a07481.json","externalId":"","uuid":"fa57d6c4-9e78-4624-9229-f77b87a07481","files":["/home/v/Desktop/MongoDB/kareem/index.js"]}
|
||||
1
backend/node_modules/kareem/.nyc_output/processinfo/index.json
generated
vendored
Normal file
1
backend/node_modules/kareem/.nyc_output/processinfo/index.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"processes":{"fa57d6c4-9e78-4624-9229-f77b87a07481":{"parent":null,"children":[]}},"files":{"/home/v/Desktop/MongoDB/kareem/index.js":["fa57d6c4-9e78-4624-9229-f77b87a07481"]},"externalIds":{}}
|
||||
840
backend/node_modules/kareem/CHANGELOG.md
generated
vendored
Normal file
840
backend/node_modules/kareem/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,840 @@
|
||||
# Changelog
|
||||
|
||||
<a name="3.2.0"></a>
|
||||
## 3.2.0 (2026-01-29)
|
||||
|
||||
* feat(exec): add filter option to execPreSync and execPostSync #44
|
||||
|
||||
<a name="3.1.0"></a>
|
||||
## 3.1.0 (2026-01-12)
|
||||
|
||||
* feat(exec): add filter option to allow executing hooks based on a filter function #43
|
||||
|
||||
<a name="3.0.0"></a>
|
||||
## 3.0.0 (2025-11-18)
|
||||
|
||||
* BREAKING CHANGE: make execPre async and drop callback support #39
|
||||
* BREAKING CHANGE: require Node 18
|
||||
* feat: overwriteArguments support #42
|
||||
|
||||
<a name="2.6.0"></a>
|
||||
## 2.6.0 (2024-03-04)
|
||||
|
||||
* feat: add TypeScript types
|
||||
|
||||
<a name="2.5.1"></a>
|
||||
## 2.5.1 (2023-01-06)
|
||||
|
||||
* fix: avoid passing final callback to pre hook, because calling the callback can mess up hook execution #36 Automattic/mongoose#12836
|
||||
|
||||
<a name="2.5.0"></a>
|
||||
## 2.5.0 (2022-12-01)
|
||||
|
||||
* feat: add errorHandler option to `post()` #34
|
||||
|
||||
<a name="2.4.0"></a>
|
||||
## 2.4.0 (2022-06-13)
|
||||
|
||||
* feat: add `overwriteResult()` and `skipWrappedFunction()` for more advanced control flow
|
||||
|
||||
<a name="2.3.4"></a>
|
||||
## 2.3.4 (2022-02-10)
|
||||
|
||||
* perf: various performance improvements #27 #24 #23 #22 #21 #20
|
||||
|
||||
<a name="2.3.3"></a>
|
||||
## 2.3.3 (2021-12-26)
|
||||
|
||||
* fix: handle sync errors in `wrap()`
|
||||
|
||||
<a name="2.3.2"></a>
|
||||
## 2.3.2 (2020-12-08)
|
||||
|
||||
* fix: handle sync errors in pre hooks if there are multiple hooks
|
||||
|
||||
<a name="2.3.0"></a>
|
||||
## 2.3.0 (2018-09-24)
|
||||
|
||||
* chore(release): 2.2.3 ([c8f2695](https://github.com/vkarpov15/kareem/commit/c8f2695))
|
||||
* chore(release): 2.2.4 ([a377a4f](https://github.com/vkarpov15/kareem/commit/a377a4f))
|
||||
* chore(release): 2.2.5 ([5a495e3](https://github.com/vkarpov15/kareem/commit/5a495e3))
|
||||
* fix(filter): copy async pres correctly with `filter()` ([1b1ed8a](https://github.com/vkarpov15/kareem/commit/1b1ed8a)), closes [Automattic/mongoose#3054](https://github.com/Automattic/mongoose/issues/3054)
|
||||
* feat: add filter() function ([1f641f4](https://github.com/vkarpov15/kareem/commit/1f641f4))
|
||||
* feat: support storing options on pre and post hooks ([59220b9](https://github.com/vkarpov15/kareem/commit/59220b9))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.3"></a>
|
||||
## <small>2.2.3 (2018-09-10)</small>
|
||||
|
||||
* chore: release 2.2.3 ([af653a3](https://github.com/vkarpov15/kareem/commit/af653a3))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.2"></a>
|
||||
## <small>2.2.2 (2018-09-10)</small>
|
||||
|
||||
* chore: release 2.2.2 ([3f0144d](https://github.com/vkarpov15/kareem/commit/3f0144d))
|
||||
* fix: allow merge() to not clone ([e628d65](https://github.com/vkarpov15/kareem/commit/e628d65))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.1"></a>
|
||||
## <small>2.2.1 (2018-06-05)</small>
|
||||
|
||||
* chore: release 2.2.1 ([4625a64](https://github.com/vkarpov15/kareem/commit/4625a64))
|
||||
* chore: remove lockfile from git ([7f3e4e6](https://github.com/vkarpov15/kareem/commit/7f3e4e6))
|
||||
* fix: handle numAsync correctly when merging ([fef8e7e](https://github.com/vkarpov15/kareem/commit/fef8e7e))
|
||||
* test: repro issue with not copying numAsync ([952d9db](https://github.com/vkarpov15/kareem/commit/952d9db))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.0"></a>
|
||||
## 2.2.0 (2018-06-05)
|
||||
|
||||
* chore: release 2.2.0 ([ff9ad03](https://github.com/vkarpov15/kareem/commit/ff9ad03))
|
||||
* fix: use maps instead of objects for _pres and _posts so `toString()` doesn't get reported as having ([55df303](https://github.com/vkarpov15/kareem/commit/55df303)), closes [Automattic/mongoose#6538](https://github.com/Automattic/mongoose/issues/6538)
|
||||
|
||||
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
## 2.1.0 (2018-05-16)
|
||||
|
||||
* chore: release 2.1.0 ([ba5f1bc](https://github.com/vkarpov15/kareem/commit/ba5f1bc))
|
||||
* feat: add option to check wrapped function return value for promises ([c9d7dd1](https://github.com/vkarpov15/kareem/commit/c9d7dd1))
|
||||
* refactor: use const in wrap() ([0fc21f9](https://github.com/vkarpov15/kareem/commit/0fc21f9))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.7"></a>
|
||||
## <small>2.0.7 (2018-04-28)</small>
|
||||
|
||||
* chore: release 2.0.7 ([0bf91e6](https://github.com/vkarpov15/kareem/commit/0bf91e6))
|
||||
* feat: add `hasHooks()` ([225f18d](https://github.com/vkarpov15/kareem/commit/225f18d)), closes [Automattic/mongoose#6385](https://github.com/Automattic/mongoose/issues/6385)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.6"></a>
|
||||
## <small>2.0.6 (2018-03-22)</small>
|
||||
|
||||
* chore: release 2.0.6 ([f3d406b](https://github.com/vkarpov15/kareem/commit/f3d406b))
|
||||
* fix(wrap): ensure fast path still wraps function in `nextTick()` for chaining ([7000494](https://github.com/vkarpov15/kareem/commit/7000494)), closes [Automattic/mongoose#6250](https://github.com/Automattic/mongoose/issues/6250) [dsanel/mongoose-delete#36](https://github.com/dsanel/mongoose-delete/issues/36)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.5"></a>
|
||||
## <small>2.0.5 (2018-02-22)</small>
|
||||
|
||||
* chore: release 2.0.5 ([3286612](https://github.com/vkarpov15/kareem/commit/3286612))
|
||||
* perf(createWrapper): don't create wrapper if there are no hooks ([5afc5b9](https://github.com/vkarpov15/kareem/commit/5afc5b9)), closes [Automattic/mongoose#6126](https://github.com/Automattic/mongoose/issues/6126)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.4"></a>
|
||||
## <small>2.0.4 (2018-02-08)</small>
|
||||
|
||||
* chore: release 2.0.4 ([2ab0293](https://github.com/vkarpov15/kareem/commit/2ab0293))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.3"></a>
|
||||
## <small>2.0.3 (2018-02-01)</small>
|
||||
|
||||
* chore: release 2.0.3 ([3c1abe5](https://github.com/vkarpov15/kareem/commit/3c1abe5))
|
||||
* fix: use process.nextTick() re: Automattic/mongoose#6074 ([e5bfe33](https://github.com/vkarpov15/kareem/commit/e5bfe33)), closes [Automattic/mongoose#6074](https://github.com/Automattic/mongoose/issues/6074)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.2"></a>
|
||||
## <small>2.0.2 (2018-01-24)</small>
|
||||
|
||||
* chore: fix license ([a9d755c](https://github.com/vkarpov15/kareem/commit/a9d755c)), closes [#10](https://github.com/vkarpov15/kareem/issues/10)
|
||||
* chore: release 2.0.2 ([fe87ab6](https://github.com/vkarpov15/kareem/commit/fe87ab6))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.1"></a>
|
||||
## <small>2.0.1 (2018-01-09)</small>
|
||||
|
||||
* chore: release 2.0.1 with lockfile bump ([09c44fb](https://github.com/vkarpov15/kareem/commit/09c44fb))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0"></a>
|
||||
## 2.0.0 (2018-01-09)
|
||||
|
||||
* chore: bump marked re: security ([cc564a9](https://github.com/vkarpov15/kareem/commit/cc564a9))
|
||||
* chore: release 2.0.0 ([f511d1c](https://github.com/vkarpov15/kareem/commit/f511d1c))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc5"></a>
|
||||
## 2.0.0-rc5 (2017-12-23)
|
||||
|
||||
* chore: fix build on node 4+5 ([6dac5a4](https://github.com/vkarpov15/kareem/commit/6dac5a4))
|
||||
* chore: fix built on node 4 + 5 again ([434ef0a](https://github.com/vkarpov15/kareem/commit/434ef0a))
|
||||
* chore: release 2.0.0-rc5 ([25a32ee](https://github.com/vkarpov15/kareem/commit/25a32ee))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc4"></a>
|
||||
## 2.0.0-rc4 (2017-12-22)
|
||||
|
||||
* chore: release 2.0.0-rc4 ([49fc083](https://github.com/vkarpov15/kareem/commit/49fc083))
|
||||
* BREAKING CHANGE: deduplicate when merging hooks re: Automattic/mongoose#2945 ([d458573](https://github.com/vkarpov15/kareem/commit/d458573)), closes [Automattic/mongoose#2945](https://github.com/Automattic/mongoose/issues/2945)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc3"></a>
|
||||
## 2.0.0-rc3 (2017-12-22)
|
||||
|
||||
* chore: release 2.0.0-rc3 ([adaaa00](https://github.com/vkarpov15/kareem/commit/adaaa00))
|
||||
* feat: support returning promises from middleware functions ([05b4480](https://github.com/vkarpov15/kareem/commit/05b4480)), closes [Automattic/mongoose#3779](https://github.com/Automattic/mongoose/issues/3779)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc2"></a>
|
||||
## 2.0.0-rc2 (2017-12-21)
|
||||
|
||||
* chore: release 2.0.0-rc2 ([76325fa](https://github.com/vkarpov15/kareem/commit/76325fa))
|
||||
* fix: ensure next() and done() run in next tick ([6c20684](https://github.com/vkarpov15/kareem/commit/6c20684))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc1"></a>
|
||||
## 2.0.0-rc1 (2017-12-21)
|
||||
|
||||
* chore: improve test coverage re: Automattic/mongoose#3232 ([7b45cf0](https://github.com/vkarpov15/kareem/commit/7b45cf0)), closes [Automattic/mongoose#3232](https://github.com/Automattic/mongoose/issues/3232)
|
||||
* chore: release 2.0.0-rc1 ([9b83f52](https://github.com/vkarpov15/kareem/commit/9b83f52))
|
||||
* BREAKING CHANGE: report sync exceptions as errors, only allow calling next() and done() once ([674adcc](https://github.com/vkarpov15/kareem/commit/674adcc)), closes [Automattic/mongoose#3483](https://github.com/Automattic/mongoose/issues/3483)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc0"></a>
|
||||
## 2.0.0-rc0 (2017-12-17)
|
||||
|
||||
* chore: release 2.0.0-rc0 ([16b44b5](https://github.com/vkarpov15/kareem/commit/16b44b5))
|
||||
* BREAKING CHANGE: drop support for node < 4 ([9cbb8c7](https://github.com/vkarpov15/kareem/commit/9cbb8c7))
|
||||
* BREAKING CHANGE: remove useLegacyPost and add several new features ([6dd8531](https://github.com/vkarpov15/kareem/commit/6dd8531)), closes [Automattic/mongoose#3232](https://github.com/Automattic/mongoose/issues/3232)
|
||||
|
||||
|
||||
|
||||
<a name="1.5.0"></a>
|
||||
## 1.5.0 (2017-07-20)
|
||||
|
||||
* chore: release 1.5.0 ([9c491a0](https://github.com/vkarpov15/kareem/commit/9c491a0))
|
||||
* fix: improve post error handlers results ([9928dd5](https://github.com/vkarpov15/kareem/commit/9928dd5)), closes [Automattic/mongoose#5466](https://github.com/Automattic/mongoose/issues/5466)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.2"></a>
|
||||
## <small>1.4.2 (2017-07-06)</small>
|
||||
|
||||
* chore: release 1.4.2 ([8d14ac5](https://github.com/vkarpov15/kareem/commit/8d14ac5))
|
||||
* fix: correct args re: Automattic/mongoose#5405 ([3f28ae6](https://github.com/vkarpov15/kareem/commit/3f28ae6)), closes [Automattic/mongoose#5405](https://github.com/Automattic/mongoose/issues/5405)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.1"></a>
|
||||
## <small>1.4.1 (2017-04-25)</small>
|
||||
|
||||
* chore: release 1.4.1 ([5ecf0c2](https://github.com/vkarpov15/kareem/commit/5ecf0c2))
|
||||
* fix: handle numAsyncPres with clone() ([c72e857](https://github.com/vkarpov15/kareem/commit/c72e857)), closes [#8](https://github.com/vkarpov15/kareem/issues/8)
|
||||
* test: repro #8 ([9b4d6b2](https://github.com/vkarpov15/kareem/commit/9b4d6b2)), closes [#8](https://github.com/vkarpov15/kareem/issues/8)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
## 1.4.0 (2017-04-19)
|
||||
|
||||
* chore: release 1.4.0 ([101c5f5](https://github.com/vkarpov15/kareem/commit/101c5f5))
|
||||
* feat: add merge() function ([285325e](https://github.com/vkarpov15/kareem/commit/285325e))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.0"></a>
|
||||
## 1.3.0 (2017-03-26)
|
||||
|
||||
* chore: release 1.3.0 ([f3a9e50](https://github.com/vkarpov15/kareem/commit/f3a9e50))
|
||||
* feat: pass function args to execPre ([4dd466d](https://github.com/vkarpov15/kareem/commit/4dd466d))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.1"></a>
|
||||
## <small>1.2.1 (2017-02-03)</small>
|
||||
|
||||
* chore: release 1.2.1 ([d97081f](https://github.com/vkarpov15/kareem/commit/d97081f))
|
||||
* fix: filter out _kareemIgnored args for error handlers re: Automattic/mongoose#4925 ([ddc7aeb](https://github.com/vkarpov15/kareem/commit/ddc7aeb)), closes [Automattic/mongoose#4925](https://github.com/Automattic/mongoose/issues/4925)
|
||||
* fix: make error handlers handle errors in pre hooks ([af38033](https://github.com/vkarpov15/kareem/commit/af38033)), closes [Automattic/mongoose#4927](https://github.com/Automattic/mongoose/issues/4927)
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
## 1.2.0 (2017-01-02)
|
||||
|
||||
* chore: release 1.2.0 ([033225c](https://github.com/vkarpov15/kareem/commit/033225c))
|
||||
* chore: upgrade deps ([f9e9a09](https://github.com/vkarpov15/kareem/commit/f9e9a09))
|
||||
* feat: add _kareemIgnore re: Automattic/mongoose#4836 ([7957771](https://github.com/vkarpov15/kareem/commit/7957771)), closes [Automattic/mongoose#4836](https://github.com/Automattic/mongoose/issues/4836)
|
||||
|
||||
|
||||
|
||||
<a name="1.1.5"></a>
|
||||
## <small>1.1.5 (2016-12-13)</small>
|
||||
|
||||
* chore: release 1.1.5 ([1a9f684](https://github.com/vkarpov15/kareem/commit/1a9f684))
|
||||
* fix: correct field name ([04a0e9d](https://github.com/vkarpov15/kareem/commit/04a0e9d))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.4"></a>
|
||||
## <small>1.1.4 (2016-12-09)</small>
|
||||
|
||||
* chore: release 1.1.4 ([ece401c](https://github.com/vkarpov15/kareem/commit/ece401c))
|
||||
* chore: run tests on node 6 ([e0cb1cb](https://github.com/vkarpov15/kareem/commit/e0cb1cb))
|
||||
* fix: only copy own properties in clone() ([dfe28ce](https://github.com/vkarpov15/kareem/commit/dfe28ce)), closes [#7](https://github.com/vkarpov15/kareem/issues/7)
|
||||
|
||||
|
||||
|
||||
<a name="1.1.3"></a>
|
||||
## <small>1.1.3 (2016-06-27)</small>
|
||||
|
||||
* chore: release 1.1.3 ([87171c8](https://github.com/vkarpov15/kareem/commit/87171c8))
|
||||
* fix: couple more issues with arg processing ([c65f523](https://github.com/vkarpov15/kareem/commit/c65f523))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.2"></a>
|
||||
## <small>1.1.2 (2016-06-27)</small>
|
||||
|
||||
* chore: release 1.1.2 ([8e102b6](https://github.com/vkarpov15/kareem/commit/8e102b6))
|
||||
* fix: add early return ([4feda4e](https://github.com/vkarpov15/kareem/commit/4feda4e))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.1"></a>
|
||||
## <small>1.1.1 (2016-06-27)</small>
|
||||
|
||||
* chore: release 1.1.1 ([8bb3050](https://github.com/vkarpov15/kareem/commit/8bb3050))
|
||||
* fix: skip error handlers if no error ([0eb3a44](https://github.com/vkarpov15/kareem/commit/0eb3a44))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
## 1.1.0 (2016-05-11)
|
||||
|
||||
* chore: release 1.1.0 ([85332d9](https://github.com/vkarpov15/kareem/commit/85332d9))
|
||||
* chore: test on node 4 and node 5 ([1faefa1](https://github.com/vkarpov15/kareem/commit/1faefa1))
|
||||
* 100% coverage again ([c9aee4e](https://github.com/vkarpov15/kareem/commit/c9aee4e))
|
||||
* add support for error post hooks ([d378113](https://github.com/vkarpov15/kareem/commit/d378113))
|
||||
* basic setup for sync hooks #4 ([55aa081](https://github.com/vkarpov15/kareem/commit/55aa081)), closes [#4](https://github.com/vkarpov15/kareem/issues/4)
|
||||
* proof of concept for error handlers ([e4a07d9](https://github.com/vkarpov15/kareem/commit/e4a07d9))
|
||||
* refactor out handleWrapError helper ([b19af38](https://github.com/vkarpov15/kareem/commit/b19af38))
|
||||
|
||||
|
||||
|
||||
<a name="1.0.1"></a>
|
||||
## <small>1.0.1 (2015-05-10)</small>
|
||||
|
||||
* Fix #1 ([de60dc6](https://github.com/vkarpov15/kareem/commit/de60dc6)), closes [#1](https://github.com/vkarpov15/kareem/issues/1)
|
||||
* release 1.0.1 ([6971088](https://github.com/vkarpov15/kareem/commit/6971088))
|
||||
* Run tests on iojs in travis ([adcd201](https://github.com/vkarpov15/kareem/commit/adcd201))
|
||||
* support legacy post hook behavior in wrap() ([23fa74c](https://github.com/vkarpov15/kareem/commit/23fa74c))
|
||||
* Use node 0.12 in travis ([834689d](https://github.com/vkarpov15/kareem/commit/834689d))
|
||||
|
||||
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
## 1.0.0 (2015-01-28)
|
||||
|
||||
* Tag 1.0.0 ([4c5a35a](https://github.com/vkarpov15/kareem/commit/4c5a35a))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.8"></a>
|
||||
## <small>0.0.8 (2015-01-27)</small>
|
||||
|
||||
* Add clone function ([688bba7](https://github.com/vkarpov15/kareem/commit/688bba7))
|
||||
* Add jscs for style checking ([5c93149](https://github.com/vkarpov15/kareem/commit/5c93149))
|
||||
* Bump 0.0.8 ([03c0d2f](https://github.com/vkarpov15/kareem/commit/03c0d2f))
|
||||
* Fix jscs config, add gulp rules ([9989abf](https://github.com/vkarpov15/kareem/commit/9989abf))
|
||||
* fix Makefile typo ([1f7e61a](https://github.com/vkarpov15/kareem/commit/1f7e61a))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.7"></a>
|
||||
## <small>0.0.7 (2015-01-04)</small>
|
||||
|
||||
* Bump 0.0.7 ([98ef173](https://github.com/vkarpov15/kareem/commit/98ef173))
|
||||
* fix LearnBoost/mongoose#2553 - use null instead of undefined for err ([9157b48](https://github.com/vkarpov15/kareem/commit/9157b48)), closes [LearnBoost/mongoose#2553](https://github.com/LearnBoost/mongoose/issues/2553)
|
||||
* Regenerate docs ([2331cdf](https://github.com/vkarpov15/kareem/commit/2331cdf))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.6"></a>
|
||||
## <small>0.0.6 (2015-01-01)</small>
|
||||
|
||||
* Update docs and bump 0.0.6 ([92c12a7](https://github.com/vkarpov15/kareem/commit/92c12a7))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.5"></a>
|
||||
## <small>0.0.5 (2015-01-01)</small>
|
||||
|
||||
* Add coverage rule to Makefile ([825a91c](https://github.com/vkarpov15/kareem/commit/825a91c))
|
||||
* Add coveralls to README ([fb52369](https://github.com/vkarpov15/kareem/commit/fb52369))
|
||||
* Add coveralls to travis ([93f6f15](https://github.com/vkarpov15/kareem/commit/93f6f15))
|
||||
* Add createWrapper() function ([ea77741](https://github.com/vkarpov15/kareem/commit/ea77741))
|
||||
* Add istanbul code coverage ([6eceeef](https://github.com/vkarpov15/kareem/commit/6eceeef))
|
||||
* Add some more comments for examples ([c5b0c6f](https://github.com/vkarpov15/kareem/commit/c5b0c6f))
|
||||
* Add travis ([e6dcb06](https://github.com/vkarpov15/kareem/commit/e6dcb06))
|
||||
* Add travis badge to docs ([ad8c9b3](https://github.com/vkarpov15/kareem/commit/ad8c9b3))
|
||||
* Add wrap() tests, 100% coverage ([6945be4](https://github.com/vkarpov15/kareem/commit/6945be4))
|
||||
* Better test coverage for execPost ([d9ad539](https://github.com/vkarpov15/kareem/commit/d9ad539))
|
||||
* Bump 0.0.5 ([69875b1](https://github.com/vkarpov15/kareem/commit/69875b1))
|
||||
* Docs fix ([15b7098](https://github.com/vkarpov15/kareem/commit/15b7098))
|
||||
* Fix silly mistake in docs generation ([50373eb](https://github.com/vkarpov15/kareem/commit/50373eb))
|
||||
* Fix typo in readme ([fec4925](https://github.com/vkarpov15/kareem/commit/fec4925))
|
||||
* Linkify travis badge ([92b25fe](https://github.com/vkarpov15/kareem/commit/92b25fe))
|
||||
* Make travis run coverage ([747157b](https://github.com/vkarpov15/kareem/commit/747157b))
|
||||
* Move travis status badge ([d52e89b](https://github.com/vkarpov15/kareem/commit/d52e89b))
|
||||
* Quick fix for coverage ([50bbddb](https://github.com/vkarpov15/kareem/commit/50bbddb))
|
||||
* Typo fix ([adea794](https://github.com/vkarpov15/kareem/commit/adea794))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.4"></a>
|
||||
## <small>0.0.4 (2014-12-13)</small>
|
||||
|
||||
* Bump 0.0.4, run docs generation ([51a15fe](https://github.com/vkarpov15/kareem/commit/51a15fe))
|
||||
* Use correct post parameters in wrap() ([9bb5da3](https://github.com/vkarpov15/kareem/commit/9bb5da3))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.3"></a>
|
||||
## <small>0.0.3 (2014-12-12)</small>
|
||||
|
||||
* Add npm test script, fix small bug with args not getting passed through post ([49e3e68](https://github.com/vkarpov15/kareem/commit/49e3e68))
|
||||
* Bump 0.0.3 ([65621d8](https://github.com/vkarpov15/kareem/commit/65621d8))
|
||||
* Update readme ([901388b](https://github.com/vkarpov15/kareem/commit/901388b))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.2"></a>
|
||||
## <small>0.0.2 (2014-12-12)</small>
|
||||
|
||||
* Add github repo and bump 0.0.2 ([59db8be](https://github.com/vkarpov15/kareem/commit/59db8be))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.1"></a>
|
||||
## <small>0.0.1 (2014-12-12)</small>
|
||||
|
||||
* Add basic docs ([ad29ea4](https://github.com/vkarpov15/kareem/commit/ad29ea4))
|
||||
* Add pre hooks ([2ffc356](https://github.com/vkarpov15/kareem/commit/2ffc356))
|
||||
* Add wrap function ([68c540c](https://github.com/vkarpov15/kareem/commit/68c540c))
|
||||
* Bump to version 0.0.1 ([a4bfd68](https://github.com/vkarpov15/kareem/commit/a4bfd68))
|
||||
* Initial commit ([4002458](https://github.com/vkarpov15/kareem/commit/4002458))
|
||||
* Initial deposit ([98fc489](https://github.com/vkarpov15/kareem/commit/98fc489))
|
||||
* Post hooks ([395b67c](https://github.com/vkarpov15/kareem/commit/395b67c))
|
||||
* Some basic setup work ([82df75e](https://github.com/vkarpov15/kareem/commit/82df75e))
|
||||
* Support sync pre hooks ([1cc1b9f](https://github.com/vkarpov15/kareem/commit/1cc1b9f))
|
||||
* Update package.json description ([978da18](https://github.com/vkarpov15/kareem/commit/978da18))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.5"></a>
|
||||
## <small>2.2.5 (2018-09-24)</small>
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.2.4"></a>
|
||||
## <small>2.2.4 (2018-09-24)</small>
|
||||
|
||||
|
||||
|
||||
|
||||
<a name="2.2.3"></a>
|
||||
## <small>2.2.3 (2018-09-24)</small>
|
||||
|
||||
* fix(filter): copy async pres correctly with `filter()` ([1b1ed8a](https://github.com/vkarpov15/kareem/commit/1b1ed8a)), closes [Automattic/mongoose#3054](https://github.com/Automattic/mongoose/issues/3054)
|
||||
* feat: add filter() function ([1f641f4](https://github.com/vkarpov15/kareem/commit/1f641f4))
|
||||
* feat: support storing options on pre and post hooks ([59220b9](https://github.com/vkarpov15/kareem/commit/59220b9))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.3"></a>
|
||||
## <small>2.2.3 (2018-09-10)</small>
|
||||
|
||||
* chore: release 2.2.3 ([af653a3](https://github.com/vkarpov15/kareem/commit/af653a3))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.2"></a>
|
||||
## <small>2.2.2 (2018-09-10)</small>
|
||||
|
||||
* chore: release 2.2.2 ([3f0144d](https://github.com/vkarpov15/kareem/commit/3f0144d))
|
||||
* fix: allow merge() to not clone ([e628d65](https://github.com/vkarpov15/kareem/commit/e628d65))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.1"></a>
|
||||
## <small>2.2.1 (2018-06-05)</small>
|
||||
|
||||
* chore: release 2.2.1 ([4625a64](https://github.com/vkarpov15/kareem/commit/4625a64))
|
||||
* chore: remove lockfile from git ([7f3e4e6](https://github.com/vkarpov15/kareem/commit/7f3e4e6))
|
||||
* fix: handle numAsync correctly when merging ([fef8e7e](https://github.com/vkarpov15/kareem/commit/fef8e7e))
|
||||
* test: repro issue with not copying numAsync ([952d9db](https://github.com/vkarpov15/kareem/commit/952d9db))
|
||||
|
||||
|
||||
|
||||
<a name="2.2.0"></a>
|
||||
## 2.2.0 (2018-06-05)
|
||||
|
||||
* chore: release 2.2.0 ([ff9ad03](https://github.com/vkarpov15/kareem/commit/ff9ad03))
|
||||
* fix: use maps instead of objects for _pres and _posts so `toString()` doesn't get reported as having ([55df303](https://github.com/vkarpov15/kareem/commit/55df303)), closes [Automattic/mongoose#6538](https://github.com/Automattic/mongoose/issues/6538)
|
||||
|
||||
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
## 2.1.0 (2018-05-16)
|
||||
|
||||
* chore: release 2.1.0 ([ba5f1bc](https://github.com/vkarpov15/kareem/commit/ba5f1bc))
|
||||
* feat: add option to check wrapped function return value for promises ([c9d7dd1](https://github.com/vkarpov15/kareem/commit/c9d7dd1))
|
||||
* refactor: use const in wrap() ([0fc21f9](https://github.com/vkarpov15/kareem/commit/0fc21f9))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.7"></a>
|
||||
## <small>2.0.7 (2018-04-28)</small>
|
||||
|
||||
* chore: release 2.0.7 ([0bf91e6](https://github.com/vkarpov15/kareem/commit/0bf91e6))
|
||||
* feat: add `hasHooks()` ([225f18d](https://github.com/vkarpov15/kareem/commit/225f18d)), closes [Automattic/mongoose#6385](https://github.com/Automattic/mongoose/issues/6385)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.6"></a>
|
||||
## <small>2.0.6 (2018-03-22)</small>
|
||||
|
||||
* chore: release 2.0.6 ([f3d406b](https://github.com/vkarpov15/kareem/commit/f3d406b))
|
||||
* fix(wrap): ensure fast path still wraps function in `nextTick()` for chaining ([7000494](https://github.com/vkarpov15/kareem/commit/7000494)), closes [Automattic/mongoose#6250](https://github.com/Automattic/mongoose/issues/6250) [dsanel/mongoose-delete#36](https://github.com/dsanel/mongoose-delete/issues/36)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.5"></a>
|
||||
## <small>2.0.5 (2018-02-22)</small>
|
||||
|
||||
* chore: release 2.0.5 ([3286612](https://github.com/vkarpov15/kareem/commit/3286612))
|
||||
* perf(createWrapper): don't create wrapper if there are no hooks ([5afc5b9](https://github.com/vkarpov15/kareem/commit/5afc5b9)), closes [Automattic/mongoose#6126](https://github.com/Automattic/mongoose/issues/6126)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.4"></a>
|
||||
## <small>2.0.4 (2018-02-08)</small>
|
||||
|
||||
* chore: release 2.0.4 ([2ab0293](https://github.com/vkarpov15/kareem/commit/2ab0293))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.3"></a>
|
||||
## <small>2.0.3 (2018-02-01)</small>
|
||||
|
||||
* chore: release 2.0.3 ([3c1abe5](https://github.com/vkarpov15/kareem/commit/3c1abe5))
|
||||
* fix: use process.nextTick() re: Automattic/mongoose#6074 ([e5bfe33](https://github.com/vkarpov15/kareem/commit/e5bfe33)), closes [Automattic/mongoose#6074](https://github.com/Automattic/mongoose/issues/6074)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.2"></a>
|
||||
## <small>2.0.2 (2018-01-24)</small>
|
||||
|
||||
* chore: fix license ([a9d755c](https://github.com/vkarpov15/kareem/commit/a9d755c)), closes [#10](https://github.com/vkarpov15/kareem/issues/10)
|
||||
* chore: release 2.0.2 ([fe87ab6](https://github.com/vkarpov15/kareem/commit/fe87ab6))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.1"></a>
|
||||
## <small>2.0.1 (2018-01-09)</small>
|
||||
|
||||
* chore: release 2.0.1 with lockfile bump ([09c44fb](https://github.com/vkarpov15/kareem/commit/09c44fb))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0"></a>
|
||||
## 2.0.0 (2018-01-09)
|
||||
|
||||
* chore: bump marked re: security ([cc564a9](https://github.com/vkarpov15/kareem/commit/cc564a9))
|
||||
* chore: release 2.0.0 ([f511d1c](https://github.com/vkarpov15/kareem/commit/f511d1c))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc5"></a>
|
||||
## 2.0.0-rc5 (2017-12-23)
|
||||
|
||||
* chore: fix build on node 4+5 ([6dac5a4](https://github.com/vkarpov15/kareem/commit/6dac5a4))
|
||||
* chore: fix built on node 4 + 5 again ([434ef0a](https://github.com/vkarpov15/kareem/commit/434ef0a))
|
||||
* chore: release 2.0.0-rc5 ([25a32ee](https://github.com/vkarpov15/kareem/commit/25a32ee))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc4"></a>
|
||||
## 2.0.0-rc4 (2017-12-22)
|
||||
|
||||
* chore: release 2.0.0-rc4 ([49fc083](https://github.com/vkarpov15/kareem/commit/49fc083))
|
||||
* BREAKING CHANGE: deduplicate when merging hooks re: Automattic/mongoose#2945 ([d458573](https://github.com/vkarpov15/kareem/commit/d458573)), closes [Automattic/mongoose#2945](https://github.com/Automattic/mongoose/issues/2945)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc3"></a>
|
||||
## 2.0.0-rc3 (2017-12-22)
|
||||
|
||||
* chore: release 2.0.0-rc3 ([adaaa00](https://github.com/vkarpov15/kareem/commit/adaaa00))
|
||||
* feat: support returning promises from middleware functions ([05b4480](https://github.com/vkarpov15/kareem/commit/05b4480)), closes [Automattic/mongoose#3779](https://github.com/Automattic/mongoose/issues/3779)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc2"></a>
|
||||
## 2.0.0-rc2 (2017-12-21)
|
||||
|
||||
* chore: release 2.0.0-rc2 ([76325fa](https://github.com/vkarpov15/kareem/commit/76325fa))
|
||||
* fix: ensure next() and done() run in next tick ([6c20684](https://github.com/vkarpov15/kareem/commit/6c20684))
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc1"></a>
|
||||
## 2.0.0-rc1 (2017-12-21)
|
||||
|
||||
* chore: improve test coverage re: Automattic/mongoose#3232 ([7b45cf0](https://github.com/vkarpov15/kareem/commit/7b45cf0)), closes [Automattic/mongoose#3232](https://github.com/Automattic/mongoose/issues/3232)
|
||||
* chore: release 2.0.0-rc1 ([9b83f52](https://github.com/vkarpov15/kareem/commit/9b83f52))
|
||||
* BREAKING CHANGE: report sync exceptions as errors, only allow calling next() and done() once ([674adcc](https://github.com/vkarpov15/kareem/commit/674adcc)), closes [Automattic/mongoose#3483](https://github.com/Automattic/mongoose/issues/3483)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.0-rc0"></a>
|
||||
## 2.0.0-rc0 (2017-12-17)
|
||||
|
||||
* chore: release 2.0.0-rc0 ([16b44b5](https://github.com/vkarpov15/kareem/commit/16b44b5))
|
||||
* BREAKING CHANGE: drop support for node < 4 ([9cbb8c7](https://github.com/vkarpov15/kareem/commit/9cbb8c7))
|
||||
* BREAKING CHANGE: remove useLegacyPost and add several new features ([6dd8531](https://github.com/vkarpov15/kareem/commit/6dd8531)), closes [Automattic/mongoose#3232](https://github.com/Automattic/mongoose/issues/3232)
|
||||
|
||||
|
||||
|
||||
<a name="1.5.0"></a>
|
||||
## 1.5.0 (2017-07-20)
|
||||
|
||||
* chore: release 1.5.0 ([9c491a0](https://github.com/vkarpov15/kareem/commit/9c491a0))
|
||||
* fix: improve post error handlers results ([9928dd5](https://github.com/vkarpov15/kareem/commit/9928dd5)), closes [Automattic/mongoose#5466](https://github.com/Automattic/mongoose/issues/5466)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.2"></a>
|
||||
## <small>1.4.2 (2017-07-06)</small>
|
||||
|
||||
* chore: release 1.4.2 ([8d14ac5](https://github.com/vkarpov15/kareem/commit/8d14ac5))
|
||||
* fix: correct args re: Automattic/mongoose#5405 ([3f28ae6](https://github.com/vkarpov15/kareem/commit/3f28ae6)), closes [Automattic/mongoose#5405](https://github.com/Automattic/mongoose/issues/5405)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.1"></a>
|
||||
## <small>1.4.1 (2017-04-25)</small>
|
||||
|
||||
* chore: release 1.4.1 ([5ecf0c2](https://github.com/vkarpov15/kareem/commit/5ecf0c2))
|
||||
* fix: handle numAsyncPres with clone() ([c72e857](https://github.com/vkarpov15/kareem/commit/c72e857)), closes [#8](https://github.com/vkarpov15/kareem/issues/8)
|
||||
* test: repro #8 ([9b4d6b2](https://github.com/vkarpov15/kareem/commit/9b4d6b2)), closes [#8](https://github.com/vkarpov15/kareem/issues/8)
|
||||
|
||||
|
||||
|
||||
<a name="1.4.0"></a>
|
||||
## 1.4.0 (2017-04-19)
|
||||
|
||||
* chore: release 1.4.0 ([101c5f5](https://github.com/vkarpov15/kareem/commit/101c5f5))
|
||||
* feat: add merge() function ([285325e](https://github.com/vkarpov15/kareem/commit/285325e))
|
||||
|
||||
|
||||
|
||||
<a name="1.3.0"></a>
|
||||
## 1.3.0 (2017-03-26)
|
||||
|
||||
* chore: release 1.3.0 ([f3a9e50](https://github.com/vkarpov15/kareem/commit/f3a9e50))
|
||||
* feat: pass function args to execPre ([4dd466d](https://github.com/vkarpov15/kareem/commit/4dd466d))
|
||||
|
||||
|
||||
|
||||
<a name="1.2.1"></a>
|
||||
## <small>1.2.1 (2017-02-03)</small>
|
||||
|
||||
* chore: release 1.2.1 ([d97081f](https://github.com/vkarpov15/kareem/commit/d97081f))
|
||||
* fix: filter out _kareemIgnored args for error handlers re: Automattic/mongoose#4925 ([ddc7aeb](https://github.com/vkarpov15/kareem/commit/ddc7aeb)), closes [Automattic/mongoose#4925](https://github.com/Automattic/mongoose/issues/4925)
|
||||
* fix: make error handlers handle errors in pre hooks ([af38033](https://github.com/vkarpov15/kareem/commit/af38033)), closes [Automattic/mongoose#4927](https://github.com/Automattic/mongoose/issues/4927)
|
||||
|
||||
|
||||
|
||||
<a name="1.2.0"></a>
|
||||
## 1.2.0 (2017-01-02)
|
||||
|
||||
* chore: release 1.2.0 ([033225c](https://github.com/vkarpov15/kareem/commit/033225c))
|
||||
* chore: upgrade deps ([f9e9a09](https://github.com/vkarpov15/kareem/commit/f9e9a09))
|
||||
* feat: add _kareemIgnore re: Automattic/mongoose#4836 ([7957771](https://github.com/vkarpov15/kareem/commit/7957771)), closes [Automattic/mongoose#4836](https://github.com/Automattic/mongoose/issues/4836)
|
||||
|
||||
|
||||
|
||||
<a name="1.1.5"></a>
|
||||
## <small>1.1.5 (2016-12-13)</small>
|
||||
|
||||
* chore: release 1.1.5 ([1a9f684](https://github.com/vkarpov15/kareem/commit/1a9f684))
|
||||
* fix: correct field name ([04a0e9d](https://github.com/vkarpov15/kareem/commit/04a0e9d))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.4"></a>
|
||||
## <small>1.1.4 (2016-12-09)</small>
|
||||
|
||||
* chore: release 1.1.4 ([ece401c](https://github.com/vkarpov15/kareem/commit/ece401c))
|
||||
* chore: run tests on node 6 ([e0cb1cb](https://github.com/vkarpov15/kareem/commit/e0cb1cb))
|
||||
* fix: only copy own properties in clone() ([dfe28ce](https://github.com/vkarpov15/kareem/commit/dfe28ce)), closes [#7](https://github.com/vkarpov15/kareem/issues/7)
|
||||
|
||||
|
||||
|
||||
<a name="1.1.3"></a>
|
||||
## <small>1.1.3 (2016-06-27)</small>
|
||||
|
||||
* chore: release 1.1.3 ([87171c8](https://github.com/vkarpov15/kareem/commit/87171c8))
|
||||
* fix: couple more issues with arg processing ([c65f523](https://github.com/vkarpov15/kareem/commit/c65f523))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.2"></a>
|
||||
## <small>1.1.2 (2016-06-27)</small>
|
||||
|
||||
* chore: release 1.1.2 ([8e102b6](https://github.com/vkarpov15/kareem/commit/8e102b6))
|
||||
* fix: add early return ([4feda4e](https://github.com/vkarpov15/kareem/commit/4feda4e))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.1"></a>
|
||||
## <small>1.1.1 (2016-06-27)</small>
|
||||
|
||||
* chore: release 1.1.1 ([8bb3050](https://github.com/vkarpov15/kareem/commit/8bb3050))
|
||||
* fix: skip error handlers if no error ([0eb3a44](https://github.com/vkarpov15/kareem/commit/0eb3a44))
|
||||
|
||||
|
||||
|
||||
<a name="1.1.0"></a>
|
||||
## 1.1.0 (2016-05-11)
|
||||
|
||||
* chore: release 1.1.0 ([85332d9](https://github.com/vkarpov15/kareem/commit/85332d9))
|
||||
* chore: test on node 4 and node 5 ([1faefa1](https://github.com/vkarpov15/kareem/commit/1faefa1))
|
||||
* 100% coverage again ([c9aee4e](https://github.com/vkarpov15/kareem/commit/c9aee4e))
|
||||
* add support for error post hooks ([d378113](https://github.com/vkarpov15/kareem/commit/d378113))
|
||||
* basic setup for sync hooks #4 ([55aa081](https://github.com/vkarpov15/kareem/commit/55aa081)), closes [#4](https://github.com/vkarpov15/kareem/issues/4)
|
||||
* proof of concept for error handlers ([e4a07d9](https://github.com/vkarpov15/kareem/commit/e4a07d9))
|
||||
* refactor out handleWrapError helper ([b19af38](https://github.com/vkarpov15/kareem/commit/b19af38))
|
||||
|
||||
|
||||
|
||||
<a name="1.0.1"></a>
|
||||
## <small>1.0.1 (2015-05-10)</small>
|
||||
|
||||
* Fix #1 ([de60dc6](https://github.com/vkarpov15/kareem/commit/de60dc6)), closes [#1](https://github.com/vkarpov15/kareem/issues/1)
|
||||
* release 1.0.1 ([6971088](https://github.com/vkarpov15/kareem/commit/6971088))
|
||||
* Run tests on iojs in travis ([adcd201](https://github.com/vkarpov15/kareem/commit/adcd201))
|
||||
* support legacy post hook behavior in wrap() ([23fa74c](https://github.com/vkarpov15/kareem/commit/23fa74c))
|
||||
* Use node 0.12 in travis ([834689d](https://github.com/vkarpov15/kareem/commit/834689d))
|
||||
|
||||
|
||||
|
||||
<a name="1.0.0"></a>
|
||||
## 1.0.0 (2015-01-28)
|
||||
|
||||
* Tag 1.0.0 ([4c5a35a](https://github.com/vkarpov15/kareem/commit/4c5a35a))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.8"></a>
|
||||
## <small>0.0.8 (2015-01-27)</small>
|
||||
|
||||
* Add clone function ([688bba7](https://github.com/vkarpov15/kareem/commit/688bba7))
|
||||
* Add jscs for style checking ([5c93149](https://github.com/vkarpov15/kareem/commit/5c93149))
|
||||
* Bump 0.0.8 ([03c0d2f](https://github.com/vkarpov15/kareem/commit/03c0d2f))
|
||||
* Fix jscs config, add gulp rules ([9989abf](https://github.com/vkarpov15/kareem/commit/9989abf))
|
||||
* fix Makefile typo ([1f7e61a](https://github.com/vkarpov15/kareem/commit/1f7e61a))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.7"></a>
|
||||
## <small>0.0.7 (2015-01-04)</small>
|
||||
|
||||
* Bump 0.0.7 ([98ef173](https://github.com/vkarpov15/kareem/commit/98ef173))
|
||||
* fix LearnBoost/mongoose#2553 - use null instead of undefined for err ([9157b48](https://github.com/vkarpov15/kareem/commit/9157b48)), closes [LearnBoost/mongoose#2553](https://github.com/LearnBoost/mongoose/issues/2553)
|
||||
* Regenerate docs ([2331cdf](https://github.com/vkarpov15/kareem/commit/2331cdf))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.6"></a>
|
||||
## <small>0.0.6 (2015-01-01)</small>
|
||||
|
||||
* Update docs and bump 0.0.6 ([92c12a7](https://github.com/vkarpov15/kareem/commit/92c12a7))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.5"></a>
|
||||
## <small>0.0.5 (2015-01-01)</small>
|
||||
|
||||
* Add coverage rule to Makefile ([825a91c](https://github.com/vkarpov15/kareem/commit/825a91c))
|
||||
* Add coveralls to README ([fb52369](https://github.com/vkarpov15/kareem/commit/fb52369))
|
||||
* Add coveralls to travis ([93f6f15](https://github.com/vkarpov15/kareem/commit/93f6f15))
|
||||
* Add createWrapper() function ([ea77741](https://github.com/vkarpov15/kareem/commit/ea77741))
|
||||
* Add istanbul code coverage ([6eceeef](https://github.com/vkarpov15/kareem/commit/6eceeef))
|
||||
* Add some more comments for examples ([c5b0c6f](https://github.com/vkarpov15/kareem/commit/c5b0c6f))
|
||||
* Add travis ([e6dcb06](https://github.com/vkarpov15/kareem/commit/e6dcb06))
|
||||
* Add travis badge to docs ([ad8c9b3](https://github.com/vkarpov15/kareem/commit/ad8c9b3))
|
||||
* Add wrap() tests, 100% coverage ([6945be4](https://github.com/vkarpov15/kareem/commit/6945be4))
|
||||
* Better test coverage for execPost ([d9ad539](https://github.com/vkarpov15/kareem/commit/d9ad539))
|
||||
* Bump 0.0.5 ([69875b1](https://github.com/vkarpov15/kareem/commit/69875b1))
|
||||
* Docs fix ([15b7098](https://github.com/vkarpov15/kareem/commit/15b7098))
|
||||
* Fix silly mistake in docs generation ([50373eb](https://github.com/vkarpov15/kareem/commit/50373eb))
|
||||
* Fix typo in readme ([fec4925](https://github.com/vkarpov15/kareem/commit/fec4925))
|
||||
* Linkify travis badge ([92b25fe](https://github.com/vkarpov15/kareem/commit/92b25fe))
|
||||
* Make travis run coverage ([747157b](https://github.com/vkarpov15/kareem/commit/747157b))
|
||||
* Move travis status badge ([d52e89b](https://github.com/vkarpov15/kareem/commit/d52e89b))
|
||||
* Quick fix for coverage ([50bbddb](https://github.com/vkarpov15/kareem/commit/50bbddb))
|
||||
* Typo fix ([adea794](https://github.com/vkarpov15/kareem/commit/adea794))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.4"></a>
|
||||
## <small>0.0.4 (2014-12-13)</small>
|
||||
|
||||
* Bump 0.0.4, run docs generation ([51a15fe](https://github.com/vkarpov15/kareem/commit/51a15fe))
|
||||
* Use correct post parameters in wrap() ([9bb5da3](https://github.com/vkarpov15/kareem/commit/9bb5da3))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.3"></a>
|
||||
## <small>0.0.3 (2014-12-12)</small>
|
||||
|
||||
* Add npm test script, fix small bug with args not getting passed through post ([49e3e68](https://github.com/vkarpov15/kareem/commit/49e3e68))
|
||||
* Bump 0.0.3 ([65621d8](https://github.com/vkarpov15/kareem/commit/65621d8))
|
||||
* Update readme ([901388b](https://github.com/vkarpov15/kareem/commit/901388b))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.2"></a>
|
||||
## <small>0.0.2 (2014-12-12)</small>
|
||||
|
||||
* Add github repo and bump 0.0.2 ([59db8be](https://github.com/vkarpov15/kareem/commit/59db8be))
|
||||
|
||||
|
||||
|
||||
<a name="0.0.1"></a>
|
||||
## <small>0.0.1 (2014-12-12)</small>
|
||||
|
||||
* Add basic docs ([ad29ea4](https://github.com/vkarpov15/kareem/commit/ad29ea4))
|
||||
* Add pre hooks ([2ffc356](https://github.com/vkarpov15/kareem/commit/2ffc356))
|
||||
* Add wrap function ([68c540c](https://github.com/vkarpov15/kareem/commit/68c540c))
|
||||
* Bump to version 0.0.1 ([a4bfd68](https://github.com/vkarpov15/kareem/commit/a4bfd68))
|
||||
* Initial commit ([4002458](https://github.com/vkarpov15/kareem/commit/4002458))
|
||||
* Initial deposit ([98fc489](https://github.com/vkarpov15/kareem/commit/98fc489))
|
||||
* Post hooks ([395b67c](https://github.com/vkarpov15/kareem/commit/395b67c))
|
||||
* Some basic setup work ([82df75e](https://github.com/vkarpov15/kareem/commit/82df75e))
|
||||
* Support sync pre hooks ([1cc1b9f](https://github.com/vkarpov15/kareem/commit/1cc1b9f))
|
||||
* Update package.json description ([978da18](https://github.com/vkarpov15/kareem/commit/978da18))
|
||||
202
backend/node_modules/kareem/LICENSE
generated
vendored
Normal file
202
backend/node_modules/kareem/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2014-2022 mongoosejs
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
385
backend/node_modules/kareem/README.md
generated
vendored
Normal file
385
backend/node_modules/kareem/README.md
generated
vendored
Normal file
@@ -0,0 +1,385 @@
|
||||
# kareem
|
||||
|
||||
[](https://github.com/mongoosejs/kareem/actions/workflows/test.yml)
|
||||
<!--[](https://coveralls.io/r/vkarpov15/kareem)-->
|
||||
|
||||
Re-imagined take on the [hooks](http://npmjs.org/package/hooks) module, meant to offer additional flexibility in allowing you to execute hooks whenever necessary, as opposed to simply wrapping a single function.
|
||||
|
||||
Named for the NBA's 2nd all-time leading scorer Kareem Abdul-Jabbar, known for his mastery of the [hook shot](http://en.wikipedia.org/wiki/Kareem_Abdul-Jabbar#Skyhook)
|
||||
|
||||
<img src="http://upload.wikimedia.org/wikipedia/commons/0/00/Kareem-Abdul-Jabbar_Lipofsky.jpg" width="220">
|
||||
|
||||
<!--DOCS START-->
|
||||
|
||||
# API
|
||||
|
||||
## pre hooks
|
||||
|
||||
Much like [hooks](https://npmjs.org/package/hooks), kareem lets you define
|
||||
pre and post hooks: pre hooks are called before a given function executes.
|
||||
Unlike hooks, kareem stores hooks and other internal state in a separate
|
||||
object, rather than relying on inheritance. Furthermore, kareem exposes
|
||||
an `execPre()` function that allows you to execute your pre hooks when
|
||||
appropriate, giving you more fine-grained control over your function hooks.
|
||||
|
||||
### It runs without any hooks specified
|
||||
|
||||
```javascript
|
||||
await hooks.execPre('cook', null);
|
||||
```
|
||||
|
||||
### It runs basic serial pre hooks
|
||||
|
||||
pre hook functions can return a promise that resolves when finished.
|
||||
|
||||
```javascript
|
||||
let count = 0;
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
++count;
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
await hooks.execPre('cook', null);
|
||||
assert.equal(1, count);
|
||||
```
|
||||
|
||||
### It can run multiple pre hooks
|
||||
|
||||
```javascript
|
||||
let count1 = 0;
|
||||
let count2 = 0;
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
++count1;
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
++count2;
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
await hooks.execPre('cook', null);
|
||||
assert.equal(1, count1);
|
||||
assert.equal(1, count2);
|
||||
```
|
||||
|
||||
### It can run fully synchronous pre hooks
|
||||
|
||||
If your pre hook function takes no parameters, its assumed to be
|
||||
fully synchronous.
|
||||
|
||||
```javascript
|
||||
let count1 = 0;
|
||||
let count2 = 0;
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
++count1;
|
||||
});
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
++count2;
|
||||
});
|
||||
|
||||
await hooks.execPre('cook', null);
|
||||
assert.equal(1, count1);
|
||||
assert.equal(1, count2);
|
||||
```
|
||||
|
||||
### It properly attaches context to pre hooks
|
||||
|
||||
Pre save hook functions are bound to the second parameter to `execPre()`
|
||||
|
||||
```javascript
|
||||
hooks.pre('cook', function() {
|
||||
this.bacon = 3;
|
||||
});
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
this.eggs = 4;
|
||||
});
|
||||
|
||||
const obj = { bacon: 0, eggs: 0 };
|
||||
|
||||
// In the pre hooks, `this` will refer to `obj`
|
||||
await hooks.execPre('cook', obj);
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
```
|
||||
|
||||
### It supports returning a promise
|
||||
|
||||
You can also return a promise from your pre hooks instead of calling
|
||||
`next()`. When the returned promise resolves, kareem will kick off the
|
||||
next middleware.
|
||||
|
||||
```javascript
|
||||
hooks.pre('cook', function() {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
this.bacon = 3;
|
||||
resolve();
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
const obj = { bacon: 0 };
|
||||
|
||||
await hooks.execPre('cook', obj);
|
||||
assert.equal(3, obj.bacon);
|
||||
```
|
||||
|
||||
### It supports filtering which hooks to run
|
||||
|
||||
You can pass a `filter` option to `execPre()` to select which hooks
|
||||
to run. The filter function receives each hook object and should return
|
||||
`true` to run the hook or `false` to skip it.
|
||||
|
||||
```javascript
|
||||
const execed = [];
|
||||
|
||||
const fn1 = function() { execed.push('first'); };
|
||||
fn1.skipMe = true;
|
||||
hooks.pre('cook', fn1);
|
||||
|
||||
const fn2 = function() { execed.push('second'); };
|
||||
hooks.pre('cook', fn2);
|
||||
|
||||
// Only runs fn2, skips fn1 because fn1.skipMe is true
|
||||
await hooks.execPre('cook', null, [], {
|
||||
filter: hook => !hook.fn.skipMe
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(execed, ['second']);
|
||||
```
|
||||
|
||||
## post hooks
|
||||
|
||||
### It runs without any hooks specified
|
||||
|
||||
```javascript
|
||||
const [eggs] = await hooks.execPost('cook', null, [1]);
|
||||
assert.equal(eggs, 1);
|
||||
```
|
||||
|
||||
### It executes with parameters passed in
|
||||
|
||||
```javascript
|
||||
hooks.post('cook', function(eggs, bacon, callback) {
|
||||
assert.equal(eggs, 1);
|
||||
assert.equal(bacon, 2);
|
||||
callback();
|
||||
});
|
||||
|
||||
const [eggs, bacon] = await hooks.execPost('cook', null, [1, 2]);
|
||||
assert.equal(eggs, 1);
|
||||
assert.equal(bacon, 2);
|
||||
```
|
||||
|
||||
### It can use synchronous post hooks
|
||||
|
||||
```javascript
|
||||
const execed = {};
|
||||
|
||||
hooks.post('cook', function(eggs, bacon) {
|
||||
execed.first = true;
|
||||
assert.equal(eggs, 1);
|
||||
assert.equal(bacon, 2);
|
||||
});
|
||||
|
||||
hooks.post('cook', function(eggs, bacon, callback) {
|
||||
execed.second = true;
|
||||
assert.equal(eggs, 1);
|
||||
assert.equal(bacon, 2);
|
||||
callback();
|
||||
});
|
||||
|
||||
const [eggs, bacon] = await hooks.execPost('cook', null, [1, 2]);
|
||||
assert.equal(Object.keys(execed).length, 2);
|
||||
assert.ok(execed.first);
|
||||
assert.ok(execed.second);
|
||||
assert.equal(eggs, 1);
|
||||
assert.equal(bacon, 2);
|
||||
```
|
||||
|
||||
### It supports returning a promise
|
||||
|
||||
You can also return a promise from your post hooks instead of calling
|
||||
`next()`. When the returned promise resolves, kareem will kick off the
|
||||
next middleware.
|
||||
|
||||
```javascript
|
||||
hooks.post('cook', function() {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
this.bacon = 3;
|
||||
resolve();
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
const obj = { bacon: 0 };
|
||||
|
||||
await hooks.execPost('cook', obj, [obj]);
|
||||
assert.equal(obj.bacon, 3);
|
||||
```
|
||||
|
||||
### It supports filtering which hooks to run
|
||||
|
||||
You can pass a `filter` option to `execPost()` to select which hooks
|
||||
to run. The filter function receives each hook object and should return
|
||||
`true` to run the hook or `false` to skip it.
|
||||
|
||||
```javascript
|
||||
const execed = [];
|
||||
|
||||
const fn1 = function() { execed.push('first'); };
|
||||
fn1.skipMe = true;
|
||||
hooks.post('cook', fn1);
|
||||
|
||||
const fn2 = function() { execed.push('second'); };
|
||||
hooks.post('cook', fn2);
|
||||
|
||||
// Only runs fn2, skips fn1 because fn1.skipMe is true
|
||||
await hooks.execPost('cook', null, [], {
|
||||
filter: hook => !hook.fn.skipMe
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(execed, ['second']);
|
||||
```
|
||||
|
||||
## wrap()
|
||||
|
||||
### It wraps pre and post calls into one call
|
||||
|
||||
```javascript
|
||||
hooks.pre('cook', function() {
|
||||
return new Promise(resolve => {
|
||||
this.bacon = 3;
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 5);
|
||||
});
|
||||
});
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
this.eggs = 4;
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
this.waffles = false;
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
hooks.post('cook', function(obj) {
|
||||
obj.tofu = 'no';
|
||||
});
|
||||
|
||||
const obj = { bacon: 0, eggs: 0 };
|
||||
|
||||
const args = [obj];
|
||||
|
||||
const result = await hooks.wrap(
|
||||
'cook',
|
||||
function(o) {
|
||||
assert.equal(obj.bacon, 3);
|
||||
assert.equal(obj.eggs, 4);
|
||||
assert.equal(obj.waffles, false);
|
||||
assert.equal(obj.tofu, undefined);
|
||||
return o;
|
||||
},
|
||||
obj,
|
||||
args);
|
||||
|
||||
assert.equal(obj.bacon, 3);
|
||||
assert.equal(obj.eggs, 4);
|
||||
assert.equal(obj.waffles, false);
|
||||
assert.equal(obj.tofu, 'no');
|
||||
assert.equal(result, obj);
|
||||
```
|
||||
|
||||
## createWrapper()
|
||||
|
||||
### It wraps wrap() into a callable function
|
||||
|
||||
```javascript
|
||||
hooks.pre('cook', function() {
|
||||
this.bacon = 3;
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
return new Promise(resolve => {
|
||||
this.eggs = 4;
|
||||
setTimeout(function() {
|
||||
resolve();
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
|
||||
hooks.pre('cook', function() {
|
||||
this.waffles = false;
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
hooks.post('cook', function(obj) {
|
||||
obj.tofu = 'no';
|
||||
});
|
||||
|
||||
const obj = { bacon: 0, eggs: 0 };
|
||||
|
||||
const cook = hooks.createWrapper(
|
||||
'cook',
|
||||
function(o) {
|
||||
assert.equal(3, obj.bacon);
|
||||
assert.equal(4, obj.eggs);
|
||||
assert.equal(false, obj.waffles);
|
||||
assert.equal(undefined, obj.tofu);
|
||||
return o;
|
||||
},
|
||||
obj);
|
||||
|
||||
const result = await cook(obj);
|
||||
assert.equal(obj.bacon, 3);
|
||||
assert.equal(obj.eggs, 4);
|
||||
assert.equal(obj.waffles, false);
|
||||
assert.equal(obj.tofu, 'no');
|
||||
|
||||
assert.equal(result, obj);
|
||||
```
|
||||
|
||||
## clone()
|
||||
|
||||
### It clones a Kareem object
|
||||
|
||||
```javascript
|
||||
const k1 = new Kareem();
|
||||
k1.pre('cook', function() {});
|
||||
k1.post('cook', function() {});
|
||||
|
||||
const k2 = k1.clone();
|
||||
assert.deepEqual(Array.from(k2._pres.keys()), ['cook']);
|
||||
assert.deepEqual(Array.from(k2._posts.keys()), ['cook']);
|
||||
```
|
||||
|
||||
## merge()
|
||||
|
||||
### It pulls hooks from another Kareem object
|
||||
|
||||
```javascript
|
||||
const k1 = new Kareem();
|
||||
const test1 = function() {};
|
||||
k1.pre('cook', test1);
|
||||
k1.post('cook', function() {});
|
||||
|
||||
const k2 = new Kareem();
|
||||
const test2 = function() {};
|
||||
k2.pre('cook', test2);
|
||||
const k3 = k2.merge(k1);
|
||||
assert.equal(k3._pres.get('cook').length, 2);
|
||||
assert.equal(k3._pres.get('cook')[0].fn, test2);
|
||||
assert.equal(k3._pres.get('cook')[1].fn, test1);
|
||||
assert.equal(k3._posts.get('cook').length, 1);
|
||||
```
|
||||
5
backend/node_modules/kareem/SECURITY.md
generated
vendored
Normal file
5
backend/node_modules/kareem/SECURITY.md
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
## Security contact information
|
||||
|
||||
To report a security vulnerability, please use the
|
||||
[Tidelift security contact](https://tidelift.com/security).
|
||||
Tidelift will coordinate the fix and disclosure.
|
||||
224
backend/node_modules/kareem/coverage/lcov-report/base.css
generated
vendored
Normal file
224
backend/node_modules/kareem/coverage/lcov-report/base.css
generated
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
body, html {
|
||||
margin:0; padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica, Arial;
|
||||
font-size: 14px;
|
||||
color:#333;
|
||||
}
|
||||
.small { font-size: 12px; }
|
||||
*, *:after, *:before {
|
||||
-webkit-box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
box-sizing:border-box;
|
||||
}
|
||||
h1 { font-size: 20px; margin: 0;}
|
||||
h2 { font-size: 14px; }
|
||||
pre {
|
||||
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
a { color:#0074D9; text-decoration:none; }
|
||||
a:hover { text-decoration:underline; }
|
||||
.strong { font-weight: bold; }
|
||||
.space-top1 { padding: 10px 0 0 0; }
|
||||
.pad2y { padding: 20px 0; }
|
||||
.pad1y { padding: 10px 0; }
|
||||
.pad2x { padding: 0 20px; }
|
||||
.pad2 { padding: 20px; }
|
||||
.pad1 { padding: 10px; }
|
||||
.space-left2 { padding-left:55px; }
|
||||
.space-right2 { padding-right:20px; }
|
||||
.center { text-align:center; }
|
||||
.clearfix { display:block; }
|
||||
.clearfix:after {
|
||||
content:'';
|
||||
display:block;
|
||||
height:0;
|
||||
clear:both;
|
||||
visibility:hidden;
|
||||
}
|
||||
.fl { float: left; }
|
||||
@media only screen and (max-width:640px) {
|
||||
.col3 { width:100%; max-width:100%; }
|
||||
.hide-mobile { display:none!important; }
|
||||
}
|
||||
|
||||
.quiet {
|
||||
color: #7f7f7f;
|
||||
color: rgba(0,0,0,0.5);
|
||||
}
|
||||
.quiet a { opacity: 0.7; }
|
||||
|
||||
.fraction {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
background: #E8E8E8;
|
||||
padding: 4px 5px;
|
||||
border-radius: 3px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.path a:link, div.path a:visited { color: #333; }
|
||||
table.coverage {
|
||||
border-collapse: collapse;
|
||||
margin: 10px 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.coverage td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.coverage td.line-count {
|
||||
text-align: right;
|
||||
padding: 0 5px 0 20px;
|
||||
}
|
||||
table.coverage td.line-coverage {
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
min-width:20px;
|
||||
}
|
||||
|
||||
table.coverage td span.cline-any {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
width: 100%;
|
||||
}
|
||||
.missing-if-branch {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #333;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.skip-if-branch {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #ccc;
|
||||
color: white;
|
||||
}
|
||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
||||
color: inherit !important;
|
||||
}
|
||||
.coverage-summary {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
||||
.keyline-all { border: 1px solid #ddd; }
|
||||
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
||||
.coverage-summary tbody { border: 1px solid #bbb; }
|
||||
.coverage-summary td { border-right: 1px solid #bbb; }
|
||||
.coverage-summary td:last-child { border-right: none; }
|
||||
.coverage-summary th {
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.coverage-summary th.file { border-right: none !important; }
|
||||
.coverage-summary th.pct { }
|
||||
.coverage-summary th.pic,
|
||||
.coverage-summary th.abs,
|
||||
.coverage-summary td.pct,
|
||||
.coverage-summary td.abs { text-align: right; }
|
||||
.coverage-summary td.file { white-space: nowrap; }
|
||||
.coverage-summary td.pic { min-width: 120px !important; }
|
||||
.coverage-summary tfoot td { }
|
||||
|
||||
.coverage-summary .sorter {
|
||||
height: 10px;
|
||||
width: 7px;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
.coverage-summary .sorted .sorter {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
.coverage-summary .sorted-desc .sorter {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
.status-line { height: 10px; }
|
||||
/* yellow */
|
||||
.cbranch-no { background: yellow !important; color: #111; }
|
||||
/* dark red */
|
||||
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
||||
.low .chart { border:1px solid #C21F39 }
|
||||
.highlighted,
|
||||
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
|
||||
background: #C21F39 !important;
|
||||
}
|
||||
/* medium red */
|
||||
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
||||
/* light red */
|
||||
.low, .cline-no { background:#FCE1E5 }
|
||||
/* light green */
|
||||
.high, .cline-yes { background:rgb(230,245,208) }
|
||||
/* medium green */
|
||||
.cstat-yes { background:rgb(161,215,106) }
|
||||
/* dark green */
|
||||
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
||||
.high .chart { border:1px solid rgb(77,146,33) }
|
||||
/* dark yellow (gold) */
|
||||
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
|
||||
.medium .chart { border:1px solid #f9cd0b; }
|
||||
/* light yellow */
|
||||
.medium { background: #fff4c2; }
|
||||
|
||||
.cstat-skip { background: #ddd; color: #111; }
|
||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
||||
|
||||
span.cline-neutral { background: #eaeaea; }
|
||||
|
||||
.coverage-summary td.empty {
|
||||
opacity: .5;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
line-height: 1;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.cover-fill, .cover-empty {
|
||||
display:inline-block;
|
||||
height: 12px;
|
||||
}
|
||||
.chart {
|
||||
line-height: 0;
|
||||
}
|
||||
.cover-empty {
|
||||
background: white;
|
||||
}
|
||||
.cover-full {
|
||||
border-right: none !important;
|
||||
}
|
||||
pre.prettyprint {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.com { color: #999 !important; }
|
||||
.ignore-none { color: #999; font-weight: normal; }
|
||||
|
||||
.wrapper {
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%;
|
||||
margin: 0 auto -48px;
|
||||
}
|
||||
.footer, .push {
|
||||
height: 48px;
|
||||
}
|
||||
87
backend/node_modules/kareem/coverage/lcov-report/block-navigation.js
generated
vendored
Normal file
87
backend/node_modules/kareem/coverage/lcov-report/block-navigation.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
/* eslint-disable */
|
||||
var jumpToCode = (function init() {
|
||||
// Classes of code we would like to highlight in the file view
|
||||
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
|
||||
|
||||
// Elements to highlight in the file listing view
|
||||
var fileListingElements = ['td.pct.low'];
|
||||
|
||||
// We don't want to select elements that are direct descendants of another match
|
||||
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
|
||||
|
||||
// Selecter that finds elements on the page to which we can jump
|
||||
var selector =
|
||||
fileListingElements.join(', ') +
|
||||
', ' +
|
||||
notSelector +
|
||||
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
|
||||
|
||||
// The NodeList of matching elements
|
||||
var missingCoverageElements = document.querySelectorAll(selector);
|
||||
|
||||
var currentIndex;
|
||||
|
||||
function toggleClass(index) {
|
||||
missingCoverageElements
|
||||
.item(currentIndex)
|
||||
.classList.remove('highlighted');
|
||||
missingCoverageElements.item(index).classList.add('highlighted');
|
||||
}
|
||||
|
||||
function makeCurrent(index) {
|
||||
toggleClass(index);
|
||||
currentIndex = index;
|
||||
missingCoverageElements.item(index).scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
inline: 'center'
|
||||
});
|
||||
}
|
||||
|
||||
function goToPrevious() {
|
||||
var nextIndex = 0;
|
||||
if (typeof currentIndex !== 'number' || currentIndex === 0) {
|
||||
nextIndex = missingCoverageElements.length - 1;
|
||||
} else if (missingCoverageElements.length > 1) {
|
||||
nextIndex = currentIndex - 1;
|
||||
}
|
||||
|
||||
makeCurrent(nextIndex);
|
||||
}
|
||||
|
||||
function goToNext() {
|
||||
var nextIndex = 0;
|
||||
|
||||
if (
|
||||
typeof currentIndex === 'number' &&
|
||||
currentIndex < missingCoverageElements.length - 1
|
||||
) {
|
||||
nextIndex = currentIndex + 1;
|
||||
}
|
||||
|
||||
makeCurrent(nextIndex);
|
||||
}
|
||||
|
||||
return function jump(event) {
|
||||
if (
|
||||
document.getElementById('fileSearch') === document.activeElement &&
|
||||
document.activeElement != null
|
||||
) {
|
||||
// if we're currently focused on the search input, we don't want to navigate
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.which) {
|
||||
case 78: // n
|
||||
case 74: // j
|
||||
goToNext();
|
||||
break;
|
||||
case 66: // b
|
||||
case 75: // k
|
||||
case 80: // p
|
||||
goToPrevious();
|
||||
break;
|
||||
}
|
||||
};
|
||||
})();
|
||||
window.addEventListener('keydown', jumpToCode);
|
||||
BIN
backend/node_modules/kareem/coverage/lcov-report/favicon.png
generated
vendored
Normal file
BIN
backend/node_modules/kareem/coverage/lcov-report/favicon.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 445 B |
116
backend/node_modules/kareem/coverage/lcov-report/index.html
generated
vendored
Normal file
116
backend/node_modules/kareem/coverage/lcov-report/index.html
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Code coverage report for All files</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="prettify.css" />
|
||||
<link rel="stylesheet" href="base.css" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>All files</h1>
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">96.66% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>232/240</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">90.08% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>109/121</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>30/30</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">96.56% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>225/233</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
<template id="filterTemplate">
|
||||
<div class="quiet">
|
||||
Filter:
|
||||
<input type="search" id="fileSearch">
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
|
||||
<td data-value="96.66" class="pic high">
|
||||
<div class="chart"><div class="cover-fill" style="width: 96%"></div><div class="cover-empty" style="width: 4%"></div></div>
|
||||
</td>
|
||||
<td data-value="96.66" class="pct high">96.66%</td>
|
||||
<td data-value="240" class="abs high">232/240</td>
|
||||
<td data-value="90.08" class="pct high">90.08%</td>
|
||||
<td data-value="121" class="abs high">109/121</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="30" class="abs high">30/30</td>
|
||||
<td data-value="96.56" class="pct high">96.56%</td>
|
||||
<td data-value="233" class="abs high">225/233</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2025-08-25T20:16:45.952Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
prettyPrint();
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
<script src="block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
1603
backend/node_modules/kareem/coverage/lcov-report/index.js.html
generated
vendored
Normal file
1603
backend/node_modules/kareem/coverage/lcov-report/index.js.html
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
backend/node_modules/kareem/coverage/lcov-report/prettify.css
generated
vendored
Normal file
1
backend/node_modules/kareem/coverage/lcov-report/prettify.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
||||
2
backend/node_modules/kareem/coverage/lcov-report/prettify.js
generated
vendored
Normal file
2
backend/node_modules/kareem/coverage/lcov-report/prettify.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
backend/node_modules/kareem/coverage/lcov-report/sort-arrow-sprite.png
generated
vendored
Normal file
BIN
backend/node_modules/kareem/coverage/lcov-report/sort-arrow-sprite.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 138 B |
196
backend/node_modules/kareem/coverage/lcov-report/sorter.js
generated
vendored
Normal file
196
backend/node_modules/kareem/coverage/lcov-report/sorter.js
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
/* eslint-disable */
|
||||
var addSorting = (function() {
|
||||
'use strict';
|
||||
var cols,
|
||||
currentSort = {
|
||||
index: 0,
|
||||
desc: false
|
||||
};
|
||||
|
||||
// returns the summary table element
|
||||
function getTable() {
|
||||
return document.querySelector('.coverage-summary');
|
||||
}
|
||||
// returns the thead element of the summary table
|
||||
function getTableHeader() {
|
||||
return getTable().querySelector('thead tr');
|
||||
}
|
||||
// returns the tbody element of the summary table
|
||||
function getTableBody() {
|
||||
return getTable().querySelector('tbody');
|
||||
}
|
||||
// returns the th element for nth column
|
||||
function getNthColumn(n) {
|
||||
return getTableHeader().querySelectorAll('th')[n];
|
||||
}
|
||||
|
||||
function onFilterInput() {
|
||||
const searchValue = document.getElementById('fileSearch').value;
|
||||
const rows = document.getElementsByTagName('tbody')[0].children;
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
const row = rows[i];
|
||||
if (
|
||||
row.textContent
|
||||
.toLowerCase()
|
||||
.includes(searchValue.toLowerCase())
|
||||
) {
|
||||
row.style.display = '';
|
||||
} else {
|
||||
row.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// loads the search box
|
||||
function addSearchBox() {
|
||||
var template = document.getElementById('filterTemplate');
|
||||
var templateClone = template.content.cloneNode(true);
|
||||
templateClone.getElementById('fileSearch').oninput = onFilterInput;
|
||||
template.parentElement.appendChild(templateClone);
|
||||
}
|
||||
|
||||
// loads all columns
|
||||
function loadColumns() {
|
||||
var colNodes = getTableHeader().querySelectorAll('th'),
|
||||
colNode,
|
||||
cols = [],
|
||||
col,
|
||||
i;
|
||||
|
||||
for (i = 0; i < colNodes.length; i += 1) {
|
||||
colNode = colNodes[i];
|
||||
col = {
|
||||
key: colNode.getAttribute('data-col'),
|
||||
sortable: !colNode.getAttribute('data-nosort'),
|
||||
type: colNode.getAttribute('data-type') || 'string'
|
||||
};
|
||||
cols.push(col);
|
||||
if (col.sortable) {
|
||||
col.defaultDescSort = col.type === 'number';
|
||||
colNode.innerHTML =
|
||||
colNode.innerHTML + '<span class="sorter"></span>';
|
||||
}
|
||||
}
|
||||
return cols;
|
||||
}
|
||||
// attaches a data attribute to every tr element with an object
|
||||
// of data values keyed by column name
|
||||
function loadRowData(tableRow) {
|
||||
var tableCols = tableRow.querySelectorAll('td'),
|
||||
colNode,
|
||||
col,
|
||||
data = {},
|
||||
i,
|
||||
val;
|
||||
for (i = 0; i < tableCols.length; i += 1) {
|
||||
colNode = tableCols[i];
|
||||
col = cols[i];
|
||||
val = colNode.getAttribute('data-value');
|
||||
if (col.type === 'number') {
|
||||
val = Number(val);
|
||||
}
|
||||
data[col.key] = val;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
// loads all row data
|
||||
function loadData() {
|
||||
var rows = getTableBody().querySelectorAll('tr'),
|
||||
i;
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
rows[i].data = loadRowData(rows[i]);
|
||||
}
|
||||
}
|
||||
// sorts the table using the data for the ith column
|
||||
function sortByIndex(index, desc) {
|
||||
var key = cols[index].key,
|
||||
sorter = function(a, b) {
|
||||
a = a.data[key];
|
||||
b = b.data[key];
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
},
|
||||
finalSorter = sorter,
|
||||
tableBody = document.querySelector('.coverage-summary tbody'),
|
||||
rowNodes = tableBody.querySelectorAll('tr'),
|
||||
rows = [],
|
||||
i;
|
||||
|
||||
if (desc) {
|
||||
finalSorter = function(a, b) {
|
||||
return -1 * sorter(a, b);
|
||||
};
|
||||
}
|
||||
|
||||
for (i = 0; i < rowNodes.length; i += 1) {
|
||||
rows.push(rowNodes[i]);
|
||||
tableBody.removeChild(rowNodes[i]);
|
||||
}
|
||||
|
||||
rows.sort(finalSorter);
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
tableBody.appendChild(rows[i]);
|
||||
}
|
||||
}
|
||||
// removes sort indicators for current column being sorted
|
||||
function removeSortIndicators() {
|
||||
var col = getNthColumn(currentSort.index),
|
||||
cls = col.className;
|
||||
|
||||
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
||||
col.className = cls;
|
||||
}
|
||||
// adds sort indicators for current column being sorted
|
||||
function addSortIndicators() {
|
||||
getNthColumn(currentSort.index).className += currentSort.desc
|
||||
? ' sorted-desc'
|
||||
: ' sorted';
|
||||
}
|
||||
// adds event listeners for all sorter widgets
|
||||
function enableUI() {
|
||||
var i,
|
||||
el,
|
||||
ithSorter = function ithSorter(i) {
|
||||
var col = cols[i];
|
||||
|
||||
return function() {
|
||||
var desc = col.defaultDescSort;
|
||||
|
||||
if (currentSort.index === i) {
|
||||
desc = !currentSort.desc;
|
||||
}
|
||||
sortByIndex(i, desc);
|
||||
removeSortIndicators();
|
||||
currentSort.index = i;
|
||||
currentSort.desc = desc;
|
||||
addSortIndicators();
|
||||
};
|
||||
};
|
||||
for (i = 0; i < cols.length; i += 1) {
|
||||
if (cols[i].sortable) {
|
||||
// add the click event handler on the th so users
|
||||
// dont have to click on those tiny arrows
|
||||
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
||||
if (el.addEventListener) {
|
||||
el.addEventListener('click', ithSorter(i));
|
||||
} else {
|
||||
el.attachEvent('onclick', ithSorter(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// adds sorting functionality to the UI
|
||||
return function() {
|
||||
if (!getTable()) {
|
||||
return;
|
||||
}
|
||||
cols = loadColumns();
|
||||
loadData();
|
||||
addSearchBox();
|
||||
addSortIndicators();
|
||||
enableUI();
|
||||
};
|
||||
})();
|
||||
|
||||
window.addEventListener('load', addSorting);
|
||||
423
backend/node_modules/kareem/coverage/lcov.info
generated
vendored
Normal file
423
backend/node_modules/kareem/coverage/lcov.info
generated
vendored
Normal file
@@ -0,0 +1,423 @@
|
||||
TN:
|
||||
SF:index.js
|
||||
FN:6,Kareem
|
||||
FN:11,skipWrappedFunction
|
||||
FN:19,overwriteResult
|
||||
FN:34,execPre
|
||||
FN:49,(anonymous_4)
|
||||
FN:53,(anonymous_5)
|
||||
FN:103,(anonymous_6)
|
||||
FN:120,execPost
|
||||
FN:157,(anonymous_8)
|
||||
FN:161,nextCallback
|
||||
FN:234,(anonymous_10)
|
||||
FN:254,(anonymous_11)
|
||||
FN:256,syncWrapper
|
||||
FN:276,wrap
|
||||
FN:304,(anonymous_14)
|
||||
FN:310,(anonymous_15)
|
||||
FN:324,(anonymous_16)
|
||||
FN:343,(anonymous_17)
|
||||
FN:355,(anonymous_18)
|
||||
FN:361,kareemWrappedFunction
|
||||
FN:376,(anonymous_20)
|
||||
FN:409,(anonymous_21)
|
||||
FN:440,postError
|
||||
FN:453,(anonymous_23)
|
||||
FN:473,(anonymous_24)
|
||||
FN:481,(anonymous_25)
|
||||
FN:481,(anonymous_26)
|
||||
FN:488,(anonymous_27)
|
||||
FN:495,isPromiseLike
|
||||
FN:499,isErrorHandlingMiddleware
|
||||
FNF:30
|
||||
FNH:30
|
||||
FNDA:62,Kareem
|
||||
FNDA:6,skipWrappedFunction
|
||||
FNDA:12,overwriteResult
|
||||
FNDA:27,execPre
|
||||
FNDA:27,(anonymous_4)
|
||||
FNDA:27,(anonymous_5)
|
||||
FNDA:4,(anonymous_6)
|
||||
FNDA:27,execPost
|
||||
FNDA:41,(anonymous_8)
|
||||
FNDA:24,nextCallback
|
||||
FNDA:5,(anonymous_10)
|
||||
FNDA:2,(anonymous_11)
|
||||
FNDA:2,syncWrapper
|
||||
FNDA:17,wrap
|
||||
FNDA:2,(anonymous_14)
|
||||
FNDA:6,(anonymous_15)
|
||||
FNDA:6,(anonymous_16)
|
||||
FNDA:2,(anonymous_17)
|
||||
FNDA:1,(anonymous_18)
|
||||
FNDA:1,kareemWrappedFunction
|
||||
FNDA:51,(anonymous_20)
|
||||
FNDA:60,(anonymous_21)
|
||||
FNDA:1,postError
|
||||
FNDA:4,(anonymous_23)
|
||||
FNDA:1,(anonymous_24)
|
||||
FNDA:1,(anonymous_25)
|
||||
FNDA:1,(anonymous_26)
|
||||
FNDA:1,(anonymous_27)
|
||||
FNDA:61,isPromiseLike
|
||||
FNDA:41,isErrorHandlingMiddleware
|
||||
DA:7,62
|
||||
DA:8,62
|
||||
DA:11,1
|
||||
DA:12,6
|
||||
DA:13,3
|
||||
DA:16,3
|
||||
DA:19,1
|
||||
DA:20,12
|
||||
DA:21,6
|
||||
DA:24,6
|
||||
DA:34,1
|
||||
DA:35,27
|
||||
DA:36,27
|
||||
DA:37,27
|
||||
DA:38,27
|
||||
DA:40,27
|
||||
DA:41,3
|
||||
DA:44,24
|
||||
DA:45,24
|
||||
DA:46,33
|
||||
DA:47,27
|
||||
DA:48,27
|
||||
DA:49,27
|
||||
DA:50,27
|
||||
DA:51,27
|
||||
DA:53,27
|
||||
DA:54,27
|
||||
DA:55,27
|
||||
DA:56,19
|
||||
DA:57,0
|
||||
DA:59,19
|
||||
DA:62,27
|
||||
DA:63,27
|
||||
DA:64,27
|
||||
DA:65,0
|
||||
DA:67,27
|
||||
DA:70,9
|
||||
DA:71,3
|
||||
DA:72,3
|
||||
DA:74,6
|
||||
DA:77,6
|
||||
DA:78,6
|
||||
DA:80,2
|
||||
DA:81,0
|
||||
DA:82,0
|
||||
DA:84,2
|
||||
DA:89,16
|
||||
DA:91,16
|
||||
DA:92,3
|
||||
DA:103,1
|
||||
DA:104,4
|
||||
DA:105,4
|
||||
DA:107,4
|
||||
DA:108,4
|
||||
DA:120,1
|
||||
DA:121,27
|
||||
DA:122,27
|
||||
DA:124,27
|
||||
DA:125,27
|
||||
DA:126,6
|
||||
DA:129,27
|
||||
DA:130,1
|
||||
DA:131,0
|
||||
DA:133,1
|
||||
DA:136,26
|
||||
DA:137,41
|
||||
DA:138,41
|
||||
DA:139,41
|
||||
DA:140,41
|
||||
DA:141,41
|
||||
DA:142,40
|
||||
DA:143,40
|
||||
DA:144,40
|
||||
DA:148,41
|
||||
DA:149,1
|
||||
DA:150,1
|
||||
DA:151,1
|
||||
DA:157,41
|
||||
DA:158,41
|
||||
DA:159,41
|
||||
DA:161,41
|
||||
DA:162,24
|
||||
DA:163,12
|
||||
DA:165,12
|
||||
DA:169,41
|
||||
DA:170,14
|
||||
DA:171,8
|
||||
DA:172,8
|
||||
DA:173,8
|
||||
DA:174,1
|
||||
DA:175,7
|
||||
DA:177,6
|
||||
DA:180,5
|
||||
DA:181,0
|
||||
DA:182,0
|
||||
DA:184,5
|
||||
DA:187,6
|
||||
DA:190,27
|
||||
DA:192,1
|
||||
DA:194,26
|
||||
DA:195,26
|
||||
DA:196,26
|
||||
DA:197,26
|
||||
DA:198,3
|
||||
DA:199,23
|
||||
DA:201,18
|
||||
DA:204,7
|
||||
DA:205,2
|
||||
DA:206,2
|
||||
DA:208,5
|
||||
DA:209,5
|
||||
DA:212,19
|
||||
DA:213,2
|
||||
DA:214,2
|
||||
DA:220,26
|
||||
DA:221,11
|
||||
DA:224,15
|
||||
DA:234,1
|
||||
DA:235,5
|
||||
DA:236,5
|
||||
DA:238,5
|
||||
DA:239,6
|
||||
DA:240,6
|
||||
DA:241,2
|
||||
DA:245,5
|
||||
DA:254,1
|
||||
DA:255,2
|
||||
DA:256,2
|
||||
DA:257,2
|
||||
DA:259,2
|
||||
DA:261,2
|
||||
DA:263,2
|
||||
DA:276,1
|
||||
DA:278,17
|
||||
DA:279,17
|
||||
DA:280,17
|
||||
DA:282,7
|
||||
DA:283,2
|
||||
DA:284,2
|
||||
DA:286,5
|
||||
DA:290,12
|
||||
DA:291,10
|
||||
DA:294,9
|
||||
DA:296,7
|
||||
DA:304,1
|
||||
DA:305,2
|
||||
DA:307,2
|
||||
DA:308,2
|
||||
DA:309,4
|
||||
DA:310,6
|
||||
DA:313,4
|
||||
DA:314,1
|
||||
DA:315,1
|
||||
DA:318,3
|
||||
DA:321,2
|
||||
DA:322,2
|
||||
DA:323,4
|
||||
DA:324,6
|
||||
DA:327,4
|
||||
DA:328,1
|
||||
DA:329,1
|
||||
DA:332,3
|
||||
DA:335,2
|
||||
DA:343,1
|
||||
DA:344,2
|
||||
DA:355,1
|
||||
DA:356,1
|
||||
DA:357,1
|
||||
DA:359,0
|
||||
DA:361,1
|
||||
DA:362,1
|
||||
DA:363,1
|
||||
DA:376,1
|
||||
DA:377,51
|
||||
DA:378,43
|
||||
DA:379,43
|
||||
DA:380,8
|
||||
DA:381,1
|
||||
DA:384,51
|
||||
DA:385,51
|
||||
DA:387,51
|
||||
DA:388,1
|
||||
DA:391,50
|
||||
DA:392,2
|
||||
DA:394,48
|
||||
DA:397,50
|
||||
DA:409,1
|
||||
DA:410,60
|
||||
DA:412,60
|
||||
DA:413,52
|
||||
DA:414,52
|
||||
DA:415,52
|
||||
DA:418,60
|
||||
DA:419,1
|
||||
DA:422,59
|
||||
DA:423,2
|
||||
DA:425,57
|
||||
DA:427,59
|
||||
DA:428,59
|
||||
DA:440,1
|
||||
DA:441,1
|
||||
DA:442,1
|
||||
DA:443,1
|
||||
DA:444,1
|
||||
DA:446,1
|
||||
DA:453,1
|
||||
DA:454,4
|
||||
DA:456,4
|
||||
DA:457,6
|
||||
DA:458,6
|
||||
DA:460,4
|
||||
DA:461,5
|
||||
DA:464,4
|
||||
DA:473,1
|
||||
DA:474,1
|
||||
DA:475,1
|
||||
DA:477,1
|
||||
DA:478,1
|
||||
DA:479,1
|
||||
DA:481,1
|
||||
DA:482,1
|
||||
DA:483,1
|
||||
DA:485,1
|
||||
DA:486,1
|
||||
DA:487,1
|
||||
DA:488,1
|
||||
DA:489,1
|
||||
DA:492,1
|
||||
DA:496,61
|
||||
DA:500,41
|
||||
DA:501,2
|
||||
DA:503,39
|
||||
DA:506,1
|
||||
LF:233
|
||||
LH:225
|
||||
BRDA:12,0,0,3
|
||||
BRDA:12,0,1,3
|
||||
BRDA:20,1,0,6
|
||||
BRDA:20,1,1,6
|
||||
BRDA:35,2,0,27
|
||||
BRDA:35,2,1,3
|
||||
BRDA:40,3,0,3
|
||||
BRDA:40,3,1,24
|
||||
BRDA:46,4,0,27
|
||||
BRDA:46,4,1,6
|
||||
BRDA:53,5,0,9
|
||||
BRDA:53,5,1,18
|
||||
BRDA:56,6,0,0
|
||||
BRDA:56,6,1,19
|
||||
BRDA:56,7,0,19
|
||||
BRDA:56,7,1,19
|
||||
BRDA:64,8,0,0
|
||||
BRDA:64,8,1,27
|
||||
BRDA:70,9,0,3
|
||||
BRDA:70,9,1,6
|
||||
BRDA:80,10,0,0
|
||||
BRDA:80,10,1,2
|
||||
BRDA:91,11,0,3
|
||||
BRDA:91,11,1,13
|
||||
BRDA:104,12,0,4
|
||||
BRDA:104,12,1,1
|
||||
BRDA:108,13,0,4
|
||||
BRDA:108,13,1,2
|
||||
BRDA:121,14,0,27
|
||||
BRDA:121,14,1,1
|
||||
BRDA:125,15,0,6
|
||||
BRDA:125,15,1,21
|
||||
BRDA:125,16,0,27
|
||||
BRDA:125,16,1,10
|
||||
BRDA:129,17,0,1
|
||||
BRDA:129,17,1,26
|
||||
BRDA:130,18,0,0
|
||||
BRDA:130,18,1,1
|
||||
BRDA:142,19,0,40
|
||||
BRDA:142,19,1,0
|
||||
BRDA:142,20,0,40
|
||||
BRDA:142,20,1,37
|
||||
BRDA:148,21,0,1
|
||||
BRDA:148,21,1,40
|
||||
BRDA:162,22,0,12
|
||||
BRDA:162,22,1,12
|
||||
BRDA:169,23,0,14
|
||||
BRDA:169,23,1,27
|
||||
BRDA:170,24,0,8
|
||||
BRDA:170,24,1,6
|
||||
BRDA:173,25,0,1
|
||||
BRDA:173,25,1,7
|
||||
BRDA:175,26,0,6
|
||||
BRDA:175,26,1,1
|
||||
BRDA:180,27,0,0
|
||||
BRDA:180,27,1,5
|
||||
BRDA:190,28,0,1
|
||||
BRDA:190,28,1,26
|
||||
BRDA:197,29,0,3
|
||||
BRDA:197,29,1,23
|
||||
BRDA:199,30,0,18
|
||||
BRDA:199,30,1,5
|
||||
BRDA:204,31,0,2
|
||||
BRDA:204,31,1,5
|
||||
BRDA:212,32,0,2
|
||||
BRDA:212,32,1,17
|
||||
BRDA:220,33,0,11
|
||||
BRDA:220,33,1,15
|
||||
BRDA:235,34,0,5
|
||||
BRDA:235,34,1,1
|
||||
BRDA:239,35,0,6
|
||||
BRDA:239,35,1,2
|
||||
BRDA:240,36,0,2
|
||||
BRDA:240,36,1,4
|
||||
BRDA:282,37,0,2
|
||||
BRDA:282,37,1,5
|
||||
BRDA:290,38,0,10
|
||||
BRDA:290,38,1,2
|
||||
BRDA:313,39,0,1
|
||||
BRDA:313,39,1,3
|
||||
BRDA:327,40,0,1
|
||||
BRDA:327,40,1,3
|
||||
BRDA:344,41,0,2
|
||||
BRDA:344,41,1,1
|
||||
BRDA:357,42,0,0
|
||||
BRDA:357,42,1,1
|
||||
BRDA:362,43,0,1
|
||||
BRDA:362,43,1,0
|
||||
BRDA:377,44,0,43
|
||||
BRDA:377,44,1,8
|
||||
BRDA:380,45,0,1
|
||||
BRDA:380,45,1,7
|
||||
BRDA:384,46,0,51
|
||||
BRDA:384,46,1,35
|
||||
BRDA:387,47,0,1
|
||||
BRDA:387,47,1,50
|
||||
BRDA:391,48,0,2
|
||||
BRDA:391,48,1,48
|
||||
BRDA:410,49,0,60
|
||||
BRDA:410,49,1,40
|
||||
BRDA:412,50,0,52
|
||||
BRDA:412,50,1,8
|
||||
BRDA:418,51,0,1
|
||||
BRDA:418,51,1,59
|
||||
BRDA:422,52,0,2
|
||||
BRDA:422,52,1,57
|
||||
BRDA:441,53,0,1
|
||||
BRDA:441,53,1,0
|
||||
BRDA:474,54,0,1
|
||||
BRDA:474,54,1,0
|
||||
BRDA:475,55,0,1
|
||||
BRDA:475,55,1,0
|
||||
BRDA:478,56,0,1
|
||||
BRDA:478,56,1,0
|
||||
BRDA:486,57,0,1
|
||||
BRDA:486,57,1,1
|
||||
BRDA:496,58,0,61
|
||||
BRDA:496,58,1,5
|
||||
BRDA:496,58,2,5
|
||||
BRDA:500,59,0,2
|
||||
BRDA:500,59,1,39
|
||||
BRF:121
|
||||
BRH:109
|
||||
end_of_record
|
||||
31
backend/node_modules/kareem/index.d.ts
generated
vendored
Normal file
31
backend/node_modules/kareem/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
declare module "kareem" {
|
||||
export default class Kareem {
|
||||
static skipWrappedFunction(): SkipWrappedFunction;
|
||||
static overwriteMiddlewareResult(): OverwriteMiddlewareResult;
|
||||
static overwriteArguments(): OverwriteArguments;
|
||||
|
||||
pre(name: string | RegExp, fn: Function): this;
|
||||
pre(name: string | RegExp, options: Record<string, any>, fn: Function, error?: any, unshift?: boolean): this;
|
||||
post(name: string | RegExp, fn: Function): this;
|
||||
post(name: string | RegExp, options: Record<string, any>, fn: Function, unshift?: boolean): this;
|
||||
|
||||
clone(): Kareem;
|
||||
merge(other: Kareem, clone?: boolean): this;
|
||||
|
||||
createWrapper(name: string, fn: Function, context?: any, options?: Record<string, any>): Function;
|
||||
createWrapperSync(name: string, fn: Function): Function;
|
||||
hasHooks(name: string): boolean;
|
||||
filter(fn: Function): Kareem;
|
||||
|
||||
wrap(name: string, fn: Function, context: any, args: any[], options?: Record<string, any>): Function;
|
||||
|
||||
execPostSync(name: string, context: any, args: any[]): any;
|
||||
execPost(name: string, context: any, args: any[], options?: Record<string, any>, callback?: Function): void;
|
||||
execPreSync(name: string, context: any, args: any[]): any;
|
||||
execPre(name: string, context: any, args: any[], callback?: Function): void;
|
||||
}
|
||||
|
||||
class SkipWrappedFunction {}
|
||||
class OverwriteMiddlewareResult {}
|
||||
class OverwriteArguments {}
|
||||
}
|
||||
539
backend/node_modules/kareem/index.js
generated
vendored
Normal file
539
backend/node_modules/kareem/index.js
generated
vendored
Normal file
@@ -0,0 +1,539 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Create a new instance
|
||||
*/
|
||||
function Kareem() {
|
||||
this._pres = new Map();
|
||||
this._posts = new Map();
|
||||
}
|
||||
|
||||
Kareem.skipWrappedFunction = function skipWrappedFunction() {
|
||||
if (!(this instanceof Kareem.skipWrappedFunction)) {
|
||||
return new Kareem.skipWrappedFunction(...arguments);
|
||||
}
|
||||
|
||||
this.args = [...arguments];
|
||||
};
|
||||
|
||||
Kareem.overwriteResult = function overwriteResult() {
|
||||
if (!(this instanceof Kareem.overwriteResult)) {
|
||||
return new Kareem.overwriteResult(...arguments);
|
||||
}
|
||||
|
||||
this.args = [...arguments];
|
||||
};
|
||||
|
||||
Kareem.overwriteArguments = function overwriteArguments() {
|
||||
if (!(this instanceof Kareem.overwriteArguments)) {
|
||||
return new Kareem.overwriteArguments(...arguments);
|
||||
}
|
||||
|
||||
this.args = [...arguments];
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute all "pre" hooks for "name"
|
||||
* @param {String} name The hook name to execute
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array} args arguments passed to the pre hooks
|
||||
* @param {Object} [options] Optional options
|
||||
* @param {Function} [options.filter] Filter function to select which hooks to run
|
||||
* @returns {Array} The potentially modified arguments
|
||||
*/
|
||||
Kareem.prototype.execPre = async function execPre(name, context, args, options) {
|
||||
let pres = this._pres.get(name) || [];
|
||||
if (options?.filter) {
|
||||
pres = pres.filter(options.filter);
|
||||
}
|
||||
const numPres = pres.length;
|
||||
let $args = args;
|
||||
let skipWrappedFunction = null;
|
||||
|
||||
if (!numPres) {
|
||||
return $args;
|
||||
}
|
||||
|
||||
for (const pre of pres) {
|
||||
const args = [];
|
||||
const _args = [null].concat($args);
|
||||
for (let i = 1; i < _args.length; ++i) {
|
||||
if (i === _args.length - 1 && typeof _args[i] === 'function') {
|
||||
continue; // skip callbacks to avoid accidentally calling the callback from a hook
|
||||
}
|
||||
args.push(_args[i]);
|
||||
}
|
||||
|
||||
try {
|
||||
const maybePromiseLike = pre.fn.apply(context, args);
|
||||
if (isPromiseLike(maybePromiseLike)) {
|
||||
const result = await maybePromiseLike;
|
||||
if (result instanceof Kareem.overwriteArguments) {
|
||||
$args = result.args;
|
||||
}
|
||||
} else if (maybePromiseLike instanceof Kareem.overwriteArguments) {
|
||||
$args = maybePromiseLike.args;
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Kareem.skipWrappedFunction) {
|
||||
skipWrappedFunction = error;
|
||||
continue;
|
||||
}
|
||||
if (error instanceof Kareem.overwriteArguments) {
|
||||
$args = error.args;
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (skipWrappedFunction) {
|
||||
throw skipWrappedFunction;
|
||||
}
|
||||
|
||||
return $args;
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute all "pre" hooks for "name" synchronously
|
||||
* @param {String} name The hook name to execute
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array} [args] Apply custom arguments to the hook
|
||||
* @param {Object} [options] Optional options
|
||||
* @param {Function} [options.filter] Filter function to select which hooks to run
|
||||
* @returns {Array} The potentially modified arguments
|
||||
*/
|
||||
Kareem.prototype.execPreSync = function(name, context, args, options) {
|
||||
let pres = this._pres.get(name) || [];
|
||||
if (options?.filter) {
|
||||
pres = pres.filter(options.filter);
|
||||
}
|
||||
const numPres = pres.length;
|
||||
let $args = args || [];
|
||||
|
||||
for (let i = 0; i < numPres; ++i) {
|
||||
const result = pres[i].fn.apply(context, $args);
|
||||
if (result instanceof Kareem.overwriteArguments) {
|
||||
$args = result.args;
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute all "post" hooks for "name"
|
||||
* @param {String} name The hook name to execute
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array} args Apply custom arguments to the hook
|
||||
* @param {Object} [options] Optional options
|
||||
* @param {Error} [options.error] Error to pass to error-handling middleware
|
||||
* @param {Function} [options.filter] Filter function to select which hooks to run
|
||||
* @returns {void}
|
||||
*/
|
||||
Kareem.prototype.execPost = async function execPost(name, context, args, options) {
|
||||
let posts = this._posts.get(name) || [];
|
||||
if (options?.filter) {
|
||||
posts = posts.filter(options.filter);
|
||||
}
|
||||
const numPosts = posts.length;
|
||||
|
||||
let firstError = null;
|
||||
if (options && options.error) {
|
||||
firstError = options.error;
|
||||
}
|
||||
|
||||
if (!numPosts) {
|
||||
if (firstError != null) {
|
||||
throw firstError;
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
for (const currentPost of posts) {
|
||||
const post = currentPost.fn;
|
||||
let numArgs = 0;
|
||||
const newArgs = [];
|
||||
const argLength = args.length;
|
||||
for (let i = 0; i < argLength; ++i) {
|
||||
if (!args[i] || !args[i]._kareemIgnore) {
|
||||
numArgs += 1;
|
||||
newArgs.push(args[i]);
|
||||
}
|
||||
}
|
||||
// If numCallbackParams set, fill in the rest with null to enforce consistent number of args
|
||||
if (options?.numCallbackParams != null) {
|
||||
numArgs = options.numCallbackParams;
|
||||
for (let i = newArgs.length; i < numArgs; ++i) {
|
||||
newArgs.push(null);
|
||||
}
|
||||
}
|
||||
|
||||
let resolve;
|
||||
let reject;
|
||||
const cbPromise = new Promise((_resolve, _reject) => {
|
||||
resolve = _resolve;
|
||||
reject = _reject;
|
||||
});
|
||||
newArgs.push(function nextCallback(err) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
|
||||
if (firstError) {
|
||||
if (isErrorHandlingMiddleware(currentPost, numArgs)) {
|
||||
try {
|
||||
const res = post.apply(context, [firstError].concat(newArgs));
|
||||
if (isPromiseLike(res)) {
|
||||
await res;
|
||||
} else if (post.length === numArgs + 2) {
|
||||
// `numArgs + 2` because we added the error and the callback
|
||||
await cbPromise;
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Kareem.overwriteResult) {
|
||||
args = error.args;
|
||||
continue;
|
||||
}
|
||||
firstError = error;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (isErrorHandlingMiddleware(currentPost, numArgs)) {
|
||||
// Skip error handlers if no error
|
||||
continue;
|
||||
} else {
|
||||
let res = null;
|
||||
try {
|
||||
res = post.apply(context, newArgs);
|
||||
if (isPromiseLike(res)) {
|
||||
res = await res;
|
||||
} else if (post.length === numArgs + 1) {
|
||||
// If post function takes a callback, wait for the post function to call the callback
|
||||
res = await cbPromise;
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Kareem.overwriteResult) {
|
||||
args = error.args;
|
||||
continue;
|
||||
}
|
||||
firstError = error;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (res instanceof Kareem.overwriteResult) {
|
||||
args = res.args;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (firstError != null) {
|
||||
throw firstError;
|
||||
}
|
||||
|
||||
return args;
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute all "post" hooks for "name" synchronously
|
||||
* @param {String} name The hook name to execute
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array} args Apply custom arguments to the hook
|
||||
* @param {Object} [options] Optional options
|
||||
* @param {Function} [options.filter] Filter function to select which hooks to run
|
||||
* @returns {Array} The used arguments
|
||||
*/
|
||||
Kareem.prototype.execPostSync = function(name, context, args, options) {
|
||||
let posts = this._posts.get(name) || [];
|
||||
if (options?.filter) {
|
||||
posts = posts.filter(options.filter);
|
||||
}
|
||||
const numPosts = posts.length;
|
||||
|
||||
for (let i = 0; i < numPosts; ++i) {
|
||||
const res = posts[i].fn.apply(context, args || []);
|
||||
if (res instanceof Kareem.overwriteResult) {
|
||||
args = res.args;
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a synchronous wrapper for "fn"
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Function} fn The function to wrap
|
||||
* @param {*} context Overwrite the "this" for the hook. If null/undefined, uses the calling context.
|
||||
* @param {Object} [options] Options for the wrapper
|
||||
* @param {Function} [options.getOptions] Function that receives the wrapper arguments and returns options for execPreSync/execPostSync. Can return `{ filter }` for both, or `{ pre: { filter }, post: { filter } }` for separate options.
|
||||
* @returns {Function} The wrapped function
|
||||
*/
|
||||
Kareem.prototype.createWrapperSync = function(name, fn, context, options) {
|
||||
const _this = this;
|
||||
const getOptions = options?.getOptions;
|
||||
return function syncWrapper() {
|
||||
const _context = context || this;
|
||||
const args = Array.from(arguments);
|
||||
const execOptions = typeof getOptions === 'function' ? getOptions(args) : {};
|
||||
const preOptions = execOptions.pre ?? execOptions;
|
||||
const postOptions = execOptions.post ?? execOptions;
|
||||
|
||||
const modifiedArgs = _this.execPreSync(name, _context, args, preOptions);
|
||||
|
||||
const toReturn = fn.apply(_context, modifiedArgs);
|
||||
|
||||
const result = _this.execPostSync(name, _context, [toReturn], postOptions);
|
||||
|
||||
return result[0];
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Executes pre hooks, followed by the wrapped function, followed by post hooks.
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Function} fn The function for the hook
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Array} args Apply custom arguments to the hook
|
||||
* @param {Object} options Additional options for the hook
|
||||
* @returns {void}
|
||||
*/
|
||||
Kareem.prototype.wrap = async function wrap(name, fn, context, args, options) {
|
||||
let ret;
|
||||
let skipWrappedFunction = false;
|
||||
let modifiedArgs = args;
|
||||
try {
|
||||
modifiedArgs = await this.execPre(name, context, args);
|
||||
} catch (error) {
|
||||
if (error instanceof Kareem.skipWrappedFunction) {
|
||||
ret = error.args;
|
||||
skipWrappedFunction = true;
|
||||
} else {
|
||||
await this.execPost(name, context, args, { ...options, error });
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipWrappedFunction) {
|
||||
ret = await fn.apply(context, modifiedArgs);
|
||||
}
|
||||
|
||||
ret = await this.execPost(name, context, [ret], options);
|
||||
|
||||
return ret[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter current instance for something specific and return the filtered clone
|
||||
* @param {Function} fn The filter function
|
||||
* @returns {Kareem} The cloned and filtered instance
|
||||
*/
|
||||
Kareem.prototype.filter = function(fn) {
|
||||
const clone = this.clone();
|
||||
|
||||
const pres = Array.from(clone._pres.keys());
|
||||
for (const name of pres) {
|
||||
const hooks = this._pres.get(name).
|
||||
map(h => Object.assign({}, h, { name: name })).
|
||||
filter(fn);
|
||||
|
||||
if (hooks.length === 0) {
|
||||
clone._pres.delete(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
clone._pres.set(name, hooks);
|
||||
}
|
||||
|
||||
const posts = Array.from(clone._posts.keys());
|
||||
for (const name of posts) {
|
||||
const hooks = this._posts.get(name).
|
||||
map(h => Object.assign({}, h, { name: name })).
|
||||
filter(fn);
|
||||
|
||||
if (hooks.length === 0) {
|
||||
clone._posts.delete(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
clone._posts.set(name, hooks);
|
||||
}
|
||||
|
||||
return clone;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check for a "name" to exist either in pre or post hooks
|
||||
* @param {String} name The name of the hook
|
||||
* @returns {Boolean} "true" if found, "false" otherwise
|
||||
*/
|
||||
Kareem.prototype.hasHooks = function(name) {
|
||||
return this._pres.has(name) || this._posts.has(name);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a Wrapper for "fn" on "name" and return the wrapped function
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Function} fn The function to wrap
|
||||
* @param {*} context Overwrite the "this" for the hook
|
||||
* @param {Object} [options]
|
||||
* @returns {Function} The wrapped function
|
||||
*/
|
||||
Kareem.prototype.createWrapper = function(name, fn, context, options) {
|
||||
const _this = this;
|
||||
if (!this.hasHooks(name)) {
|
||||
// Fast path: if there's no hooks for this function, just return the function
|
||||
return fn;
|
||||
}
|
||||
return function kareemWrappedFunction() {
|
||||
const _context = context || this;
|
||||
return _this.wrap(name, fn, _context, Array.from(arguments), options);
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a new hook for "pre"
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Object} [options]
|
||||
* @param {Function} fn The function to register for "name"
|
||||
* @param {never} error Unused
|
||||
* @param {Boolean} [unshift] Wheter to "push" or to "unshift" the new hook
|
||||
* @returns {Kareem}
|
||||
*/
|
||||
Kareem.prototype.pre = function(name, options, fn, error, unshift) {
|
||||
if (typeof options === 'function') {
|
||||
fn = options;
|
||||
options = {};
|
||||
} else if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
const pres = this._pres.get(name) || [];
|
||||
this._pres.set(name, pres);
|
||||
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error('pre() requires a function, got "' + typeof fn + '"');
|
||||
}
|
||||
|
||||
if (unshift) {
|
||||
pres.unshift(Object.assign({}, options, { fn: fn }));
|
||||
} else {
|
||||
pres.push(Object.assign({}, options, { fn: fn }));
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a new hook for "post"
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Object} [options]
|
||||
* @param {Boolean} [options.errorHandler] Whether this is an error handler
|
||||
* @param {Function} fn The function to register for "name"
|
||||
* @param {Boolean} [unshift] Wheter to "push" or to "unshift" the new hook
|
||||
* @returns {Kareem}
|
||||
*/
|
||||
Kareem.prototype.post = function(name, options, fn, unshift) {
|
||||
const posts = this._posts.get(name) || [];
|
||||
|
||||
if (typeof options === 'function') {
|
||||
unshift = !!fn;
|
||||
fn = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof fn !== 'function') {
|
||||
throw new Error('post() requires a function, got "' + typeof fn + '"');
|
||||
}
|
||||
|
||||
if (unshift) {
|
||||
posts.unshift(Object.assign({}, options, { fn: fn }));
|
||||
} else {
|
||||
posts.push(Object.assign({}, options, { fn: fn }));
|
||||
}
|
||||
this._posts.set(name, posts);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a new error handler for "name"
|
||||
* @param {String} name The name of the hook
|
||||
* @param {Object} [options]
|
||||
* @param {Function} fn The function to register for "name"
|
||||
* @param {Boolean} [unshift] Wheter to "push" or to "unshift" the new hook
|
||||
* @returns {Kareem}
|
||||
*/
|
||||
|
||||
Kareem.prototype.postError = function postError(name, options, fn, unshift) {
|
||||
if (typeof options === 'function') {
|
||||
unshift = !!fn;
|
||||
fn = options;
|
||||
options = {};
|
||||
}
|
||||
return this.post(name, { ...options, errorHandler: true }, fn, unshift);
|
||||
};
|
||||
|
||||
/**
|
||||
* Clone the current instance
|
||||
* @returns {Kareem} The cloned instance
|
||||
*/
|
||||
Kareem.prototype.clone = function() {
|
||||
const n = new Kareem();
|
||||
|
||||
for (const key of this._pres.keys()) {
|
||||
const clone = this._pres.get(key).slice();
|
||||
n._pres.set(key, clone);
|
||||
}
|
||||
for (const key of this._posts.keys()) {
|
||||
n._posts.set(key, this._posts.get(key).slice());
|
||||
}
|
||||
|
||||
return n;
|
||||
};
|
||||
|
||||
/**
|
||||
* Merge "other" into self or "clone"
|
||||
* @param {Kareem} other The instance to merge with
|
||||
* @param {Kareem} [clone] The instance to merge onto (if not defined, using "this")
|
||||
* @returns {Kareem} The merged instance
|
||||
*/
|
||||
Kareem.prototype.merge = function(other, clone) {
|
||||
clone = arguments.length === 1 ? true : clone;
|
||||
const ret = clone ? this.clone() : this;
|
||||
|
||||
for (const key of other._pres.keys()) {
|
||||
const sourcePres = ret._pres.get(key) || [];
|
||||
const deduplicated = other._pres.get(key).
|
||||
// Deduplicate based on `fn`
|
||||
filter(p => sourcePres.map(_p => _p.fn).indexOf(p.fn) === -1);
|
||||
const combined = sourcePres.concat(deduplicated);
|
||||
ret._pres.set(key, combined);
|
||||
}
|
||||
for (const key of other._posts.keys()) {
|
||||
const sourcePosts = ret._posts.get(key) || [];
|
||||
const deduplicated = other._posts.get(key).
|
||||
filter(p => sourcePosts.indexOf(p) === -1);
|
||||
ret._posts.set(key, sourcePosts.concat(deduplicated));
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
function isPromiseLike(v) {
|
||||
return (typeof v === 'object' && v !== null && typeof v.then === 'function');
|
||||
}
|
||||
|
||||
function isErrorHandlingMiddleware(post, numArgs) {
|
||||
if (post.errorHandler) {
|
||||
return true;
|
||||
}
|
||||
return post.fn.length === numArgs + 2;
|
||||
}
|
||||
|
||||
module.exports = Kareem;
|
||||
28
backend/node_modules/kareem/package.json
generated
vendored
Normal file
28
backend/node_modules/kareem/package.json
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "kareem",
|
||||
"version": "3.2.0",
|
||||
"description": "Next-generation take on pre/post function hooks",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha ./test/*",
|
||||
"test-coverage": "nyc --reporter lcov mocha ./test/*",
|
||||
"docs": "node ./docs.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mongoosejs/kareem.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"acquit": "1.x",
|
||||
"acquit-ignore": "0.2.x",
|
||||
"eslint": "8.20.0",
|
||||
"mocha": "11.x",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"author": "Valeri Karpov <val@karpov.io>",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user