Commit Graph

142 Commits

Author SHA1 Message Date
Kasper Fabricius Kristensen
cd54c7dca9 fix(medusa-cli): add semver dependency (#3603)
* add direct dependency on semver to CLI

* add changeset
2023-03-29 08:48:39 +02:00
olivermrbl
8ddb3952c0 chore(release): v1.8.0-rc.2 2023-03-28 21:04:57 +02:00
olivermrbl
990c79d2d5 chore(release): v1.8.0-rc.1 2023-03-28 19:32:36 +02:00
Adrien de Peretti
b9c6c3d059 fix(medusa-payment-paypal): Missing typescript dev dependency (#3609) 2023-03-28 19:20:39 +02:00
Adrien de Peretti
5307408894 feat(medusa-payment-paypal): Migrate to the new payment processor API (#3414)
* feat(medusa-payment-paypal): Migrate to the new payment processor API

* WIP

* WIP

* WIP unit tests

* WIP

* unit tests

* fix package.json

* yarn

* cleanup

* address feedback 1/2

* Start to implement a new Paypal SDK

* cleanup

* finalise sdk

* cleanup

* fix push missing file

* rename sdk methods

* unit test the http client

* WIP

* fix http client

* Create .changeset/empty-melons-eat.md

* refactor tests

* fix quote

* fix options

* cleanup

* do not retry auth

* WIP

* retry mechanism max attempts

* use both old and new options

* fix capture

* remove totals fields

* add missing method

* cleanup

* fix current tests

* authorize should update the data with the fresh order

* remove comments

* fix tests

* Update packages/medusa-payment-paypal/src/core/paypal-http-client.ts

Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>

* fix unit tests

* update changeset

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Riqwan Thamir <rmthamir@gmail.com>
2023-03-28 13:49:09 +02:00
Adrien de Peretti
4a7bdc917a fix(event-bus-local): Error handling (#3575)
**What**

The error handling was applied on the emit, which always succeed. On the other hand, the `on` which calls the handler, was not handling any errors and therefore crashed the server
2023-03-24 13:49:29 +00:00
Kasper Fabricius Kristensen
d7ac88a3a5 fix(admin-ui): Explicitly add add moment dependency (#3560) 2023-03-23 15:58:47 +01: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
74bc4b16a0 feat(medusa-plugin-algolia): Revamp Algolia search plugin (#3510) 2023-03-22 12:55:26 +01: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
Rares Stefan
a8423b8acc fix(medusa, admin-ui): Fix edit order variant stock (#3512)
The stock column when adding variants in an order edit would just look at `inventory_quantity`, location-unaware. Updated this to now attempt to request location-aware stock information and updated the column to use this information and show total stock across how many locations, and a tooltip showing per-location stock.

![image](https://user-images.githubusercontent.com/948623/225901225-177a2ce4-7344-49d0-84d5-3f3b0ce9f62e.png)

Resolves CORE-1250

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
2023-03-20 13:16:49 +00:00
Carlos R. L. Rodrigues
aa690beed7 feat(medusa): Modules initializer (#3352) 2023-03-17 12:18:52 -03:00
Kasper Fabricius Kristensen
8a7421db5b feat(admin): Improve DX for deploying admin externally (#3418)
* init deploy command

* add include flag

* add 'shortcut' flag

* add dev command, fix var replacement, change default behaviour

* cleanup params of build command

* fix defaults when using the plugin to serve admin

* add changeset

* fix globals

* update README

* throw error on no build found

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-03-17 13:18:51 +01:00
Kasper Fabricius Kristensen
9ad15d3a88 feat(admin-ui): Implements redesign of public pages (#3504)
* redesign public pages

* rm build files

* fix size of button
2023-03-17 10:17:47 +01:00
Oliver Windall Juhl
7e17e0ddc2 feat(medusa-plugin-meilisearch): Update + improve Meilisearch plugin (#3377)
* feat(medusa-plugin-meilisearch): Upgrade meilisearch deps + migrate plugin to TS

* fix version

* Remove transaction base service from search service

* Create .changeset/strange-mails-pump.md

* Backward compatibility

* Address PR feedback

* Fix folder structure

* Update readme

* Move types

* fix deps

* Change version in changeset

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
2023-03-16 16:15:29 +01: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
olivermrbl
24604f1b71 chore: Merge conflicts with master 2023-03-14 11:43:31 +01:00
olivermrbl
77fd361ce8 chore(release): v1.7.13 2023-03-13 19:09:08 +01:00
Patrick
55febef7f1 feat(types): package scaffolding for generated types (#3452)
## What

Generated client types package based on the API's OpenApi Spec.

## Why

This package aims at replacing the need to import types directly from the core `@medusajs/medusa` package which can lead to side effects like importing backend dependencies into the client's realm.

## How

* The package contains a script that is invoked during the build step. 
* The script will use the `medusa-oas oas --type=combined` cli to generate a combined oas file. 
* Then, `medusa-oas client --component=types` uses the oas file to generate the types based on the OAS schema definitions. The result is outputted into `/src/lib`
* `prettier` is run on the `/src/lib` directory to ensure that the generated code follows the monorepo coding style.
* Finally, with `"emitDeclarationOnly": true`,  `tsc` compiles the src directory to only output types.

Until we update our CI pipeline, we will not commit the content `/src/lib`.

## Test

* Run `yarn install`
* Run `yarn build`
* Expect `packages/generated/client-types/dist/` to contain types generated from the OAS defined by `@medusajs/medusa`
2023-03-13 12:23:26 +00:00
olivermrbl
6d928628a9 chore: Fix merge conflicts with master 2023-03-12 12:53:07 +01:00
Frane Polić
f97b3d7cce feat(medusa): Cache modules (#3187) 2023-03-10 15:09:26 +01:00
Carlos R. L. Rodrigues
54dcc1871c feat(medusa,medusa-core-utils): graceful shutdown server (#3408)
* feat: graceful shutdown
2023-03-10 09:11:45 -03:00
Patrick
966aea65c2 feat(oas-cli): combine admin + store + custom OAS (#3411) 2023-03-10 10:37:59 +01:00
olivermrbl
e5f0a60090 chore: Update yarn.lock 2023-03-09 10:37:27 +01:00
Kasper Fabricius Kristensen
cf51ad0d46 fix(admin-ui): move dependencies from devDependencies (#3405) 2023-03-07 14:43:08 +01:00
Riqwan Thamir
b5662d0c6a feat(admin-ui): adds category ui for tree/list, edit, create, delete (#3399)
* chore: adds category ui for tree/list, edit, create, delete

* fix: address feedback

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: fPolic <frane@medusajs.com>
2023-03-07 13:29:22 +01:00
Patrick
240d0ea7b8 fix(ci,oas) move oas ci script to a package under the oas workspace (#3391)
* feat(ci,oas) run oas ci on all PRs

* fix(ci,oas) move oas ci script to a package under the oas workspace

* chore(changeset): patch
2023-03-07 10:33:12 +01:00
Philip Korsholm
5d809a7a39 fix(medusa-payment-stripe): Add typescript to dev deps (#3371)
* add typescript dev devepency

* add changeset

* update yarn.lock
2023-03-04 15:37:32 +01:00
olivermrbl
ad99a8bd24 chore: Fix merge conflicts with master 2023-03-03 12:01:35 +01:00
Kasper Fabricius Kristensen
40de54b010 feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334) 2023-03-03 10:09:16 +01:00
olivermrbl
3718f88c69 chore(release): v1.7.11 2023-03-02 12:02:35 +01:00
olivermrbl
f5ed47053c fix: Merge conflicts with master 2023-03-01 18:58:59 +01:00
olivermrbl
6e3b339b22 chore(release): v1.7.10 2023-03-01 18:55:21 +01:00
Adrien de Peretti
589d1c09b0 feat(medusa-payment-stripe): Stripe PaymentProcessor implementation (#3257) 2023-02-28 18:44:24 +01:00
olivermrbl
7738525401 fix: Merge conflicts with master 2023-02-28 11:24:46 +01:00
olivermrbl
83d70f7965 chore(release): v1.7.9 2023-02-28 08:57:57 +01:00
Carlos R. L. Rodrigues
ad7f56506f Feat(medusa,modules-sdk): Modules SDK package (#3294) 2023-02-23 13:09:35 -03:00
olivermrbl
e1b92e9b04 fix: Merge conflicts with master 2023-02-22 17:38:49 +01:00
olivermrbl
fefc248a41 chore(release): v1.7.8 2023-02-22 13:13:48 +01:00
Patrick
e8e7d7bb53 fix(medusa-dev): include packages/ subdirectories in discovery (#3293)
## What

Include packages/ subdirectories in medusa-dev packages discovery.

## Why

We started to use subdirectories in the monorepo `packages/` directory in order to better organize packages.

Packages in subdirectories were invisible to `medusa-dev` and could not be copied.

## How

Rely on monorepo package.json workspace glob patterns to discover packages that can be published to the local npm registry.
2023-02-21 16:12:02 +00:00
Patrick
1c40346e9e feat(codegen): openapi-typescript-codegen fork (#3272)
## What

Allow `medusa-oas` CLI to generate API client code from an OAS json file.

## Why

Manually maintaining API clients is time consuming and error prone. We wish to automate the process by using code generation strategies.

We also wish to eliminate direct import from `@medusajs/medusa` in clients which can lead to unwanted side effects like importing unnecessary dependencies.

## How

Fork and customize an OAS code generator library that is TypeScript friendly.

Attempt to match the interface and signature of our current client packages: `@medusajs/medusa-js`, `medusa-react`

Add a new `client` command to the `medusa-oas` CLI as the main interface to interact with the code generation tooling.

## Test

### Prerequisites 
* From the root of the monorepo:
* `yarn install`
* `yarn build`

### Case - all in one build
* From the root of the monorepo:
* Run `yarn medusa-oas oas --out-dir ~/tmp/oas --type store`
* Run `yarn medusa-oas client --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/client-store --type store`
* Expect `~/tmp/client-store` to contain the following files and directories:
```
core/
hooks/
models/
services/
index.ts
MedusaStore.ts
useMedusaStore.tsx
```

### Case - types only
* From the root of the monorepo:
* Run `yarn medusa-oas oas --out-dir ~/tmp/oas --type store`
* Run `yarn medusa-oas client --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/client-types --type store --component types`
* Expect `~/tmp/client-types` to contain the following files and directories:
```
models/
index.ts
```

### Case - client only
* From the root of the monorepo:
* Run `yarn medusa-oas oas --out-dir ~/tmp/oas --type store`
* Run `yarn medusa-oas client --src-file ~/tmp/oas/store.oas.json --out-dir ~/tmp/client-only --type store --component client --types-package @medusajs/client-types`
* Expect `~/tmp/client-only` to contain the following files and directories:
```
core/
services/
index.ts
MedusaStore.ts
```
2023-02-20 20:50:39 +00:00
Riqwan Thamir
121b42acfe chore(medusa): Typeorm upgrade to 0.3.11 (#3041) 2023-02-15 16:25:30 +01:00
Patrick
8137061908 feat(oas): medusa-oas-cli as OAS build tool (#3213)
## What

Introduce a CLI for extracting OAS from the core `medusa` package.

## Why

We need to decouple OAS tooling from documentation tooling in order to allow packages and external systems to leverage our OAS has a dependency.

## How

Introduce a new OAS workspace within packages in order to organize current and future OAS related package. Only 1 OAS package for now.

Introduce a new CLI only package to act as the main gateway for all upcoming OAS tooling. Only 1 command for now.

Update documentation tooling pertaining to OAS to use the CLI instead.

## Test

### Prerequisite
From the monorepo root:
* `yarn install`
* `yarn build`

### Documentation

#### Case - validation only - success
* Run `yarn openapi:generate --dry-run`
* Expect console output `🟢 Valid OAS` but no mention of `🔵 Exported OAS`

#### Case - validation only - invalid
* Introduce a bug by renaming `@schema Cart` to `@schema Kart` in [models/cart.ts](0adb0d9ff9/packages/medusa/src/models/cart.ts (L2))
* Run `yarn build` to update `@medusajs/medusa` package with the bug.
* Run `yarn openapi:generate --dry-run`
* Expect console output `🔴 Invalid OAS` with a stack trace of the issue.

#### Case - docs generation
* Run `yarn openapi:generate`
* Expect `docs/api/` directory to contain:
  * `admin.oas.json` (raw OAS)
  * `store.oas.json` (raw OAS)
  * `admin.oas.yaml` (sanitized OAS)
  * `store.oas.yaml` (sanitized OAS)
  * `admin/` (updated redocly split output)
  * `store/` (updated redocly split output)

### CLI

#### Case - crawl additional paths
* From a local medusa server (`medusa-starter-default`), add an `index.ts` file in `src/models/`
* In the `index.ts`, add dummy OAS JSDoc like `/** @schema Foobar */`
* From the root of the monorepo, run `yarn medusa-oas --type store --paths path-to-medusa-server/src`
* Expect a `store.oas.json` to be created at the root of the monorepo.
* The `store.oas.json` should contain an additional `Foobar` entry in `components.schemas`.
2023-02-15 14:55:58 +00:00
olivermrbl
1bfbe27b9b chore(release): Publish 2023-02-14 17:30:40 +01:00
olivermrbl
3b474ec35c chore(release): Publish 2023-02-08 19:35:44 +01:00
Patrick
53532df8d5 feat(OAS): sanitize circular reference for Redocly (#3198)
### What

Add OAS build step to patch known circular references that prevent Redocly from rendering the API documentation.

### Why

We've encountered crashing and loading issues with Redocly when the OAS contained circular references. We have been working around the limitation by omitting some known problematic $ref in our source OAS. We wish to move away from this strategy in order to always explicitly include $ref in our OAS.

### How

We are introducing a custom Redocly CLI plugin that will replace `$ref` by `type: object` base on a configurable set of instructions. These instructions can be modified in `docs-util/redocly/config.yaml`

We are adding a `redocly bundle` step in the current OAS build process in order to sanitize problematic circular references.

We updated the redocly-cli package version in order to ensure that plugins are supported.

### Test

We will use [Cart.payment](fd5c185159/packages/medusa/src/models/cart.ts (L72-L74)) to ensure that the new process is properly sanitizing.

* Run `yarn openapi:generate`
* Open `docs/api/store/components/schemas/Cart.yaml`
  * Expect the `payment` property to have been sanitized to `type: object`
* Run `yarn redocly preview-docs docs/api/store/openapi.yaml --config=docs-util/redocly/config.yaml`
* Visit http://127.0.0.1:8080/#tag/Cart/operation/GetCartsCart
  * In the response, expect cart.payment to not list the properties of the Payment schema.
2023-02-08 13:01:03 +00:00
Oliver Windall Juhl
08324355a4 chore: Patch bump all dependencies + minor bumps winston (#3185) 2023-02-07 19:15:29 +01:00
Kasper Fabricius Kristensen
4fbf6b7ad3 fix(medusa-react): Fix production.min.js causing invalid hook usage error in CJS environments (#3144) 2023-02-01 14:07:02 +01:00
olivermrbl
a48c533bec chore(release): Publish 2023-01-19 18:29:07 +01:00
olivermrbl
6481b0c357 chore(release): Publish 2023-01-18 18:48:57 +01:00