Merge remote-tracking branch 'origin/develop' into feat/meilisearch-plugin
This commit is contained in:
commit
10c87e8d5a
271 files changed
+16116
-5647
No files matched your search
@@ -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.15](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.14...babel-preset-medusa-package@1.1.15) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package babel-preset-medusa-package
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.14](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.13...babel-preset-medusa-package@1.1.14) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package babel-preset-medusa-package
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.13](https://github.com/medusajs/medusa/compare/babel-preset-medusa-package@1.1.12...babel-preset-medusa-package@1.1.13) (2021-07-26)
|
||||
|
||||
**Note:** Version bump only for package babel-preset-medusa-package
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "babel-preset-medusa-package",
|
||||
"version": "1.1.13",
|
||||
"version": "1.1.15",
|
||||
"author": "Sebastian Rindom <sebastian@mrbltech.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -26,5 +26,5 @@
|
||||
"engines": {
|
||||
"node": ">=10.14.0"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
/dist
|
||||
yarn.lock
|
||||
@@ -0,0 +1,37 @@
|
||||
# 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
|
||||
*.un~
|
||||
yarn.lock
|
||||
src
|
||||
flow-typed
|
||||
coverage
|
||||
decls
|
||||
examples
|
||||
|
||||
# tests
|
||||
__tests__
|
||||
@@ -0,0 +1,23 @@
|
||||
# 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](https://github.com/medusajs/medusa/compare/create-medusa-app@0.0.1...create-medusa-app@0.0.3) (2021-09-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* flip seed flag to default to true ([#398](https://github.com/medusajs/medusa/issues/398)) ([dd1025f](https://github.com/medusajs/medusa/commit/dd1025fd5369eb264d7d5f5d6db41c888259d786))
|
||||
* versioning ([3b8901e](https://github.com/medusajs/medusa/commit/3b8901ebc2fb41dc8d5372a808c5eaafd7d32646))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## 0.0.1 (2021-09-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* adds create-medusa-app ([#377](https://github.com/medusajs/medusa/issues/377)) ([ec6d16e](https://github.com/medusajs/medusa/commit/ec6d16e945f4b8a99e9dcc8ae2e92a2318fbc709))
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#! /usr/bin/env node
|
||||
|
||||
const { run } = require("./dist")
|
||||
|
||||
run().catch((e) => {
|
||||
console.warn(e)
|
||||
})
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "create-medusa-app",
|
||||
"version": "0.0.3",
|
||||
"main": "dist/index.js",
|
||||
"bin": "cli.js",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist/index.js",
|
||||
"cli.js"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "microbundle -i src/index.ts --no-pkg-main --target=node -f=cjs --sourcemap=false --compress --alias worker_threads=@ascorbic/worker-threads-shim",
|
||||
"watch": "microbundle -i src/index.ts --no-pkg-main --target=node -f=cjs --sourcemap=false --alias worker_threads=@ascorbic/worker-threads-shim --watch",
|
||||
"prepare": "yarn build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.15.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ascorbic/worker-threads-shim": "^1.0.0",
|
||||
"@babel/runtime": "^7.15.4",
|
||||
"@types/chalk": "^2.2.0",
|
||||
"@types/commander": "^2.12.2",
|
||||
"@types/configstore": "^4.0.0",
|
||||
"@types/fs-extra": "^9.0.12",
|
||||
"@types/node": "^14.17.14",
|
||||
"ansi-wordwrap": "^1.0.2",
|
||||
"chalk": "^4.1.2",
|
||||
"commander": "^8.1.0",
|
||||
"common-tags": "^1.8.0",
|
||||
"configstore": "^6.0.0",
|
||||
"enquirer": "^2.3.6",
|
||||
"eslint": "^7.32.0",
|
||||
"execa": "^5.1.1",
|
||||
"fs-exists-cached": "^1.0.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"hosted-git-info": "^4.0.2",
|
||||
"is-valid-path": "^0.1.1",
|
||||
"joi": "^17.4.2",
|
||||
"microbundle": "^0.13.3",
|
||||
"node-fetch": "^2.6.1",
|
||||
"prettier": "^2.3.2",
|
||||
"prompts": "^2.4.1",
|
||||
"string-length": "^4.0.2",
|
||||
"terminal-link": "^2.1.1",
|
||||
"tiny-spin": "^1.0.2",
|
||||
"url": "^0.11.0",
|
||||
"uuid": "3.4.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/medusajs/medusa.git",
|
||||
"directory": "packages/create-medusa-app"
|
||||
},
|
||||
"author": "Sebastian Rindom <seb@medusa-commerce.com>",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import Configstore from "configstore"
|
||||
|
||||
let config: Configstore
|
||||
|
||||
export const getConfigStore = (): Configstore => {
|
||||
if (!config) {
|
||||
config = new Configstore(
|
||||
`medusa`,
|
||||
{},
|
||||
{
|
||||
globalConfigPath: true,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
import path from "path"
|
||||
import Commander from "commander"
|
||||
import chalk from "chalk"
|
||||
|
||||
import { prompt } from "enquirer"
|
||||
import { newStarter } from "./new-starter"
|
||||
import { track } from "./track"
|
||||
|
||||
import pkg from "../package.json"
|
||||
|
||||
let projectPath: string = ""
|
||||
|
||||
const questions = {
|
||||
projectRoot: {
|
||||
type: "input",
|
||||
name: "projectRoot",
|
||||
message: "Where should your project be installed?",
|
||||
initial: "my-medusa-store",
|
||||
},
|
||||
starter: {
|
||||
type: "select",
|
||||
name: "starter",
|
||||
message: "Which Medusa starter would you like to install?",
|
||||
choices: ["medusa-starter-default", "medusa-starter-contentful", "Other"],
|
||||
},
|
||||
starterUrl: {
|
||||
type: "input",
|
||||
name: "starterUrl",
|
||||
message: "Where is the starter located? (URL or path)",
|
||||
},
|
||||
storefront: {
|
||||
type: "select",
|
||||
name: "storefront",
|
||||
message: "Which storefront starter would you like to install?",
|
||||
choices: ["Gatsby Starter", "Next.js Starter", "None"],
|
||||
},
|
||||
}
|
||||
|
||||
const program = new Commander.Command(pkg.name)
|
||||
.version(pkg.version)
|
||||
.action((name) => (projectPath = name))
|
||||
.option(`-r --root`, `The directory to install your Medusa app`)
|
||||
.option(
|
||||
`-s --starter-url`,
|
||||
`A GitHub URL to a repository that contains a Medusa starter project to bootstrap from`
|
||||
)
|
||||
.option(
|
||||
`--no-seed`,
|
||||
`If run with the no-seed flag the script will skip seeding the database upon setup`
|
||||
)
|
||||
.option(`-v --verbose`, `Show all installation output`)
|
||||
.parse(process.argv)
|
||||
|
||||
export const run = async (): Promise<void> => {
|
||||
track("CREATE_CLI")
|
||||
|
||||
if (typeof projectPath === "string") {
|
||||
projectPath = projectPath.trim()
|
||||
}
|
||||
|
||||
const { projectRoot } = (await prompt(questions.projectRoot)) as {
|
||||
projectRoot: string
|
||||
}
|
||||
let { starter } = (await prompt(questions.starter)) as {
|
||||
starter: string
|
||||
}
|
||||
|
||||
if (starter === "Other") {
|
||||
const { starterUrl } = (await prompt(questions.starterUrl)) as {
|
||||
starterUrl: string
|
||||
}
|
||||
starter = starterUrl
|
||||
} else {
|
||||
starter = `medusajs/${starter}`
|
||||
}
|
||||
track("STARTER_SELECTED", { starter })
|
||||
|
||||
const progOptions = program.opts()
|
||||
|
||||
const noSeed = progOptions.noSeed
|
||||
track("SEED_SELECTED", { seed: !noSeed })
|
||||
|
||||
const { storefront } = (await prompt(questions.storefront)) as {
|
||||
storefront: string
|
||||
}
|
||||
track("STOREFRONT_SELECTED", { storefront })
|
||||
|
||||
await newStarter({
|
||||
starter,
|
||||
root: path.join(projectRoot, `backend`),
|
||||
seed: !noSeed,
|
||||
verbose: progOptions.verbose,
|
||||
})
|
||||
|
||||
const hasStorefront = storefront.toLowerCase() !== "none"
|
||||
if (hasStorefront) {
|
||||
const storefrontStarter =
|
||||
storefront.toLowerCase() === "gatsby starter"
|
||||
? "https://github.com/medusajs/gatsby-starter-medusa"
|
||||
: "https://github.com/medusajs/nextjs-starter-medusa"
|
||||
await newStarter({
|
||||
starter: storefrontStarter,
|
||||
root: path.join(projectRoot, `storefront`),
|
||||
verbose: progOptions.verbose,
|
||||
})
|
||||
}
|
||||
await newStarter({
|
||||
starter: "https://github.com/medusajs/admin",
|
||||
root: path.join(projectRoot, `admin`),
|
||||
keepGit: true,
|
||||
verbose: progOptions.verbose,
|
||||
})
|
||||
|
||||
console.log(`
|
||||
Your project is ready 🚀. The available commands are:
|
||||
|
||||
Medusa API
|
||||
cd ${projectRoot}/backend
|
||||
yarn start
|
||||
|
||||
Admin
|
||||
cd ${projectRoot}/admin
|
||||
yarn start
|
||||
`)
|
||||
|
||||
if (hasStorefront) {
|
||||
console.log(`
|
||||
Storefront
|
||||
cd ${projectRoot}/storefront
|
||||
yarn start
|
||||
`)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,377 @@
|
||||
import { execSync } from "child_process"
|
||||
import execa from "execa"
|
||||
import { spin } from "tiny-spin"
|
||||
import { sync as existsSync } from "fs-exists-cached"
|
||||
import fs from "fs-extra"
|
||||
import hostedGitInfo from "hosted-git-info"
|
||||
import isValid from "is-valid-path"
|
||||
import sysPath from "path"
|
||||
import url from "url"
|
||||
|
||||
import { reporter } from "./reporter"
|
||||
import { getConfigStore } from "./get-config-store"
|
||||
|
||||
const packageManagerConfigKey = `cli.packageManager`
|
||||
|
||||
export const getPackageManager = (npmConfigUserAgent) => {
|
||||
const configStore = getConfigStore()
|
||||
const actualPackageManager = configStore.get(packageManagerConfigKey)
|
||||
|
||||
if (actualPackageManager) {
|
||||
return actualPackageManager
|
||||
}
|
||||
|
||||
if (npmConfigUserAgent?.includes(`yarn`)) {
|
||||
configStore.set(packageManagerConfigKey, `yarn`)
|
||||
return `yarn`
|
||||
}
|
||||
|
||||
configStore.set(packageManagerConfigKey, `npm`)
|
||||
return `npm`
|
||||
}
|
||||
|
||||
const removeUndefined = (obj) => {
|
||||
return Object.fromEntries(
|
||||
Object.entries(obj)
|
||||
.filter(([_, v]) => v != null)
|
||||
.map(([k, v]) => [k, v === Object(v) ? removeEmpty(v) : v])
|
||||
)
|
||||
}
|
||||
|
||||
const spawnWithArgs = (file, args, options) =>
|
||||
execa(file, args, { stdio: "ignore", preferLocal: false, ...options })
|
||||
|
||||
const spawn = (cmd, options) => {
|
||||
const [file, ...args] = cmd.split(/\s+/)
|
||||
return spawnWithArgs(file, args, options)
|
||||
}
|
||||
// Checks the existence of yarn package
|
||||
// We use yarnpkg instead of yarn to avoid conflict with Hadoop yarn
|
||||
// Refer to https://github.com/yarnpkg/yarn/issues/673
|
||||
const checkForYarn = () => {
|
||||
try {
|
||||
execSync(`yarnpkg --version`, { stdio: `ignore` })
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
const isAlreadyGitRepository = async () => {
|
||||
try {
|
||||
return await spawn(`git rev-parse --is-inside-work-tree`, {
|
||||
stdio: `pipe`,
|
||||
}).then((output) => output.stdout === `true`)
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize newly cloned directory as a git repo
|
||||
const gitInit = async (rootPath) => {
|
||||
reporter.info(`Initialising git in ${rootPath}`)
|
||||
|
||||
return await spawn(`git init`, { cwd: rootPath })
|
||||
}
|
||||
|
||||
// Create a .gitignore file if it is missing in the new directory
|
||||
const maybeCreateGitIgnore = async (rootPath) => {
|
||||
if (existsSync(sysPath.join(rootPath, `.gitignore`))) {
|
||||
return
|
||||
}
|
||||
|
||||
reporter.info(`Creating minimal .gitignore in ${rootPath}`)
|
||||
await fs.writeFile(
|
||||
sysPath.join(rootPath, `.gitignore`),
|
||||
`.cache\nnode_modules\npublic\n`
|
||||
)
|
||||
reporter.success(`Created .gitignore in ${rootPath}`)
|
||||
}
|
||||
|
||||
// Create an initial git commit in the new directory
|
||||
const createInitialGitCommit = async (rootPath, starterUrl) => {
|
||||
reporter.info(`Create initial git commit in ${rootPath}`)
|
||||
|
||||
await spawn(`git add -A`, { cwd: rootPath })
|
||||
// use execSync instead of spawn to handle git clients using
|
||||
// pgp signatures (with password)
|
||||
try {
|
||||
execSync(`git commit -m "Initial commit from medusa: (${starterUrl})"`, {
|
||||
cwd: rootPath,
|
||||
})
|
||||
} catch {
|
||||
// Remove git support if initial commit fails
|
||||
reporter.warn(`Initial git commit failed - removing git support\n`)
|
||||
fs.removeSync(sysPath.join(rootPath, `.git`))
|
||||
}
|
||||
}
|
||||
|
||||
// Executes `npm install` or `yarn install` in rootPath.
|
||||
const install = async (rootPath, verbose) => {
|
||||
const prevDir = process.cwd()
|
||||
|
||||
const stop = spin(`Installing packages...`)
|
||||
console.log() // Add some space
|
||||
|
||||
process.chdir(rootPath)
|
||||
|
||||
const npmConfigUserAgent = process.env.npm_config_user_agent
|
||||
|
||||
try {
|
||||
if (getPackageManager() === `yarn` && checkForYarn()) {
|
||||
await fs.remove(`package-lock.json`)
|
||||
await spawn(`yarnpkg`, { stdio: verbose ? `inherit` : `ignore` })
|
||||
} else {
|
||||
await fs.remove(`yarn.lock`)
|
||||
await spawn(`npm install`, { stdio: verbose ? `inherit` : `ignore` })
|
||||
}
|
||||
} finally {
|
||||
stop()
|
||||
console.log()
|
||||
reporter.success(`Packages installed`)
|
||||
process.chdir(prevDir)
|
||||
}
|
||||
}
|
||||
|
||||
const ignored = (path) => !/^\.(git|hg)$/.test(sysPath.basename(path))
|
||||
|
||||
// Copy starter from file system.
|
||||
const copy = async (starterPath, rootPath) => {
|
||||
// Chmod with 755.
|
||||
// 493 = parseInt('755', 8)
|
||||
await fs.ensureDir(rootPath, { mode: 493 })
|
||||
|
||||
if (!existsSync(starterPath)) {
|
||||
throw new Error(`starter ${starterPath} doesn't exist`)
|
||||
}
|
||||
|
||||
if (starterPath === `.`) {
|
||||
throw new Error(
|
||||
`You can't create a starter from the existing directory. If you want to
|
||||
create a new project in the current directory, the trailing dot isn't
|
||||
necessary. If you want to create a project from a local starter, run
|
||||
something like "medusa new my-medusa-store ../local-medusa-starter"`
|
||||
)
|
||||
}
|
||||
|
||||
const stop = spin(`Creating new site from local starter: ${starterPath}`)
|
||||
|
||||
reporter.info(`Copying local starter to ${rootPath} ...`)
|
||||
|
||||
await fs.copy(starterPath, rootPath, { filter: ignored })
|
||||
|
||||
stop()
|
||||
console.log()
|
||||
reporter.success(`Created starter directory layout`)
|
||||
console.log() // Add some space
|
||||
|
||||
await install(rootPath)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Clones starter from URI.
|
||||
const clone = async (hostInfo, rootPath, keepGit, verbose = false) => {
|
||||
let url
|
||||
// Let people use private repos accessed over SSH.
|
||||
if (hostInfo.getDefaultRepresentation() === `sshurl`) {
|
||||
url = hostInfo.ssh({ noCommittish: true })
|
||||
// Otherwise default to normal git syntax.
|
||||
} else {
|
||||
url = hostInfo.https({ noCommittish: true, noGitPlus: true })
|
||||
}
|
||||
|
||||
const branch = hostInfo.committish ? [`-b`, hostInfo.committish] : []
|
||||
|
||||
const stop = spin(`Creating new project from git: ${url}`)
|
||||
|
||||
const args = [
|
||||
`clone`,
|
||||
...branch,
|
||||
url,
|
||||
rootPath,
|
||||
`--recursive`,
|
||||
`--depth=1`,
|
||||
].filter((arg) => Boolean(arg))
|
||||
|
||||
await execa(`git`, args, {})
|
||||
.then(() => {
|
||||
stop()
|
||||
console.log()
|
||||
reporter.success(`Created starter directory layout`)
|
||||
})
|
||||
.catch((err) => {
|
||||
stop()
|
||||
console.log()
|
||||
reporter.error(`Failed to clone repository`)
|
||||
throw err
|
||||
})
|
||||
|
||||
if (!keepGit) {
|
||||
await fs.remove(sysPath.join(rootPath, `.git`))
|
||||
}
|
||||
|
||||
await install(rootPath, verbose)
|
||||
const isGit = await isAlreadyGitRepository()
|
||||
if (!isGit) await gitInit(rootPath)
|
||||
await maybeCreateGitIgnore(rootPath)
|
||||
if (!isGit) await createInitialGitCommit(rootPath, url)
|
||||
}
|
||||
|
||||
const getMedusaConfig = (rootPath) => {
|
||||
try {
|
||||
const configPath = sysPath.join(rootPath, "medusa-config.js")
|
||||
if (existsSync(configPath)) {
|
||||
const resolved = sysPath.resolve(configPath)
|
||||
const configModule = require(resolved)
|
||||
return configModule
|
||||
}
|
||||
throw Error()
|
||||
} catch (err) {
|
||||
return null
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
const getPaths = async (starterPath, rootPath) => {
|
||||
let selectedOtherStarter = false
|
||||
|
||||
// set defaults if no root or starter has been set yet
|
||||
rootPath = rootPath || process.cwd()
|
||||
starterPath = starterPath || `medusajs/medusa-starter-default`
|
||||
|
||||
return { starterPath, rootPath, selectedOtherStarter }
|
||||
}
|
||||
|
||||
const successMessage = (path) => {
|
||||
reporter.info(`Your new Medusa project is ready for you! To start developing run:
|
||||
|
||||
cd ${path}
|
||||
medusa develop
|
||||
`)
|
||||
}
|
||||
|
||||
const setupEnvVars = async (rootPath) => {
|
||||
const templatePath = sysPath.join(rootPath, ".env.template")
|
||||
const destination = sysPath.join(rootPath, ".env")
|
||||
if (existsSync(templatePath)) {
|
||||
fs.renameSync(templatePath, destination)
|
||||
}
|
||||
}
|
||||
|
||||
const attemptSeed = async (rootPath) => {
|
||||
const stop = spin("Seeding database")
|
||||
|
||||
const pkgPath = sysPath.resolve(rootPath, "package.json")
|
||||
if (existsSync(pkgPath)) {
|
||||
const pkg = require(pkgPath)
|
||||
if (pkg.scripts && pkg.scripts.seed) {
|
||||
await setupEnvVars(rootPath)
|
||||
|
||||
const proc = execa(getPackageManager(), [`run`, `seed`], {
|
||||
cwd: rootPath,
|
||||
})
|
||||
|
||||
// Useful for development
|
||||
proc.stdout.pipe(process.stdout)
|
||||
|
||||
await proc
|
||||
.then(() => {
|
||||
stop()
|
||||
console.log()
|
||||
reporter.success("Seed completed")
|
||||
})
|
||||
.catch((err) => {
|
||||
stop()
|
||||
console.log()
|
||||
reporter.error("Failed to complete seed; skipping")
|
||||
console.error(err)
|
||||
})
|
||||
} else {
|
||||
stop()
|
||||
console.log()
|
||||
reporter.error("Starter doesn't provide a seed command; skipping.")
|
||||
}
|
||||
} else {
|
||||
stop()
|
||||
console.log()
|
||||
reporter.error("Could not find package.json")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function that clones or copies the starter.
|
||||
*/
|
||||
export const newStarter = async (args) => {
|
||||
const { starter, root, verbose, seed, keepGit } = args
|
||||
|
||||
const { starterPath, rootPath, selectedOtherStarter } = await getPaths(
|
||||
starter,
|
||||
root
|
||||
)
|
||||
|
||||
const urlObject = url.parse(rootPath)
|
||||
|
||||
if (urlObject.protocol && urlObject.host) {
|
||||
const isStarterAUrl =
|
||||
starter && !url.parse(starter).hostname && !url.parse(starter).protocol
|
||||
|
||||
if (/medusa-starter/gi.test(rootPath) && isStarterAUrl) {
|
||||
reporter.panic({
|
||||
id: `10000`,
|
||||
context: {
|
||||
starter,
|
||||
rootPath,
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
reporter.panic({
|
||||
id: `10001`,
|
||||
context: {
|
||||
rootPath,
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (!isValid(rootPath)) {
|
||||
reporter.panic({
|
||||
id: `10002`,
|
||||
context: {
|
||||
path: sysPath.resolve(rootPath),
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (existsSync(sysPath.join(rootPath, `package.json`))) {
|
||||
reporter.panic({
|
||||
id: `10003`,
|
||||
context: {
|
||||
rootPath,
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const hostedInfo = hostedGitInfo.fromUrl(starterPath)
|
||||
if (hostedInfo) {
|
||||
await clone(hostedInfo, rootPath, keepGit, verbose)
|
||||
} else {
|
||||
await copy(starterPath, rootPath, verbose)
|
||||
}
|
||||
|
||||
const medusaConfig = getMedusaConfig(rootPath)
|
||||
if (medusaConfig) {
|
||||
let isPostgres = false
|
||||
if (medusaConfig.projectConfig) {
|
||||
const databaseType = medusaConfig.projectConfig.database_type
|
||||
isPostgres = databaseType === "postgres"
|
||||
}
|
||||
|
||||
if (!isPostgres && seed) {
|
||||
await attemptSeed(rootPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
export const panicHandler = (panicData = {}) => {
|
||||
const { id, context } = panicData
|
||||
switch (id) {
|
||||
case "10000":
|
||||
return {
|
||||
message: `Looks like you provided a URL as your project name. Try "medusa new my-medusa-store ${context.rootPath}" instead.`,
|
||||
}
|
||||
case "10001":
|
||||
return {
|
||||
message: `Looks like you provided a URL as your project name. Try "medusa new my-medusa-store ${context.rootPath}" instead.`,
|
||||
}
|
||||
case "10002":
|
||||
return {
|
||||
message: `Could not create project because ${context.path} is not a valid path.`,
|
||||
}
|
||||
case "10003":
|
||||
return {
|
||||
message: `Directory ${context.rootPath} is already a Node project.`,
|
||||
}
|
||||
default:
|
||||
return {
|
||||
message: "Unknown error",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import c from "ansi-colors"
|
||||
import { panicHandler } from "./panic-handler"
|
||||
|
||||
export const reporter = {
|
||||
info: (message: string): void => console.log(message),
|
||||
verbose: (message: string): void => console.log(message),
|
||||
log: (message: string): void => console.log(message),
|
||||
success: (message: string): void =>
|
||||
console.log(c.green(c.symbols.check + ` `) + message),
|
||||
error: (message: string): void =>
|
||||
console.error(c.red(c.symbols.cross + ` `) + message),
|
||||
panic: (panicData: { id: string; context: any }): never => {
|
||||
const { message } = panicHandler(panicData)
|
||||
console.error(message)
|
||||
process.exit(1)
|
||||
},
|
||||
warn: (message: string): void => console.warn(message),
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import fetch from "node-fetch"
|
||||
import uuidv4 from "uuid/v4"
|
||||
import { getConfigStore } from "./get-config-store"
|
||||
|
||||
const store = getConfigStore()
|
||||
const medusaCliVersion = require(`../package.json`).version
|
||||
|
||||
const analyticsApi =
|
||||
process.env.MEDUSA_TELEMETRY_API ||
|
||||
`https://telemetry.medusa-commerce.com/batch`
|
||||
|
||||
const getMachineId = (): string => {
|
||||
let machineId = store.get(`telemetry.machine_id`)
|
||||
|
||||
if (typeof machineId !== `string`) {
|
||||
machineId = uuidv4()
|
||||
store.set(`telemetry.machine_id`, machineId)
|
||||
}
|
||||
|
||||
return machineId
|
||||
}
|
||||
|
||||
const sessionId = uuidv4()
|
||||
|
||||
export const track = (eventType: string, args?: any): void => {
|
||||
fetch(analyticsApi, {
|
||||
method: `POST`,
|
||||
headers: {
|
||||
"content-type": `application/json`,
|
||||
"user-agent": `create-medusa-app:${medusaCliVersion}`,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
timestamp: new Date(),
|
||||
batch: [
|
||||
{
|
||||
type: eventType,
|
||||
timestamp: new Date(),
|
||||
sessionId,
|
||||
machine_id: getMachineId(),
|
||||
component_id: `create-medusa-app`,
|
||||
cli_version: medusaCliVersion,
|
||||
properties: args,
|
||||
},
|
||||
],
|
||||
}),
|
||||
}).catch(() => {}) /* do nothing, it's telemetry */
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
declare module "stream-filter"
|
||||
declare module "ansi-wordwrap"
|
||||
declare module "uuid/v4"
|
||||
declare module "node-fetch"
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2015",
|
||||
"module": "commonjs",
|
||||
"allowJs": true,
|
||||
"declaration": false,
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.json", "src/**/*.js"],
|
||||
"exclude": ["**/__tests__/**/*"]
|
||||
}
|
||||
@@ -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.18](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.17...@medusajs/medusa-cli@1.1.18) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package @medusajs/medusa-cli
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.17](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.16...@medusajs/medusa-cli@1.1.17) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package @medusajs/medusa-cli
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.16](https://github.com/medusajs/medusa/compare/@medusajs/medusa-cli@1.1.15...@medusajs/medusa-cli@1.1.16) (2021-08-17)
|
||||
|
||||
**Note:** Version bump only for package @medusajs/medusa-cli
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@medusajs/medusa-cli",
|
||||
"version": "1.1.16",
|
||||
"version": "1.1.18",
|
||||
"description": "Command Line interface for Medusa Commerce",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
@@ -52,7 +52,7 @@
|
||||
"joi-objectid": "^3.0.1",
|
||||
"meant": "^1.0.1",
|
||||
"medusa-core-utils": "^0.1.27",
|
||||
"medusa-telemetry": "^0.0.3",
|
||||
"medusa-telemetry": "^0.0.5",
|
||||
"netrc-parser": "^3.1.6",
|
||||
"open": "^8.0.6",
|
||||
"ora": "^5.4.1",
|
||||
@@ -66,5 +66,5 @@
|
||||
"winston": "^3.3.3",
|
||||
"yargs": "^15.3.1"
|
||||
},
|
||||
"gitHead": "cfe19f7f9d3bb17425348362b148a0b4b7a649ef"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
+117
-14
@@ -1300,6 +1300,13 @@ ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5:
|
||||
json-schema-traverse "^0.4.1"
|
||||
uri-js "^4.2.2"
|
||||
|
||||
ansi-align@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.0.tgz#b536b371cf687caaef236c18d3e21fe3797467cb"
|
||||
integrity sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==
|
||||
dependencies:
|
||||
string-width "^3.0.0"
|
||||
|
||||
ansi-escapes@^3.1.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b"
|
||||
@@ -1466,12 +1473,19 @@ aws4@^1.8.0:
|
||||
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.1.tgz#7e33d8f7d449b3f673cd72deb9abdc552dbe528e"
|
||||
integrity sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==
|
||||
|
||||
axios@^0.21.1:
|
||||
version "0.21.1"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
|
||||
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
|
||||
axios-retry@^3.1.9:
|
||||
version "3.1.9"
|
||||
resolved "https://registry.yarnpkg.com/axios-retry/-/axios-retry-3.1.9.tgz#6c30fc9aeb4519aebaec758b90ef56fa03fe72e8"
|
||||
integrity sha512-NFCoNIHq8lYkJa6ku4m+V1837TP6lCa7n79Iuf8/AqATAHYB0ISaAS1eyIenDOfHOLtym34W65Sjke2xjg2fsA==
|
||||
dependencies:
|
||||
follow-redirects "^1.10.0"
|
||||
is-retry-allowed "^1.1.0"
|
||||
|
||||
axios@^0.21.1:
|
||||
version "0.21.2"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.2.tgz#21297d5084b2aeeb422f5d38e7be4fbb82239017"
|
||||
integrity sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==
|
||||
dependencies:
|
||||
follow-redirects "^1.14.0"
|
||||
|
||||
babel-jest@^25.5.1:
|
||||
version "25.5.1"
|
||||
@@ -1589,6 +1603,20 @@ bl@^4.1.0:
|
||||
inherits "^2.0.4"
|
||||
readable-stream "^3.4.0"
|
||||
|
||||
boxen@^5.0.1:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/boxen/-/boxen-5.1.1.tgz#4faca6a437885add0bf8d99082e272d480814cd4"
|
||||
integrity sha512-JtIQYts08AFAYGF4eSh3pUt3NQkYV/e75pRtQmAVTLNWR/1L7Bsswxlgzgk8nmLEM+gFszsIlA9BgD3XnSqp3g==
|
||||
dependencies:
|
||||
ansi-align "^3.0.0"
|
||||
camelcase "^6.2.0"
|
||||
chalk "^4.1.0"
|
||||
cli-boxes "^2.2.1"
|
||||
string-width "^4.2.2"
|
||||
type-fest "^0.20.2"
|
||||
widest-line "^3.1.0"
|
||||
wrap-ansi "^7.0.0"
|
||||
|
||||
brace-expansion@^1.1.7:
|
||||
version "1.1.11"
|
||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
|
||||
@@ -1693,6 +1721,11 @@ camelcase@^5.0.0, camelcase@^5.3.1:
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
|
||||
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||
|
||||
camelcase@^6.2.0:
|
||||
version "6.2.0"
|
||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809"
|
||||
integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==
|
||||
|
||||
caniuse-lite@^1.0.30001219:
|
||||
version "1.0.30001236"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001236.tgz#0a80de4cdf62e1770bb46a30d884fc8d633e3958"
|
||||
@@ -1780,6 +1813,11 @@ ci-info@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
|
||||
integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==
|
||||
|
||||
ci-info@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.2.0.tgz#2876cb948a498797b5236f0095bc057d0dca38b6"
|
||||
integrity sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A==
|
||||
|
||||
class-utils@^0.3.5:
|
||||
version "0.3.6"
|
||||
resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463"
|
||||
@@ -1797,6 +1835,11 @@ clean-stack@^3.0.0:
|
||||
dependencies:
|
||||
escape-string-regexp "4.0.0"
|
||||
|
||||
cli-boxes@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f"
|
||||
integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==
|
||||
|
||||
cli-cursor@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307"
|
||||
@@ -2203,6 +2246,11 @@ doctrine@^3.0.0:
|
||||
dependencies:
|
||||
esutils "^2.0.2"
|
||||
|
||||
dom-walk@^0.1.0:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84"
|
||||
integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==
|
||||
|
||||
domexception@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90"
|
||||
@@ -2660,10 +2708,10 @@ fn.name@1.x.x:
|
||||
resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc"
|
||||
integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==
|
||||
|
||||
follow-redirects@^1.10.0:
|
||||
version "1.13.3"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.3.tgz#e5598ad50174c1bc4e872301e82ac2cd97f90267"
|
||||
integrity sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==
|
||||
follow-redirects@^1.14.0:
|
||||
version "1.14.3"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.3.tgz#6ada78118d8d24caee595595accdc0ac6abd022e"
|
||||
integrity sha512-3MkHxknWMUtb23apkgz/83fDoe+y+qr0TdgacGIA7bew+QLBo3vdgEN2xEsuXNivpFy4CyDhBBZnNZOtalmenw==
|
||||
|
||||
for-in@^1.0.2:
|
||||
version "1.0.2"
|
||||
@@ -2827,6 +2875,14 @@ glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
|
||||
once "^1.3.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
|
||||
global@^4.4.0:
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406"
|
||||
integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==
|
||||
dependencies:
|
||||
min-document "^2.19.0"
|
||||
process "^0.11.10"
|
||||
|
||||
globals@^11.1.0:
|
||||
version "11.12.0"
|
||||
resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
|
||||
@@ -3164,7 +3220,7 @@ is-docker@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.0.0.tgz#2cb0df0e75e2d064fe1864c37cdeacb7b2dcf25b"
|
||||
integrity sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ==
|
||||
|
||||
is-docker@^2.1.1:
|
||||
is-docker@^2.1.1, is-docker@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
|
||||
integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==
|
||||
@@ -3263,6 +3319,11 @@ is-plain-object@^2.0.3, is-plain-object@^2.0.4:
|
||||
dependencies:
|
||||
isobject "^3.0.1"
|
||||
|
||||
is-retry-allowed@^1.1.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz#d778488bd0a4666a3be8a1482b9f2baafedea8b4"
|
||||
integrity sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==
|
||||
|
||||
is-stream@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
|
||||
@@ -4043,6 +4104,21 @@ medusa-core-utils@^0.1.27:
|
||||
"@hapi/joi" "^16.1.8"
|
||||
joi-objectid "^3.0.1"
|
||||
|
||||
medusa-telemetry@^0.0.5:
|
||||
version "0.0.5"
|
||||
resolved "https://registry.yarnpkg.com/medusa-telemetry/-/medusa-telemetry-0.0.5.tgz#d7d08fca5cbecc0e853b4e0406194a92c5206caa"
|
||||
integrity sha512-h7hP5Lc33OkFhMcvfrPcwINzMOuPoG8Vn8O6niKGFxF9RmmQnJgaAG1J43/Eq9ZWBrWi0n42XBttibKwCMViHw==
|
||||
dependencies:
|
||||
axios "^0.21.1"
|
||||
axios-retry "^3.1.9"
|
||||
boxen "^5.0.1"
|
||||
ci-info "^3.2.0"
|
||||
configstore "5.0.1"
|
||||
global "^4.4.0"
|
||||
is-docker "^2.2.1"
|
||||
remove-trailing-slash "^0.1.1"
|
||||
uuid "^8.3.2"
|
||||
|
||||
merge-stream@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
|
||||
@@ -4105,6 +4181,13 @@ mimic-fn@^2.1.0:
|
||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
|
||||
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
|
||||
|
||||
min-document@^2.19.0:
|
||||
version "2.19.0"
|
||||
resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
|
||||
integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=
|
||||
dependencies:
|
||||
dom-walk "^0.1.0"
|
||||
|
||||
minimatch@^3.0.4:
|
||||
version "3.0.4"
|
||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||
@@ -4644,6 +4727,11 @@ process-nextick-args@~2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
|
||||
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
|
||||
|
||||
process@^0.11.10:
|
||||
version "0.11.10"
|
||||
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
|
||||
integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI=
|
||||
|
||||
progress@^2.0.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
|
||||
@@ -4837,6 +4925,11 @@ remove-trailing-separator@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef"
|
||||
integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8=
|
||||
|
||||
remove-trailing-slash@^0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/remove-trailing-slash/-/remove-trailing-slash-0.1.1.tgz#be2285a59f39c74d1bce4f825950061915e3780d"
|
||||
integrity sha512-o4S4Qh6L2jpnCy83ysZDau+VORNvnFw07CKSAymkd6ICNVEPisMyzlc00KlvvicsxKck94SEwhDnMNdICzO+tA==
|
||||
|
||||
repeat-element@^1.1.2:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce"
|
||||
@@ -5324,7 +5417,7 @@ string-width@^3.0.0:
|
||||
is-fullwidth-code-point "^2.0.0"
|
||||
strip-ansi "^5.1.0"
|
||||
|
||||
string-width@^4.0.0:
|
||||
string-width@^4.0.0, string-width@^4.2.2:
|
||||
version "4.2.2"
|
||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5"
|
||||
integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==
|
||||
@@ -5494,9 +5587,9 @@ tmp@^0.0.33:
|
||||
os-tmpdir "~1.0.2"
|
||||
|
||||
tmpl@1.0.x:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"
|
||||
integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
|
||||
integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==
|
||||
|
||||
to-fast-properties@^2.0.0:
|
||||
version "2.0.0"
|
||||
@@ -5608,6 +5701,11 @@ type-fest@^0.11.0:
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1"
|
||||
integrity sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==
|
||||
|
||||
type-fest@^0.20.2:
|
||||
version "0.20.2"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
|
||||
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
|
||||
|
||||
type-fest@^0.21.3:
|
||||
version "0.21.3"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37"
|
||||
@@ -5733,6 +5831,11 @@ uuid@^3.3.2:
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||
|
||||
uuid@^8.3.2:
|
||||
version "8.3.2"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
|
||||
v8-compile-cache@^2.0.3:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e"
|
||||
|
||||
@@ -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.22](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.21...medusa-core-utils@1.1.22) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-core-utils
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.21](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.20...medusa-core-utils@1.1.21) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-core-utils
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.20](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.19...medusa-core-utils@1.1.20) (2021-08-05)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-core-utils",
|
||||
"version": "1.1.20",
|
||||
"version": "1.1.22",
|
||||
"description": "Core utils for Medusa",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -33,5 +33,5 @@
|
||||
"joi": "^17.3.0",
|
||||
"joi-objectid": "^3.0.1"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -4938,9 +4938,9 @@ tmp@^0.0.33:
|
||||
os-tmpdir "~1.0.2"
|
||||
|
||||
tmpl@1.0.x:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"
|
||||
integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
|
||||
integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==
|
||||
|
||||
to-fast-properties@^2.0.0:
|
||||
version "2.0.0"
|
||||
|
||||
@@ -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.
|
||||
|
||||
## [0.0.20](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.19...medusa-dev-cli@0.0.20) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-dev-cli
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.0.19](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.18...medusa-dev-cli@0.0.19) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-dev-cli
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.0.18](https://github.com/medusajs/medusa/compare/medusa-dev-cli@0.0.17...medusa-dev-cli@0.0.18) (2021-07-26)
|
||||
|
||||
**Note:** Version bump only for package medusa-dev-cli
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "medusa-dev-cli",
|
||||
"description": "CLI helpers for contributors working on Medusa",
|
||||
"version": "0.0.18",
|
||||
"version": "0.0.20",
|
||||
"author": "Sebastian Rindom <skrindom@gmail.com>",
|
||||
"bin": {
|
||||
"medusa-dev": "./dist/index.js"
|
||||
@@ -24,7 +24,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.12.1",
|
||||
"@babel/core": "^7.12.3",
|
||||
"babel-preset-medusa-package": "^1.1.13",
|
||||
"babel-preset-medusa-package": "^1.1.15",
|
||||
"cross-env": "^7.0.3"
|
||||
},
|
||||
"homepage": "https://github.com/medusajs/medusa/tree/master/packages/medusa-dev-cli#readme",
|
||||
@@ -47,5 +47,5 @@
|
||||
"engines": {
|
||||
"node": ">=12.13.0"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"plugins": [
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-transform-instanceof",
|
||||
"@babel/plugin-transform-classes"
|
||||
],
|
||||
"presets": ["@babel/preset-env"],
|
||||
"env": {
|
||||
"test": {
|
||||
"plugins": ["@babel/plugin-transform-runtime"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"plugins": ["prettier"],
|
||||
"extends": ["prettier"],
|
||||
"rules": {
|
||||
"prettier/prettier": "error",
|
||||
"semi": "error",
|
||||
"no-unused-expressions": "true"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/lib
|
||||
node_modules
|
||||
.DS_store
|
||||
.env*
|
||||
/*.js
|
||||
!index.js
|
||||
yarn.lock
|
||||
|
||||
/dist
|
||||
|
||||
/api
|
||||
/services
|
||||
/models
|
||||
/subscribers
|
||||
/__mocks__
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/lib
|
||||
node_modules
|
||||
.DS_store
|
||||
.env*
|
||||
/*.js
|
||||
!index.js
|
||||
yarn.lock
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"endOfLine": "lf",
|
||||
"semi": false,
|
||||
"singleQuote": false,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "es5"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
// noop
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "medusa-file-s3",
|
||||
"version": "1.0.0",
|
||||
"description": "AWS s3 file connector for Medusa",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/medusajs/medusa",
|
||||
"directory": "packages/medusa-file-s3"
|
||||
},
|
||||
"author": "Sebastian Mateos Nicolajsen",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.7.5",
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/node": "^7.7.4",
|
||||
"@babel/plugin-proposal-class-properties": "^7.7.4",
|
||||
"@babel/plugin-transform-instanceof": "^7.8.3",
|
||||
"@babel/plugin-transform-runtime": "^7.7.6",
|
||||
"@babel/preset-env": "^7.7.5",
|
||||
"@babel/register": "^7.7.4",
|
||||
"@babel/runtime": "^7.9.6",
|
||||
"client-sessions": "^0.8.0",
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-test-utils": "^0.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d .",
|
||||
"prepare": "cross-env NODE_ENV=production npm run build",
|
||||
"watch": "babel -w src --out-dir . --ignore **/__tests__",
|
||||
"test": "jest"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"medusa-interfaces": "1.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-classes": "^7.15.4",
|
||||
"aws-sdk": "^2.983.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-test-utils": "^1.1.23"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import fs from "fs"
|
||||
import aws from "aws-sdk"
|
||||
import { FileService } from "medusa-interfaces"
|
||||
|
||||
class S3Service extends FileService {
|
||||
constructor({}, options) {
|
||||
super()
|
||||
|
||||
this.bucket_ = options.bucket
|
||||
this.s3Url_ = options.s3_url
|
||||
this.accessKeyId_ = options.access_key_id
|
||||
this.secretAccessKey_ = options.secret_access_key
|
||||
this.region_ = options.region
|
||||
this.endpoint_ = options.endpoint
|
||||
}
|
||||
|
||||
upload(file) {
|
||||
aws.config.setPromisesDependency()
|
||||
aws.config.update({
|
||||
accessKeyId: this.accessKeyId_,
|
||||
secretAccessKey: this.secretAccessKey_,
|
||||
region: this.region_,
|
||||
endpoint: this.endpoint_,
|
||||
})
|
||||
|
||||
const s3 = new aws.S3()
|
||||
var params = {
|
||||
ACL: "public-read",
|
||||
Bucket: this.bucket_,
|
||||
Body: fs.createReadStream(file.path),
|
||||
Key: `${file.originalname}`,
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
s3.upload(params, (err, data) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
return
|
||||
}
|
||||
|
||||
resolve({ url: data.Location })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
delete(file) {
|
||||
aws.config.setPromisesDependency()
|
||||
aws.config.update({
|
||||
accessKeyId: this.accessKeyId_,
|
||||
secretAccessKey: this.secretAccessKey_,
|
||||
region: this.region_,
|
||||
endpoint: this.endpoint_,
|
||||
})
|
||||
|
||||
const s3 = new aws.S3()
|
||||
var params = {
|
||||
Bucket: this.bucket_,
|
||||
Key: `${file}`,
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
s3.deleteObject(params, (err, data) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
return
|
||||
}
|
||||
resolve(data)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default S3Service
|
||||
@@ -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.25](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.24...medusa-file-spaces@1.1.25) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-spaces
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.23...medusa-file-spaces@1.1.24) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-spaces
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.22...medusa-file-spaces@1.1.23) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-spaces
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-file-spaces",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"description": "Digital Ocean Spaces file connector for Medusa",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -40,9 +40,9 @@
|
||||
"aws-sdk": "^2.710.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-test-utils": "^1.1.23",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25",
|
||||
"stripe": "^8.50.0"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.22](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.21...medusa-fulfillment-manual@1.1.22) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-manual
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.21](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.20...medusa-fulfillment-manual@1.1.21) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-manual
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.20](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.19...medusa-fulfillment-manual@1.1.20) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-manual
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-fulfillment-manual",
|
||||
"version": "1.1.20",
|
||||
"version": "1.1.22",
|
||||
"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.20"
|
||||
"medusa-core-utils": "^1.1.22"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -3,6 +3,25 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.26](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.25...medusa-fulfillment-webshipper@1.1.26) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-webshipper
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.24...medusa-fulfillment-webshipper@1.1.25) (2021-09-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.23...medusa-fulfillment-webshipper@1.1.24) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-webshipper
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-fulfillment-webshipper",
|
||||
"version": "1.1.24",
|
||||
"version": "1.1.26",
|
||||
"description": "Webshipper Fulfillment provider for Medusa",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -37,7 +37,7 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20"
|
||||
"medusa-core-utils": "^1.1.22"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -582,7 +582,10 @@ class WebshipperFulfillmentService extends FulfillmentService {
|
||||
}
|
||||
|
||||
if (order) {
|
||||
if (order.data.attributes.status !== "pending") {
|
||||
if (
|
||||
order.data.attributes.status !== "pending" &&
|
||||
order.data.attributes.status !== "missing_rate"
|
||||
) {
|
||||
if (order.data.attributes.status === "cancelled") {
|
||||
return Promise.resolve(order)
|
||||
}
|
||||
|
||||
@@ -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.23](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.22...medusa-interfaces@1.1.23) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-interfaces
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.22](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.21...medusa-interfaces@1.1.22) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-interfaces
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.21](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.20...medusa-interfaces@1.1.21) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-interfaces
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-interfaces",
|
||||
"version": "1.1.21",
|
||||
"version": "1.1.23",
|
||||
"description": "Core interfaces for Medusa",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -35,7 +35,7 @@
|
||||
"typeorm": "0.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"medusa-core-utils": "^1.1.20"
|
||||
"medusa-core-utils": "^1.1.22"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.27](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.26...medusa-payment-adyen@1.1.27) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-adyen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.26](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.25...medusa-payment-adyen@1.1.26) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-adyen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.24...medusa-payment-adyen@1.1.25) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-adyen
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-adyen",
|
||||
"version": "1.1.25",
|
||||
"version": "1.1.27",
|
||||
"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.23"
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"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.20"
|
||||
"medusa-core-utils": "^1.1.22"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.27](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.26...medusa-payment-klarna@1.1.27) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-klarna
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.26](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.25...medusa-payment-klarna@1.1.26) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-klarna
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.24...medusa-payment-klarna@1.1.25) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-klarna
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-klarna",
|
||||
"version": "1.1.25",
|
||||
"version": "1.1.27",
|
||||
"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.20",
|
||||
"medusa-test-utils": "^1.1.23"
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -3,6 +3,33 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.0.4](https://github.com/medusajs/medusa/compare/medusa-payment-manual@1.0.4...medusa-payment-manual@1.0.4) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-manual
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.0.3](https://github.com/medusajs/medusa/compare/medusa-payment-manual@1.0.4...medusa-payment-manual@1.0.3) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-manual
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.0.4](https://github.com/medusajs/medusa/compare/medusa-payment-manual@1.0.2...medusa-payment-manual@1.0.4) (2021-09-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Update to API references look and feel ([#343](https://github.com/medusajs/medusa/issues/343)) ([143f06a](https://github.com/medusajs/medusa/commit/143f06aa397dcc16991405a6143c22eaa0e3ffd9))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.0.3](https://github.com/medusajs/medusa/compare/medusa-payment-manual@1.0.2...medusa-payment-manual@1.0.3) (2021-08-31)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-manual",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"description": "A dummy payment provider to be used for testing or manual payments",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -25,7 +25,7 @@
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-test-utils": "^1.1.23"
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d . --ignore **/__tests__",
|
||||
@@ -36,5 +36,5 @@
|
||||
"peerDependencies": {
|
||||
"medusa-interfaces": "1.x"
|
||||
},
|
||||
"gitHead": "cb44b73a4ec0319c77058816022367183f28857c"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.26](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.25...medusa-payment-paypal@1.0.26) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-paypal
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.0.25](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.24...medusa-payment-paypal@1.0.25) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-paypal
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.0.24](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.23...medusa-payment-paypal@1.0.24) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-paypal
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-paypal",
|
||||
"version": "1.0.24",
|
||||
"version": "1.0.26",
|
||||
"description": "Paypal Payment provider for Meduas Commerce",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -26,8 +26,8 @@
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-interfaces": "^1.1.21",
|
||||
"medusa-test-utils": "^1.1.23"
|
||||
"medusa-interfaces": "^1.1.23",
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d . --ignore **/__tests__,**/__mocks__",
|
||||
@@ -42,7 +42,7 @@
|
||||
"@paypal/checkout-server-sdk": "^1.0.2",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20"
|
||||
"medusa-core-utils": "^1.1.22"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.26](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.25...medusa-payment-stripe@1.1.26) (2021-09-22)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-stripe
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.24...medusa-payment-stripe@1.1.25) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-stripe
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.23...medusa-payment-stripe@1.1.24) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-stripe
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.22...medusa-payment-stripe@1.1.23) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-stripe
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-stripe",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.26",
|
||||
"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.23"
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d . --ignore **/__tests__",
|
||||
@@ -40,8 +40,8 @@
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"stripe": "^8.50.0"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
import _ from "lodash"
|
||||
import Stripe from "stripe"
|
||||
import { PaymentService } from "medusa-interfaces"
|
||||
|
||||
class IdealProviderService extends PaymentService {
|
||||
static identifier = "stripe-ideal"
|
||||
|
||||
constructor(
|
||||
{ stripeProviderService, customerService, totalsService, regionService },
|
||||
options
|
||||
) {
|
||||
super()
|
||||
|
||||
/**
|
||||
* Required Stripe options:
|
||||
* {
|
||||
* api_key: "stripe_secret_key", REQUIRED
|
||||
* webhook_secret: "stripe_webhook_secret", REQUIRED
|
||||
* // Use this flag to capture payment immediately (default is false)
|
||||
* capture: true
|
||||
* }
|
||||
*/
|
||||
this.options_ = options
|
||||
|
||||
/** @private @const {Stripe} */
|
||||
this.stripe_ = Stripe(options.api_key)
|
||||
|
||||
/** @private @const {CustomerService} */
|
||||
this.stripeProviderService_ = stripeProviderService
|
||||
|
||||
/** @private @const {CustomerService} */
|
||||
this.customerService_ = customerService
|
||||
|
||||
/** @private @const {RegionService} */
|
||||
this.regionService_ = regionService
|
||||
|
||||
/** @private @const {TotalsService} */
|
||||
this.totalsService_ = totalsService
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches Stripe payment intent. Check its status and returns the
|
||||
* corresponding Medusa status.
|
||||
* @param {object} paymentData - payment method data from cart
|
||||
* @returns {string} the status of the payment intent
|
||||
*/
|
||||
async getStatus(paymentData) {
|
||||
return await this.stripeProviderService_.getStatus(paymentData)
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a customers saved payment methods if registered in Stripe.
|
||||
* @param {object} customer - customer to fetch saved cards for
|
||||
* @returns {Promise<Array<object>>} saved payments methods
|
||||
*/
|
||||
async retrieveSavedMethods(customer) {
|
||||
return Promise.resolve([])
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches a Stripe customer
|
||||
* @param {string} customerId - Stripe customer id
|
||||
* @returns {Promise<object>} Stripe customer
|
||||
*/
|
||||
async retrieveCustomer(customerId) {
|
||||
return await this.stripeProviderService_.retrieveCustomer(customerId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Stripe customer using a Medusa customer.
|
||||
* @param {object} customer - Customer data from Medusa
|
||||
* @returns {Promise<object>} Stripe customer
|
||||
*/
|
||||
async createCustomer(customer) {
|
||||
return await this.stripeProviderService_.createCustomer(customer)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Stripe payment intent.
|
||||
* If customer is not registered in Stripe, we do so.
|
||||
* @param {object} cart - cart to create a payment for
|
||||
* @returns {object} Stripe payment intent
|
||||
*/
|
||||
async createPayment(cart) {
|
||||
const { customer_id, region_id, email } = cart
|
||||
const region = await this.regionService_.retrieve(region_id)
|
||||
const { currency_code } = region
|
||||
|
||||
const amount = await this.totalsService_.getTotal(cart)
|
||||
|
||||
const intentRequest = {
|
||||
amount: Math.round(amount),
|
||||
currency: currency_code,
|
||||
payment_method_types: ["ideal"],
|
||||
capture_method: "automatic",
|
||||
metadata: { cart_id: `${cart.id}` },
|
||||
}
|
||||
|
||||
if (customer_id) {
|
||||
const customer = await this.customerService_.retrieve(customer_id)
|
||||
|
||||
if (customer.metadata?.stripe_id) {
|
||||
intentRequest.customer = customer.metadata.stripe_id
|
||||
} else {
|
||||
const stripeCustomer = await this.createCustomer({
|
||||
email,
|
||||
id: customer_id,
|
||||
})
|
||||
|
||||
intentRequest.customer = stripeCustomer.id
|
||||
}
|
||||
} else {
|
||||
const stripeCustomer = await this.createCustomer({
|
||||
email,
|
||||
})
|
||||
|
||||
intentRequest.customer = stripeCustomer.id
|
||||
}
|
||||
|
||||
const paymentIntent = await this.stripe_.paymentIntents.create(
|
||||
intentRequest
|
||||
)
|
||||
|
||||
return paymentIntent
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves Stripe payment intent.
|
||||
* @param {object} data - the data of the payment to retrieve
|
||||
* @returns {Promise<object>} Stripe payment intent
|
||||
*/
|
||||
async retrievePayment(data) {
|
||||
return await this.stripeProviderService_.retrievePayment(data)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a Stripe payment intent and returns it.
|
||||
* @param {object} sessionData - the data of the payment to retrieve
|
||||
* @returns {Promise<object>} Stripe payment intent
|
||||
*/
|
||||
async getPaymentData(sessionData) {
|
||||
return await this.stripeProviderService_.getPaymentData(sessionData)
|
||||
}
|
||||
|
||||
/**
|
||||
* Authorizes Stripe payment intent by simply returning
|
||||
* the status for the payment intent in use.
|
||||
* @param {object} sessionData - payment session data
|
||||
* @param {object} context - properties relevant to current context
|
||||
* @returns {Promise<{ status: string, data: object }>} result with data and status
|
||||
*/
|
||||
async authorizePayment(sessionData, context = {}) {
|
||||
return await this.stripeProviderService_.authorizePayment(
|
||||
sessionData,
|
||||
context
|
||||
)
|
||||
}
|
||||
|
||||
async updatePaymentData(sessionData, update) {
|
||||
return await this.stripeProviderService_.updatePaymentData(
|
||||
sessionData,
|
||||
update
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates Stripe payment intent.
|
||||
* @param {object} sessionData - payment session data.
|
||||
* @param {object} update - objec to update intent with
|
||||
* @returns {object} Stripe payment intent
|
||||
*/
|
||||
async updatePayment(sessionData, cart) {
|
||||
try {
|
||||
const stripeId = cart.customer?.metadata?.stripe_id || undefined
|
||||
|
||||
if (stripeId !== sessionData.customer) {
|
||||
return this.createPayment(cart)
|
||||
} else {
|
||||
if (cart.total && sessionData.amount === Math.round(cart.total)) {
|
||||
return sessionData
|
||||
}
|
||||
|
||||
return this.stripe_.paymentIntents.update(sessionData.id, {
|
||||
amount: Math.round(cart.total),
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
async deletePayment(payment) {
|
||||
return await this.stripeProviderService_.deletePayment(payment)
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates customer of Stripe payment intent.
|
||||
* @param {string} paymentIntentId - id of payment intent to update
|
||||
* @param {string} customerId - id of new Stripe customer
|
||||
* @returns {object} Stripe payment intent
|
||||
*/
|
||||
async updatePaymentIntentCustomer(paymentIntentId, customerId) {
|
||||
return await this.stripeProviderService_.updatePaymentIntentCustomer(
|
||||
paymentIntentId,
|
||||
customerId
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures payment for Stripe payment intent.
|
||||
* @param {object} paymentData - payment method data from cart
|
||||
* @returns {object} Stripe payment intent
|
||||
*/
|
||||
async capturePayment(payment) {
|
||||
return await this.stripeProviderService_.capturePayment(payment)
|
||||
}
|
||||
|
||||
/**
|
||||
* Refunds payment for Stripe payment intent.
|
||||
* @param {object} paymentData - payment method data from cart
|
||||
* @param {number} amountToRefund - amount to refund
|
||||
* @returns {string} refunded payment intent
|
||||
*/
|
||||
async refundPayment(payment, amountToRefund) {
|
||||
return await this.stripeProviderService_.refundPayment(
|
||||
payment,
|
||||
amountToRefund
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels payment for Stripe payment intent.
|
||||
* @param {object} paymentData - payment method data from cart
|
||||
* @returns {object} canceled payment intent
|
||||
*/
|
||||
async cancelPayment(payment) {
|
||||
return await this.stripeProviderService_.cancelPayment(payment)
|
||||
}
|
||||
}
|
||||
|
||||
export default IdealProviderService
|
||||
@@ -333,7 +333,7 @@ class StripeProviderService extends PaymentService {
|
||||
async cancelPayment(payment) {
|
||||
const { id } = payment.data
|
||||
try {
|
||||
return this.stripe_.paymentIntents.cancel(id)
|
||||
return await this.stripe_.paymentIntents.cancel(id)
|
||||
} catch (error) {
|
||||
if (error.payment_intent.status === "canceled") {
|
||||
return error.payment_intent
|
||||
|
||||
@@ -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.25](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.24...medusa-plugin-add-ons@1.1.25) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-add-ons
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.23...medusa-plugin-add-ons@1.1.24) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-add-ons
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.22...medusa-plugin-add-ons@1.1.23) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-add-ons
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-add-ons",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"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.23"
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d . --ignore **/__tests__",
|
||||
@@ -37,8 +37,8 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"redis": "^3.0.2"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -3,6 +3,33 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.30...medusa-plugin-brightpearl@1.1.30) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-brightpearl
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.30...medusa-plugin-brightpearl@1.1.29) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-brightpearl
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.28...medusa-plugin-brightpearl@1.1.30) (2021-09-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* account for non-division currencies in sales credit ([#342](https://github.com/medusajs/medusa/issues/342)) ([bd1e115](https://github.com/medusajs/medusa/commit/bd1e115696cf020a29bbfe07e5e85a3e0314bf78))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.28...medusa-plugin-brightpearl@1.1.29) (2021-08-31)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-brightpearl",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.30",
|
||||
"description": "Brightpearl plugin for Medusa Commerce",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -27,8 +27,8 @@
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-interfaces": "^1.1.21",
|
||||
"medusa-test-utils": "^1.1.23",
|
||||
"medusa-interfaces": "^1.1.23",
|
||||
"medusa-test-utils": "^1.1.25",
|
||||
"prettier": "^2.0.5"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -44,8 +44,8 @@
|
||||
"axios": "^0.19.2",
|
||||
"axios-rate-limit": "^1.2.1",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"randomatic": "^3.1.1"
|
||||
},
|
||||
"gitHead": "cb44b73a4ec0319c77058816022367183f28857c"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -3,6 +3,26 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.27](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.26...medusa-plugin-contentful@1.1.27) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-contentful
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.26](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.25...medusa-plugin-contentful@1.1.26) (2021-09-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* adds transform medusa ids ([#385](https://github.com/medusajs/medusa/issues/385)) ([0812aca](https://github.com/medusajs/medusa/commit/0812acaf0db19664028cabf08ffd11d67de42f3a))
|
||||
* typo ([5d5c659](https://github.com/medusajs/medusa/commit/5d5c659f8ae9bd96cc0cc565167f3d926e8253ff))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.24...medusa-plugin-contentful@1.1.25) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-contentful
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-contentful",
|
||||
"version": "1.1.25",
|
||||
"version": "1.1.27",
|
||||
"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.20",
|
||||
"medusa-test-utils": "^1.1.23",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25",
|
||||
"redis": "^3.0.2"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -174,7 +174,7 @@ class ContentfulService extends BaseService {
|
||||
"en-US": variantLinks,
|
||||
},
|
||||
[this.getCustomField("options", "product")]: {
|
||||
"en-US": p.options,
|
||||
"en-US": this.transformMedusaIds(p.options),
|
||||
},
|
||||
[this.getCustomField("medusaId", "product")]: {
|
||||
"en-US": p.id,
|
||||
@@ -285,10 +285,10 @@ class ContentfulService extends BaseService {
|
||||
"en-US": v.sku,
|
||||
},
|
||||
[this.getCustomField("prices", "variant")]: {
|
||||
"en-US": v.prices,
|
||||
"en-US": this.transformMedusaIds(v.prices),
|
||||
},
|
||||
[this.getCustomField("options", "variant")]: {
|
||||
"en-US": v.options,
|
||||
"en-US": this.transformMedusaIds(v.options),
|
||||
},
|
||||
[this.getCustomField("medusaId", "variant")]: {
|
||||
"en-US": v.id,
|
||||
@@ -476,7 +476,7 @@ class ContentfulService extends BaseService {
|
||||
"en-US": p.description,
|
||||
},
|
||||
[this.getCustomField("options", "product")]: {
|
||||
"en-US": p.options,
|
||||
"en-US": this.transformMedusaIds(p.options),
|
||||
},
|
||||
[this.getCustomField("variants", "product")]: {
|
||||
"en-US": variantLinks,
|
||||
@@ -538,9 +538,8 @@ class ContentfulService extends BaseService {
|
||||
"en-US": p.collection.title,
|
||||
}
|
||||
|
||||
productEntryFields[
|
||||
this.getCustomField("collection", "product")
|
||||
] = collection
|
||||
productEntryFields[this.getCustomField("collection", "product")] =
|
||||
collection
|
||||
}
|
||||
|
||||
if (p.tags) {
|
||||
@@ -624,10 +623,10 @@ class ContentfulService extends BaseService {
|
||||
"en-US": v.sku,
|
||||
},
|
||||
[this.getCustomField("options", "variant")]: {
|
||||
"en-US": v.options,
|
||||
"en-US": this.transformMedusaIds(v.options),
|
||||
},
|
||||
[this.getCustomField("prices", "variant")]: {
|
||||
"en-US": v.prices,
|
||||
"en-US": this.transformMedusaIds(v.prices),
|
||||
},
|
||||
[this.getCustomField("medusaId", "variant")]: {
|
||||
"en-US": v.id,
|
||||
@@ -734,6 +733,29 @@ class ContentfulService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
transformMedusaIds(objOrArray) {
|
||||
let input = objOrArray
|
||||
let isArray = true
|
||||
if (!Array.isArray(objOrArray)) {
|
||||
input = [objOrArray]
|
||||
isArray = false
|
||||
}
|
||||
|
||||
let output = []
|
||||
for (const obj of input) {
|
||||
let transformed = Object.assign({}, obj)
|
||||
transformed.medusaId = obj.id
|
||||
output.push(transformed)
|
||||
}
|
||||
|
||||
console.log(output)
|
||||
if (!isArray) {
|
||||
return output[0]
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
async getType(type) {
|
||||
const environment = await this.getContentfulEnvironment_()
|
||||
return environment.getContentType(type)
|
||||
|
||||
@@ -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.15](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.14...medusa-plugin-discount-generator@1.1.15) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-discount-generator
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.13...medusa-plugin-discount-generator@1.1.14) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-discount-generator
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-discount-generator@1.1.12...medusa-plugin-discount-generator@1.1.13) (2021-07-26)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-discount-generator
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-discount-generator",
|
||||
"version": "1.1.13",
|
||||
"version": "1.1.15",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"author": "Sebastian Rindom",
|
||||
@@ -40,5 +40,5 @@
|
||||
"medusa-core-utils": "^0.1.27",
|
||||
"randomatic": "^3.1.1"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.25](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.24...medusa-plugin-economic@1.1.25) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-economic
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.23...medusa-plugin-economic@1.1.24) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-economic
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.22...medusa-plugin-economic@1.1.23) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-economic
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-economic",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-economic",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"description": "E-conomic financial reporting",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -39,9 +39,9 @@
|
||||
"axios": "^0.19.2",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-test-utils": "^1.1.23",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25",
|
||||
"moment": "^2.27.0"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.15](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.14...medusa-plugin-ip-lookup@1.1.15) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-ip-lookup
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.14](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.13...medusa-plugin-ip-lookup@1.1.14) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-ip-lookup
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.13](https://github.com/medusajs/medusa/compare/medusa-plugin-ip-lookup@1.1.12...medusa-plugin-ip-lookup@1.1.13) (2021-07-26)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-ip-lookup
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-ip-lookup",
|
||||
"version": "1.1.13",
|
||||
"version": "1.1.15",
|
||||
"description": "IP lookup middleware for Medusa core",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -35,5 +35,5 @@
|
||||
"axios": "^0.20.0",
|
||||
"mongoose": "^5.8.0"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.25](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.24...medusa-plugin-mailchimp@1.1.25) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-mailchimp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.23...medusa-plugin-mailchimp@1.1.24) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-mailchimp
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.22...medusa-plugin-mailchimp@1.1.23) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-mailchimp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-mailchimp",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"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.20",
|
||||
"medusa-test-utils": "^1.1.23"
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.25](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.24...medusa-plugin-permissions@1.1.25) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-permissions
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.23...medusa-plugin-permissions@1.1.24) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-permissions
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.22...medusa-plugin-permissions@1.1.23) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-permissions
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-permissions",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"description": "Role permission for Medusa core",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -32,9 +32,9 @@
|
||||
"medusa-interfaces": "1.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-test-utils": "^1.1.23",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25",
|
||||
"mongoose": "^5.8.0"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
## [0.0.18](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.18...medusa-plugin-restock-notification@0.0.18) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-restock-notification
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.0.17](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.18...medusa-plugin-restock-notification@0.0.17) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-restock-notification
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.0.18](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.16...medusa-plugin-restock-notification@0.0.18) (2021-09-02)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-restock-notification
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.0.17](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.16...medusa-plugin-restock-notification@0.0.17) (2021-08-31)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-restock-notification
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-restock-notification",
|
||||
"version": "0.0.17",
|
||||
"version": "0.0.18",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,11 +14,11 @@
|
||||
"@babel/core": "^7.7.5",
|
||||
"@babel/plugin-transform-typescript": "^7.13.0",
|
||||
"@babel/preset-typescript": "^7.12.7",
|
||||
"babel-preset-medusa-package": "^1.1.13",
|
||||
"babel-preset-medusa-package": "^1.1.15",
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-test-utils": "^1.1.23",
|
||||
"medusa-test-utils": "^1.1.25",
|
||||
"pg": "^8.5.1",
|
||||
"ulid": "^2.3.0"
|
||||
},
|
||||
@@ -36,7 +36,7 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20"
|
||||
"medusa-core-utils": "^1.1.22"
|
||||
},
|
||||
"gitHead": "cb44b73a4ec0319c77058816022367183f28857c"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -34,13 +34,16 @@ class RestockNotificationService extends BaseService {
|
||||
return this
|
||||
}
|
||||
|
||||
const cloned = new RestockNotificationService({
|
||||
manager: transactionManager,
|
||||
options: this.options_,
|
||||
eventBusService: this.eventBus_,
|
||||
productVariantService: this.productVariantService_,
|
||||
restockNotificationModel: this.restockNotificationModel_,
|
||||
})
|
||||
const cloned = new RestockNotificationService(
|
||||
{
|
||||
manager: transactionManager,
|
||||
options: this.options_,
|
||||
eventBusService: this.eventBus_,
|
||||
productVariantService: this.productVariantService_,
|
||||
restockNotificationModel: this.restockNotificationModel_,
|
||||
},
|
||||
this.options_
|
||||
)
|
||||
|
||||
cloned.transactionManager_ = transactionManager
|
||||
|
||||
|
||||
@@ -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.28](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.27...medusa-plugin-segment@1.1.28) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-segment
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.27](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.26...medusa-plugin-segment@1.1.27) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-segment
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.26](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.25...medusa-plugin-segment@1.1.26) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-segment
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-segment",
|
||||
"version": "1.1.26",
|
||||
"version": "1.1.28",
|
||||
"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.20",
|
||||
"medusa-test-utils": "^1.1.23"
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.26](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.25...medusa-plugin-sendgrid@1.1.26) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-sendgrid
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.24...medusa-plugin-sendgrid@1.1.25) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-sendgrid
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.23...medusa-plugin-sendgrid@1.1.24) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-sendgrid
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-sendgrid",
|
||||
"version": "1.1.24",
|
||||
"version": "1.1.26",
|
||||
"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.20",
|
||||
"medusa-test-utils": "^1.1.23"
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.25](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.24...medusa-plugin-slack-notification@1.1.25) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-slack-notification
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.23...medusa-plugin-slack-notification@1.1.24) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-slack-notification
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.22...medusa-plugin-slack-notification@1.1.23) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-slack-notification
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-economic",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-slack-notification",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"description": "Slack notifications",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -39,9 +39,9 @@
|
||||
"axios": "^0.19.2",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-test-utils": "^1.1.23",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25",
|
||||
"moment": "^2.27.0"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -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.25](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.24...medusa-plugin-twilio-sms@1.1.25) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-twilio-sms
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.23...medusa-plugin-twilio-sms@1.1.24) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-twilio-sms
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.22...medusa-plugin-twilio-sms@1.1.23) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-twilio-sms
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-twilio-sms",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -35,9 +35,9 @@
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-classes": "^7.9.5",
|
||||
"body-parser": "^1.19.0",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-test-utils": "^1.1.23",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25",
|
||||
"twilio": "^3.49.1"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -3,6 +3,39 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.25...medusa-plugin-wishlist@1.1.25) (2021-09-15)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.25...medusa-plugin-wishlist@1.1.24) (2021-09-14)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.25](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.23...medusa-plugin-wishlist@1.1.25) (2021-09-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 404 ([b1132ee](https://github.com/medusajs/medusa/commit/b1132eec23514a6e7a22fe6653f4a4b4fde0e83f))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-plugin-wishlist@1.1.23...medusa-plugin-wishlist@1.1.24) (2021-08-31)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-wishlist",
|
||||
"version": "1.1.24",
|
||||
"version": "1.1.25",
|
||||
"description": "Provides /customers/:id/wishlist to add items to a customr's wishlist",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -38,8 +38,8 @@
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-test-utils": "^1.1.23"
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25"
|
||||
},
|
||||
"gitHead": "cb44b73a4ec0319c77058816022367183f28857c"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -953,18 +953,6 @@
|
||||
exec-sh "^0.3.2"
|
||||
minimist "^1.2.0"
|
||||
|
||||
"@hapi/hoek@^9.0.0":
|
||||
version "9.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131"
|
||||
integrity sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==
|
||||
|
||||
"@hapi/topo@^5.0.0":
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012"
|
||||
integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
|
||||
"@istanbuljs/load-nyc-config@^1.0.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
|
||||
@@ -1166,23 +1154,6 @@
|
||||
readdirp "^2.2.1"
|
||||
upath "^1.1.1"
|
||||
|
||||
"@sideway/address@^4.1.0":
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.2.tgz#811b84333a335739d3969cfc434736268170cad1"
|
||||
integrity sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
|
||||
"@sideway/formula@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.0.tgz#fe158aee32e6bd5de85044be615bc08478a0a13c"
|
||||
integrity sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==
|
||||
|
||||
"@sideway/pinpoint@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
|
||||
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==
|
||||
|
||||
"@sinonjs/commons@^1.7.0":
|
||||
version "1.8.3"
|
||||
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d"
|
||||
@@ -3144,11 +3115,6 @@ is-number@^3.0.0:
|
||||
dependencies:
|
||||
kind-of "^3.0.2"
|
||||
|
||||
is-number@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff"
|
||||
integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==
|
||||
|
||||
is-number@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
|
||||
@@ -3642,22 +3608,6 @@ jest@^25.5.2:
|
||||
import-local "^3.0.2"
|
||||
jest-cli "^25.5.4"
|
||||
|
||||
joi-objectid@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/joi-objectid/-/joi-objectid-3.0.1.tgz#63ace7860f8e1a993a28d40c40ffd8eff01a3668"
|
||||
integrity sha512-V/3hbTlGpvJ03Me6DJbdBI08hBTasFOmipsauOsxOSnsF1blxV537WTl1zPwbfcKle4AK0Ma4OPnzMH4LlvTpQ==
|
||||
|
||||
joi@^17.3.0:
|
||||
version "17.4.2"
|
||||
resolved "https://registry.yarnpkg.com/joi/-/joi-17.4.2.tgz#02f4eb5cf88e515e614830239379dcbbe28ce7f7"
|
||||
integrity sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
"@hapi/topo" "^5.0.0"
|
||||
"@sideway/address" "^4.1.0"
|
||||
"@sideway/formula" "^3.0.0"
|
||||
"@sideway/pinpoint" "^2.0.0"
|
||||
|
||||
js-tokens@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
|
||||
@@ -3878,33 +3828,11 @@ map-visit@^1.0.0:
|
||||
dependencies:
|
||||
object-visit "^1.0.0"
|
||||
|
||||
math-random@^1.0.1:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c"
|
||||
integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==
|
||||
|
||||
media-typer@0.3.0:
|
||||
version "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.20:
|
||||
version "1.1.20"
|
||||
resolved "https://registry.yarnpkg.com/medusa-core-utils/-/medusa-core-utils-1.1.20.tgz#676c0dc863a206b80cc53299a984c532d07df65f"
|
||||
integrity sha512-gf+/L5eeqHea3xgjwD7YZEzfUGlxbjfvaeiiGWi3Wfu0dLa+G1B4S0TsX+upR+oVeWPmk66VMqWC80h3e4csqw==
|
||||
dependencies:
|
||||
joi "^17.3.0"
|
||||
joi-objectid "^3.0.1"
|
||||
|
||||
medusa-test-utils@^1.1.23:
|
||||
version "1.1.23"
|
||||
resolved "https://registry.yarnpkg.com/medusa-test-utils/-/medusa-test-utils-1.1.23.tgz#e8380df499979cd0b97a5bb87779662f4da9d722"
|
||||
integrity sha512-okyUgB4t7bqDieE0XO+HkbVVemn6hE1tTAtF9PXRi2igmKmcnyW/Ljk3lqrKYVhjei4z3Z/b+K2b0oNwhopbGQ==
|
||||
dependencies:
|
||||
"@babel/plugin-transform-classes" "^7.9.5"
|
||||
medusa-core-utils "^1.1.20"
|
||||
randomatic "^3.1.1"
|
||||
|
||||
merge-descriptors@1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61"
|
||||
@@ -4451,15 +4379,6 @@ qs@~6.5.2:
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
|
||||
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
|
||||
|
||||
randomatic@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.1.1.tgz#b776efc59375984e36c537b2f51a1f0aff0da1ed"
|
||||
integrity sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==
|
||||
dependencies:
|
||||
is-number "^4.0.0"
|
||||
kind-of "^6.0.0"
|
||||
math-random "^1.0.1"
|
||||
|
||||
range-parser@~1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
|
||||
|
||||
@@ -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.
|
||||
|
||||
## [0.0.5](https://github.com/medusajs/medusa/compare/medusa-telemetry@0.0.4...medusa-telemetry@0.0.5) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-telemetry
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.0.4](https://github.com/medusajs/medusa/compare/medusa-telemetry@0.0.3...medusa-telemetry@0.0.4) (2021-09-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* make shipping_option_id on requirements optional ([#340](https://github.com/medusajs/medusa/issues/340)) ([16b0fa3](https://github.com/medusajs/medusa/commit/16b0fa377a577abd7976c2beaff83e2030969df8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.0.3](https://github.com/medusajs/medusa/compare/medusa-telemetry@0.0.2...medusa-telemetry@0.0.3) (2021-08-17)
|
||||
|
||||
**Note:** Version bump only for package medusa-telemetry
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-telemetry",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.5",
|
||||
"description": "Telemetry for Medusa",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -16,8 +16,8 @@
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/preset-typescript": "^7.13.0",
|
||||
"babel-preset-medusa-package": "^1.1.13",
|
||||
"@babel/preset-typescript": "^7.15.0",
|
||||
"babel-preset-medusa-package": "^1.1.15",
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
@@ -40,9 +40,10 @@
|
||||
"boxen": "^5.0.1",
|
||||
"ci-info": "^3.2.0",
|
||||
"configstore": "5.0.1",
|
||||
"global": "^4.4.0",
|
||||
"is-docker": "^2.2.1",
|
||||
"remove-trailing-slash": "^0.1.1",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"gitHead": "cfe19f7f9d3bb17425348362b148a0b4b7a649ef"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
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.25](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.24...medusa-test-utils@1.1.25) (2021-09-15)
|
||||
|
||||
**Note:** Version bump only for package medusa-test-utils
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.24](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.23...medusa-test-utils@1.1.24) (2021-09-14)
|
||||
|
||||
**Note:** Version bump only for package medusa-test-utils
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.23](https://github.com/medusajs/medusa/compare/medusa-test-utils@1.1.22...medusa-test-utils@1.1.23) (2021-08-05)
|
||||
|
||||
**Note:** Version bump only for package medusa-test-utils
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-test-utils",
|
||||
"version": "1.1.23",
|
||||
"version": "1.1.25",
|
||||
"description": "Test utils for Medusa",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -29,8 +29,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-classes": "^7.9.5",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"randomatic": "^3.1.1"
|
||||
},
|
||||
"gitHead": "db9d6c0cf55ff60a90415b16bc7582cc4795768f"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -857,6 +857,18 @@
|
||||
exec-sh "^0.3.2"
|
||||
minimist "^1.2.0"
|
||||
|
||||
"@hapi/hoek@^9.0.0":
|
||||
version "9.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131"
|
||||
integrity sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==
|
||||
|
||||
"@hapi/topo@^5.0.0":
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012"
|
||||
integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
|
||||
"@istanbuljs/load-nyc-config@^1.0.0":
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
|
||||
@@ -1058,6 +1070,23 @@
|
||||
readdirp "^2.2.1"
|
||||
upath "^1.1.1"
|
||||
|
||||
"@sideway/address@^4.1.0":
|
||||
version "4.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.2.tgz#811b84333a335739d3969cfc434736268170cad1"
|
||||
integrity sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
|
||||
"@sideway/formula@^3.0.0":
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.0.tgz#fe158aee32e6bd5de85044be615bc08478a0a13c"
|
||||
integrity sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==
|
||||
|
||||
"@sideway/pinpoint@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df"
|
||||
integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==
|
||||
|
||||
"@sinonjs/commons@^1.7.0":
|
||||
version "1.8.2"
|
||||
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.2.tgz#858f5c4b48d80778fde4b9d541f27edc0d56488b"
|
||||
@@ -3167,6 +3196,22 @@ jest@^25.5.2:
|
||||
import-local "^3.0.2"
|
||||
jest-cli "^25.5.4"
|
||||
|
||||
joi-objectid@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/joi-objectid/-/joi-objectid-3.0.1.tgz#63ace7860f8e1a993a28d40c40ffd8eff01a3668"
|
||||
integrity sha512-V/3hbTlGpvJ03Me6DJbdBI08hBTasFOmipsauOsxOSnsF1blxV537WTl1zPwbfcKle4AK0Ma4OPnzMH4LlvTpQ==
|
||||
|
||||
joi@^17.3.0:
|
||||
version "17.4.2"
|
||||
resolved "https://registry.yarnpkg.com/joi/-/joi-17.4.2.tgz#02f4eb5cf88e515e614830239379dcbbe28ce7f7"
|
||||
integrity sha512-Lm56PP+n0+Z2A2rfRvsfWVDXGEWjXxatPopkQ8qQ5mxCEhwHG+Ettgg5o98FFaxilOxozoa14cFhrE/hOzh/Nw==
|
||||
dependencies:
|
||||
"@hapi/hoek" "^9.0.0"
|
||||
"@hapi/topo" "^5.0.0"
|
||||
"@sideway/address" "^4.1.0"
|
||||
"@sideway/formula" "^3.0.0"
|
||||
"@sideway/pinpoint" "^2.0.0"
|
||||
|
||||
js-tokens@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
|
||||
@@ -3379,6 +3424,14 @@ math-random@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.4.tgz#5dd6943c938548267016d4e34f057583080c514c"
|
||||
integrity sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==
|
||||
|
||||
medusa-core-utils@^1.1.22:
|
||||
version "1.1.22"
|
||||
resolved "https://registry.yarnpkg.com/medusa-core-utils/-/medusa-core-utils-1.1.22.tgz#84ce0af0a7c672191d758ea462056e30a39d08b1"
|
||||
integrity sha512-kMuRkWOuNG4Bw6epg/AYu95UJuE+rjHTeTWRLbEPrYGjWREV82tLWVDI21/QcccmaHmMU98Rkw2z9JwyFZIiyw==
|
||||
dependencies:
|
||||
joi "^17.3.0"
|
||||
joi-objectid "^3.0.1"
|
||||
|
||||
merge-stream@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
|
||||
@@ -4516,9 +4569,9 @@ tmp@^0.0.33:
|
||||
os-tmpdir "~1.0.2"
|
||||
|
||||
tmpl@1.0.x:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"
|
||||
integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
|
||||
integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==
|
||||
|
||||
to-fast-properties@^2.0.0:
|
||||
version "2.0.0"
|
||||
|
||||
@@ -3,6 +3,79 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.41](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.40...@medusajs/medusa@1.1.41) (2021-09-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 404 product ([8c8c589](https://github.com/medusajs/medusa/commit/8c8c589b0fa720225a02005f9880ad7d1fbf5042))
|
||||
* add default relations to variants to include prices ([#394](https://github.com/medusajs/medusa/issues/394)) ([d477ca9](https://github.com/medusajs/medusa/commit/d477ca9842eb58cc561e9e0fa9d01e2d0d2f6756))
|
||||
* Ensure uniqueness for products, variants, collections and discounts ([#382](https://github.com/medusajs/medusa/issues/382)) ([2715095](https://github.com/medusajs/medusa/commit/27150959ffa70819cf3c4ad176288a1c70287942))
|
||||
* make shipping_option_id on requirements optional ([#340](https://github.com/medusajs/medusa/issues/340)) ([16b0fa3](https://github.com/medusajs/medusa/commit/16b0fa377a577abd7976c2beaff83e2030969df8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.40](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.40...@medusajs/medusa@1.1.40) (2021-09-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 404 product ([8c8c589](https://github.com/medusajs/medusa/commit/8c8c589b0fa720225a02005f9880ad7d1fbf5042))
|
||||
* add default relations to variants to include prices ([#394](https://github.com/medusajs/medusa/issues/394)) ([d477ca9](https://github.com/medusajs/medusa/commit/d477ca9842eb58cc561e9e0fa9d01e2d0d2f6756))
|
||||
* Ensure uniqueness for products, variants, collections and discounts ([#382](https://github.com/medusajs/medusa/issues/382)) ([2715095](https://github.com/medusajs/medusa/commit/27150959ffa70819cf3c4ad176288a1c70287942))
|
||||
* make shipping_option_id on requirements optional ([#340](https://github.com/medusajs/medusa/issues/340)) ([16b0fa3](https://github.com/medusajs/medusa/commit/16b0fa377a577abd7976c2beaff83e2030969df8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.39](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.40...@medusajs/medusa@1.1.39) (2021-09-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 404 product ([8c8c589](https://github.com/medusajs/medusa/commit/8c8c589b0fa720225a02005f9880ad7d1fbf5042))
|
||||
* add default relations to variants to include prices ([#394](https://github.com/medusajs/medusa/issues/394)) ([d477ca9](https://github.com/medusajs/medusa/commit/d477ca9842eb58cc561e9e0fa9d01e2d0d2f6756))
|
||||
* Ensure uniqueness for products, variants, collections and discounts ([#382](https://github.com/medusajs/medusa/issues/382)) ([2715095](https://github.com/medusajs/medusa/commit/27150959ffa70819cf3c4ad176288a1c70287942))
|
||||
* make shipping_option_id on requirements optional ([#340](https://github.com/medusajs/medusa/issues/340)) ([16b0fa3](https://github.com/medusajs/medusa/commit/16b0fa377a577abd7976c2beaff83e2030969df8))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* update and cancel swaps, claims, and returns ([#310](https://github.com/medusajs/medusa/issues/310)) ([cf66f97](https://github.com/medusajs/medusa/commit/cf66f97758003a41737602d4b1b1051b266d4f81))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.40](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.38...@medusajs/medusa@1.1.40) (2021-09-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Account for non-discountable items in getRefundTotal ([#347](https://github.com/medusajs/medusa/issues/347)) ([fd14e24](https://github.com/medusajs/medusa/commit/fd14e243daf2724ce91aaf85c29806f22f3b6623))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* creates support for swaps on the storefront ([#355](https://github.com/medusajs/medusa/issues/355)) ([ae82cfc](https://github.com/medusajs/medusa/commit/ae82cfc70a94655ff03fcf1d9b8596f14e8c2840))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [1.1.39](https://github.com/medusajs/medusa/compare/@medusajs/medusa@1.1.38...@medusajs/medusa@1.1.39) (2021-08-31)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@medusajs/medusa",
|
||||
"version": "1.1.39",
|
||||
"version": "1.1.41",
|
||||
"description": "E-commerce for JAMstack",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
@@ -20,11 +20,11 @@
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/preset-typescript": "^7.13.0",
|
||||
"babel-preset-medusa-package": "^1.1.13",
|
||||
"babel-preset-medusa-package": "^1.1.15",
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-interfaces": "^1.1.21",
|
||||
"medusa-interfaces": "^1.1.23",
|
||||
"nodemon": "^2.0.1",
|
||||
"prettier": "^1.19.1",
|
||||
"sqlite3": "^5.0.2",
|
||||
@@ -45,7 +45,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@hapi/joi": "^16.1.8",
|
||||
"@medusajs/medusa-cli": "^1.1.16",
|
||||
"@medusajs/medusa-cli": "^1.1.18",
|
||||
"@types/lodash": "^4.14.168",
|
||||
"awilix": "^4.2.3",
|
||||
"body-parser": "^1.19.0",
|
||||
@@ -66,8 +66,8 @@
|
||||
"joi": "^17.3.0",
|
||||
"joi-objectid": "^3.0.1",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"medusa-core-utils": "^1.1.20",
|
||||
"medusa-test-utils": "^1.1.23",
|
||||
"medusa-core-utils": "^1.1.22",
|
||||
"medusa-test-utils": "^1.1.25",
|
||||
"morgan": "^1.9.1",
|
||||
"multer": "^1.4.2",
|
||||
"passport": "^0.4.0",
|
||||
@@ -86,5 +86,5 @@
|
||||
"uuid": "^8.3.1",
|
||||
"winston": "^3.2.1"
|
||||
},
|
||||
"gitHead": "cb44b73a4ec0319c77058816022367183f28857c"
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -12,6 +12,9 @@ import { Validator, MedusaError } from "medusa-core-utils"
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* email:
|
||||
* type: string
|
||||
* description: The Customer's email. Only providable if user not registered.
|
||||
* first_name:
|
||||
* type: string
|
||||
* description: The Customer's first name.
|
||||
@@ -37,6 +40,7 @@ export default async (req, res) => {
|
||||
const { id } = req.params
|
||||
|
||||
const schema = Validator.object().keys({
|
||||
email: Validator.string().optional(),
|
||||
first_name: Validator.string().optional(),
|
||||
last_name: Validator.string().optional(),
|
||||
password: Validator.string().optional(),
|
||||
@@ -50,9 +54,19 @@ export default async (req, res) => {
|
||||
|
||||
try {
|
||||
const customerService = req.scope.resolve("customerService")
|
||||
|
||||
let customer = await customerService.retrieve(id)
|
||||
|
||||
if (value.email && customer.has_account) {
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.INVALID_DATA,
|
||||
"Email cannot be changed when the user has registered their account"
|
||||
)
|
||||
}
|
||||
|
||||
await customerService.update(id, value)
|
||||
|
||||
const customer = await customerService.retrieve(id, {
|
||||
customer = await customerService.retrieve(id, {
|
||||
relations: ["orders"],
|
||||
})
|
||||
res.status(200).json({ customer })
|
||||
|
||||
@@ -22,6 +22,7 @@ import variantRoutes from "./variants"
|
||||
import draftOrderRoutes from "./draft-orders"
|
||||
import collectionRoutes from "./collections"
|
||||
import notificationRoutes from "./notifications"
|
||||
import noteRoutes from "./notes"
|
||||
|
||||
const route = Router()
|
||||
|
||||
@@ -68,6 +69,7 @@ export default (app, container, config) => {
|
||||
collectionRoutes(route)
|
||||
notificationRoutes(route)
|
||||
returnReasonRoutes(route)
|
||||
noteRoutes(route)
|
||||
|
||||
return app
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
import { MedusaError, Validator } from "medusa-core-utils"
|
||||
|
||||
/**
|
||||
* @oas [post] /notes
|
||||
* operationId: "PostNotes"
|
||||
* summary: "Creates a Note"
|
||||
* description: "Creates a Note which can be associated with any resource as required."
|
||||
* requestBody:
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* resource_id:
|
||||
* type: string
|
||||
* description: The id of the resource which the Note relates to.
|
||||
* resource_type:
|
||||
* type: string
|
||||
* description: The type of resource which the Note relates to.
|
||||
* value:
|
||||
* type: string
|
||||
* description: The content of the Note to create.
|
||||
* tags:
|
||||
* - Note
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* note:
|
||||
* $ref: "#/components/schemas/note"
|
||||
*
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const schema = Validator.object().keys({
|
||||
resource_id: Validator.string(),
|
||||
resource_type: Validator.string(),
|
||||
value: Validator.string(),
|
||||
})
|
||||
|
||||
const userId = req.user.id || req.user.userId
|
||||
|
||||
const { value, error } = schema.validate(req.body)
|
||||
if (error) {
|
||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, error.details)
|
||||
}
|
||||
|
||||
try {
|
||||
const noteService = req.scope.resolve("noteService")
|
||||
|
||||
const result = await noteService.create({
|
||||
resource_id: value.resource_id,
|
||||
resource_type: value.resource_type,
|
||||
value: value.value,
|
||||
author_id: userId,
|
||||
})
|
||||
|
||||
res.status(200).json({ note: result })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @oas [delete] /notes/{id}
|
||||
* operationId: "DeleteNotesNote"
|
||||
* summary: "Deletes a Note"
|
||||
* description: "Deletes a Note."
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the Note to delete.
|
||||
* tags:
|
||||
* - Note
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* id:
|
||||
* type: string
|
||||
* description: The id of the deleted Note.
|
||||
* deleted:
|
||||
* type: boolean
|
||||
* description: Whether or not the Note was deleted.
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const { id } = req.params
|
||||
|
||||
try {
|
||||
const noteService = req.scope.resolve("noteService")
|
||||
await noteService.delete(id)
|
||||
|
||||
res.status(200).json({ id, deleted: true })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @oas [get] /notes/{id}
|
||||
* operationId: "GetNoteNote"
|
||||
* summary: "Get Note"
|
||||
* description: "Retrieves a single note using its id"
|
||||
* parameters:
|
||||
* - (path) id=* {string} The id of the note to retrieve.
|
||||
* tags:
|
||||
* - Note
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* note:
|
||||
* $ref: "#/components/schemas/note"
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
const { id } = req.params
|
||||
|
||||
try {
|
||||
const noteService = req.scope.resolve("noteService")
|
||||
const note = await noteService.retrieve(id, { relations: ["author"] })
|
||||
|
||||
res.status(200).json({ note })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Router } from "express"
|
||||
import middlewares from "../../../middlewares"
|
||||
|
||||
const route = Router()
|
||||
|
||||
export default app => {
|
||||
app.use("/notes", route)
|
||||
|
||||
route.get("/:id", middlewares.wrap(require("./get-note").default))
|
||||
|
||||
route.get("/", middlewares.wrap(require("./list-notes").default))
|
||||
|
||||
route.post("/", middlewares.wrap(require("./create-note").default))
|
||||
|
||||
route.post("/:id", middlewares.wrap(require("./update-note").default))
|
||||
|
||||
route.delete("/:id", middlewares.wrap(require("./delete-note").default))
|
||||
|
||||
return app
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @oas [get] /notes
|
||||
* operationId: "GetNotes"
|
||||
* summary: "List Notes"
|
||||
* description: "Retrieves a list of notes"
|
||||
* tags:
|
||||
* - Note
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* properties:
|
||||
* notes:
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: "#/components/schemas/note"
|
||||
*/
|
||||
export default async (req, res) => {
|
||||
try {
|
||||
const limit = parseInt(req.query.limit) || 50
|
||||
const offset = parseInt(req.query.offset) || 0
|
||||
|
||||
const selector = {}
|
||||
|
||||
if ("resource_id" in req.query) {
|
||||
selector.resource_id = req.query.resource_id
|
||||
}
|
||||
|
||||
const noteService = req.scope.resolve("noteService")
|
||||
const notes = await noteService.list(selector, {
|
||||
take: limit,
|
||||
skip: offset,
|
||||
relations: ["author"],
|
||||
})
|
||||
|
||||
res.status(200).json({ notes })
|
||||
} catch (err) {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
Loaded 100 of 271 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user