Feat(medusa): implement feature flags (#1768)

* feat: add feature flag loading in projects

* fix: make feature flag consume itself

* fix: rename container registration to featureFlagRouter

* fix: refactor

* behavioral feature flags

* add environment to server

* limit "useTemplateDb" to non feature flagged migrations

* filter migrations and entities according to those which are enabled in the environment

* run only migrations that are enabled when running 'medusa migrations run'

* add logging to the featureflag loader

* initial implementation of featureFlagEntity

* column descriptors

* initial startServerWithEnv (to be refactored)

* update commands

* final touches

* update loaders to fix unit tests

* enable all batch job tests

* update seed method

* add api test capabilities

* revert batch job test

* revert formatting changes

* pr feedback

* pr feedback

* remove unused imports

* rename feature flag decorators

* pr feedback

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
This commit is contained in:
Philip Korsholm
2022-07-04 15:39:30 +02:00
committed by GitHub
co-authored by Sebastian Rindom
parent f0704a7e17
commit 41681b45b1
19 changed files with 527 additions and 58 deletions
@@ -95,25 +95,25 @@ describe("/admin/batch-jobs", () => {
id: "job_5",
created_at: expect.any(String),
updated_at: expect.any(String),
created_by: "admin_user"
created_by: "admin_user",
},
{
id: "job_3",
created_at: expect.any(String),
updated_at: expect.any(String),
created_by: "admin_user"
created_by: "admin_user",
},
{
id: "job_2",
created_at: expect.any(String),
updated_at: expect.any(String),
created_by: "admin_user"
created_by: "admin_user",
},
{
id: "job_1",
created_at: expect.any(String),
updated_at: expect.any(String),
created_by: "admin_user"
created_by: "admin_user",
},
],
})
@@ -121,7 +121,10 @@ describe("/admin/batch-jobs", () => {
it("lists batch jobs created by the user and where completed_at is null ", async () => {
const api = useApi()
const response = await api.get("/admin/batch-jobs?completed_at=null", adminReqConfig)
const response = await api.get(
"/admin/batch-jobs?completed_at=null",
adminReqConfig
)
expect(response.status).toEqual(200)
expect(response.data.batch_jobs.length).toEqual(3)