Commit Graph

64 Commits

Author SHA1 Message Date
Riqwan Thamir
b62af612c7 feat(link-modules,modules-sdk,pricing): Medusa App Migrations + Core compatible migrations (#5317)
* chore: remove skipping logic for migrations

* chore: medusa app returns migrations to run for modules

* chore: added migration for feature compatible

* chore: added changelog

* chore: create table only if it does not exist

* chore: update migration to pluck from registered modules

* chore: cleanup

* chore: make product an internal service temp

* chore: added options and deps to module

* chore: added link module options

* chore: remove duplicate

* chore: added missing column names in core + remove from model

* chore: scope migrations to only to create if not exist - money amount, currency

---------

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
2023-10-10 16:23:38 +02:00
github-actions[bot]
35d5fbe8cc chore: Version Packages (#5272)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-10-06 08:41:24 -07:00
Carlos R. L. Rodrigues
130cbc1f43 feat(*): Modules export entities and fields (#5242) 2023-10-03 14:20:43 -07:00
Adrien de Peretti
eeceec791c feat(utils,modules-sdk): Remote query object to string array (#5216)
**What**
- transform remote query object back to string array
- get all fields and fields from given relations from a GraphQL schema

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
2023-10-03 17:54:41 +00:00
github-actions[bot]
dab8a82cc1 chore: Version Packages (#5171)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-29 14:17:21 -04:00
Adrien de Peretti
dfa5d041c9 feat(medusa): Add product isolation FF to update cart (#5168)
**What**
Update cart must use the remote query when being in product isolation mode.

This pr is a first iteration that aims to quickly make compatible the end point in isolation. In a future iteration, this end point will be migrated to a workflow

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-09-22 08:49:59 +00:00
Adrien de Peretti
202049f8aa fix(medusa, workflows): Create product workflow with Isolated modules + module registration (#5081)
* fix(medusa, workflows): Isolated modules

* Create polite-kangaroos-rhyme.md

* finalise

* naming
2023-09-21 17:10:14 +02:00
github-actions[bot]
ed2c31d8e2 chore: Version Packages (#5157)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-21 08:57:25 +02:00
Carlos R. L. Rodrigues
47603f4797 fix(modules-sdk): medusa app load legacy modules (#5115)
* fix: default module path

* fix: allow legacy modules to be loaded by MedusaApp

* changeset

---------

Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
2023-09-20 10:20:46 +02:00
github-actions[bot]
c5433e2981 chore: Version Packages (#5083)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-18 18:55:48 +02:00
Carlos R. L. Rodrigues
1e5a6d4359 fix(modules-sdk): medusa app default module (#5114) 2023-09-18 12:45:13 +00:00
github-actions[bot]
223a4a4cd9 chore: Version Packages (#5002)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-15 17:09:34 +02:00
Adrien de Peretti
4fa675ec25 chore(medusa, modules-sdk, types): Refactor modules loading from medusa (#5018) 2023-09-13 14:26:54 +02:00
Riqwan Thamir
3d68be2b6b fix(orchestration,link-modules,pricing,types): fix shippingprofile errror outside of core + change link alias name (#5025)
* fix(orchestration,link-modules,pricing,types): fix shippingprofile error outside of core + change link alias name

* chore: scope relationships and move condition inside

* chore: remove islist

* chore: fix merge conflict

* chore: reverted serviceName scoping

* chore: change shape to make methodOverride compatible

* chore: added methodOverride to remote query

* chore: revert override
2023-09-13 12:16:00 +02:00
Adrien de Peretti
30863fee52 feat(medusa): List products with Remote Query (#4969)
**What**
- includes some type fixes in the DAL layer
- List products including their prices and filtered by the sales channel as well as q parameter and category scope and all other filters
- Assign shipping profile
- ordering
- Add missing columns in the product module
- update product module migrations

**Comment**
-  In regards to the fields, we can pass whatever we want the module will only return the one that exists (default behavior), but on the other hand, that is not possible for the relations.

**question**
- To simplify usage, should we expose the fields/relations available from the module to simplify building a query for the user and be aware of what the module provides

**todo**
- Add back the support for the user to ask for fields/relations
2023-09-12 15:55:05 +00:00
Adrien de Peretti
6273b4b160 feat(utils, module-sdk, medusa): Extract pg connection utils to utils package (#4961) 2023-09-11 12:10:40 +02:00
Carlos R. L. Rodrigues
d8649bacaa chore(modules-sdk,orchestration): to remote joiner query (#4974)
Helper function to transform js/json object into RemoteJoinerQuery format.

```typescript
toRemoteJoinerQuery({
  product: {
    fields: ["id", "title"],
    __args: {
      skip: 0,
    },
    variants: {
      fields: ["id", "title", "handle", "sku"],
      shipping_profile: {
        profile: {
          fields: ["id", "name"],
        },
      },
    },
    collections: {
      fields: ["id", "title"],
    },
  },
})
```

outputs:
```
{
  alias: "product",
  fields: ["id", "title"],
  expands: [
    {
      property: "product.variants",
      fields: ["id", "title", "handle", "sku"],
    },
    {
      property: "product.variants.shipping_profile",
    },
    {
      property: "product.variants.shipping_profile.profile",
      fields: ["id", "name"],
    },
    {
      property: "product.collections",
      fields: ["id", "title"],
    },
  ],
  args: [
    {
      name: "skip",
      value: 0,
    },
  ],
};
```
2023-09-10 13:26:50 +00:00
github-actions[bot]
98b91d1137 chore: Version Packages (#4891)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-08 14:09:39 +02:00
Riqwan Thamir
c3dba06948 fix(modules-sdk, orchestration): add missing dependencies + fix default handling in medusa-app & remote query (#4930) 2023-09-07 07:53:46 +00:00
Carlos R. L. Rodrigues
a4906d0ac0 chore(medusa,orchestration,link-modules,modules-sdk): internal services as modules (#4925) 2023-09-04 11:36:05 -03: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
Riqwan Thamir
460161a69f feat(pricing, types, utils, medusa-sdk): Pricing Module Setup + Currency (#4860)
What:

- Setups the skeleton for pricing module
- Creates service/model/repository for currency model
- Setups types
- Setups DB
- Moved some utils to a common place

RESOLVES CORE-1477
RESOLVES CORE-1476
2023-08-29 21:58:34 +00:00
github-actions[bot]
db36258885 chore: Version Packages (#4711)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-17 17:17:41 +02:00
Oli Juhl
1d2637572b chore: Remove rimraf from prepare (#4741) 2023-08-11 22:55:59 +02:00
Adrien de Peretti
3f3a84262c feat(types, product, utils, medusa): Include shared connection for modules (#4626) 2023-08-08 15:10:34 +00:00
github-actions[bot]
0deecf353f chore: Version Packages (#4643)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-07 13:43:54 +02:00
Riqwan Thamir
8af55aed87 feat(product, types, modules-sdk): added event bus events for products (#4654)
what:

- adds an eventbus dependency to product module.
- emits events on product, category and collection CUD

RESOLVES CORE-1450
2023-08-04 09:26:02 +00:00
Adrien de Peretti
4b80ba8a35 fix(product, integration-tests): Fix integration tests (#4674)
* fix(product, integration-tests): Fix integration tests

* improve test

* Create dirty-eagles-shop.md
2023-08-02 13:44:53 +02:00
Adrien de Peretti
58d4c230e2 chore: include rimraf as part of the build for most of the packages (#4615)
* chore: include rimraf as part of the build for most of the packages

* cleanup

* revert medusa interface

* missing script update
2023-07-31 09:23:27 +02:00
github-actions[bot]
5a569c4a20 chore: Version Packages (#4591)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-27 13:19:14 +02:00
Adrien de Peretti
379c83933e fix(module-sdk): Shared modules loading (#4611)
* WIP

* tests wording

* Create nasty-files-type.md

* cleanup
2023-07-27 12:53:31 +02:00
Carlos R. L. Rodrigues
f12299deb1 Feat: @medusajs/workflows (#4553)
feat: medusa workflows
2023-07-25 10:13:14 -03:00
Carlos R. L. Rodrigues
f174bb6fa1 fix(modules-sdk): remote query get loaded modules (#4596) 2023-07-24 16:20:30 +00:00
Carlos R. L. Rodrigues
5a8a889c6d feat(modules-sdk): Remote Query (#4463)
* feat: Remote Query
2023-07-19 15:35:36 -03:00
github-actions[bot]
5d7877ded6 chore: Version Packages (#4223)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-18 13:14:20 +02:00
Oliver Windall Juhl
9b42387fd3 chore: Add missing deps (#4317) 2023-06-15 18:27:31 +02:00
Oliver Windall Juhl
afd1b67f1c chore: Clean up deps, devDeps, and peerDeps across all packages (#4276)
* chore: Use caret for all Medusa deps

* Create wild-balloons-push.md

* Address PR feedback

* force build order

* add missing dep

* add missing dev deps

* addresses last comments
2023-06-14 15:18:11 +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
github-actions[bot]
8f8f6332b7 chore: Version Packages (#4114)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-30 12:11:45 +02:00
Carlos R. L. Rodrigues
e73c3e51c9 feat(modules-sdk): Module as singleton instances (#4065) 2023-05-18 10:12:18 +02:00
github-actions[bot]
0be70113f9 chore: Version Packages (#4074)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-16 11:03:47 +02:00
github-actions[bot]
a8f43055db chore: Version Packages (#4020)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-09 15:49:04 +02:00
github-actions[bot]
6b2bcc1a36 chore: Version Packages (#3942)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-04 10:51:13 +02:00
github-actions[bot]
b41b6303cc chore: Release (#3856)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-04-26 19:09:01 +02:00
github-actions[bot]
0f51e3a400 chore: Release (#3818)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-04-14 11:18:39 +02:00
github-actions[bot]
3efe13eefd chore: Release (#3782)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-04-12 11:32:05 +02:00
olivermrbl
4c268238a4 Merge branch 'master' into develop 2023-04-05 09:18:48 +02:00
olivermrbl
66c59d54ff chore(release): v1.8.0 2023-04-04 18:35:27 +02:00
Patrick
089f1eb19e feat(tests): harmonize and clean-up yarn test commands convention (#3695)
## What

Harmonize and clean-up yarn test commands convention.

## Why

Current strategy to filter integration tests from unit tests was cumbersome to maintain. Also, some packages declared `test:unit` which ended up being an alias to `test`.

## How

* Remove all occurrences of `test:unit`
* Rename all `test` commands under `/integration-tests/**/package.json` to `test:integration`
* In the root `package.json`, rewrite `test:integration` command to run `turbo run test:integration`
* In the root `package.json`, remove filtering on the `test` command
* Introduce a new `test:integration` task in the Turborepo config.
2023-04-04 13:47:54 +00:00
olivermrbl
bb9df09e37 chore(release): v1.8.0-rc.6 2023-04-03 18:05:12 +02:00