fix merge conflicts from develop

This commit is contained in:
olivermrbl committed 2021-05-25 15:44:26 +02:00
commit e3343f74a7
251 files changed
+25580 -4521

No files matched your search

+1 -2
View File
@@ -7,8 +7,7 @@ executors:
parameters: parameters:
image: image:
type: string type: string
# First 10.x LTS release, but old Yarn default: "12.13"
default: "10.14"
docker: docker:
- image: circleci/node:<< parameters.image >> - image: circleci/node:<< parameters.image >>
+1 -1
View File
@@ -18,7 +18,7 @@ You can get a Medusa engine up and running in your local development environment
yarn add @medusajs/medusa yarn add @medusajs/medusa
# CLI # CLI
npm install -g @medusa/medusa-cli npm install -g @medusajs/medusa-cli
yarn add global @medusajs/medusa-cli yarn add global @medusajs/medusa-cli
# babel preset # babel preset
@@ -0,0 +1,62 @@
const { dropDatabase } = require("pg-god");
const path = require("path");
const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api");
const { initDb } = require("../../../helpers/use-db");
const adminSeeder = require("../../helpers/admin-seeder");
const fixtureWriter = require("../../utils/write-fixture").default;
jest.setTimeout(30000);
describe("/admin/auth", () => {
let medusaProcess;
let dbConnection;
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."));
dbConnection = await initDb({ cwd });
medusaProcess = await setupServer({ cwd });
});
afterAll(async () => {
await dbConnection.close();
await dropDatabase({ databaseName: "medusa-fixtures" });
medusaProcess.kill();
});
describe("POST /admin/products", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection);
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "user"`);
});
it("authenticates user", async () => {
const api = useApi();
const response = await api
.post("/admin/auth", {
email: "admin@medusa.js",
password: "secret_password",
})
.catch((err) => {
console.log(err);
});
expect(response.status).toEqual(200);
fixtureWriter.addFixture("user", response.data.user);
});
});
});
@@ -1,5 +1,6 @@
const { dropDatabase } = require("pg-god"); const { dropDatabase } = require("pg-god");
const path = require("path"); const path = require("path");
const { ProductVariant } = require("@medusajs/medusa");
const setupServer = require("../../../helpers/setup-server"); const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api"); const { useApi } = require("../../../helpers/use-api");
@@ -161,4 +162,93 @@ describe("/admin/orders", () => {
fixtureWriter.addFixture("return", response.data.order.returns[0]); fixtureWriter.addFixture("return", response.data.order.returns[0]);
}); });
}); });
describe("POST /admin/orders/:id/swaps", () => {
let id;
let varId;
beforeEach(async () => {
try {
await adminSeeder(dbConnection);
const order = await orderSeeder(dbConnection, {
fulfillment_status: "fulfilled",
payment_status: "captured",
});
id = order.id;
const pVar = await dbConnection.manager.findOne(ProductVariant, {});
varId = pVar.id;
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "fulfillment_item"`);
await manager.query(`DELETE FROM "fulfillment"`);
await manager.query(`DELETE FROM "return_item"`);
await manager.query(`DELETE FROM "return"`);
await manager.query(`DELETE FROM "claim_image"`);
await manager.query(`DELETE FROM "claim_tag"`);
await manager.query(`DELETE FROM "claim_item"`);
await manager.query(`DELETE FROM "shipping_method"`);
await manager.query(`DELETE FROM "line_item"`);
await manager.query(`DELETE FROM "swap"`);
await manager.query(`DELETE FROM "cart"`);
await manager.query(`DELETE FROM "claim_order"`);
await manager.query(`DELETE FROM "money_amount"`);
await manager.query(`DELETE FROM "product_option_value"`);
await manager.query(`DELETE FROM "product_option"`);
await manager.query(`DELETE FROM "product_variant"`);
await manager.query(`DELETE FROM "product"`);
await manager.query(`DELETE FROM "shipping_option"`);
await manager.query(`DELETE FROM "discount"`);
await manager.query(`DELETE FROM "payment"`);
await manager.query(`DELETE FROM "order"`);
await manager.query(`DELETE FROM "customer"`);
await manager.query(
`UPDATE "country" SET region_id=NULL WHERE iso_2 = 'us'`
);
await manager.query(`DELETE FROM "region"`);
await manager.query(`DELETE FROM "user"`);
});
it("creates a swap", async () => {
const api = useApi();
const { data } = await api.get(`/admin/orders/${id}`, {
headers: {
authorization: "Bearer test_token",
},
});
const order = data.order;
const response = await api.post(
`/admin/orders/${id}/swaps`,
{
return_items: [
{
item_id: order.items[0].id,
quantity: 1,
},
],
additional_items: [
{
variant_id: varId,
quantity: 2,
},
],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(response.status).toEqual(200);
fixtureWriter.addFixture("swap", response.data.order.swaps[0]);
});
});
}); });
@@ -78,10 +78,6 @@ describe("/shipping-options", () => {
fixtureWriter.addFixture("region", getRes.data.shipping_option.region); fixtureWriter.addFixture("region", getRes.data.shipping_option.region);
fixtureWriter.addFixture("shipping_option", getRes.data.shipping_option); fixtureWriter.addFixture("shipping_option", getRes.data.shipping_option);
fixtureWriter.addFixture(
"shipping_profile",
getRes.data.shipping_option.shipping_profile
);
}); });
}); });
}); });
@@ -0,0 +1,74 @@
const { dropDatabase } = require("pg-god");
const path = require("path");
const { Region } = require("@medusajs/medusa");
const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api");
const { initDb } = require("../../../helpers/use-db");
const adminSeeder = require("../../helpers/admin-seeder");
const fixtureWriter = require("../../utils/write-fixture").default;
jest.setTimeout(30000);
describe("/shipping-profiles", () => {
let medusaProcess;
let dbConnection;
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."));
dbConnection = await initDb({ cwd });
medusaProcess = await setupServer({ cwd });
});
afterAll(async () => {
dbConnection.close();
await dropDatabase({ databaseName: "medusa-fixtures" });
medusaProcess.kill();
});
describe("POST /admin/shipping-profiles", () => {
let regId;
beforeEach(async () => {
await adminSeeder(dbConnection);
const manager = dbConnection.manager;
const created = manager.create(Region, {
name: "Test Region",
currency_code: "usd",
tax_rate: 0,
fulfillment_providers: [
{
id: "test-ful",
},
],
});
const newReg = await manager.save(created);
regId = newReg.id;
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "shipping_option"`);
await manager.query(`DELETE FROM "region"`);
await manager.query(`DELETE FROM "user"`);
});
it("creates a cart", async () => {
const api = useApi();
const getRes = await api.get(`/admin/shipping-profiles`, {
headers: {
Authorization: "Bearer test_token",
},
});
expect(getRes.status).toEqual(200);
fixtureWriter.addFixture(
"shipping_profile",
getRes.data.shipping_profiles[0]
);
});
});
});
@@ -0,0 +1,56 @@
const { dropDatabase } = require("pg-god");
const path = require("path");
const { Region } = require("@medusajs/medusa");
const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api");
const { initDb } = require("../../../helpers/use-db");
const adminSeeder = require("../../helpers/admin-seeder");
const fixtureWriter = require("../../utils/write-fixture").default;
jest.setTimeout(30000);
describe("/shipping-profiles", () => {
let medusaProcess;
let dbConnection;
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."));
dbConnection = await initDb({ cwd });
medusaProcess = await setupServer({ cwd });
});
afterAll(async () => {
dbConnection.close();
await dropDatabase({ databaseName: "medusa-fixtures" });
medusaProcess.kill();
});
describe("GET /admin/store", () => {
let regId;
beforeEach(async () => {
await adminSeeder(dbConnection);
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "user"`);
});
it("creates a cart", async () => {
const api = useApi();
const getRes = await api.get(`/admin/store`, {
headers: {
Authorization: "Bearer test_token",
},
});
expect(getRes.status).toEqual(200);
fixtureWriter.addFixture("store", getRes.data.store);
});
});
});
@@ -43,7 +43,7 @@ module.exports = async (connection, data = {}) => {
}, },
], ],
}); });
const newProdVar = manager.save(prodVar); const newProdVar = await manager.save(prodVar);
const ma = manager.create(MoneyAmount, { const ma = manager.create(MoneyAmount, {
variant_id: newProdVar.id, variant_id: newProdVar.id,
+4 -4
View File
@@ -7,13 +7,13 @@
"build": "babel src -d dist --extensions \".ts,.js\"" "build": "babel src -d dist --extensions \".ts,.js\""
}, },
"dependencies": { "dependencies": {
"@medusajs/medusa": "^1.1.3", "@medusajs/medusa": "1.1.11-dev-1615929449260",
"medusa-interfaces": "^1.1.0" "medusa-interfaces": "1.1.1-dev-1615929449260"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.12.10", "@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10", "@babel/core": "^7.12.10",
"@babel/node": "^7.12.10", "@babel/node": "^7.12.10",
"babel-preset-medusa-package": "^1.1.0" "babel-preset-medusa-package": "1.1.0-dev-1615929449260"
} }
} }
+34 -377
View File
@@ -946,13 +946,14 @@
dependencies: dependencies:
"@hapi/hoek" "^9.0.0" "@hapi/hoek" "^9.0.0"
"@medusajs/medusa@^1.1.3": "@medusajs/medusa@1.1.11-dev-1615929449260":
version "1.1.3" version "1.1.11-dev-1615929449260"
resolved "https://registry.yarnpkg.com/@medusajs/medusa/-/medusa-1.1.3.tgz#253cf73a45d066eb25cfa58efa81674a45759ef1" resolved "http://localhost:4873/@medusajs%2fmedusa/-/medusa-1.1.11-dev-1615929449260.tgz#4635d197df491fa10ad80c6fda5818edb6cbe9ad"
integrity sha512-QSEe0fQuEndyJ7WUPKfaPYO5pCR5xNLT/6NAObgi2nuo4WroA2nqqU01bOuWf/Sa4PnH0YMtJ0H86qzLa0MARA== integrity sha512-Yx94TuEWe76MLslv1PmDOIDrEJ5lQz8cL2rikK7OquK4oyt0Y8xCE5MNgiiZCP71/sv3TMCoTx0GZxrl02vk8w==
dependencies: dependencies:
"@babel/plugin-transform-classes" "^7.9.5" "@babel/plugin-transform-classes" "^7.9.5"
"@hapi/joi" "^16.1.8" "@hapi/joi" "^16.1.8"
"@types/lodash" "^4.14.168"
awilix "^4.2.3" awilix "^4.2.3"
body-parser "^1.19.0" body-parser "^1.19.0"
bull "^3.12.1" bull "^3.12.1"
@@ -970,8 +971,8 @@
joi "^17.3.0" joi "^17.3.0"
joi-objectid "^3.0.1" joi-objectid "^3.0.1"
jsonwebtoken "^8.5.1" jsonwebtoken "^8.5.1"
medusa-core-utils "^1.1.0" medusa-core-utils "1.1.0-dev-1615929449260"
medusa-test-utils "^1.1.1" medusa-test-utils "1.1.3-dev-1615929449260"
morgan "^1.9.1" morgan "^1.9.1"
multer "^1.4.2" multer "^1.4.2"
passport "^0.4.0" passport "^0.4.0"
@@ -985,7 +986,6 @@
request-ip "^2.1.3" request-ip "^2.1.3"
resolve-cwd "^3.0.0" resolve-cwd "^3.0.0"
scrypt-kdf "^2.0.1" scrypt-kdf "^2.0.1"
typeorm "^0.2.29"
ulid "^2.3.0" ulid "^2.3.0"
uuid "^8.3.1" uuid "^8.3.1"
winston "^3.2.1" winston "^3.2.1"
@@ -1045,11 +1045,6 @@
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==
"@sqltools/formatter@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@sqltools/formatter/-/formatter-1.2.2.tgz#9390a8127c0dcba61ebd7fdcc748655e191bdd68"
integrity sha512-/5O7Fq6Vnv8L6ucmPjaWbVG1XkP4FO+w5glqfkIsq3Xw4oyNAdJddbnYodNDAfjVUvo/rrSCTom4kAND7T1o5Q==
"@types/fs-extra@^8.0.1": "@types/fs-extra@^8.0.1":
version "8.1.1" version "8.1.1"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.1.tgz#1e49f22d09aa46e19b51c0b013cb63d0d923a068" resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.1.tgz#1e49f22d09aa46e19b51c0b013cb63d0d923a068"
@@ -1065,6 +1060,11 @@
"@types/minimatch" "*" "@types/minimatch" "*"
"@types/node" "*" "@types/node" "*"
"@types/lodash@^4.14.168":
version "4.14.168"
resolved "http://localhost:4873/@types%2flodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==
"@types/minimatch@*": "@types/minimatch@*":
version "3.0.3" version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
@@ -1083,21 +1083,6 @@ accepts@~1.3.7:
mime-types "~2.1.24" mime-types "~2.1.24"
negotiator "0.6.2" negotiator "0.6.2"
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8=
ansi-regex@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==
ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=
ansi-styles@^3.2.1: ansi-styles@^3.2.1:
version "3.2.1" version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
@@ -1105,18 +1090,6 @@ ansi-styles@^3.2.1:
dependencies: dependencies:
color-convert "^1.9.0" color-convert "^1.9.0"
ansi-styles@^4.0.0, ansi-styles@^4.1.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
dependencies:
color-convert "^2.0.1"
any-promise@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
integrity sha1-q8av7tzqUugJzcA3au0845Y10X8=
anymatch@^2.0.0: anymatch@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb"
@@ -1133,23 +1106,11 @@ anymatch@~3.1.1:
normalize-path "^3.0.0" normalize-path "^3.0.0"
picomatch "^2.0.4" picomatch "^2.0.4"
app-root-path@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.0.0.tgz#210b6f43873227e18a4b810a032283311555d5ad"
integrity sha512-qMcx+Gy2UZynHjOHOIXPNvpf+9cjvk3cWrBBK7zg4gH9+clobJRb9NGzcT7mQTcV/6Gm/1WelUtqxVXnNlrwcw==
append-field@^1.0.0: append-field@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/append-field/-/append-field-1.0.0.tgz#1e3440e915f0b1203d23748e78edd7b9b5b43e56" resolved "https://registry.yarnpkg.com/append-field/-/append-field-1.0.0.tgz#1e3440e915f0b1203d23748e78edd7b9b5b43e56"
integrity sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY= integrity sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY=
argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==
dependencies:
sprintf-js "~1.0.2"
arr-diff@^4.0.0: arr-diff@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
@@ -1223,10 +1184,10 @@ babel-plugin-transform-typescript-metadata@^0.3.1:
dependencies: dependencies:
"@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0"
babel-preset-medusa-package@^1.1.0: babel-preset-medusa-package@1.1.0-dev-1615929449260:
version "1.1.0" version "1.1.0-dev-1615929449260"
resolved "https://registry.yarnpkg.com/babel-preset-medusa-package/-/babel-preset-medusa-package-1.1.0.tgz#3b5a5fc5679a92747a5f13ab5419252b0de67b84" resolved "http://localhost:4873/babel-preset-medusa-package/-/babel-preset-medusa-package-1.1.0-dev-1615929449260.tgz#668c9d5f7e385ca1f3b0c681b6e90f0195d45025"
integrity sha512-1rGnObrfr4WCcmYciovqn8JbwNq2KtbEho/acQAYIxl6G3LOODK/jBH2zQHeW5k4GxjVe72JZDdqjfdm88KmEw== integrity sha512-y3GY3HFPPWOCY6OZ3rh3Ybms/LI6PzvD6Mo+nP6RBw1us6p4UAle1EoQrOp4gXYb5WX9PsYN5TwVUwgDNO7uwg==
dependencies: dependencies:
"@babel/plugin-proposal-class-properties" "^7.12.1" "@babel/plugin-proposal-class-properties" "^7.12.1"
"@babel/plugin-proposal-decorators" "^7.12.1" "@babel/plugin-proposal-decorators" "^7.12.1"
@@ -1243,11 +1204,6 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
base64-js@^1.3.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
base@^0.11.1: base@^0.11.1:
version "0.11.2" version "0.11.2"
resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f"
@@ -1351,14 +1307,6 @@ buffer-writer@2.0.0:
resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04" resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04"
integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw== integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==
buffer@^5.5.0:
version "5.7.1"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0"
integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.1.13"
bull@^3.12.1: bull@^3.12.1:
version "3.20.0" version "3.20.0"
resolved "https://registry.yarnpkg.com/bull/-/bull-3.20.0.tgz#ca394d623f13ade6cddb7481f630988bce2d4d09" resolved "https://registry.yarnpkg.com/bull/-/bull-3.20.0.tgz#ca394d623f13ade6cddb7481f630988bce2d4d09"
@@ -1424,17 +1372,6 @@ caniuse-lite@^1.0.30001173:
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001181.tgz#4f0e5184e1ea7c3bf2727e735cbe7ca9a451d673" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001181.tgz#4f0e5184e1ea7c3bf2727e735cbe7ca9a451d673"
integrity sha512-m5ul/ARCX50JB8BSNM+oiPmQrR5UmngaQ3QThTTp5HcIIQGP/nPBs82BYLE+tigzm3VW+F4BJIhUyaVtEweelQ== integrity sha512-m5ul/ARCX50JB8BSNM+oiPmQrR5UmngaQ3QThTTp5HcIIQGP/nPBs82BYLE+tigzm3VW+F4BJIhUyaVtEweelQ==
chalk@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=
dependencies:
ansi-styles "^2.2.1"
escape-string-regexp "^1.0.2"
has-ansi "^2.0.0"
strip-ansi "^3.0.0"
supports-color "^2.0.0"
chalk@^2.0.0: chalk@^2.0.0:
version "2.4.2" version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
@@ -1444,14 +1381,6 @@ chalk@^2.0.0:
escape-string-regexp "^1.0.5" escape-string-regexp "^1.0.5"
supports-color "^5.3.0" supports-color "^5.3.0"
chalk@^4.0.0, chalk@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
chokidar@^3.4.0, chokidar@^3.4.2: chokidar@^3.4.0, chokidar@^3.4.2:
version "3.5.1" version "3.5.1"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a"
@@ -1477,27 +1406,6 @@ class-utils@^0.3.5:
isobject "^3.0.0" isobject "^3.0.0"
static-extend "^0.1.1" static-extend "^0.1.1"
cli-highlight@^2.1.10:
version "2.1.10"
resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.10.tgz#26a087da9209dce4fcb8cf5427dc97cd96ac173a"
integrity sha512-CcPFD3JwdQ2oSzy+AMG6j3LRTkNjM82kzcSKzoVw6cLanDCJNlsLjeqVTOTfOfucnWv5F0rmBemVf1m9JiIasw==
dependencies:
chalk "^4.0.0"
highlight.js "^10.0.0"
mz "^2.4.0"
parse5 "^5.1.1"
parse5-htmlparser2-tree-adapter "^6.0.0"
yargs "^16.0.0"
cliui@^7.0.2:
version "7.0.4"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==
dependencies:
string-width "^4.2.0"
strip-ansi "^6.0.0"
wrap-ansi "^7.0.0"
cluster-key-slot@^1.1.0: cluster-key-slot@^1.1.0:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.0.tgz#30474b2a981fb12172695833052bc0d01336d10d" resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.0.tgz#30474b2a981fb12172695833052bc0d01336d10d"
@@ -1518,19 +1426,12 @@ color-convert@^1.9.0, color-convert@^1.9.1:
dependencies: dependencies:
color-name "1.1.3" color-name "1.1.3"
color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
dependencies:
color-name "~1.1.4"
color-name@1.1.3: color-name@1.1.3:
version "1.1.3" version "1.1.3"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
color-name@^1.0.0, color-name@~1.1.4: color-name@^1.0.0:
version "1.1.4" version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
@@ -1790,11 +1691,6 @@ electron-to-chromium@^1.3.634:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.648.tgz#b05926eca1843c04b283e682a1fc6c10af7e9dda" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.648.tgz#b05926eca1843c04b283e682a1fc6c10af7e9dda"
integrity sha512-4POzwyQ80tkDiBwkxn7IpfzioimrjRSFX1sCQ3pLZsYJ5ERYmwzdq0hZZ3nFP7Z6GtmnSn3xwWDm8FPlMeOoEQ== integrity sha512-4POzwyQ80tkDiBwkxn7IpfzioimrjRSFX1sCQ3pLZsYJ5ERYmwzdq0hZZ3nFP7Z6GtmnSn3xwWDm8FPlMeOoEQ==
emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
enabled@2.0.x: enabled@2.0.x:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2" resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2"
@@ -1861,16 +1757,11 @@ escape-html@~1.0.3:
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: escape-string-regexp@^1.0.5:
version "1.0.5" version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
esprima@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
esutils@^2.0.2: esutils@^2.0.2:
version "2.0.3" version "2.0.3"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
@@ -2002,11 +1893,6 @@ fecha@^4.2.0:
resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.0.tgz#3ffb6395453e3f3efff850404f0a59b6747f5f41" resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.0.tgz#3ffb6395453e3f3efff850404f0a59b6747f5f41"
integrity sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg== integrity sha512-aN3pcx/DSmtyoovUudctc8+6Hl4T+hI9GBBHLjA76jdZl7+b1sgh5g4k+u/GL3dTy1/pnYzKp69FpJ0OicE3Wg==
figlet@^1.1.1:
version "1.5.0"
resolved "https://registry.yarnpkg.com/figlet/-/figlet-1.5.0.tgz#2db4d00a584e5155a96080632db919213c3e003c"
integrity sha512-ZQJM4aifMpz6H19AW1VqvZ7l4pOE9p7i/3LyxgO2kp+PO/VcDYNqIHEMtkccqIhTXMKci4kjueJr/iCQEaT/Ww==
fill-range@^4.0.0: fill-range@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7"
@@ -2126,11 +2012,6 @@ gensync@^1.0.0-beta.1:
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==
get-caller-file@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
get-intrinsic@^1.0.2: get-intrinsic@^1.0.2:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.0.tgz#892e62931e6938c8a23ea5aaebcfb67bd97da97e" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.0.tgz#892e62931e6938c8a23ea5aaebcfb67bd97da97e"
@@ -2201,23 +2082,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.6, graceful-fs@^4.2.0:
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
has-ansi@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=
dependencies:
ansi-regex "^2.0.0"
has-flag@^3.0.0: has-flag@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
has-flag@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
has-symbols@^1.0.1: has-symbols@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8"
@@ -2261,11 +2130,6 @@ has@^1.0.3:
dependencies: dependencies:
function-bind "^1.1.1" function-bind "^1.1.1"
highlight.js@^10.0.0:
version "10.5.0"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.5.0.tgz#3f09fede6a865757378f2d9ebdcbc15ba268f98f"
integrity sha512-xTmvd9HiIHR6L53TMC7TKolEj65zG1XU+Onr8oi86mYa+nLcIbxTTWkpW7CsEwv/vK7u1zb8alZIMLDqqN6KTw==
homedir-polyfill@^1.0.1: homedir-polyfill@^1.0.1:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8"
@@ -2302,11 +2166,6 @@ iconv-lite@0.4.24:
dependencies: dependencies:
safer-buffer ">= 2.1.2 < 3" safer-buffer ">= 2.1.2 < 3"
ieee754@^1.1.13:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
ignore@^5.1.1: ignore@^5.1.1:
version "5.1.8" version "5.1.8"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
@@ -2320,7 +2179,7 @@ inflight@^1.0.4:
once "^1.3.0" once "^1.3.0"
wrappy "1" wrappy "1"
inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3: inherits@2, inherits@2.0.4, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3:
version "2.0.4" version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
@@ -2463,11 +2322,6 @@ is-extglob@^2.1.0, is-extglob@^2.1.1:
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=
is-fullwidth-code-point@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
is-glob@^3.1.0: is-glob@^3.1.0:
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a"
@@ -2596,14 +2450,6 @@ js-tokens@^4.0.0:
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
js-yaml@^3.14.0:
version "3.14.1"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537"
integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"
jsesc@^2.5.1: jsesc@^2.5.1:
version "2.5.2" version "2.5.2"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
@@ -2803,28 +2649,28 @@ media-typer@0.3.0:
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
medusa-core-utils@^1.1.0: medusa-core-utils@1.1.0-dev-1615929449260:
version "1.1.0" version "1.1.0-dev-1615929449260"
resolved "https://registry.yarnpkg.com/medusa-core-utils/-/medusa-core-utils-1.1.0.tgz#0641b365b769dbf99856025d935eef5cf5d81f2c" resolved "http://localhost:4873/medusa-core-utils/-/medusa-core-utils-1.1.0-dev-1615929449260.tgz#ad6334e195a77cbf1764ea637f6071a4441adf68"
integrity sha512-zocRthKhLK3eSjrXbAhZZkIMBRxyvU7GcAMFh5UCEgfe7f935vjE7r5lGTr5jTEwgwaoTUk9ep0VBekz0SEdyw== integrity sha512-udhVtrOWoab7Mljb4r427+iCZ1vy/XJb+yr6Q8xZe535on6DYpjahEiuLgkyy19wX50kVv5yt3raTE4Vg3yKEw==
dependencies: dependencies:
joi "^17.3.0" joi "^17.3.0"
joi-objectid "^3.0.1" joi-objectid "^3.0.1"
medusa-interfaces@^1.1.0: medusa-interfaces@1.1.1-dev-1615929449260:
version "1.1.0" version "1.1.1-dev-1615929449260"
resolved "https://registry.yarnpkg.com/medusa-interfaces/-/medusa-interfaces-1.1.0.tgz#fdced50c2aac5956b4a40da34841df60a96d16c4" resolved "http://localhost:4873/medusa-interfaces/-/medusa-interfaces-1.1.1-dev-1615929449260.tgz#6034b9f472591b85294430ecce8c68a8b05bd58a"
integrity sha512-wSgHR/MYGJzj6y54u25v7lGX8gTaAJarwN2VIHDTn0lsVGlIPqJem+tbJkDLdUV7V5mERSq5FGoqnIFHeJaDgQ== integrity sha512-w4ORNLHtec/DbMTLCfWatcUU9uVZfQtiOV12/quxg+N9K/2yk7jl8SAWhFiCc0gbT7Trwy1+V8esGEaAIPqMkQ==
dependencies: dependencies:
medusa-core-utils "^1.1.0" medusa-core-utils "1.1.0-dev-1615929449260"
medusa-test-utils@^1.1.1: medusa-test-utils@1.1.3-dev-1615929449260:
version "1.1.1" version "1.1.3-dev-1615929449260"
resolved "https://registry.yarnpkg.com/medusa-test-utils/-/medusa-test-utils-1.1.1.tgz#e6c9faf9339a2fa22f162c9864091d6e12792215" resolved "http://localhost:4873/medusa-test-utils/-/medusa-test-utils-1.1.3-dev-1615929449260.tgz#7b6d81c6eae1147e5f36d7242021f9f245e8662d"
integrity sha512-Fx55x1widi9yz3tQSvQbkACyNZMu05j9q9Ta0eDWwb1q96RpTQg0BMc0Em+ZXE9EwxWHqgDUqlAfLGmCW6aQUg== integrity sha512-Kqxf8/HjusYvVLf6jjdC62ci68JGyE20P1W8suB7cM8qnXNJHuKh5EXhFJRFX00tgr3N2oq68qrAUNcakB0IKA==
dependencies: dependencies:
"@babel/plugin-transform-classes" "^7.9.5" "@babel/plugin-transform-classes" "^7.9.5"
medusa-core-utils "^1.1.0" medusa-core-utils "1.1.0-dev-1615929449260"
randomatic "^3.1.1" randomatic "^3.1.1"
merge-descriptors@1.0.1: merge-descriptors@1.0.1:
@@ -2913,11 +2759,6 @@ mkdirp@^0.5.1:
dependencies: dependencies:
minimist "^1.2.5" minimist "^1.2.5"
mkdirp@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
moment-timezone@^0.5.31: moment-timezone@^0.5.31:
version "0.5.32" version "0.5.32"
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.32.tgz#db7677cc3cc680fd30303ebd90b0da1ca0dfecc2" resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.32.tgz#db7677cc3cc680fd30303ebd90b0da1ca0dfecc2"
@@ -2975,15 +2816,6 @@ multer@^1.4.2:
type-is "^1.6.4" type-is "^1.6.4"
xtend "^4.0.0" xtend "^4.0.0"
mz@^2.4.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32"
integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==
dependencies:
any-promise "^1.0.0"
object-assign "^4.0.1"
thenify-all "^1.0.0"
nanomatch@^1.2.9: nanomatch@^1.2.9:
version "1.2.13" version "1.2.13"
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"
@@ -3044,7 +2876,7 @@ normalize-path@^3.0.0, normalize-path@~3.0.0:
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
object-assign@^4, object-assign@^4.0.1, object-assign@^4.1.1: object-assign@^4, object-assign@^4.1.1:
version "4.1.1" version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
@@ -3168,33 +3000,11 @@ packet-reader@1.0.0:
resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74"
integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==
parent-require@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/parent-require/-/parent-require-1.0.0.tgz#746a167638083a860b0eef6732cb27ed46c32977"
integrity sha1-dGoWdjgIOoYLDu9nMssn7UbDKXc=
parse-passwd@^1.0.0: parse-passwd@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6"
integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=
parse5-htmlparser2-tree-adapter@^6.0.0:
version "6.0.1"
resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6"
integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==
dependencies:
parse5 "^6.0.1"
parse5@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178"
integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==
parse5@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b"
integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==
parseurl@~1.3.3: parseurl@~1.3.3:
version "1.3.3" version "1.3.3"
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
@@ -3594,11 +3404,6 @@ request-ip@^2.1.3:
dependencies: dependencies:
is_js "^0.9.0" is_js "^0.9.0"
require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
resolve-cwd@^3.0.0: resolve-cwd@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d"
@@ -3669,11 +3474,6 @@ safe-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
sax@>=0.6.0:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
scrypt-kdf@^2.0.1: scrypt-kdf@^2.0.1:
version "2.0.1" version "2.0.1"
resolved "https://registry.yarnpkg.com/scrypt-kdf/-/scrypt-kdf-2.0.1.tgz#3355224c52d398331b2cbf2b70a7be26b52c53e6" resolved "https://registry.yarnpkg.com/scrypt-kdf/-/scrypt-kdf-2.0.1.tgz#3355224c52d398331b2cbf2b70a7be26b52c53e6"
@@ -3740,14 +3540,6 @@ setprototypeof@1.1.1:
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683"
integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw== integrity sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==
sha.js@^2.4.11:
version "2.4.11"
resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7"
integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==
dependencies:
inherits "^2.0.1"
safe-buffer "^5.0.1"
simple-swizzle@^0.2.2: simple-swizzle@^0.2.2:
version "0.2.2" version "0.2.2"
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
@@ -3843,11 +3635,6 @@ split2@^3.1.1:
dependencies: dependencies:
readable-stream "^3.0.0" readable-stream "^3.0.0"
sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
stack-trace@0.0.x: stack-trace@0.0.x:
version "0.0.10" version "0.0.10"
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0"
@@ -3876,15 +3663,6 @@ streamsearch@0.1.2:
resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a" resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a"
integrity sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo= integrity sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=
string-width@^4.1.0, string-width@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5"
integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.0"
string.prototype.trimend@^1.0.1, string.prototype.trimend@^1.0.3: string.prototype.trimend@^1.0.1, string.prototype.trimend@^1.0.3:
version "1.0.3" version "1.0.3"
resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz#a22bd53cca5c7cf44d7c9d5c732118873d6cd18b" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz#a22bd53cca5c7cf44d7c9d5c732118873d6cd18b"
@@ -3920,25 +3698,6 @@ string_decoder@~1.1.1:
dependencies: dependencies:
safe-buffer "~5.1.0" safe-buffer "~5.1.0"
strip-ansi@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=
dependencies:
ansi-regex "^2.0.0"
strip-ansi@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532"
integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==
dependencies:
ansi-regex "^5.0.0"
supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=
supports-color@^5.3.0: supports-color@^5.3.0:
version "5.5.0" version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
@@ -3946,32 +3705,11 @@ supports-color@^5.3.0:
dependencies: dependencies:
has-flag "^3.0.0" has-flag "^3.0.0"
supports-color@^7.1.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
dependencies:
has-flag "^4.0.0"
text-hex@1.0.x: text-hex@1.0.x:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5" resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5"
integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg== integrity sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==
thenify-all@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726"
integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=
dependencies:
thenify ">= 3.1.0 < 4"
"thenify@>= 3.1.0 < 4":
version "3.3.1"
resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f"
integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==
dependencies:
any-promise "^1.0.0"
to-fast-properties@^2.0.0: to-fast-properties@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
@@ -4019,11 +3757,6 @@ triple-beam@^1.2.0, triple-beam@^1.3.0:
resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9" resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9"
integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw== integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==
tslib@^1.13.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
tslib@^2.0.3: tslib@^2.0.3:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
@@ -4042,28 +3775,6 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typeorm@^0.2.29:
version "0.2.30"
resolved "https://registry.yarnpkg.com/typeorm/-/typeorm-0.2.30.tgz#a0df2256402cbcdde8049a244437560495ce9b38"
integrity sha512-qpr8AO3Phi6ZF7qMHOrRdNisVt8jE1KfmW0ooLFcXscA87aJ12aBPyB9cJfxGNjNwd7B3WIK9ZlBveWiqd74QA==
dependencies:
"@sqltools/formatter" "1.2.2"
app-root-path "^3.0.0"
buffer "^5.5.0"
chalk "^4.1.0"
cli-highlight "^2.1.10"
debug "^4.1.1"
dotenv "^8.2.0"
glob "^7.1.6"
js-yaml "^3.14.0"
mkdirp "^1.0.4"
reflect-metadata "^0.1.13"
sha.js "^2.4.11"
tslib "^1.13.0"
xml2js "^0.4.23"
yargonaut "^1.1.2"
yargs "^16.0.3"
uid-safe@~2.1.5: uid-safe@~2.1.5:
version "2.1.5" version "2.1.5"
resolved "https://registry.yarnpkg.com/uid-safe/-/uid-safe-2.1.5.tgz#2b3d5c7240e8fc2e58f8aa269e5ee49c0857bd3a" resolved "https://registry.yarnpkg.com/uid-safe/-/uid-safe-2.1.5.tgz#2b3d5c7240e8fc2e58f8aa269e5ee49c0857bd3a"
@@ -4203,71 +3914,17 @@ winston@^3.2.1:
triple-beam "^1.3.0" triple-beam "^1.3.0"
winston-transport "^4.4.0" winston-transport "^4.4.0"
wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"
wrappy@1: wrappy@1:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
xml2js@^0.4.23:
version "0.4.23"
resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66"
integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==
dependencies:
sax ">=0.6.0"
xmlbuilder "~11.0.0"
xmlbuilder@~11.0.0:
version "11.0.1"
resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3"
integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==
xtend@^4.0.0: xtend@^4.0.0:
version "4.0.2" version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
y18n@^5.0.5:
version "5.0.5"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18"
integrity sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==
yallist@^4.0.0: yallist@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
yargonaut@^1.1.2:
version "1.1.4"
resolved "https://registry.yarnpkg.com/yargonaut/-/yargonaut-1.1.4.tgz#c64f56432c7465271221f53f5cc517890c3d6e0c"
integrity sha512-rHgFmbgXAAzl+1nngqOcwEljqHGG9uUZoPjsdZEs1w5JW9RXYzrSvH/u70C1JE5qFi0qjsdhnUX/dJRpWqitSA==
dependencies:
chalk "^1.1.1"
figlet "^1.1.1"
parent-require "^1.0.0"
yargs-parser@^20.2.2:
version "20.2.4"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"
integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
yargs@^16.0.0, yargs@^16.0.3:
version "16.2.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
dependencies:
cliui "^7.0.2"
escalade "^3.1.1"
get-caller-file "^2.0.5"
require-directory "^2.1.1"
string-width "^4.2.0"
y18n "^5.0.5"
yargs-parser "^20.2.2"
+4 -2
View File
@@ -1,12 +1,14 @@
const path = require("path"); const path = require("path");
const express = require("express"); const express = require("express");
const getPort = require("get-port"); const getPort = require("get-port");
const importFrom = require("import-from");
const loaders = require("@medusajs/medusa/dist/loaders").default;
const initialize = async () => { const initialize = async () => {
const app = express(); const app = express();
const cwd = process.cwd();
const loaders = importFrom(cwd, "@medusajs/medusa/dist/loaders").default;
const { dbConnection } = await loaders({ const { dbConnection } = await loaders({
directory: path.resolve(process.cwd()), directory: path.resolve(process.cwd()),
expressApp: app, expressApp: app,
+248 -6
View File
@@ -87,7 +87,7 @@
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "properties": {
"customer": { "user": {
"$ref": "#/components/schemas/user" "$ref": "#/components/schemas/user"
} }
} }
@@ -134,7 +134,7 @@
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "properties": {
"customer": { "user": {
"$ref": "#/components/schemas/user" "$ref": "#/components/schemas/user"
} }
} }
@@ -1904,7 +1904,7 @@
"in": "path", "in": "path",
"name": "id", "name": "id",
"required": true, "required": true,
"description": "The id of the Swap.", "description": "The id of the Order.",
"schema": { "schema": {
"type": "string" "type": "string"
} }
@@ -2194,7 +2194,7 @@
"get": { "get": {
"operationId": "GetOrders", "operationId": "GetOrders",
"summary": "List Orders", "summary": "List Orders",
"description": "Retrieves an list of Orders", "description": "Retrieves a list of Orders",
"tags": [ "tags": [
"Order" "Order"
], ],
@@ -2205,8 +2205,11 @@
"application/json": { "application/json": {
"schema": { "schema": {
"properties": { "properties": {
"order": { "orders": {
"$ref": "#/components/schemas/order" "type": "array",
"items": {
"$ref": "#/components/schemas/order"
}
} }
} }
} }
@@ -2503,6 +2506,14 @@
"description": "The id of the Line Item.", "description": "The id of the Line Item.",
"type": "string" "type": "string"
}, },
"reason_id": {
"description": "The id of the Return Reason to use.",
"type": "string"
},
"note": {
"description": "An optional note with information about the Return.",
"type": "string"
},
"quantity": { "quantity": {
"description": "The quantity of the Line Item.", "description": "The quantity of the Line Item.",
"type": "integer" "type": "integer"
@@ -4554,6 +4565,183 @@
} }
} }
}, },
"/return-reasons": {
"post": {
"operationId": "PostReturnReasons",
"summary": "Create a Return Reason",
"description": "Creates a Return Reason",
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"label": {
"description": "The label to display to the Customer.",
"type": "string"
},
"value": {
"description": "The value that the Return Reason will be identified by. Must be unique.",
"type": "string"
},
"description": {
"description": "An optional description to for the Reason.",
"type": "string"
},
"metadata": {
"description": "An optional set of key-value pairs with additional information.",
"type": "object"
}
}
}
}
}
},
"tags": [
"Return Reason"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"properties": {
"return_reason": {
"$ref": "#/components/schemas/return_reason"
}
}
}
}
}
}
}
},
"get": {
"operationId": "GetReturnReasons",
"summary": "List Return Reasons",
"description": "Retrieves a list of Return Reasons.",
"tags": [
"Return Reason"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"properties": {
"return_reasons": {
"type": "array",
"items": {
"$ref": "#/components/schemas/return_reason"
}
}
}
}
}
}
}
}
}
},
"/return-reasons/{id}": {
"get": {
"operationId": "GetReturnReasonsReason",
"summary": "Retrieve a Return Reason",
"description": "Retrieves a Return Reason.",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "The id of the Return Reason.",
"schema": {
"type": "string"
}
}
],
"tags": [
"Return Reason"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"properties": {
"return_reason": {
"$ref": "#/components/schemas/return_reason"
}
}
}
}
}
}
}
},
"post": {
"operationId": "PostReturnReasonsReason",
"summary": "Update a Return Reason",
"description": "Updates a Return Reason",
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"description": "The id of the Return Reason.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"label": {
"description": "The label to display to the Customer.",
"type": "string"
},
"value": {
"description": "The value that the Return Reason will be identified by. Must be unique.",
"type": "string"
},
"description": {
"description": "An optional description to for the Reason.",
"type": "string"
},
"metadata": {
"description": "An optional set of key-value pairs with additional information.",
"type": "object"
}
}
}
}
}
},
"tags": [
"Return Reason"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"properties": {
"return_reason": {
"$ref": "#/components/schemas/return_reason"
}
}
}
}
}
}
}
}
},
"/returns": { "/returns": {
"get": { "get": {
"operationId": "GetReturns", "operationId": "GetReturns",
@@ -7412,6 +7600,60 @@
"description": "The quantity that was received in the warehouse.", "description": "The quantity that was received in the warehouse.",
"type": "integer" "type": "integer"
}, },
"reason": {
"description": "The reason for returning the item.",
"anyOf": [
{
"$ref": "#/components/schemas/return_reason"
}
]
},
"note": {
"description": "An optional note with additional details about the Return.",
"type": "string"
},
"metadata": {
"description": "An optional key-value map with additional information.",
"type": "object"
}
}
},
"return_reason": {
"title": "Return Reason",
"description": "A Reason for why a given product is returned. A Return Reason can be used on Return Items in order to indicate why a Line Item was returned.",
"x-resourceId": "return_reason",
"properties": {
"id": {
"description": "The id of the Return Reason will start with `rr_`.",
"type": "string"
},
"description": {
"description": "A description of the Reason.",
"type": "string"
},
"label": {
"description": "A text that can be displayed to the Customer as a reason.",
"type": "string"
},
"value": {
"description": "The value to identify the reason by.",
"type": "string"
},
"created_at": {
"description": "The date with timezone at which the resource was created.",
"type": "string",
"format": "date-time"
},
"updated_at": {
"description": "The date with timezone at which the resource was last updated.",
"type": "string",
"format": "date-time"
},
"deleted_at": {
"description": "The date with timezone at which the resource was deleted.",
"type": "string",
"format": "date-time"
},
"metadata": { "metadata": {
"description": "An optional key-value map with additional information.", "description": "An optional key-value map with additional information.",
"type": "object" "type": "object"
+175 -6
View File
@@ -53,7 +53,7 @@ paths:
application/json: application/json:
schema: schema:
properties: properties:
customer: user:
$ref: '#/components/schemas/user' $ref: '#/components/schemas/user'
requestBody: requestBody:
content: content:
@@ -83,7 +83,7 @@ paths:
application/json: application/json:
schema: schema:
properties: properties:
customer: user:
$ref: '#/components/schemas/user' $ref: '#/components/schemas/user'
/collections: /collections:
post: post:
@@ -1314,7 +1314,7 @@ paths:
- in: path - in: path
name: id name: id
required: true required: true
description: The id of the Swap. description: The id of the Order.
schema: schema:
type: string type: string
requestBody: requestBody:
@@ -1501,7 +1501,7 @@ paths:
get: get:
operationId: GetOrders operationId: GetOrders
summary: List Orders summary: List Orders
description: Retrieves an list of Orders description: Retrieves a list of Orders
tags: tags:
- Order - Order
responses: responses:
@@ -1511,8 +1511,10 @@ paths:
application/json: application/json:
schema: schema:
properties: properties:
order: orders:
$ref: '#/components/schemas/order' type: array
items:
$ref: '#/components/schemas/order'
'/orders/{id}/swaps/{swap_id}/process-payment': '/orders/{id}/swaps/{swap_id}/process-payment':
post: post:
operationId: PostOrdersOrderSwapsSwapProcessPayment operationId: PostOrdersOrderSwapsSwapProcessPayment
@@ -1705,6 +1707,12 @@ paths:
item_id: item_id:
description: The id of the Line Item. description: The id of the Line Item.
type: string type: string
reason_id:
description: The id of the Return Reason to use.
type: string
note:
description: An optional note with information about the Return.
type: string
quantity: quantity:
description: The quantity of the Line Item. description: The quantity of the Line Item.
type: integer type: integer
@@ -3151,6 +3159,126 @@ paths:
properties: properties:
region: region:
$ref: '#/components/schemas/region' $ref: '#/components/schemas/region'
/return-reasons:
post:
operationId: PostReturnReasons
summary: Create a Return Reason
description: Creates a Return Reason
requestBody:
content:
application/json:
schema:
properties:
label:
description: The label to display to the Customer.
type: string
value:
description: >-
The value that the Return Reason will be identified by. Must
be unique.
type: string
description:
description: An optional description to for the Reason.
type: string
metadata:
description: >-
An optional set of key-value pairs with additional
information.
type: object
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return_reason:
$ref: '#/components/schemas/return_reason'
get:
operationId: GetReturnReasons
summary: List Return Reasons
description: Retrieves a list of Return Reasons.
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return_reasons:
type: array
items:
$ref: '#/components/schemas/return_reason'
'/return-reasons/{id}':
get:
operationId: GetReturnReasonsReason
summary: Retrieve a Return Reason
description: Retrieves a Return Reason.
parameters:
- in: path
name: id
required: true
description: The id of the Return Reason.
schema:
type: string
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return_reason:
$ref: '#/components/schemas/return_reason'
post:
operationId: PostReturnReasonsReason
summary: Update a Return Reason
description: Updates a Return Reason
parameters:
- in: path
name: id
required: true
description: The id of the Return Reason.
schema:
type: string
requestBody:
content:
application/json:
schema:
properties:
label:
description: The label to display to the Customer.
type: string
value:
description: >-
The value that the Return Reason will be identified by. Must
be unique.
type: string
description:
description: An optional description to for the Reason.
type: string
metadata:
description: >-
An optional set of key-value pairs with additional
information.
type: object
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return_reason:
$ref: '#/components/schemas/return_reason'
/returns: /returns:
get: get:
operationId: GetReturns operationId: GetReturns
@@ -5441,6 +5569,47 @@ components:
recieved_quantity: recieved_quantity:
description: The quantity that was received in the warehouse. description: The quantity that was received in the warehouse.
type: integer type: integer
reason:
description: The reason for returning the item.
anyOf:
- $ref: '#/components/schemas/return_reason'
note:
description: An optional note with additional details about the Return.
type: string
metadata:
description: An optional key-value map with additional information.
type: object
return_reason:
title: Return Reason
description: >-
A Reason for why a given product is returned. A Return Reason can be
used on Return Items in order to indicate why a Line Item was returned.
x-resourceId: return_reason
properties:
id:
description: The id of the Return Reason will start with `rr_`.
type: string
description:
description: A description of the Reason.
type: string
label:
description: A text that can be displayed to the Customer as a reason.
type: string
value:
description: The value to identify the reason by.
type: string
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was last updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
type: string
format: date-time
metadata: metadata:
description: An optional key-value map with additional information. description: An optional key-value map with additional information.
type: object type: object
+746 -523
View File
File diff suppressed because it is too large. Load diff
+830 -533
View File
File diff suppressed because it is too large. Load diff
+208
View File
@@ -237,6 +237,12 @@ paths:
quantity: quantity:
description: The quantity of the Product Variant to add description: The quantity of the Product Variant to add
type: integer type: integer
context:
description: >-
An optional object to provide context to the Cart. The
`context` field is automatically populated with `ip` and
`user_agent`
type: object
tags: tags:
- Cart - Cart
responses: responses:
@@ -594,6 +600,9 @@ paths:
customer_id: customer_id:
description: The id of the Customer to associate the Cart with. description: The id of the Customer to associate the Cart with.
type: string type: string
context:
description: An optional object to provide context to the Cart.
type: object
tags: tags:
- Cart - Cart
responses: responses:
@@ -977,6 +986,37 @@ paths:
password: password:
type: string type: string
description: The new password to set for the Customer. description: The new password to set for the Customer.
'/gift-cards/{code}':
get:
operationId: GetGiftCardsCode
summary: Retrieve Gift Card by Code
description: Retrieves a Gift Card by its associated unqiue code.
parameters:
- in: path
name: code
required: true
description: The unique Gift Card code.
schema:
type: string
tags:
- Gift Card
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
id:
description: The id of the Gift Card
code:
description: The code of the Gift Card
value:
description: The original value of the Gift Card.
balance:
description: The current balanace of the Gift Card
region:
$ref: '#/components/schemas/region'
'/orders/cart/{cart_id}': '/orders/cart/{cart_id}':
get: get:
operationId: GetOrdersOrderCartId operationId: GetOrdersOrderCartId
@@ -1025,6 +1065,38 @@ paths:
properties: properties:
customer: customer:
$ref: '#/components/schemas/customer' $ref: '#/components/schemas/customer'
/orders:
get:
operationId: GetOrders
summary: Look Up an Order
description: >-
Looks for an Order with a given `display_id`, `email` pair. The
`display_id`, `email` pair must match in order for the Order to be
returned.
parameters:
- in: query
name: display_id
required: true
description: The display id given to the Order.
schema:
type: number
- in: query
name: email
required: true
description: The email of the Order with the given display_id.
schema:
type: string
tags:
- Order
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
order:
$ref: '#/components/schemas/order'
'/products/{id}': '/products/{id}':
get: get:
operationId: GetProductsProduct operationId: GetProductsProduct
@@ -1075,6 +1147,47 @@ paths:
type: array type: array
items: items:
$ref: '#/components/schemas/product' $ref: '#/components/schemas/product'
'/return-reasons/{id}':
get:
operationId: GetReturnReasonsReason
summary: Retrieve a Return Reason
description: Retrieves a Return Reason.
parameters:
- in: path
name: id
required: true
description: The id of the Return Reason.
schema:
type: string
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return_reason:
$ref: '#/components/schemas/return_reason'
/return-reasons:
get:
operationId: GetReturnReasons
summary: List Return Reasons
description: Retrieves a list of Return Reasons.
tags:
- Return Reason
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return_reasons:
type: array
items:
$ref: '#/components/schemas/return_reason'
'/regions/{id}': '/regions/{id}':
get: get:
operationId: GetRegionsRegion operationId: GetRegionsRegion
@@ -1125,12 +1238,66 @@ paths:
type: array type: array
items: items:
$ref: '#/components/schemas/region' $ref: '#/components/schemas/region'
/returns:
post:
operationId: PostReturns
summary: Create Return
description: Creates a Return for an Order.
requestBody:
content:
application/json:
schema:
properties:
order_id:
type: string
description: The id of the Order to create the Return from.
items:
description: The items to include in the Return.
type: array
items:
properties:
item_id:
description: The id of the Line Item from the Order.
type: string
quantity:
description: The quantity to return.
type: integer
return_shipping:
description: >-
If the Return is to be handled by the store operator the
Customer can choose a Return Shipping Method. Alternatvely
the Customer can handle the Return themselves.
type: object
properties:
option_id:
type: string
description: >-
The id of the Shipping Option to create the Shipping
Method from.
tags:
- Return
responses:
'200':
description: OK
content:
application/json:
schema:
properties:
return:
$ref: '#/components/schemas/return'
/shipping-options: /shipping-options:
get: get:
operationId: GetShippingOptions operationId: GetShippingOptions
summary: Retrieve Shipping Options summary: Retrieve Shipping Options
description: Retrieves a list of Shipping Options. description: Retrieves a list of Shipping Options.
parameters: parameters:
- in: query
name: is_return
description: >-
Whether return Shipping Options should be included. By default all
Shipping Options are returned.
schema:
type: boolean
- in: query - in: query
name: product_ids name: product_ids
description: A comma separated list of Product ids to filter Shipping Options by. description: A comma separated list of Product ids to filter Shipping Options by.
@@ -3064,6 +3231,47 @@ components:
recieved_quantity: recieved_quantity:
description: The quantity that was received in the warehouse. description: The quantity that was received in the warehouse.
type: integer type: integer
reason:
description: The reason for returning the item.
anyOf:
- $ref: '#/components/schemas/return_reason'
note:
description: An optional note with additional details about the Return.
type: string
metadata:
description: An optional key-value map with additional information.
type: object
return_reason:
title: Return Reason
description: >-
A Reason for why a given product is returned. A Return Reason can be
used on Return Items in order to indicate why a Line Item was returned.
x-resourceId: return_reason
properties:
id:
description: The id of the Return Reason will start with `rr_`.
type: string
description:
description: A description of the Reason.
type: string
label:
description: A text that can be displayed to the Customer as a reason.
type: string
value:
description: The value to identify the reason by.
type: string
created_at:
description: The date with timezone at which the resource was created.
type: string
format: date-time
updated_at:
description: The date with timezone at which the resource was last updated.
type: string
format: date-time
deleted_at:
description: The date with timezone at which the resource was deleted.
type: string
format: date-time
metadata: metadata:
description: An optional key-value map with additional information. description: An optional key-value map with additional information.
type: object type: object
+9 -9
View File
@@ -2282,9 +2282,9 @@ domexception@^1.0.1:
webidl-conversions "^4.0.2" webidl-conversions "^4.0.2"
dot-prop@^4.1.0: dot-prop@^4.1.0:
version "4.2.0" version "4.2.1"
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.0.tgz#1f19e0c2e1aa0e32797c49799f2837ac6af69c57" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-4.2.1.tgz#45884194a71fc2cda71cbb4bceb3a4dd2f433ba4"
integrity sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ== integrity sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==
dependencies: dependencies:
is-obj "^1.0.0" is-obj "^1.0.0"
@@ -3213,9 +3213,9 @@ inherits@2.0.3:
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
ini@^1.3.4, ini@~1.3.0: ini@^1.3.4, ini@~1.3.0:
version "1.3.5" version "1.3.8"
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
inquirer@^7.0.0: inquirer@^7.0.0:
version "7.1.0" version "7.1.0"
@@ -6627,9 +6627,9 @@ xml-name-validator@^3.0.0:
integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==
y18n@^4.0.0: y18n@^4.0.0:
version "4.0.0" version "4.0.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==
yallist@^2.1.2: yallist@^2.1.2:
version "2.1.2" version "2.1.2"
@@ -0,0 +1,161 @@
const { dropDatabase } = require("pg-god");
const path = require("path");
const { Region, DiscountRule, Discount } = require("@medusajs/medusa");
const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api");
const { initDb } = require("../../../helpers/use-db");
const adminSeeder = require("../../helpers/admin-seeder");
jest.setTimeout(30000);
describe("/admin/discounts", () => {
let medusaProcess;
let dbConnection;
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."));
dbConnection = await initDb({ cwd });
medusaProcess = await setupServer({ cwd });
});
afterAll(async () => {
await dbConnection.close();
await dropDatabase({ databaseName: "medusa-integration" });
medusaProcess.kill();
});
describe("POST /admin/discounts", () => {
beforeEach(async () => {
const manager = dbConnection.manager;
try {
await adminSeeder(dbConnection);
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "discount"`);
await manager.query(`DELETE FROM "discount_rule"`);
await manager.query(`DELETE FROM "user"`);
});
it("creates a discount and updates it", async () => {
const api = useApi();
const response = await api
.post(
"/admin/discounts",
{
code: "HELLOWORLD",
rule: {
description: "test",
type: "percentage",
value: 10,
allocation: "total",
},
usage_limit: 10,
},
{
headers: {
Authorization: "Bearer test_token",
},
}
)
.catch((err) => {
console.log(err);
});
expect(response.status).toEqual(200);
expect(response.data.discount).toEqual(
expect.objectContaining({
code: "HELLOWORLD",
usage_limit: 10,
})
);
const updated = await api
.post(
`/admin/discounts/${response.data.discount.id}`,
{
usage_limit: 20,
},
{
headers: {
Authorization: "Bearer test_token",
},
}
)
.catch((err) => {
console.log(err);
});
expect(updated.status).toEqual(200);
expect(updated.data.discount).toEqual(
expect.objectContaining({
code: "HELLOWORLD",
usage_limit: 20,
})
);
});
});
describe("POST /admin/discounts/:discount_id/dynamic-codes", () => {
beforeEach(async () => {
const manager = dbConnection.manager;
try {
await adminSeeder(dbConnection);
await manager.insert(DiscountRule, {
id: "test-discount-rule",
description: "Dynamic rule",
type: "percentage",
value: 10,
allocation: "total",
});
await manager.insert(Discount, {
id: "test-discount",
code: "DYNAMIC",
is_dynamic: true,
is_disabled: false,
rule_id: "test-discount-rule",
});
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "discount"`);
await manager.query(`DELETE FROM "discount_rule"`);
await manager.query(`DELETE FROM "user"`);
});
it("creates a dynamic discount", async () => {
const api = useApi();
const response = await api
.post(
"/admin/discounts/test-discount/dynamic-codes",
{
code: "HELLOWORLD",
},
{
headers: {
Authorization: "Bearer test_token",
},
}
)
.catch((err) => {
console.log(err);
});
expect(response.status).toEqual(200);
});
});
});
+437 -1
View File
@@ -1,11 +1,13 @@
const { dropDatabase } = require("pg-god"); const { dropDatabase } = require("pg-god");
const path = require("path"); const path = require("path");
const { ReturnReason } = require("@medusajs/medusa");
const setupServer = require("../../../helpers/setup-server"); const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api"); const { useApi } = require("../../../helpers/use-api");
const { initDb } = require("../../../helpers/use-db"); const { initDb } = require("../../../helpers/use-db");
const orderSeeder = require("../../helpers/order-seeder"); const orderSeeder = require("../../helpers/order-seeder");
const swapSeeder = require("../../helpers/swap-seeder");
const adminSeeder = require("../../helpers/admin-seeder"); const adminSeeder = require("../../helpers/admin-seeder");
jest.setTimeout(30000); jest.setTimeout(30000);
@@ -98,11 +100,12 @@ describe("/admin/orders", () => {
await manager.query(`DELETE FROM "fulfillment_item"`); await manager.query(`DELETE FROM "fulfillment_item"`);
await manager.query(`DELETE FROM "fulfillment"`); await manager.query(`DELETE FROM "fulfillment"`);
await manager.query(`DELETE FROM "swap"`); await manager.query(`DELETE FROM "swap"`);
await manager.query(`DELETE FROM "return"`);
await manager.query(`DELETE FROM "claim_image"`); await manager.query(`DELETE FROM "claim_image"`);
await manager.query(`DELETE FROM "claim_tag"`); await manager.query(`DELETE FROM "claim_tag"`);
await manager.query(`DELETE FROM "claim_item"`); await manager.query(`DELETE FROM "claim_item"`);
await manager.query(`DELETE FROM "shipping_method"`); await manager.query(`DELETE FROM "shipping_method"`);
await manager.query(`DELETE FROM "return_item"`);
await manager.query(`DELETE FROM "return"`);
await manager.query(`DELETE FROM "line_item"`); await manager.query(`DELETE FROM "line_item"`);
await manager.query(`DELETE FROM "claim_order"`); await manager.query(`DELETE FROM "claim_order"`);
await manager.query(`DELETE FROM "money_amount"`); await manager.query(`DELETE FROM "money_amount"`);
@@ -176,6 +179,72 @@ describe("/admin/orders", () => {
); );
}); });
it("creates a claim with return shipping", async () => {
const api = useApi();
const response = await api.post(
"/admin/orders/test-order/claims",
{
type: "replace",
claim_items: [
{
item_id: "test-item",
quantity: 1,
reason: "production_failure",
tags: ["fluff"],
images: ["https://test.image.com"],
},
],
additional_items: [
{
variant_id: "test-variant",
quantity: 1,
},
],
return_shipping: { option_id: "test-return-option", price: 0 },
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(response.status).toEqual(200);
expect(response.data.order.claims[0].claim_items).toEqual(
expect.arrayContaining([
expect.objectContaining({
item_id: "test-item",
quantity: 1,
reason: "production_failure",
images: expect.arrayContaining([
expect.objectContaining({
url: "https://test.image.com",
}),
]),
}),
])
);
expect(response.data.order.claims[0].additional_items).toEqual(
expect.arrayContaining([
expect.objectContaining({
variant_id: "test-variant",
quantity: 1,
}),
])
);
expect(
response.data.order.claims[0].return_order.shipping_method
).toEqual(
expect.objectContaining({
price: 0,
shipping_option_id: "test-return-option",
})
);
});
it("updates a claim", async () => { it("updates a claim", async () => {
const api = useApi(); const api = useApi();
@@ -468,6 +537,91 @@ describe("/admin/orders", () => {
}); });
}); });
describe("POST /admin/orders/:id/return", () => {
let rrId;
beforeEach(async () => {
try {
await adminSeeder(dbConnection);
await orderSeeder(dbConnection);
const created = dbConnection.manager.create(ReturnReason, {
value: "too_big",
label: "Too Big",
});
const result = await dbConnection.manager.save(created);
rrId = result.id;
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "cart"`);
await manager.query(`DELETE FROM "fulfillment_item"`);
await manager.query(`DELETE FROM "fulfillment"`);
await manager.query(`DELETE FROM "swap"`);
await manager.query(`DELETE FROM "return_item"`);
await manager.query(`DELETE FROM "return_reason"`);
await manager.query(`DELETE FROM "return"`);
await manager.query(`DELETE FROM "claim_image"`);
await manager.query(`DELETE FROM "claim_tag"`);
await manager.query(`DELETE FROM "claim_item"`);
await manager.query(`DELETE FROM "shipping_method"`);
await manager.query(`DELETE FROM "line_item"`);
await manager.query(`DELETE FROM "claim_order"`);
await manager.query(`DELETE FROM "money_amount"`);
await manager.query(`DELETE FROM "product_variant"`);
await manager.query(`DELETE FROM "product"`);
await manager.query(`DELETE FROM "shipping_option"`);
await manager.query(`DELETE FROM "discount"`);
await manager.query(`DELETE FROM "payment"`);
await manager.query(`DELETE FROM "order"`);
await manager.query(`DELETE FROM "customer"`);
await manager.query(
`UPDATE "country" SET region_id=NULL WHERE iso_2 = 'us'`
);
await manager.query(`DELETE FROM "region"`);
await manager.query(`DELETE FROM "user"`);
});
it("creates a return", async () => {
const api = useApi();
const response = await api.post(
"/admin/orders/test-order/return",
{
items: [
{
item_id: "test-item",
quantity: 1,
reason_id: rrId,
note: "TOO SMALL",
},
],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(response.status).toEqual(200);
expect(response.data.order.returns[0].refund_amount).toEqual(7200);
expect(response.data.order.returns[0].items).toEqual([
expect.objectContaining({
item_id: "test-item",
quantity: 1,
reason_id: rrId,
note: "TOO SMALL",
}),
]);
});
});
describe("GET /admin/orders", () => { describe("GET /admin/orders", () => {
beforeEach(async () => { beforeEach(async () => {
try { try {
@@ -620,4 +774,286 @@ describe("/admin/orders", () => {
]); ]);
}); });
}); });
describe("POST /admin/orders/:id/swaps", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection);
await orderSeeder(dbConnection);
await swapSeeder(dbConnection);
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "fulfillment_item"`);
await manager.query(`DELETE FROM "fulfillment"`);
await manager.query(`DELETE FROM "return_item"`);
await manager.query(`DELETE FROM "return_reason"`);
await manager.query(`DELETE FROM "return"`);
await manager.query(`DELETE FROM "claim_image"`);
await manager.query(`DELETE FROM "claim_tag"`);
await manager.query(`DELETE FROM "claim_item"`);
await manager.query(`DELETE FROM "shipping_method"`);
await manager.query(`DELETE FROM "line_item"`);
await manager.query(`DELETE FROM "payment"`);
await manager.query(`DELETE FROM "swap"`);
await manager.query(`DELETE FROM "cart"`);
await manager.query(`DELETE FROM "claim_order"`);
await manager.query(`DELETE FROM "money_amount"`);
await manager.query(`DELETE FROM "product_variant"`);
await manager.query(`DELETE FROM "product"`);
await manager.query(`DELETE FROM "shipping_option"`);
await manager.query(`DELETE FROM "discount"`);
await manager.query(`DELETE FROM "refund"`);
await manager.query(`DELETE FROM "order"`);
await manager.query(`DELETE FROM "customer"`);
await manager.query(
`UPDATE "country" SET region_id=NULL WHERE iso_2 = 'us'`
);
await manager.query(`DELETE FROM "region"`);
await manager.query(`DELETE FROM "user"`);
});
it("creates a swap", async () => {
const api = useApi();
const response = await api.post(
"/admin/orders/test-order/swaps",
{
return_items: [
{
item_id: "test-item",
quantity: 1,
},
],
additional_items: [{ variant_id: "test-variant-2", quantity: 1 }],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(response.status).toEqual(200);
});
it("creates a swap and a return", async () => {
const api = useApi();
const returnedOrderFirst = await api.post(
"/admin/orders/order-with-swap/return",
{
items: [
{
item_id: "test-item-many",
quantity: 2,
},
],
receive_now: true,
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(returnedOrderFirst.status).toEqual(200);
const returnedOrderSecond = await api.post(
"/admin/orders/order-with-swap/return",
{
items: [
{
item_id: "test-item-many",
quantity: 1,
},
],
receive_now: true,
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(returnedOrderSecond.status).toEqual(200);
expect(returnedOrderSecond.data.order.items[1].returned_quantity).toBe(3);
});
it("creates a swap and receives the items", async () => {
const api = useApi();
const createdSwapOrder = await api.post(
"/admin/orders/test-order/swaps",
{
return_items: [
{
item_id: "test-item",
quantity: 1,
},
],
additional_items: [{ variant_id: "test-variant-2", quantity: 1 }],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(createdSwapOrder.status).toEqual(200);
const swap = createdSwapOrder.data.order.swaps[0];
const receivedSwap = await api.post(
`/admin/returns/${swap.return_order.id}/receive`,
{
items: [
{
item_id: "test-item",
quantity: 1,
},
],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(receivedSwap.status).toEqual(200);
expect(receivedSwap.data.return.status).toBe("received");
});
it("creates a swap on a swap", async () => {
const api = useApi();
const swapOnSwap = await api.post(
"/admin/orders/order-with-swap/swaps",
{
return_items: [
{
item_id: "test-item-swapped",
quantity: 1,
},
],
additional_items: [{ variant_id: "test-variant", quantity: 1 }],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(swapOnSwap.status).toEqual(200);
});
it("receives a swap on swap", async () => {
const api = useApi();
const received = await api.post(
`/admin/returns/return-on-swap/receive`,
{
items: [
{
item_id: "test-item-swapped",
quantity: 1,
},
],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(received.status).toEqual(200);
});
it("creates a return on a swap", async () => {
const api = useApi();
const returnOnSwap = await api.post(
"/admin/orders/order-with-swap/return",
{
items: [
{
item_id: "test-item-swapped",
quantity: 1,
},
],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(returnOnSwap.status).toEqual(200);
});
it("creates a return on an order", async () => {
const api = useApi();
const returnOnOrder = await api.post(
"/admin/orders/test-order/return",
{
items: [
{
item_id: "test-item",
quantity: 1,
},
],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(returnOnOrder.status).toEqual(200);
const captured = await api.post(
"/admin/orders/test-order/capture",
{},
{
headers: {
authorization: "Bearer test_token",
},
}
);
const returnId = returnOnOrder.data.order.returns[0].id;
const received = await api.post(
`/admin/returns/${returnId}/receive`,
{
items: [
{
item_id: "test-item",
quantity: 1,
},
],
},
{
headers: {
authorization: "Bearer test_token",
},
}
);
expect(received.status).toEqual(200);
});
});
}); });
@@ -42,6 +42,7 @@ describe("/admin/products", () => {
const manager = dbConnection.manager; const manager = dbConnection.manager;
await manager.query(`DELETE FROM "product_option_value"`); await manager.query(`DELETE FROM "product_option_value"`);
await manager.query(`DELETE FROM "product_option"`); await manager.query(`DELETE FROM "product_option"`);
await manager.query(`DELETE FROM "image"`);
await manager.query(`DELETE FROM "money_amount"`); await manager.query(`DELETE FROM "money_amount"`);
await manager.query(`DELETE FROM "product_variant"`); await manager.query(`DELETE FROM "product_variant"`);
await manager.query(`DELETE FROM "product"`); await manager.query(`DELETE FROM "product"`);
@@ -62,6 +63,7 @@ describe("/admin/products", () => {
title: "Test product", title: "Test product",
description: "test-product-description", description: "test-product-description",
type: { value: "test-type" }, type: { value: "test-type" },
images: ["test-image.png", "test-image-2.png"],
collection_id: "test-collection", collection_id: "test-collection",
tags: [{ value: "123" }, { value: "456" }], tags: [{ value: "123" }, { value: "456" }],
options: [{ title: "size" }, { title: "color" }], options: [{ title: "size" }, { title: "color" }],
@@ -91,6 +93,15 @@ describe("/admin/products", () => {
expect.objectContaining({ expect.objectContaining({
title: "Test product", title: "Test product",
handle: "test-product", handle: "test-product",
images: expect.arrayContaining([
expect.objectContaining({
url: "test-image.png",
}),
expect.objectContaining({
url: "test-image-2.png",
}),
]),
thumbnail: "test-image.png",
tags: [ tags: [
expect.objectContaining({ expect.objectContaining({
value: "123", value: "123",
@@ -137,13 +148,15 @@ describe("/admin/products", () => {
); );
}); });
it("updates a product (update tags, delete collection, delete type)", async () => { it("updates a product (update tags, delete collection, delete type, replaces images)", async () => {
const api = useApi(); const api = useApi();
const payload = { const payload = {
collection_id: null, collection_id: null,
type: null, type: null,
tags: [{ value: "123" }], tags: [{ value: "123" }],
images: ["test-image-2.png"],
type: { value: "test-type-2" },
}; };
const response = await api const response = await api
@@ -160,6 +173,12 @@ describe("/admin/products", () => {
expect(response.data.product).toEqual( expect(response.data.product).toEqual(
expect.objectContaining({ expect.objectContaining({
images: expect.arrayContaining([
expect.objectContaining({
url: "test-image-2.png",
}),
]),
thumbnail: "test-image-2.png",
tags: [ tags: [
expect.objectContaining({ expect.objectContaining({
value: "123", value: "123",
@@ -167,6 +186,9 @@ describe("/admin/products", () => {
], ],
type: null, type: null,
collection: null, collection: null,
type: expect.objectContaining({
value: "test-type-2",
}),
}) })
); );
}); });
@@ -0,0 +1,170 @@
const { dropDatabase } = require("pg-god");
const path = require("path");
const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api");
const { initDb } = require("../../../helpers/use-db");
const adminSeeder = require("../../helpers/admin-seeder");
jest.setTimeout(30000);
describe("/admin/return-reasons", () => {
let medusaProcess;
let dbConnection;
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."));
dbConnection = await initDb({ cwd });
medusaProcess = await setupServer({ cwd });
});
afterAll(async () => {
await dbConnection.close();
await dropDatabase({ databaseName: "medusa-integration" });
medusaProcess.kill();
});
describe("POST /admin/return-reasons", () => {
beforeEach(async () => {
try {
await adminSeeder(dbConnection);
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "return_reason"`);
await manager.query(`DELETE FROM "user"`);
});
it("creates a return_reason", async () => {
const api = useApi();
const payload = {
label: "Too Big",
description: "Use this if the size was too big",
value: "too_big",
};
const response = await api
.post("/admin/return-reasons", payload, {
headers: {
Authorization: "Bearer test_token",
},
})
.catch((err) => {
console.log(err);
});
expect(response.status).toEqual(200);
expect(response.data.return_reason).toEqual(
expect.objectContaining({
label: "Too Big",
description: "Use this if the size was too big",
value: "too_big",
})
);
});
it("update a return reason", async () => {
const api = useApi();
const payload = {
label: "Too Big Typo",
description: "Use this if the size was too big",
value: "too_big",
};
const response = await api
.post("/admin/return-reasons", payload, {
headers: {
Authorization: "Bearer test_token",
},
})
.catch((err) => {
console.log(err);
});
expect(response.status).toEqual(200);
expect(response.data.return_reason).toEqual(
expect.objectContaining({
label: "Too Big Typo",
description: "Use this if the size was too big",
value: "too_big",
})
);
const newResponse = await api
.post(
`/admin/return-reasons/${response.data.return_reason.id}`,
{
label: "Too Big",
description: "new desc",
},
{
headers: {
Authorization: "Bearer test_token",
},
}
)
.catch((err) => {
console.log(err);
});
expect(newResponse.data.return_reason).toEqual(
expect.objectContaining({
label: "Too Big",
description: "new desc",
value: "too_big",
})
);
});
it("list return reasons", async () => {
const api = useApi();
const payload = {
label: "Too Big Typo",
description: "Use this if the size was too big",
value: "too_big",
};
await api
.post("/admin/return-reasons", payload, {
headers: {
Authorization: "Bearer test_token",
},
})
.catch((err) => {
console.log(err);
});
const response = await api
.get("/admin/return-reasons", {
headers: {
Authorization: "Bearer test_token",
},
})
.catch((err) => {
console.log(err);
});
expect(response.status).toEqual(200);
console.log(response.data);
expect(response.data.return_reasons).toEqual([
expect.objectContaining({
value: "too_big",
}),
]);
});
});
});
+118 -17
View File
@@ -14,6 +14,19 @@ describe("/store/carts", () => {
let medusaProcess; let medusaProcess;
let dbConnection; let dbConnection;
const doAfterEach = async (manager) => {
await manager.query(`DELETE FROM "discount"`);
await manager.query(`DELETE FROM "discount_rule"`);
await manager.query(`DELETE FROM "shipping_method"`);
await manager.query(`DELETE FROM "shipping_option"`);
await manager.query(`DELETE FROM "cart"`);
await manager.query(`DELETE FROM "customer"`);
await manager.query(
`UPDATE "country" SET region_id=NULL WHERE iso_2 = 'us'`
);
await manager.query(`DELETE FROM "region"`);
};
beforeAll(async () => { beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", "..")); const cwd = path.resolve(path.join(__dirname, "..", ".."));
dbConnection = await initDb({ cwd }); dbConnection = await initDb({ cwd });
@@ -43,11 +56,7 @@ describe("/store/carts", () => {
afterEach(async () => { afterEach(async () => {
const manager = dbConnection.manager; const manager = dbConnection.manager;
await manager.query(`DELETE FROM "cart"`); await doAfterEach(manager);
await manager.query(
`UPDATE "country" SET region_id=NULL WHERE iso_2 = 'us'`
);
await manager.query(`DELETE FROM "region"`);
}); });
it("creates a cart", async () => { it("creates a cart", async () => {
@@ -72,6 +81,26 @@ describe("/store/carts", () => {
const getRes = await api.post(`/store/carts/${response.data.cart.id}`); const getRes = await api.post(`/store/carts/${response.data.cart.id}`);
expect(getRes.status).toEqual(200); expect(getRes.status).toEqual(200);
}); });
it("creates a cart with context", async () => {
const api = useApi();
const response = await api.post("/store/carts", {
context: {
test_id: "test",
},
});
expect(response.status).toEqual(200);
const getRes = await api.post(`/store/carts/${response.data.cart.id}`);
expect(getRes.status).toEqual(200);
const cart = getRes.data.cart;
expect(cart.context).toEqual({
ip: "::ffff:127.0.0.1",
user_agent: "axios/0.21.1",
test_id: "test",
});
});
}); });
describe("POST /store/carts/:id", () => { describe("POST /store/carts/:id", () => {
@@ -86,12 +115,22 @@ describe("/store/carts", () => {
afterEach(async () => { afterEach(async () => {
const manager = dbConnection.manager; const manager = dbConnection.manager;
await manager.query(`DELETE FROM "cart"`); await doAfterEach(manager);
await manager.query(`DELETE FROM "customer"`); });
await manager.query(
`UPDATE "country" SET region_id=NULL WHERE iso_2 = 'us'` it("fails on apply discount if limit has been reached", async () => {
); const api = useApi();
await manager.query(`DELETE FROM "region"`);
try {
await api.post("/store/carts/test-cart", {
discounts: [{ code: "CREATED" }],
});
} catch (error) {
expect(error.response.status).toEqual(400);
expect(error.response.data.message).toEqual(
"Discount has been used maximum allowed times"
);
}
}); });
it("updates cart customer id", async () => { it("updates cart customer id", async () => {
@@ -103,6 +142,73 @@ describe("/store/carts", () => {
expect(response.status).toEqual(200); expect(response.status).toEqual(200);
}); });
it("adds free shipping to cart then removes it again", async () => {
const api = useApi();
let cart = await api.post(
"/store/carts/test-cart",
{
discounts: [{ code: "FREE_SHIPPING" }, { code: "CREATED" }],
},
{ withCredentials: true }
);
expect(cart.data.cart.shipping_total).toBe(0);
expect(cart.status).toEqual(200);
cart = await api.post(
"/store/carts/test-cart",
{
discounts: [{ code: "CREATED" }],
},
{ withCredentials: true }
);
expect(cart.data.cart.shipping_total).toBe(1000);
expect(cart.status).toEqual(200);
});
});
describe("DELETE /store/carts/:id/discounts/:code", () => {
beforeEach(async () => {
try {
await cartSeeder(dbConnection);
await dbConnection.manager.query(
`INSERT INTO "cart_discounts" (cart_id, discount_id) VALUES ('test-cart', 'free-shipping')`
);
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await doAfterEach(manager);
});
it("removes free shipping and updates shipping total", async () => {
const api = useApi();
const cartWithFreeShipping = await api.post(
"/store/carts/test-cart",
{
discounts: [{ code: "FREE_SHIPPING" }],
},
{ withCredentials: true }
);
expect(cartWithFreeShipping.data.cart.shipping_total).toBe(0);
expect(cartWithFreeShipping.status).toEqual(200);
const response = await api.delete(
"/store/carts/test-cart/discounts/FREE_SHIPPING"
);
expect(response.data.cart.shipping_total).toBe(1000);
expect(response.status).toEqual(200);
});
}); });
describe("get-cart with session customer", () => { describe("get-cart with session customer", () => {
@@ -117,12 +223,7 @@ describe("/store/carts", () => {
afterEach(async () => { afterEach(async () => {
const manager = dbConnection.manager; const manager = dbConnection.manager;
await manager.query(`DELETE FROM "cart"`); await doAfterEach(manager);
await manager.query(`DELETE FROM "customer"`);
await manager.query(
`UPDATE "country" SET region_id=NULL WHERE iso_2 = 'us'`
);
await manager.query(`DELETE FROM "region"`);
}); });
it("updates empty cart.customer_id on cart retrieval", async () => { it("updates empty cart.customer_id on cart retrieval", async () => {
@@ -59,6 +59,7 @@ describe("/store/gift-cards", () => {
code: "GC_TEST", code: "GC_TEST",
value: 200, value: 200,
balance: 120, balance: 120,
region: expect.any(Object),
}); });
}); });
}); });
@@ -0,0 +1,69 @@
const { dropDatabase } = require("pg-god");
const path = require("path");
const { ReturnReason } = require("@medusajs/medusa");
const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api");
const { initDb } = require("../../../helpers/use-db");
jest.setTimeout(30000);
describe("/store/return-reasons", () => {
let medusaProcess;
let dbConnection;
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."));
dbConnection = await initDb({ cwd });
medusaProcess = await setupServer({ cwd });
});
afterAll(async () => {
await dbConnection.close();
await dropDatabase({ databaseName: "medusa-integration" });
medusaProcess.kill();
});
describe("GET /store/return-reasons", () => {
let rrId;
beforeEach(async () => {
try {
const created = dbConnection.manager.create(ReturnReason, {
value: "too_big",
label: "Too Big",
});
const result = await dbConnection.manager.save(created);
rrId = result.id;
} catch (err) {
console.log(err);
throw err;
}
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "return_reason"`);
});
it("list return reasons", async () => {
const api = useApi();
const response = await api.get("/store/return-reasons").catch((err) => {
console.log(err);
});
expect(response.status).toEqual(200);
expect(response.data.return_reasons).toEqual([
expect.objectContaining({
id: rrId,
value: "too_big",
}),
]);
});
});
});
@@ -2,6 +2,7 @@ const { dropDatabase } = require("pg-god");
const path = require("path"); const path = require("path");
const { const {
Region, Region,
ReturnReason,
Order, Order,
Customer, Customer,
ShippingProfile, ShippingProfile,
@@ -35,6 +36,8 @@ describe("/store/carts", () => {
}); });
describe("POST /store/returns", () => { describe("POST /store/returns", () => {
let rrId;
beforeEach(async () => { beforeEach(async () => {
const manager = dbConnection.manager; const manager = dbConnection.manager;
await manager.query( await manager.query(
@@ -110,6 +113,14 @@ describe("/store/carts", () => {
amount: 1000, amount: 1000,
is_return: true, is_return: true,
}); });
const created = dbConnection.manager.create(ReturnReason, {
value: "too_big",
label: "Too Big",
});
const result = await dbConnection.manager.save(created);
rrId = result.id;
}); });
afterEach(async () => { afterEach(async () => {
@@ -117,6 +128,7 @@ describe("/store/carts", () => {
await manager.query(`DELETE FROM "shipping_method"`); await manager.query(`DELETE FROM "shipping_method"`);
await manager.query(`DELETE FROM "shipping_option"`); await manager.query(`DELETE FROM "shipping_option"`);
await manager.query(`DELETE FROM "return_item"`); await manager.query(`DELETE FROM "return_item"`);
await manager.query(`DELETE FROM "return_reason"`);
await manager.query(`DELETE FROM "return"`); await manager.query(`DELETE FROM "return"`);
await manager.query(`DELETE FROM "line_item"`); await manager.query(`DELETE FROM "line_item"`);
await manager.query(`DELETE FROM "order"`); await manager.query(`DELETE FROM "order"`);
@@ -174,5 +186,33 @@ describe("/store/carts", () => {
expect(response.data.return.refund_amount).toEqual(7000); expect(response.data.return.refund_amount).toEqual(7000);
}); });
it("creates a return with reasons", async () => {
const api = useApi();
const response = await api
.post("/store/returns", {
order_id: "order_test",
items: [
{
reason_id: rrId,
note: "TOO small",
item_id: "test-item",
quantity: 1,
},
],
})
.catch((err) => {
return err.response;
});
expect(response.status).toEqual(200);
expect(response.data.return.items).toEqual([
expect.objectContaining({
reason_id: rrId,
note: "TOO small",
}),
]);
});
}); });
}); });
@@ -0,0 +1,134 @@
const { dropDatabase } = require("pg-god");
const path = require("path");
const { Region, ShippingProfile, ShippingOption } = require("@medusajs/medusa");
const setupServer = require("../../../helpers/setup-server");
const { useApi } = require("../../../helpers/use-api");
const { initDb } = require("../../../helpers/use-db");
jest.setTimeout(30000);
describe("/store/shipping-options", () => {
let medusaProcess;
let dbConnection;
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", ".."));
dbConnection = await initDb({ cwd });
medusaProcess = await setupServer({ cwd });
});
afterAll(async () => {
dbConnection.close();
await dropDatabase({ databaseName: "medusa-integration" });
medusaProcess.kill();
});
describe("POST /store/shipping-options", () => {
beforeEach(async () => {
const manager = dbConnection.manager;
await manager.query(
`ALTER SEQUENCE order_display_id_seq RESTART WITH 111`
);
await manager.insert(Region, {
id: "region",
name: "Test Region",
currency_code: "usd",
tax_rate: 0,
});
await manager.insert(Region, {
id: "region2",
name: "Test Region 2",
currency_code: "usd",
tax_rate: 0,
});
const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
});
await manager.insert(ShippingOption, {
id: "test-out",
name: "Test out",
profile_id: defaultProfile.id,
region_id: "region",
provider_id: "test-ful",
data: {},
price_type: "flat_rate",
amount: 2000,
is_return: false,
});
await manager.insert(ShippingOption, {
id: "test-return",
name: "Test ret",
profile_id: defaultProfile.id,
region_id: "region",
provider_id: "test-ful",
data: {},
price_type: "flat_rate",
amount: 1000,
is_return: true,
});
await manager.insert(ShippingOption, {
id: "test-region2",
name: "Test region 2",
profile_id: defaultProfile.id,
region_id: "region2",
provider_id: "test-ful",
data: {},
price_type: "flat_rate",
amount: 1000,
is_return: false,
});
});
afterEach(async () => {
const manager = dbConnection.manager;
await manager.query(`DELETE FROM "shipping_option"`);
await manager.query(`DELETE FROM "region"`);
});
it("retrieves all shipping options", async () => {
const api = useApi();
const response = await api.get("/store/shipping-options").catch((err) => {
return err.response;
});
expect(response.status).toEqual(200);
expect(response.data.shipping_options.length).toEqual(3);
});
it("creates a return with shipping method", async () => {
const api = useApi();
const response = await api
.get("/store/shipping-options?is_return=true")
.catch((err) => {
return err.response;
});
expect(response.status).toEqual(200);
expect(response.data.shipping_options.length).toEqual(1);
expect(response.data.shipping_options[0].id).toEqual("test-return");
});
it("creates a return with shipping method", async () => {
const api = useApi();
const response = await api
.get("/store/shipping-options?region_id=region2")
.catch((err) => {
return err.response;
});
expect(response.status).toEqual(200);
expect(response.data.shipping_options.length).toEqual(1);
expect(response.data.shipping_options[0].id).toEqual("test-region2");
});
});
});
+74 -2
View File
@@ -1,15 +1,68 @@
const { Customer, Region, Cart } = require("@medusajs/medusa"); const {
Customer,
Region,
Cart,
DiscountRule,
Discount,
ShippingProfile,
ShippingOption,
ShippingMethod,
} = require("@medusajs/medusa");
module.exports = async (connection, data = {}) => { module.exports = async (connection, data = {}) => {
const manager = connection.manager; const manager = connection.manager;
await manager.insert(Region, { const defaultProfile = await manager.findOne(ShippingProfile, {
type: "default",
});
const r = manager.create(Region, {
id: "test-region", id: "test-region",
name: "Test Region", name: "Test Region",
currency_code: "usd", currency_code: "usd",
tax_rate: 0, tax_rate: 0,
}); });
const freeRule = manager.create(DiscountRule, {
id: "free-shipping-rule",
description: "Free shipping rule",
type: "free_shipping",
value: 100,
allocation: "total",
});
const freeDisc = manager.create(Discount, {
id: "free-shipping",
code: "FREE_SHIPPING",
is_dynamic: false,
is_disabled: false,
});
freeDisc.regions = [r];
freeDisc.rule = freeRule;
await manager.save(freeDisc);
const d = await manager.create(Discount, {
id: "test-discount",
code: "CREATED",
is_dynamic: false,
is_disabled: false,
});
const dr = await manager.create(DiscountRule, {
id: "test-discount-rule",
description: "Created",
type: "fixed",
value: 10000,
allocation: "total",
});
d.rule = dr;
d.regions = [r];
await manager.save(d);
await manager.query( await manager.query(
`UPDATE "country" SET region_id='test-region' WHERE iso_2 = 'us'` `UPDATE "country" SET region_id='test-region' WHERE iso_2 = 'us'`
); );
@@ -29,6 +82,17 @@ module.exports = async (connection, data = {}) => {
email: "some-customer@email.com", email: "some-customer@email.com",
}); });
await manager.insert(ShippingOption, {
id: "test-option",
name: "test-option",
provider_id: "test-ful",
region_id: "test-region",
profile_id: defaultProfile.id,
price_type: "flat_rate",
amount: 1000,
data: {},
});
const cart = manager.create(Cart, { const cart = manager.create(Cart, {
id: "test-cart", id: "test-cart",
customer_id: "some-customer", customer_id: "some-customer",
@@ -44,4 +108,12 @@ module.exports = async (connection, data = {}) => {
}); });
await manager.save(cart); await manager.save(cart);
await manager.insert(ShippingMethod, {
id: "test-method",
shipping_option_id: "test-option",
cart_id: "test-cart",
price: 1000,
data: {},
});
}; };
+52 -13
View File
@@ -10,6 +10,7 @@ const {
ProductVariant, ProductVariant,
Region, Region,
Order, Order,
Swap,
} = require("@medusajs/medusa"); } = require("@medusajs/medusa");
module.exports = async (connection, data = {}) => { module.exports = async (connection, data = {}) => {
@@ -39,6 +40,26 @@ module.exports = async (connection, data = {}) => {
], ],
}); });
await manager.insert(ProductVariant, {
id: "test-variant-2",
title: "Swap product",
product_id: "test-product",
inventory_quantity: 1,
options: [
{
option_id: "test-option",
value: "Large",
},
],
});
const ma2 = manager.create(MoneyAmount, {
variant_id: "test-variant-2",
currency_code: "usd",
amount: 8000,
});
await manager.save(ma2);
const ma = manager.create(MoneyAmount, { const ma = manager.create(MoneyAmount, {
variant_id: "test-variant", variant_id: "test-variant",
currency_code: "usd", currency_code: "usd",
@@ -73,10 +94,24 @@ module.exports = async (connection, data = {}) => {
data: {}, data: {},
}); });
await manager.insert(ShippingOption, {
id: "test-return-option",
name: "Test ret",
profile_id: defaultProfile.id,
region_id: "test-region",
provider_id: "test-ful",
data: {},
price_type: "flat_rate",
amount: 1000,
is_return: true,
});
const order = manager.create(Order, { const order = manager.create(Order, {
id: "test-order", id: "test-order",
customer_id: "test-customer", customer_id: "test-customer",
email: "test@email.com", email: "test@email.com",
payment_status: "captured",
fulfillment_status: "fulfilled",
billing_address: { billing_address: {
id: "test-billing-address", id: "test-billing-address",
first_name: "lebron", first_name: "lebron",
@@ -115,27 +150,31 @@ module.exports = async (connection, data = {}) => {
amount: 10000, amount: 10000,
currency_code: "usd", currency_code: "usd",
amount_refunded: 0, amount_refunded: 0,
provider_id: "test", provider_id: "test-pay",
data: {}, data: {},
}, },
], ],
items: [ items: [],
{
id: "test-item",
fulfilled_quantity: 1,
title: "Line Item",
description: "Line Item Desc",
thumbnail: "https://test.js/1234",
unit_price: 8000,
quantity: 1,
variant_id: "test-variant",
},
],
...data, ...data,
}); });
await manager.save(order); await manager.save(order);
const li = manager.create(LineItem, {
id: "test-item",
fulfilled_quantity: 1,
returned_quantity: 0,
title: "Line Item",
description: "Line Item Desc",
thumbnail: "https://test.js/1234",
unit_price: 8000,
quantity: 1,
variant_id: "test-variant",
order_id: "test-order",
});
await manager.save(li);
await manager.insert(ShippingMethod, { await manager.insert(ShippingMethod, {
id: "test-method", id: "test-method",
order_id: "test-order", order_id: "test-order",
@@ -6,6 +6,7 @@ const {
Product, Product,
ShippingProfile, ShippingProfile,
ProductVariant, ProductVariant,
Image,
} = require("@medusajs/medusa"); } = require("@medusajs/medusa");
module.exports = async (connection, data = {}) => { module.exports = async (connection, data = {}) => {
@@ -36,6 +37,13 @@ module.exports = async (connection, data = {}) => {
await manager.save(type); await manager.save(type);
const image = manager.create(Image, {
id: "test-image",
url: "test-image.png",
});
await manager.save(image);
await manager.insert(Region, { await manager.insert(Region, {
id: "test-region", id: "test-region",
name: "Test Region", name: "Test Region",
@@ -43,7 +51,7 @@ module.exports = async (connection, data = {}) => {
tax_rate: 0, tax_rate: 0,
}); });
await manager.insert(Product, { const p = manager.create(Product, {
id: "test-product", id: "test-product",
title: "Test product", title: "Test product",
profile_id: defaultProfile.id, profile_id: defaultProfile.id,
@@ -57,6 +65,10 @@ module.exports = async (connection, data = {}) => {
options: [{ id: "test-option", title: "Default value" }], options: [{ id: "test-option", title: "Default value" }],
}); });
p.images = [image];
await manager.save(p);
await manager.insert(ProductVariant, { await manager.insert(ProductVariant, {
id: "test-variant", id: "test-variant",
inventory_quantity: 10, inventory_quantity: 10,
@@ -0,0 +1,159 @@
const {
ShippingProfile,
Customer,
MoneyAmount,
LineItem,
Country,
ShippingOption,
ShippingMethod,
Product,
ProductVariant,
Region,
Order,
Swap,
Return,
} = require("@medusajs/medusa");
module.exports = async (connection, data = {}) => {
const manager = connection.manager;
let orderWithSwap = manager.create(Order, {
id: "order-with-swap",
customer_id: "test-customer",
email: "test@email.com",
payment_status: "captured",
fulfillment_status: "fulfilled",
billing_address: {
id: "test-billing-address",
first_name: "lebron",
},
shipping_address: {
id: "test-shipping-address",
first_name: "lebron",
country_code: "us",
},
region_id: "test-region",
currency_code: "usd",
tax_rate: 0,
discounts: [],
payments: [
{
id: "test-payment",
amount: 10000,
currency_code: "usd",
amount_refunded: 0,
provider_id: "test",
data: {},
},
],
items: [],
...data,
});
orderWithSwap = await manager.save(orderWithSwap);
const li = manager.create(LineItem, {
id: "test-item-2",
fulfilled_quantity: 1,
title: "Line Item",
description: "Line Item Desc",
thumbnail: "https://test.js/1234",
unit_price: 8000,
quantity: 1,
variant_id: "test-variant",
order_id: orderWithSwap.id,
});
await manager.save(li);
const li2 = manager.create(LineItem, {
id: "test-item-many",
fulfilled_quantity: 4,
title: "Line Item",
description: "Line Item Desc",
thumbnail: "https://test.js/1234",
unit_price: 8000,
quantity: 4,
variant_id: "test-variant",
order_id: orderWithSwap.id,
});
await manager.save(li2);
const swap = manager.create(Swap, {
id: "test-swap",
order_id: "order-with-swap",
payment_status: "captured",
fulfillment_status: "fulfilled",
payment: {
id: "test-payment-swap",
amount: 10000,
currency_code: "usd",
amount_refunded: 0,
provider_id: "test",
data: {},
},
additional_items: [
{
id: "test-item-swapped",
fulfilled_quantity: 1,
title: "Line Item",
description: "Line Item Desc",
thumbnail: "https://test.js/1234",
unit_price: 8000,
quantity: 1,
variant_id: "test-variant-2",
},
],
});
await manager.save(swap);
const swapOnSwap = manager.create(Swap, {
id: "swap-on-swap",
order_id: "order-with-swap",
payment_status: "captured",
fulfillment_status: "fulfilled",
return_order: {
id: "return-on-swap",
refund_amount: 9000,
items: [
{
return_id: "return-on-swap",
item_id: "test-item-swapped",
quantity: 1,
},
],
},
payment: {
id: "test-payment-swap-on-swap",
amount: 10000,
currency_code: "usd",
amount_refunded: 0,
provider_id: "test",
data: {},
},
additional_items: [
{
id: "test-item-swap-on-swap",
fulfilled_quantity: 1,
title: "Line Item",
description: "Line Item Desc",
thumbnail: "https://test.js/1234",
unit_price: 8000,
quantity: 1,
variant_id: "test-variant",
},
],
});
await manager.save(swapOnSwap);
await manager.insert(ShippingMethod, {
id: "test-method-swap-order",
shipping_option_id: "test-option",
order_id: "order-with-swap",
price: 1000,
data: {},
});
};
+3 -9
View File
@@ -1,13 +1,7 @@
const glob = require(`glob`); // API
const pkgs = glob
.sync(`${__dirname}/*/`)
.map((p) => p.replace(__dirname, `<rootDir>/integration-tests`));
module.exports = { module.exports = {
testEnvironment: `node`, testEnvironment: `node`,
rootDir: `../`,
roots: pkgs,
testPathIgnorePatterns: [ testPathIgnorePatterns: [
`/examples/`, `/examples/`,
`/www/`, `/www/`,
@@ -17,6 +11,6 @@ module.exports = {
`__testfixtures__`, `__testfixtures__`,
`.cache`, `.cache`,
], ],
transform: { "^.+\\.[jt]s$": `<rootDir>/jest-transformer.js` }, transform: { "^.+\\.[jt]s$": `../../jest-transformer.js` },
setupFilesAfterEnv: ["<rootDir>/integration-tests/setup.js"], setupFilesAfterEnv: ["../setup.js"],
}; };
+5 -3
View File
@@ -4,17 +4,19 @@
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "jest --runInBand",
"build": "babel src -d dist --extensions \".ts,.js\"" "build": "babel src -d dist --extensions \".ts,.js\""
}, },
"dependencies": { "dependencies": {
"@medusajs/medusa": "^1.1.3", "@medusajs/medusa": "1.1.19-dev-1618904018564",
"medusa-interfaces": "^1.1.0", "medusa-interfaces": "1.1.7-dev-1618904018564",
"typeorm": "^0.2.31" "typeorm": "^0.2.31"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.12.10", "@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10", "@babel/core": "^7.12.10",
"@babel/node": "^7.12.10", "@babel/node": "^7.12.10",
"babel-preset-medusa-package": "^1.1.0" "babel-preset-medusa-package": "1.1.0-dev-1618904018564",
"jest": "^26.6.3"
} }
} }
File diff suppressed because it is too large. Load diff
+4 -2
View File
@@ -1,12 +1,14 @@
const path = require("path"); const path = require("path");
const express = require("express"); const express = require("express");
const getPort = require("get-port"); const getPort = require("get-port");
const importFrom = require("import-from");
const loaders = require("@medusajs/medusa/dist/loaders").default;
const initialize = async () => { const initialize = async () => {
const app = express(); const app = express();
const loaders = importFrom(process.cwd(), "@medusajs/medusa/dist/loaders")
.default;
const { dbConnection } = await loaders({ const { dbConnection } = await loaders({
directory: path.resolve(process.cwd()), directory: path.resolve(process.cwd()),
expressApp: app, expressApp: app,
+1 -1
View File
@@ -5,7 +5,7 @@
], ],
"command": { "command": {
"publish": { "publish": {
"allowBranch": "release/*", "allowBranch": ["master", "release/*"],
"bump": "patch", "bump": "patch",
"conventionalCommits": true, "conventionalCommits": true,
"message": "chore(release): Publish" "message": "chore(release): Publish"
+2
View File
@@ -18,6 +18,7 @@
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"express": "^4.17.1", "express": "^4.17.1",
"get-port": "^5.1.1", "get-port": "^5.1.1",
"import-from": "^3.0.0",
"jest": "^26.6.3", "jest": "^26.6.3",
"lerna": "^3.22.1", "lerna": "^3.22.1",
"mongoose": "^5.10.15", "mongoose": "^5.10.15",
@@ -35,6 +36,7 @@
"test:fixtures": "jest --config=docs-util/jest.config.js --runInBand" "test:fixtures": "jest --config=docs-util/jest.config.js --runInBand"
}, },
"dependencies": { "dependencies": {
"import-from": "^3.0.0",
"oas-normalize": "^2.3.1", "oas-normalize": "^2.3.1",
"swagger-inline": "^3.2.2" "swagger-inline": "^3.2.2"
} }
@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.3](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.0...babel-preset-medusa-package@1.1.3) (2021-04-28)
**Note:** Version bump only for package babel-preset-medusa-package
## [1.1.2](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.1...babel-preset-medusa-package@1.1.2) (2021-04-20)
**Note:** Version bump only for package babel-preset-medusa-package
## [1.1.1](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.0...babel-preset-medusa-package@1.1.1) (2021-04-20)
**Note:** Version bump only for package babel-preset-medusa-package
# [1.1.0](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.0.1...babel-preset-medusa-package@1.1.0) (2021-01-26) # [1.1.0](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.0.1...babel-preset-medusa-package@1.1.0) (2021-01-26)
**Note:** Version bump only for package babel-preset-medusa-package **Note:** Version bump only for package babel-preset-medusa-package
@@ -1,6 +1,6 @@
{ {
"name": "babel-preset-medusa-package", "name": "babel-preset-medusa-package",
"version": "1.1.0", "version": "1.1.3",
"author": "Sebastian Rindom <sebastian@mrbltech.com>", "author": "Sebastian Rindom <sebastian@mrbltech.com>",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -26,5 +26,5 @@
"engines": { "engines": {
"node": ">=10.14.0" "node": ">=10.14.0"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
+2
View File
@@ -1,2 +1,4 @@
dist/ dist/
node_modules/ node_modules/
.env
+1
View File
@@ -3,3 +3,4 @@ src
.eslintrc .eslintrc
.gitignore .gitignore
.prettierrc .prettierrc
.env
+62
View File
@@ -3,6 +3,68 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.8](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.7...@medusajs/medusa-cli@1.1.8) (2021-05-05)
**Note:** Version bump only for package @medusajs/medusa-cli
## [1.1.7](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.4...@medusajs/medusa-cli@1.1.7) (2021-04-28)
**Note:** Version bump only for package @medusajs/medusa-cli
## [1.1.6](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.5...@medusajs/medusa-cli@1.1.6) (2021-04-20)
**Note:** Version bump only for package @medusajs/medusa-cli
## [1.1.5](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.4...@medusajs/medusa-cli@1.1.5) (2021-04-20)
**Note:** Version bump only for package @medusajs/medusa-cli
## [1.1.4](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.3...@medusajs/medusa-cli@1.1.4) (2021-03-17)
**Note:** Version bump only for package @medusajs/medusa-cli
## [1.1.3](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.0...@medusajs/medusa-cli@1.1.3) (2021-03-17)
### Features
* dev cli ([#203](https://github.com/medusajs/medusa/issues/203)) ([695b1fd](https://github.com/medusajs/medusa/commit/695b1fd0a54a247502cb48ffb73d060356293b76)), closes [#199](https://github.com/medusajs/medusa/issues/199)
## [1.1.2](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.0...@medusajs/medusa-cli@1.1.2) (2021-03-17)
### Features
* dev cli ([#203](https://github.com/medusajs/medusa/issues/203)) ([695b1fd](https://github.com/medusajs/medusa/commit/695b1fd0a54a247502cb48ffb73d060356293b76)), closes [#199](https://github.com/medusajs/medusa/issues/199)
# [1.1.0](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.0.11...@medusajs/medusa-cli@1.1.0) (2021-01-26) # [1.1.0](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.0.11...@medusajs/medusa-cli@1.1.0) (2021-01-26)
**Note:** Version bump only for package @medusajs/medusa-cli **Note:** Version bump only for package @medusajs/medusa-cli
+3
View File
@@ -0,0 +1,3 @@
#!/usr/bin/env node
require("./dist/index.js")
+38 -30
View File
@@ -1,6 +1,6 @@
{ {
"name": "medusa-cli", "name": "medusa-cli",
"version": "1.1.0", "version": "1.1.8",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -1795,11 +1795,6 @@
} }
} }
}, },
"arch": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/arch/-/arch-2.1.2.tgz",
"integrity": "sha512-NTBIIbAfkJeIletyABbVtdPgeKfDafR+1mZV/AyyfC1UkVkp9iUjV+wwmqtUgphHYajbI86jejBJp5e+jkGTiQ=="
},
"argparse": { "argparse": {
"version": "1.0.10", "version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@@ -2298,16 +2293,6 @@
"integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==", "integrity": "sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw==",
"dev": true "dev": true
}, },
"clipboardy": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-2.3.0.tgz",
"integrity": "sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==",
"requires": {
"arch": "^2.1.1",
"execa": "^1.0.0",
"is-wsl": "^2.1.1"
}
},
"cliui": { "cliui": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
@@ -2437,6 +2422,7 @@
"version": "6.0.5", "version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
"integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
"dev": true,
"requires": { "requires": {
"nice-try": "^1.0.4", "nice-try": "^1.0.4",
"path-key": "^2.0.1", "path-key": "^2.0.1",
@@ -2631,6 +2617,7 @@
"version": "1.4.4", "version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
"dev": true,
"requires": { "requires": {
"once": "^1.4.0" "once": "^1.4.0"
} }
@@ -2919,6 +2906,7 @@
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz",
"integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==",
"dev": true,
"requires": { "requires": {
"cross-spawn": "^6.0.0", "cross-spawn": "^6.0.0",
"get-stream": "^4.0.0", "get-stream": "^4.0.0",
@@ -3287,6 +3275,7 @@
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
"dev": true,
"requires": { "requires": {
"pump": "^3.0.0" "pump": "^3.0.0"
} }
@@ -3665,7 +3654,9 @@
"is-docker": { "is-docker": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.0.0.tgz", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.0.0.tgz",
"integrity": "sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ==" "integrity": "sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ==",
"dev": true,
"optional": true
}, },
"is-extendable": { "is-extendable": {
"version": "0.1.1", "version": "0.1.1",
@@ -3732,7 +3723,8 @@
"is-stream": { "is-stream": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
"integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=",
"dev": true
}, },
"is-typedarray": { "is-typedarray": {
"version": "1.0.0", "version": "1.0.0",
@@ -3750,6 +3742,8 @@
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"dev": true,
"optional": true,
"requires": { "requires": {
"is-docker": "^2.0.0" "is-docker": "^2.0.0"
} }
@@ -3763,7 +3757,8 @@
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true
}, },
"isobject": { "isobject": {
"version": "3.0.1", "version": "3.0.1",
@@ -5150,7 +5145,8 @@
"nice-try": { "nice-try": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
}, },
"node-int64": { "node-int64": {
"version": "0.4.0", "version": "0.4.0",
@@ -5215,6 +5211,7 @@
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz",
"integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=",
"dev": true,
"requires": { "requires": {
"path-key": "^2.0.0" "path-key": "^2.0.0"
} }
@@ -5302,6 +5299,7 @@
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"dev": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@@ -5344,7 +5342,8 @@
"p-finally": { "p-finally": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=",
"dev": true
}, },
"p-limit": { "p-limit": {
"version": "2.3.0", "version": "2.3.0",
@@ -5421,7 +5420,8 @@
"path-key": { "path-key": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
"dev": true
}, },
"path-parse": { "path-parse": {
"version": "1.0.6", "version": "1.0.6",
@@ -5540,6 +5540,7 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
"dev": true,
"requires": { "requires": {
"end-of-stream": "^1.1.0", "end-of-stream": "^1.1.0",
"once": "^1.3.1" "once": "^1.3.1"
@@ -5935,7 +5936,8 @@
"semver": { "semver": {
"version": "5.7.1", "version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
}, },
"set-blocking": { "set-blocking": {
"version": "2.0.0", "version": "2.0.0",
@@ -5969,6 +5971,7 @@
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
"integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
"dev": true,
"requires": { "requires": {
"shebang-regex": "^1.0.0" "shebang-regex": "^1.0.0"
} }
@@ -5976,7 +5979,8 @@
"shebang-regex": { "shebang-regex": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
"dev": true
}, },
"shellwords": { "shellwords": {
"version": "0.1.1", "version": "0.1.1",
@@ -5988,7 +5992,8 @@
"signal-exit": { "signal-exit": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==" "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
"dev": true
}, },
"sisteransi": { "sisteransi": {
"version": "1.0.5", "version": "1.0.5",
@@ -6357,7 +6362,8 @@
"strip-eof": { "strip-eof": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
"dev": true
}, },
"strip-final-newline": { "strip-final-newline": {
"version": "2.0.0", "version": "2.0.0",
@@ -6846,6 +6852,7 @@
"version": "1.3.1", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
"dev": true,
"requires": { "requires": {
"isexe": "^2.0.0" "isexe": "^2.0.0"
} }
@@ -6874,7 +6881,8 @@
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true
}, },
"write": { "write": {
"version": "1.0.3", "version": "1.0.3",
@@ -6916,9 +6924,9 @@
"dev": true "dev": true
}, },
"y18n": { "y18n": {
"version": "4.0.0", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ=="
}, },
"yargs": { "yargs": {
"version": "15.3.1", "version": "15.3.1",
+3 -3
View File
@@ -1,10 +1,10 @@
{ {
"name": "@medusajs/medusa-cli", "name": "@medusajs/medusa-cli",
"version": "1.1.0", "version": "1.1.8",
"description": "Command Line interface for Medusa Commerce", "description": "Command Line interface for Medusa Commerce",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {
"medusa": "dist/index.js" "medusa": "cli.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -48,5 +48,5 @@
"resolve-cwd": "^3.0.0", "resolve-cwd": "^3.0.0",
"yargs": "^15.3.1" "yargs": "^15.3.1"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
+3 -3
View File
@@ -4905,9 +4905,9 @@ xmlchars@^2.1.1:
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==
y18n@^4.0.0: y18n@^4.0.0:
version "4.0.0" version "4.0.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==
yargs-parser@^18.1.1: yargs-parser@^18.1.1:
version "18.1.3" version "18.1.3"
+83
View File
@@ -3,6 +3,89 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.6...medusa-core-utils@1.1.9) (2021-04-28)
**Note:** Version bump only for package medusa-core-utils
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.7...medusa-core-utils@1.1.8) (2021-04-20)
**Note:** Version bump only for package medusa-core-utils
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.6...medusa-core-utils@1.1.7) (2021-04-20)
**Note:** Version bump only for package medusa-core-utils
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.5...medusa-core-utils@1.1.6) (2021-04-13)
**Note:** Version bump only for package medusa-core-utils
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.4...medusa-core-utils@1.1.5) (2021-04-09)
**Note:** Version bump only for package medusa-core-utils
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.3...medusa-core-utils@1.1.4) (2021-03-30)
### Bug Fixes
* don't divide zero decimal currencies ([cfab2d4](https://github.com/medusajs/medusa/commit/cfab2d408a296a938266d0989b1de67d060b2ed5))
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.2...medusa-core-utils@1.1.3) (2021-03-17)
**Note:** Version bump only for package medusa-core-utils
## [1.1.2](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.0...medusa-core-utils@1.1.2) (2021-03-17)
### Features
* **medusa:** Add support for filtering with gt, lt, gte and lte ([#190](https://github.com/medusajs/medusa/issues/190)) ([dd0491f](https://github.com/medusajs/medusa/commit/dd0491f52132aed24f642589b12fcf636b719580))
* **medusa:** cart context ([#201](https://github.com/medusajs/medusa/issues/201)) ([dd7b306](https://github.com/medusajs/medusa/commit/dd7b306333fbe1042f5cf2bed614bce84ea9475f))
## [1.1.1](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.0...medusa-core-utils@1.1.1) (2021-03-17)
### Features
* **medusa:** Add support for filtering with gt, lt, gte and lte ([#190](https://github.com/medusajs/medusa/issues/190)) ([dd0491f](https://github.com/medusajs/medusa/commit/dd0491f52132aed24f642589b12fcf636b719580))
* **medusa:** cart context ([#201](https://github.com/medusajs/medusa/issues/201)) ([dd7b306](https://github.com/medusajs/medusa/commit/dd7b306333fbe1042f5cf2bed614bce84ea9475f))
# [1.1.0](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.0.11...medusa-core-utils@1.1.0) (2021-01-26) # [1.1.0](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.0.11...medusa-core-utils@1.1.0) (2021-01-26)
**Note:** Version bump only for package medusa-core-utils **Note:** Version bump only for package medusa-core-utils
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "medusa-core-utils", "name": "medusa-core-utils",
"version": "1.1.0", "version": "1.1.9",
"description": "Core utils for Medusa", "description": "Core utils for Medusa",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
@@ -17,13 +17,13 @@
"author": "Sebastian Rindom", "author": "Sebastian Rindom",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.7.5", "@babel/cli": "^7.13.0",
"@babel/core": "^7.7.5", "@babel/core": "^7.13.8",
"@babel/plugin-proposal-class-properties": "^7.7.4", "@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-transform-classes": "^7.9.5", "@babel/plugin-transform-classes": "^7.9.5",
"@babel/plugin-transform-runtime": "^7.7.6", "@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.5", "@babel/preset-env": "^7.13.9",
"@babel/runtime": "^7.9.6", "@babel/runtime": "^7.13.9",
"cross-env": "^5.2.1", "cross-env": "^5.2.1",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"jest": "^25.5.2", "jest": "^25.5.2",
@@ -33,5 +33,5 @@
"joi": "^17.3.0", "joi": "^17.3.0",
"joi-objectid": "^3.0.1" "joi-objectid": "^3.0.1"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -0,0 +1,13 @@
import zeroDecimalCurrencies from "./zero-decimal-currencies"
const humanizeAmount = (amount, currency) => {
let divisor = 100
if (zeroDecimalCurrencies.includes(currency.toLowerCase())) {
divisor = 1
}
return amount / divisor
}
export default humanizeAmount
+2
View File
@@ -5,3 +5,5 @@ export { default as MedusaError } from "./errors"
export { default as getConfigFile } from "./get-config-file" export { default as getConfigFile } from "./get-config-file"
export { default as createRequireFromPath } from "./create-require-from-path" export { default as createRequireFromPath } from "./create-require-from-path"
export { default as compareObjectsByProp } from "./compare-objects" export { default as compareObjectsByProp } from "./compare-objects"
export { default as zeroDecimalCurrencies } from "./zero-decimal-currencies"
export { default as humanizeAmount } from "./humanize-amount"
@@ -0,0 +1,20 @@
const zeroDecimalCurrencies = [
"bif",
"clp",
"djf",
"gnf",
"jpy",
"kmf",
"krw",
"mga",
"pyg",
"rwf",
"ugx",
"vnd",
"vuv",
"xaf",
"xof",
"xpf",
]
export default zeroDecimalCurrencies
File diff suppressed because it is too large. Load diff
+3
View File
@@ -0,0 +1,3 @@
{
"presets": [["babel-preset-medusa-package"]]
}
+33
View File
@@ -0,0 +1,33 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
decls
dist
# verdaccio local storage
verdaccio
+3
View File
@@ -0,0 +1,3 @@
src
flow-typed
verdaccio
+66
View File
@@ -0,0 +1,66 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.0.8](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.5...medusa-dev-cli@0.0.8) (2021-04-28)
**Note:** Version bump only for package medusa-dev-cli
## [0.0.7](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.6...medusa-dev-cli@0.0.7) (2021-04-20)
**Note:** Version bump only for package medusa-dev-cli
## [0.0.6](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.5...medusa-dev-cli@0.0.6) (2021-04-20)
**Note:** Version bump only for package medusa-dev-cli
## [0.0.5](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.4...medusa-dev-cli@0.0.5) (2021-04-13)
### Bug Fixes
* working ([a9b1d75](https://github.com/medusajs/medusa/commit/a9b1d75074d2786df6dfca9064b3d9657a664d6d))
* yarn lon ([3c49467](https://github.com/medusajs/medusa/commit/3c4946762c25220c18913f46537f777a55a209ec))
## [0.0.4](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.3...medusa-dev-cli@0.0.4) (2021-03-17)
**Note:** Version bump only for package medusa-dev-cli
## 0.0.3 (2021-03-17)
### Features
* dev cli ([#203](https://github.com/medusajs/medusa/issues/203)) ([695b1fd](https://github.com/medusajs/medusa/commit/695b1fd0a54a247502cb48ffb73d060356293b76)), closes [#199](https://github.com/medusajs/medusa/issues/199)
## 0.0.2 (2021-03-17)
### Features
* dev cli ([#203](https://github.com/medusajs/medusa/issues/203)) ([695b1fd](https://github.com/medusajs/medusa/commit/695b1fd0a54a247502cb48ffb73d060356293b76)), closes [#199](https://github.com/medusajs/medusa/issues/199)
+74
View File
@@ -0,0 +1,74 @@
# medusa-dev-cli
A command-line tool for local Medusa development. When doing development work on
Medusa core, this tool allows you to copy the changes to the various
Medusa packages to Medusa projects.
## Install
`npm install -g medusa-dev-cli`
## Configuration / First time setup
The medusa-dev-cli tool needs to know where your cloned Medusa repository is
located. You typically only need to configure this once.
`medusa-dev --set-path-to-repo /path/to/my/cloned/version/medusa`
## How to use
Navigate to the project you want to link to your forked Medusa repository and
run:
`medusa-dev`
The tool will then scan your project's package.json to find its Medusa
dependencies and copy the latest source from your cloned version of Medusa into
your project's node_modules folder. A watch task is then created to re-copy any
modules that might change while you're working on the code, so you can leave
this program running.
Typically you'll also want to run `npm run watch` in the Medusa repo to set up
watchers to build Medusa source code.
## Revert to current packages
If you've recently run `medusa-dev` your `node_modules` will be out of sync with current published packages. In order to undo this, you can remove the `node_modules` directory or run:
```shell
git checkout package.json; yarn --force
```
or
```shell
git checkout package.json; npm install --force
```
### Other commands
#### `--packages`
You can prevent the automatic dependencies scan and instead specify a list of
packages you want to link by using the `--packages` option:
`medusa-dev --packages @medusajs/medusa medusa-interfaces`
#### `--scan-once`
With this flag, the tool will do an initial scan and copy and then quit. This is
useful for setting up automated testing/builds of Medusa projects from the latest
code.
#### `--quiet`
Don't output anything except for a success message when used together with
`--scan-once`.
#### `--copy-all`
Copy all modules/files in the medusa source repo in packages/
#### `--force-install`
Disables copying files into node_modules and forces usage of local npm repository.
+51
View File
@@ -0,0 +1,51 @@
{
"name": "medusa-dev-cli",
"description": "CLI helpers for contributors working on Medusa",
"version": "0.0.8",
"author": "Sebastian Rindom <skrindom@gmail.com>",
"bin": {
"medusa-dev": "./dist/index.js"
},
"dependencies": {
"@babel/runtime": "^7.12.5",
"chokidar": "^3.5.0",
"configstore": "^5.0.1",
"del": "^6.0.0",
"execa": "^4.1.0",
"find-yarn-workspace-root": "^2.0.0",
"fs-extra": "^9.0.1",
"got": "^10.7.0",
"is-absolute": "^1.0.0",
"lodash": "^4.17.21",
"signal-exit": "^3.0.3",
"verdaccio": "^4.10.0",
"yargs": "^15.4.1"
},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"babel-preset-medusa-package": "^1.1.3",
"cross-env": "^7.0.3"
},
"homepage": "https://github.com/medusajs/medusa/tree/master/packages/medusa-dev-cli#readme",
"keywords": [
"medusa"
],
"license": "MIT",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/medusajs/medusa.git",
"directory": "packages/medusa-dev-cli"
},
"scripts": {
"build": "babel src --out-dir dist --ignore \"**/__tests__\"",
"prepare": "cross-env NODE_ENV=production npm run build",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "babel -w src --out-dir dist --ignore \"**/__tests__\""
},
"engines": {
"node": ">=12.13.0"
},
"gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
}
+132
View File
@@ -0,0 +1,132 @@
#!/usr/bin/env node
const Configstore = require(`configstore`);
const pkg = require(`../package.json`);
const _ = require(`lodash`);
const path = require(`path`);
const os = require(`os`);
const watch = require(`./watch`);
const { getVersionInfo } = require(`./utils/version`);
const argv = require(`yargs`)
.usage(`Usage: medusa-dev [options]`)
.alias(`q`, `quiet`)
.nargs(`q`, 0)
.describe(`q`, `Do not output copy file information`)
.alias(`s`, `scan-once`)
.nargs(`s`, 0)
.describe(`s`, `Scan once. Do not start file watch`)
.alias(`p`, `set-path-to-repo`)
.nargs(`p`, 1)
.describe(
`p`,
`Set path to Medusa repository.
You typically only need to configure this once.`
)
.nargs(`force-install`, 0)
.describe(
`force-install`,
`Disables copying files into node_modules and forces usage of local npm repository.`
)
.alias(`C`, `copy-all`)
.nargs(`C`, 0)
.describe(
`C`,
`Copy all contents in packages/ instead of just medusa packages`
)
.array(`packages`)
.describe(`packages`, `Explicitly specify packages to copy`)
.help(`h`)
.alias(`h`, `help`)
.nargs(`v`, 0)
.alias(`v`, `version`)
.describe(`v`, `Print the currently installed version of Medusa Dev CLI`)
.argv;
if (argv.version) {
console.log(getVersionInfo());
process.exit();
}
const conf = new Configstore(pkg.name);
const fs = require(`fs-extra`);
let pathToRepo = argv.setPathToRepo;
if (pathToRepo) {
if (pathToRepo.includes(`~`)) {
pathToRepo = path.join(os.homedir(), pathToRepo.split(`~`).pop());
}
conf.set(`medusa-location`, path.resolve(pathToRepo));
process.exit();
}
const havePackageJsonFile = fs.existsSync(`package.json`);
if (!havePackageJsonFile) {
console.error(`Current folder must have a package.json file!`);
process.exit();
}
const medusaLocation = conf.get(`medusa-location`);
if (!medusaLocation) {
console.error(
`
You haven't set the path yet to your cloned
version of medusa. Do so now by running:
medusa-dev --set-path-to-repo /path/to/my/cloned/version/medusa
`
);
process.exit();
}
// get list of packages from monorepo
const monoRepoPackages = [];
const pkgsDirs = fs.readdirSync(path.join(medusaLocation, `packages`));
for (const dir of pkgsDirs) {
const pack = JSON.parse(
fs.readFileSync(path.join(medusaLocation, `packages`, dir, `package.json`))
);
monoRepoPackages.push(pack.name);
}
const localPkg = JSON.parse(fs.readFileSync(`package.json`));
// intersect dependencies with monoRepoPackages to get list of packages that are used
const localPackages = _.intersection(
monoRepoPackages,
Object.keys(_.merge({}, localPkg.dependencies, localPkg.devDependencies))
);
if (!argv.packages && _.isEmpty(localPackages)) {
console.error(
`
You haven't got any medusa dependencies into your current package.json
You probably want to pass in a list of packages to start
developing on! For example:
medusa-dev --packages @medusajs/medusa
If you prefer to place them in your package.json dependencies instead,
medusa-dev will pick them up.
`
);
if (!argv.forceInstall) {
process.exit();
} else {
console.log(
`Continuing other dependencies installation due to "--forceInstall" flag`
);
}
}
watch(medusaLocation, argv.packages, {
localPackages,
quiet: argv.quiet,
scanOnce: argv.scanOnce,
forceInstall: argv.forceInstall,
monoRepoPackages,
});
@@ -0,0 +1,19 @@
const signalExit = require(`signal-exit`);
const cleanupTasks = new Set();
exports.registerCleanupTask = (taskFn) => {
cleanupTasks.add(taskFn);
return () => {
const result = taskFn();
cleanupTasks.delete(taskFn);
return result;
};
};
signalExit(() => {
if (cleanupTasks.size) {
console.log(`Process exitted in middle of publishing - cleaning up`);
cleanupTasks.forEach((taskFn) => taskFn());
}
});
@@ -0,0 +1,75 @@
const startVerdaccio = require(`verdaccio`).default;
const fs = require(`fs-extra`);
const _ = require(`lodash`);
let VerdaccioInitPromise = null;
const { verdaccioConfig } = require(`./verdaccio-config`);
const { publishPackage } = require(`./publish-package`);
const { installPackages } = require(`./install-packages`);
const startServer = () => {
if (VerdaccioInitPromise) {
return VerdaccioInitPromise;
}
console.log(`Starting local verdaccio server`);
// clear storage
fs.removeSync(verdaccioConfig.storage);
VerdaccioInitPromise = new Promise((resolve) => {
startVerdaccio(
verdaccioConfig,
verdaccioConfig.port,
verdaccioConfig.storage,
`1.0.0`,
`medusa-dev`,
(webServer, addr, pkgName, pkgVersion) => {
// console.log(webServer)
webServer.listen(addr.port || addr.path, addr.host, () => {
console.log(`Started local verdaccio server`);
resolve();
});
}
);
});
return VerdaccioInitPromise;
};
exports.startVerdaccio = startServer;
exports.publishPackagesLocallyAndInstall = async ({
packagesToPublish,
localPackages,
root,
ignorePackageJSONChanges,
yarnWorkspaceRoot,
}) => {
await startServer();
const versionPostFix = Date.now();
const newlyPublishedPackageVersions = {};
for (const packageName of packagesToPublish) {
newlyPublishedPackageVersions[packageName] = await publishPackage({
packageName,
packagesToPublish,
root,
versionPostFix,
ignorePackageJSONChanges,
});
}
const packagesToInstall = _.intersection(packagesToPublish, localPackages);
await installPackages({
packagesToInstall,
yarnWorkspaceRoot,
newlyPublishedPackageVersions,
});
};
@@ -0,0 +1,151 @@
const path = require(`path`)
const fs = require(`fs-extra`)
const { promisifiedSpawn } = require(`../utils/promisified-spawn`)
const { registryUrl } = require(`./verdaccio-config`)
const installPackages = async ({
packagesToInstall,
yarnWorkspaceRoot,
newlyPublishedPackageVersions,
}) => {
console.log(
`Installing packages from local registry:\n${packagesToInstall
.map(packageAndVersion => ` - ${packageAndVersion}`)
.join(`\n`)}`
)
let installCmd
if (yarnWorkspaceRoot) {
// this is very hacky - given root, we run `yarn workspaces info`
// to get list of all workspaces and their locations, and manually
// edit package.json file for packages we want to install
// to make sure there are no mismatched versions of same package
// in workspaces which should preserve node_modules structure
// (packages being mostly hoisted to top-level node_modules)
const { stdout } = await promisifiedSpawn([
`yarn`,
[`workspaces`, `info`, `--json`],
{ stdio: `pipe` },
])
let workspacesLayout
try {
workspacesLayout = JSON.parse(JSON.parse(stdout).data)
} catch (e) {
/*
Yarn 1.22 doesn't output pure json - it has leading and trailing text:
```
$ yarn workspaces info --json
yarn workspaces v1.22.0
{
"z": {
"location": "z",
"workspaceDependencies": [],
"mismatchedWorkspaceDependencies": []
},
"y": {
"location": "y",
"workspaceDependencies": [],
"mismatchedWorkspaceDependencies": []
}
}
Done in 0.48s.
```
So we need to do some sanitization. We find JSON by matching substring
that starts with `{` and ends with `}`
*/
const regex = /^[^{]*({.*})[^}]*$/gs
const sanitizedStdOut = regex.exec(stdout)
if (sanitizedStdOut?.length >= 2) {
// pick content of first (and only) capturing group
const jsonString = sanitizedStdOut[1]
try {
workspacesLayout = JSON.parse(jsonString)
} catch (e) {
console.error(
`Failed to parse "sanitized" output of "yarn workspaces info" command.\n\nSanitized string: "${jsonString}`
)
// not exitting here, because we have general check for `workspacesLayout` being set below
}
}
}
if (!workspacesLayout) {
console.error(
`Couldn't parse output of "yarn workspaces info" command`,
stdout
)
process.exit(1)
}
const handleDeps = deps => {
if (!deps) {
return false
}
let changed = false
Object.keys(deps).forEach(depName => {
if (packagesToInstall.includes(depName)) {
deps[depName] = `gatsby-dev`
changed = true
}
})
return changed
}
Object.keys(workspacesLayout).forEach(workspaceName => {
const { location } = workspacesLayout[workspaceName]
const pkgJsonPath = path.join(yarnWorkspaceRoot, location, `package.json`)
if (!fs.existsSync(pkgJsonPath)) {
return
}
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, `utf8`))
let changed = false
changed |= handleDeps(pkg.dependencies)
changed |= handleDeps(pkg.devDependencies)
changed |= handleDeps(pkg.peerDependencies)
if (changed) {
console.log(`Changing deps in ${pkgJsonPath} to use @gatsby-dev`)
fs.outputJSONSync(pkgJsonPath, pkg, {
spaces: 2,
})
}
})
// package.json files are changed - so we just want to install
// using verdaccio registry
installCmd = [
`yarn`,
[`install`, `--registry=${registryUrl}`, `--ignore-engines`],
]
} else {
installCmd = [
`yarn`,
[
`add`,
...packagesToInstall.map(packageName => {
const packageVersion = newlyPublishedPackageVersions[packageName]
return `${packageName}@${packageVersion}`
}),
`--registry=${registryUrl}`,
`--exact`,
`--ignore-engines`,
],
]
}
try {
await promisifiedSpawn(installCmd)
console.log(`Installation complete`)
} catch (error) {
console.error(`Installation failed`, error)
process.exit(1)
}
}
exports.installPackages = installPackages
@@ -0,0 +1,153 @@
const fs = require(`fs-extra`);
const path = require(`path`);
const { promisifiedSpawn } = require(`../utils/promisified-spawn`);
const { registryUrl } = require(`./verdaccio-config`);
const NPMRCContent = `${registryUrl.replace(
/https?:/g,
``
)}/:_authToken="medusa-dev"`;
const {
getMonorepoPackageJsonPath,
} = require(`../utils/get-monorepo-package-json-path`);
const { registerCleanupTask } = require(`./cleanup-tasks`);
/**
* Edit package.json to:
* - adjust version to temporary one
* - change version selectors for dependencies that
* will be published, to make sure that yarn
* install them in local site
*/
const adjustPackageJson = ({
monoRepoPackageJsonPath,
packageName,
versionPostFix,
packagesToPublish,
ignorePackageJSONChanges,
root,
}) => {
// we need to check if package depend on any other package to will be published and
// adjust version selector to point to dev version of package so local registry is used
// for dependencies.
const monorepoPKGjsonString = fs.readFileSync(
monoRepoPackageJsonPath,
`utf-8`
);
const monorepoPKGjson = JSON.parse(monorepoPKGjsonString);
monorepoPKGjson.version = `${monorepoPKGjson.version}-dev-${versionPostFix}`;
packagesToPublish.forEach((packageThatWillBePublished) => {
if (
monorepoPKGjson.dependencies &&
monorepoPKGjson.dependencies[packageThatWillBePublished]
) {
const currentVersion = JSON.parse(
fs.readFileSync(
getMonorepoPackageJsonPath({
packageName: packageThatWillBePublished,
root,
}),
`utf-8`
)
).version;
monorepoPKGjson.dependencies[
packageThatWillBePublished
] = `${currentVersion}-dev-${versionPostFix}`;
}
});
const temporaryMonorepoPKGjsonString = JSON.stringify(monorepoPKGjson);
const unignorePackageJSONChanges = ignorePackageJSONChanges(packageName, [
monorepoPKGjsonString,
temporaryMonorepoPKGjsonString,
]);
// change version and dependency versions
fs.outputFileSync(monoRepoPackageJsonPath, temporaryMonorepoPKGjsonString);
return {
newPackageVersion: monorepoPKGjson.version,
unadjustPackageJson: registerCleanupTask(() => {
// restore original package.json
fs.outputFileSync(monoRepoPackageJsonPath, monorepoPKGjsonString);
unignorePackageJSONChanges();
}),
};
};
/**
* Anonymous publishing require dummy .npmrc
* See https://github.com/verdaccio/verdaccio/issues/212#issuecomment-308578500
* This is `npm publish` (as in linked comment) and `yarn publish` requirement.
* This is not verdaccio restriction.
*/
const createTemporaryNPMRC = ({ pathToPackage }) => {
const NPMRCPath = path.join(pathToPackage, `.npmrc`);
fs.outputFileSync(NPMRCPath, NPMRCContent);
return registerCleanupTask(() => {
fs.removeSync(NPMRCPath);
});
};
const publishPackage = async ({
packageName,
packagesToPublish,
root,
versionPostFix,
ignorePackageJSONChanges,
}) => {
const monoRepoPackageJsonPath = getMonorepoPackageJsonPath({
packageName,
root,
});
const { unadjustPackageJson, newPackageVersion } = adjustPackageJson({
monoRepoPackageJsonPath,
packageName,
root,
versionPostFix,
packagesToPublish,
ignorePackageJSONChanges,
});
const pathToPackage = path.dirname(monoRepoPackageJsonPath);
const uncreateTemporaryNPMRC = createTemporaryNPMRC({ pathToPackage });
// npm publish
const publishCmd = [
`npm`,
[`publish`, `--tag`, `medusa-dev`, `--registry=${registryUrl}`],
{
cwd: pathToPackage,
},
];
console.log(
`Publishing ${packageName}@${newPackageVersion} to local registry`
);
try {
await promisifiedSpawn(publishCmd);
console.log(
`Published ${packageName}@${newPackageVersion} to local registry`
);
} catch (e) {
console.error(`Failed to publish ${packageName}@${newPackageVersion}`, e);
process.exit(1);
}
uncreateTemporaryNPMRC();
unadjustPackageJson();
return newPackageVersion;
};
exports.publishPackage = publishPackage;
@@ -0,0 +1,33 @@
const path = require(`path`)
const os = require(`os`)
const verdaccioConfig = {
storage: path.join(os.tmpdir(), `verdaccio`, `storage`),
port: 4873, // default
max_body_size: `1000mb`,
web: {
enable: true,
title: `gatsby-dev`,
},
logs: [{ type: `stdout`, format: `pretty-timestamped`, level: `warn` }],
packages: {
"**": {
access: `$all`,
publish: `$all`,
proxy: `npmjs`,
},
},
uplinks: {
npmjs: {
url: `https://registry.npmjs.org/`,
// default is 2 max_fails - on flaky networks that cause a lot of failed installations
max_fails: 10,
},
},
}
exports.verdaccioConfig = verdaccioConfig
const registryUrl = `http://localhost:${verdaccioConfig.port}`
exports.registryUrl = registryUrl
@@ -0,0 +1,29 @@
const { getDependantPackages } = require(`../get-dependant-packages`)
describe(`getDependantPackages`, () => {
it(`handles deep dependency chains`, () => {
const packagesToPublish = getDependantPackages({
packageName: `package-a-dep1-dep1`,
depTree: {
"package-a-dep1": new Set([`package-a`]),
"package-a-dep1-dep1": new Set([`package-a-dep1`]),
"not-related": new Set([`also-not-related`]),
},
})
expect(packagesToPublish).toEqual(
new Set([`package-a`, `package-a-dep1`, `package-a-dep1-dep1`])
)
})
it(`doesn't get stuck in circular dependency loops`, () => {
const packagesToPublish = getDependantPackages({
packageName: `package-a`,
depTree: {
"package-a": new Set([`package-b`]),
"package-b": new Set([`package-a`]),
},
})
expect(packagesToPublish).toEqual(new Set([`package-a`, `package-b`]))
})
})
@@ -0,0 +1,68 @@
const path = require(`path`)
const { traversePackagesDeps } = require(`../traverse-package-deps`)
jest.doMock(
path.join(...`<monorepo-path>/packages/package-a/package.json`.split(`/`)),
() => {
return {
dependencies: {
"unrelated-package": `*`,
"package-a-dep1": `*`,
},
}
},
{ virtual: true }
)
jest.doMock(
path.join(
...`<monorepo-path>/packages/package-a-dep1/package.json`.split(`/`)
),
() => {
return {
dependencies: {
"package-a-dep1-dep1": `*`,
},
}
},
{ virtual: true }
)
jest.doMock(
path.join(
...`<monorepo-path>/packages/package-a-dep1-dep1/package.json`.split(`/`)
),
() => {
return {
dependencies: {},
}
},
{ virtual: true }
)
describe(`traversePackageDeps`, () => {
it(`handles deep dependency chains`, () => {
const { seenPackages, depTree } = traversePackagesDeps({
root: `<monorepo-path>`,
packages: [`package-a`, `doesnt-exist`],
monoRepoPackages: [
`package-a`,
`package-a-dep1`,
`package-a-dep1-dep1`,
`package-not-used`,
],
})
expect(seenPackages).toEqual([
`package-a`,
`package-a-dep1`,
`package-a-dep1-dep1`,
])
expect(depTree).toEqual({
"package-a-dep1": new Set([`package-a`]),
"package-a-dep1-dep1": new Set([`package-a-dep1`]),
})
})
})
@@ -0,0 +1,190 @@
const fs = require(`fs-extra`);
const _ = require(`lodash`);
const {
getMonorepoPackageJsonPath,
} = require(`./get-monorepo-package-json-path`);
const got = require(`got`);
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function (result, value, key) {
if (!_.isEqual(value, base[key])) {
result[key] =
_.isObject(value) && _.isObject(base[key])
? changes(value, base[key])
: value;
}
});
}
return changes(object, base);
}
/**
* Compare dependencies of installed packages and monorepo package.
* It will skip dependencies that are removed in monorepo package.
*
* If local package is not installed, it will check unpkg.com.
* This allow medusa-dev to skip publishing unnecesairly and
* let install packages from public npm repository if nothing changed.
*/
exports.checkDepsChanges = async ({
newPath,
packageName,
monoRepoPackages,
root,
isInitialScan,
ignoredPackageJSON,
}) => {
let localPKGjson;
let packageNotInstalled = false;
try {
localPKGjson = JSON.parse(fs.readFileSync(newPath, `utf-8`));
} catch {
packageNotInstalled = true;
// there is no local package - so we still need to install deps
// this is nice because devs won't need to do initial package installation - we can handle this.
if (!isInitialScan) {
console.log(
`'${packageName}' doesn't seem to be installed. Restart medusa-dev to publish it`
);
return {
didDepsChanged: false,
packageNotInstalled,
};
}
// if package is not installed, we will do http GET request to
// unkpg to check if dependency in package published in public
// npm repository are different
// this allow us to not publish to local repository
// and save some time/work
try {
const response = await got(
`https://unpkg.com/${packageName}/package.json`
);
if (response?.statusCode !== 200) {
throw new Error(`No response or non 200 code`);
}
localPKGjson = JSON.parse(response.body);
} catch {
console.log(
`'${packageName}' doesn't seem to be installed and is not published on NPM.`
);
return {
didDepsChanged: true,
packageNotInstalled,
};
}
}
const monoDir = packageName.startsWith("@medusajs")
? packageName.split("/")[1]
: packageName;
const monoRepoPackageJsonPath = getMonorepoPackageJsonPath({
packageName: monoDir,
root,
});
const monorepoPKGjsonString = fs.readFileSync(
monoRepoPackageJsonPath,
`utf-8`
);
const monorepoPKGjson = JSON.parse(monorepoPKGjsonString);
if (ignoredPackageJSON.has(packageName)) {
if (ignoredPackageJSON.get(packageName).includes(monorepoPKGjsonString)) {
// we are in middle of publishing and content of package.json is one set during publish process,
// so we need to not cause false positives
return {
didDepsChanged: false,
packageNotInstalled,
};
}
}
if (!monorepoPKGjson.dependencies) monorepoPKGjson.dependencies = {};
if (!localPKGjson.dependencies) localPKGjson.dependencies = {};
const areDepsEqual = _.isEqual(
monorepoPKGjson.dependencies,
localPKGjson.dependencies
);
if (!areDepsEqual) {
const diff = difference(
monorepoPKGjson.dependencies,
localPKGjson.dependencies
);
const diff2 = difference(
localPKGjson.dependencies,
monorepoPKGjson.dependencies
);
let needPublishing = false;
let isPublishing = false;
const depChangeLog = _.uniq(Object.keys({ ...diff, ...diff2 }))
.reduce((acc, key) => {
if (monorepoPKGjson.dependencies[key] === `medusa-dev`) {
// if we are in middle of publishing to local repository - ignore
isPublishing = true;
return acc;
}
if (localPKGjson.dependencies[key] === `medusa-dev`) {
// monorepo packages will restore version, but after installation
// in local site - it will use `medusa-dev` dist tag - we need
// to ignore changes that
return acc;
}
if (
localPKGjson.dependencies[key] &&
monorepoPKGjson.dependencies[key]
) {
// Check only for version changes in packages
// that are not from medusa repo.
// Changes in medusa packages will be copied over
// from monorepo - and if those contain other dependency
// changes - they will be covered
if (!monoRepoPackages.includes(key)) {
acc.push(
` - '${key}' changed version from ${localPKGjson.dependencies[key]} to ${monorepoPKGjson.dependencies[key]}`
);
needPublishing = true;
}
} else if (monorepoPKGjson.dependencies[key]) {
acc.push(
` - '${key}@${monorepoPKGjson.dependencies[key]}' was added`
);
needPublishing = true;
} else {
acc.push(` - '${key}@${localPKGjson.dependencies[key]}' was removed`);
// this doesn't need publishing really, so will skip this
}
return acc;
}, [])
.join(`\n`);
if (!isPublishing && depChangeLog.length > 0) {
console.log(`Dependencies of '${packageName}' changed:\n${depChangeLog}`);
if (isInitialScan) {
console.log(
`Will ${!needPublishing ? `not ` : ``}publish to local npm registry.`
);
} else {
console.warn(
`Installation of dependencies after initial scan is not implemented`
);
}
return {
didDepsChanged: needPublishing,
packageNotInstalled,
};
}
}
return {
didDepsChanged: false,
packageNotInstalled,
};
};
@@ -0,0 +1,30 @@
/**
* Recursively get set of packages that depend on given package.
* Set also includes passed package.
*/
const getDependantPackages = ({
packageName,
depTree,
packagesToPublish = new Set(),
}) => {
if (packagesToPublish.has(packageName)) {
// bail early if package was already handled
return packagesToPublish
}
packagesToPublish.add(packageName)
const dependants = depTree[packageName]
if (dependants) {
dependants.forEach(dependant =>
getDependantPackages({
packageName: dependant,
depTree,
packagesToPublish,
})
)
}
return packagesToPublish
}
exports.getDependantPackages = getDependantPackages
@@ -0,0 +1,11 @@
const path = require(`path`);
exports.getMonorepoPackageJsonPath = ({ packageName, root }) => {
let dirName = packageName;
if (packageName.startsWith("@medusajs")) {
const [, directory] = packageName.split("/");
dirName = directory;
}
return path.join(root, `packages`, dirName, `package.json`);
};
@@ -0,0 +1,29 @@
const execa = require(`execa`)
const defaultSpawnArgs = {
cwd: process.cwd(),
stdio: `inherit`,
}
exports.setDefaultSpawnStdio = stdio => {
defaultSpawnArgs.stdio = stdio
}
exports.promisifiedSpawn = async ([cmd, args = [], spawnArgs = {}]) => {
const spawnOptions = {
...defaultSpawnArgs,
...spawnArgs,
}
try {
return await execa(cmd, args, spawnOptions)
} catch (e) {
if (spawnOptions.stdio === `ignore`) {
console.log(
`\nCommand "${cmd} ${args.join(
` `
)}" failed.\nTo see details of failed command, rerun "medusa-dev" without "--quiet" or "-q" switch\n`
)
}
throw e
}
}
@@ -0,0 +1,76 @@
const _ = require(`lodash`);
const path = require(`path`);
/**
* @typedef {Object} TraversePackagesDepsReturn
* @property {Object} depTree Lookup table to check dependants for given package.
* Used to determine which packages need to be published.
*/
/**
* Compile final list of packages to watch
* This will include packages explicitly defined packages and all their dependencies
* Also creates dependency graph that is used later to determine which packages
* would need to be published when their dependencies change
* @param {Object} $0
* @param {String} $0.root Path to root of medusa monorepo repository
* @param {String[]} $0.packages Initial array of packages to watch
* This can be extracted from project dependencies or explicitly set by `--packages` flag
* @param {String[]} $0.monoRepoPackages Array of packages in medusa monorepo
* @param {String[]} [$0.seenPackages] Array of packages that were already traversed.
* This makes sure dependencies are extracted one time for each package and avoid any
* infinite loops.
* @param {DepTree} [$0.depTree] Used internally to recursively construct dependency graph.
* @return {TraversePackagesDepsReturn}
*/
const traversePackagesDeps = ({
root,
packages,
monoRepoPackages,
seenPackages = [...packages],
depTree = {},
}) => {
packages.forEach((p) => {
if (p.startsWith("@medusajs")) {
p = p.split("/")[1];
}
let pkgJson;
try {
pkgJson = require(path.join(root, `packages`, p, `package.json`));
} catch {
console.error(`"${p}" package doesn't exist in monorepo.`);
// remove from seenPackages
seenPackages = seenPackages.filter((seenPkg) => seenPkg !== p);
return;
}
const fromMonoRepo = _.intersection(
Object.keys({ ...pkgJson.dependencies }),
monoRepoPackages
);
fromMonoRepo.forEach((pkgName) => {
depTree[pkgName] = (depTree[pkgName] || new Set()).add(p);
});
// only traverse not yet seen packages to avoid infinite loops
const newPackages = _.difference(fromMonoRepo, seenPackages);
if (newPackages.length) {
newPackages.forEach((depFromMonorepo) => {
seenPackages.push(depFromMonorepo);
});
traversePackagesDeps({
root,
packages: fromMonoRepo,
monoRepoPackages,
seenPackages,
depTree,
});
}
});
return { seenPackages, depTree };
};
exports.traversePackagesDeps = traversePackagesDeps;
@@ -0,0 +1,4 @@
exports.getVersionInfo = () => {
const { version: devCliVersion } = require(`../../package.json`);
return `Medusa Dev CLI version: ${devCliVersion}`;
};
+352
View File
@@ -0,0 +1,352 @@
const chokidar = require(`chokidar`);
const _ = require(`lodash`);
const del = require(`del`);
const fs = require(`fs-extra`);
const path = require(`path`);
const findWorkspaceRoot = require(`find-yarn-workspace-root`);
const { publishPackagesLocallyAndInstall } = require(`./local-npm-registry`);
const { checkDepsChanges } = require(`./utils/check-deps-changes`);
const { getDependantPackages } = require(`./utils/get-dependant-packages`);
const {
setDefaultSpawnStdio,
promisifiedSpawn,
} = require(`./utils/promisified-spawn`);
const { traversePackagesDeps } = require(`./utils/traverse-package-deps`);
let numCopied = 0;
const quit = () => {
console.log(`Copied ${numCopied} files`);
process.exit();
};
const MAX_COPY_RETRIES = 3;
/*
* non-existent packages break on('ready')
* See: https://github.com/paulmillr/chokidar/issues/449
*/
async function watch(
root,
packages,
{ scanOnce, quiet, forceInstall, monoRepoPackages, localPackages }
) {
setDefaultSpawnStdio(quiet ? `ignore` : `inherit`);
// determine if in yarn workspace - if in workspace, force using verdaccio
// as current logic of copying files will not work correctly.
const yarnWorkspaceRoot = findWorkspaceRoot();
if (yarnWorkspaceRoot && process.env.NODE_ENV !== `test`) {
console.log(`Yarn workspace found.`);
forceInstall = true;
}
let afterPackageInstallation = false;
let queuedCopies = [];
const realCopyPath = (arg) => {
const { oldPath, newPath, quiet, resolve, reject, retry = 0 } = arg;
fs.copy(oldPath, newPath, (err) => {
if (err) {
if (retry >= MAX_COPY_RETRIES) {
console.error(err);
reject(err);
return;
} else {
setTimeout(
() => realCopyPath({ ...arg, retry: retry + 1 }),
500 * Math.pow(2, retry)
);
return;
}
}
// When the medusa binary is copied over, it is not setup with the executable
// permissions that it is given when installed via yarn.
// This fixes the issue where after running meduas-dev, running `yarn medusa develop`
// fails with a permission issue.
if (/(bin\/meduas.js|medusa(-cli)?\/cli.js)$/.test(newPath)) {
fs.chmodSync(newPath, `0755`);
}
numCopied += 1;
if (!quiet) {
console.log(`Copied ${oldPath} to ${newPath}`);
}
resolve();
});
};
const copyPath = (oldPath, newPath, quiet, packageName) =>
new Promise((resolve, reject) => {
const argObj = { oldPath, newPath, quiet, packageName, resolve, reject };
if (afterPackageInstallation) {
realCopyPath(argObj);
} else {
queuedCopies.push(argObj);
}
});
const runQueuedCopies = () => {
afterPackageInstallation = true;
queuedCopies.forEach((argObj) => realCopyPath(argObj));
queuedCopies = [];
};
const clearJSFilesFromNodeModules = async () => {
const packagesToClear = queuedCopies.reduce((acc, { packageName }) => {
if (packageName) {
acc.add(packageName);
}
return acc;
}, new Set());
await Promise.all(
[...packagesToClear].map(
async (packageToClear) =>
await del([
`node_modules/${packageToClear}/**/*.{js,js.map}`,
`!node_modules/${packageToClear}/node_modules/**/*.{js,js.map}`,
`!node_modules/${packageToClear}/src/**/*.{js,js.map}`,
])
)
);
};
// check packages deps and if they depend on other packages from monorepo
// add them to packages list
const { seenPackages, depTree } = traversePackagesDeps({
root,
packages: _.uniq(localPackages),
monoRepoPackages,
});
const allPackagesToWatch = packages
? _.intersection(packages, seenPackages)
: seenPackages;
const ignoredPackageJSON = new Map();
const ignorePackageJSONChanges = (packageName, contentArray) => {
ignoredPackageJSON.set(packageName, contentArray);
return () => {
ignoredPackageJSON.delete(packageName);
};
};
if (forceInstall) {
try {
if (allPackagesToWatch.length > 0) {
await publishPackagesLocallyAndInstall({
packagesToPublish: allPackagesToWatch,
root,
localPackages,
ignorePackageJSONChanges,
yarnWorkspaceRoot,
});
} else {
// run `yarn`
const yarnInstallCmd = [`yarn`];
console.log(`Installing packages from public NPM registry`);
await promisifiedSpawn(yarnInstallCmd);
console.log(`Installation complete`);
}
} catch (e) {
console.log(e);
}
process.exit();
}
if (allPackagesToWatch.length === 0) {
console.error(`There are no packages to watch.`);
return;
}
const cleanToWatch = allPackagesToWatch.map((pkgName) => {
if (pkgName.startsWith(`@medusajs`)) {
return pkgName.split("/")[1];
}
return pkgName;
});
const ignored = [
/[/\\]node_modules[/\\]/i,
/\.git/i,
/\.DS_Store/,
/[/\\]__tests__[/\\]/i,
/[/\\]__mocks__[/\\]/i,
/\.npmrc/i,
].concat(
cleanToWatch.map((p) => new RegExp(`${p}[\\/\\\\]src[\\/\\\\]`, `i`))
);
const watchers = _.uniq(
cleanToWatch
.map((p) => path.join(root, `/packages/`, p))
.filter((p) => fs.existsSync(p))
);
let allCopies = [];
const packagesToPublish = new Set();
let isInitialScan = true;
let isPublishing = false;
const waitFor = new Set();
let anyPackageNotInstalled = false;
const watchEvents = [`change`, `add`];
chokidar
.watch(watchers, {
ignored: [(filePath) => _.some(ignored, (reg) => reg.test(filePath))],
})
.on(`all`, async (event, filePath) => {
if (!watchEvents.includes(event)) {
return;
}
const [pack] = filePath
.split(/packages[/\\]/)
.pop()
.split(/[/\\]/);
const sourcePkg = JSON.parse(
fs.readFileSync(path.join(root, `/packages/`, pack, `package.json`))
);
const packageName = sourcePkg.name;
const prefix = path.join(root, `/packages/`, pack);
// Copy it over local version.
// Don't copy over the medusa bin file as that breaks the NPM symlink.
if (_.includes(filePath, `dist/medusa-cli.js`)) {
return;
}
const relativePackageFile = path.relative(prefix, filePath);
const newPath = path.join(
`./node_modules/${packageName}`,
relativePackageFile
);
if (relativePackageFile === `package.json`) {
// package.json files will change during publish to adjust version of package (and dependencies), so ignore
// changes during this process
if (isPublishing) {
return;
}
// Compare dependencies with local version
const didDepsChangedPromise = checkDepsChanges({
newPath,
packageName,
monoRepoPackages,
root,
isInitialScan,
ignoredPackageJSON,
});
if (isInitialScan) {
// normally checkDepsChanges would be sync,
// but because it also can do async GET request
// to unpkg if local package is not installed
// keep track of it to make sure all of it
// finish before installing
waitFor.add(didDepsChangedPromise);
}
const {
didDepsChanged,
packageNotInstalled,
} = await didDepsChangedPromise;
if (packageNotInstalled) {
anyPackageNotInstalled = true;
}
if (didDepsChanged) {
if (isInitialScan) {
waitFor.delete(didDepsChangedPromise);
// handle dependency change only in initial scan - this is for sure doable to
// handle this in watching mode correctly - but for the sake of shipping
// this I limit more work/time consuming edge cases.
// Dependency changed - now we need to figure out
// the packages that actually need to be published.
// If package with changed dependencies is dependency of other
// medusa package - like for example `medusa-plugin-page-creator`
// we need to publish both `medusa-plugin-page-creator` and `medusa`
// and install `medusa` in example site project.
getDependantPackages({
packageName,
depTree,
packages,
}).forEach((packageToPublish) => {
// scheduling publish - we will publish when `ready` is emitted
// as we can do single publish then
packagesToPublish.add(packageToPublish);
});
}
}
// don't ever copy package.json as this will mess up any future dependency
// changes checks
return;
}
const localCopies = [copyPath(filePath, newPath, quiet, packageName)];
// If this is from "cache-dir" also copy it into the site's .cache
if (_.includes(filePath, `cache-dir`)) {
const newCachePath = path.join(
`.cache/`,
path.relative(path.join(prefix, `cache-dir`), filePath)
);
localCopies.push(copyPath(filePath, newCachePath, quiet));
}
allCopies = allCopies.concat(localCopies);
})
.on(`ready`, async () => {
// wait for all async work needed to be done
// before publishing / installing
await Promise.all(Array.from(waitFor));
if (isInitialScan) {
isInitialScan = false;
if (packagesToPublish.size > 0) {
isPublishing = true;
await publishPackagesLocallyAndInstall({
packagesToPublish: Array.from(packagesToPublish),
root,
localPackages,
ignorePackageJSONChanges,
});
packagesToPublish.clear();
isPublishing = false;
} else if (anyPackageNotInstalled) {
// run `yarn`
const yarnInstallCmd = [`yarn`];
console.log(`Installing packages from public NPM registry`);
await promisifiedSpawn(yarnInstallCmd);
console.log(`Installation complete`);
}
await clearJSFilesFromNodeModules();
runQueuedCopies();
}
// all files watched, quit once all files are copied if necessary
Promise.all(allCopies).then(() => {
if (scanOnce) {
quit();
}
});
});
}
module.exports = watch;
File diff suppressed because it is too large. Load diff
+76
View File
@@ -3,6 +3,82 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.9...medusa-file-spaces@1.1.12) (2021-04-28)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.10...medusa-file-spaces@1.1.11) (2021-04-20)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.9...medusa-file-spaces@1.1.10) (2021-04-20)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.8...medusa-file-spaces@1.1.9) (2021-04-13)
### Bug Fixes
* merge develop ([2982a8e](https://github.com/medusajs/medusa/commit/2982a8e682e90beb4549d969d9d3b04d78a46a2d))
* merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.7...medusa-file-spaces@1.1.8) (2021-04-13)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.6...medusa-file-spaces@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.5...medusa-file-spaces@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.3...medusa-file-spaces@1.1.5) (2021-03-17)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.3...medusa-file-spaces@1.1.4) (2021-03-17)
**Note:** Version bump only for package medusa-file-spaces
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.2...medusa-file-spaces@1.1.3) (2021-02-17) ## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.2...medusa-file-spaces@1.1.3) (2021-02-17)
**Note:** Version bump only for package medusa-file-spaces **Note:** Version bump only for package medusa-file-spaces
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "medusa-file-spaces", "name": "medusa-file-spaces",
"version": "1.1.3", "version": "1.1.12",
"description": "Digital Ocean Spaces file connector for Medusa", "description": "Digital Ocean Spaces file connector for Medusa",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -40,9 +40,9 @@
"aws-sdk": "^2.710.0", "aws-sdk": "^2.710.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"express": "^4.17.1", "express": "^4.17.1",
"medusa-core-utils": "^1.1.0", "medusa-core-utils": "^1.1.9",
"medusa-test-utils": "^1.1.3", "medusa-test-utils": "^1.1.12",
"stripe": "^8.50.0" "stripe": "^8.50.0"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -3,6 +3,78 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.6...medusa-fulfillment-manual@1.1.9) (2021-04-28)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.7...medusa-fulfillment-manual@1.1.8) (2021-04-20)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.6...medusa-fulfillment-manual@1.1.7) (2021-04-20)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.5...medusa-fulfillment-manual@1.1.6) (2021-04-13)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.4...medusa-fulfillment-manual@1.1.5) (2021-04-09)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.3...medusa-fulfillment-manual@1.1.4) (2021-03-30)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.2...medusa-fulfillment-manual@1.1.3) (2021-03-17)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.2](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.0...medusa-fulfillment-manual@1.1.2) (2021-03-17)
**Note:** Version bump only for package medusa-fulfillment-manual
## [1.1.1](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.0...medusa-fulfillment-manual@1.1.1) (2021-03-17)
**Note:** Version bump only for package medusa-fulfillment-manual
# [1.1.0](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.0.12...medusa-fulfillment-manual@1.1.0) (2021-01-26) # [1.1.0](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.0.12...medusa-fulfillment-manual@1.1.0) (2021-01-26)
**Note:** Version bump only for package medusa-fulfillment-manual **Note:** Version bump only for package medusa-fulfillment-manual
@@ -1,6 +1,6 @@
{ {
"name": "medusa-fulfillment-manual", "name": "medusa-fulfillment-manual",
"version": "1.1.0", "version": "1.1.9",
"description": "A manual fulfillment provider for Medusa", "description": "A manual fulfillment provider for Medusa",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -36,7 +36,7 @@
"@babel/plugin-transform-instanceof": "^7.8.3", "@babel/plugin-transform-instanceof": "^7.8.3",
"@babel/runtime": "^7.7.6", "@babel/runtime": "^7.7.6",
"express": "^4.17.1", "express": "^4.17.1",
"medusa-core-utils": "^1.1.0" "medusa-core-utils": "^1.1.9"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -3,6 +3,104 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.12...medusa-fulfillment-webshipper@1.1.13) (2021-05-05)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.9...medusa-fulfillment-webshipper@1.1.12) (2021-04-28)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.10...medusa-fulfillment-webshipper@1.1.11) (2021-04-20)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.9...medusa-fulfillment-webshipper@1.1.10) (2021-04-20)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.8...medusa-fulfillment-webshipper@1.1.9) (2021-04-13)
### Bug Fixes
* gitignore ([fa1fe9d](https://github.com/medusajs/medusa/commit/fa1fe9d619e19a277db6ee3a25ebb177222fa04b))
* merge develop ([2982a8e](https://github.com/medusajs/medusa/commit/2982a8e682e90beb4549d969d9d3b04d78a46a2d))
* merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
### Features
* adds support for certificate of origin ([f21dae8](https://github.com/medusajs/medusa/commit/f21dae827ad64522fd1f4d6317740c6b0ded0536))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.7...medusa-fulfillment-webshipper@1.1.8) (2021-04-13)
### Bug Fixes
* gitignore ([fa1fe9d](https://github.com/medusajs/medusa/commit/fa1fe9d619e19a277db6ee3a25ebb177222fa04b))
### Features
* adds support for certificate of origin ([f21dae8](https://github.com/medusajs/medusa/commit/f21dae827ad64522fd1f4d6317740c6b0ded0536))
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.6...medusa-fulfillment-webshipper@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.5...medusa-fulfillment-webshipper@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.3...medusa-fulfillment-webshipper@1.1.5) (2021-03-17)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.3...medusa-fulfillment-webshipper@1.1.4) (2021-03-17)
**Note:** Version bump only for package medusa-fulfillment-webshipper
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.3-next.0...medusa-fulfillment-webshipper@1.1.3) (2021-02-25) ## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.3-next.0...medusa-fulfillment-webshipper@1.1.3) (2021-02-25)
**Note:** Version bump only for package medusa-fulfillment-webshipper **Note:** Version bump only for package medusa-fulfillment-webshipper
@@ -12,4 +12,5 @@ A webhook listener is exposed at `/webshipper/shipments` to listen for shipment
api_token: [a webshipper api token] (required) api_token: [a webshipper api token] (required)
order_channel_id: [the channel id to register orders on] (required) order_channel_id: [the channel id to register orders on] (required)
webhook_secret: [the webhook secret used to listen for shipments] (required) webhook_secret: [the webhook secret used to listen for shipments] (required)
coo_countries: [an array of countries in which a Certificate of Origin will be attached] (default: "all")
``` ```
@@ -1,6 +1,6 @@
{ {
"name": "medusa-fulfillment-webshipper", "name": "medusa-fulfillment-webshipper",
"version": "1.1.3", "version": "1.1.13",
"description": "Webshipper Fulfillment provider for Medusa", "description": "Webshipper Fulfillment provider for Medusa",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -14,6 +14,7 @@
"@babel/cli": "^7.7.5", "@babel/cli": "^7.7.5",
"@babel/core": "^7.7.5", "@babel/core": "^7.7.5",
"@babel/plugin-proposal-class-properties": "^7.7.4", "@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-transform-instanceof": "^7.12.13",
"@babel/plugin-transform-runtime": "^7.7.6", "@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.5", "@babel/preset-env": "^7.7.5",
"@babel/runtime": "^7.9.6", "@babel/runtime": "^7.9.6",
@@ -36,7 +37,7 @@
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^4.17.1", "express": "^4.17.1",
"medusa-core-utils": "^1.1.0" "medusa-core-utils": "^1.1.9"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -9,6 +9,16 @@ class WebshipperFulfillmentService extends FulfillmentService {
this.options_ = options this.options_ = options
if (!options.coo_countries) {
this.options_.coo_countries = ["all"]
} else if (Array.isArray(options.coo_countries)) {
this.options_.coo_countries = options.coo_countries.map((c) =>
c.toLowerCase()
)
} else if (typeof options.coo_countries === "string") {
this.options_.coo_countries = [options.coo_countries]
}
/** @private @const {logger} */ /** @private @const {logger} */
this.logger_ = logger this.logger_ = logger
@@ -242,8 +252,12 @@ class WebshipperFulfillmentService extends FulfillmentService {
webshipperOrder = await this.client_.orders.retrieve(existing) webshipperOrder = await this.client_.orders.retrieve(existing)
} }
const { shipping_address } = fromOrder
if (!webshipperOrder) { if (!webshipperOrder) {
let invoice let invoice
let certificateOfOrigin
if (this.invoiceGenerator_) { if (this.invoiceGenerator_) {
const base64Invoice = await this.invoiceGenerator_.createInvoice( const base64Invoice = await this.invoiceGenerator_.createInvoice(
fromOrder, fromOrder,
@@ -263,6 +277,34 @@ class WebshipperFulfillmentService extends FulfillmentService {
.catch((err) => { .catch((err) => {
throw err throw err
}) })
const cooCountries = this.options_.coo_countries
if (
(cooCountries.includes("all") ||
cooCountries.includes(
shipping_address.country_code.toLowerCase()
)) &&
this.invoiceGenerator_.createCertificateOfOrigin
) {
const base64Coo = await this.invoiceGenerator_.createCertificateOfOrigin(
fromOrder,
fulfillmentItems
)
certificateOfOrigin = await this.client_.documents
.create({
type: "documents",
attributes: {
document_size: this.options_.document_size || "A4",
document_format: "PDF",
base64: base64Coo,
document_type: "certificate",
},
})
.catch((err) => {
throw err
})
}
} }
let id = fulfillment.id let id = fulfillment.id
@@ -274,7 +316,6 @@ class WebshipperFulfillmentService extends FulfillmentService {
visible_ref = `S-${fromOrder.display_id}` visible_ref = `S-${fromOrder.display_id}`
} }
const { shipping_address } = fromOrder
const newOrder = { const newOrder = {
type: "orders", type: "orders",
attributes: { attributes: {
@@ -335,14 +376,25 @@ class WebshipperFulfillmentService extends FulfillmentService {
country_code: methodData.drop_point_country_code.toUpperCase(), country_code: methodData.drop_point_country_code.toUpperCase(),
} }
} }
if (invoice) {
if (invoice || certificateOfOrigin) {
const docData = []
if (invoice) {
docData.push({
id: invoice.data.id,
type: invoice.data.type,
})
}
if (certificateOfOrigin) {
docData.push({
id: certificateOfOrigin.data.id,
type: certificateOfOrigin.data.type,
})
}
newOrder.relationships.documents = { newOrder.relationships.documents = {
data: [ data: docData,
{
id: invoice.data.id,
type: invoice.data.type,
},
],
} }
} }
+78
View File
@@ -3,6 +3,84 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.7...medusa-interfaces@1.1.10) (2021-04-28)
**Note:** Version bump only for package medusa-interfaces
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.8...medusa-interfaces@1.1.9) (2021-04-20)
**Note:** Version bump only for package medusa-interfaces
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.7...medusa-interfaces@1.1.8) (2021-04-20)
**Note:** Version bump only for package medusa-interfaces
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.6...medusa-interfaces@1.1.7) (2021-04-13)
**Note:** Version bump only for package medusa-interfaces
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.5...medusa-interfaces@1.1.6) (2021-04-09)
**Note:** Version bump only for package medusa-interfaces
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.4...medusa-interfaces@1.1.5) (2021-03-30)
**Note:** Version bump only for package medusa-interfaces
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.3...medusa-interfaces@1.1.4) (2021-03-17)
**Note:** Version bump only for package medusa-interfaces
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.1...medusa-interfaces@1.1.3) (2021-03-17)
### Features
* **medusa:** Add support for filtering with gt, lt, gte and lte ([#190](https://github.com/medusajs/medusa/issues/190)) ([dd0491f](https://github.com/medusajs/medusa/commit/dd0491f52132aed24f642589b12fcf636b719580))
## [1.1.2](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.1...medusa-interfaces@1.1.2) (2021-03-17)
### Features
* **medusa:** Add support for filtering with gt, lt, gte and lte ([#190](https://github.com/medusajs/medusa/issues/190)) ([dd0491f](https://github.com/medusajs/medusa/commit/dd0491f52132aed24f642589b12fcf636b719580))
## [1.1.1](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.0...medusa-interfaces@1.1.1) (2021-02-17) ## [1.1.1](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.0...medusa-interfaces@1.1.1) (2021-02-17)
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "medusa-interfaces", "name": "medusa-interfaces",
"version": "1.1.1", "version": "1.1.10",
"description": "Core interfaces for Medusa", "description": "Core interfaces for Medusa",
"main": "dist/index.js", "main": "dist/index.js",
"repository": { "repository": {
@@ -35,7 +35,7 @@
"typeorm": "0.x" "typeorm": "0.x"
}, },
"dependencies": { "dependencies": {
"medusa-core-utils": "^1.1.0" "medusa-core-utils": "^1.1.9"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -3,6 +3,82 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.9...medusa-payment-adyen@1.1.12) (2021-04-28)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.10...medusa-payment-adyen@1.1.11) (2021-04-20)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.9...medusa-payment-adyen@1.1.10) (2021-04-20)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.8...medusa-payment-adyen@1.1.9) (2021-04-13)
### Bug Fixes
* merge develop ([2982a8e](https://github.com/medusajs/medusa/commit/2982a8e682e90beb4549d969d9d3b04d78a46a2d))
* merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.7...medusa-payment-adyen@1.1.8) (2021-04-13)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.6...medusa-payment-adyen@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.5...medusa-payment-adyen@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.3...medusa-payment-adyen@1.1.5) (2021-03-17)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.3...medusa-payment-adyen@1.1.4) (2021-03-17)
**Note:** Version bump only for package medusa-payment-adyen
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.2...medusa-payment-adyen@1.1.3) (2021-02-17) ## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.2...medusa-payment-adyen@1.1.3) (2021-02-17)
**Note:** Version bump only for package medusa-payment-adyen **Note:** Version bump only for package medusa-payment-adyen
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "medusa-payment-adyen", "name": "medusa-payment-adyen",
"version": "1.1.3", "version": "1.1.12",
"description": "Adyen Payment provider for Medusa Commerce", "description": "Adyen Payment provider for Medusa Commerce",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -24,7 +24,7 @@
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"jest": "^25.5.2", "jest": "^25.5.2",
"medusa-test-utils": "^1.1.3" "medusa-test-utils": "^1.1.12"
}, },
"scripts": { "scripts": {
"build": "babel src -d .", "build": "babel src -d .",
@@ -42,7 +42,7 @@
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^4.17.1", "express": "^4.17.1",
"medusa-core-utils": "^1.1.0" "medusa-core-utils": "^1.1.9"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -3,6 +3,99 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.10...medusa-payment-klarna@1.1.13) (2021-04-28)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.11...medusa-payment-klarna@1.1.12) (2021-04-20)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.10...medusa-payment-klarna@1.1.11) (2021-04-20)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.9...medusa-payment-klarna@1.1.10) (2021-04-13)
### Bug Fixes
* merge develop ([2982a8e](https://github.com/medusajs/medusa/commit/2982a8e682e90beb4549d969d9d3b04d78a46a2d))
* merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.8...medusa-payment-klarna@1.1.9) (2021-04-13)
### Bug Fixes
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.8...medusa-payment-klarna@1.1.8) (2021-03-30)
### Bug Fixes
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.7...medusa-payment-klarna@1.1.8) (2021-03-23)
### Bug Fixes
* klarna doesn't treat negative discounts well ([e275184](https://github.com/medusajs/medusa/commit/e27518435ea1fafe556168c36475916a4243eabe))
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.6...medusa-payment-klarna@1.1.7) (2021-03-17)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.4...medusa-payment-klarna@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.4...medusa-payment-klarna@1.1.5) (2021-03-17)
**Note:** Version bump only for package medusa-payment-klarna
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.3...medusa-payment-klarna@1.1.4) (2021-02-17) ## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.3...medusa-payment-klarna@1.1.4) (2021-02-17)
**Note:** Version bump only for package medusa-payment-klarna **Note:** Version bump only for package medusa-payment-klarna
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "medusa-payment-klarna", "name": "medusa-payment-klarna",
"version": "1.1.4", "version": "1.1.13",
"description": "Klarna Payment provider for Medusa Commerce", "description": "Klarna Payment provider for Medusa Commerce",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -40,8 +40,8 @@
"axios": "^0.21.0", "axios": "^0.21.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"express": "^4.17.1", "express": "^4.17.1",
"medusa-core-utils": "^1.1.0", "medusa-core-utils": "^1.1.9",
"medusa-test-utils": "^1.1.3" "medusa-test-utils": "^1.1.12"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -102,7 +102,7 @@ class KlarnaProviderService extends PaymentService {
order.order_lines = await this.lineItemsToOrderLines_(cart, region.tax_rate) order.order_lines = await this.lineItemsToOrderLines_(cart, region.tax_rate)
if (discount_total) { if (discount_total > 0) {
order.order_lines.push({ order.order_lines.push({
name: `Discount`, name: `Discount`,
quantity: 1, quantity: 1,
@@ -113,6 +113,16 @@ class KlarnaProviderService extends PaymentService {
total_amount: -discount_total * (1 + taxRate), total_amount: -discount_total * (1 + taxRate),
total_tax_amount: -discount_total * taxRate, total_tax_amount: -discount_total * taxRate,
}) })
} else if (discount_total < 0) {
order.order_lines.push({
name: `Discount Payback`,
quantity: 1,
type: "surcharge",
unit_price: -discount_total * (1 + taxRate),
tax_rate: taxRate * 10000,
total_amount: -discount_total * (1 + taxRate),
total_tax_amount: -discount_total * taxRate,
})
} }
if (gift_card_total) { if (gift_card_total) {
@@ -3,6 +3,89 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.0.13](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.12...medusa-payment-paypal@1.0.13) (2021-04-29)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.12](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.9...medusa-payment-paypal@1.0.12) (2021-04-28)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.11](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.10...medusa-payment-paypal@1.0.11) (2021-04-20)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.10](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.9...medusa-payment-paypal@1.0.10) (2021-04-20)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.9](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.8...medusa-payment-paypal@1.0.9) (2021-04-13)
### Bug Fixes
* merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
## [1.0.8](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.7...medusa-payment-paypal@1.0.8) (2021-04-13)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.7](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.6...medusa-payment-paypal@1.0.7) (2021-03-30)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.6](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.5...medusa-payment-paypal@1.0.6) (2021-03-17)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.5](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.3...medusa-payment-paypal@1.0.5) (2021-03-17)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.4](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.3...medusa-payment-paypal@1.0.4) (2021-03-17)
**Note:** Version bump only for package medusa-payment-paypal
## [1.0.3](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.2...medusa-payment-paypal@1.0.3) (2021-02-17) ## [1.0.3](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.2...medusa-payment-paypal@1.0.3) (2021-02-17)
**Note:** Version bump only for package medusa-payment-paypal **Note:** Version bump only for package medusa-payment-paypal
+7 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "medusa-payment-paypal", "name": "medusa-payment-paypal",
"version": "1.0.3", "version": "1.0.13",
"description": "Paypal Payment provider for Meduas Commerce", "description": "Paypal Payment provider for Meduas Commerce",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -26,12 +26,13 @@
"cross-env": "^5.2.1", "cross-env": "^5.2.1",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"jest": "^25.5.2", "jest": "^25.5.2",
"medusa-test-utils": "^1.1.3" "medusa-interfaces": "^1.1.10",
"medusa-test-utils": "^1.1.12"
}, },
"scripts": { "scripts": {
"build": "babel src -d . --ignore **/__tests__", "build": "babel src -d . --ignore **/__tests__,**/__mocks__",
"prepare": "cross-env NODE_ENV=production npm run build", "prepare": "cross-env NODE_ENV=production npm run build",
"watch": "babel -w src --out-dir . --ignore **/__tests__", "watch": "babel -w src --out-dir . --ignore **/__tests__,**/__mocks__",
"test": "jest" "test": "jest"
}, },
"peerDependencies": { "peerDependencies": {
@@ -41,7 +42,7 @@
"@paypal/checkout-server-sdk": "^1.0.2", "@paypal/checkout-server-sdk": "^1.0.2",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"express": "^4.17.1", "express": "^4.17.1",
"medusa-core-utils": "^1.1.0" "medusa-core-utils": "^1.1.9"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -0,0 +1,87 @@
export const PayPalClientMock = {
execute: jest.fn().mockImplementation((r) => {
return {
result: r.result,
}
}),
}
export const PayPalMock = {
core: {
SandboxEnvironment: function () {
this.env = {
sandbox: true,
live: false,
}
},
LiveEnvironment: function () {
this.env = {
sandbox: false,
live: true,
}
},
PayPalHttpClient: function () {
return PayPalClientMock
},
},
payments: {
AuthorizationsGetRequest: jest.fn().mockImplementation(() => {}),
AuthorizationsVoidRequest: jest.fn().mockImplementation(() => {}),
AuthorizationsCaptureRequest: jest.fn().mockImplementation(() => {
return {
result: {
id: "test",
},
capture: true,
}
}),
CapturesRefundRequest: jest.fn().mockImplementation(() => {
return {
result: {
id: "test",
},
body: null,
requestBody: function (d) {
this.body = d
},
}
}),
},
orders: {
OrdersCreateRequest: jest.fn().mockImplementation(() => {
return {
result: {
id: "test",
},
order: true,
body: null,
requestBody: function (d) {
this.body = d
},
}
}),
OrdersPatchRequest: jest.fn().mockImplementation(() => {
return {
result: {
id: "test",
},
order: true,
body: null,
requestBody: function (d) {
this.body = d
},
}
}),
OrdersGetRequest: jest.fn().mockImplementation(() => {
return {
result: {
id: "test",
},
}
}),
},
}
export default PayPalMock
@@ -0,0 +1,346 @@
import PayPalProviderService from "../paypal-provider"
import {
PayPalMock,
PayPalClientMock,
} from "../../__mocks__/@paypal/checkout-server-sdk"
const TotalsServiceMock = {
getTotal: jest.fn().mockImplementation((c) => c.total),
}
const RegionServiceMock = {
retrieve: jest.fn().mockImplementation((id) =>
Promise.resolve({
currency_code: "eur",
})
),
}
describe("PaypalProviderService", () => {
describe("createPayment", () => {
let result
const paypalProviderService = new PayPalProviderService(
{
regionService: RegionServiceMock,
totalsService: TotalsServiceMock,
},
{
api_key: "test",
}
)
beforeEach(async () => {
jest.clearAllMocks()
})
it("creates paypal order", async () => {
result = await paypalProviderService.createPayment({
id: "test_cart",
region_id: "fr",
total: 1000,
})
expect(PayPalMock.orders.OrdersCreateRequest).toHaveBeenCalledTimes(1)
expect(PayPalClientMock.execute).toHaveBeenCalledTimes(1)
expect(PayPalClientMock.execute).toHaveBeenCalledWith(
expect.objectContaining({
order: true,
body: {
intent: "AUTHORIZE",
application_context: {
shipping_preference: "NO_SHIPPING",
},
purchase_units: [
{
custom_id: "test_cart",
amount: {
currency_code: "EUR",
value: "10.00",
},
},
],
},
})
)
expect(result.id).toEqual("test")
})
})
describe("retrievePayment", () => {
let result
const paypalProviderService = new PayPalProviderService(
{
regionService: RegionServiceMock,
totalsService: TotalsServiceMock,
},
{
api_key: "test",
}
)
beforeEach(async () => {
jest.clearAllMocks()
})
it("retrieves paypal order", async () => {
result = await paypalProviderService.retrievePayment({ id: "test" })
expect(PayPalMock.orders.OrdersGetRequest).toHaveBeenCalledTimes(1)
expect(PayPalMock.orders.OrdersGetRequest).toHaveBeenCalledWith("test")
expect(PayPalClientMock.execute).toHaveBeenCalledTimes(1)
expect(result.id).toEqual("test")
})
})
describe("updatePayment", () => {
let result
const paypalProviderService = new PayPalProviderService(
{
regionService: RegionServiceMock,
totalsService: TotalsServiceMock,
},
{
api_key: "test",
}
)
beforeEach(async () => {
jest.clearAllMocks()
})
it("updates paypal order", async () => {
result = await paypalProviderService.updatePayment(
{ id: "test" },
{
id: "test_cart",
region_id: "fr",
total: 1000,
}
)
expect(PayPalMock.orders.OrdersPatchRequest).toHaveBeenCalledTimes(1)
expect(PayPalMock.orders.OrdersPatchRequest).toHaveBeenCalledWith("test")
expect(PayPalClientMock.execute).toHaveBeenCalledTimes(1)
expect(PayPalClientMock.execute).toHaveBeenCalledWith(
expect.objectContaining({
order: true,
body: [
{
op: "replace",
path: "/purchase_units/@reference_id=='default'",
value: {
amount: {
currency_code: "EUR",
value: "10.00",
},
},
},
],
})
)
expect(result.id).toEqual("test")
})
})
describe("capturePayment", () => {
let result
const paypalProviderService = new PayPalProviderService(
{
regionService: RegionServiceMock,
totalsService: TotalsServiceMock,
},
{
api_key: "test",
}
)
beforeEach(async () => {
jest.clearAllMocks()
})
it("updates paypal order", async () => {
result = await paypalProviderService.capturePayment({
data: {
id: "test",
purchase_units: [
{
payments: {
authorizations: [
{
id: "test_auth",
},
],
},
},
],
},
})
expect(
PayPalMock.payments.AuthorizationsCaptureRequest
).toHaveBeenCalledTimes(1)
expect(
PayPalMock.payments.AuthorizationsCaptureRequest
).toHaveBeenCalledWith("test_auth")
expect(PayPalMock.orders.OrdersGetRequest).toHaveBeenCalledWith("test")
expect(PayPalClientMock.execute).toHaveBeenCalledTimes(2)
expect(result.id).toEqual("test")
})
})
describe("refundPayment", () => {
let result
const paypalProviderService = new PayPalProviderService(
{
regionService: RegionServiceMock,
totalsService: TotalsServiceMock,
},
{
api_key: "test",
}
)
beforeEach(async () => {
jest.clearAllMocks()
})
it("refunds payment", async () => {
result = await paypalProviderService.refundPayment(
{
currency_code: "eur",
data: {
id: "test",
purchase_units: [
{
payments: {
captures: [
{
id: "test_cap",
},
],
},
},
],
},
},
2000
)
expect(PayPalMock.payments.CapturesRefundRequest).toHaveBeenCalledWith(
"test_cap"
)
expect(PayPalMock.orders.OrdersGetRequest).toHaveBeenCalledWith("test")
expect(PayPalClientMock.execute).toHaveBeenCalledTimes(2)
expect(PayPalClientMock.execute).toHaveBeenCalledWith(
expect.objectContaining({
body: {
amount: {
currency_code: "EUR",
value: "20.00",
},
},
})
)
expect(result.id).toEqual("test")
})
it("doesn't refund without captures", async () => {
await expect(
paypalProviderService.refundPayment(
{
currency_code: "eur",
data: {
id: "test",
purchase_units: [
{
payments: {
captures: [],
},
},
],
},
},
2000
)
).rejects.toThrow("Order not yet captured")
})
})
describe("cancelPayment", () => {
let result
const paypalProviderService = new PayPalProviderService(
{
regionService: RegionServiceMock,
totalsService: TotalsServiceMock,
},
{
api_key: "test",
}
)
beforeEach(async () => {
jest.clearAllMocks()
})
it("refunds if captured", async () => {
result = await paypalProviderService.cancelPayment({
captured_at: "true",
currency_code: "eur",
data: {
id: "test",
purchase_units: [
{
payments: {
captures: [
{
id: "test_cap",
},
],
},
},
],
},
})
expect(PayPalMock.payments.CapturesRefundRequest).toHaveBeenCalledWith(
"test_cap"
)
expect(PayPalMock.orders.OrdersGetRequest).toHaveBeenCalledWith("test")
expect(PayPalClientMock.execute).toHaveBeenCalledTimes(2)
expect(result.id).toEqual("test")
})
it("voids if not captured", async () => {
result = await paypalProviderService.cancelPayment({
currency_code: "eur",
data: {
id: "test",
purchase_units: [
{
payments: {
authorizations: [
{
id: "test_auth",
},
],
},
},
],
},
})
expect(
PayPalMock.payments.AuthorizationsVoidRequest
).toHaveBeenCalledWith("test_auth")
expect(PayPalMock.orders.OrdersGetRequest).toHaveBeenCalledWith("test")
expect(PayPalClientMock.execute).toHaveBeenCalledTimes(2)
expect(result.id).toEqual("test")
})
})
})
@@ -5,7 +5,7 @@ import { PaymentService } from "medusa-interfaces"
class PayPalProviderService extends PaymentService { class PayPalProviderService extends PaymentService {
static identifier = "paypal" static identifier = "paypal"
constructor({ customerService, totalsService, regionService }, options) { constructor({ totalsService, regionService }, options) {
super() super()
/** /**
@@ -35,9 +35,6 @@ class PayPalProviderService extends PaymentService {
/** @private @const {PayPalHttpClient} */ /** @private @const {PayPalHttpClient} */
this.paypal_ = new PayPal.core.PayPalHttpClient(environment) this.paypal_ = new PayPal.core.PayPalHttpClient(environment)
/** @private @const {CustomerService} */
this.customerService_ = customerService
/** @private @const {RegionService} */ /** @private @const {RegionService} */
this.regionService_ = regionService this.regionService_ = regionService
@@ -196,7 +193,7 @@ class PayPalProviderService extends PaymentService {
value: { value: {
amount: { amount: {
currency_code: currency_code.toUpperCase(), currency_code: currency_code.toUpperCase(),
value: (cart.total / 100).toFixed(), value: (cart.total / 100).toFixed(2),
}, },
}, },
}, },
@@ -240,7 +237,7 @@ class PayPalProviderService extends PaymentService {
* Refunds a given amount. * Refunds a given amount.
* @param {object} payment - payment to refund * @param {object} payment - payment to refund
* @param {number} amountToRefund - amount to refund * @param {number} amountToRefund - amount to refund
* @returns {string} the resulting PayPal order * @returns {Promise<Object>} the resulting PayPal order
*/ */
async refundPayment(payment, amountToRefund) { async refundPayment(payment, amountToRefund) {
const { purchase_units } = payment.data const { purchase_units } = payment.data
@@ -257,13 +254,13 @@ class PayPalProviderService extends PaymentService {
request.requestBody({ request.requestBody({
amount: { amount: {
currency_code: payment.currency_code.toUpperCase(), currency_code: payment.currency_code.toUpperCase(),
value: (amountToRefund / 100).toFixed(), value: (amountToRefund / 100).toFixed(2),
}, },
}) })
await this.paypal_.execute(request) await this.paypal_.execute(request)
return this.retrievePayment(payment.id) return this.retrievePayment(payment.data)
} catch (error) { } catch (error) {
throw error throw error
} }
@@ -272,7 +269,7 @@ class PayPalProviderService extends PaymentService {
/** /**
* Cancels payment for Stripe payment intent. * Cancels payment for Stripe payment intent.
* @param {object} paymentData - payment method data from cart * @param {object} paymentData - payment method data from cart
* @returns {object} canceled payment intent * @returns {Promise<object>} canceled payment intent
*/ */
async cancelPayment(payment) { async cancelPayment(payment) {
try { try {
@@ -3,6 +3,89 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.9...medusa-payment-stripe@1.1.12) (2021-04-28)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.10...medusa-payment-stripe@1.1.11) (2021-04-20)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.9...medusa-payment-stripe@1.1.10) (2021-04-20)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.8...medusa-payment-stripe@1.1.9) (2021-04-13)
### Bug Fixes
* merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.7...medusa-payment-stripe@1.1.8) (2021-04-13)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.6...medusa-payment-stripe@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.5...medusa-payment-stripe@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-payment-stripe
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.3...medusa-payment-stripe@1.1.5) (2021-03-17)
### Bug Fixes
* floor amounts ([5e2f550](https://github.com/medusajs/medusa/commit/5e2f550ae10a3eb7636edf6bf99197517a1fa7b3))
* round instead of floor ([74a6b67](https://github.com/medusajs/medusa/commit/74a6b67f9db0a66fdf3cf69be6db62ae0deea635))
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.3...medusa-payment-stripe@1.1.4) (2021-03-17)
### Bug Fixes
* floor amounts ([5e2f550](https://github.com/medusajs/medusa/commit/5e2f550ae10a3eb7636edf6bf99197517a1fa7b3))
* round instead of floor ([74a6b67](https://github.com/medusajs/medusa/commit/74a6b67f9db0a66fdf3cf69be6db62ae0deea635))
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.2...medusa-payment-stripe@1.1.3) (2021-02-17) ## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.2...medusa-payment-stripe@1.1.3) (2021-02-17)
**Note:** Version bump only for package medusa-payment-stripe **Note:** Version bump only for package medusa-payment-stripe
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "medusa-payment-stripe", "name": "medusa-payment-stripe",
"version": "1.1.3", "version": "1.1.12",
"description": "Stripe Payment provider for Meduas Commerce", "description": "Stripe Payment provider for Meduas Commerce",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -26,7 +26,7 @@
"cross-env": "^5.2.1", "cross-env": "^5.2.1",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"jest": "^25.5.2", "jest": "^25.5.2",
"medusa-test-utils": "^1.1.3" "medusa-test-utils": "^1.1.12"
}, },
"scripts": { "scripts": {
"build": "babel src -d . --ignore **/__tests__", "build": "babel src -d . --ignore **/__tests__",
@@ -40,8 +40,8 @@
"dependencies": { "dependencies": {
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"express": "^4.17.1", "express": "^4.17.1",
"medusa-core-utils": "^1.1.0", "medusa-core-utils": "^1.1.9",
"stripe": "^8.50.0" "stripe": "^8.50.0"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -3,6 +3,82 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.9...medusa-plugin-add-ons@1.1.12) (2021-04-28)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.10...medusa-plugin-add-ons@1.1.11) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.9...medusa-plugin-add-ons@1.1.10) (2021-04-20)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.8...medusa-plugin-add-ons@1.1.9) (2021-04-13)
### Bug Fixes
* merge develop ([2982a8e](https://github.com/medusajs/medusa/commit/2982a8e682e90beb4549d969d9d3b04d78a46a2d))
* merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.7...medusa-plugin-add-ons@1.1.8) (2021-04-13)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.6...medusa-plugin-add-ons@1.1.7) (2021-03-30)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.5...medusa-plugin-add-ons@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.3...medusa-plugin-add-ons@1.1.5) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.3...medusa-plugin-add-ons@1.1.4) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-add-ons
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.2...medusa-plugin-add-ons@1.1.3) (2021-02-17) ## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.2...medusa-plugin-add-ons@1.1.3) (2021-02-17)
**Note:** Version bump only for package medusa-plugin-add-ons **Note:** Version bump only for package medusa-plugin-add-ons
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "medusa-plugin-add-ons", "name": "medusa-plugin-add-ons",
"version": "1.1.3", "version": "1.1.12",
"description": "Add-on plugin for Medusa Commerce", "description": "Add-on plugin for Medusa Commerce",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -25,7 +25,7 @@
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"jest": "^25.5.2", "jest": "^25.5.2",
"medusa-test-utils": "^1.1.3" "medusa-test-utils": "^1.1.12"
}, },
"scripts": { "scripts": {
"build": "babel src -d . --ignore **/__tests__", "build": "babel src -d . --ignore **/__tests__",
@@ -37,8 +37,8 @@
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"express": "^4.17.1", "express": "^4.17.1",
"medusa-core-utils": "^1.1.0", "medusa-core-utils": "^1.1.9",
"redis": "^3.0.2" "redis": "^3.0.2"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -3,6 +3,129 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.15](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.13...medusa-plugin-brightpearl@1.1.15) (2021-04-28)
### Bug Fixes
* better inventory sync ([9eaf027](https://github.com/medusajs/medusa/commit/9eaf02762ff1ad455ac5020668ee9106db7c705a))
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.13...medusa-plugin-brightpearl@1.1.14) (2021-04-20)
### Features
* **medusa:** Swaps on swaps ([#229](https://github.com/medusajs/medusa/issues/229)) ([f8f1f57](https://github.com/medusajs/medusa/commit/f8f1f57fa1bcdc6f7ae4183e657a07e2641b1345))
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.13...medusa-plugin-brightpearl@1.1.13) (2021-04-20)
### Features
* **medusa:** Swaps on swaps ([#229](https://github.com/medusajs/medusa/issues/229)) ([f8f1f57](https://github.com/medusajs/medusa/commit/f8f1f57fa1bcdc6f7ae4183e657a07e2641b1345))
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.12...medusa-plugin-brightpearl@1.1.13) (2021-04-14)
**Note:** Version bump only for package medusa-plugin-brightpearl
## [1.1.12](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.11...medusa-plugin-brightpearl@1.1.12) (2021-04-13)
### Bug Fixes
* bp swaps ([e105d4e](https://github.com/medusajs/medusa/commit/e105d4edde5793f40e867291606b3db5e44dc24f))
* merge develop ([2982a8e](https://github.com/medusajs/medusa/commit/2982a8e682e90beb4549d969d9d3b04d78a46a2d))
* merge develop ([a468c45](https://github.com/medusajs/medusa/commit/a468c451e82c68f41b5005a2e480057f6124aaa6))
* typo ([37ab52b](https://github.com/medusajs/medusa/commit/37ab52b19514fb1dfd864f0c218efd7ad205ff30))
## [1.1.11](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.10...medusa-plugin-brightpearl@1.1.11) (2021-04-13)
### Bug Fixes
* bp swaps ([e105d4e](https://github.com/medusajs/medusa/commit/e105d4edde5793f40e867291606b3db5e44dc24f))
* typo ([37ab52b](https://github.com/medusajs/medusa/commit/37ab52b19514fb1dfd864f0c218efd7ad205ff30))
## [1.1.10](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.9...medusa-plugin-brightpearl@1.1.10) (2021-04-01)
### Bug Fixes
* don't divide zero decimal currencies ([cfab2d4](https://github.com/medusajs/medusa/commit/cfab2d408a296a938266d0989b1de67d060b2ed5))
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.9...medusa-plugin-brightpearl@1.1.9) (2021-03-30)
### Bug Fixes
* don't divide zero decimal currencies ([cfab2d4](https://github.com/medusajs/medusa/commit/cfab2d408a296a938266d0989b1de67d060b2ed5))
* publish assist ([7719957](https://github.com/medusajs/medusa/commit/7719957b44a0c0d950eff948faf31188fe0e3ef1))
## [1.1.9](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.8...medusa-plugin-brightpearl@1.1.9) (2021-03-25)
**Note:** Version bump only for package medusa-plugin-brightpearl
## [1.1.8](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.7...medusa-plugin-brightpearl@1.1.8) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-brightpearl
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.5...medusa-plugin-brightpearl@1.1.7) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-brightpearl
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.5...medusa-plugin-brightpearl@1.1.6) (2021-03-17)
**Note:** Version bump only for package medusa-plugin-brightpearl
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.4...medusa-plugin-brightpearl@1.1.5) (2021-02-25) ## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.4...medusa-plugin-brightpearl@1.1.5) (2021-02-25)
**Note:** Version bump only for package medusa-plugin-brightpearl **Note:** Version bump only for package medusa-plugin-brightpearl
@@ -1,6 +1,6 @@
{ {
"name": "medusa-plugin-brightpearl", "name": "medusa-plugin-brightpearl",
"version": "1.1.5", "version": "1.1.15",
"description": "Brightpearl plugin for Medusa Commerce", "description": "Brightpearl plugin for Medusa Commerce",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@@ -27,7 +27,7 @@
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"jest": "^25.5.2", "jest": "^25.5.2",
"medusa-test-utils": "^1.1.3", "medusa-test-utils": "^1.1.12",
"prettier": "^2.0.5" "prettier": "^2.0.5"
}, },
"scripts": { "scripts": {
@@ -43,8 +43,8 @@
"axios": "^0.19.2", "axios": "^0.19.2",
"axios-rate-limit": "^1.2.1", "axios-rate-limit": "^1.2.1",
"express": "^4.17.1", "express": "^4.17.1",
"medusa-core-utils": "^1.1.0", "medusa-core-utils": "^1.1.9",
"randomatic": "^3.1.1" "randomatic": "^3.1.1"
}, },
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd" "gitHead": "982da259ed93fe1b618800c8693a5c9dfe312532"
} }
@@ -65,7 +65,7 @@ export default (container) => {
throw new Error("Already sent to BP") throw new Error("Already sent to BP")
} }
await brightpearlService.createSalesOrder(order) await brightpearlService.createSalesOrder(order.id)
res.sendStatus(200) res.sendStatus(200)
} catch (err) { } catch (err) {
res.status(400).json(err) res.status(400).json(err)
Loaded 100 of 251 files, more files were not shown because too many files have changed in this diff. Show more