chore: Fix CI pipeline (#1839)
This commit is contained in:
1 parent
cf167d00b1
commit
e539bdc620
15 files changed
+10585
-33577
No files matched your search
@@ -10,14 +10,10 @@ runs:
|
|||||||
id: cache
|
id: cache
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
node_modules
|
.yarn/cache
|
||||||
*/*/node_modules
|
|
||||||
key: ${{ runner.os }}-yarn-${{inputs.extension}}-v8-${{ hashFiles('**/yarn.lock') }}
|
key: ${{ runner.os }}-yarn-${{inputs.extension}}-v8-${{ hashFiles('**/yarn.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-yarn-${{inputs.extension}}-v8
|
${{ runner.os }}-yarn-${{inputs.extension}}-v8
|
||||||
# We want to only bootstrap and install if no cache is found.
|
# We want to only bootstrap and install if no cache is found.
|
||||||
- run: |
|
- run: yarn install --immutable
|
||||||
if [[ "${{steps.cache.outputs.cache-hit}}" != "true" ]]; then
|
|
||||||
yarn install --immutable
|
|
||||||
fi
|
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -6,7 +6,33 @@ on:
|
|||||||
- "www/**"
|
- "www/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
setup:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2.3.5
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Node.js environment
|
||||||
|
uses: actions/setup-node@v2.4.1
|
||||||
|
with:
|
||||||
|
node-version: "14"
|
||||||
|
cache: "yarn"
|
||||||
|
|
||||||
|
- name: Assert changed
|
||||||
|
run: ./scripts/assert-changed-files-actions.sh "packages"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
uses: ./.github/actions/cache-deps
|
||||||
|
with:
|
||||||
|
extension: pipeline
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
|
needs: setup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
@@ -34,7 +60,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
uses: ./.github/actions/cache-deps
|
uses: ./.github/actions/cache-deps
|
||||||
with:
|
with:
|
||||||
extension: unit-tests
|
extension: pipeline
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: yarn build
|
run: yarn build
|
||||||
@@ -43,6 +69,7 @@ jobs:
|
|||||||
run: yarn test
|
run: yarn test
|
||||||
|
|
||||||
integration-tests-api:
|
integration-tests-api:
|
||||||
|
needs: setup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
@@ -71,10 +98,6 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
node: [0, 1, 2, 3]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Cancel Previous Runs
|
- name: Cancel Previous Runs
|
||||||
uses: styfle/cancel-workflow-action@0.9.1
|
uses: styfle/cancel-workflow-action@0.9.1
|
||||||
@@ -95,7 +118,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
uses: ./.github/actions/cache-deps
|
uses: ./.github/actions/cache-deps
|
||||||
with:
|
with:
|
||||||
extension: integration-tests
|
extension: pipeline
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: yarn build
|
run: yarn build
|
||||||
@@ -119,19 +142,15 @@ jobs:
|
|||||||
run: yarn build
|
run: yarn build
|
||||||
working-directory: integration-tests/api
|
working-directory: integration-tests/api
|
||||||
|
|
||||||
- name: Split tests
|
|
||||||
id: split-tests
|
|
||||||
run: echo "::set-output name=split::$(npx jest --listTests --json | jq -cM '[_nwise(length / 4 | ceil)]')"
|
|
||||||
working-directory: integration-tests/api
|
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: echo $SPLIT | jq '.[${{ matrix.node }}] | .[] | @text' | xargs yarn test --maxWorkers=50%
|
run: yarn test --maxWorkers=50%
|
||||||
working-directory: integration-tests/api
|
working-directory: integration-tests/api
|
||||||
env:
|
env:
|
||||||
DB_PASSWORD: postgres
|
DB_PASSWORD: postgres
|
||||||
SPLIT: ${{ steps['split-tests'].outputs['split'] }}
|
SPLIT: ${{ steps['split-tests'].outputs['split'] }}
|
||||||
|
|
||||||
integration-tests-plugins:
|
integration-tests-plugins:
|
||||||
|
needs: setup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
@@ -171,7 +190,7 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
uses: ./.github/actions/cache-deps
|
uses: ./.github/actions/cache-deps
|
||||||
with:
|
with:
|
||||||
extension: integration-tests
|
extension: pipeline
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: yarn build
|
run: yarn build
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ node_modules
|
|||||||
*yarn-error.log
|
*yarn-error.log
|
||||||
.pnp.*
|
.pnp.*
|
||||||
.yarn/*
|
.yarn/*
|
||||||
!.yarn/cache
|
|
||||||
!.yarn/patches
|
!.yarn/patches
|
||||||
!.yarn/plugins
|
!.yarn/plugins
|
||||||
!.yarn/releases
|
!.yarn/releases
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ checksumBehavior: ignore
|
|||||||
|
|
||||||
compressionLevel: 0
|
compressionLevel: 0
|
||||||
|
|
||||||
enableGlobalCache: true
|
|
||||||
|
|
||||||
nmMode: hardlinks-global
|
nmMode: hardlinks-global
|
||||||
|
|
||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
|||||||
@@ -8,16 +8,16 @@
|
|||||||
"build": "babel src -d dist --extensions \".ts,.js\""
|
"build": "babel src -d dist --extensions \".ts,.js\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@medusajs/medusa": "1.3.3-dev-1657484310311",
|
"@medusajs/medusa": "1.3.4-dev-1657640917765",
|
||||||
"faker": "^5.5.3",
|
"faker": "^5.5.3",
|
||||||
"medusa-interfaces": "1.3.1-dev-1657484310311",
|
"medusa-interfaces": "1.3.1-dev-1657640917765",
|
||||||
"typeorm": "^0.2.31"
|
"typeorm": "^0.2.31"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.12.10",
|
"@babel/cli": "^7.12.10",
|
||||||
"@babel/core": "^7.12.10",
|
"@babel/core": "^7.12.10",
|
||||||
"@babel/node": "^7.12.10",
|
"@babel/node": "^7.12.10",
|
||||||
"babel-preset-medusa-package": "1.1.19-dev-1657484310311",
|
"babel-preset-medusa-package": "1.1.19-dev-1657640917765",
|
||||||
"jest": "^26.6.3"
|
"jest": "^26.6.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10483
-7798
File diff suppressed because it is too large.
Load diff
@@ -4,10 +4,6 @@
|
|||||||
"workspaces": {
|
"workspaces": {
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
|
||||||
"nohoist": [
|
|
||||||
"**/tsdx",
|
|
||||||
"**/tsdx/**"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,12 +0,0 @@
|
|||||||
let ignore = [`**/dist`]
|
|
||||||
|
|
||||||
// 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 = {
|
|
||||||
presets: [["babel-preset-medusa-package"], ["@babel/preset-typescript"]],
|
|
||||||
ignore,
|
|
||||||
}
|
|
||||||
@@ -10,15 +10,15 @@ module.exports = {
|
|||||||
// )
|
// )
|
||||||
// : [`default`].concat(useCoverage ? `jest-junit` : []),
|
// : [`default`].concat(useCoverage ? `jest-junit` : []),
|
||||||
globals: {
|
globals: {
|
||||||
'ts-jest': {
|
"ts-jest": {
|
||||||
tsConfig: 'tsconfig.spec.json',
|
tsConfig: "tsconfig.spec.json",
|
||||||
isolatedModules: false
|
isolatedModules: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
transform: {
|
transform: {
|
||||||
"^.+\\.[jt]s?$": `../../jest-transformer.js`,
|
"^.+\\.[jt]s?$": "ts-jest",
|
||||||
},
|
},
|
||||||
testEnvironment: `node`,
|
testEnvironment: `node`,
|
||||||
moduleFileExtensions: [`js`, `jsx`, `ts`, `tsx`, `json`],
|
moduleFileExtensions: [`js`, `jsx`, `ts`, `tsx`, `json`],
|
||||||
"setupFilesAfterEnv": ["<rootDir>/setupTests.js"]
|
setupFilesAfterEnv: ["<rootDir>/setupTests.js"],
|
||||||
}
|
}
|
||||||
@@ -31,11 +31,10 @@
|
|||||||
"prettier": "^1.19.1",
|
"prettier": "^1.19.1",
|
||||||
"sqlite3": "^5.0.2",
|
"sqlite3": "^5.0.2",
|
||||||
"supertest": "^4.0.2",
|
"supertest": "^4.0.2",
|
||||||
"ts-jest": "^28.0.1",
|
"ts-jest": "^25.5.1",
|
||||||
"typescript": "^4.4.4"
|
"typescript": "^4.4.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "nodemon --watch plugins/ --watch src/ --exec babel-node src/app.js",
|
|
||||||
"watch": "tsc --build --watch",
|
"watch": "tsc --build --watch",
|
||||||
"prepare": "cross-env NODE_ENV=production yarn run build",
|
"prepare": "cross-env NODE_ENV=production yarn run build",
|
||||||
"build": "tsc --build",
|
"build": "tsc --build",
|
||||||
|
|||||||
@@ -1,705 +0,0 @@
|
|||||||
import { MedusaError } from "medusa-core-utils"
|
|
||||||
import { BaseService } from "medusa-interfaces"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides layer to manipulate profiles.
|
|
||||||
* @extends BaseService
|
|
||||||
*/
|
|
||||||
class ShippingOptionService extends BaseService {
|
|
||||||
constructor({
|
|
||||||
manager,
|
|
||||||
shippingOptionRepository,
|
|
||||||
shippingOptionRequirementRepository,
|
|
||||||
shippingMethodRepository,
|
|
||||||
fulfillmentProviderService,
|
|
||||||
regionService,
|
|
||||||
}) {
|
|
||||||
super()
|
|
||||||
|
|
||||||
/** @private @const {EntityManager} */
|
|
||||||
this.manager_ = manager
|
|
||||||
|
|
||||||
/** @private @const {ShippingOptionRepository} */
|
|
||||||
this.optionRepository_ = shippingOptionRepository
|
|
||||||
|
|
||||||
/** @private @const {ShippingMethodRepository} */
|
|
||||||
this.methodRepository_ = shippingMethodRepository
|
|
||||||
|
|
||||||
/** @private @const {ShippingOptionRequirementRepository} */
|
|
||||||
this.requirementRepository_ = shippingOptionRequirementRepository
|
|
||||||
|
|
||||||
/** @private @const {ProductService} */
|
|
||||||
this.providerService_ = fulfillmentProviderService
|
|
||||||
|
|
||||||
/** @private @const {RegionService} */
|
|
||||||
this.regionService_ = regionService
|
|
||||||
}
|
|
||||||
|
|
||||||
withTransaction(transactionManager) {
|
|
||||||
if (!transactionManager) {
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
const cloned = new ShippingOptionService({
|
|
||||||
manager: transactionManager,
|
|
||||||
shippingOptionRepository: this.optionRepository_,
|
|
||||||
shippingMethodRepository: this.methodRepository_,
|
|
||||||
shippingOptionRequirementRepository: this.requirementRepository_,
|
|
||||||
fulfillmentProviderService: this.providerService_,
|
|
||||||
regionService: this.regionService_,
|
|
||||||
})
|
|
||||||
|
|
||||||
cloned.transactionManager_ = transactionManager
|
|
||||||
|
|
||||||
return cloned
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates a requirement
|
|
||||||
* @param {ShippingRequirement} requirement - the requirement to validate
|
|
||||||
* @param {string} optionId - the id to validate the requirement
|
|
||||||
* @return {ShippingRequirement} a validated shipping requirement
|
|
||||||
*/
|
|
||||||
async validateRequirement_(requirement, optionId) {
|
|
||||||
if (!requirement.type) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"A Shipping Requirement must have a type field"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
requirement.type !== "min_subtotal" &&
|
|
||||||
requirement.type !== "max_subtotal"
|
|
||||||
) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"Requirement type must be one of min_subtotal, max_subtotal"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const reqRepo = this.manager_.getCustomRepository(
|
|
||||||
this.requirementRepository_
|
|
||||||
)
|
|
||||||
|
|
||||||
const existingReq = await reqRepo.findOne({
|
|
||||||
where: { id: requirement.id },
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!existingReq && requirement.id) {
|
|
||||||
throw new MedusaError(MedusaError.Types.INVALID_DATA, "ID does not exist")
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no option id is provided, we are currently in the process of creating
|
|
||||||
// a new shipping option. Therefore, simply return the requirement, such
|
|
||||||
// that the cascading will take care of the creation of the requirement.
|
|
||||||
if (!optionId) {
|
|
||||||
return requirement
|
|
||||||
}
|
|
||||||
|
|
||||||
let req
|
|
||||||
if (existingReq) {
|
|
||||||
req = await reqRepo.save({
|
|
||||||
...existingReq,
|
|
||||||
...requirement,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
const created = reqRepo.create({
|
|
||||||
shipping_option_id: optionId,
|
|
||||||
...requirement,
|
|
||||||
})
|
|
||||||
|
|
||||||
req = await reqRepo.save(created)
|
|
||||||
}
|
|
||||||
|
|
||||||
return req
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} selector - the query object for find
|
|
||||||
* @param {object} config - config object
|
|
||||||
* @return {Promise} the result of the find operation
|
|
||||||
*/
|
|
||||||
async list(selector, config = { skip: 0, take: 50 }) {
|
|
||||||
const optRepo = this.manager_.getCustomRepository(this.optionRepository_)
|
|
||||||
|
|
||||||
const query = this.buildQuery_(selector, config)
|
|
||||||
return optRepo.find(query)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} selector - the query object for find
|
|
||||||
* @param {object} config - config object
|
|
||||||
* @return {Promise} the result of the find operation
|
|
||||||
*/
|
|
||||||
async listAndCount(selector, config = { skip: 0, take: 50 }) {
|
|
||||||
const optRepo = this.manager_.getCustomRepository(this.optionRepository_)
|
|
||||||
|
|
||||||
const query = this.buildQuery_(selector, config)
|
|
||||||
return await optRepo.findAndCount(query)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a profile by id.
|
|
||||||
* Throws in case of DB Error and if profile was not found.
|
|
||||||
* @param {string} optionId - the id of the profile to get.
|
|
||||||
* @param {object} options - the options to get a profile
|
|
||||||
* @return {Promise<Product>} the profile document.
|
|
||||||
*/
|
|
||||||
async retrieve(optionId, options = {}) {
|
|
||||||
const soRepo = this.manager_.getCustomRepository(this.optionRepository_)
|
|
||||||
const validatedId = this.validateId_(optionId)
|
|
||||||
|
|
||||||
const query = {
|
|
||||||
where: { id: validatedId },
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.select) {
|
|
||||||
query.select = options.select
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.relations) {
|
|
||||||
query.relations = options.relations
|
|
||||||
}
|
|
||||||
|
|
||||||
const option = await soRepo.findOne(query)
|
|
||||||
|
|
||||||
if (!option) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.NOT_FOUND,
|
|
||||||
`Shipping Option with ${optionId} was not found`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return option
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates a shipping method's associations. Useful when a cart is completed
|
|
||||||
* and its methods should be copied to an order/swap entity.
|
|
||||||
* @param {string} id - the id of the shipping method to update
|
|
||||||
* @param {object} update - the values to update the method with
|
|
||||||
* @return {Promise<ShippingMethod>} the resulting shipping method
|
|
||||||
*/
|
|
||||||
async updateShippingMethod(id, update) {
|
|
||||||
return this.atomicPhase_(async (manager) => {
|
|
||||||
const methodRepo = manager.getCustomRepository(this.methodRepository_)
|
|
||||||
const method = await methodRepo.findOne({ where: { id } })
|
|
||||||
|
|
||||||
if ("return_id" in update) {
|
|
||||||
method.return_id = update.return_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("swap_id" in update) {
|
|
||||||
method.swap_id = update.swap_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("order_id" in update) {
|
|
||||||
method.order_id = update.order_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("claim_order_id" in update) {
|
|
||||||
method.claim_order_id = update.claim_order_id
|
|
||||||
}
|
|
||||||
|
|
||||||
return methodRepo.save(method)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes a given shipping method
|
|
||||||
* @param {ShippingMethod | Array<ShippingMethod>} shippingMethods - the shipping method to remove
|
|
||||||
*/
|
|
||||||
async deleteShippingMethods(shippingMethods) {
|
|
||||||
if (!Array.isArray(shippingMethods)) {
|
|
||||||
shippingMethods = [shippingMethods]
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.atomicPhase_(async (manager) => {
|
|
||||||
const methodRepo = manager.getCustomRepository(this.methodRepository_)
|
|
||||||
return methodRepo.remove(shippingMethods)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a shipping method for a given cart.
|
|
||||||
* @param {string} optionId - the id of the option to use for the method.
|
|
||||||
* @param {object} data - the optional provider data to use.
|
|
||||||
* @param {object} config - the cart to create the shipping method for.
|
|
||||||
* @return {ShippingMethod} the resulting shipping method.
|
|
||||||
*/
|
|
||||||
async createShippingMethod(optionId, data, config) {
|
|
||||||
return this.atomicPhase_(async (manager) => {
|
|
||||||
const option = await this.retrieve(optionId, {
|
|
||||||
relations: ["requirements"],
|
|
||||||
})
|
|
||||||
|
|
||||||
const methodRepo = manager.getCustomRepository(this.methodRepository_)
|
|
||||||
|
|
||||||
if ("cart" in config) {
|
|
||||||
this.validateCartOption(option, config.cart || {})
|
|
||||||
}
|
|
||||||
|
|
||||||
const validatedData = await this.providerService_.validateFulfillmentData(
|
|
||||||
option,
|
|
||||||
data,
|
|
||||||
config.cart || {}
|
|
||||||
)
|
|
||||||
|
|
||||||
let methodPrice
|
|
||||||
if (typeof config.price === "number") {
|
|
||||||
methodPrice = config.price
|
|
||||||
} else {
|
|
||||||
methodPrice = await this.getPrice_(option, validatedData, config.cart)
|
|
||||||
}
|
|
||||||
|
|
||||||
const toCreate = {
|
|
||||||
shipping_option_id: option.id,
|
|
||||||
data: validatedData,
|
|
||||||
price: methodPrice,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.order) {
|
|
||||||
toCreate.order_id = config.order.id
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.cart) {
|
|
||||||
toCreate.cart_id = config.cart.id
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.cart_id) {
|
|
||||||
toCreate.cart_id = config.cart_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.return_id) {
|
|
||||||
toCreate.return_id = config.return_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.order_id) {
|
|
||||||
toCreate.order_id = config.order_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.claim_order_id) {
|
|
||||||
toCreate.claim_order_id = config.claim_order_id
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.draft_order_id) {
|
|
||||||
toCreate.draft_order_id = config.draft_order_id
|
|
||||||
}
|
|
||||||
|
|
||||||
const method = await methodRepo.create(toCreate)
|
|
||||||
|
|
||||||
const created = await methodRepo.save(method)
|
|
||||||
|
|
||||||
return methodRepo.findOne({
|
|
||||||
where: { id: created.id },
|
|
||||||
relations: ["shipping_option"],
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a given option id is a valid option for a cart. If it is the
|
|
||||||
* option is returned with the correct price. Throws when region_ids do not
|
|
||||||
* match, or when the shipping option requirements are not satisfied.
|
|
||||||
* @param {object} option - the option object to check
|
|
||||||
* @param {Cart} cart - the cart object to check against
|
|
||||||
* @return {ShippingOption} the validated shipping option
|
|
||||||
*/
|
|
||||||
validateCartOption(option, cart) {
|
|
||||||
if (option.is_return) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cart.region_id !== option.region_id) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"The shipping option is not available in the cart's region"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const subtotal = cart.subtotal
|
|
||||||
const requirementResults = option.requirements.map((requirement) => {
|
|
||||||
switch (requirement.type) {
|
|
||||||
case "max_subtotal":
|
|
||||||
return requirement.amount > subtotal
|
|
||||||
case "min_subtotal":
|
|
||||||
return requirement.amount <= subtotal
|
|
||||||
default:
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!requirementResults.every(Boolean)) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.NOT_ALLOWED,
|
|
||||||
"The Cart does not satisfy the shipping option's requirements"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return option
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new shipping option. Used both for outbound and inbound shipping
|
|
||||||
* options. The difference is registered by the `is_return` field which
|
|
||||||
* defaults to false.
|
|
||||||
* @param {ShippingOption} data - the data to create shipping options
|
|
||||||
* @return {Promise<ShippingOption>} the result of the create operation
|
|
||||||
*/
|
|
||||||
async create(data) {
|
|
||||||
return this.atomicPhase_(async (manager) => {
|
|
||||||
const optionRepo = manager.getCustomRepository(this.optionRepository_)
|
|
||||||
const option = await optionRepo.create(data)
|
|
||||||
|
|
||||||
const region = await this.regionService_
|
|
||||||
.withTransaction(manager)
|
|
||||||
.retrieve(option.region_id, {
|
|
||||||
relations: ["fulfillment_providers"],
|
|
||||||
})
|
|
||||||
|
|
||||||
if (
|
|
||||||
!region.fulfillment_providers.find(
|
|
||||||
({ id }) => id === option.provider_id
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"The fulfillment provider is not available in the provided region"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
option.price_type = await this.validatePriceType_(data.price_type, option)
|
|
||||||
option.amount = data.price_type === "calculated" ? null : data.amount
|
|
||||||
|
|
||||||
const isValid = await this.providerService_.validateOption(option)
|
|
||||||
|
|
||||||
if (!isValid) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"The fulfillment provider cannot validate the shipping option"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("requirements" in data) {
|
|
||||||
const acc = []
|
|
||||||
for (const r of data.requirements) {
|
|
||||||
const validated = await this.validateRequirement_(r)
|
|
||||||
|
|
||||||
if (acc.find((raw) => raw.type === validated.type)) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"Only one requirement of each type is allowed"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
acc.find(
|
|
||||||
(raw) =>
|
|
||||||
(raw.type === "max_subtotal" &&
|
|
||||||
validated.amount > raw.amount) ||
|
|
||||||
(raw.type === "min_subtotal" && validated.amount < raw.amount)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"Max. subtotal must be greater than Min. subtotal"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
acc.push(validated)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await optionRepo.save(option)
|
|
||||||
return result
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef ShippingOptionPrice
|
|
||||||
* @property {string} type - one of flat_rate, calculated
|
|
||||||
* @property {number} value - the value if available
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates a shipping option price
|
|
||||||
* @param {ShippingOptionPrice} priceType - the price to validate
|
|
||||||
* @param {ShippingOption} option - the option to validate against
|
|
||||||
* @return {Promise<ShippingOptionPrice>} the validated price
|
|
||||||
*/
|
|
||||||
async validatePriceType_(priceType, option) {
|
|
||||||
if (
|
|
||||||
!priceType ||
|
|
||||||
(priceType !== "flat_rate" && priceType !== "calculated")
|
|
||||||
) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"The price must be of type flat_rate or calculated"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priceType === "calculated") {
|
|
||||||
const canCalculate = await this.providerService_.canCalculate(option)
|
|
||||||
if (!canCalculate) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"The fulfillment provider cannot calculate prices for this option"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return priceType
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates a profile. Metadata updates and product updates should use
|
|
||||||
* dedicated methods, e.g. `setMetadata`, etc. The function
|
|
||||||
* will throw errors if metadata or product updates are attempted.
|
|
||||||
* @param {string} optionId - the id of the option. Must be a string that
|
|
||||||
* can be casted to an ObjectId
|
|
||||||
* @param {object} update - an object with the update values.
|
|
||||||
* @return {Promise} resolves to the update result.
|
|
||||||
*/
|
|
||||||
async update(optionId, update) {
|
|
||||||
return this.atomicPhase_(async (manager) => {
|
|
||||||
const option = await this.retrieve(optionId, {
|
|
||||||
relations: ["requirements"],
|
|
||||||
})
|
|
||||||
|
|
||||||
if ("metadata" in update) {
|
|
||||||
option.metadata = await this.setMetadata_(option, update.metadata)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (update.region_id || update.provider_id || update.data) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.NOT_ALLOWED,
|
|
||||||
"Region and Provider cannot be updated after creation"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("is_return" in update) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.NOT_ALLOWED,
|
|
||||||
"is_return cannot be changed after creation"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("requirements" in update) {
|
|
||||||
const acc = []
|
|
||||||
for (const r of update.requirements) {
|
|
||||||
const validated = await this.validateRequirement_(r, optionId)
|
|
||||||
|
|
||||||
if (acc.find((raw) => raw.type === validated.type)) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"Only one requirement of each type is allowed"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
acc.find(
|
|
||||||
(raw) =>
|
|
||||||
(raw.type === "max_subtotal" &&
|
|
||||||
validated.amount > raw.amount) ||
|
|
||||||
(raw.type === "min_subtotal" && validated.amount < raw.amount)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_DATA,
|
|
||||||
"Max. subtotal must be greater than Min. subtotal"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
acc.push(validated)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (option.requirements) {
|
|
||||||
const accReqs = acc.map((a) => a.id)
|
|
||||||
const toRemove = option.requirements.filter(
|
|
||||||
(r) => !accReqs.includes(r.id)
|
|
||||||
)
|
|
||||||
await Promise.all(
|
|
||||||
toRemove.map(async (req) => {
|
|
||||||
await this.removeRequirement(req.id)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
option.requirements = acc
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("price_type" in update) {
|
|
||||||
option.price_type = await this.validatePriceType_(
|
|
||||||
update.price_type,
|
|
||||||
option
|
|
||||||
)
|
|
||||||
if (update.price_type === "calculated") {
|
|
||||||
option.amount = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("amount" in update && option.price_type !== "calculated") {
|
|
||||||
option.amount = update.amount
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("name" in update) {
|
|
||||||
option.name = update.name
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("admin_only" in update) {
|
|
||||||
option.admin_only = update.admin_only
|
|
||||||
}
|
|
||||||
|
|
||||||
const optionRepo = manager.getCustomRepository(this.optionRepository_)
|
|
||||||
const result = await optionRepo.save(option)
|
|
||||||
return result
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes a profile with a given profile id.
|
|
||||||
* @param {string} optionId - the id of the profile to delete. Must be
|
|
||||||
* castable as an ObjectId
|
|
||||||
* @return {Promise} the result of the delete operation.
|
|
||||||
*/
|
|
||||||
async delete(optionId) {
|
|
||||||
try {
|
|
||||||
const option = await this.retrieve(optionId)
|
|
||||||
|
|
||||||
const optionRepo = this.manager_.getCustomRepository(
|
|
||||||
this.optionRepository_
|
|
||||||
)
|
|
||||||
|
|
||||||
return optionRepo.softRemove(option)
|
|
||||||
} catch (error) {
|
|
||||||
// Delete is idempotent, but we return a promise to allow then-chaining
|
|
||||||
return Promise.resolve()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @typedef ShippingRequirement
|
|
||||||
* @property {string} type - one of max_subtotal, min_subtotal
|
|
||||||
* @property {number} amount - the value to match against
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a requirement to a shipping option. Only 1 requirement of each type
|
|
||||||
* is allowed.
|
|
||||||
* @param {string} optionId - the option to add the requirement to.
|
|
||||||
* @param {ShippingRequirement} requirement - the requirement for the option.
|
|
||||||
* @return {Promise} the result of update
|
|
||||||
*/
|
|
||||||
async addRequirement(optionId, requirement) {
|
|
||||||
return this.atomicPhase_(async (manager) => {
|
|
||||||
const option = await this.retrieve(optionId, {
|
|
||||||
relations: ["requirements"],
|
|
||||||
})
|
|
||||||
const validatedReq = await this.validateRequirement_(requirement)
|
|
||||||
|
|
||||||
if (option.requirements.find((r) => r.type === validatedReq.type)) {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.DUPLICATE_ERROR,
|
|
||||||
`A requirement with type: ${validatedReq.type} already exists`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
option.requirements.push(validatedReq)
|
|
||||||
|
|
||||||
const optionRepo = manager.getCustomRepository(this.optionRepository_)
|
|
||||||
return optionRepo.save(option)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes a requirement from a shipping option
|
|
||||||
* @param {string} requirementId - the id of the requirement to remove
|
|
||||||
* @return {Promise} the result of update
|
|
||||||
*/
|
|
||||||
async removeRequirement(requirementId) {
|
|
||||||
return this.atomicPhase_(async (manager) => {
|
|
||||||
try {
|
|
||||||
const reqRepo = manager.getCustomRepository(this.requirementRepository_)
|
|
||||||
const requirement = await reqRepo.findOne({
|
|
||||||
where: { id: requirementId },
|
|
||||||
})
|
|
||||||
|
|
||||||
const result = await reqRepo.softRemove(requirement)
|
|
||||||
|
|
||||||
return result
|
|
||||||
} catch (error) {
|
|
||||||
// Delete is idempotent, but we return a promise to allow then-chaining
|
|
||||||
return Promise.resolve()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decorates a shipping option.
|
|
||||||
* @param {ShippingOption} optionId - the shipping option to decorate using optionId.
|
|
||||||
* @param {string[]} fields - the fields to include.
|
|
||||||
* @param {string[]} expandFields - fields to expand.
|
|
||||||
* @return {ShippingOption} the decorated ShippingOption.
|
|
||||||
*/
|
|
||||||
async decorate(optionId, fields = [], expandFields = []) {
|
|
||||||
const requiredFields = ["id", "metadata"]
|
|
||||||
|
|
||||||
fields = fields.concat(requiredFields)
|
|
||||||
|
|
||||||
const option = await this.retrieve(optionId, {
|
|
||||||
select: fields,
|
|
||||||
relations: expandFields,
|
|
||||||
})
|
|
||||||
|
|
||||||
return option
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dedicated method to set metadata for a shipping option.
|
|
||||||
* @param {object} option - the option to set metadata for.
|
|
||||||
* @param {object} metadata - object for metadata field
|
|
||||||
* @return {Promise} resolves to the updated result.
|
|
||||||
*/
|
|
||||||
async setMetadata_(option, metadata) {
|
|
||||||
const existing = option.metadata || {}
|
|
||||||
const newData = {}
|
|
||||||
for (const [key, value] of Object.entries(metadata)) {
|
|
||||||
if (typeof key !== "string") {
|
|
||||||
throw new MedusaError(
|
|
||||||
MedusaError.Types.INVALID_ARGUMENT,
|
|
||||||
"Key type is invalid. Metadata keys must be strings"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
newData[key] = value
|
|
||||||
}
|
|
||||||
|
|
||||||
const updated = {
|
|
||||||
...existing,
|
|
||||||
...newData,
|
|
||||||
}
|
|
||||||
|
|
||||||
return updated
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the amount to be paid for a shipping method. Will ask the
|
|
||||||
* fulfillment provider to calculate the price if the shipping option has the
|
|
||||||
* price type "calculated".
|
|
||||||
* @param {ShippingOption} option - the shipping option to retrieve the price
|
|
||||||
* for.
|
|
||||||
* @param {ShippingData} data - the shipping data to retrieve the price.
|
|
||||||
* @param {Cart | Order} cart - the context in which the price should be
|
|
||||||
* retrieved.
|
|
||||||
* @return {Promise<Number>} the price of the shipping option.
|
|
||||||
*/
|
|
||||||
async getPrice_(option, data, cart) {
|
|
||||||
if (option.price_type === "calculated") {
|
|
||||||
return this.providerService_.calculatePrice(option, data, cart)
|
|
||||||
}
|
|
||||||
return option.amount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ShippingOptionService
|
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": [
|
"lib": [
|
||||||
"es5",
|
"es5",
|
||||||
"es6"
|
"es6",
|
||||||
|
"es2019"
|
||||||
],
|
],
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
|
|||||||
@@ -3471,15 +3471,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@jest/schemas@npm:^28.0.2":
|
|
||||||
version: 28.0.2
|
|
||||||
resolution: "@jest/schemas@npm:28.0.2"
|
|
||||||
dependencies:
|
|
||||||
"@sinclair/typebox": ^0.23.3
|
|
||||||
checksum: c8f88543d50318a78b9916b4f1015658abd247d48c43fcb40c5075a0c2246b79f6466488e0f641b5ff54d7d43e22c33d4ac275d4f0b7fa6debfe24023d2c7bec
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@jest/source-map@npm:^25.5.0":
|
"@jest/source-map@npm:^25.5.0":
|
||||||
version: 25.5.0
|
version: 25.5.0
|
||||||
resolution: "@jest/source-map@npm:25.5.0"
|
resolution: "@jest/source-map@npm:25.5.0"
|
||||||
@@ -3695,20 +3686,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@jest/types@npm:^28.1.1":
|
|
||||||
version: 28.1.1
|
|
||||||
resolution: "@jest/types@npm:28.1.1"
|
|
||||||
dependencies:
|
|
||||||
"@jest/schemas": ^28.0.2
|
|
||||||
"@types/istanbul-lib-coverage": ^2.0.0
|
|
||||||
"@types/istanbul-reports": ^3.0.0
|
|
||||||
"@types/node": "*"
|
|
||||||
"@types/yargs": ^17.0.8
|
|
||||||
chalk: ^4.0.0
|
|
||||||
checksum: 00286ac7395653572234438e4c2e9ba5de6b241addcd9965e6ee6fa770ee13929c66cd543e60b1a539d376a5377ad0cfc378198e7070925bd21237da5a38d511
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@jimp/bmp@npm:^0.16.1":
|
"@jimp/bmp@npm:^0.16.1":
|
||||||
version: 0.16.1
|
version: 0.16.1
|
||||||
resolution: "@jimp/bmp@npm:0.16.1"
|
resolution: "@jimp/bmp@npm:0.16.1"
|
||||||
@@ -5289,7 +5266,7 @@ __metadata:
|
|||||||
scrypt-kdf: ^2.0.1
|
scrypt-kdf: ^2.0.1
|
||||||
sqlite3: ^5.0.2
|
sqlite3: ^5.0.2
|
||||||
supertest: ^4.0.2
|
supertest: ^4.0.2
|
||||||
ts-jest: ^28.0.1
|
ts-jest: ^25.5.1
|
||||||
typescript: ^4.4.4
|
typescript: ^4.4.4
|
||||||
ulid: ^2.3.0
|
ulid: ^2.3.0
|
||||||
uuid: ^8.3.1
|
uuid: ^8.3.1
|
||||||
@@ -6546,13 +6523,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@sinclair/typebox@npm:^0.23.3":
|
|
||||||
version: 0.23.5
|
|
||||||
resolution: "@sinclair/typebox@npm:0.23.5"
|
|
||||||
checksum: cf37f23c3095d03805eeb01f557f59d88394216ff03cd22b4d68e49d86e837ad3905b277498b5b640da4803b8559e6b752cb39309f8e3ff5f7d994b8d0cc48d5
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@sindresorhus/is@npm:^0.14.0":
|
"@sindresorhus/is@npm:^0.14.0":
|
||||||
version: 0.14.0
|
version: 0.14.0
|
||||||
resolution: "@sindresorhus/is@npm:0.14.0"
|
resolution: "@sindresorhus/is@npm:0.14.0"
|
||||||
@@ -9226,15 +9196,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@types/yargs@npm:^17.0.8":
|
|
||||||
version: 17.0.10
|
|
||||||
resolution: "@types/yargs@npm:17.0.10"
|
|
||||||
dependencies:
|
|
||||||
"@types/yargs-parser": "*"
|
|
||||||
checksum: eb46d2c0dc7b3e1ccbf5a06ac217dc761ec8b9817c1fe6a15474476f86e90abc29c693f33221c28b0f20fa5f3028f44a0b1f040fc9f91f0124b9a88a7d2462a7
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@types/yoga-layout@npm:1.9.2":
|
"@types/yoga-layout@npm:1.9.2":
|
||||||
version: 1.9.2
|
version: 1.9.2
|
||||||
resolution: "@types/yoga-layout@npm:1.9.2"
|
resolution: "@types/yoga-layout@npm:1.9.2"
|
||||||
@@ -22834,20 +22795,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"jest-util@npm:^28.0.0":
|
|
||||||
version: 28.1.1
|
|
||||||
resolution: "jest-util@npm:28.1.1"
|
|
||||||
dependencies:
|
|
||||||
"@jest/types": ^28.1.1
|
|
||||||
"@types/node": "*"
|
|
||||||
chalk: ^4.0.0
|
|
||||||
ci-info: ^3.2.0
|
|
||||||
graceful-fs: ^4.2.9
|
|
||||||
picomatch: ^2.2.3
|
|
||||||
checksum: 24f311d1b0c46f7ae9f37b020ee2932551d27882256b259768d3ce9915b43861808f1a40711344c4e567013858f11e11fc9ca19509e2c17810310e927185c705
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"jest-validate@npm:^25.5.0":
|
"jest-validate@npm:^25.5.0":
|
||||||
version: 25.5.0
|
version: 25.5.0
|
||||||
resolution: "jest-validate@npm:25.5.0"
|
resolution: "jest-validate@npm:25.5.0"
|
||||||
@@ -25790,7 +25737,7 @@ __metadata:
|
|||||||
ts-jest: ^27.1.4
|
ts-jest: ^27.1.4
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
"@medusajs/medusa": ^1.3.2
|
"@medusajs/medusa": ^1.3.4
|
||||||
react: ">=16"
|
react: ">=16"
|
||||||
react-query: ">= 3.29.0"
|
react-query: ">= 3.29.0"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
@@ -26116,6 +26063,16 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"micromatch@npm:4.x, micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5":
|
||||||
|
version: 4.0.5
|
||||||
|
resolution: "micromatch@npm:4.0.5"
|
||||||
|
dependencies:
|
||||||
|
braces: ^3.0.2
|
||||||
|
picomatch: ^2.3.1
|
||||||
|
checksum: 3d6505b20f9fa804af5d8c596cb1c5e475b9b0cd05f652c5b56141cf941bd72adaeb7a436fda344235cef93a7f29b7472efc779fcdb83b478eab0867b95cdeff
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"micromatch@npm:^3.1.10, micromatch@npm:^3.1.4":
|
"micromatch@npm:^3.1.10, micromatch@npm:^3.1.4":
|
||||||
version: 3.1.10
|
version: 3.1.10
|
||||||
resolution: "micromatch@npm:3.1.10"
|
resolution: "micromatch@npm:3.1.10"
|
||||||
@@ -26137,16 +26094,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"micromatch@npm:^4.0.2, micromatch@npm:^4.0.4, micromatch@npm:^4.0.5":
|
|
||||||
version: 4.0.5
|
|
||||||
resolution: "micromatch@npm:4.0.5"
|
|
||||||
dependencies:
|
|
||||||
braces: ^3.0.2
|
|
||||||
picomatch: ^2.3.1
|
|
||||||
checksum: 3d6505b20f9fa804af5d8c596cb1c5e475b9b0cd05f652c5b56141cf941bd72adaeb7a436fda344235cef93a7f29b7472efc779fcdb83b478eab0867b95cdeff
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"microseconds@npm:0.2.0":
|
"microseconds@npm:0.2.0":
|
||||||
version: 0.2.0
|
version: 0.2.0
|
||||||
resolution: "microseconds@npm:0.2.0"
|
resolution: "microseconds@npm:0.2.0"
|
||||||
@@ -26542,7 +26489,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.3, mkdirp@npm:^0.5.4, mkdirp@npm:^0.5.5, mkdirp@npm:~0.5.1":
|
"mkdirp@npm:0.x, mkdirp@npm:^0.5.1, mkdirp@npm:^0.5.3, mkdirp@npm:^0.5.4, mkdirp@npm:^0.5.5, mkdirp@npm:~0.5.1":
|
||||||
version: 0.5.6
|
version: 0.5.6
|
||||||
resolution: "mkdirp@npm:0.5.6"
|
resolution: "mkdirp@npm:0.5.6"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -32276,6 +32223,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"semver@npm:6.x, semver@npm:^6.0.0, semver@npm:^6.1.1, semver@npm:^6.1.2, semver@npm:^6.2.0, semver@npm:^6.3.0":
|
||||||
|
version: 6.3.0
|
||||||
|
resolution: "semver@npm:6.3.0"
|
||||||
|
bin:
|
||||||
|
semver: ./bin/semver.js
|
||||||
|
checksum: 1f4959e15bcfbaf727e964a4920f9260141bb8805b399793160da4e7de128e42a7d1f79c1b7d5cd21a6073fba0d55feb9966f5fef3e5ccb8e1d7ead3d7527458
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"semver@npm:7.0.0, semver@npm:~7.0.0":
|
"semver@npm:7.0.0, semver@npm:~7.0.0":
|
||||||
version: 7.0.0
|
version: 7.0.0
|
||||||
resolution: "semver@npm:7.0.0"
|
resolution: "semver@npm:7.0.0"
|
||||||
@@ -32318,15 +32274,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"semver@npm:^6.0.0, semver@npm:^6.1.1, semver@npm:^6.1.2, semver@npm:^6.2.0, semver@npm:^6.3.0":
|
|
||||||
version: 6.3.0
|
|
||||||
resolution: "semver@npm:6.3.0"
|
|
||||||
bin:
|
|
||||||
semver: ./bin/semver.js
|
|
||||||
checksum: 1f4959e15bcfbaf727e964a4920f9260141bb8805b399793160da4e7de128e42a7d1f79c1b7d5cd21a6073fba0d55feb9966f5fef3e5ccb8e1d7ead3d7527458
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"send@npm:0.17.1":
|
"send@npm:0.17.1":
|
||||||
version: 0.17.1
|
version: 0.17.1
|
||||||
resolution: "send@npm:0.17.1"
|
resolution: "send@npm:0.17.1"
|
||||||
@@ -34831,6 +34778,29 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"ts-jest@npm:^25.5.1":
|
||||||
|
version: 25.5.1
|
||||||
|
resolution: "ts-jest@npm:25.5.1"
|
||||||
|
dependencies:
|
||||||
|
bs-logger: 0.x
|
||||||
|
buffer-from: 1.x
|
||||||
|
fast-json-stable-stringify: 2.x
|
||||||
|
json5: 2.x
|
||||||
|
lodash.memoize: 4.x
|
||||||
|
make-error: 1.x
|
||||||
|
micromatch: 4.x
|
||||||
|
mkdirp: 0.x
|
||||||
|
semver: 6.x
|
||||||
|
yargs-parser: 18.x
|
||||||
|
peerDependencies:
|
||||||
|
jest: ">=25 <26"
|
||||||
|
typescript: ">=3.4 <4.0"
|
||||||
|
bin:
|
||||||
|
ts-jest: cli.js
|
||||||
|
checksum: 222c07b0d62ef30c960e51109ad22d5602d3775df645f3090109cb8d8a8bd381308203010d7d530158e1bdeaa996d61c456043f4ff345d2e0444893dbe700a19
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"ts-jest@npm:^26.5.6":
|
"ts-jest@npm:^26.5.6":
|
||||||
version: 26.5.6
|
version: 26.5.6
|
||||||
resolution: "ts-jest@npm:26.5.6"
|
resolution: "ts-jest@npm:26.5.6"
|
||||||
@@ -34887,36 +34857,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"ts-jest@npm:^28.0.1":
|
|
||||||
version: 28.0.5
|
|
||||||
resolution: "ts-jest@npm:28.0.5"
|
|
||||||
dependencies:
|
|
||||||
bs-logger: 0.x
|
|
||||||
fast-json-stable-stringify: 2.x
|
|
||||||
jest-util: ^28.0.0
|
|
||||||
json5: ^2.2.1
|
|
||||||
lodash.memoize: 4.x
|
|
||||||
make-error: 1.x
|
|
||||||
semver: 7.x
|
|
||||||
yargs-parser: ^21.0.1
|
|
||||||
peerDependencies:
|
|
||||||
"@babel/core": ">=7.0.0-beta.0 <8"
|
|
||||||
babel-jest: ^28.0.0
|
|
||||||
jest: ^28.0.0
|
|
||||||
typescript: ">=4.3"
|
|
||||||
peerDependenciesMeta:
|
|
||||||
"@babel/core":
|
|
||||||
optional: true
|
|
||||||
babel-jest:
|
|
||||||
optional: true
|
|
||||||
esbuild:
|
|
||||||
optional: true
|
|
||||||
bin:
|
|
||||||
ts-jest: cli.js
|
|
||||||
checksum: 614ccbbc8ca55f149bdb8bb7448d2c4344b8f741933ac7a95af35d679aef1d3caef6e84ff3859fac3f17613361a0620f1ba532eefb9d3a8b8f6ab9d325036b67
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"ts-node@npm:^10.8.1":
|
"ts-node@npm:^10.8.1":
|
||||||
version: 10.8.2
|
version: 10.8.2
|
||||||
resolution: "ts-node@npm:10.8.2"
|
resolution: "ts-node@npm:10.8.2"
|
||||||
@@ -37433,6 +37373,16 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"yargs-parser@npm:18.x, yargs-parser@npm:^18.1.2, yargs-parser@npm:^18.1.3":
|
||||||
|
version: 18.1.3
|
||||||
|
resolution: "yargs-parser@npm:18.1.3"
|
||||||
|
dependencies:
|
||||||
|
camelcase: ^5.0.0
|
||||||
|
decamelize: ^1.2.0
|
||||||
|
checksum: 25df918833592a83f52e7e4f91ba7d7bfaa2b891ebf7fe901923c2ee797534f23a176913ff6ff7ebbc1cc1725a044cc6a6539fed8bfd4e13b5b16376875f9499
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"yargs-parser@npm:20.x, yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3, yargs-parser@npm:^20.2.9":
|
"yargs-parser@npm:20.x, yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3, yargs-parser@npm:^20.2.9":
|
||||||
version: 20.2.9
|
version: 20.2.9
|
||||||
resolution: "yargs-parser@npm:20.2.9"
|
resolution: "yargs-parser@npm:20.2.9"
|
||||||
@@ -37450,17 +37400,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"yargs-parser@npm:^18.1.2, yargs-parser@npm:^18.1.3":
|
"yargs-parser@npm:^21.0.0":
|
||||||
version: 18.1.3
|
|
||||||
resolution: "yargs-parser@npm:18.1.3"
|
|
||||||
dependencies:
|
|
||||||
camelcase: ^5.0.0
|
|
||||||
decamelize: ^1.2.0
|
|
||||||
checksum: 25df918833592a83f52e7e4f91ba7d7bfaa2b891ebf7fe901923c2ee797534f23a176913ff6ff7ebbc1cc1725a044cc6a6539fed8bfd4e13b5b16376875f9499
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"yargs-parser@npm:^21.0.0, yargs-parser@npm:^21.0.1":
|
|
||||||
version: 21.0.1
|
version: 21.0.1
|
||||||
resolution: "yargs-parser@npm:21.0.1"
|
resolution: "yargs-parser@npm:21.0.1"
|
||||||
checksum: 384ca19e113a053bb7858cf47f891e630c10ea6ad91f9ad7cae84ea1cdfb09b155a2d0fa97b51116ee6f01e038faaa6c46964953afecd453fa64a761bb87475f
|
checksum: 384ca19e113a053bb7858cf47f891e630c10ea6ad91f9ad7cae84ea1cdfb09b155a2d0fa97b51116ee6f01e038faaa6c46964953afecd453fa64a761bb87475f
|
||||||
|
|||||||
Reference in new issue
Block a user