@@ -7,8 +7,7 @@ executors:
|
||||
parameters:
|
||||
image:
|
||||
type: string
|
||||
# First 10.x LTS release, but old Yarn
|
||||
default: "10.14"
|
||||
default: "12.13"
|
||||
docker:
|
||||
- image: circleci/node:<< parameters.image >>
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
"build": "babel src -d dist --extensions \".ts,.js\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@medusajs/medusa": "1.1.11-dev-1615562702314",
|
||||
"medusa-interfaces": "1.1.1-dev-1615562702314"
|
||||
"@medusajs/medusa": "1.1.11-dev-1615929449260",
|
||||
"medusa-interfaces": "1.1.1-dev-1615929449260"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.12.10",
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/node": "^7.12.10",
|
||||
"babel-preset-medusa-package": "1.1.0-dev-1615562702314"
|
||||
"babel-preset-medusa-package": "1.1.0-dev-1615929449260"
|
||||
}
|
||||
}
|
||||
|
||||
+28
-377
@@ -946,10 +946,10 @@
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
|
||||
"@medusajs/medusa@1.1.11-dev-1615562702314":
|
||||
version "1.1.11-dev-1615562702314"
|
||||
resolved "http://localhost:4873/@medusajs%2fmedusa/-/medusa-1.1.11-dev-1615562702314.tgz#2bd0b0ba84e38a9717a2ab44ee52bcac31162125"
|
||||
integrity sha512-/23r7U+3jT33o2D2GdhRj9rWqoe0ZP8mQ2H+0ukx+QnFgD+Y/NwigNrDm98fxLwDDZmeFQx2s2EXzgBW3cO7mw==
|
||||
"@medusajs/medusa@1.1.11-dev-1615929449260":
|
||||
version "1.1.11-dev-1615929449260"
|
||||
resolved "http://localhost:4873/@medusajs%2fmedusa/-/medusa-1.1.11-dev-1615929449260.tgz#4635d197df491fa10ad80c6fda5818edb6cbe9ad"
|
||||
integrity sha512-Yx94TuEWe76MLslv1PmDOIDrEJ5lQz8cL2rikK7OquK4oyt0Y8xCE5MNgiiZCP71/sv3TMCoTx0GZxrl02vk8w==
|
||||
dependencies:
|
||||
"@babel/plugin-transform-classes" "^7.9.5"
|
||||
"@hapi/joi" "^16.1.8"
|
||||
@@ -971,8 +971,8 @@
|
||||
joi "^17.3.0"
|
||||
joi-objectid "^3.0.1"
|
||||
jsonwebtoken "^8.5.1"
|
||||
medusa-core-utils "1.1.0-dev-1615562702314"
|
||||
medusa-test-utils "1.1.3-dev-1615562702314"
|
||||
medusa-core-utils "1.1.0-dev-1615929449260"
|
||||
medusa-test-utils "1.1.3-dev-1615929449260"
|
||||
morgan "^1.9.1"
|
||||
multer "^1.4.2"
|
||||
passport "^0.4.0"
|
||||
@@ -986,7 +986,6 @@
|
||||
request-ip "^2.1.3"
|
||||
resolve-cwd "^3.0.0"
|
||||
scrypt-kdf "^2.0.1"
|
||||
typeorm "^0.2.29"
|
||||
ulid "^2.3.0"
|
||||
uuid "^8.3.1"
|
||||
winston "^3.2.1"
|
||||
@@ -1046,11 +1045,6 @@
|
||||
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
|
||||
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":
|
||||
version "8.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.1.tgz#1e49f22d09aa46e19b51c0b013cb63d0d923a068"
|
||||
@@ -1089,21 +1083,6 @@ accepts@~1.3.7:
|
||||
mime-types "~2.1.24"
|
||||
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:
|
||||
version "3.2.1"
|
||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
||||
@@ -1111,18 +1090,6 @@ ansi-styles@^3.2.1:
|
||||
dependencies:
|
||||
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:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb"
|
||||
@@ -1139,23 +1106,11 @@ anymatch@~3.1.1:
|
||||
normalize-path "^3.0.0"
|
||||
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:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/append-field/-/append-field-1.0.0.tgz#1e3440e915f0b1203d23748e78edd7b9b5b43e56"
|
||||
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:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
|
||||
@@ -1229,10 +1184,10 @@ babel-plugin-transform-typescript-metadata@^0.3.1:
|
||||
dependencies:
|
||||
"@babel/helper-plugin-utils" "^7.0.0"
|
||||
|
||||
babel-preset-medusa-package@1.1.0-dev-1615562702314:
|
||||
version "1.1.0-dev-1615562702314"
|
||||
resolved "http://localhost:4873/babel-preset-medusa-package/-/babel-preset-medusa-package-1.1.0-dev-1615562702314.tgz#c0e8a2c29054ffad39b91320f2258ea6e3eda176"
|
||||
integrity sha512-1x2PPmBkTA6+6Rv7SgkuaFdTRpfngF2OfZZ62+Fy0QYSEx3tq+T3r5MlAMV8uCAZCY2gY+n6irQ8Mq6K2LS5xQ==
|
||||
babel-preset-medusa-package@1.1.0-dev-1615929449260:
|
||||
version "1.1.0-dev-1615929449260"
|
||||
resolved "http://localhost:4873/babel-preset-medusa-package/-/babel-preset-medusa-package-1.1.0-dev-1615929449260.tgz#668c9d5f7e385ca1f3b0c681b6e90f0195d45025"
|
||||
integrity sha512-y3GY3HFPPWOCY6OZ3rh3Ybms/LI6PzvD6Mo+nP6RBw1us6p4UAle1EoQrOp4gXYb5WX9PsYN5TwVUwgDNO7uwg==
|
||||
dependencies:
|
||||
"@babel/plugin-proposal-class-properties" "^7.12.1"
|
||||
"@babel/plugin-proposal-decorators" "^7.12.1"
|
||||
@@ -1249,11 +1204,6 @@ balanced-match@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||
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:
|
||||
version "0.11.2"
|
||||
resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f"
|
||||
@@ -1357,14 +1307,6 @@ buffer-writer@2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04"
|
||||
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:
|
||||
version "3.20.0"
|
||||
resolved "https://registry.yarnpkg.com/bull/-/bull-3.20.0.tgz#ca394d623f13ade6cddb7481f630988bce2d4d09"
|
||||
@@ -1430,17 +1372,6 @@ caniuse-lite@^1.0.30001173:
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001181.tgz#4f0e5184e1ea7c3bf2727e735cbe7ca9a451d673"
|
||||
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:
|
||||
version "2.4.2"
|
||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
|
||||
@@ -1450,14 +1381,6 @@ chalk@^2.0.0:
|
||||
escape-string-regexp "^1.0.5"
|
||||
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:
|
||||
version "3.5.1"
|
||||
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a"
|
||||
@@ -1483,27 +1406,6 @@ class-utils@^0.3.5:
|
||||
isobject "^3.0.0"
|
||||
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:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.0.tgz#30474b2a981fb12172695833052bc0d01336d10d"
|
||||
@@ -1524,19 +1426,12 @@ color-convert@^1.9.0, color-convert@^1.9.1:
|
||||
dependencies:
|
||||
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:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
|
||||
|
||||
color-name@^1.0.0, color-name@~1.1.4:
|
||||
color-name@^1.0.0:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||
@@ -1796,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"
|
||||
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:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/enabled/-/enabled-2.0.0.tgz#f9dd92ec2d6f4bbc0d5d1e64e21d61cd4665e7c2"
|
||||
@@ -1867,16 +1757,11 @@ escape-html@~1.0.3:
|
||||
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
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:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
|
||||
@@ -2008,11 +1893,6 @@ fecha@^4.2.0:
|
||||
resolved "https://registry.yarnpkg.com/fecha/-/fecha-4.2.0.tgz#3ffb6395453e3f3efff850404f0a59b6747f5f41"
|
||||
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:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7"
|
||||
@@ -2132,11 +2012,6 @@ gensync@^1.0.0-beta.1:
|
||||
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
|
||||
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:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.0.tgz#892e62931e6938c8a23ea5aaebcfb67bd97da97e"
|
||||
@@ -2207,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"
|
||||
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:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
||||
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:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8"
|
||||
@@ -2267,11 +2130,6 @@ has@^1.0.3:
|
||||
dependencies:
|
||||
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:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8"
|
||||
@@ -2308,11 +2166,6 @@ iconv-lite@0.4.24:
|
||||
dependencies:
|
||||
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:
|
||||
version "5.1.8"
|
||||
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
|
||||
@@ -2326,7 +2179,7 @@ inflight@^1.0.4:
|
||||
once "^1.3.0"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
||||
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
||||
@@ -2469,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"
|
||||
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:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a"
|
||||
@@ -2602,14 +2450,6 @@ js-tokens@^4.0.0:
|
||||
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
|
||||
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:
|
||||
version "2.5.2"
|
||||
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
|
||||
@@ -2809,28 +2649,28 @@ media-typer@0.3.0:
|
||||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
|
||||
integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=
|
||||
|
||||
medusa-core-utils@1.1.0-dev-1615562702314:
|
||||
version "1.1.0-dev-1615562702314"
|
||||
resolved "http://localhost:4873/medusa-core-utils/-/medusa-core-utils-1.1.0-dev-1615562702314.tgz#972a9e140f73a143f2c4a57d756862042c3f7178"
|
||||
integrity sha512-kipde/u8SEMzcNdIHkdBd578gt1taL6O6buE/O7Ne+Egze6zbT9yrJjQrbafQigFkTfXW3ngq28yZwKxblMUlA==
|
||||
medusa-core-utils@1.1.0-dev-1615929449260:
|
||||
version "1.1.0-dev-1615929449260"
|
||||
resolved "http://localhost:4873/medusa-core-utils/-/medusa-core-utils-1.1.0-dev-1615929449260.tgz#ad6334e195a77cbf1764ea637f6071a4441adf68"
|
||||
integrity sha512-udhVtrOWoab7Mljb4r427+iCZ1vy/XJb+yr6Q8xZe535on6DYpjahEiuLgkyy19wX50kVv5yt3raTE4Vg3yKEw==
|
||||
dependencies:
|
||||
joi "^17.3.0"
|
||||
joi-objectid "^3.0.1"
|
||||
|
||||
medusa-interfaces@1.1.1-dev-1615562702314:
|
||||
version "1.1.1-dev-1615562702314"
|
||||
resolved "http://localhost:4873/medusa-interfaces/-/medusa-interfaces-1.1.1-dev-1615562702314.tgz#c3aa0e7dff39727921d3618ec5497e59aec9ed2a"
|
||||
integrity sha512-G0aG2QPaWdH4G2hri2PiAfYPGKHCQ6Fe9UVKCirH9gTf6KQgGUgBbp0GH0Bvy9o3xnxR1Wm/u0jsID4jtNQyxw==
|
||||
medusa-interfaces@1.1.1-dev-1615929449260:
|
||||
version "1.1.1-dev-1615929449260"
|
||||
resolved "http://localhost:4873/medusa-interfaces/-/medusa-interfaces-1.1.1-dev-1615929449260.tgz#6034b9f472591b85294430ecce8c68a8b05bd58a"
|
||||
integrity sha512-w4ORNLHtec/DbMTLCfWatcUU9uVZfQtiOV12/quxg+N9K/2yk7jl8SAWhFiCc0gbT7Trwy1+V8esGEaAIPqMkQ==
|
||||
dependencies:
|
||||
medusa-core-utils "1.1.0-dev-1615562702314"
|
||||
medusa-core-utils "1.1.0-dev-1615929449260"
|
||||
|
||||
medusa-test-utils@1.1.3-dev-1615562702314:
|
||||
version "1.1.3-dev-1615562702314"
|
||||
resolved "http://localhost:4873/medusa-test-utils/-/medusa-test-utils-1.1.3-dev-1615562702314.tgz#c3a50e97ab31bed9bfa9519d40ef06fcac79b826"
|
||||
integrity sha512-kjMldY4ZKw+Emu59+0NEVazm+TrklB8htgGvRbY6+G7Oues14UobFDcBPILnvDROSwoxdwhsSy2Q8TycAH4cOg==
|
||||
medusa-test-utils@1.1.3-dev-1615929449260:
|
||||
version "1.1.3-dev-1615929449260"
|
||||
resolved "http://localhost:4873/medusa-test-utils/-/medusa-test-utils-1.1.3-dev-1615929449260.tgz#7b6d81c6eae1147e5f36d7242021f9f245e8662d"
|
||||
integrity sha512-Kqxf8/HjusYvVLf6jjdC62ci68JGyE20P1W8suB7cM8qnXNJHuKh5EXhFJRFX00tgr3N2oq68qrAUNcakB0IKA==
|
||||
dependencies:
|
||||
"@babel/plugin-transform-classes" "^7.9.5"
|
||||
medusa-core-utils "1.1.0-dev-1615562702314"
|
||||
medusa-core-utils "1.1.0-dev-1615929449260"
|
||||
randomatic "^3.1.1"
|
||||
|
||||
merge-descriptors@1.0.1:
|
||||
@@ -2919,11 +2759,6 @@ mkdirp@^0.5.1:
|
||||
dependencies:
|
||||
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:
|
||||
version "0.5.32"
|
||||
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.32.tgz#db7677cc3cc680fd30303ebd90b0da1ca0dfecc2"
|
||||
@@ -2981,15 +2816,6 @@ multer@^1.4.2:
|
||||
type-is "^1.6.4"
|
||||
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:
|
||||
version "1.2.13"
|
||||
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"
|
||||
@@ -3050,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"
|
||||
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"
|
||||
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
|
||||
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
|
||||
@@ -3174,33 +3000,11 @@ packet-reader@1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74"
|
||||
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:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6"
|
||||
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:
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
|
||||
@@ -3600,11 +3404,6 @@ request-ip@^2.1.3:
|
||||
dependencies:
|
||||
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:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d"
|
||||
@@ -3675,11 +3474,6 @@ safe-regex@^1.1.0:
|
||||
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
|
||||
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:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/scrypt-kdf/-/scrypt-kdf-2.0.1.tgz#3355224c52d398331b2cbf2b70a7be26b52c53e6"
|
||||
@@ -3746,14 +3540,6 @@ setprototypeof@1.1.1:
|
||||
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.1.1.tgz#7e95acb24aa92f5885e0abef5ba131330d4ae683"
|
||||
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:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
|
||||
@@ -3849,11 +3635,6 @@ split2@^3.1.1:
|
||||
dependencies:
|
||||
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:
|
||||
version "0.0.10"
|
||||
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0"
|
||||
@@ -3882,15 +3663,6 @@ streamsearch@0.1.2:
|
||||
resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-0.1.2.tgz#808b9d0e56fc273d809ba57338e929919a1a9f1a"
|
||||
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:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz#a22bd53cca5c7cf44d7c9d5c732118873d6cd18b"
|
||||
@@ -3926,25 +3698,6 @@ string_decoder@~1.1.1:
|
||||
dependencies:
|
||||
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:
|
||||
version "5.5.0"
|
||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
|
||||
@@ -3952,32 +3705,11 @@ supports-color@^5.3.0:
|
||||
dependencies:
|
||||
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:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/text-hex/-/text-hex-1.0.0.tgz#69dc9c1b17446ee79a92bf5b884bb4b9127506f5"
|
||||
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:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
|
||||
@@ -4025,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"
|
||||
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:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
|
||||
@@ -4048,28 +3775,6 @@ typedarray@^0.0.6:
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
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:
|
||||
version "2.1.5"
|
||||
resolved "https://registry.yarnpkg.com/uid-safe/-/uid-safe-2.1.5.tgz#2b3d5c7240e8fc2e58f8aa269e5ee49c0857bd3a"
|
||||
@@ -4209,71 +3914,17 @@ winston@^3.2.1:
|
||||
triple-beam "^1.3.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:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
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:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
|
||||
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:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
||||
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"
|
||||
|
||||
+745
-506
File diff suppressed because it is too large
Load Diff
+230
-63
@@ -695,49 +695,6 @@ paths:
|
||||
properties:
|
||||
discount:
|
||||
$ref: '#/components/schemas/discount'
|
||||
/notifications:
|
||||
get:
|
||||
operationId: GetNotifications
|
||||
summary: List Notifications
|
||||
description: Retrieves a list of Notifications.
|
||||
tags:
|
||||
- Notification
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
notifications:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/notification'
|
||||
'/notifications/{id}/resend':
|
||||
post:
|
||||
operationId: PostNotificationsNotificationResend
|
||||
summary: Resend Notification
|
||||
description: >-
|
||||
Resends a previously sent notifications, with the same data but
|
||||
optionally to a different address
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Notification
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Notification
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
notification:
|
||||
$ref: '#/components/schemas/notification'
|
||||
/gift-cards:
|
||||
post:
|
||||
operationId: PostGiftCards
|
||||
@@ -910,6 +867,49 @@ paths:
|
||||
properties:
|
||||
gift_card:
|
||||
$ref: '#/components/schemas/gift_card'
|
||||
/notifications:
|
||||
get:
|
||||
operationId: GetNotifications
|
||||
summary: List Notifications
|
||||
description: Retrieves a list of Notifications.
|
||||
tags:
|
||||
- Notification
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
notifications:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/notification'
|
||||
'/notifications/{id}/resend':
|
||||
post:
|
||||
operationId: PostNotificationsNotificationResend
|
||||
summary: Resend Notification
|
||||
description: >-
|
||||
Resends a previously sent notifications, with the same data but
|
||||
optionally to a different address
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Notification
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Notification
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
notification:
|
||||
$ref: '#/components/schemas/notification'
|
||||
'/orders/{id}/shipping-methods':
|
||||
post:
|
||||
operationId: PostOrdersOrderShippingMethods
|
||||
@@ -1314,7 +1314,7 @@ paths:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Swap.
|
||||
description: The id of the Order.
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
@@ -1501,7 +1501,7 @@ paths:
|
||||
get:
|
||||
operationId: GetOrders
|
||||
summary: List Orders
|
||||
description: Retrieves an list of Orders
|
||||
description: Retrieves a list of Orders
|
||||
tags:
|
||||
- Order
|
||||
responses:
|
||||
@@ -1707,6 +1707,12 @@ paths:
|
||||
item_id:
|
||||
description: The id of the Line Item.
|
||||
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:
|
||||
description: The quantity of the Line Item.
|
||||
type: integer
|
||||
@@ -3153,6 +3159,126 @@ paths:
|
||||
properties:
|
||||
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:
|
||||
get:
|
||||
operationId: GetReturns
|
||||
@@ -3482,24 +3608,6 @@ paths:
|
||||
properties:
|
||||
shipping_profiles:
|
||||
$ref: '#/components/schemas/shipping_profile'
|
||||
/swaps:
|
||||
get:
|
||||
operationId: GetSwaps
|
||||
summary: List Swaps
|
||||
description: Retrieves a list of Swaps.
|
||||
tags:
|
||||
- Swap
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
swaps:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/swap'
|
||||
'/store/currencies/{code}':
|
||||
post:
|
||||
operationId: PostStoreCurrenciesCode
|
||||
@@ -3610,6 +3718,24 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/store'
|
||||
/swaps:
|
||||
get:
|
||||
operationId: GetSwaps
|
||||
summary: List Swaps
|
||||
description: Retrieves a list of Swaps.
|
||||
tags:
|
||||
- Swap
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
swaps:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/swap'
|
||||
/variants:
|
||||
get:
|
||||
operationId: GetVariants
|
||||
@@ -5443,6 +5569,47 @@ components:
|
||||
recieved_quantity:
|
||||
description: The quantity that was received in the warehouse.
|
||||
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:
|
||||
description: An optional key-value map with additional information.
|
||||
type: object
|
||||
|
||||
+643
-586
File diff suppressed because it is too large
Load Diff
+496
-199
@@ -75,6 +75,130 @@
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/auth": {
|
||||
"post": {
|
||||
"operationId": "PostAuth",
|
||||
"summary": "Authenticate Customer",
|
||||
"description": "Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser.",
|
||||
"parameters": [],
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"customer": {
|
||||
"$ref": "#/components/schemas/customer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"email",
|
||||
"password"
|
||||
],
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string",
|
||||
"description": "The Customer's email."
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"description": "The Customer's password."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"operationId": "DeleteAuth",
|
||||
"summary": "Log out",
|
||||
"description": "Destroys a Customer's authenticated session.",
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
}
|
||||
},
|
||||
"get": {
|
||||
"operationId": "GetAuth",
|
||||
"summary": "Get Session",
|
||||
"description": "Gets the currently logged in Customer.",
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"customer": {
|
||||
"$ref": "#/components/schemas/customer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/auth/{email}": {
|
||||
"get": {
|
||||
"operationId": "GetAuthEmail",
|
||||
"summary": "Check if email has account",
|
||||
"description": "Checks if a Customer with the given email has signed up.",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "email",
|
||||
"required": true,
|
||||
"description": "The Customer's email.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"exists": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/carts/{id}/shipping-methods": {
|
||||
"post": {
|
||||
"operationId": "PostCartsCartShippingMethod",
|
||||
@@ -217,6 +341,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
"description": "An optional object to provide context to the Cart. The `context` field is automatically populated with `ip` and `user_agent`",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -757,6 +885,10 @@
|
||||
"customer_id": {
|
||||
"description": "The id of the Customer to associate the Cart with.",
|
||||
"type": "string"
|
||||
},
|
||||
"context": {
|
||||
"description": "An optional object to provide context to the Cart.",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1349,111 +1481,24 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/auth": {
|
||||
"post": {
|
||||
"operationId": "PostAuth",
|
||||
"summary": "Authenticate Customer",
|
||||
"description": "Logs a Customer in and authorizes them to view their details. Successful authentication will set a session cookie in the Customer's browser.",
|
||||
"parameters": [],
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"customer": {
|
||||
"$ref": "#/components/schemas/customer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"email",
|
||||
"password"
|
||||
],
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string",
|
||||
"description": "The Customer's email."
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"description": "The Customer's password."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"operationId": "DeleteAuth",
|
||||
"summary": "Log out",
|
||||
"description": "Destroys a Customer's authenticated session.",
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/gift-cards/{code}": {
|
||||
"get": {
|
||||
"operationId": "GetAuth",
|
||||
"summary": "Get Session",
|
||||
"description": "Gets the currently logged in Customer.",
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"customer": {
|
||||
"$ref": "#/components/schemas/customer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/auth/{email}": {
|
||||
"get": {
|
||||
"operationId": "GetAuthEmail",
|
||||
"summary": "Check if email has account",
|
||||
"description": "Checks if a Customer with the given email has signed up.",
|
||||
"operationId": "GetGiftCardsCode",
|
||||
"summary": "Retrieve Gift Card by Code",
|
||||
"description": "Retrieves a Gift Card by its associated unqiue code.",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "email",
|
||||
"name": "code",
|
||||
"required": true,
|
||||
"description": "The Customer's email.",
|
||||
"description": "The unique Gift Card code.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Auth"
|
||||
"Gift Card"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
@@ -1462,8 +1507,20 @@
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"exists": {
|
||||
"type": "boolean"
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1473,61 +1530,24 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/orders/cart/{cart_id}": {
|
||||
"/products/{id}": {
|
||||
"get": {
|
||||
"operationId": "GetOrdersOrderCartId",
|
||||
"summary": "Retrieves Order by Cart id",
|
||||
"description": "Retrieves an Order by the id of the Cart that was used to create the Order.",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "cart_id",
|
||||
"required": true,
|
||||
"description": "The id of Cart.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Order"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"order": {
|
||||
"$ref": "#/components/schemas/order"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/orders/{id}": {
|
||||
"get": {
|
||||
"operationId": "GetOrdersOrder",
|
||||
"summary": "Retrieves an Order",
|
||||
"description": "Retrieves an Order",
|
||||
"operationId": "GetProductsProduct",
|
||||
"summary": "Retrieves a Product",
|
||||
"description": "Retrieves a Product.",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"description": "The id of the Order.",
|
||||
"description": "The id of the Product.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Order"
|
||||
"Product"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
@@ -1536,8 +1556,115 @@
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"customer": {
|
||||
"$ref": "#/components/schemas/customer"
|
||||
"product": {
|
||||
"$ref": "#/components/schemas/product"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/products": {
|
||||
"get": {
|
||||
"operationId": "GetProducts",
|
||||
"summary": "List Products",
|
||||
"description": "Retrieves a list of Products.",
|
||||
"tags": [
|
||||
"Product"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"count": {
|
||||
"description": "The total number of Products.",
|
||||
"type": "integer"
|
||||
},
|
||||
"offset": {
|
||||
"description": "The offset for pagination.",
|
||||
"type": "integer"
|
||||
},
|
||||
"limit": {
|
||||
"description": "The maxmimum number of Products to return,",
|
||||
"type": "integer"
|
||||
},
|
||||
"products": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1625,24 +1752,24 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/swaps/{cart_id}": {
|
||||
"/orders/cart/{cart_id}": {
|
||||
"get": {
|
||||
"operationId": "GetSwapsSwapCartId",
|
||||
"summary": "Retrieve Swap by Cart id",
|
||||
"description": "Retrieves a Swap by the id of the Cart used to confirm the Swap.",
|
||||
"operationId": "GetOrdersOrderCartId",
|
||||
"summary": "Retrieves Order by Cart id",
|
||||
"description": "Retrieves an Order by the id of the Cart that was used to create the Order.",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "cart_id",
|
||||
"required": true,
|
||||
"description": "The id of the Cart",
|
||||
"description": "The id of Cart.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Swap"
|
||||
"Order"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
@@ -1651,8 +1778,157 @@
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"swap": {
|
||||
"$ref": "#/components/schemas/swap"
|
||||
"order": {
|
||||
"$ref": "#/components/schemas/order"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/orders/{id}": {
|
||||
"get": {
|
||||
"operationId": "GetOrdersOrder",
|
||||
"summary": "Retrieves an Order",
|
||||
"description": "Retrieves an Order",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"required": true,
|
||||
"description": "The id of the Order.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Order"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/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"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1668,6 +1944,14 @@
|
||||
"summary": "Retrieve Shipping Options",
|
||||
"description": "Retrieves a list of Shipping Options.",
|
||||
"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",
|
||||
"name": "product_ids",
|
||||
@@ -1749,24 +2033,24 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/products/{id}": {
|
||||
"/swaps/{cart_id}": {
|
||||
"get": {
|
||||
"operationId": "GetProductsProduct",
|
||||
"summary": "Retrieves a Product",
|
||||
"description": "Retrieves a Product.",
|
||||
"operationId": "GetSwapsSwapCartId",
|
||||
"summary": "Retrieve Swap by Cart id",
|
||||
"description": "Retrieves a Swap by the id of the Cart used to confirm the Swap.",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
"name": "id",
|
||||
"name": "cart_id",
|
||||
"required": true,
|
||||
"description": "The id of the Product.",
|
||||
"description": "The id of the Cart",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Product"
|
||||
"Swap"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
@@ -1775,49 +2059,8 @@
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"product": {
|
||||
"$ref": "#/components/schemas/product"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/products": {
|
||||
"get": {
|
||||
"operationId": "GetProducts",
|
||||
"summary": "List Products",
|
||||
"description": "Retrieves a list of Products.",
|
||||
"tags": [
|
||||
"Product"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"count": {
|
||||
"description": "The total number of Products.",
|
||||
"type": "integer"
|
||||
},
|
||||
"offset": {
|
||||
"description": "The offset for pagination.",
|
||||
"type": "integer"
|
||||
},
|
||||
"limit": {
|
||||
"description": "The maxmimum number of Products to return,",
|
||||
"type": "integer"
|
||||
},
|
||||
"products": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/product"
|
||||
}
|
||||
"swap": {
|
||||
"$ref": "#/components/schemas/swap"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4033,6 +4276,60 @@
|
||||
"description": "The quantity that was received in the warehouse.",
|
||||
"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": {
|
||||
"description": "An optional key-value map with additional information.",
|
||||
"type": "object"
|
||||
|
||||
+299
-91
@@ -237,6 +237,12 @@ paths:
|
||||
quantity:
|
||||
description: The quantity of the Product Variant to add
|
||||
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:
|
||||
- Cart
|
||||
responses:
|
||||
@@ -594,6 +600,9 @@ paths:
|
||||
customer_id:
|
||||
description: The id of the Customer to associate the Cart with.
|
||||
type: string
|
||||
context:
|
||||
description: An optional object to provide context to the Cart.
|
||||
type: object
|
||||
tags:
|
||||
- Cart
|
||||
responses:
|
||||
@@ -977,6 +986,37 @@ paths:
|
||||
password:
|
||||
type: string
|
||||
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}':
|
||||
get:
|
||||
operationId: GetOrdersOrderCartId
|
||||
@@ -1025,20 +1065,29 @@ paths:
|
||||
properties:
|
||||
customer:
|
||||
$ref: '#/components/schemas/customer'
|
||||
'/regions/{id}':
|
||||
/orders:
|
||||
get:
|
||||
operationId: GetRegionsRegion
|
||||
summary: Retrieves a Region
|
||||
description: Retrieves a Region.
|
||||
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: path
|
||||
name: id
|
||||
- in: query
|
||||
name: display_id
|
||||
required: true
|
||||
description: The id of the Region.
|
||||
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:
|
||||
- Region
|
||||
- Order
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
@@ -1046,35 +1095,8 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
region:
|
||||
$ref: '#/components/schemas/region'
|
||||
/regions:
|
||||
get:
|
||||
operationId: GetRegions
|
||||
summary: List Regions
|
||||
description: Retrieves a list of Regions.
|
||||
tags:
|
||||
- Region
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
count:
|
||||
description: The total number of regions.
|
||||
type: integer
|
||||
offset:
|
||||
description: The offset for pagination.
|
||||
type: integer
|
||||
limit:
|
||||
description: 'The maxmimum number of regions to return,'
|
||||
type: integer
|
||||
regions:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/region'
|
||||
order:
|
||||
$ref: '#/components/schemas/order'
|
||||
'/products/{id}':
|
||||
get:
|
||||
operationId: GetProductsProduct
|
||||
@@ -1125,6 +1147,205 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$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}':
|
||||
get:
|
||||
operationId: GetRegionsRegion
|
||||
summary: Retrieves a Region
|
||||
description: Retrieves a Region.
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
description: The id of the Region.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Region
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
region:
|
||||
$ref: '#/components/schemas/region'
|
||||
/regions:
|
||||
get:
|
||||
operationId: GetRegions
|
||||
summary: List Regions
|
||||
description: Retrieves a list of Regions.
|
||||
tags:
|
||||
- Region
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
count:
|
||||
description: The total number of regions.
|
||||
type: integer
|
||||
offset:
|
||||
description: The offset for pagination.
|
||||
type: integer
|
||||
limit:
|
||||
description: 'The maxmimum number of regions to return,'
|
||||
type: integer
|
||||
regions:
|
||||
type: array
|
||||
items:
|
||||
$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:
|
||||
get:
|
||||
operationId: GetShippingOptions
|
||||
summary: Retrieve Shipping Options
|
||||
description: Retrieves a list of Shipping Options.
|
||||
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
|
||||
name: product_ids
|
||||
description: A comma separated list of Product ids to filter Shipping Options by.
|
||||
schema:
|
||||
type: string
|
||||
- in: query
|
||||
name: region_id
|
||||
description: the Region to retrieve Shipping Options from.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Shipping Option
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
shipping_options:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/shipping_option'
|
||||
'/shipping-options/{cart_id}':
|
||||
get:
|
||||
operationId: GetShippingOptionsCartId
|
||||
summary: Retrieve Shipping Options for Cart
|
||||
description: Retrieves a list of Shipping Options available to a cart.
|
||||
parameters:
|
||||
- in: path
|
||||
name: cart_id
|
||||
required: true
|
||||
description: The id of the Cart.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Shipping Option
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
shipping_options:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/shipping_option'
|
||||
'/swaps/{cart_id}':
|
||||
get:
|
||||
operationId: GetSwapsSwapCartId
|
||||
@@ -1195,60 +1416,6 @@ paths:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/product_variant'
|
||||
/shipping-options:
|
||||
get:
|
||||
operationId: GetShippingOptions
|
||||
summary: Retrieve Shipping Options
|
||||
description: Retrieves a list of Shipping Options.
|
||||
parameters:
|
||||
- in: query
|
||||
name: product_ids
|
||||
description: A comma separated list of Product ids to filter Shipping Options by.
|
||||
schema:
|
||||
type: string
|
||||
- in: query
|
||||
name: region_id
|
||||
description: the Region to retrieve Shipping Options from.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Shipping Option
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
shipping_options:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/shipping_option'
|
||||
'/shipping-options/{cart_id}':
|
||||
get:
|
||||
operationId: GetShippingOptionsCartId
|
||||
summary: Retrieve Shipping Options for Cart
|
||||
description: Retrieves a list of Shipping Options available to a cart.
|
||||
parameters:
|
||||
- in: path
|
||||
name: cart_id
|
||||
required: true
|
||||
description: The id of the Cart.
|
||||
schema:
|
||||
type: string
|
||||
tags:
|
||||
- Shipping Option
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
shipping_options:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/shipping_option'
|
||||
components:
|
||||
schemas:
|
||||
address:
|
||||
@@ -3064,6 +3231,47 @@ components:
|
||||
recieved_quantity:
|
||||
description: The quantity that was received in the warehouse.
|
||||
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:
|
||||
description: An optional key-value map with additional information.
|
||||
type: object
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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");
|
||||
@@ -151,30 +152,29 @@ describe("/admin/orders", () => {
|
||||
);
|
||||
expect(response.status).toEqual(200);
|
||||
|
||||
expect(response.data.order.claims[0].claim_items).toEqual([
|
||||
expect.objectContaining({
|
||||
item_id: "test-item",
|
||||
quantity: 1,
|
||||
reason: "production_failure",
|
||||
images: [
|
||||
expect.objectContaining({
|
||||
url: "https://test.image.com",
|
||||
}),
|
||||
],
|
||||
tags: [
|
||||
expect.objectContaining({
|
||||
value: "fluff",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
]);
|
||||
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.objectContaining({
|
||||
variant_id: "test-variant",
|
||||
quantity: 1,
|
||||
}),
|
||||
]);
|
||||
expect(response.data.order.claims[0].additional_items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
variant_id: "test-variant",
|
||||
quantity: 1,
|
||||
}),
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
it("updates a claim", async () => {
|
||||
@@ -296,26 +296,28 @@ describe("/admin/orders", () => {
|
||||
claim = updateData.order.claims[0];
|
||||
|
||||
expect(claim.claim_items.length).toEqual(1);
|
||||
expect(claim.claim_items).toEqual([
|
||||
expect.objectContaining({
|
||||
id: claim.claim_items[0].id,
|
||||
reason: "production_failure",
|
||||
note: "Something new",
|
||||
images: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
url: "https://test.image.com",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
url: "https://new.com/image",
|
||||
}),
|
||||
]),
|
||||
tags: expect.arrayContaining([
|
||||
expect.objectContaining({ value: "completely" }),
|
||||
expect.objectContaining({ value: "new" }),
|
||||
expect.objectContaining({ value: "tags" }),
|
||||
]),
|
||||
}),
|
||||
]);
|
||||
expect(claim.claim_items).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: claim.claim_items[0].id,
|
||||
reason: "production_failure",
|
||||
note: "Something new",
|
||||
images: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
url: "https://test.image.com",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
url: "https://new.com/image",
|
||||
}),
|
||||
]),
|
||||
// tags: expect.arrayContaining([
|
||||
// expect.objectContaining({ value: "completely" }),
|
||||
// expect.objectContaining({ value: "new" }),
|
||||
// expect.objectContaining({ value: "tags" }),
|
||||
// ]),
|
||||
}),
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
it("updates claim items - removes image", async () => {
|
||||
@@ -384,11 +386,11 @@ describe("/admin/orders", () => {
|
||||
reason: "production_failure",
|
||||
note: "Something new",
|
||||
images: [],
|
||||
tags: expect.arrayContaining([
|
||||
expect.objectContaining({ value: "completely" }),
|
||||
expect.objectContaining({ value: "new" }),
|
||||
expect.objectContaining({ value: "tags" }),
|
||||
]),
|
||||
// tags: expect.arrayContaining([
|
||||
// expect.objectContaining({ value: "completely" }),
|
||||
// expect.objectContaining({ value: "new" }),
|
||||
// expect.objectContaining({ value: "tags" }),
|
||||
// ]),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
@@ -466,4 +468,242 @@ 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", () => {
|
||||
beforeEach(async () => {
|
||||
try {
|
||||
await adminSeeder(dbConnection);
|
||||
// Manually insert date for filtering
|
||||
const createdAt = new Date("26 January 1997 12:00 UTC");
|
||||
await orderSeeder(dbConnection, {
|
||||
created_at: createdAt.toISOString(),
|
||||
});
|
||||
} 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"`);
|
||||
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("lists all orders", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api.get("/admin/orders?fields=id", {
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
});
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.data.orders).toEqual([
|
||||
expect.objectContaining({
|
||||
id: "test-order",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("successfully lists orders with greater than", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api.get(
|
||||
"/admin/orders?fields=id&created_at[gt]=01-26-1990",
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.data.orders).toEqual([
|
||||
expect.objectContaining({
|
||||
id: "test-order",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("successfully lists no orders with greater than", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api.get(
|
||||
"/admin/orders?fields=id&created_at[gt]=01-26-2000",
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.data.orders).toEqual([]);
|
||||
});
|
||||
|
||||
it("successfully lists orders with less than", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api.get(
|
||||
"/admin/orders?fields=id&created_at[lt]=01-26-2000",
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.data.orders).toEqual([
|
||||
expect.objectContaining({
|
||||
id: "test-order",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("successfully lists no orders with less than", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api.get(
|
||||
"/admin/orders?fields=id&created_at[lt]=01-26-1990",
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.data.orders).toEqual([]);
|
||||
});
|
||||
|
||||
it("successfully lists orders using unix (greater than)", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api.get(
|
||||
"/admin/orders?fields=id&created_at[gt]=633351600",
|
||||
{
|
||||
headers: {
|
||||
authorization: "Bearer test_token",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.data.orders).toEqual([
|
||||
expect.objectContaining({
|
||||
id: "test-order",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,6 +42,7 @@ describe("/admin/products", () => {
|
||||
const manager = dbConnection.manager;
|
||||
await manager.query(`DELETE FROM "product_option_value"`);
|
||||
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 "product_variant"`);
|
||||
await manager.query(`DELETE FROM "product"`);
|
||||
@@ -62,6 +63,7 @@ describe("/admin/products", () => {
|
||||
title: "Test product",
|
||||
description: "test-product-description",
|
||||
type: { value: "test-type" },
|
||||
images: ["test-image.png", "test-image-2.png"],
|
||||
collection_id: "test-collection",
|
||||
tags: [{ value: "123" }, { value: "456" }],
|
||||
options: [{ title: "size" }, { title: "color" }],
|
||||
@@ -91,6 +93,15 @@ describe("/admin/products", () => {
|
||||
expect.objectContaining({
|
||||
title: "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: [
|
||||
expect.objectContaining({
|
||||
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 payload = {
|
||||
collection_id: null,
|
||||
type: null,
|
||||
tags: [{ value: "123" }],
|
||||
images: ["test-image-2.png"],
|
||||
type: { value: "test-type-2" },
|
||||
};
|
||||
|
||||
const response = await api
|
||||
@@ -160,6 +173,12 @@ describe("/admin/products", () => {
|
||||
|
||||
expect(response.data.product).toEqual(
|
||||
expect.objectContaining({
|
||||
images: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
url: "test-image-2.png",
|
||||
}),
|
||||
]),
|
||||
thumbnail: "test-image-2.png",
|
||||
tags: [
|
||||
expect.objectContaining({
|
||||
value: "123",
|
||||
@@ -167,6 +186,9 @@ describe("/admin/products", () => {
|
||||
],
|
||||
type: 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",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -72,6 +72,26 @@ describe("/store/carts", () => {
|
||||
const getRes = await api.post(`/store/carts/${response.data.cart.id}`);
|
||||
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", () => {
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
const { dropDatabase } = require("pg-god");
|
||||
const path = require("path");
|
||||
const { Region, GiftCard } = 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/gift-cards", () => {
|
||||
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("GET /store/gift-cards/:code", () => {
|
||||
beforeEach(async () => {
|
||||
const manager = dbConnection.manager;
|
||||
await manager.insert(Region, {
|
||||
id: "region",
|
||||
name: "Test Region",
|
||||
currency_code: "usd",
|
||||
tax_rate: 0,
|
||||
});
|
||||
await manager.insert(GiftCard, {
|
||||
id: "gift_test",
|
||||
code: "GC_TEST",
|
||||
value: 200,
|
||||
balance: 120,
|
||||
region_id: "region",
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const manager = dbConnection.manager;
|
||||
await manager.query(`DELETE FROM "gift_card"`);
|
||||
await manager.query(`DELETE FROM "region"`);
|
||||
});
|
||||
|
||||
it("retrieves a gift card", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api.get("/store/gift-cards/GC_TEST");
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.data.gift_card).toEqual({
|
||||
id: "gift_test",
|
||||
code: "GC_TEST",
|
||||
value: 200,
|
||||
balance: 120,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,160 @@
|
||||
const { dropDatabase } = require("pg-god");
|
||||
const path = require("path");
|
||||
const {
|
||||
Region,
|
||||
Order,
|
||||
Customer,
|
||||
ShippingProfile,
|
||||
Product,
|
||||
ProductVariant,
|
||||
MoneyAmount,
|
||||
LineItem,
|
||||
} = 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/carts", () => {
|
||||
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("GET /store/orders", () => {
|
||||
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(Customer, {
|
||||
id: "cus_1234",
|
||||
email: "test@email.com",
|
||||
});
|
||||
await manager.insert(Order, {
|
||||
id: "order_test",
|
||||
email: "test@email.com",
|
||||
display_id: 111,
|
||||
customer_id: "cus_1234",
|
||||
region_id: "region",
|
||||
tax_rate: 0,
|
||||
currency_code: "usd",
|
||||
});
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "default",
|
||||
});
|
||||
await manager.insert(Product, {
|
||||
id: "test-product",
|
||||
title: "test product",
|
||||
profile_id: defaultProfile.id,
|
||||
options: [{ id: "test-option", title: "Size" }],
|
||||
});
|
||||
|
||||
await manager.insert(ProductVariant, {
|
||||
id: "test-variant",
|
||||
title: "test variant",
|
||||
product_id: "test-product",
|
||||
inventory_quantity: 1,
|
||||
options: [
|
||||
{
|
||||
option_id: "test-option",
|
||||
value: "Size",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await manager.insert(LineItem, {
|
||||
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",
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const manager = dbConnection.manager;
|
||||
await manager.query(`DELETE FROM "line_item"`);
|
||||
|
||||
await manager.query(`DELETE FROM "order"`);
|
||||
await manager.query(`DELETE FROM "customer"`);
|
||||
await manager.query(`DELETE FROM "region"`);
|
||||
|
||||
await manager.query(`DELETE FROM "product_option_value"`);
|
||||
await manager.query(`DELETE FROM "product_option"`);
|
||||
await manager.query(`DELETE FROM "money_amount"`);
|
||||
await manager.query(`DELETE FROM "product_variant"`);
|
||||
await manager.query(`DELETE FROM "product"`);
|
||||
});
|
||||
|
||||
it("looks up order", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api
|
||||
.get("/store/orders?display_id=111&email=test@email.com")
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
expect(response.status).toEqual(200);
|
||||
expect(response.data.order.display_id).toEqual(111);
|
||||
expect(response.data.order.email).toEqual("test@email.com");
|
||||
});
|
||||
|
||||
it("fails if display_id + email not provided", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api
|
||||
.get("/store/orders?display_id=111")
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
expect(response.status).toEqual(400);
|
||||
});
|
||||
|
||||
it("fails if display_id + email not provided", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api
|
||||
.get("/store/orders?email=test@email.com")
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
expect(response.status).toEqual(400);
|
||||
});
|
||||
|
||||
it("fails if email not correct", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api
|
||||
.get("/store/orders?display_id=111&email=test1@email.com")
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
|
||||
expect(response.status).toEqual(404);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -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",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,218 @@
|
||||
const { dropDatabase } = require("pg-god");
|
||||
const path = require("path");
|
||||
const {
|
||||
Region,
|
||||
ReturnReason,
|
||||
Order,
|
||||
Customer,
|
||||
ShippingProfile,
|
||||
Product,
|
||||
ProductVariant,
|
||||
ShippingOption,
|
||||
LineItem,
|
||||
} = 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/carts", () => {
|
||||
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/returns", () => {
|
||||
let rrId;
|
||||
|
||||
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(Customer, {
|
||||
id: "cus_1234",
|
||||
email: "test@email.com",
|
||||
});
|
||||
|
||||
await manager.insert(Order, {
|
||||
id: "order_test",
|
||||
email: "test@email.com",
|
||||
display_id: 111,
|
||||
customer_id: "cus_1234",
|
||||
region_id: "region",
|
||||
tax_rate: 0,
|
||||
currency_code: "usd",
|
||||
});
|
||||
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
type: "default",
|
||||
});
|
||||
|
||||
await manager.insert(Product, {
|
||||
id: "test-product",
|
||||
title: "test product",
|
||||
profile_id: defaultProfile.id,
|
||||
options: [{ id: "test-option", title: "Size" }],
|
||||
});
|
||||
|
||||
await manager.insert(ProductVariant, {
|
||||
id: "test-variant",
|
||||
title: "test variant",
|
||||
product_id: "test-product",
|
||||
inventory_quantity: 1,
|
||||
options: [
|
||||
{
|
||||
option_id: "test-option",
|
||||
value: "Size",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await manager.insert(LineItem, {
|
||||
id: "test-item",
|
||||
order_id: "order_test",
|
||||
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.insert(ShippingOption, {
|
||||
id: "test-option",
|
||||
name: "Test ret",
|
||||
profile_id: defaultProfile.id,
|
||||
region_id: "region",
|
||||
provider_id: "test-ful",
|
||||
data: {},
|
||||
price_type: "flat_rate",
|
||||
amount: 1000,
|
||||
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 () => {
|
||||
const manager = dbConnection.manager;
|
||||
await manager.query(`DELETE FROM "shipping_method"`);
|
||||
await manager.query(`DELETE FROM "shipping_option"`);
|
||||
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 "line_item"`);
|
||||
await manager.query(`DELETE FROM "order"`);
|
||||
await manager.query(`DELETE FROM "customer"`);
|
||||
await manager.query(`DELETE FROM "region"`);
|
||||
|
||||
await manager.query(`DELETE FROM "product_option_value"`);
|
||||
await manager.query(`DELETE FROM "product_option"`);
|
||||
await manager.query(`DELETE FROM "money_amount"`);
|
||||
await manager.query(`DELETE FROM "product_variant"`);
|
||||
await manager.query(`DELETE FROM "product"`);
|
||||
});
|
||||
|
||||
it("creates a return", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api
|
||||
.post("/store/returns", {
|
||||
order_id: "order_test",
|
||||
items: [
|
||||
{
|
||||
item_id: "test-item",
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
})
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
expect(response.status).toEqual(200);
|
||||
|
||||
expect(response.data.return.refund_amount).toEqual(8000);
|
||||
});
|
||||
|
||||
it("creates a return with shipping method", async () => {
|
||||
const api = useApi();
|
||||
|
||||
const response = await api
|
||||
.post("/store/returns", {
|
||||
order_id: "order_test",
|
||||
return_shipping: {
|
||||
option_id: "test-option",
|
||||
},
|
||||
items: [
|
||||
{
|
||||
item_id: "test-item",
|
||||
quantity: 1,
|
||||
},
|
||||
],
|
||||
})
|
||||
.catch((err) => {
|
||||
return err.response;
|
||||
});
|
||||
expect(response.status).toEqual(200);
|
||||
|
||||
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");
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -6,6 +6,7 @@ const {
|
||||
Product,
|
||||
ShippingProfile,
|
||||
ProductVariant,
|
||||
Image,
|
||||
} = require("@medusajs/medusa");
|
||||
|
||||
module.exports = async (connection, data = {}) => {
|
||||
@@ -36,6 +37,13 @@ module.exports = async (connection, data = {}) => {
|
||||
|
||||
await manager.save(type);
|
||||
|
||||
const image = manager.create(Image, {
|
||||
id: "test-image",
|
||||
url: "test-image.png",
|
||||
});
|
||||
|
||||
await manager.save(image);
|
||||
|
||||
await manager.insert(Region, {
|
||||
id: "test-region",
|
||||
name: "Test Region",
|
||||
@@ -43,7 +51,7 @@ module.exports = async (connection, data = {}) => {
|
||||
tax_rate: 0,
|
||||
});
|
||||
|
||||
await manager.insert(Product, {
|
||||
const p = manager.create(Product, {
|
||||
id: "test-product",
|
||||
title: "Test product",
|
||||
profile_id: defaultProfile.id,
|
||||
@@ -57,6 +65,10 @@ module.exports = async (connection, data = {}) => {
|
||||
options: [{ id: "test-option", title: "Default value" }],
|
||||
});
|
||||
|
||||
p.images = [image];
|
||||
|
||||
await manager.save(p);
|
||||
|
||||
await manager.insert(ProductVariant, {
|
||||
id: "test-variant",
|
||||
inventory_quantity: 10,
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
const glob = require(`glob`);
|
||||
|
||||
const pkgs = glob
|
||||
.sync(`${__dirname}/*/`)
|
||||
.map((p) => p.replace(__dirname, `<rootDir>/integration-tests`));
|
||||
// API
|
||||
|
||||
module.exports = {
|
||||
testEnvironment: `node`,
|
||||
rootDir: `../`,
|
||||
roots: pkgs,
|
||||
testPathIgnorePatterns: [
|
||||
`/examples/`,
|
||||
`/www/`,
|
||||
@@ -17,6 +11,6 @@ module.exports = {
|
||||
`__testfixtures__`,
|
||||
`.cache`,
|
||||
],
|
||||
transform: { "^.+\\.[jt]s$": `<rootDir>/jest-transformer.js` },
|
||||
setupFilesAfterEnv: ["<rootDir>/integration-tests/setup.js"],
|
||||
transform: { "^.+\\.[jt]s$": `../../jest-transformer.js` },
|
||||
setupFilesAfterEnv: ["../setup.js"],
|
||||
};
|
||||
|
||||
@@ -4,16 +4,19 @@
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "jest --runInBand",
|
||||
"build": "babel src -d dist --extensions \".ts,.js\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@medusajs/medusa": "^1.1.3",
|
||||
"medusa-interfaces": "^1.1.0"
|
||||
"@medusajs/medusa": "1.1.11-dev-1615882960610",
|
||||
"medusa-interfaces": "1.1.1-dev-1615882960610",
|
||||
"typeorm": "^0.2.31"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.12.10",
|
||||
"@babel/core": "^7.12.10",
|
||||
"@babel/node": "^7.12.10",
|
||||
"babel-preset-medusa-package": "^1.1.0"
|
||||
"babel-preset-medusa-package": "1.1.0-dev-1615882960610",
|
||||
"jest": "^26.6.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,10 @@ class TestFulService extends FulfillmentService {
|
||||
return Promise.resolve({});
|
||||
}
|
||||
|
||||
createReturn() {
|
||||
return Promise.resolve({});
|
||||
}
|
||||
|
||||
createFulfillment() {
|
||||
// No data is being sent anywhere
|
||||
return Promise.resolve({});
|
||||
|
||||
+2487
-64
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,14 @@
|
||||
const path = require("path");
|
||||
const express = require("express");
|
||||
const getPort = require("get-port");
|
||||
|
||||
const loaders = require("@medusajs/medusa/dist/loaders").default;
|
||||
const importFrom = require("import-from");
|
||||
|
||||
const initialize = async () => {
|
||||
const app = express();
|
||||
|
||||
const loaders = importFrom(process.cwd(), "@medusajs/medusa/dist/loaders")
|
||||
.default;
|
||||
|
||||
const { dbConnection } = await loaders({
|
||||
directory: path.resolve(process.cwd()),
|
||||
expressApp: app,
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"cross-env": "^7.0.2",
|
||||
"express": "^4.17.1",
|
||||
"get-port": "^5.1.1",
|
||||
"import-from": "^3.0.0",
|
||||
"jest": "^26.6.3",
|
||||
"lerna": "^3.22.1",
|
||||
"mongoose": "^5.10.15",
|
||||
|
||||
@@ -3,6 +3,28 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package @medusajs/medusa-cli
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("./dist/index.js")
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-cli",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "@medusajs/medusa-cli",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.3",
|
||||
"description": "Command Line interface for Medusa Commerce",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
"medusa": "dist/index.js"
|
||||
"medusa": "cli.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -3,6 +3,30 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-core-utils
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-core-utils",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.2",
|
||||
"description": "Core utils for Medusa",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -17,13 +17,13 @@
|
||||
"author": "Sebastian Rindom",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.7.5",
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/plugin-proposal-class-properties": "^7.7.4",
|
||||
"@babel/cli": "^7.13.0",
|
||||
"@babel/core": "^7.13.8",
|
||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||
"@babel/plugin-transform-classes": "^7.9.5",
|
||||
"@babel/plugin-transform-runtime": "^7.7.6",
|
||||
"@babel/preset-env": "^7.7.5",
|
||||
"@babel/runtime": "^7.9.6",
|
||||
"@babel/preset-env": "^7.13.9",
|
||||
"@babel/runtime": "^7.13.9",
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
|
||||
@@ -17,4 +17,73 @@ Joi.address = () => {
|
||||
})
|
||||
}
|
||||
|
||||
Joi.dateFilter = () => {
|
||||
return Joi.object({
|
||||
lt: Joi.alternatives(Joi.date().timestamp("unix"), Joi.date()),
|
||||
gt: Joi.alternatives(Joi.date().timestamp("unix"), Joi.date()),
|
||||
gte: Joi.alternatives(Joi.date().timestamp("unix"), Joi.date()),
|
||||
lte: Joi.alternatives(Joi.date().timestamp("unix"), Joi.date()),
|
||||
})
|
||||
}
|
||||
|
||||
Joi.orderFilter = () => {
|
||||
return Joi.object().keys({
|
||||
id: Joi.string(),
|
||||
q: Joi.string(),
|
||||
status: Joi.array()
|
||||
.items(
|
||||
Joi.string().valid(
|
||||
"pending",
|
||||
"completed",
|
||||
"archived",
|
||||
"canceled",
|
||||
"requires_action"
|
||||
)
|
||||
)
|
||||
.single(),
|
||||
fulfillment_status: Joi.array()
|
||||
.items(
|
||||
Joi.string().valid(
|
||||
"not_fulfilled",
|
||||
"fulfilled",
|
||||
"partially_fulfilled",
|
||||
"shipped",
|
||||
"partially_shipped",
|
||||
"canceled",
|
||||
"returned",
|
||||
"partially_returned",
|
||||
"requires_action"
|
||||
)
|
||||
)
|
||||
.single(),
|
||||
payment_status: Joi.array()
|
||||
.items(
|
||||
Joi.string().valid(
|
||||
"captured",
|
||||
"awaiting",
|
||||
"not_paid",
|
||||
"refunded",
|
||||
"partially_refunded",
|
||||
"canceled",
|
||||
"requires_action"
|
||||
)
|
||||
)
|
||||
.single(),
|
||||
display_id: Joi.string(),
|
||||
cart_id: Joi.string(),
|
||||
offset: Joi.string(),
|
||||
limit: Joi.string(),
|
||||
expand: Joi.string(),
|
||||
fields: Joi.string(),
|
||||
customer_id: Joi.string(),
|
||||
email: Joi.string(),
|
||||
region_id: Joi.string(),
|
||||
currency_code: Joi.string(),
|
||||
tax_rate: Joi.string(),
|
||||
canceled_at: Joi.dateFilter(),
|
||||
created_at: Joi.dateFilter(),
|
||||
updated_at: Joi.dateFilter(),
|
||||
})
|
||||
}
|
||||
|
||||
export default Joi
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": [["babel-preset-medusa-package"]]
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
src
|
||||
flow-typed
|
||||
verdaccio
|
||||
@@ -0,0 +1,22 @@
|
||||
# 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.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)
|
||||
@@ -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.
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "medusa-dev-cli",
|
||||
"description": "CLI helpers for contributors working on Medusa",
|
||||
"version": "0.0.3",
|
||||
"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.0",
|
||||
"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": "d9faeee4c0dd0930b85a14143443a6d9cc787ab2"
|
||||
}
|
||||
@@ -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}`;
|
||||
};
|
||||
@@ -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
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-spaces
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-file-spaces",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Digital Ocean Spaces file connector for Medusa",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -40,8 +40,8 @@
|
||||
"aws-sdk": "^2.710.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3",
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5",
|
||||
"stripe": "^8.50.0"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-manual
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-fulfillment-manual",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.2",
|
||||
"description": "A manual fulfillment provider for Medusa",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -36,7 +36,7 @@
|
||||
"@babel/plugin-transform-instanceof": "^7.8.3",
|
||||
"@babel/runtime": "^7.7.6",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0"
|
||||
"medusa-core-utils": "^1.1.2"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-webshipper
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-fulfillment-webshipper",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Webshipper Fulfillment provider for Medusa",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -36,7 +36,7 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0"
|
||||
"medusa-core-utils": "^1.1.2"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,28 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-interfaces",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.3",
|
||||
"description": "Core interfaces for Medusa",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -35,7 +35,7 @@
|
||||
"typeorm": "0.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"medusa-core-utils": "^1.1.0"
|
||||
"medusa-core-utils": "^1.1.2"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
}
|
||||
|
||||
@@ -11,9 +11,6 @@ describe("BaseService", () => {
|
||||
id: "1234",
|
||||
test1: ["123", "12", "1"],
|
||||
test2: Not("this"),
|
||||
rec: {
|
||||
first: ["1", "2", "3"],
|
||||
},
|
||||
},
|
||||
{
|
||||
relations: ["1234"],
|
||||
@@ -25,9 +22,6 @@ describe("BaseService", () => {
|
||||
id: "1234",
|
||||
test1: In(["123", "12", "1"]),
|
||||
test2: Not("this"),
|
||||
rec: {
|
||||
first: In(["1", "2", "3"]),
|
||||
},
|
||||
},
|
||||
relations: ["1234"],
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { In, FindOperator, getManager } from "typeorm"
|
||||
import { In, FindOperator, Raw } from "typeorm"
|
||||
|
||||
/**
|
||||
* Common functionality for Services
|
||||
@@ -29,7 +29,32 @@ class BaseService {
|
||||
acc[key] = In([...value])
|
||||
break
|
||||
case value !== null && typeof value === "object":
|
||||
acc[key] = build(value)
|
||||
const subquery = []
|
||||
|
||||
Object.entries(value).map(([modifier, val]) => {
|
||||
switch (modifier) {
|
||||
case "lt":
|
||||
subquery.push({ operator: "<", value: val })
|
||||
break
|
||||
case "gt":
|
||||
subquery.push({ operator: ">", value: val })
|
||||
break
|
||||
case "lte":
|
||||
subquery.push({ operator: "<=", value: val })
|
||||
break
|
||||
case "gte":
|
||||
subquery.push({ operator: ">=", value: val })
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
acc[key] = Raw(
|
||||
a =>
|
||||
subquery
|
||||
.map((s, index) => `${a} ${s.operator} :${index}`)
|
||||
.join(" AND "),
|
||||
subquery.map(s => s.value)
|
||||
)
|
||||
break
|
||||
default:
|
||||
acc[key] = value
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-adyen
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-adyen",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Adyen Payment provider for Medusa Commerce",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -24,7 +24,7 @@
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-test-utils": "^1.1.3"
|
||||
"medusa-test-utils": "^1.1.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d .",
|
||||
@@ -42,7 +42,7 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0"
|
||||
"medusa-core-utils": "^1.1.2"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-klarna
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-klarna",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.6",
|
||||
"description": "Klarna Payment provider for Medusa Commerce",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -40,8 +40,8 @@
|
||||
"axios": "^0.21.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3"
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-paypal
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-paypal",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.5",
|
||||
"description": "Paypal Payment provider for Meduas Commerce",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -26,7 +26,7 @@
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-test-utils": "^1.1.3"
|
||||
"medusa-test-utils": "^1.1.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d . --ignore **/__tests__",
|
||||
@@ -41,7 +41,7 @@
|
||||
"@paypal/checkout-server-sdk": "^1.0.2",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0"
|
||||
"medusa-core-utils": "^1.1.2"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,30 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-stripe
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-stripe",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Stripe Payment provider for Meduas Commerce",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -26,7 +26,7 @@
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-test-utils": "^1.1.3"
|
||||
"medusa-test-utils": "^1.1.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d . --ignore **/__tests__",
|
||||
@@ -40,7 +40,7 @@
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"stripe": "^8.50.0"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-add-ons
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-add-ons",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Add-on plugin for Medusa Commerce",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -25,7 +25,7 @@
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-test-utils": "^1.1.3"
|
||||
"medusa-test-utils": "^1.1.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d . --ignore **/__tests__",
|
||||
@@ -37,7 +37,7 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"redis": "^3.0.2"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [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)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-brightpearl
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-brightpearl",
|
||||
"version": "1.1.5",
|
||||
"version": "1.1.7",
|
||||
"description": "Brightpearl plugin for Medusa Commerce",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -27,7 +27,7 @@
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-test-utils": "^1.1.3",
|
||||
"medusa-test-utils": "^1.1.5",
|
||||
"prettier": "^2.0.5"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -43,7 +43,7 @@
|
||||
"axios": "^0.19.2",
|
||||
"axios-rate-limit": "^1.2.1",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"randomatic": "^3.1.1"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
|
||||
@@ -3,6 +3,28 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.4...medusa-plugin-contentful@1.1.6) (2021-03-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* contentful sync ([#206](https://github.com/medusajs/medusa/issues/206)) ([227cdb6](https://github.com/medusajs/medusa/commit/227cdb622234126df6087992203ce82ff9446974))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.4...medusa-plugin-contentful@1.1.5) (2021-03-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* contentful sync ([#206](https://github.com/medusajs/medusa/issues/206)) ([227cdb6](https://github.com/medusajs/medusa/commit/227cdb622234126df6087992203ce82ff9446974))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.3...medusa-plugin-contentful@1.1.4) (2021-02-25)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-contentful",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.6",
|
||||
"description": "Contentful plugin for Medusa Commerce",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -39,9 +39,9 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"contentful-management": "^5.27.1",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3",
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5",
|
||||
"redis": "^3.0.2"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
"gitHead": "739b7b3cc5ff31aa7a15637db2000e645c7597b1"
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ const checkContentTypes = async (container) => {
|
||||
if (!product) {
|
||||
throw Error("Content type: `product` is missing in Contentful")
|
||||
}
|
||||
|
||||
if (!variant) {
|
||||
throw Error("Content type: `productVariant` is missing in Contentful")
|
||||
}
|
||||
|
||||
@@ -96,13 +96,15 @@ class ContentfulService extends BaseService {
|
||||
},
|
||||
})
|
||||
|
||||
await asset.processForAllLocales()
|
||||
const finalAsset = await asset
|
||||
.processForAllLocales()
|
||||
.then((ast) => ast.publish())
|
||||
|
||||
assets.push({
|
||||
sys: {
|
||||
type: "Link",
|
||||
linkType: "Asset",
|
||||
id: asset.sys.id,
|
||||
id: finalAsset.sys.id,
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -231,9 +233,9 @@ class ContentfulService extends BaseService {
|
||||
fields,
|
||||
})
|
||||
|
||||
const ignoreIds = (await this.getIgnoreIds_("product")) || []
|
||||
ignoreIds.push(product.id)
|
||||
this.redis_.set("product_ignore_ids", JSON.stringify(ignoreIds))
|
||||
// const ignoreIds = (await this.getIgnoreIds_("product")) || []
|
||||
// ignoreIds.push(product.id)
|
||||
// this.redis_.set("product_ignore_ids", JSON.stringify(ignoreIds))
|
||||
return result
|
||||
} catch (error) {
|
||||
throw error
|
||||
@@ -271,38 +273,47 @@ class ContentfulService extends BaseService {
|
||||
}
|
||||
)
|
||||
|
||||
const ignoreIds = (await this.getIgnoreIds_("product_variant")) || []
|
||||
ignoreIds.push(v.id)
|
||||
this.redis_.set("product_variant_ignore_ids", JSON.stringify(ignoreIds))
|
||||
// const ignoreIds = (await this.getIgnoreIds_("product_variant")) || []
|
||||
// ignoreIds.push(v.id)
|
||||
// this.redis_.set("product_variant_ignore_ids", JSON.stringify(ignoreIds))
|
||||
return result
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
async updateProductInContentful(product) {
|
||||
async updateProductInContentful(data) {
|
||||
const updateFields = [
|
||||
"variants",
|
||||
"options",
|
||||
"tags",
|
||||
"title",
|
||||
"tags",
|
||||
"type",
|
||||
"type_id",
|
||||
"collection",
|
||||
"collection_id",
|
||||
"thumbnail",
|
||||
]
|
||||
|
||||
const found = data.fields.find((f) => updateFields.includes(f))
|
||||
if (!found) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const ignoreIds = (await this.getIgnoreIds_("product")) || []
|
||||
// const ignoreIds = (await this.getIgnoreIds_("product")) || []
|
||||
|
||||
if (ignoreIds.includes(product.id)) {
|
||||
const newIgnoreIds = ignoreIds.filter((id) => id !== product.id)
|
||||
this.redis_.set("product_ignore_ids", JSON.stringify(newIgnoreIds))
|
||||
return
|
||||
} else {
|
||||
ignoreIds.push(product.id)
|
||||
this.redis_.set("product_ignore_ids", JSON.stringify(ignoreIds))
|
||||
}
|
||||
// if (ignoreIds.includes(product.id)) {
|
||||
// const newIgnoreIds = ignoreIds.filter((id) => id !== product.id)
|
||||
// this.redis_.set("product_ignore_ids", JSON.stringify(newIgnoreIds))
|
||||
// return
|
||||
// } else {
|
||||
// ignoreIds.push(product.id)
|
||||
// this.redis_.set("product_ignore_ids", JSON.stringify(ignoreIds))
|
||||
// }
|
||||
|
||||
const environment = await this.getContentfulEnvironment_()
|
||||
// check if product exists
|
||||
let productEntry = undefined
|
||||
try {
|
||||
productEntry = await environment.getEntry(product.id)
|
||||
} catch (error) {
|
||||
return this.createProductInContentful(product)
|
||||
}
|
||||
|
||||
const p = await this.productService_.retrieve(product.id, {
|
||||
const p = await this.productService_.retrieve(data.id, {
|
||||
relations: [
|
||||
"options",
|
||||
"variants",
|
||||
@@ -313,6 +324,15 @@ class ContentfulService extends BaseService {
|
||||
],
|
||||
})
|
||||
|
||||
const environment = await this.getContentfulEnvironment_()
|
||||
// check if product exists
|
||||
let productEntry = undefined
|
||||
try {
|
||||
productEntry = await environment.getEntry(data.id)
|
||||
} catch (error) {
|
||||
return this.createProductInContentful(p)
|
||||
}
|
||||
|
||||
const variantEntries = await this.getVariantEntries_(p.variants)
|
||||
const variantLinks = this.getVariantLinks_(variantEntries)
|
||||
|
||||
@@ -332,7 +352,12 @@ class ContentfulService extends BaseService {
|
||||
},
|
||||
}
|
||||
|
||||
if (p.thumbnail) {
|
||||
if (data.fields.includes("thumbnail") && p.thumbnail) {
|
||||
let url = p.thumbnail
|
||||
if (p.thumbnail.startsWith("//")) {
|
||||
url = `https:${url}`
|
||||
}
|
||||
|
||||
const thumbnailAsset = await environment.createAsset({
|
||||
fields: {
|
||||
title: {
|
||||
@@ -344,8 +369,8 @@ class ContentfulService extends BaseService {
|
||||
file: {
|
||||
"en-US": {
|
||||
contentType: "image/xyz",
|
||||
fileName: p.thumbnail,
|
||||
upload: p.thumbnail,
|
||||
fileName: url,
|
||||
upload: url,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -412,20 +437,37 @@ class ContentfulService extends BaseService {
|
||||
}
|
||||
|
||||
async updateProductVariantInContentful(variant) {
|
||||
try {
|
||||
const ignoreIds = (await this.getIgnoreIds_("product_variant")) || []
|
||||
const updateFields = [
|
||||
"title",
|
||||
"prices",
|
||||
"sku",
|
||||
"material",
|
||||
"weight",
|
||||
"length",
|
||||
"height",
|
||||
"origin_country",
|
||||
"options",
|
||||
]
|
||||
|
||||
if (ignoreIds.includes(variant.id)) {
|
||||
const newIgnoreIds = ignoreIds.filter((id) => id !== variant.id)
|
||||
this.redis_.set(
|
||||
"product_variant_ignore_ids",
|
||||
JSON.stringify(newIgnoreIds)
|
||||
)
|
||||
return
|
||||
} else {
|
||||
ignoreIds.push(variant.id)
|
||||
this.redis_.set("product_variant_ignore_ids", JSON.stringify(ignoreIds))
|
||||
}
|
||||
const found = variant.fields.find((f) => updateFields.includes(f))
|
||||
if (!found) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
// const ignoreIds = (await this.getIgnoreIds_("product_variant")) || []
|
||||
|
||||
//if (ignoreIds.includes(variant.id)) {
|
||||
// const newIgnoreIds = ignoreIds.filter((id) => id !== variant.id)
|
||||
// this.redis_.set(
|
||||
// "product_variant_ignore_ids",
|
||||
// JSON.stringify(newIgnoreIds)
|
||||
// )
|
||||
// return
|
||||
//} else {
|
||||
// ignoreIds.push(variant.id)
|
||||
// this.redis_.set("product_variant_ignore_ids", JSON.stringify(ignoreIds))
|
||||
//}
|
||||
|
||||
const environment = await this.getContentfulEnvironment_()
|
||||
// check if product exists
|
||||
@@ -476,19 +518,23 @@ class ContentfulService extends BaseService {
|
||||
const environment = await this.getContentfulEnvironment_()
|
||||
const productEntry = await environment.getEntry(productId)
|
||||
|
||||
const ignoreIds = (await this.getIgnoreIds_("product")) || []
|
||||
if (ignoreIds.includes(productId)) {
|
||||
const newIgnoreIds = ignoreIds.filter((id) => id !== productId)
|
||||
this.redis_.set("product_ignore_ids", JSON.stringify(newIgnoreIds))
|
||||
return
|
||||
} else {
|
||||
ignoreIds.push(productId)
|
||||
this.redis_.set("product_ignore_ids", JSON.stringify(ignoreIds))
|
||||
}
|
||||
const product = await this.productService_.retrieve(productId)
|
||||
|
||||
let update = {
|
||||
title:
|
||||
productEntry.fields[this.getCustomField("title", "product")]["en-US"],
|
||||
//const ignoreIds = (await this.getIgnoreIds_("product")) || []
|
||||
//if (ignoreIds.includes(productId)) {
|
||||
// const newIgnoreIds = ignoreIds.filter((id) => id !== productId)
|
||||
// this.redis_.set("product_ignore_ids", JSON.stringify(newIgnoreIds))
|
||||
// return
|
||||
//} else {
|
||||
// ignoreIds.push(productId)
|
||||
// this.redis_.set("product_ignore_ids", JSON.stringify(ignoreIds))
|
||||
//}
|
||||
|
||||
let update = {}
|
||||
const title =
|
||||
productEntry.fields[this.getCustomField("title", "product")]["en-US"]
|
||||
if (product.title !== title) {
|
||||
update.title = title
|
||||
}
|
||||
|
||||
// Get the thumbnail, if present
|
||||
@@ -497,15 +543,16 @@ class ContentfulService extends BaseService {
|
||||
productEntry.fields.thumbnail["en-US"].sys.id
|
||||
)
|
||||
|
||||
update.thumbnail = thumb.fields.file["en-US"].url
|
||||
if (thumb.fields.file["en-US"].url) {
|
||||
if (!product.thumbnail.includes(thumb.fields.file["en-US"].url)) {
|
||||
update.thumbnail = thumb.fields.file["en-US"].url
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const updatedProduct = await this.productService_.update(
|
||||
productId,
|
||||
update
|
||||
)
|
||||
|
||||
return updatedProduct
|
||||
if (!_.isEmpty(update)) {
|
||||
await this.productService_.update(productId, update)
|
||||
}
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
@@ -516,18 +563,18 @@ class ContentfulService extends BaseService {
|
||||
const environment = await this.getContentfulEnvironment_()
|
||||
const variantEntry = await environment.getEntry(variantId)
|
||||
|
||||
const ignoreIds = (await this.getIgnoreIds_("product_variant")) || []
|
||||
if (ignoreIds.includes(variantId)) {
|
||||
const newIgnoreIds = ignoreIds.filter((id) => id !== variantId)
|
||||
this.redis_.set(
|
||||
"product_variant_ignore_ids",
|
||||
JSON.stringify(newIgnoreIds)
|
||||
)
|
||||
return
|
||||
} else {
|
||||
ignoreIds.push(variantId)
|
||||
this.redis_.set("product_variant_ignore_ids", JSON.stringify(ignoreIds))
|
||||
}
|
||||
// const ignoreIds = (await this.getIgnoreIds_("product_variant")) || []
|
||||
// if (ignoreIds.includes(variantId)) {
|
||||
// const newIgnoreIds = ignoreIds.filter((id) => id !== variantId)
|
||||
// this.redis_.set(
|
||||
// "product_variant_ignore_ids",
|
||||
// JSON.stringify(newIgnoreIds)
|
||||
// )
|
||||
// return
|
||||
// } else {
|
||||
// ignoreIds.push(variantId)
|
||||
// this.redis_.set("product_variant_ignore_ids", JSON.stringify(ignoreIds))
|
||||
// }
|
||||
|
||||
const updatedVariant = await this.productVariantService_.update(
|
||||
variantId,
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.3...medusa-plugin-economic@1.1.5) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-economic
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.3...medusa-plugin-economic@1.1.4) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-economic
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.2...medusa-plugin-economic@1.1.3) (2021-02-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-economic
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-economic",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-economic",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "E-conomic financial reporting",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -39,8 +39,8 @@
|
||||
"axios": "^0.19.2",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3",
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5",
|
||||
"moment": "^2.27.0"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.3...medusa-plugin-mailchimp@1.1.5) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-mailchimp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.3...medusa-plugin-mailchimp@1.1.4) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-mailchimp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.2...medusa-plugin-mailchimp@1.1.3) (2021-02-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-mailchimp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-mailchimp",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Mailchimp newsletter subscriptions",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -40,8 +40,8 @@
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"mailchimp-api-v3": "^1.14.0",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3"
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.3...medusa-plugin-permissions@1.1.5) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-permissions
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.3...medusa-plugin-permissions@1.1.4) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-permissions
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.2...medusa-plugin-permissions@1.1.3) (2021-02-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-permissions
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-permissions",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Role permission for Medusa core",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -32,8 +32,8 @@
|
||||
"medusa-interfaces": "1.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3",
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5",
|
||||
"mongoose": "^5.8.0"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
|
||||
@@ -3,6 +3,28 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.7](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.5...medusa-plugin-segment@1.1.7) (2021-03-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **medusa:** cart context ([#201](https://github.com/medusajs/medusa/issues/201)) ([dd7b306](https://github.com/medusajs/medusa/commit/dd7b306333fbe1042f5cf2bed614bce84ea9475f))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.5...medusa-plugin-segment@1.1.6) (2021-03-17)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **medusa:** cart context ([#201](https://github.com/medusajs/medusa/issues/201)) ([dd7b306](https://github.com/medusajs/medusa/commit/dd7b306333fbe1042f5cf2bed614bce84ea9475f))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.5-next.3...medusa-plugin-segment@1.1.5) (2021-02-25)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-segment
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-segment",
|
||||
"version": "1.1.5",
|
||||
"version": "1.1.7",
|
||||
"description": "Segment Analytics",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -39,8 +39,8 @@
|
||||
"axios": "^0.19.2",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3"
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5"
|
||||
},
|
||||
"gitHead": "0c294b7b3acbc1b873aab7e90a8e596bdac48899"
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ class SegmentService extends BaseService {
|
||||
* e.g.
|
||||
* {
|
||||
* write_key: Segment write key given in Segment dashboard
|
||||
* use_ga_id: If set to true the plugin will look for a ga_id in the cart
|
||||
* context if present this id will be used as the Google Analytics
|
||||
* client id.
|
||||
* }
|
||||
*/
|
||||
constructor({ totalsService, productService }, options) {
|
||||
|
||||
@@ -3,15 +3,19 @@ class OrderSubscriber {
|
||||
segmentService,
|
||||
eventBusService,
|
||||
orderService,
|
||||
cartService,
|
||||
claimService,
|
||||
returnService,
|
||||
fulfillmentService,
|
||||
}) {
|
||||
this.orderService_ = orderService
|
||||
|
||||
this.cartService_ = cartService
|
||||
|
||||
this.returnService_ = returnService
|
||||
|
||||
this.claimService_ = claimService
|
||||
|
||||
this.fulfillmentService_ = fulfillmentService
|
||||
|
||||
eventBusService.subscribe(
|
||||
@@ -239,12 +243,46 @@ class OrderSubscriber {
|
||||
],
|
||||
})
|
||||
|
||||
const eventContext = {}
|
||||
const integrations = {}
|
||||
|
||||
if (order.cart_id) {
|
||||
try {
|
||||
const cart = await this.cartService_.retrieve(order.cart_id, {
|
||||
select: ["context"],
|
||||
})
|
||||
|
||||
if (cart.context) {
|
||||
if (cart.context.ip) {
|
||||
eventContext.ip = cart.context.ip
|
||||
}
|
||||
|
||||
if (cart.context.user_agent) {
|
||||
eventContext.user_agent = cart.context.user_agent
|
||||
}
|
||||
|
||||
if (segmentService.options_ && segmentService.options_.use_ga_id) {
|
||||
if (cart.context.ga_id) {
|
||||
integrations["Google Analytics"] = {
|
||||
clientId: cart.context.ga_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
console.warn("Failed to gather context for order")
|
||||
}
|
||||
}
|
||||
|
||||
const orderData = await segmentService.buildOrder(order)
|
||||
const orderEvent = {
|
||||
event: "Order Completed",
|
||||
userId: order.customer_id,
|
||||
properties: orderData,
|
||||
timestamp: order.created_at,
|
||||
context: eventContext,
|
||||
integrations,
|
||||
}
|
||||
|
||||
segmentService.track(orderEvent)
|
||||
|
||||
@@ -3,6 +3,28 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.6](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.4...medusa-plugin-sendgrid@1.1.6) (2021-03-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* enable gift-card creation without order_id ([9ce935a](https://github.com/medusajs/medusa/commit/9ce935a779aec90ff1ad301c73114ab69ce51b36))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.4...medusa-plugin-sendgrid@1.1.5) (2021-03-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* enable gift-card creation without order_id ([9ce935a](https://github.com/medusajs/medusa/commit/9ce935a779aec90ff1ad301c73114ab69ce51b36))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.3...medusa-plugin-sendgrid@1.1.4) (2021-02-25)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-sendgrid",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.6",
|
||||
"description": "SendGrid transactional emails",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -39,8 +39,8 @@
|
||||
"@sendgrid/mail": "^7.1.1",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3"
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.3...medusa-plugin-slack-notification@1.1.5) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-slack-notification
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.3...medusa-plugin-slack-notification@1.1.4) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-slack-notification
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.2...medusa-plugin-slack-notification@1.1.3) (2021-02-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-slack-notification
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-economic",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-slack-notification",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Slack notifications",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -39,8 +39,8 @@
|
||||
"axios": "^0.19.2",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3",
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5",
|
||||
"moment": "^2.27.0"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.3...medusa-plugin-twilio-sms@1.1.5) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-twilio-sms
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.3...medusa-plugin-twilio-sms@1.1.4) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-twilio-sms
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.2...medusa-plugin-twilio-sms@1.1.3) (2021-02-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-twilio-sms
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-twilio-sms",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -35,8 +35,8 @@
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-classes": "^7.9.5",
|
||||
"body-parser": "^1.19.0",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3",
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5",
|
||||
"twilio": "^3.49.1"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.5](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.3...medusa-plugin-wishlist@1.1.5) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-wishlist
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.4](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.3...medusa-plugin-wishlist@1.1.4) (2021-03-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-wishlist
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.3](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.2...medusa-plugin-wishlist@1.1.3) (2021-02-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-wishlist
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-wishlist",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.5",
|
||||
"description": "Provides /customers/:id/wishlist to add items to a customr's wishlist",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -37,8 +37,8 @@
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.0",
|
||||
"medusa-test-utils": "^1.1.3"
|
||||
"medusa-core-utils": "^1.1.2",
|
||||
"medusa-test-utils": "^1.1.5"
|
||||
},
|
||||
"gitHead": "0646bd395a6056657cb0aa93c13699c4a9dbbcdd"
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user