chore: merge release
This commit is contained in:
commit
59761163c2
565 files changed
+38806
-16346
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"plugins": ["@babel/plugin-proposal-class-properties"],
|
||||
"presets": ["@babel/preset-env"],
|
||||
"presets": ["@babel/preset-env", "@babel/preset-typescript"],
|
||||
"env": {
|
||||
"test": {
|
||||
"plugins": ["@babel/plugin-transform-runtime"]
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
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-core-utils@1.1.27...medusa-core-utils@1.1.28) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-core-utils
|
||||
|
||||
## [1.1.27](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.26...medusa-core-utils@1.1.27) (2021-11-19)
|
||||
|
||||
### Features
|
||||
|
||||
- Typescript for API layer ([#817](https://github.com/medusajs/medusa/issues/817)) ([373532e](https://github.com/medusajs/medusa/commit/373532ecbc8196f47e71af95a8cf82a14a4b1f9e))
|
||||
|
||||
## [1.1.26](https://github.com/medusajs/medusa/compare/medusa-core-utils@1.1.25...medusa-core-utils@1.1.26) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-core-utils
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-core-utils",
|
||||
"version": "1.1.26",
|
||||
"version": "1.1.28",
|
||||
"description": "Core utils for Medusa",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -10,7 +10,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"build": "babel src --out-dir dist/ --ignore **/__tests__",
|
||||
"build": "tsc --build",
|
||||
"prepare": "cross-env NODE_ENV=production npm run build",
|
||||
"watch": "babel -w src --out-dir dist/ --ignore **/__tests__"
|
||||
},
|
||||
@@ -23,15 +23,19 @@
|
||||
"@babel/plugin-transform-classes": "^7.9.5",
|
||||
"@babel/plugin-transform-runtime": "^7.7.6",
|
||||
"@babel/preset-env": "^7.13.9",
|
||||
"@babel/preset-typescript": "^7.16.0",
|
||||
"@babel/runtime": "^7.13.9",
|
||||
"class-transformer": "^0.4.0",
|
||||
"class-validator": "^0.13.1",
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"prettier": "^1.19.1"
|
||||
"prettier": "^1.19.1",
|
||||
"typescript": "^4.4.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"joi": "^17.3.0",
|
||||
"joi-objectid": "^3.0.1"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
+12
-7
@@ -22,12 +22,21 @@ export const MedusaErrorCodes = {
|
||||
* @extends Error
|
||||
*/
|
||||
class MedusaError extends Error {
|
||||
public type: string
|
||||
public message: string
|
||||
public code?: string
|
||||
public date: Date
|
||||
public static Types = MedusaErrorTypes
|
||||
public static Codes = MedusaErrorCodes
|
||||
|
||||
/**
|
||||
* Creates a standardized error to be used across Medusa project.
|
||||
* @param type {MedusaErrorType} - the type of error.
|
||||
* @param params {Array} - Error params.
|
||||
* @param {string} type - type of error
|
||||
* @param {string} message - message to go along with error
|
||||
* @param {string} code - code of error
|
||||
* @param {Array} params - params
|
||||
*/
|
||||
constructor(type, message, code, ...params) {
|
||||
constructor(type: string, message: string, code?: string, ...params: any) {
|
||||
super(...params)
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
@@ -35,14 +44,10 @@ class MedusaError extends Error {
|
||||
}
|
||||
|
||||
this.type = type
|
||||
this.name = type
|
||||
this.code = code
|
||||
this.message = message
|
||||
this.date = new Date()
|
||||
}
|
||||
}
|
||||
|
||||
MedusaError.Types = MedusaErrorTypes
|
||||
MedusaError.Codes = MedusaErrorCodes
|
||||
|
||||
export default MedusaError
|
||||
@@ -1,11 +1,11 @@
|
||||
export { countries } from "./countries"
|
||||
export { isoCountryLookup } from "./countries"
|
||||
export { transformIdableFields } from "./transform-idable-fields"
|
||||
export { indexTypes } from "./index-types"
|
||||
export { default as Validator } from "./validator"
|
||||
export { default as compareObjectsByProp } from "./compare-objects"
|
||||
export { countries, isoCountryLookup } from "./countries"
|
||||
export { default as createRequireFromPath } from "./create-require-from-path"
|
||||
export { default as MedusaError } from "./errors"
|
||||
export { default as getConfigFile } from "./get-config-file"
|
||||
export { default as createRequireFromPath } from "./create-require-from-path"
|
||||
export { default as compareObjectsByProp } from "./compare-objects"
|
||||
export { default as zeroDecimalCurrencies } from "./zero-decimal-currencies"
|
||||
export { default as humanizeAmount } from "./humanize-amount"
|
||||
export { indexTypes } from "./index-types"
|
||||
export { transformIdableFields } from "./transform-idable-fields"
|
||||
export { default as Validator } from "./validator"
|
||||
export { default as zeroDecimalCurrencies } from "./zero-decimal-currencies"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5", "es6"],
|
||||
"target": "es5",
|
||||
"outDir": "./dist",
|
||||
"esModuleInterop": true,
|
||||
"declaration": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true,
|
||||
"noImplicitReturns": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noImplicitThis": true,
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["./src/**/*"],
|
||||
"exclude": ["./dist/**/*", "./src/__tests__", "node_modules"]
|
||||
}
|
||||
+1267
-1578
File diff suppressed because it is too large.
Load diff
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.0.6](https://github.com/medusajs/medusa/compare/medusa-file-s3@1.0.5...medusa-file-s3@1.0.6) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-s3
|
||||
|
||||
## [1.0.5](https://github.com/medusajs/medusa/compare/medusa-file-s3@1.0.4...medusa-file-s3@1.0.5) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-s3
|
||||
|
||||
## [1.0.4](https://github.com/medusajs/medusa/compare/medusa-file-s3@1.0.3...medusa-file-s3@1.0.4) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-s3
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-file-s3",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.6",
|
||||
"description": "AWS s3 file connector for Medusa",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -40,7 +40,8 @@
|
||||
"aws-sdk": "^2.983.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"express": "^4.17.1",
|
||||
"medusa-core-utils": "^1.1.26",
|
||||
"medusa-test-utils": "^1.1.29"
|
||||
}
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"gitHead": "aa460f63591f9625f1fe98749b34172e528bed7f"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.30...medusa-file-spaces@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-spaces
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.29...medusa-file-spaces@1.1.30) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-spaces
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-file-spaces@1.1.28...medusa-file-spaces@1.1.29) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-file-spaces
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-file-spaces",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.31",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31",
|
||||
"stripe": "^8.50.0"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "aa460f63591f9625f1fe98749b34172e528bed7f"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
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-fulfillment-manual@1.1.27...medusa-fulfillment-manual@1.1.28) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-manual
|
||||
|
||||
## [1.1.27](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.26...medusa-fulfillment-manual@1.1.27) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-manual
|
||||
|
||||
## [1.1.26](https://github.com/medusajs/medusa/compare/medusa-fulfillment-manual@1.1.25...medusa-fulfillment-manual@1.1.26) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-manual
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-fulfillment-manual",
|
||||
"version": "1.1.26",
|
||||
"version": "1.1.28",
|
||||
"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.26"
|
||||
"medusa-core-utils": "^1.1.28"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.31...medusa-fulfillment-webshipper@1.1.32) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-webshipper
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.30...medusa-fulfillment-webshipper@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-webshipper
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-fulfillment-webshipper@1.1.29...medusa-fulfillment-webshipper@1.1.30) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-fulfillment-webshipper
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-fulfillment-webshipper",
|
||||
"version": "1.1.30",
|
||||
"version": "1.1.32",
|
||||
"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.26"
|
||||
"medusa-core-utils": "^1.1.28"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -3,6 +3,17 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.28...medusa-interfaces@1.1.29) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-interfaces
|
||||
|
||||
## [1.1.28](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.27...medusa-interfaces@1.1.28) (2021-11-19)
|
||||
|
||||
### Features
|
||||
|
||||
- Allow retrieval of soft-deleted products ([#723](https://github.com/medusajs/medusa/issues/723)) ([1e50aee](https://github.com/medusajs/medusa/commit/1e50aee4feb55092560dd4a9c51a0671363e8576))
|
||||
- Typescript for API layer ([#817](https://github.com/medusajs/medusa/issues/817)) ([373532e](https://github.com/medusajs/medusa/commit/373532ecbc8196f47e71af95a8cf82a14a4b1f9e))
|
||||
|
||||
## [1.1.27](https://github.com/medusajs/medusa/compare/medusa-interfaces@1.1.26...medusa-interfaces@1.1.27) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-interfaces
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-interfaces",
|
||||
"version": "1.1.27",
|
||||
"version": "1.1.29",
|
||||
"description": "Core interfaces for Medusa",
|
||||
"main": "dist/index.js",
|
||||
"repository": {
|
||||
@@ -35,7 +35,7 @@
|
||||
"typeorm": "0.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"medusa-core-utils": "^1.1.26"
|
||||
"medusa-core-utils": "^1.1.28"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MedusaError } from "medusa-core-utils"
|
||||
import { In, FindOperator, Raw } from "typeorm"
|
||||
import { FindOperator, In, Raw } from "typeorm"
|
||||
|
||||
/**
|
||||
* Common functionality for Services
|
||||
@@ -21,6 +21,11 @@ class BaseService {
|
||||
buildQuery_(selector, config = {}) {
|
||||
const build = (obj) => {
|
||||
const where = Object.entries(obj).reduce((acc, [key, value]) => {
|
||||
// Undefined values indicate that they have no significance to the query.
|
||||
// If the query is looking for rows where a column is not set it should use null instead of undefined
|
||||
if (typeof value === "undefined") {
|
||||
return acc
|
||||
}
|
||||
switch (true) {
|
||||
case value instanceof FindOperator:
|
||||
acc[key] = value
|
||||
@@ -63,13 +68,17 @@ class BaseService {
|
||||
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
|
||||
return where
|
||||
}
|
||||
|
||||
const query = {
|
||||
where: build(selector),
|
||||
}
|
||||
|
||||
if ("deleted_at" in selector) {
|
||||
query.withDeleted = true
|
||||
}
|
||||
|
||||
if ("skip" in config) {
|
||||
query.skip = config.skip
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseService } from "medusa-interfaces"
|
||||
import BaseService from "./base-service"
|
||||
|
||||
/**
|
||||
* The interface that all search services must implement.
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
/dist
|
||||
@@ -0,0 +1,20 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.0.3](https://github.com/medusajs/medusa-js/compare/@medusajs/medusa-js@1.0.2...@medusajs/medusa-js@1.0.3) (2021-11-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- release ([5fa4848](https://github.com/medusajs/medusa-js/commit/5fa4848b17a9dd432c2361e5d9485950494a2bc6))
|
||||
|
||||
## [1.0.2](https://github.com/medusajs/medusa-js/compare/@medusajs/medusa-js@1.0.1...@medusajs/medusa-js@1.0.2) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package @medusajs/medusa-js
|
||||
|
||||
## 1.0.1 (2021-11-19)
|
||||
|
||||
### Features
|
||||
|
||||
- Typescript for API layer ([#817](https://github.com/medusajs/medusa-js/issues/817)) ([373532e](https://github.com/medusajs/medusa-js/commit/373532ecbc8196f47e71af95a8cf82a14a4b1f9e))
|
||||
@@ -0,0 +1 @@
|
||||
# Medusa Commerce JS Client
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"transform": {
|
||||
"^.+\\.(t|j)sx?$": "ts-jest"
|
||||
},
|
||||
"testRegex": "(/tests/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
||||
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"]
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "@medusajs/medusa-js",
|
||||
"version": "1.0.3",
|
||||
"description": "Client for Medusa Commerce Rest API",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist/**/*"
|
||||
],
|
||||
"scripts": {
|
||||
"prepare": "cross-env NODE_ENV=production npm run build",
|
||||
"build": "tsc --build",
|
||||
"test": "jest --config jestconfig.json"
|
||||
},
|
||||
"author": "Oliver Juhl",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@medusajs/medusa": "^1.1.55",
|
||||
"axios": "^0.21.0",
|
||||
"retry-axios": "^2.6.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/medusajs/medusa-js.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/medusajs/medusa-js/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.19",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.2.0",
|
||||
"jest": "^26.6.3",
|
||||
"prettier": "^2.2.1",
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
"use strict"
|
||||
/**
|
||||
* MedusaError is the base error for every other MedusaError
|
||||
*/
|
||||
export default class MedusaError extends Error {
|
||||
constructor() {
|
||||
super()
|
||||
}
|
||||
|
||||
public static factory(type: ErrorType): MedusaError {
|
||||
switch (type) {
|
||||
case ErrorType.INVALID_REQUEST:
|
||||
return new MedusaInvalidRequestError()
|
||||
case ErrorType.AUTHENTICATION:
|
||||
return new MedusaAuthenticationError()
|
||||
case ErrorType.API:
|
||||
return new MedusaAPIError()
|
||||
case ErrorType.PERMISSION:
|
||||
return new MedusaPermissionError()
|
||||
case ErrorType.CONNECTION:
|
||||
return new MedusaConnectionError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum ErrorType {
|
||||
"INVALID_REQUEST",
|
||||
"API",
|
||||
"AUTHENTICATION",
|
||||
"PERMISSION",
|
||||
"CONNECTION",
|
||||
}
|
||||
|
||||
/**
|
||||
* MedusaInvalidRequestError is raised when a request as invalid parameters.
|
||||
*/
|
||||
export class MedusaInvalidRequestError extends MedusaError {}
|
||||
|
||||
/**
|
||||
* MedusaAPIError is raised in case no other type cover the problem
|
||||
*/
|
||||
export class MedusaAPIError extends MedusaError {}
|
||||
|
||||
/**
|
||||
* MedusaAuthenticationError is raised when invalid credentials is used to connect to Medusa
|
||||
*/
|
||||
export class MedusaAuthenticationError extends MedusaError {}
|
||||
|
||||
/**
|
||||
* MedusaPermissionErorr is raised when attempting to access a resource without permissions
|
||||
*/
|
||||
export class MedusaPermissionError extends MedusaError {}
|
||||
|
||||
/**
|
||||
* MedusaConnectionError is raised when the Medusa servers can't be reached.
|
||||
*/
|
||||
export class MedusaConnectionError extends MedusaError {}
|
||||
@@ -0,0 +1,51 @@
|
||||
import MedusaError from "./error"
|
||||
import Client, { Config } from "./request"
|
||||
import AuthResource from "./resources/auth"
|
||||
import CartsResource from "./resources/carts"
|
||||
import CollectionsResource from "./resources/collections"
|
||||
import CustomersResource from "./resources/customers"
|
||||
import GiftCardsResource from "./resources/gift-cards"
|
||||
import OrdersResource from "./resources/orders"
|
||||
import ProductsResource from "./resources/products"
|
||||
import RegionsResource from "./resources/regions"
|
||||
import ReturnReasonsResource from "./resources/return-reasons"
|
||||
import ReturnsResource from "./resources/returns"
|
||||
import ShippingOptionsResource from "./resources/shipping-options"
|
||||
import SwapsResource from "./resources/swaps"
|
||||
|
||||
class Medusa {
|
||||
private client: Client
|
||||
public auth: AuthResource
|
||||
public carts: CartsResource
|
||||
public customers: CustomersResource
|
||||
public errors: MedusaError
|
||||
public orders: OrdersResource
|
||||
public products: ProductsResource
|
||||
public regions: RegionsResource
|
||||
public returnReasons: ReturnReasonsResource
|
||||
public returns: ReturnsResource
|
||||
public shippingOptions: ShippingOptionsResource
|
||||
public swaps: SwapsResource
|
||||
public collections: CollectionsResource
|
||||
public giftCards: GiftCardsResource
|
||||
|
||||
constructor(config: Config) {
|
||||
this.client = new Client(config)
|
||||
|
||||
this.auth = new AuthResource(this.client)
|
||||
this.carts = new CartsResource(this.client)
|
||||
this.customers = new CustomersResource(this.client)
|
||||
this.errors = new MedusaError()
|
||||
this.orders = new OrdersResource(this.client)
|
||||
this.products = new ProductsResource(this.client)
|
||||
this.regions = new RegionsResource(this.client)
|
||||
this.returnReasons = new ReturnReasonsResource(this.client)
|
||||
this.returns = new ReturnsResource(this.client)
|
||||
this.shippingOptions = new ShippingOptionsResource(this.client)
|
||||
this.swaps = new SwapsResource(this.client)
|
||||
this.collections = new CollectionsResource(this.client)
|
||||
this.giftCards = new GiftCardsResource(this.client)
|
||||
}
|
||||
}
|
||||
|
||||
export default Medusa
|
||||
@@ -0,0 +1,199 @@
|
||||
import axios, { AxiosError, AxiosInstance } from "axios"
|
||||
import * as rax from "retry-axios"
|
||||
import { v4 as uuidv4 } from "uuid"
|
||||
|
||||
export interface Config {
|
||||
baseUrl: string
|
||||
maxRetries: number
|
||||
}
|
||||
export interface RequestOptions {
|
||||
apiKey?: string
|
||||
timeout?: number
|
||||
numberOfRetries?: number
|
||||
}
|
||||
|
||||
export type RequestMethod = "DELETE" | "POST" | "GET"
|
||||
|
||||
const defaultConfig = {
|
||||
maxRetries: 0,
|
||||
baseUrl: "http://localhost:9000",
|
||||
}
|
||||
|
||||
class Client {
|
||||
private axiosClient: AxiosInstance
|
||||
private config: Config
|
||||
|
||||
constructor(config: Config) {
|
||||
/** @private @constant {AxiosInstance} */
|
||||
this.axiosClient = this.createClient({ ...defaultConfig, ...config })
|
||||
|
||||
/** @private @constant {Config} */
|
||||
this.config = { ...defaultConfig, ...config }
|
||||
}
|
||||
|
||||
shouldRetryCondition(
|
||||
err: AxiosError,
|
||||
numRetries: number,
|
||||
maxRetries: number
|
||||
): boolean {
|
||||
// Obviously, if we have reached max. retries we stop
|
||||
if (numRetries >= maxRetries) {
|
||||
return false
|
||||
}
|
||||
|
||||
// If no response, we assume a connection error and retry
|
||||
if (!err.response) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Retry on conflicts
|
||||
if (err.response.status === 409) {
|
||||
return true
|
||||
}
|
||||
|
||||
// All 5xx errors are retried
|
||||
// OBS: We are currently not retrying 500 requests, since our core needs proper error handling.
|
||||
// At the moment, 500 will be returned on all errors, that are not of type MedusaError.
|
||||
if (err.response.status > 500 && err.response.status <= 599) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Stolen from https://github.com/stripe/stripe-node/blob/fd0a597064289b8c82f374f4747d634050739043/lib/utils.js#L282
|
||||
normalizeHeaders(obj: object): object {
|
||||
if (!(obj && typeof obj === "object")) {
|
||||
return obj
|
||||
}
|
||||
|
||||
return Object.keys(obj).reduce((result, header) => {
|
||||
result[this.normalizeHeader(header)] = obj[header]
|
||||
return result
|
||||
}, {})
|
||||
}
|
||||
|
||||
// Stolen from https://github.com/marten-de-vries/header-case-normalizer/blob/master/index.js#L36-L41
|
||||
normalizeHeader(header: string): string {
|
||||
return header
|
||||
.split("-")
|
||||
.map(
|
||||
(text) => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase()
|
||||
)
|
||||
.join("-")
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates all the initial headers.
|
||||
* We add the idempotency key, if the request is configured to retry.
|
||||
* @param {object} userHeaders user supplied headers
|
||||
* @param {Types.RequestMethod} method request method
|
||||
* @param {string} path request path
|
||||
* @return {object}
|
||||
*/
|
||||
setHeaders(
|
||||
userHeaders: RequestOptions,
|
||||
method: RequestMethod,
|
||||
path: string
|
||||
): object {
|
||||
let defaultHeaders: object = {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
// TODO: if route is an authenticated route, add api key
|
||||
if (path.startsWith("/admin")) {
|
||||
defaultHeaders = {
|
||||
...defaultHeaders,
|
||||
}
|
||||
}
|
||||
|
||||
// only add idempotency key, if we want to retry
|
||||
if (this.config.maxRetries > 0 && method === "POST") {
|
||||
defaultHeaders["Idempotency-Key"] = uuidv4()
|
||||
}
|
||||
|
||||
return Object.assign({}, defaultHeaders, this.normalizeHeaders(userHeaders))
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the axios client used for requests
|
||||
* As part of the creation, we configure the retry conditions
|
||||
* and the exponential backoff approach.
|
||||
* @param {Config} config user supplied configurations
|
||||
* @return {AxiosInstance}
|
||||
*/
|
||||
createClient(config: Config): AxiosInstance {
|
||||
const client = axios.create({
|
||||
baseURL: config.baseUrl,
|
||||
})
|
||||
|
||||
rax.attach(client)
|
||||
|
||||
client.defaults.raxConfig = {
|
||||
instance: client,
|
||||
retry: config.maxRetries,
|
||||
backoffType: "exponential",
|
||||
shouldRetry: (err: AxiosError): boolean => {
|
||||
const cfg = rax.getConfig(err)
|
||||
if (cfg) {
|
||||
return this.shouldRetryCondition(
|
||||
err,
|
||||
cfg.currentRetryAttempt || 1,
|
||||
cfg.retry || 3
|
||||
)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
return client
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the response data as:
|
||||
* { cart: { id: "some_cart", ... } }
|
||||
* @param {object} data Axios response data
|
||||
* @param {number} status Axios response status code
|
||||
* @return {object}
|
||||
*/
|
||||
createRawResponse(data: object, status: number): object {
|
||||
const res = { status }
|
||||
Object.entries(data).map(([key, value]) => {
|
||||
res[key] = value
|
||||
})
|
||||
|
||||
return res as any // eslint-disable-line
|
||||
}
|
||||
|
||||
/**
|
||||
* Axios request
|
||||
* @param {Types.RequestMethod} method request method
|
||||
* @param {string} path request path
|
||||
* @param {object} payload request payload
|
||||
* @param {RequestOptions} options axios configuration
|
||||
* @return {object}
|
||||
*/
|
||||
async request(
|
||||
method: RequestMethod,
|
||||
path: string,
|
||||
payload: object = {},
|
||||
options: RequestOptions = {}
|
||||
): Promise<any> {
|
||||
const reqOpts = {
|
||||
method,
|
||||
withCredentials: true,
|
||||
url: path,
|
||||
data: payload,
|
||||
json: true,
|
||||
headers: this.setHeaders(options, method, path),
|
||||
}
|
||||
|
||||
const { data, status } = await this.axiosClient(reqOpts)
|
||||
|
||||
return this.createRawResponse(data, status)
|
||||
}
|
||||
}
|
||||
|
||||
export default Client
|
||||
@@ -0,0 +1,47 @@
|
||||
import {
|
||||
StoreCustomersRes,
|
||||
StorePostCustomersCustomerAddressesAddressReq,
|
||||
StorePostCustomersCustomerAddressesReq,
|
||||
} from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class AddressesResource extends BaseResource {
|
||||
/**
|
||||
* Adds an address to a customers saved addresses
|
||||
* @param {StorePostCustomersCustomerAddressesReq} payload contains information to create an address
|
||||
* @return {AxiosPromise<StoreCustomerResponse>}
|
||||
*/
|
||||
addAddress(
|
||||
payload: StorePostCustomersCustomerAddressesReq
|
||||
): AxiosPromise<StoreCustomersRes> {
|
||||
const path = `/store/customers/me/addresses`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an address of a customer
|
||||
* @param {string} address_id id of the address to delete
|
||||
* @return {AxiosPromise<StoreCustomersResponse>}
|
||||
*/
|
||||
deleteAddress(address_id: string): AxiosPromise<StoreCustomersRes> {
|
||||
const path = `/store/customers/me/addresses/${address_id}`
|
||||
return this.client.request("DELETE", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an address of a customer
|
||||
* @param {string} address_id id of customer
|
||||
* @param {StorePostCustomersCustomerAddressesAddressReq} payload address update
|
||||
* @return {StoreCustomersResponse}
|
||||
*/
|
||||
updateAddress(
|
||||
address_id: string,
|
||||
payload: StorePostCustomersCustomerAddressesAddressReq
|
||||
): AxiosPromise<StoreCustomersRes> {
|
||||
const path = `/store/customers/me/addresses/${address_id}`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
}
|
||||
|
||||
export default AddressesResource
|
||||
@@ -0,0 +1,41 @@
|
||||
import { AxiosPromise } from "axios"
|
||||
import {
|
||||
StoreGetAuthEmailRes,
|
||||
StorePostAuthReq,
|
||||
StoreAuthRes,
|
||||
} from "@medusajs/medusa"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class AuthResource extends BaseResource {
|
||||
/**
|
||||
* @description Authenticates a customer using email and password combination
|
||||
* @param {StorePostAuthReq} payload authentication payload
|
||||
* @return {AxiosPromise<StoreAuthRes>}
|
||||
*/
|
||||
authenticate(payload: StorePostAuthReq): AxiosPromise<StoreAuthRes> {
|
||||
const path = `/store/auth`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Retrieves an authenticated session
|
||||
* Usually used to check if authenticated session is alive.
|
||||
* @return {AxiosPromise<StoreAuthRes>}
|
||||
*/
|
||||
getSession(): AxiosPromise<StoreAuthRes> {
|
||||
const path = `/store/auth`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Check if email exists
|
||||
* @param {string} email is required
|
||||
* @return {AxiosPromise<StoreGetAuthEmailRes>}
|
||||
*/
|
||||
exists(email: string): AxiosPromise<StoreGetAuthEmailRes> {
|
||||
const path = `/store/auth/${email}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default AuthResource
|
||||
@@ -0,0 +1,9 @@
|
||||
import Client from "../request"
|
||||
|
||||
export default class BaseResource {
|
||||
public client: Client
|
||||
|
||||
constructor(client: Client) {
|
||||
this.client = client
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
import {
|
||||
StoreCartsRes,
|
||||
StorePostCartReq,
|
||||
StorePostCartsCartPaymentSessionReq,
|
||||
StorePostCartsCartPaymentSessionUpdateReq,
|
||||
StorePostCartsCartReq,
|
||||
StorePostCartsCartShippingMethodReq,
|
||||
} from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
import BaseResource from "./base"
|
||||
import LineItemsResource from "./line-items"
|
||||
|
||||
class CartsResource extends BaseResource {
|
||||
public lineItems = new LineItemsResource(this.client)
|
||||
|
||||
/**
|
||||
* Adds a shipping method to cart
|
||||
* @param {string} cart_id Id of cart
|
||||
* @param {StorePostCartsCartShippingMethodReq} payload Containg id of shipping option and optional data
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
addShippingMethod(
|
||||
cart_id: string,
|
||||
payload: StorePostCartsCartShippingMethodReq
|
||||
): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/shipping-methods`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Completes a cart.
|
||||
* Payment authorization is attempted and if more work is required, we simply return the cart for further updates.
|
||||
* If payment is authorized and order is not yet created, we make sure to do so.
|
||||
* The completion of a cart can be performed idempotently with a provided header Idempotency-Key.
|
||||
* If not provuided, we will generate one for the request.
|
||||
* @param {string} cart_id is required
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
complete(cart_id: string): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/complete`
|
||||
return this.client.request("POST", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a cart
|
||||
* @param {StorePostCartReq} payload is optional and can contain a region_id and items.
|
||||
* The cart will contain the payload, if provided. Otherwise it will be empty
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
create(payload?: StorePostCartReq): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates payment sessions.
|
||||
* Initializes the payment sessions that can be used to pay for the items of the cart.
|
||||
* This is usually called when a customer proceeds to checkout.
|
||||
* @param {string} cart_id is required
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
createPaymentSessions(cart_id: string): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/payment-sessions`
|
||||
return this.client.request("POST", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a discount from cart.
|
||||
* @param {string} cart_id is required
|
||||
* @param {string} code discount code to remove
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
deleteDiscount(cart_id: string, code: string): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/discounts/${code}`
|
||||
return this.client.request("DELETE", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a payment session from a cart.
|
||||
* Can be useful in case a payment has failed
|
||||
* @param {string} cart_id is required
|
||||
* @param {string} provider_id the provider id of the session e.g. "stripe"
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
deletePaymentSession(
|
||||
cart_id: string,
|
||||
provider_id: string
|
||||
): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/payment-sessions/${provider_id}`
|
||||
return this.client.request("DELETE", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes a payment session.
|
||||
* @param {string} cart_id is required
|
||||
* @param {string} provider_id the provider id of the session e.g. "stripe"
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
refreshPaymentSession(
|
||||
cart_id: string,
|
||||
provider_id: string
|
||||
): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/payment-sessions/${provider_id}/refresh`
|
||||
return this.client.request("POST", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a cart
|
||||
* @param {string} cart_id is required
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
retrieve(cart_id: string): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes a payment session.
|
||||
* @param {string} cart_id is required
|
||||
* @param {StorePostCartsCartPaymentSessionReq} payload the provider id of the session e.g. "stripe"
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
setPaymentSession(
|
||||
cart_id: string,
|
||||
payload: StorePostCartsCartPaymentSessionReq
|
||||
): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/payment-session`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a cart
|
||||
* @param {string} cart_id is required
|
||||
* @param {StorePostCartsCartReq} payload is required and can contain region_id, email, billing and shipping address
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
update(
|
||||
cart_id: string,
|
||||
payload: StorePostCartsCartReq
|
||||
): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the payment method
|
||||
* @param {string} cart_id is required
|
||||
* @param {StorePostCartsCartPaymentSessionUpdateReq} payload is required
|
||||
* @return {AxiosPromise<StoreCartsRes>}
|
||||
*/
|
||||
updatePaymentSession(
|
||||
cart_id: string,
|
||||
payload: StorePostCartsCartPaymentSessionUpdateReq
|
||||
): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/payment-session/update`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
}
|
||||
|
||||
export default CartsResource
|
||||
@@ -0,0 +1,42 @@
|
||||
import { AxiosPromise } from "axios"
|
||||
import {
|
||||
StoreCollectionsRes,
|
||||
StoreCollectionsListRes,
|
||||
StoreGetCollectionsParams,
|
||||
} from "@medusajs/medusa"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class CollectionsResource extends BaseResource {
|
||||
/**
|
||||
* @description Retrieves a single collection
|
||||
* @param {string} id id of the collection
|
||||
* @return {AxiosPromise<StoreCollectionsRes>}
|
||||
*/
|
||||
retrieve(id: string): AxiosPromise<StoreCollectionsRes> {
|
||||
const path = `/store/collections/${id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Retrieves a list of collections
|
||||
* @param {string} query is optional. Can contain a limit and offset for the returned list
|
||||
* @return {AxiosPromise<StoreCollectionsListRes>}
|
||||
*/
|
||||
list(
|
||||
query?: StoreGetCollectionsParams
|
||||
): AxiosPromise<StoreCollectionsListRes> {
|
||||
let path = `/store/collections`
|
||||
|
||||
if (query) {
|
||||
const queryString = Object.entries(query).map(([key, value]) => {
|
||||
return `${key}=${value}`
|
||||
})
|
||||
|
||||
path = `/store/collections?${queryString.join("&")}`
|
||||
}
|
||||
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default CollectionsResource
|
||||
@@ -0,0 +1,102 @@
|
||||
import {
|
||||
StoreCustomersListOrdersRes,
|
||||
StoreCustomersRes,
|
||||
StoreGetCustomersCustomerOrdersParams,
|
||||
StorePostCustomersCustomerPasswordTokenReq,
|
||||
StorePostCustomersCustomerReq,
|
||||
StorePostCustomersReq,
|
||||
} from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
import AddressesResource from "./addresses"
|
||||
import BaseResource from "./base"
|
||||
import PaymentMethodsResource from "./payment-methods"
|
||||
|
||||
class CustomerResource extends BaseResource {
|
||||
public paymentMethods = new PaymentMethodsResource(this.client)
|
||||
public addresses = new AddressesResource(this.client)
|
||||
|
||||
/**
|
||||
* Creates a customer
|
||||
* @param {StorePostCustomersReq} payload information of customer
|
||||
* @return { AxiosPromise<StoreCustomersRes>}
|
||||
*/
|
||||
create(payload: StorePostCustomersReq): AxiosPromise<StoreCustomersRes> {
|
||||
const path = `/store/customers`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the customer that is currently logged
|
||||
* @return {AxiosPromise<StoreCustomersRes>}
|
||||
*/
|
||||
retrieve(): AxiosPromise<StoreCustomersRes> {
|
||||
const path = `/store/customers/me`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a customer
|
||||
* @param {StorePostCustomersCustomerReq} payload information to update customer with
|
||||
* @return {AxiosPromise<StoreCustomersRes>}
|
||||
*/
|
||||
update(
|
||||
payload: StorePostCustomersCustomerReq
|
||||
): AxiosPromise<StoreCustomersRes> {
|
||||
const path = `/store/customers/me`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve customer orders
|
||||
* @param {StoreGetCustomersCustomerOrdersParams} params optional params to retrieve orders
|
||||
* @return {AxiosPromise<StoreCustomersListOrdersRes>}
|
||||
*/
|
||||
listOrders(
|
||||
params?: StoreGetCustomersCustomerOrdersParams
|
||||
): AxiosPromise<StoreCustomersListOrdersRes> {
|
||||
let path = `/store/customers/me/orders`
|
||||
if (params) {
|
||||
let query: string | undefined
|
||||
|
||||
for (const key of Object.keys(params)) {
|
||||
if (query) {
|
||||
query += `&${key}=${params[key]}`
|
||||
} else {
|
||||
query = `?${key}=${params[key]}`
|
||||
}
|
||||
}
|
||||
|
||||
if (query) {
|
||||
path += query
|
||||
}
|
||||
}
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets customer password
|
||||
* @param {StorePostCustomersCustomerPasswordTokenReq} payload info used to reset customer password
|
||||
* @return {AxiosPromise<StoreCustomersRes>}
|
||||
*/
|
||||
resetPassword(
|
||||
payload: StorePostCustomersCustomerPasswordTokenReq
|
||||
): AxiosPromise<StoreCustomersRes> {
|
||||
const path = `/store/customers/password-reset`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a reset password token, which can be used to reset the password.
|
||||
* The token is not returned but should be sent out to the customer in an email.
|
||||
* @param {StorePostCustomersCustomerPasswordTokenReq} payload info used to generate token
|
||||
* @return {AxiosPromise}
|
||||
*/
|
||||
generatePasswordToken(
|
||||
payload: StorePostCustomersCustomerPasswordTokenReq
|
||||
): AxiosPromise {
|
||||
const path = `/store/customers/password-token`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
}
|
||||
|
||||
export default CustomerResource
|
||||
@@ -0,0 +1,17 @@
|
||||
import { StoreGiftCardsRes } from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class GiftCardsResource extends BaseResource {
|
||||
/**
|
||||
* @description Retrieves a single GiftCard
|
||||
* @param {string} code code of the gift card
|
||||
* @return {AxiosPromise<StoreGiftCardsRes>}
|
||||
*/
|
||||
retrieve(code: string): AxiosPromise<StoreGiftCardsRes> {
|
||||
const path = `/store/gift-cards/${code}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default GiftCardsResource
|
||||
@@ -0,0 +1,54 @@
|
||||
import {
|
||||
StoreCartsRes,
|
||||
StoreCartsDeleteRes,
|
||||
StorePostCartsCartLineItemsItemReq,
|
||||
StorePostCartsCartLineItemsReq,
|
||||
} from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class LineItemsResource extends BaseResource {
|
||||
/**
|
||||
* Creates a line-item for a cart
|
||||
* @param {string} cart_id id of cart
|
||||
* @param {StorePostCartsCartLineItemsReq} payload details needed to create a line-item
|
||||
* @return {AxiosPromise<StoreCartsCartRes>}
|
||||
*/
|
||||
create(
|
||||
cart_id: string,
|
||||
payload: StorePostCartsCartLineItemsReq
|
||||
): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/line-items`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a line-item.
|
||||
* Only quantity updates are allowed
|
||||
* @param {string} cart_id id of cart
|
||||
* @param {string} line_id id of item to update
|
||||
* @param {StorePostCartsCartLineItemsItemReq} payload details needed to update a line-item
|
||||
* @return {AxiosPromise<StoreCartsCartRes>}
|
||||
*/
|
||||
update(
|
||||
cart_id: string,
|
||||
line_id: string,
|
||||
payload: StorePostCartsCartLineItemsItemReq
|
||||
): AxiosPromise<StoreCartsRes> {
|
||||
const path = `/store/carts/${cart_id}/line-items/${line_id}`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a line-item from a cart
|
||||
* @param {string} cart_id id of cart
|
||||
* @param {string} line_id id of item to remove
|
||||
* @return {AxiosPromise<StoreCartsDeleteRes>}
|
||||
*/
|
||||
delete(cart_id: string, line_id: string): AxiosPromise<StoreCartsDeleteRes> {
|
||||
const path = `/store/carts/${cart_id}/line-items/${line_id}`
|
||||
return this.client.request("DELETE", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default LineItemsResource
|
||||
@@ -0,0 +1,48 @@
|
||||
import { StoreGetOrdersParams, StoreOrdersRes } from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class OrdersResource extends BaseResource {
|
||||
/**
|
||||
* @description Retrieves an order
|
||||
* @param {string} id is required
|
||||
* @return {AxiosPromise<StoreOrdersRes>}
|
||||
*/
|
||||
retrieve(id: string): AxiosPromise<StoreOrdersRes> {
|
||||
const path = `/store/orders/${id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Retrieves an order by cart id
|
||||
* @param {string} cart_id is required
|
||||
* @return {AxiosPromise<StoreOrdersRes>}
|
||||
*/
|
||||
retrieveByCartId(cart_id: string): AxiosPromise<StoreOrdersRes> {
|
||||
const path = `/store/orders/cart/${cart_id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Look up an order using order details
|
||||
* @param {StoreGetOrdersParams} payload details used to look up the order
|
||||
* @return {AxiosPromise<StoreOrdersRes>}
|
||||
*/
|
||||
lookupOrder(payload: StoreGetOrdersParams): AxiosPromise<StoreOrdersRes> {
|
||||
let path = `/store/orders?`
|
||||
|
||||
const queryString = Object.entries(payload).map(([key, value]) => {
|
||||
let val = value
|
||||
if (Array.isArray(value)) {
|
||||
val = value.join(",")
|
||||
}
|
||||
|
||||
return `${key}=${encodeURIComponent(val as string)}`
|
||||
})
|
||||
path = `/store/orders?${queryString.join("&")}`
|
||||
|
||||
return this.client.request("GET", path, payload)
|
||||
}
|
||||
}
|
||||
|
||||
export default OrdersResource
|
||||
@@ -0,0 +1,16 @@
|
||||
import BaseResource from "./base"
|
||||
import { AxiosPromise } from "axios"
|
||||
|
||||
class PaymentMethodsResource extends BaseResource {
|
||||
/**
|
||||
* Lists customer payment methods
|
||||
* @param {string} id id of cart
|
||||
* @return {AxiosPromise<{ payment_methods: object[] }>}
|
||||
*/
|
||||
list(id: string): AxiosPromise<{ payment_methods: object[] }> {
|
||||
const path = `/store/carts/${id}/payment-methods`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default PaymentMethodsResource
|
||||
@@ -0,0 +1,43 @@
|
||||
import {
|
||||
StoreGetVariantsParams,
|
||||
StoreVariantsListRes,
|
||||
StoreVariantsRes,
|
||||
} from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class ProductVariantsResource extends BaseResource {
|
||||
/**
|
||||
* @description Retrieves a single product variant
|
||||
* @param {string} id is required
|
||||
* @return {AxiosPromise<StoreVariantsRes>}
|
||||
*/
|
||||
retrieve(id: string): AxiosPromise<StoreVariantsRes> {
|
||||
const path = `/store/variants/${id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Retrieves a list of of Product Variants
|
||||
* @param {StoreVariantsListParamsObject} query
|
||||
* @return {AxiosPromise<StoreVariantsListRes>}
|
||||
*/
|
||||
list(query?: StoreGetVariantsParams): AxiosPromise<StoreVariantsListRes> {
|
||||
const path = `/store/variants`
|
||||
|
||||
const search = Object.entries(query || {}).map(([key, value]) => {
|
||||
if (Array.isArray(value)) {
|
||||
return `${key}=${value.join(",")}`
|
||||
}
|
||||
|
||||
return `${key}=${value}`
|
||||
})
|
||||
|
||||
return this.client.request(
|
||||
"GET",
|
||||
`${path}${search.length > 0 && `?${search.join("&")}`}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default ProductVariantsResource
|
||||
@@ -0,0 +1,55 @@
|
||||
import {
|
||||
StoreGetProductsParams,
|
||||
StorePostSearchReq,
|
||||
StorePostSearchRes,
|
||||
StoreProductsListRes,
|
||||
StoreProductsRes,
|
||||
} from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
import BaseResource from "./base"
|
||||
import ProductVariantsResource from "./product-variants"
|
||||
|
||||
class ProductsResource extends BaseResource {
|
||||
public variants = new ProductVariantsResource(this.client)
|
||||
|
||||
/**
|
||||
* @description Retrieves a single Product
|
||||
* @param {string} id is required
|
||||
* @return {AxiosPromise<StoreProductsRes>}
|
||||
*/
|
||||
retrieve(id: string): AxiosPromise<StoreProductsRes> {
|
||||
const path = `/store/products/${id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Searches for products
|
||||
* @param {StorePostSearchReq} searchOptions is required
|
||||
* @return {AxiosPromise<StorePostSearchRes>}
|
||||
*/
|
||||
search(searchOptions: StorePostSearchReq): AxiosPromise<StorePostSearchRes> {
|
||||
const path = `/store/products/search`
|
||||
return this.client.request("POST", path, searchOptions)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Retrieves a list of products
|
||||
* @param {StoreGetProductsParams} query is optional. Can contain a limit and offset for the returned list
|
||||
* @return {AxiosPromise<StoreProductsListRes>}
|
||||
*/
|
||||
list(query?: StoreGetProductsParams): AxiosPromise<StoreProductsListRes> {
|
||||
let path = `/store/products`
|
||||
|
||||
if (query) {
|
||||
const queryString = Object.entries(query).map(([key, value]) => {
|
||||
return `${key}=${value}`
|
||||
})
|
||||
|
||||
path = `/store/products?${queryString.join("&")}`
|
||||
}
|
||||
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default ProductsResource
|
||||
@@ -0,0 +1,26 @@
|
||||
import { AxiosPromise } from "axios"
|
||||
import { StoreRegionsListRes, StoreRegionsRes } from "@medusajs/medusa"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class RegionsResource extends BaseResource {
|
||||
/**
|
||||
* @description Retrieves a list of regions
|
||||
* @return {AxiosPromise<StoreRegionsListRes>}
|
||||
*/
|
||||
list(): AxiosPromise<StoreRegionsListRes> {
|
||||
const path = `/store/regions`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Retrieves a region
|
||||
* @param {string} id is required
|
||||
* @return {AxiosPromise<StoreRegionsRes>}
|
||||
*/
|
||||
retrieve(id: string): AxiosPromise<StoreRegionsRes> {
|
||||
const path = `/store/regions/${id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default RegionsResource
|
||||
@@ -0,0 +1,29 @@
|
||||
import BaseResource from "./base"
|
||||
import {
|
||||
StoreReturnReasonsListRes,
|
||||
StoreReturnReasonsRes,
|
||||
} from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
|
||||
class ReturnReasonsResource extends BaseResource {
|
||||
/**
|
||||
* @description Retrieves a single Return Reason
|
||||
* @param {string} id is required
|
||||
* @return {AxiosPromise<StoreReturnReasonsRes>}
|
||||
*/
|
||||
retrieve(id: string): AxiosPromise<StoreReturnReasonsRes> {
|
||||
const path = `/store/return-reasons/${id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists return reasons defined in Medusa Admin
|
||||
* @return {AxiosPromise<StoreReturnReasonsListRes>}
|
||||
*/
|
||||
list(): AxiosPromise<StoreReturnReasonsListRes> {
|
||||
const path = `/store/return-reasons`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default ReturnReasonsResource
|
||||
@@ -0,0 +1,17 @@
|
||||
import BaseResource from "./base"
|
||||
import { AxiosPromise } from "axios"
|
||||
import { StoreReturnsRes, StorePostReturnsReq } from "@medusajs/medusa"
|
||||
|
||||
class ReturnsResource extends BaseResource {
|
||||
/**
|
||||
* Creates a return request
|
||||
* @param {StorePostReturnsReq} payload details needed to create a return
|
||||
* @return {AxiosPromise<StoreReturnsRes>}
|
||||
*/
|
||||
create(payload: StorePostReturnsReq): AxiosPromise<StoreReturnsRes> {
|
||||
const path = `/store/returns`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
}
|
||||
|
||||
export default ReturnsResource
|
||||
@@ -0,0 +1,44 @@
|
||||
import {
|
||||
StoreGetShippingOptionsParams,
|
||||
StoreShippingOptionsListRes,
|
||||
} from "@medusajs/medusa"
|
||||
import { AxiosPromise } from "axios"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class ShippingOptionsResource extends BaseResource {
|
||||
/**
|
||||
* @description Lists shiping options available for a cart
|
||||
* @param {string} cart_id
|
||||
* @return {AxiosPromise<StoreShippingOptionsListRes>}
|
||||
*/
|
||||
listCartOptions(cart_id: string): AxiosPromise<StoreShippingOptionsListRes> {
|
||||
const path = `/store/shipping-options/${cart_id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Lists shiping options available
|
||||
* @param {StoreGetShippingOptionsParamsObject} query
|
||||
* @return {AxiosPromise<StoreShippingOptionsListRes>}
|
||||
*/
|
||||
list(
|
||||
query?: StoreGetShippingOptionsParams
|
||||
): AxiosPromise<StoreShippingOptionsListRes> {
|
||||
let path = `/store/shipping-options`
|
||||
|
||||
const queryString = Object.entries(query || {}).map(([key, value]) => {
|
||||
let val = value
|
||||
if (Array.isArray(value)) {
|
||||
val = value.join(",")
|
||||
}
|
||||
|
||||
return `${key}=${val}`
|
||||
})
|
||||
|
||||
path = `/store/shipping-options?${queryString.join("&")}`
|
||||
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default ShippingOptionsResource
|
||||
@@ -0,0 +1,27 @@
|
||||
import { AxiosPromise } from "axios"
|
||||
import { StoreSwapsRes, StorePostSwapsReq } from "@medusajs/medusa"
|
||||
import BaseResource from "./base"
|
||||
|
||||
class SwapsResource extends BaseResource {
|
||||
/**
|
||||
* @description Creates a swap from a cart
|
||||
* @param {StorePostSwapsReq} payload
|
||||
* @return {AxiosPromise<StoreSwapsRes>}
|
||||
*/
|
||||
create(payload: StorePostSwapsReq): AxiosPromise<StoreSwapsRes> {
|
||||
const path = `/store/swaps`
|
||||
return this.client.request("POST", path, payload)
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Retrieves a swap by cart id
|
||||
* @param {string} cart_id id of cart
|
||||
* @return {AxiosPromise<StoreSwapsRes>}
|
||||
*/
|
||||
retrieveByCartId(cart_id: string): AxiosPromise<StoreSwapsRes> {
|
||||
const path = `/store/swaps/${cart_id}`
|
||||
return this.client.request("GET", path)
|
||||
}
|
||||
}
|
||||
|
||||
export default SwapsResource
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es5", "es6"],
|
||||
"target": "es5",
|
||||
"outDir": "./dist",
|
||||
"esModuleInterop": true,
|
||||
"declaration": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"sourceMap": true,
|
||||
"noImplicitReturns": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noImplicitThis": true,
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", " **/tests/*"]
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.33](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.32...medusa-payment-adyen@1.1.33) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-adyen
|
||||
|
||||
## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.31...medusa-payment-adyen@1.1.32) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-adyen
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-payment-adyen@1.1.30...medusa-payment-adyen@1.1.31) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-adyen
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-adyen",
|
||||
"version": "1.1.31",
|
||||
"version": "1.1.33",
|
||||
"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.29"
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"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.26"
|
||||
"medusa-core-utils": "^1.1.28"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.33](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.32...medusa-payment-klarna@1.1.33) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-klarna
|
||||
|
||||
## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.31...medusa-payment-klarna@1.1.32) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-klarna
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-payment-klarna@1.1.30...medusa-payment-klarna@1.1.31) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-klarna
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-klarna",
|
||||
"version": "1.1.31",
|
||||
"version": "1.1.33",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29"
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.0.10](https://github.com/medusajs/medusa/compare/medusa-payment-manual@1.0.9...medusa-payment-manual@1.0.10) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-manual
|
||||
|
||||
## [1.0.9](https://github.com/medusajs/medusa/compare/medusa-payment-manual@1.0.8...medusa-payment-manual@1.0.9) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-manual
|
||||
|
||||
## [1.0.8](https://github.com/medusajs/medusa/compare/medusa-payment-manual@1.0.7...medusa-payment-manual@1.0.8) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-manual
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-manual",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.10",
|
||||
"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.29"
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel src -d . --ignore **/__tests__",
|
||||
@@ -36,5 +36,5 @@
|
||||
"peerDependencies": {
|
||||
"medusa-interfaces": "1.x"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -3,11 +3,13 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.0.31](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.30...medusa-payment-paypal@1.0.31) (2021-11-11)
|
||||
## [1.0.32](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.30...medusa-payment-paypal@1.0.32) (2021-11-19)
|
||||
|
||||
### Bug Fixes
|
||||
**Note:** Version bump only for package medusa-payment-paypal
|
||||
|
||||
- account for lowest currency unit in paypal ([#761](https://github.com/medusajs/medusa/issues/761)) ([b30a2af](https://github.com/medusajs/medusa/commit/b30a2af94de32476d82bbe4727ee7b224d6437fe))
|
||||
## [1.0.31](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.30...medusa-payment-paypal@1.0.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-paypal
|
||||
|
||||
## [1.0.30](https://github.com/medusajs/medusa/compare/medusa-payment-paypal@1.0.29...medusa-payment-paypal@1.0.30) (2021-10-18)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-paypal",
|
||||
"version": "1.0.31",
|
||||
"version": "1.0.32",
|
||||
"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.27",
|
||||
"medusa-test-utils": "^1.1.29"
|
||||
"medusa-interfaces": "^1.1.29",
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"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.26"
|
||||
"medusa-core-utils": "^1.1.28"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.31...medusa-payment-stripe@1.1.32) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-stripe
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.30...medusa-payment-stripe@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-stripe
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-payment-stripe@1.1.29...medusa-payment-stripe@1.1.30) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-payment-stripe
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-payment-stripe",
|
||||
"version": "1.1.30",
|
||||
"version": "1.1.32",
|
||||
"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.29"
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"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.26",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"stripe": "^8.50.0"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.30...medusa-plugin-add-ons@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-add-ons
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.29...medusa-plugin-add-ons@1.1.30) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-add-ons
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-add-ons@1.1.28...medusa-plugin-add-ons@1.1.29) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-add-ons
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-add-ons",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.31",
|
||||
"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.29"
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"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.26",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"redis": "^3.0.2"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,15 @@
|
||||
/dist
|
||||
.env
|
||||
.DS_Store
|
||||
/uploads
|
||||
/node_modules
|
||||
yarn-error.log
|
||||
|
||||
/dist
|
||||
|
||||
/api
|
||||
/services
|
||||
/models
|
||||
/subscribers
|
||||
/loaders
|
||||
/utils
|
||||
@@ -0,0 +1,13 @@
|
||||
/lib
|
||||
node_modules
|
||||
.DS_store
|
||||
.env*
|
||||
/*.js
|
||||
!index.js
|
||||
yarn.lock
|
||||
src
|
||||
.gitignore
|
||||
.eslintrc
|
||||
.babelrc
|
||||
.prettierrc
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# 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/medusa-plugin-algolia@0.0.2...medusa-plugin-algolia@0.0.3) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-algolia
|
||||
|
||||
## 0.0.2 (2021-11-19)
|
||||
|
||||
### Features
|
||||
|
||||
- Algolia plugin for medusa ([#718](https://github.com/medusajs/medusa/issues/718)) ([8ce9b20](https://github.com/medusajs/medusa/commit/8ce9b20222e1f4db75f730898549f0ed09eb1574))
|
||||
- Typescript for API layer ([#817](https://github.com/medusajs/medusa/issues/817)) ([373532e](https://github.com/medusajs/medusa/commit/373532ecbc8196f47e71af95a8cf82a14a4b1f9e))
|
||||
@@ -0,0 +1,20 @@
|
||||
# medusa-plugin-algolia
|
||||
|
||||
algolia Plugin for Medusa to search for products.
|
||||
|
||||
## Plugin Options
|
||||
|
||||
```
|
||||
{
|
||||
application_id: "someId",
|
||||
admin_api_key: "someApiKey",
|
||||
settings: {
|
||||
[indexName]: [algolia settings passed to algolia's `updateSettings()` method]
|
||||
// example
|
||||
products: {
|
||||
searchableAttributes: ["title", "description", "variant_sku", "type_value"],
|
||||
attributesToRetrieve: ["title", "description", "variant_sku", "type_value"],
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
//noop
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
testEnvironment: "node",
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "medusa-plugin-algolia",
|
||||
"version": "0.0.3",
|
||||
"description": "Search support for algolia",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/medusajs/medusa",
|
||||
"directory": "packages/medusa-plugin-algolia"
|
||||
},
|
||||
"author": "rolwin100",
|
||||
"license": "MIT",
|
||||
"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",
|
||||
"typeorm": "0.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"algoliasearch": "^4.10.5",
|
||||
"body-parser": "^1.19.0",
|
||||
"lodash": "^4.17.21",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-interfaces": "^1.1.29"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"gitHead": "aa460f63591f9625f1fe98749b34172e528bed7f"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export default async (container, options) => {
|
||||
try {
|
||||
const algoliaService = container.resolve("algoliaService")
|
||||
|
||||
await Promise.all(
|
||||
Object.entries(options.settings).map(([key, value]) =>
|
||||
algoliaService.updateSettings(key, value)
|
||||
)
|
||||
)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
import algoliasearch from "algoliasearch"
|
||||
import { indexTypes } from "medusa-core-utils"
|
||||
import { SearchService } from "medusa-interfaces"
|
||||
import { transformProduct } from "../utils/transform-product"
|
||||
|
||||
class AlgoliaService extends SearchService {
|
||||
constructor(container, options) {
|
||||
super()
|
||||
|
||||
this.options_ = options
|
||||
const { application_id, admin_api_key } = this.options_
|
||||
|
||||
if (!application_id) {
|
||||
throw new Error("Please provide a valid Application ID")
|
||||
}
|
||||
|
||||
if (!admin_api_key) {
|
||||
throw new Error("Please provide a valid Admin Api Key")
|
||||
}
|
||||
|
||||
this.client_ = algoliasearch(application_id, admin_api_key)
|
||||
}
|
||||
|
||||
/**
|
||||
* Add two numbers.
|
||||
* @param {string} indexName - The name of the index
|
||||
* @param {*} options - not required just to match the schema we are used it
|
||||
* @return {*}
|
||||
*/
|
||||
createIndex(indexName, options = {}) {
|
||||
return this.client_.initIndex(indexName)
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get an index
|
||||
* @param {string} indexName - the index name.
|
||||
* @return {Promise<{object}>} - returns response from search engine provider
|
||||
*/
|
||||
getIndex(indexName) {
|
||||
let hits = []
|
||||
return this.client_
|
||||
.initIndex(indexName)
|
||||
.browseObjects({
|
||||
query: indexName,
|
||||
batch: (batch) => {
|
||||
hits = hits.concat(batch)
|
||||
},
|
||||
})
|
||||
.then(() => hits)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} indexName
|
||||
* @param {Array} documents - products list array
|
||||
* @param {*} type
|
||||
* @return {*}
|
||||
*/
|
||||
addDocuments(indexName, documents, type) {
|
||||
const transformedDocuments = this.getTransformedDocuments(type, documents)
|
||||
return this.client_.initIndex(indexName).saveObjects(transformedDocuments)
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to replace documents
|
||||
* @param {string} indexName - the index name.
|
||||
* @param {Object} documents - array of document objects that will replace existing documents
|
||||
* @param {Array.<Object>} type - type of documents to be replaced (e.g: products, regions, orders, etc)
|
||||
* @return {Promise<{object}>} - returns response from search engine provider
|
||||
*/
|
||||
replaceDocuments(indexName, documents, type) {
|
||||
const transformedDocuments = this.getTransformedDocuments(type, documents)
|
||||
return this.client_
|
||||
.initIndex(indexName)
|
||||
.replaceAllObjects(transformedDocuments)
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to delete document
|
||||
* @param {string} indexName - the index name
|
||||
* @param {string} document_id - the id of the document
|
||||
* @return {Promise<{object}>} - returns response from search engine provider
|
||||
*/
|
||||
deleteDocument(indexName, document_id) {
|
||||
return this.client_.initIndex(indexName).deleteObject(document_id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to delete all documents
|
||||
* @param {string} indexName - the index name
|
||||
* @return {Promise<{object}>} - returns response from search engine provider
|
||||
*/
|
||||
deleteAllDocuments(indexName) {
|
||||
return this.client_.initIndex(indexName).delete()
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to search for a document in an index
|
||||
* @param {string} indexName - the index name
|
||||
* @param {string} query - the search query
|
||||
* @param {*} options
|
||||
* - any options passed to the request object other than the query and indexName
|
||||
* - additionalOptions contain any provider specific options
|
||||
* @return {*} - returns response from search engine provider
|
||||
*/
|
||||
search(indexName, query, options) {
|
||||
const { paginationOptions, filter, additionalOptions } = options
|
||||
if ("limit" in paginationOptions) {
|
||||
paginationOptions["length"] = paginationOptions.limit
|
||||
delete paginationOptions.limit
|
||||
}
|
||||
|
||||
return this.client_.initIndex(indexName).search(query, {
|
||||
filters: filter,
|
||||
...paginationOptions,
|
||||
...additionalOptions,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to update the settings of an index
|
||||
* @param {string} indexName - the index name
|
||||
* @param {object} settings - settings object
|
||||
* @return {Promise<{object}>} - returns response from search engine provider
|
||||
*/
|
||||
updateSettings(indexName, settings) {
|
||||
return this.client_.initIndex(indexName).setSettings(settings)
|
||||
}
|
||||
|
||||
getTransformedDocuments(type, documents) {
|
||||
switch (type) {
|
||||
case indexTypes.products:
|
||||
return this.transformProducts(documents)
|
||||
default:
|
||||
return documents
|
||||
}
|
||||
}
|
||||
|
||||
transformProducts(products) {
|
||||
if (!products) {
|
||||
return []
|
||||
}
|
||||
return products.map(transformProduct)
|
||||
}
|
||||
}
|
||||
|
||||
export default AlgoliaService
|
||||
@@ -0,0 +1,42 @@
|
||||
const variantKeys = [
|
||||
"sku",
|
||||
"title",
|
||||
"upc",
|
||||
"ean",
|
||||
"mid_code",
|
||||
"hs_code",
|
||||
"options",
|
||||
]
|
||||
const prefix = `variant`
|
||||
|
||||
export const transformProduct = (product) => {
|
||||
const initialObj = variantKeys.reduce((obj, key) => {
|
||||
obj[`${prefix}_${key}`] = []
|
||||
return obj
|
||||
}, {})
|
||||
initialObj[`${prefix}_options_value`] = []
|
||||
|
||||
const flattenedVariantFields = product.variants.reduce((obj, variant) => {
|
||||
variantKeys.forEach((k) => {
|
||||
if (k === "options" && variant[k]) {
|
||||
const values = variant[k].map((option) => option.value)
|
||||
obj[`${prefix}_options_value`] =
|
||||
obj[`${prefix}_options_value`].concat(values)
|
||||
return
|
||||
}
|
||||
return variant[k] && obj[`${prefix}_${k}`].push(variant[k])
|
||||
})
|
||||
return obj
|
||||
}, initialObj)
|
||||
|
||||
product.objectID = product.id
|
||||
product.type_value = product.type && product.type.value
|
||||
product.collection_title = product.collection && product.collection.title
|
||||
product.collection_handle = product.collection && product.collection.handle
|
||||
product.tags_value = product.tags ? product.tags.map((t) => t.value) : []
|
||||
|
||||
return {
|
||||
...product,
|
||||
...flattenedVariantFields,
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.37](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.36...medusa-plugin-brightpearl@1.1.37) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-brightpearl
|
||||
|
||||
## [1.1.36](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.35...medusa-plugin-brightpearl@1.1.36) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-brightpearl
|
||||
|
||||
## [1.1.35](https://github.com/medusajs/medusa/compare/medusa-plugin-brightpearl@1.1.34...medusa-plugin-brightpearl@1.1.35) (2021-10-26)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-brightpearl",
|
||||
"version": "1.1.35",
|
||||
"version": "1.1.37",
|
||||
"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.27",
|
||||
"medusa-test-utils": "^1.1.29",
|
||||
"medusa-interfaces": "^1.1.29",
|
||||
"medusa-test-utils": "^1.1.31",
|
||||
"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.26",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"randomatic": "^3.1.1"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
const ignore = []
|
||||
|
||||
// Jest needs to compile this code, but generally we don't want this copied
|
||||
// to output folders
|
||||
if (process.env.NODE_ENV !== `test`) {
|
||||
ignore.push(`**/__tests__`)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
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"],
|
||||
},
|
||||
},
|
||||
ignore,
|
||||
}
|
||||
@@ -3,6 +3,7 @@ node_modules
|
||||
.DS_store
|
||||
.env*
|
||||
/*.js
|
||||
!.babelrc.js
|
||||
!index.js
|
||||
yarn.lock
|
||||
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.34](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.33...medusa-plugin-contentful@1.1.34) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-contentful
|
||||
|
||||
## [1.1.33](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.32...medusa-plugin-contentful@1.1.33) (2021-11-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- ignore tests in build output ([#579](https://github.com/medusajs/medusa/issues/579)) ([53178cb](https://github.com/medusajs/medusa/commit/53178cbda3b4f5e9ac30829c99b4d4df6616a0cf))
|
||||
|
||||
## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-plugin-contentful@1.1.31...medusa-plugin-contentful@1.1.32) (2021-10-25)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ContentfulMock = void 0;
|
||||
var ContentfulMock = {
|
||||
createClient: jest.fn()
|
||||
};
|
||||
exports.ContentfulMock = ContentfulMock;
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-contentful",
|
||||
"version": "1.1.32",
|
||||
"version": "1.1.34",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31",
|
||||
"redis": "^3.0.2"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
export const createClient = jest.fn()
|
||||
|
||||
const mock = jest.fn().mockImplementation(() => {
|
||||
return { createClient }
|
||||
})
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.30...medusa-plugin-economic@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-economic
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.29...medusa-plugin-economic@1.1.30) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-economic
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-economic@1.1.28...medusa-plugin-economic@1.1.29) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-economic
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-economic",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.31",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-economic",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.31",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31",
|
||||
"moment": "^2.27.0"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.30...medusa-plugin-mailchimp@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-mailchimp
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.29...medusa-plugin-mailchimp@1.1.30) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-mailchimp
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-mailchimp@1.1.28...medusa-plugin-mailchimp@1.1.29) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-mailchimp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-mailchimp",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.31",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29"
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.0.9](https://github.com/medusajs/medusa/compare/medusa-plugin-meilisearch@0.0.8...medusa-plugin-meilisearch@0.0.9) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-meilisearch
|
||||
|
||||
## [0.0.8](https://github.com/medusajs/medusa/compare/medusa-plugin-meilisearch@0.0.7...medusa-plugin-meilisearch@0.0.8) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-meilisearch
|
||||
|
||||
## [0.0.7](https://github.com/medusajs/medusa/compare/medusa-plugin-meilisearch@0.0.6...medusa-plugin-meilisearch@0.0.7) (2021-11-03)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-meilisearch",
|
||||
"version": "0.0.7",
|
||||
"version": "0.0.9",
|
||||
"description": "A starter for Medusa projects.",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
@@ -23,8 +23,8 @@
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"lodash": "^4.17.21",
|
||||
"medusa-core-utils": "^1.1.26",
|
||||
"medusa-interfaces": "^1.1.27",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-interfaces": "^1.1.29",
|
||||
"meilisearch": "^0.20.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -41,5 +41,6 @@
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2"
|
||||
}
|
||||
},
|
||||
"gitHead": "aa460f63591f9625f1fe98749b34172e528bed7f"
|
||||
}
|
||||
@@ -3,6 +3,16 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.30...medusa-plugin-permissions@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-permissions
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.29...medusa-plugin-permissions@1.1.30) (2021-11-19)
|
||||
|
||||
### Features
|
||||
|
||||
- Typescript for API layer ([#817](https://github.com/medusajs/medusa/issues/817)) ([373532e](https://github.com/medusajs/medusa/commit/373532ecbc8196f47e71af95a8cf82a14a4b1f9e))
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-permissions@1.1.28...medusa-plugin-permissions@1.1.29) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-permissions
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-permissions",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.31",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31",
|
||||
"mongoose": "^5.8.0"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "aa460f63591f9625f1fe98749b34172e528bed7f"
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import { IdMap } from "medusa-test-utils"
|
||||
|
||||
export const PermissionServiceMock = {
|
||||
hasPermission: jest.fn().mockImplementation((user, method, endpoint) => {
|
||||
if (user._id === IdMap.getId("test-user")) {
|
||||
return Promise.resolve(true)
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
const mock = jest.fn().mockImplementation(() => {
|
||||
return PermissionServiceMock
|
||||
})
|
||||
|
||||
export default mock
|
||||
@@ -1,354 +0,0 @@
|
||||
import mongoose from "mongoose"
|
||||
import { IdMap } from "medusa-test-utils"
|
||||
import PermissionService from "../permission"
|
||||
import { permissions, RoleModelMock } from "../../models/__mocks__/role"
|
||||
|
||||
describe("PermissionService", () => {
|
||||
describe("hasPermission", () => {
|
||||
let result
|
||||
let user = {
|
||||
_id: IdMap.getId("test-user"),
|
||||
email: "oliver@medusa.test",
|
||||
passwordHash: "123456789",
|
||||
metadata: {
|
||||
roles: ["product_editor"],
|
||||
},
|
||||
}
|
||||
const permissionService = new PermissionService({
|
||||
roleModel: RoleModelMock,
|
||||
})
|
||||
|
||||
beforeAll(async () => {
|
||||
jest.clearAllMocks()
|
||||
result = await permissionService.hasPermission(user, "POST", "/products")
|
||||
})
|
||||
|
||||
it("calls permission model functions", () => {
|
||||
expect(RoleModelMock.findOne).toHaveBeenCalledTimes(
|
||||
user.metadata.roles.length
|
||||
)
|
||||
})
|
||||
|
||||
it("successfully grants access to user", () => {
|
||||
expect(result).toEqual(true)
|
||||
})
|
||||
|
||||
it("succesfully denies access to user", async () => {
|
||||
const accessDenied = await permissionService.hasPermission(
|
||||
user,
|
||||
"CREATE",
|
||||
"/orders"
|
||||
)
|
||||
expect(accessDenied).toEqual(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("retrieveRole", () => {
|
||||
let result
|
||||
const permissionService = new PermissionService({
|
||||
roleModel: RoleModelMock,
|
||||
})
|
||||
beforeAll(async () => {
|
||||
jest.clearAllMocks()
|
||||
|
||||
result = await permissionService.retrieveRole("product_editor")
|
||||
})
|
||||
|
||||
it("calls permission model functions", () => {
|
||||
expect(RoleModelMock.findOne).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it("successfully fetches product editor permissions", () => {
|
||||
expect(result).toEqual(permissions.productEditorPermission)
|
||||
})
|
||||
|
||||
it("throws if role with name does not exist", async () => {
|
||||
try {
|
||||
await permissionService.retrieveRole("product_editor")
|
||||
} catch (error) {
|
||||
expect(error.message).toEqual(
|
||||
"test_editor does not exist. Use method createRole to create it."
|
||||
)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("createRole", () => {
|
||||
const permissionService = new PermissionService({
|
||||
roleModel: RoleModelMock,
|
||||
})
|
||||
|
||||
beforeAll(async () => {
|
||||
jest.clearAllMocks()
|
||||
|
||||
const contentEditorPermissions = [
|
||||
{
|
||||
method: "POST",
|
||||
endpoint: "/contents",
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
endpoint: "/contents",
|
||||
},
|
||||
{
|
||||
method: "PUT",
|
||||
endpoint: "/contents",
|
||||
},
|
||||
]
|
||||
|
||||
await permissionService.createRole(
|
||||
"content_editor",
|
||||
contentEditorPermissions
|
||||
)
|
||||
})
|
||||
|
||||
it("calls permission model functions", () => {
|
||||
expect(RoleModelMock.create).toHaveBeenCalledTimes(1)
|
||||
expect(RoleModelMock.create).toHaveBeenCalledWith({
|
||||
name: "content_editor",
|
||||
permissions: [
|
||||
{
|
||||
method: "POST",
|
||||
endpoint: "/contents",
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
endpoint: "/contents",
|
||||
},
|
||||
{
|
||||
method: "PUT",
|
||||
endpoint: "/contents",
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
it("throws if any permission is invalid", async () => {
|
||||
try {
|
||||
await permissionService.createRole("content_editor", [
|
||||
{
|
||||
method: "POST",
|
||||
endpoint: "/products",
|
||||
},
|
||||
{
|
||||
// Should fail since this is not a valid http request
|
||||
method: "FETCH",
|
||||
endpoint: "/products",
|
||||
},
|
||||
])
|
||||
} catch (err) {
|
||||
expect(err.message).toEqual("Permission is not valid")
|
||||
}
|
||||
})
|
||||
|
||||
it("throws if role with name already exists", async () => {
|
||||
try {
|
||||
await permissionService.createRole("product_editor", [
|
||||
{
|
||||
method: "POST",
|
||||
endpoint: "/order",
|
||||
},
|
||||
])
|
||||
} catch (err) {
|
||||
expect(err.message).toEqual("product_editor already exists")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("grantRole", () => {
|
||||
const setMetadataMock = jest.fn().mockReturnValue(Promise.resolve())
|
||||
const userRetrieveMock = jest.fn().mockImplementation((data) => {
|
||||
if (data === IdMap.getId("permission-user")) {
|
||||
return Promise.resolve({
|
||||
_id: IdMap.getId("permission-user"),
|
||||
email: "oliver@test.dk",
|
||||
metadata: {
|
||||
roles: ["content_editor"],
|
||||
},
|
||||
})
|
||||
}
|
||||
if (data === IdMap.getId("user-without-roles")) {
|
||||
return Promise.resolve({
|
||||
_id: IdMap.getId("user-without-roles"),
|
||||
email: "oliver@test.dk",
|
||||
metadata: {},
|
||||
})
|
||||
}
|
||||
return Promise.resolve(undefined)
|
||||
})
|
||||
const permissionService = new PermissionService({
|
||||
roleModel: RoleModelMock,
|
||||
userService: {
|
||||
setMetadata: setMetadataMock,
|
||||
retrieve: userRetrieveMock,
|
||||
},
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
it("successfully grants role to user", async () => {
|
||||
await permissionService.grantRole(
|
||||
IdMap.getId("permission-user"),
|
||||
"product_editor"
|
||||
)
|
||||
|
||||
expect(setMetadataMock).toHaveBeenCalledTimes(1)
|
||||
expect(setMetadataMock).toHaveBeenCalledWith(
|
||||
IdMap.getId("permission-user"),
|
||||
"roles",
|
||||
["content_editor", "product_editor"]
|
||||
)
|
||||
})
|
||||
|
||||
it("sets user metadata.roles to user that does not have metadata.roles", async () => {
|
||||
await permissionService.grantRole(
|
||||
IdMap.getId("user-without-roles"),
|
||||
"product_editor"
|
||||
)
|
||||
|
||||
expect(setMetadataMock).toHaveBeenCalledTimes(1)
|
||||
expect(setMetadataMock).toHaveBeenCalledWith(
|
||||
IdMap.getId("user-without-roles"),
|
||||
"roles",
|
||||
["product_editor"]
|
||||
)
|
||||
})
|
||||
|
||||
it("throws if user already has role", async () => {
|
||||
try {
|
||||
await permissionService.grantRole(
|
||||
IdMap.getId("permission-user"),
|
||||
"product_editor"
|
||||
)
|
||||
} catch (err) {
|
||||
expect(err.message).toEqual("User already has role: product_editor")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("addPermission", () => {
|
||||
const permissionService = new PermissionService({
|
||||
roleModel: RoleModelMock,
|
||||
})
|
||||
|
||||
beforeAll(async () => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
it("successfully adds permission", async () => {
|
||||
const toAdd = {
|
||||
method: "POST",
|
||||
endpoint: "/products",
|
||||
}
|
||||
await permissionService.addPermission("product_editor", toAdd)
|
||||
|
||||
expect(RoleModelMock.updateOne).toHaveBeenCalledTimes(1)
|
||||
expect(RoleModelMock.updateOne).toHaveBeenCalledWith(
|
||||
{ _id: IdMap.getId("product_editor") },
|
||||
{
|
||||
$push: { permissions: { method: "POST", endpoint: "/products" } },
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
it("throws if permission is not valid", async () => {
|
||||
const toAdd = {
|
||||
method: "POST",
|
||||
endpoint: 1234,
|
||||
}
|
||||
|
||||
try {
|
||||
await permissionService.addPermission("product_editor", toAdd)
|
||||
} catch (err) {
|
||||
expect(err.message).toEqual("Permission is not valid")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("removePermission", () => {
|
||||
const permissionService = new PermissionService({
|
||||
roleModel: RoleModelMock,
|
||||
})
|
||||
|
||||
beforeAll(async () => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
it("successfully removes permission", async () => {
|
||||
const toRemove = {
|
||||
method: "POST",
|
||||
endpoint: "/products",
|
||||
}
|
||||
await permissionService.removePermission("product_editor", toRemove)
|
||||
|
||||
expect(RoleModelMock.updateOne).toHaveBeenCalledTimes(1)
|
||||
expect(RoleModelMock.updateOne).toHaveBeenCalledWith(
|
||||
{ _id: IdMap.getId("product_editor") },
|
||||
{
|
||||
$pull: { permissions: { method: "POST", endpoint: "/products" } },
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
it("throws if permission is not valid", async () => {
|
||||
const update = {
|
||||
method: "FETCH",
|
||||
endpoint: "/cart",
|
||||
}
|
||||
|
||||
try {
|
||||
await permissionService.addPermission("product_editor", update)
|
||||
} catch (err) {
|
||||
expect(err.message).toEqual("Permission is not valid")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
describe("revokeRole", () => {
|
||||
const setMetadataMock = jest.fn().mockReturnValue(Promise.resolve())
|
||||
const userRetrieveMock = jest.fn().mockReturnValue(
|
||||
Promise.resolve({
|
||||
_id: IdMap.getId("product_editor"),
|
||||
email: "oliver@test.dk",
|
||||
metadata: {
|
||||
roles: ["product_editor"],
|
||||
},
|
||||
})
|
||||
)
|
||||
const permissionService = new PermissionService({
|
||||
roleModel: RoleModelMock,
|
||||
userService: {
|
||||
setMetadata: setMetadataMock,
|
||||
retrieve: userRetrieveMock,
|
||||
},
|
||||
})
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
it("successfully revokes a role from user", async () => {
|
||||
await permissionService.revokeRole(
|
||||
IdMap.getId("product_editor"),
|
||||
"product_editor"
|
||||
)
|
||||
|
||||
expect(setMetadataMock).toHaveBeenCalledTimes(1)
|
||||
expect(setMetadataMock).toHaveBeenCalledWith(
|
||||
IdMap.getId("product_editor"),
|
||||
"roles",
|
||||
[]
|
||||
)
|
||||
})
|
||||
|
||||
it("succeeds idempotently if user does not have the role to delete", async () => {
|
||||
await permissionService.revokeRole(
|
||||
IdMap.getId("product_editor"),
|
||||
"content_editor"
|
||||
)
|
||||
|
||||
expect(setMetadataMock).toHaveBeenCalledTimes(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -3,7 +3,11 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.0.23](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.22...medusa-plugin-restock-notification@0.0.23) (2021-11-11)
|
||||
## [0.0.24](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.22...medusa-plugin-restock-notification@0.0.24) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-restock-notification
|
||||
|
||||
## [0.0.23](https://github.com/medusajs/medusa/compare/medusa-plugin-restock-notification@0.0.22...medusa-plugin-restock-notification@0.0.23) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-restock-notification
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-restock-notification",
|
||||
"version": "0.0.23",
|
||||
"version": "0.0.24",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -18,7 +18,7 @@
|
||||
"cross-env": "^5.2.1",
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.5.2",
|
||||
"medusa-test-utils": "^1.1.29",
|
||||
"medusa-test-utils": "^1.1.31",
|
||||
"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.26"
|
||||
"medusa-core-utils": "^1.1.28"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.34](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.33...medusa-plugin-segment@1.1.34) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-segment
|
||||
|
||||
## [1.1.33](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.32...medusa-plugin-segment@1.1.33) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-segment
|
||||
|
||||
## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-plugin-segment@1.1.31...medusa-plugin-segment@1.1.32) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-segment
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-segment",
|
||||
"version": "1.1.32",
|
||||
"version": "1.1.34",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29"
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "a69b1e85be1da3b1b5bc4c5446471252623c8808"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.32](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.31...medusa-plugin-sendgrid@1.1.32) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-sendgrid
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.30...medusa-plugin-sendgrid@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-sendgrid
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-sendgrid@1.1.29...medusa-plugin-sendgrid@1.1.30) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-sendgrid
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-sendgrid",
|
||||
"version": "1.1.30",
|
||||
"version": "1.1.32",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29"
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "aa460f63591f9625f1fe98749b34172e528bed7f"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.30...medusa-plugin-slack-notification@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-slack-notification
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.29...medusa-plugin-slack-notification@1.1.30) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-slack-notification
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-slack-notification@1.1.28...medusa-plugin-slack-notification@1.1.29) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-slack-notification
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-economic",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.31",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-slack-notification",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.31",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31",
|
||||
"moment": "^2.27.0"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "aa460f63591f9625f1fe98749b34172e528bed7f"
|
||||
}
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.31](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.30...medusa-plugin-twilio-sms@1.1.31) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-twilio-sms
|
||||
|
||||
## [1.1.30](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.29...medusa-plugin-twilio-sms@1.1.30) (2021-11-19)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-twilio-sms
|
||||
|
||||
## [1.1.29](https://github.com/medusajs/medusa/compare/medusa-plugin-twilio-sms@1.1.28...medusa-plugin-twilio-sms@1.1.29) (2021-10-18)
|
||||
|
||||
**Note:** Version bump only for package medusa-plugin-twilio-sms
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "medusa-plugin-twilio-sms",
|
||||
"version": "1.1.29",
|
||||
"version": "1.1.31",
|
||||
"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.26",
|
||||
"medusa-test-utils": "^1.1.29",
|
||||
"medusa-core-utils": "^1.1.28",
|
||||
"medusa-test-utils": "^1.1.31",
|
||||
"twilio": "^3.49.1"
|
||||
},
|
||||
"gitHead": "41a5425405aea5045a26def95c0dc00cf4a5a44d"
|
||||
"gitHead": "aa460f63591f9625f1fe98749b34172e528bed7f"
|
||||
}
|
||||
Loaded 100 of 565 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user