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,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -134,9 +132,7 @@
"indexes": [
{
"keyName": "IDX_stock_location_address_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -144,9 +140,7 @@
},
{
"keyName": "stock_location_address_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -231,9 +225,7 @@
"indexes": [
{
"keyName": "IDX_stock_location_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -241,9 +233,7 @@
},
{
"keyName": "stock_location_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -253,13 +243,9 @@
"foreignKeys": {
"stock_location_address_id_foreign": {
"constraintName": "stock_location_address_id_foreign",
"columnNames": [
"address_id"
],
"columnNames": ["address_id"],
"localTableName": "public.stock_location",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.stock_location_address",
"deleteRule": "set null",
"updateRule": "cascade"
@@ -1,23 +1,33 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240307161216 extends Migration {
async up(): Promise<void> {
this.addSql('create table if not exists "stock_location_address" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "address_1" text not null, "address_2" text null, "company" text null, "city" text null, "country_code" text not null, "phone" text null, "province" text null, "postal_code" text null, "metadata" jsonb null, constraint "stock_location_address_pkey" primary key ("id"));');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_stock_location_address_deleted_at" ON "stock_location_address" (deleted_at) WHERE deleted_at IS NOT NULL;');
this.addSql(
'create table if not exists "stock_location_address" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "address_1" text not null, "address_2" text null, "company" text null, "city" text null, "country_code" text not null, "phone" text null, "province" text null, "postal_code" text null, "metadata" jsonb null, constraint "stock_location_address_pkey" primary key ("id"));'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_stock_location_address_deleted_at" ON "stock_location_address" (deleted_at) WHERE deleted_at IS NOT NULL;'
)
this.addSql('create table if not exists "stock_location" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "name" text not null, "address_id" text null, "metadata" jsonb null, constraint "stock_location_pkey" primary key ("id"));');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_stock_location_deleted_at" ON "stock_location" (deleted_at) WHERE deleted_at IS NOT NULL;');
this.addSql(
'create table if not exists "stock_location" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "name" text not null, "address_id" text null, "metadata" jsonb null, constraint "stock_location_pkey" primary key ("id"));'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_stock_location_deleted_at" ON "stock_location" (deleted_at) WHERE deleted_at IS NOT NULL;'
)
this.addSql('alter table if exists "stock_location" add constraint "stock_location_address_id_foreign" foreign key ("address_id") references "stock_location_address" ("id") on update cascade on delete set null;');
this.addSql(
'alter table if exists "stock_location" add constraint "stock_location_address_id_foreign" foreign key ("address_id") references "stock_location_address" ("id") on update cascade on delete set null;'
)
}
async down(): Promise<void> {
this.addSql('alter table if exists "stock_location" drop constraint if exists "stock_location_address_id_foreign";');
this.addSql(
'alter table if exists "stock_location" drop constraint if exists "stock_location_address_id_foreign";'
)
this.addSql('drop table if exists "stock_location_address" cascade;');
this.addSql('drop table if exists "stock_location_address" cascade;')
this.addSql('drop table if exists "stock_location" cascade;');
this.addSql('drop table if exists "stock_location" cascade;')
}
}