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 15:12:00 +05:30
committed by GitHub
parent 193f93464f
commit 48e00169d2
557 changed files with 2365 additions and 3499 deletions

View File

@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -134,9 +132,7 @@
},
{
"keyName": "customer_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -320,9 +316,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"customer_id"
],
"columnNames": ["customer_id"],
"composite": false,
"keyName": "IDX_customer_address_customer_id",
"primary": false,
@@ -346,9 +340,7 @@
},
{
"keyName": "customer_address_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -358,13 +350,9 @@
"foreignKeys": {
"customer_address_customer_id_foreign": {
"constraintName": "customer_address_customer_id_foreign",
"columnNames": [
"customer_id"
],
"columnNames": ["customer_id"],
"localTableName": "public.customer_address",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.customer",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -447,9 +435,7 @@
"indexes": [
{
"keyName": "IDX_customer_group_name_unique",
"columnNames": [
"name"
],
"columnNames": ["name"],
"composite": false,
"primary": false,
"unique": false,
@@ -457,9 +443,7 @@
},
{
"keyName": "customer_group_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -542,18 +526,14 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"customer_group_id"
],
"columnNames": ["customer_group_id"],
"composite": false,
"keyName": "IDX_customer_group_customer_group_id",
"primary": false,
"unique": false
},
{
"columnNames": [
"customer_id"
],
"columnNames": ["customer_id"],
"composite": false,
"keyName": "IDX_customer_group_customer_customer_id",
"primary": false,
@@ -561,9 +541,7 @@
},
{
"keyName": "customer_group_customer_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -573,25 +551,17 @@
"foreignKeys": {
"customer_group_customer_customer_group_id_foreign": {
"constraintName": "customer_group_customer_customer_group_id_foreign",
"columnNames": [
"customer_group_id"
],
"columnNames": ["customer_group_id"],
"localTableName": "public.customer_group_customer",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.customer_group",
"deleteRule": "cascade"
},
"customer_group_customer_customer_id_foreign": {
"constraintName": "customer_group_customer_customer_id_foreign",
"columnNames": [
"customer_id"
],
"columnNames": ["customer_id"],
"localTableName": "public.customer_group_customer",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.customer",
"deleteRule": "cascade"
}

View File

@@ -1,21 +1,39 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240524123112 extends Migration {
async up(): Promise<void> {
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_email_has_account_unique" ON "customer" (email, has_account) WHERE deleted_at IS NULL;');
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_email_has_account_unique" ON "customer" (email, has_account) WHERE deleted_at IS NULL;'
)
this.addSql('drop index if exists "IDX_customer_address_unqiue_customer_billing";');
this.addSql('drop index if exists "IDX_customer_address_unqiue_customer_shipping";');
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_billing" ON "customer_address" (customer_id) WHERE "is_default_billing" = true;');
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_shipping" ON "customer_address" (customer_id) WHERE "is_default_shipping" = true;');
this.addSql(
'drop index if exists "IDX_customer_address_unqiue_customer_billing";'
)
this.addSql(
'drop index if exists "IDX_customer_address_unqiue_customer_shipping";'
)
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_billing" ON "customer_address" (customer_id) WHERE "is_default_billing" = true;'
)
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_shipping" ON "customer_address" (customer_id) WHERE "is_default_shipping" = true;'
)
}
async down(): Promise<void> {
this.addSql('drop index if exists "IDX_customer_email_has_account_unique";');
this.addSql('drop index if exists "IDX_customer_email_has_account_unique";')
this.addSql('drop index if exists "IDX_customer_address_unique_customer_billing";');
this.addSql('drop index if exists "IDX_customer_address_unique_customer_shipping";');
this.addSql('create unique index if not exists "IDX_customer_address_unqiue_customer_billing" on "customer_address" ("customer_id") where "is_default_billing" = true;');
this.addSql('create unique index if not exists "IDX_customer_address_unique_customer_shipping" on "customer_address" ("customer_id") where "is_default_shipping" = true;');
this.addSql(
'drop index if exists "IDX_customer_address_unique_customer_billing";'
)
this.addSql(
'drop index if exists "IDX_customer_address_unique_customer_shipping";'
)
this.addSql(
'create unique index if not exists "IDX_customer_address_unqiue_customer_billing" on "customer_address" ("customer_id") where "is_default_billing" = true;'
)
this.addSql(
'create unique index if not exists "IDX_customer_address_unique_customer_shipping" on "customer_address" ("customer_id") where "is_default_shipping" = true;'
)
}
}