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": [
{
@@ -41,10 +39,7 @@
"primary": false,
"nullable": false,
"default": "'draft'",
"enumItems": [
"active",
"draft"
],
"enumItems": ["active", "draft"],
"mappedType": "enum"
},
"type": {
@@ -55,10 +50,7 @@
"primary": false,
"nullable": false,
"default": "'sale'",
"enumItems": [
"sale",
"override"
],
"enumItems": ["sale", "override"],
"mappedType": "enum"
},
"starts_at": {
@@ -129,9 +121,7 @@
"indexes": [
{
"keyName": "IDX_price_list_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -139,9 +129,7 @@
},
{
"keyName": "price_list_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -226,9 +214,7 @@
"indexes": [
{
"keyName": "IDX_price_list_rule_price_list_id",
"columnNames": [
"price_list_id"
],
"columnNames": ["price_list_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -236,9 +222,7 @@
},
{
"keyName": "IDX_price_list_rule_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -246,9 +230,7 @@
},
{
"keyName": "price_list_rule_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -258,13 +240,9 @@
"foreignKeys": {
"price_list_rule_price_list_id_foreign": {
"constraintName": "price_list_rule_price_list_id_foreign",
"columnNames": [
"price_list_id"
],
"columnNames": ["price_list_id"],
"localTableName": "public.price_list_rule",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.price_list",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -348,9 +326,7 @@
"indexes": [
{
"keyName": "IDX_price_preference_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -366,9 +342,7 @@
},
{
"keyName": "price_preference_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -426,9 +400,7 @@
"indexes": [
{
"keyName": "IDX_price_set_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -436,9 +408,7 @@
},
{
"keyName": "price_set_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -578,9 +548,7 @@
"indexes": [
{
"keyName": "IDX_price_currency_code",
"columnNames": [
"currency_code"
],
"columnNames": ["currency_code"],
"composite": false,
"primary": false,
"unique": false,
@@ -588,9 +556,7 @@
},
{
"keyName": "IDX_price_price_set_id",
"columnNames": [
"price_set_id"
],
"columnNames": ["price_set_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -598,9 +564,7 @@
},
{
"keyName": "IDX_price_price_list_id",
"columnNames": [
"price_list_id"
],
"columnNames": ["price_list_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -608,9 +572,7 @@
},
{
"keyName": "IDX_price_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -618,9 +580,7 @@
},
{
"keyName": "price_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -630,26 +590,18 @@
"foreignKeys": {
"price_price_set_id_foreign": {
"constraintName": "price_price_set_id_foreign",
"columnNames": [
"price_set_id"
],
"columnNames": ["price_set_id"],
"localTableName": "public.price",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.price_set",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"price_price_list_id_foreign": {
"constraintName": "price_price_list_id_foreign",
"columnNames": [
"price_list_id"
],
"columnNames": ["price_list_id"],
"localTableName": "public.price",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.price_list",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -742,9 +694,7 @@
"indexes": [
{
"keyName": "IDX_price_rule_price_id_attribute_unique",
"columnNames": [
"price_id"
],
"columnNames": ["price_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -752,9 +702,7 @@
},
{
"keyName": "IDX_price_rule_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -762,9 +710,7 @@
},
{
"keyName": "price_rule_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -774,13 +720,9 @@
"foreignKeys": {
"price_rule_price_id_foreign": {
"constraintName": "price_rule_price_id_foreign",
"columnNames": [
"price_id"
],
"columnNames": ["price_id"],
"localTableName": "public.price_rule",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.price",
"deleteRule": "cascade",
"updateRule": "cascade"

View File

@@ -1,15 +1,19 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240322094407 extends Migration {
async up(): Promise<void> {
this.addSql('drop table if exists "money_amount" cascade;');
this.addSql('drop table if exists "money_amount" cascade;')
}
async down(): Promise<void> {
this.addSql('create table if not exists "money_amount" ("id" text not null, "currency_code" text not null, "amount" numeric not null, "min_quantity" numeric null, "max_quantity" numeric null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "money_amount_pkey" primary key ("id"));');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_currency_code" ON "money_amount" (currency_code) WHERE deleted_at IS NULL;');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_deleted_at" ON "money_amount" (deleted_at) WHERE deleted_at IS NOT NULL;');
this.addSql(
'create table if not exists "money_amount" ("id" text not null, "currency_code" text not null, "amount" numeric not null, "min_quantity" numeric null, "max_quantity" numeric null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "money_amount_pkey" primary key ("id"));'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_money_amount_currency_code" ON "money_amount" (currency_code) WHERE deleted_at IS NULL;'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_money_amount_deleted_at" ON "money_amount" (deleted_at) WHERE deleted_at IS NOT NULL;'
)
}
}

View File

@@ -1,15 +1,19 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240704094505 extends Migration {
async up(): Promise<void> {
this.addSql('create table if not exists "price_preference" ("id" text not null, "attribute" text not null, "value" text null, "is_tax_inclusive" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_preference_pkey" primary key ("id"));');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_preference_deleted_at" ON "price_preference" (deleted_at) WHERE deleted_at IS NOT NULL;');
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_preference_attribute_value" ON "price_preference" (attribute, value) WHERE deleted_at IS NULL;');
this.addSql(
'create table if not exists "price_preference" ("id" text not null, "attribute" text not null, "value" text null, "is_tax_inclusive" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_preference_pkey" primary key ("id"));'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_price_preference_deleted_at" ON "price_preference" (deleted_at) WHERE deleted_at IS NOT NULL;'
)
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_preference_attribute_value" ON "price_preference" (attribute, value) WHERE deleted_at IS NULL;'
)
}
async down(): Promise<void> {
this.addSql('drop table if exists "price_preference" cascade;');
this.addSql('drop table if exists "price_preference" cascade;')
}
}