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,6 +1,5 @@
import { access, lstat, mkdtemp } from "fs/promises"
import path from "path"
import { sep } from "path"
import path, { sep } from "path"
import { tmpdir } from "os"
export async function isFile(filePath: string): Promise<boolean> {
@@ -6,11 +6,17 @@ export const readYaml = async (filePath): Promise<unknown> => {
return yaml.load(yamlString)
}
export const writeYaml = async (filePath: string, yamlContent: string): Promise<void> => {
export const writeYaml = async (
filePath: string,
yamlContent: string
): Promise<void> => {
await fs.writeFile(filePath, yamlContent, "utf8")
}
export const writeYamlFromJson = async (filePath, jsonObject): Promise<void> => {
export const writeYamlFromJson = async (
filePath,
jsonObject
): Promise<void> => {
const yamlString = yaml.dump(jsonObject)
await fs.writeFile(filePath, yamlString, "utf8")
}