breaking: move shared HTTP utils to the framework (#9402)

Fixes: FRMW-2728, FRMW-2729

After this PR gets merged the following middleware will be exported from the `@medusajs/framework/http` import path.

- applyParamsAsFilters
- clearFiltersByKey
- applyDefaultFilters
- setContext
- getQueryConfig
- httpCompression
- maybeApplyLinkFilter
- refetchEntities
- unlessPath
- validateBody
- validateQuery

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
Harminder Virk
2024-10-03 09:42:00 +00:00
committed by GitHub
co-authored by Adrien de Peretti
parent 193f93464f
commit 48e00169d2
557 changed files with 2365 additions and 3499 deletions
@@ -1,19 +1,19 @@
const signalExit = require(`signal-exit`);
const signalExit = require(`signal-exit`)
const cleanupTasks = new Set();
const cleanupTasks = new Set()
exports.registerCleanupTask = (taskFn) => {
cleanupTasks.add(taskFn);
cleanupTasks.add(taskFn)
return () => {
const result = taskFn();
cleanupTasks.delete(taskFn);
return result;
};
};
const result = taskFn()
cleanupTasks.delete(taskFn)
return result
}
}
signalExit(() => {
if (cleanupTasks.size) {
console.log(`Process exitted in middle of publishing - cleaning up`);
cleanupTasks.forEach((taskFn) => taskFn());
console.log(`Process exitted in middle of publishing - cleaning up`)
cleanupTasks.forEach((taskFn) => taskFn())
}
});
})