Commit Graph

126 Commits

Author SHA1 Message Date
Harminder Virk
9516890bb3 fix: attempt to fix flaky migration tests (#8034) 2024-07-09 17:13:45 +05:30
Stevche Radevski
1c3ef13371 feat: Add necessary middlewares for tax inclusive pricing (#7827)
We are adding tax inclusive pricing calculation when listing products.

Two things to keep in mind:
- `region_id` will be required if you request calculated prices.
- We won't accept `currency_code` anymore, as that will come from the region info (since ultimately a cart and its currency are tied to a region)

REF CORE-2376
DEPENDS ON #8003
2024-07-09 09:37:13 +00:00
Stevche Radevski
db6969578f feat: Plug tax inclusivity in cart and order workflows (#8013) 2024-07-09 11:10:42 +02:00
Harminder Virk
4b391fc3cf Initial implementation with just the generate method (#7973) 2024-07-09 12:32:02 +05:30
Adrien de Peretti
10848c8bf2 chore: rename source to linkable in defineLink options (#8016)
* chore: rename source to linkable in defineLink options

* rm unused const
2024-07-08 16:44:03 +02:00
Adrien de Peretti
fc7f5ff71a fix: Modules providers loading mechanism to infer the source dir (#8015)
* fix: Modules providers loading mechanism to infer the source dir

* finalize
2024-07-08 14:11:45 +02:00
Adrien de Peretti
b450628481 fix: error 4082 when using defineLink (#8014) 2024-07-08 12:05:44 +02:00
Adrien de Peretti
9750047af1 chore: Rename entity to model (#7977)
**What**
Start renaming `entity` to `model`
2024-07-08 07:43:49 +00:00
Adrien de Peretti
b368251ca3 chore: Migrate modules to use the Module util (#7964)
**What**
Apply the `Module` util to each module to handle the export and provide the linkable configuration object.

- Most joiner config that does not have any special config are removed/cleaned up in favor of the autogenerated one or simpler one
- linkable are now available in all modules
- cleaned up the dependencies of the modules

FIXES CORE-2410
2024-07-05 13:00:40 +00:00
Adrien de Peretti
1393f51046 fix: Improve get caller file path util (#7974)
* fix: Improve get caller file path util

* improve compatibility

* update comment

---------

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2024-07-05 12:54:27 +02:00
Carlos R. L. Rodrigues
9badad24aa feat(workflows-sdk): conditional step (#7912)
* chore: move ModuleRegistrationName to utils

* chore(workflows-sdk): conditional step

* type

* when condition
2024-07-05 10:54:18 +02:00
Adrien de Peretti
f49139b20f fix: custom link resolution in medusa app (#7950)
* fix custom link resolution in medusa app

* improve

* fix duplicate
2024-07-04 16:50:53 +02:00
Adrien de Peretti
7b84d854f0 Feat/mikro orm based linkable (#7944)
**What**
- Generate simple linkable for mikro orm based modules 
- fix module util
- fix joiner config builder
- fix define link relationship extension
- fix migrations not loading custom links
2024-07-04 13:30:47 +00:00
Adrien de Peretti
cb36655b63 chore: Update defineMikroOrmCliConfig api (#7940)
* chore: Update defineMikroOrmCliConfig api

* update usage
2024-07-04 12:58:43 +02:00
Adrien de Peretti
41c4307fc7 feat: define link util (#7931)
* feat: define link util

* handle pluralized fieldAlias for isList

* serviceName ar reference

* finalize

* todo

* WIP

* finalize

* fix tests

* update typings

* fix Module

* linkable

* update errors
2024-07-04 10:37:30 +02:00
Shahed Nasser
9b1688944e fix: fix docs link in payment provider tsdocs (#7939)
* fix: fix docs link in payment provider tsdocs

* add a note
2024-07-04 11:09:29 +03:00
Harminder Virk
cc3eb8698d fix: omit mikro orm entities values from the config (#7938) 2024-07-04 13:21:52 +05:30
Stevche Radevski
012a624ee4 feat: Flatten the provider config for all modules (#7930) 2024-07-03 16:57:12 +02:00
Riqwan Thamir
b6e4435c23 chore: cleanup migrations logs (#7924)
what:

when running `medusa run migrations`, cleanup logs with short descriptive message.

Before:

<img width="1262" alt="Screenshot 2024-07-03 at 14 31 36" src="https://github.com/medusajs/medusa/assets/5105988/504e9c24-371c-476d-9b6d-2dfe1a4088dc">

After:

<img width="1004" alt="Screenshot 2024-07-03 at 14 42 57" src="https://github.com/medusajs/medusa/assets/5105988/a89eaed5-04a4-4efb-a2e9-ca480f1eaa6e">
2024-07-03 13:53:59 +00:00
Adrien de Peretti
2711012d96 feat: Make the Module require the service name (#7923)
* feat: Make the Module require the service name

* finalize types
2024-07-03 15:44:57 +02:00
Adrien de Peretti
617a5972bf feat: refactor module joiner config and links generation (#7859)
* feat: refactor module joiner config and links generation

* improve typings

* WIP

* WIP

* WIP

* rename type file

* create link config

* finish typings and add utils

* improve links

* WIP typings

* finalize ExportModule utils

* finalize ExportModule utils

* fix: dml tests

* improve and fixes

* simplify typings with id changes

* add toJSON

* multiple fixes and entity builder fixes

* fix currency searchable

* fix tests

* medusa service refactoring

* cleanup

* cleanup and fixes

* make module name optional

* renaming

---------

Co-authored-by: Harminder Virk <virk.officials@gmail.com>
2024-07-03 13:12:49 +02:00
Harminder Virk
46f15b4909 fix: inferring of relationship types (#7913)
FIXES: CORE-2448
2024-07-03 13:29:27 +05:30
Stevche Radevski
b4aa7fb9a7 fix: Disallow creating duplicate prices (#7866)
* fix: Disallow creating duplicate prices

* fix: Don't pass id to manager create in upsertWithReplace
2024-07-02 17:06:58 +02:00
Stevche Radevski
ef5f5363a1 fix: Delete before upsert in upsertWithReplace to handle relations with unique constraint (#7875) 2024-07-02 13:56:12 +02:00
Carlos R. L. Rodrigues
07715e6b50 chore(order): cancel return (#7881) 2024-07-02 06:52:58 -03:00
Harminder Virk
b3236ff31c Add support for native enums (#7903) 2024-07-02 15:22:09 +05:30
Harminder Virk
074e4a888e Mark keys as primary with explicit method call (#7900) 2024-07-02 13:27:21 +05:30
Carlos R. L. Rodrigues
17e6a83b59 fix(utils): joiner config from medusa project (#7896) 2024-07-01 13:48:34 -03:00
Stevche Radevski
9daec5d7ac chore: Migrate notification module to DML (#7835) 2024-07-01 09:17:32 +00:00
Stevche Radevski
c661180c44 feat: Completely revamp the pricing module (#7852)
* feat: Completely revamp the pricing module

* chore: Update all places to the new pricing interfaces

* fix: Remove unnecessary join to itself

* chore: Add data migration for existing users

* fix: Apply the correct index to price rule
2024-07-01 09:47:03 +02:00
Shahed Nasser
72f7500c84 chore(docs): DML API Reference (#7863)
* added dml options

* added tsdocs + configurations
2024-07-01 10:21:56 +03:00
Oli Juhl
fa6cd84049 chore: Migrate region module to use DML (#7837) 2024-06-29 13:14:52 +00:00
Carlos R. L. Rodrigues
9f3998393b fix(totals): order item totals (#7867) 2024-06-28 09:34:25 -03:00
Riqwan Thamir
789d545b9e feat(utils,types): infer keys in query builder from schema (#7861) 2024-06-27 20:38:06 +02:00
Carlos R. L. Rodrigues
7602fe8b61 chore: totals refundable_total (#7857) 2024-06-27 13:56:55 -03:00
Riqwan Thamir
91098877c2 fix(utils): always apply default indexes (#7858)
what:

- fixes default indexes not being applied always
2024-06-27 16:05:28 +00:00
Riqwan Thamir
91faa5ffdb feat(utils): DML generates foreign key indexes by default (#7855)
**what:**

- adds default indexes on foreign keys when belongs to relationship is present

RESOLVES CORE-2404
2024-06-27 14:45:27 +00:00
Riqwan Thamir
3f16b011fa feat(utils,types): DML Index can generate where SQL from a query builder (#7849)
what:

- introduces a simple query builder
- uses the query builder to tranform an object in where to SQL when applying indexes

```
Examples:
  { where: { column: null } } -> column IS NULL
  { where: { column: { $ne: null } } } -> column IS NOT NULL
  { where: { boolean_column: true } } -> boolean_column IS TRUE
  { where: { column: "value", another_column: { $ne: 30 } } } -> column = "value" AND another_column != 30
```

```
const user = model
  .define("user", {
    email: model.text(),
    account: model.text(),
    organization: model.text(),
  })
  .indexes([
    {
      on: ["organization", "account"],
      where: { email: { $ne: null } },
    },
    {
      name: "IDX-email-account-special",
      on: ["organization", "account"],
      where: {
        email: { $ne: null },
        account: null,
      },
    },
```

RESOLVES CORE-2392
2024-06-27 10:24:34 +00:00
Riqwan Thamir
5ee97d0e97 feat(utils,types): DML can apply composite indexes (#7842)
**what:**

- DML can apply composite indexes
- Where clause is currently a string, QB version will come as a follow up

```
model.define("user", {
  email: model.text(),
  account: model.text(),
}).indexes([
  {
    name: "IDX-unique-name",
    unique: true,
    on: ["email", "account"],
    where: "email is NOT NULL",
  },
])
```

RESOLVES CORE-2391
2024-06-26 15:39:04 +00:00
Adrien de Peretti
68dbcda84c fix: DML Enum property (#7846)
* fix: DML Enum property

* add more tests

* fix unit tests
2024-06-26 17:01:57 +02:00
Riqwan Thamir
4945c79818 feat(utils): infer primaryKeys from a DML model (#7839)
what:

- depending on other properties in a DML model, we infer primaryKeys between id properties and primaryKey-able properties. 

```
Example:
  Model 1:
    id: model.id() -> primary key
    code: model.text()

  Model 2:
    id: model.id()
    code: model.text().primaryKey() -> primary key

  Model 3:
    id: model.id()
    code: model.text().primaryKey() -> composite primary key
    name: model.text().primaryKey() -> composite primary key
```
2024-06-26 09:26:09 +00:00
Adrien de Peretti
dc307c658d feat: Add support for array properties DML (#7836) 2024-06-25 20:51:14 +02:00
Adrien de Peretti
39038ddb0a chore: various DML improvements (#7833)
* chore: various DML improvements

* Check is something through static utils

* Check is something through static utils

* allow to define a schema with table name

* restrict searchable to text only

* rm searchable modifier

* extract constructor logic into separate function
2024-06-25 18:00:39 +02:00
Adrien de Peretti
66d17fabde chore: rename extractor type to InferEntityType (#7829) 2024-06-25 13:43:11 +02:00
Adrien de Peretti
34c44078e7 fix: DML relation management for many to one relation ship foreign keys (#7790)
FIXES CORE-2369

cc @thetutlage 

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-06-24 18:54:54 +00:00
Oli Juhl
25210369d9 fix(utils): Uppercase event action name (#7822)
Currently, the keys of the events contain a lowercased action, e.g. `INVENTORY_ITEM_created`, which is breaking our usage across multiple modules
2024-06-24 17:43:49 +00:00
Riqwan Thamir
96fb7a962e feat(utils,currency): Migrate currency to use DML (#7807) 2024-06-24 19:07:26 +02:00
Shahed Nasser
79d90fadc4 feat(utils): configure notification module by default (#7814)
Add the notification module to `defineConfig` and configure the local notification module.
2024-06-24 14:47:40 +00:00
Adrien de Peretti
021f5ea016 fix: medusa service should infer names when not provided (#7818)
* fix: medusa service should infer names when not provided

* fix types

* fix typings
2024-06-24 16:35:44 +02:00
Adrien de Peretti
27bb93c5b5 chore: Fix export and option of mikro orm define config util (#7809) 2024-06-24 09:31:52 +00:00