Carlos R. L. Rodrigues
884428a1b5
feat: event aggregator ( #6218 )
...
What:
- Event Aggregator Util
- Preparation for normalizing event in a new format (backward compatible with the current format)
- GQL Schema to joiner config and some Entities configured
- Link modules emmiting events
2024-02-05 11:59:10 +00:00
Carlos R. L. Rodrigues
45134e4d11
chore: local workflow proxying methods to pass context ( #6263 )
...
What:
- When calling a module's method inside a Local Workflow the MedusaContext is passed as the last argument to the method if not provided
- Add `requestId` to req
- A couple of fixes on Remote Joiner and the data fetcher for internal services
Why:
- The context used to initialize the workflow has to be shared with all modules. properties like transactionId will be used to emit events and requestId to trace logs for example.
2024-02-01 13:37:26 +00:00
Carlos R. L. Rodrigues
d85fee42ee
chore: use loaded module reference ( #5763 )
2024-01-23 08:31:02 -03:00
Adrien de Peretti
2826605b01
fix(medusa): Order edit confirmation conflict line items update ( #5867 )
...
* fix(medusa): Order edit confirmation conflict line items update
* naming
* Create serious-flowers-provide.md
* another proposal
* fixes
2023-12-14 14:52:27 +01:00
Philip Korsholm
18afe0b9ad
Fix(medusa, inventory, stock-location, types, utils): Modules sdk build query ( #5713 )
...
* remove defaults
* take 2
* works now
* add changeset
* pricing module and pricing service list take null updates
* update handlers
* update product module service with take:null where relevant
* no spread
* note to self:default offset should be 0, not 15
2023-11-27 10:17:42 +00:00
Adrien de Peretti
f90ba02087
feat(utils): Introduce promiseAll util ( #5543 )
2023-11-08 08:48:48 +01:00
Adrien de Peretti
a45da9215d
fix(medusa, modules-sdk, modules): Module loading missing dependencies + remote query reference issue ( #5468 )
2023-10-26 20:24:38 +02:00
Frane Polić
aba9ded2a3
feat(workflows): update product workflow ( #4982 )
...
**What**
- added "update product" workflow
Co-authored-by: Riqwan Thamir <5105988+riqwan@users.noreply.github.com >
2023-10-19 12:02:40 +00:00
Sebastian Rindom
66413d094e
feat: move create inventory to @medusajs/workflows ( #5301 )
...
**Why**
- We have some workflow-like flows in @medusajs/medusa. These should be moved over to the workflows package.
- Inventory Items <> Variant currently assume a 1-1 mapping. There should be support for a many-to-many mapping.
**What**
- PR introduces a feature flag for supporting many-to-many mappings for inventory and variants.
- Deletes legacy transaction handler in @medusajs/medusa.
- Adjusts existing createInventoryItems handler to remove dependency on variant data.
**Unkowns**
~~1. Couldn't find an existing test for the CreateProduct workflow. It should be tested that this still works as expected.~~
2. Have removed transaction managers as we should move to handling consistency through orchestration tooling. Are we ready for that?
2023-10-11 18:01:56 +00:00
Carlos R. L. Rodrigues
130cbc1f43
feat(*): Modules export entities and fields ( #5242 )
2023-10-03 14:20:43 -07:00
Carlos R. L. Rodrigues
4d16acf5f0
feat(link-modules,modules-sdk, utils, types, products) - Remote Link and Link modules ( #4695 )
...
What:
- Definition of all Modules links
- `link-modules` package to manage the creation of all pre-defined link or custom ones
```typescript
import { initialize as iniInventory } from "@medusajs/inventory";
import { initialize as iniProduct } from "@medusajs/product";
import {
initialize as iniLinks,
runMigrations as migrateLinks
} from "@medusajs/link-modules";
await Promise.all([iniInventory(), iniProduct()]);
await migrateLinks(); // create tables based on previous loaded modules
await iniLinks(); // load link based on previous loaded modules
await iniLinks(undefined, [
{
serviceName: "product_custom_translation_service_link",
isLink: true,
databaseConfig: {
tableName: "product_transalations",
},
alias: [
{
name: "translations",
},
],
primaryKeys: ["id", "product_id", "translation_id"],
relationships: [
{
serviceName: Modules.PRODUCT,
primaryKey: "id",
foreignKey: "product_id",
alias: "product",
},
{
serviceName: "custom_translation_service",
primaryKey: "id",
foreignKey: "translation_id",
alias: "transalation",
deleteCascade: true,
},
],
extends: [
{
serviceName: Modules.PRODUCT,
relationship: {
serviceName: "product_custom_translation_service_link",
primaryKey: "product_id",
foreignKey: "id",
alias: "translations",
isList: true,
},
},
{
serviceName: "custom_translation_service",
relationship: {
serviceName: "product_custom_translation_service_link",
primaryKey: "product_id",
foreignKey: "id",
alias: "product_link",
},
},
],
},
]); // custom links
```
Remote Link
```typescript
import { RemoteLink, Modules } from "@medusajs/modules-sdk";
// [...] initialize modules and links
const remoteLink = new RemoteLink();
// upsert the relationship
await remoteLink.create({ // one (object) or many (array)
[Modules.PRODUCT]: {
variant_id: "var_abc",
},
[Modules.INVENTORY]: {
inventory_item_id: "iitem_abc",
},
data: { // optional additional fields
required_quantity: 5
}
});
// dismiss (doesn't cascade)
await remoteLink.dismiss({ // one (object) or many (array)
[Modules.PRODUCT]: {
variant_id: "var_abc",
},
[Modules.INVENTORY]: {
inventory_item_id: "iitem_abc",
},
});
// delete
await remoteLink.delete({
// every key is a module
[Modules.PRODUCT]: {
// every key is a linkable field
variant_id: "var_abc", // single or multiple values
},
});
// restore
await remoteLink.restore({
// every key is a module
[Modules.PRODUCT]: {
// every key is a linkable field
variant_id: "var_abc", // single or multiple values
},
});
```
Co-authored-by: Riqwan Thamir <5105988+riqwan@users.noreply.github.com >
2023-08-30 14:31:32 +00:00
Carlos R. L. Rodrigues
5a8a889c6d
feat(modules-sdk): Remote Query ( #4463 )
...
* feat: Remote Query
2023-07-19 15:35:36 -03:00
Philip Korsholm
d184d23c63
Feat/bulk operations for inventory service ( #4503 )
...
* initial push
* bulk delete reservations by location ids
* add method to interface (not implemented yet)
* bulk update
* delete reservations by location id bulk
* add create bulk for inventory item
* refactor attach inventory item method
* add changeset
* verbose false
* method override instead of multiple methods
* change up method signature
* redo changes when updating interface
* update createInventoryLevel method
* rename variables
* fix feedback
* return correct string array when emitting event
* refactor inventory service
* redo order changes
* snapshot
* move prep methods
2023-07-18 11:17:57 +02:00
Adrien de Peretti
14c0f62f84
feat: Product Module ( #4161 )
...
* chore: boilerplate setup
* wip: add Product, ProductTag, ProductType, ProductCollection models
* wip: `IProductService` definition
* wip: test function in index, build passing
* fix: where condition
* chore: get boilerplate working with modules sdk, create a boilerplate test, create product variant model, register services properly
* chore: added variant to model
* chore: changed definition details + add migrator
* cleanup and update product entity
* Update product unique index to include soft deleted
* Migrations tests
* generated migration
* update dev orm config
* add path aliases
* WIP
* chore: added boilerplate integration test + database helper + product variant migraiton + model
* chore: remove old test utils
* update ts and jest config to include path aliases
* tweak config
* WIP migrations variant
* Migrations round
* integration tests migrations polishing
* chore: fixed issues with test db
* fix path aliases when published
* use ts-alias
* fix connection loader
* fixes
* wip: product list
* (WIP): Data access layer
* (WIP): DAL cleanup services
* wip: `ProductTag` DAL
* wip: `ProductTag` expose list in product service
* (WIP): Continue DAL and test list product filtering/populate
* WIP: unit tests
* chore: added tests for service - productvariant
* chore: WIP finding issues with orm manager fork
* WIP fix fields selection
* chore: make text fixes work
* (WIP) product integration
* (WIP) product integration
* chore: create a product in variant test
* list product with relations
* wip: `ProductTag` service + integrations
* chore: added with and without serialization example
* chore: remove only in spec
* wip: `ProductCollection` service + integrations
* uncomment product.variants
* Update type IProductService
* (WIP) type work
* (WIP) Product variants relation
* WIP: replacable data layer
* (WIP): Use bundle types
* WIP: update type
* WIP upadte tests
* WIP
* wip: options/option values entites
* (WIP): cleanup
* wip: add option value to variant, fix collection
* Integration tests for custom data access layer
* update tests
* chore: merge with latest branch
* chore: scope tests to relations and add category to models/index
* chore: ignore dist folders for jest
* chore: modularize spec data file
* improve DX
* module fixture naming
* chore: added category tests + fix model
* chore: use kebab case
* chore: allow scoping products by category id
* chore: replace `kebabCase` import
* feat: add `deleted_at` to options
* improve typings
* chore: wip
* fix query util
* revert webpack
* fix: update option models, create option DTOs, tests wip, fix `deduplicateIfNecessary` returning `undefined`
* fix: merge conflict
* WIP connection
* rm unsues deps
* fix migrations
* fix query util
* chore: adds mpath on creation
* WIP update types
* improve typings
* WIP typeings improvement
* WIP
* deps
* chore: package medusa/product ot medusa-commerce/product
* chore: added product categories service + descendants filter
* add missing index
* Add support for strict categories not in
* Add support for strict categories not in
* lint
* rename module
* rename module
* Create small-ducks-doubt.md
* yarn lock
* update initialise
* chore: fix/finalise DTOs
* fix: wrong types in `IProductService`
* fix type
* Load database config from env if present (#4175 )
* Load database config from env if present
* Load database config from env if present
* options optionnal
* update util
* add defaults
* improve filterable interfaces
* fix import
* fix types
* remove medusa-telemetry from modules-sdk
* WIP fixing webpack issues when bootstraping module
* cleanup
* improve loading driver options
* cleanup
* yarn lock
* fix import
* improve sdk types and naming
* align orther modules initialise method
* fix module tests with singleton module
* fix module tests with singleton module
* add up/down migration scripts
* update types
* scripts
* cleanup migrations and scripts
* hash module singleton
* cleanup migration
* cleanup
* fix stringifyCircular usage
* improvements
* fix deps
* fix deps
* improve load config utils
* improve load config utils
* fix deps
* add declaration to the build
* update yarn
* Do not resolve a module path if the exports are explicitly given
* fix module registration resolution path when exports are provided. Explicitly check for false and assign an empty string in this scenario for segregation purpose
* add comment
* fix migration options to prevent set replica errors
* chore: update types to a proper depedency
* chore: update type package
* add seed scripts
* Add descriptive error during database config loading
* use MedusaError
* chore: added lodash to package
* add more test to the database config loader util
* create bin scripts
* add bin
* update argv retrieval
* update package.json
* chore: add product category to injected deps
* chore: replace with product category service
* move dotenv usage to the functions
* do not load db if there is custom manager
* chore: fix some tests on products repo
* chore: fixed product spec
* chore: skip products module on modules register
* stringifyCircular update
* chore: fix incorrect module resolution
* fix: circular stringify and non required module loading
* yarn lock
* target es5
* chore: mikro-orm back to 5.7.4
* revert module registry
* skip external modules
* es2020
* update indexes, migration and integration tests
* rm only
* unit test script should only run unit tests
* Exclude product integration from the unit tests and make use of the global integration script to run all packages integration tests
* fix integration tests
* improve setup
* cleanup
* log error on setup fail
* Create enum like for package names
* chore: remove EOL
* chore: review part 2
* renamve gateway to productModuleService
* chore: added filters and collections to productmoduleservice
* chore: add collection to the singleton instance
* chore: remove skipped test + add todo
* fix indexes on fields and relations + update migration
* update yarn lock
* update idx
* add foreign key
* rename interface and add listCategories
* rename product module definition
---------
Co-authored-by: fPolic <frane@medusajs.com >
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com >
Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com >
2023-06-09 20:47:24 +02:00
Adrien de Peretti
af2dc4f75a
feat(medusa, inventory, stock-location): Remove unnecessary transaction usage in the modules and the list product end points ( #4232 )
2023-06-05 12:11:12 +02:00
Adrien de Peretti
d76ba0cd29
fix(medusa): Order edit missing transaction when consuming the inventory module ( #4211 )
...
* fix(medusa): Order edit missing transaction when consuming the inventory module
* Create hot-cougars-speak.md
* fix missing types
2023-06-05 11:01:28 +02:00
Frane Polić
db41995307
chore(utils): clean util package deps ( #4146 )
2023-05-26 13:20:12 +02:00
Philip Korsholm
0a35f21af7
feat(medusa, inventory): Search inventory items by title and description ( #4154 )
...
* initial filtering based on query
* add changeset
* add expect clause to ensure other items are not inluded
2023-05-24 11:52:25 +01:00
Philip Korsholm
3a38c84f88
feat(medusa,inventory,types): Expand list-reservation capabilities ( #3979 )
...
**What**
- Add filter capabilities to reservation items based on:
- description query: "contains", "startsWith", "endsWith", "equals"
- date querying
**How**
- Introducing a new filtering primitive: "StringSearchOperator" resembling the "dateComparisonOperator"
Fixes CORE-1373
2023-05-24 09:54:25 +00:00
Philip Korsholm
5c01b4e6b6
fix(inventory): Use correct table name in migration ( #4155 )
...
* whoops
* add changeset
2023-05-23 12:42:21 +02:00
Philip Korsholm
7fd22ecb4d
feat(client-types, types, medusa, inventory): Inventory item and reservation item datamodel updates ( #3971 )
...
* add fields
* add title in migration
* update api endpoints to reflect datamodel changes
* update migration exports for inventory module
* add changeset
* add created_by for reservation item
2023-05-04 17:25:48 +02:00
Philip Korsholm
4a85627435
feat(medusa, medusa-plugin-brightpearl): Inventory management for Brightpearl ( #3192 )
2023-04-23 12:50:19 +02:00
Adrien de Peretti
af710f1b48
fix(medusa): Bulk create variant + pass transaction to the inventory service context methods ( #3835 )
...
* fix(medusa): Bulk create variant and pass transaction where needed
* Create fair-penguins-stare.md
* fix unit tests
* event
* transaction orchestration
* revert options
* Prevent isolated module to use the given transaction if any in the exposed service
* Use enum
* remove changeset to re do it
* Create thick-ants-tickle.md
* update event bus local
* remove changeset to re do it
* Create thick-kings-wonder.md
* remove changeset to re do it
* Create slimy-bees-eat.md
* Update packages/utils/src/event-bus/index.ts
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com >
---------
Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com >
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com >
2023-04-19 09:27:48 +02:00
Oliver Windall Juhl
cd2d4f6455
fix(inventory): Add missing context arguments ( #3863 )
...
* add missing context
* Create ninety-peas-complain.md
2023-04-18 08:43:36 +02:00
Riqwan Thamir
abdb74d997
chore(medusa, utils): rename buildLegacyFieldsListFrom to objectToStringPath ( #3738 )
...
* chore(medusa): rename buildLegacyFieldsListFrom to objectToStringPath
* chore: address pr comments
2023-04-07 10:27:13 +02:00
Carlos R. L. Rodrigues
bd12a95083
chore: Initialize method for modules ( #3649 )
...
What:
- Export initialize methods for all modules to be used as a package.
- Export `runMigrations` and `revertMigration` on modules that DB migrations are available
```typescript
import {
initialize as initializeInventory,
InventoryServiceInitializeOptions,
runMigrations as runMigrationsInventory,
} from "@medusajs/inventory";
import { initialize as eventBusInitialize } from "@medusajs/event-bus-redis";
import { initialize as cacheInitialize } from "@medusajs/cache-redis";
const eventBus = await eventBusInitialize({
redisUrl: "localhost",
});
const cache = await cacheInitialize({
redisUrl: "localhost",
});
const options: InventoryServiceInitializeOptions = {
database: {
type: "postgres",
url: `postgres://postgres:@localhost/inventory`,
},
};
await runMigrationsInventory({
options,
});
const inventoryService = await initializeInventory(options, {
eventBusService: eventBus,
});
const sku = "sku_123"
const item = await service.createInventoryItem({
sku,
});
cache.set(sku, { item });
```
2023-03-31 12:09:04 +00:00
Philip Korsholm
5e405be02c
feat(medusa): Remove reservations for all line items when an order edit is accepted ( #3544 )
...
**What**
- Remove all allocations to line items once an order edit is confirmed
**Why**
- Since all line items of an order are discarded once an order edit is confirmed it will orphan the reservations causing inconsistencies with the stock
2023-03-30 09:56:10 +00:00
Carlos R. L. Rodrigues
55e94d0b45
fix(modules-sdk): check if dependency is registered ( #3620 )
...
* fix: check if dependency is registered
* changeset
2023-03-29 08:47:12 +02:00
Carlos R. L. Rodrigues
4e9d257d3b
Chore(medusa,utils,types,inventory,stock-location): remove core dependency modules ( #3531 )
2023-03-23 08:07:32 -03:00
Oliver Windall Juhl
ef5ef9f5a2
feat(medusa,event-bus-local,event-bus-redis): Event Bus modules ( #2599 )
2023-03-22 10:26:21 +01:00
Philip Korsholm
026bdab05d
Feat/fulfill swaps and claims with locations ( #3518 )
...
* re-add if statements
* initial implementation
* add changeset
* address feedback
* remove context param from create-fulfillment
* fix tests
2023-03-20 13:48:25 +01:00
Carlos R. L. Rodrigues
aa690beed7
feat(medusa): Modules initializer ( #3352 )
2023-03-17 12:18:52 -03:00
Philip Korsholm
02c77d7059
Fix/adjust reservations correctly ( #3474 )
...
**What**
- Adjust reservations correctly according to the following heuristic:
adjustment by addition: (i.e. positive quantity adjustment passed to the adjustment method)
- if a reservation for the line-item in the location exists add quantity to that
- if not create a new reservation
adjustment by subtraction:
- if a reservation with the exact quantity exists, delete it and return
- if a reservation with a greater quantity exists, subtract from it and return
- otherwise delete from reservations until a reservation with greater quantity than the remaining is found and adjust that with the remaining quantity OR there are no more reservations
Fixes CORE-1247
2023-03-16 09:47:54 +00:00
Philip Korsholm
38c8d49f46
Feat(medusa): handle reservation quantity update for line items ( #3484 )
...
**What**
- Raise exception if a reservation is updated or created to have larger quantity than is unfulfilled for a line-item
Fixes CORE-1249
2023-03-16 09:15:39 +00:00
Carlos R. L. Rodrigues
77d46220c2
Feat(modules-sdk,inventory,stock-location): modules isolated connection ( #3329 )
...
* feat: scoped container for modules
2023-03-15 12:09:45 -03:00
Philip Korsholm
10bf05c147
Fix(inventory, stock-location): Remove orphaned location levels and reservations ( #3460 )
...
**What**
- Remove related inventory levels and reservation items when a stock location is removed
**How**
- Add bulk deletion methods for both inventory levels and reservation items to the inventory service api
- invoke both on location removal
Fixes CORE-1232
2023-03-15 09:12:46 +00:00
Philip Korsholm
fe9eea4c18
feat(medusa, admin-ui, medusa-react, medusa-js): Allow toggling of manage inventory ( #3435 )
...
**What**
- Toggle manage inventory in the inventory management modal
**How**
- Create/update/remove inventory item based on if `manage_inventory` is set and if an inventory item already exists
- Move all stock location updates to when the modal is submitted
- Add create-inventory-item endpoint in the core
Fixes CORE-1196
Co-authored-by: Sebastian Rindom <7554214+srindom@users.noreply.github.com >
2023-03-14 16:14:31 +00:00
Philip Korsholm
30a3203640
Fix(medusa): Missing location id on fulfillments ( #3462 )
...
**What**
- include location id when creating a fulfillment
- Allow location updates to reservations without passing along quantity
**Why**
- location_id on fulfillment was null after creation
Fixes CORE-1242, CORE-1243
2023-03-14 11:08:52 +00:00
olivermrbl
24604f1b71
chore: Merge conflicts with master
2023-03-14 11:43:31 +01:00
Adrien de Peretti
f0a1355feb
feat(medusa): Bulk emit events ( #3407 )
2023-03-13 15:28:51 +01:00
Philip Korsholm
08c8aa46c5
fix(medusa): Only add ordering select if not already present ( #3319 )
2023-02-26 13:08:06 +01:00
Carlos R. L. Rodrigues
ad7f56506f
Feat(medusa,modules-sdk): Modules SDK package ( #3294 )
2023-02-23 13:09:35 -03:00
Adrien de Peretti
aefe5aa133
feat(medusa): Expose an activeManager_ getter in TransactionBaseService ( #3256 )
2023-02-16 10:26:23 +00:00
Riqwan Thamir
121b42acfe
chore(medusa): Typeorm upgrade to 0.3.11 ( #3041 )
2023-02-15 16:25:30 +01:00
Carlos R. L. Rodrigues
923ccece24
feat(medusa,stock-location,inventory): Integration tests ( #3149 )
2023-02-06 09:02:43 -03:00
Carlos R. L. Rodrigues
f65f590a27
feat: inventory items api ( #2971 )
...
What:
Admin endpoints to handle inventory items and their stock levels per location
FIXES: CORE-975
Co-authored-by: Sebastian Rindom <7554214+srindom@users.noreply.github.com >
2023-01-23 12:06:23 +00:00
Carlos R. L. Rodrigues
aa54d902e5
chore: added missing withTransacton, create-variant using TO ( #3047 )
...
Create variant integrated with Inventory modules
2023-01-18 09:29:06 -03:00
Oliver Windall Juhl
1547dd8143
fix(medusa): Add module config to transaction base service ( #3033 )
2023-01-15 19:37:11 +01:00
Carlos R. L. Rodrigues
9dbccd9ca7
feat(medusa, stock-location, inventory): Allow modules to integrate with core ( #2997 )
...
* feat: module shared resources
2023-01-13 10:39:43 -03:00
Carlos R. L. Rodrigues
93ee248493
feat(medusa, inventory): Inventory Management module ( #2956 )
...
* feat: inventory module
2023-01-10 14:38:30 -03:00