fastify-decorators
Advanced tools
Comparing version 4.0.0-next.1 to 4.0.0-next.2
@@ -9,6 +9,4 @@ /** | ||
import fp from 'fastify-plugin'; | ||
import { opendirSync } from 'fs'; | ||
import { join } from 'path'; | ||
import { pathToFileURL } from 'url'; | ||
import { hooksRegistry } from '../plugins/life-cycle.js'; | ||
import { opendirSync, lstatSync } from 'node:fs'; | ||
import { hooksRegistry } from '../plugins/index.js'; | ||
import { CREATOR } from '../symbols/index.js'; | ||
@@ -19,13 +17,10 @@ import { transformAndWait } from '../utils/transform-and-wait.js'; | ||
await transformAndWait(hooksRegistry.appInit, (hook) => hook(fastify)); | ||
const controllers = new Set(); | ||
if ('directory' in config) | ||
for await (const controller of autoLoadModules(config)) | ||
controllers.add(controller); | ||
await transformAndWait(autoLoadModules(config), loadController.bind(fastify, config)); | ||
if ('controllers' in config) | ||
config.controllers.forEach(controllers.add, controllers); | ||
await transformAndWait(controllers, loadController.bind(fastify, config)); | ||
await transformAndWait(config.controllers, loadController.bind(fastify, config)); | ||
await transformAndWait(hooksRegistry.appReady, (hook) => hook(fastify)); | ||
fastify.addHook('onClose', () => transformAndWait(hooksRegistry.appDestroy, (hook) => hook(fastify))); | ||
}, { | ||
fastify: '^3.0.0', | ||
fastify: '^3.0.0 || ^4.0.0-alpha.0 || ^4.0.0-rc.0 || ^4.0.0', | ||
name: 'fastifyDecorators', | ||
@@ -36,6 +31,14 @@ }); | ||
const filter = config.mask ? new RegExp(config.mask, flags) : defaultMask; | ||
return readModulesRecursively(config.directory, filter); | ||
return readModulesRecursively(parsePath(config.directory), filter); | ||
} | ||
async function* readModulesRecursively(path, filter) { | ||
const dir = opendirSync(path); | ||
function parsePath(directory) { | ||
const urlLike = directory.toString('utf8'); | ||
const url = urlLike.startsWith('file://') ? new URL(urlLike) : new URL('file://' + urlLike); | ||
if (lstatSync(url).isFile()) | ||
url.pathname += './..'; | ||
return url; | ||
} | ||
async function* readModulesRecursively(parentUrl, filter) { | ||
const dir = opendirSync(parentUrl); | ||
parentUrl.pathname += '/'; | ||
try { | ||
@@ -46,3 +49,3 @@ while (true) { | ||
return; | ||
const fullFilePath = join(path, dirent.name); | ||
const fullFilePath = new URL(dirent.name, parentUrl); | ||
if (dirent.isDirectory()) { | ||
@@ -52,3 +55,3 @@ yield* readModulesRecursively(fullFilePath, filter); | ||
else if (filter.test(dirent.name)) { | ||
yield import(pathToFileURL(fullFilePath).toString()).then((m) => m.default); | ||
yield import(fullFilePath.toString()).then((m) => m.default); | ||
} | ||
@@ -62,3 +65,3 @@ } | ||
function loadController(config, controller) { | ||
if (verifyController(controller)) { | ||
if (isValidController(controller)) { | ||
return controller[CREATOR].register(this, config.prefix); | ||
@@ -70,5 +73,5 @@ } | ||
} | ||
function verifyController(controller) { | ||
function isValidController(controller) { | ||
return controller && CREATOR in controller; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm9vdHN0cmFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL2Jvb3RzdHJhcC9ib290c3RyYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBR0gsT0FBTyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDaEMsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLElBQUksQ0FBQztBQUNqQyxPQUFPLEVBQUUsSUFBSSxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBQzVCLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFJcEMsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRXpELE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUM5QyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUVsRSxNQUFNLFdBQVcs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UgaWYgKGZpbHRlci50ZXN0KGRpcmVudC5uYW1lKSkge1xuICAgICAgICB5aWVsZCBpbXBvcnQocGF0aFRvRmlsZVVSTChmdWxsRmlsZVBhdGgpLnRvU3RyaW5nKCkpLnRoZW4oKG0pID0+IG0uZGVmYXVsdCk7XG4gICAgICB9XG4gICAgfVxuICB9IGZpbmFsbHkge1xuICAgIGF3YWl0IGRpci5jbG9zZSgpO1xuICB9XG59XG5cbmZ1bmN0aW9uIGxvYWRDb250cm9sbGVyKHRoaXM6IEZhc3RpZnlJbnN0YW5jZSwgY29uZmlnOiBCb290c3RyYXBDb25maWcsIGNvbnRyb2xsZXI6IENvbnN0cnVjdGFibGU8dW5rbm93bj4pIHtcbiAgaWYgKHZlcmlmeUNvbnRyb2xsZXIoY29udHJvbGxlcikpIHtcbiAgICByZXR1cm4gY29udHJvbGxlcltDUkVBVE9SXS5yZWdpc3Rlcih0aGlzLCBjb25maWcucHJlZml4KTtcbiAgfSBlbHNlIGlmICghY29uZmlnLnNraXBCcm9rZW4pIHtcbiAgICB0aHJvdyBuZXcgVHlwZUVycm9yKGBMb2FkZWQgZmlsZSBpcyBpbmNvcnJlY3QgbW9kdWxlIGFuZCBjYW4gbm90IGJlIGJvb3RzdHJhcHBlZDogJHtjb250cm9sbGVyfWApO1xuICB9XG59XG5cbmZ1bmN0aW9uIHZlcmlmeUNvbnRyb2xsZXIoY29udHJvbGxlcjogQ29uc3RydWN0YWJsZTx1bmtub3duPik6IGNvbnRyb2xsZXIgaXMgUmVnaXN0cmFibGUge1xuICByZXR1cm4gY29udHJvbGxlciAmJiBDUkVBVE9SIGluIGNvbnRyb2xsZXI7XG59XG4iXX0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm9vdHN0cmFwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL2Jvb3RzdHJhcC9ib290c3RyYXAudHMiXSwibmFtZXMiOltdL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uKChtKSA9PiBtLmRlZmF1bHQpO1xuICAgICAgfVxuICAgIH1cbiAgfSBmaW5hbGx5IHtcbiAgICBhd2FpdCBkaXIuY2xvc2UoKTtcbiAgfVxufVxuXG5mdW5jdGlvbiBsb2FkQ29udHJvbGxlcih0aGlzOiBGYXN0aWZ5SW5zdGFuY2UsIGNvbmZpZzogQm9vdHN0cmFwQ29uZmlnLCBjb250cm9sbGVyOiBDb25zdHJ1Y3RhYmxlPHVua25vd24+KSB7XG4gIGlmIChpc1ZhbGlkQ29udHJvbGxlcihjb250cm9sbGVyKSkge1xuICAgIHJldHVybiBjb250cm9sbGVyW0NSRUFUT1JdLnJlZ2lzdGVyKHRoaXMsIGNvbmZpZy5wcmVmaXgpO1xuICB9IGVsc2UgaWYgKCFjb25maWcuc2tpcEJyb2tlbikge1xuICAgIHRocm93IG5ldyBUeXBlRXJyb3IoYExvYWRlZCBmaWxlIGlzIGluY29ycmVjdCBtb2R1bGUgYW5kIGNhbiBub3QgYmUgYm9vdHN0cmFwcGVkOiAke2NvbnRyb2xsZXJ9YCk7XG4gIH1cbn1cblxuZnVuY3Rpb24gaXNWYWxpZENvbnRyb2xsZXIoY29udHJvbGxlcjogQ29uc3RydWN0YWJsZTx1bmtub3duPik6IGNvbnRyb2xsZXIgaXMgUmVnaXN0cmFibGUge1xuICByZXR1cm4gY29udHJvbGxlciAmJiBDUkVBVE9SIGluIGNvbnRyb2xsZXI7XG59XG4iXX0= |
@@ -14,2 +14,3 @@ # Changelog | ||
- Option to inject Request/Reply into services | ||
- Support for URL in autoload config | ||
- Plugin for integration with [TypeDI](https://npmjs.com/package/typedi) | ||
@@ -19,3 +20,3 @@ | ||
- BREAKING: minimal supported Node.js version is v12.13.1 | ||
- BREAKING: dropped Node.js 10 and 12, minimal required is 14 LTS | ||
- BREAKING: moved dependency injection functionality into separate package | ||
@@ -22,0 +23,0 @@ - BREAKING: removed CommonJS build |
@@ -17,3 +17,3 @@ /** | ||
else if (typeof parameter === 'string') { | ||
constructor[ERROR_HANDLERS].push(handlerFactory((error) => (error === null || error === void 0 ? void 0 : error.code) === parameter, handlerName)); | ||
constructor[ERROR_HANDLERS].push(handlerFactory((error) => error?.code === parameter, handlerName)); | ||
} | ||
@@ -28,2 +28,2 @@ else { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3ItaGFuZGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9kZWNvcmF0b3JzL2Vycm9yLWhhbmRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBSUgsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3JELE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBS3BFLE1BQU0sVUFBVSxZQUFZLENBQTZCLFNBQXNCO0lBQzdFLE9BQU8sVUFBVSxFQUFFLFdBQVcsRUFBTyxFQUFFLFdBQTRCO1FBQ2pFLG1CQUFtQixDQUFDLFdBQVcsQ0FBQyxDQUFDO1FBRWpDLElBQUksU0FBUyxJQUFJLElBQUksRUFBRTtZQUNyQixXQUFXLENBQUMsY0FBYyxDQUFDLENBQUMsSUFBSSxDQUFDLGNBQWMsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxJQUFJLEVBQUUsV0FBVyxDQUFDLENBQUMsQ0FBQztTQUMzRTthQUFNLElBQUksT0FBTyxTQUFTLEtBQUssUUFBUSxFQUFFO1lBQ3hDLFdBQVcsQ0FBQyxjQUFjLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLENBQUMsS0FBcUIsRUFBRSxFQUFFLENBQUMsQ0FBQSxLQUFLLGFBQUwsS0FBSyx1QkFBTCxLQUFLLENBQUUsSUFBSSxNQUFLLFNBQVMsRUFBRSxXQUFXLENBQUMsQ0FBQ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ZXRlciA9PT0gJ3N0cmluZycpIHtcbiAgICAgIGNvbnN0cnVjdG9yW0VSUk9SX0hBTkRMRVJTXS5wdXNoKGhhbmRsZXJGYWN0b3J5KChlcnJvcj86IEVycm9yV2l0aENvZGUpID0+IGVycm9yPy5jb2RlID09PSBwYXJhbWV0ZXIsIGhhbmRsZXJOYW1lKSk7XG4gICAgfSBlbHNlIHtcbiAgICAgIGNvbnN0cnVjdG9yW0VSUk9SX0hBTkRMRVJTXS5wdXNoKGhhbmRsZXJGYWN0b3J5KChlcnJvcj86IEVycm9yKSA9PiBlcnJvciBpbnN0YW5jZW9mIHBhcmFtZXRlciwgaGFuZGxlck5hbWUpKTtcbiAgICB9XG4gIH07XG59XG5cbmludGVyZmFjZSBFcnJvcldpdGhDb2RlIGV4dGVuZHMgRXJyb3Ige1xuICBjb2RlPzogc3RyaW5nO1xufVxuXG5mdW5jdGlvbiBoYW5kbGVyRmFjdG9yeShhY2NlcHRzOiA8VCBleHRlbmRzIEVycm9yPihlcnJvcj86IFQpID0+IGJvb2xlYW4sIGhhbmRsZXJOYW1lOiBzdHJpbmcgfCBzeW1ib2wpOiBJRXJyb3JIYW5kbGVyIHtcbiAgcmV0dXJuIHsgYWNjZXB0cywgaGFuZGxlck5hbWUgfTtcbn1cbiJdfQ== |
@@ -15,4 +15,2 @@ <h1 style="text-align: center">Fastify decorators</h1> | ||
import { bootstrap } from 'fastify-decorators'; | ||
import { dirname } from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
@@ -22,3 +20,3 @@ const app = fastify(); | ||
app.register(bootstrap, { | ||
directory: dirname(fileURLToPath(import.meta.url)), | ||
directory: import.meta.url, | ||
mask: /\.controller\./, | ||
@@ -25,0 +23,0 @@ }); |
@@ -82,4 +82,4 @@ <h1 style="text-align: center">Fastify decorators</h1> | ||
```ts | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import { Controller, GET, ErrorHandler } from 'fastify-decorators'; | ||
@@ -86,0 +86,0 @@ |
# Migration from v3.x to v4.x | ||
This guide describes how to migrate from `fastify-decorators` v2 to v3. | ||
This guide describes how to migrate from `fastify-decorators` v3 to v4. | ||
@@ -5,0 +5,0 @@ _Note_: migration guide from v2.x to v3.x is [here](https://github.com/L2jLiga/fastify-decorators/blob/v3/docs/Migration%20to%20v3.md). |
@@ -0,0 +0,0 @@ <h1 style="text-align: center">Fastify decorators</h1> |
@@ -87,3 +87,2 @@ <h1 style="text-align: center">Fastify decorators</h1> | ||
? { | ||
runInBand: false, | ||
maxConcurrency: testsCount, | ||
@@ -90,0 +89,0 @@ maxWorkers: testsCount, |
@@ -8,2 +8,4 @@ /** | ||
*/ | ||
/// <reference types="node" /> | ||
import type { PathLike } from 'node:fs'; | ||
import type { Constructable } from './constructable.js'; | ||
@@ -17,3 +19,3 @@ /** | ||
*/ | ||
directory: string; | ||
directory: PathLike; | ||
/** | ||
@@ -20,0 +22,0 @@ * Mask used to filter files to load |
@@ -9,2 +9,2 @@ /** | ||
export {}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm9vdHN0cmFwLWNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2xpYi9pbnRlcmZhY2VzL2Jvb3RzdHJhcC1jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEFuZHJleSBDaGFsa2luIDxMMmpMaWdhQGdtYWlsLmNvbT4gKGh0dHBzOi8vZ2l0aHViLmNvbS9MMmpMaWdhKS4gQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZ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4gICAqIEBkZWZhdWx0IGZhbHNlXG4gICAqL1xuICBza2lwQnJva2VuPzogYm9vbGVhbjtcblxuICAvKipcbiAgICogR2xvYmFsIHByZWZpeCB0byBiZSBhcHBsaWVkIGZvciBhbGwgcm91dGVzXG4gICAqL1xuICBwcmVmaXg/OiBzdHJpbmc7XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQ29udHJvbGxlcnNMaXN0Q29uZmlnIHtcbiAgLyoqXG4gICAqIExpc3Qgb2YgQ29udHJvbGxlciBjbGFzc2VzIHRvIGJvb3RzdHJhcFxuICAgKi9cbiAgY29udHJvbGxlcnM6IENvbnN0cnVjdGFibGU8dW5rbm93bj5bXTtcblxuICAvKipcbiAgICogQnkgZGVmYXVsdCBhcHBsaWNhdGlvbiB3aWxsIGZhaWxzIHRvIGJvb3RzdHJhcCBpZiBvbmUgb3IgbW9yZSBvZiBsb2FkZWQgZmlsZXMgZG9lcyBub3QgY29udGFpbiB2YWxpZCBjb250cm9sbGVyIG9yIGhhbmRsZXJcbiAgICogVGhpcyBvcHRpb24gYWxsb3dzIHRvIGNoYW5nZSB0aGlzIGJlaGF2aW9yXG4gICAqIEBkZWZhdWx0IGZhbHNlXG4gICAqL1xuICBza2lwQnJva2VuPzogYm9vbGVhbjtcblxuICAvKipcbiAgICogR2xvYmFsIHByZWZpeCB0byBiZSBhcHBsaWVkIGZvciBhbGwgcm91dGVzXG4gICAqL1xuICBwcmVmaXg/OiBzdHJpbmc7XG59XG5cbmV4cG9ydCB0eXBlIEJvb3RzdHJhcENvbmZpZyA9IEF1dG9Mb2FkQ29uZmlnIHwgQ29udHJvbGxlcnNMaXN0Q29uZmlnO1xuIl19 |
{ | ||
"name": "fastify-decorators", | ||
"version": "4.0.0-next.1", | ||
"version": "4.0.0-next.2", | ||
"description": "Framework aimed to provide useful TypeScript decorators to implement controllers, services and request handlers, built with Fastify.", | ||
@@ -19,3 +19,3 @@ "type": "module", | ||
"postbuild": "cp -r ./package.json ../README.md ../CHANGELOG.md ../LICENSE ../docs ../dist/fastify-decorators && node ../patch-readme.js", | ||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest" | ||
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest" | ||
}, | ||
@@ -47,3 +47,3 @@ "repository": { | ||
"engines": { | ||
"node": ">= 12.13.0" | ||
"node": "^14.15.0 || ^16.13.0 || >= 17.0.0" | ||
}, | ||
@@ -55,3 +55,3 @@ "dependencies": { | ||
"@types/node": "*", | ||
"fastify": "^3.0.1", | ||
"fastify": "^3.0.1 || ^4.0.0-alpha.0 || ^4.0.0", | ||
"typescript": "^4.0.0" | ||
@@ -58,0 +58,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
[![Fastify decorators](https://raw.githubusercontent.com/L2jLiga/fastify-decorators/v4.0.0-next.1/assets/logo.png)](https://github.com/L2jLiga/fastify-decorators) | ||
[![Fastify decorators](https://raw.githubusercontent.com/L2jLiga/fastify-decorators/v4.0.0-next.2/assets/logo.png)](https://github.com/L2jLiga/fastify-decorators) | ||
@@ -89,5 +89,5 @@ [![npm version](https://badge.fury.io/js/fastify-decorators.svg?colorB=brightgreen)](https://www.npmjs.com/package/fastify-decorators) | ||
| ------------ | ------ | | ||
| 10.x | es2018 | | ||
| 12.x | es2019 | | ||
| 14.x | es2020 | | ||
| 16.x | es2021 | | ||
| 18.x | es2022 | | ||
@@ -115,3 +115,2 @@ `fastify-decorators` itself use `"target": "es2018"` to support NodeJS 10+ (see [Node.js ES2018 Support]). | ||
import { bootstrap } from 'fastify-decorators'; | ||
import { resolve } from 'path'; | ||
@@ -124,3 +123,3 @@ // Require the framework and instantiate it | ||
// Specify directory with our handler | ||
directory: resolve(__dirname, `handlers`), | ||
directory: new URL(`handlers`, import.meta.url), | ||
@@ -167,3 +166,2 @@ // Specify mask to match only our handler | ||
import { bootstrap } from 'fastify-decorators'; | ||
import { resolve } from 'path'; | ||
@@ -176,3 +174,3 @@ // Require the framework and instantiate it | ||
// Specify directory with our controllers | ||
directory: resolve(__dirname, `controllers`), | ||
directory: new URL(`controllers`, import.meta.url), | ||
@@ -261,6 +259,6 @@ // Specify mask to match only our controllers | ||
[fastify resty]: https://github.com/FastifyResty/fastify-resty | ||
[bootstrapping]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/docs/Bootstrapping.md | ||
[controllers]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/docs/Controllers.md | ||
[request handlers]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/docs/Request%20Handlers.md | ||
[testing]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/docs/Testing.md | ||
[migration guide (v4)]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.1/docs/Migration%20to%20v4.md | ||
[bootstrapping]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/docs/Bootstrapping.md | ||
[controllers]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/docs/Controllers.md | ||
[request handlers]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/docs/Request%20Handlers.md | ||
[testing]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/docs/Testing.md | ||
[migration guide (v4)]: https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/https://github.com/L2jLiga/fastify-decorators/blob/v4.0.0-next.2/docs/Migration%20to%20v4.md |
@@ -8,2 +8,2 @@ /** | ||
*/ | ||
export declare const transformAndWait: <Item>(collection: Iterable<Item>, mapFn: (arg: Item) => unknown | Promise<unknown>) => Promise<void>; | ||
export declare const transformAndWait: <Item>(collection: Iterable<Item> | AsyncIterable<Item>, mapFn: (arg: Item) => unknown | Promise<unknown>) => Promise<void>; |
@@ -9,4 +9,6 @@ /** | ||
export const transformAndWait = async (collection, mapFn) => { | ||
await Promise.all([...collection].map(mapFn)); | ||
for await (const item of collection) { | ||
await mapFn(item); | ||
} | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtLWFuZC13YWl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL3V0aWxzL3RyYW5zZm9ybS1hbmQtd2FpdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxNQUFNLENBQUMsTUFBTSxnQkFBZ0IsR0FBRyxLQUFLLEVBQVEsVUFBMEIsRUFBRSxLQUFnRCxFQUFpQixFQUFFO0lBQzFJLE1BQU0sT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEdBQUcsVUFBVSxDQUFDLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7QUFDaEQsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEFuZHJleSBDaGFsa2luIDxMMmpMaWdhQGdtYWlsLmNvbT4gKGh0dHBzOi8vZ2l0aHViLmNvbS9MMmpMaWdhKS4gQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZSB0aGF0IGNh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nZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZSB0aGF0IGNhbiBiZVxuICogZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZSBhdCBodHRwczovL2dpdGh1Yi5jb20vTDJqTGlnYS9mYXN0aWZ5LWRlY29yYXRvcnMvYmxvYi9tYXN0ZXIvTElDRU5TRVxuICovXG5cbmV4cG9ydCBjb25zdCB0cmFuc2Zvcm1BbmRXYWl0ID0gYXN5bmMgPEl0ZW0+KFxuICBjb2xsZWN0aW9uOiBJdGVyYWJsZTxJdGVtPiB8IEFzeW5jSXRlcmFibGU8SXRlbT4sXG4gIG1hcEZuOiAoYXJnOiBJdGVtKSA9PiB1bmtub3duIHwgUHJvbWlzZTx1bmtub3duPixcbik6IFByb21pc2U8dm9pZD4gPT4ge1xuICBmb3IgYXdhaXQgKGNvbnN0IGl0ZW0gb2YgY29sbGVjdGlvbikge1xuICAgIGF3YWl0IG1hcEZuKGl0ZW0pO1xuICB9XG59O1xuIl19 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
197657
1139
0
259