chore: perform dependencies scan and fix all dependencies (#9296)

This commit is contained in:
Harminder Virk
2024-09-26 14:14:38 +05:30
committed by GitHub
parent fba78c0fb1
commit 48bea267dc
593 changed files with 2729 additions and 2314 deletions

View File

@@ -1,5 +1,2 @@
module.exports = {
transform: { "^.+\\.[jt]s$": ["@swc/jest"] },
testEnvironment: `node`,
moduleFileExtensions: [`js`, `jsx`, `ts`, `tsx`, `json`],
}
const defineJestConfig = require("../../../define_jest_config")
module.exports = defineJestConfig()

View File

@@ -16,10 +16,13 @@
},
"files": [
"dist",
"cli.js"
"cli.js",
"!dist/**/__tests__",
"!dist/**/__mocks__",
"!dist/**/__fixtures__"
],
"engines": {
"node": ">=16"
"node": ">=20"
},
"scripts": {
"test": "jest --passWithNoTests src",
@@ -29,17 +32,24 @@
"author": "Sebastian Rindom",
"license": "MIT",
"devDependencies": {
"@swc/core": "^1.5.29",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"@types/yargs": "^15.0.15",
"cross-env": "^5.2.1",
"jest": "^29.7.0",
"rimraf": "^5.0.1",
"typescript": "^5.3.3"
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.2"
},
"peerDependencies": {
"ts-node": "^10.9.2"
},
"peerDependenciesMeta": {
"ts-node": {
"optional": true
}
},
"dependencies": {
"@medusajs/utils": "^1.11.9",
"axios": "^0.21.4",
"@medusajs/utils": "1.11.9",
"chalk": "^4.0.0",
"configstore": "5.0.1",
"dotenv": "^16.4.5",
@@ -52,19 +62,15 @@
"is-valid-path": "^0.1.1",
"meant": "^1.0.3",
"medusa-telemetry": "^0.0.17",
"open": "^8.0.6",
"ora": "^5.4.1",
"pg": "^8.11.3",
"pg-god": "^1.0.12",
"prompts": "^2.4.2",
"resolve-cwd": "^3.0.0",
"semver": "^7.3.8",
"stack-trace": "^0.0.10",
"ulid": "^2.3.0",
"winston": "^3.8.2",
"yargs": "^15.3.1"
},
"peerDependencies": {
"ulid": "^2.3.0"
},
"gitHead": "81a7ff73d012fda722f6e9ef0bd9ba0232d37808"
}

View File

@@ -12,9 +12,10 @@ import sysPath from "path"
import prompts from "prompts"
import { Pool } from "pg"
import url from "url"
// @ts-ignore
import inquirer from "inquirer"
import { createDatabase } from "pg-god"
import { track } from "medusa-telemetry"
import inquirer from "inquirer"
import reporter from "../reporter"
import { getPackageManager, setPackageManager } from "../util/package-manager"
@@ -180,7 +181,10 @@ const clone = async (hostInfo, rootPath, v2 = false, inputBranch) => {
url = hostInfo.https({ noCommittish: true, noGitPlus: true })
}
let branch = (inputBranch || hostInfo.committish ? [`-b`, inputBranch || hostInfo.committish] : [])
let branch =
inputBranch || hostInfo.committish
? [`-b`, inputBranch || hostInfo.committish]
: []
if (v2) {
branch = [`-b`, inputBranch || "feat/v2"]
@@ -215,24 +219,6 @@ const clone = async (hostInfo, rootPath, v2 = false, inputBranch) => {
if (!isGit) await createInitialGitCommit(rootPath, url)
}
const getMedusaConfig = (rootPath) => {
try {
const configPath = sysPath.join(rootPath, "medusa-config.js")
if (existsSync(configPath)) {
const resolved = sysPath.resolve(configPath)
const configModule = require(resolved)
return configModule
}
throw Error()
} catch (err) {
console.log(err)
reporter.warn(
`Couldn't find a medusa-config.js file; please double check that you have the correct starter installed`
)
}
return {}
}
const getPaths = async (starterPath, rootPath, v2 = false) => {
let selectedOtherStarter = false
@@ -515,7 +501,9 @@ const attemptSeed = async (rootPath) => {
export const newStarter = async (args) => {
const nodeVersion = getNodeVersion()
if (nodeVersion < MIN_SUPPORTED_NODE_VERSION) {
reporter.error(`Medusa requires at least v20 of Node.js. You're using v${nodeVersion}. Please install at least v20 and try again: https://nodejs.org/en/download`)
reporter.error(
`Medusa requires at least v20 of Node.js. You're using v${nodeVersion}. Please install at least v20 and try again: https://nodejs.org/en/download`
)
process.exit(1)
}
track("CLI_NEW")
@@ -534,7 +522,7 @@ export const newStarter = async (args) => {
dbPort,
dbHost,
v2,
branch
branch,
} = args
const dbCredentials = removeUndefined({
@@ -656,7 +644,7 @@ medusa new ${rootPath} [url-to-starter]
// remove demo files
clearProject(rootPath)
// remove .git directory
fs.rmSync(path.join(rootPath, '.git'), {
fs.rmSync(path.join(rootPath, ".git"), {
recursive: true,
force: true,
})

View File

@@ -15,11 +15,6 @@ if (os.platform() === `win32`) {
// ensureWindowsDriveLetterIsUppercase()
}
// Check if update is available
// updateNotifier({ pkg }).notify({ isGlobal: true })
const MIN_NODE_VERSION = `10.13.0`
process.on(`unhandledRejection`, (reason) => {
// This will exit the process in newer Node anyway so lets be consistent
// across versions and crash

View File

@@ -3,8 +3,6 @@ import ora from "ora"
import stackTrace from "stack-trace"
import { ulid } from "ulid"
import winston from "winston"
import * as Transport from "winston-transport"
import { panicHandler } from "./panic-handler"
const LOG_LEVEL = process.env.LOG_LEVEL || "info"
@@ -12,7 +10,7 @@ const LOG_FILE = process.env.LOG_FILE || ""
const NODE_ENV = process.env.NODE_ENV || "development"
const IS_DEV = NODE_ENV.startsWith("dev")
let transports: Transport[] = []
let transports: winston.transport[] = []
if (!IS_DEV) {
transports.push(new winston.transports.Console())

View File

@@ -1,3 +1,4 @@
// @ts-ignore
import ConfigStore from "configstore"
import reporter from "../reporter"

View File

@@ -1,30 +1,3 @@
{
"compilerOptions": {
"lib": ["es2021"],
"target": "es2021",
"outDir": "./dist",
"esModuleInterop": true,
"declarationMap": 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,
"downlevelIteration": true // to use ES5 specific tooling
},
"include": ["src"],
"exclude": [
"dist",
"./src/**/__tests__",
"./src/**/__mocks__",
"./src/**/__fixtures__",
"node_modules"
]
"extends": "../../../_tsconfig.base.json"
}

View File

@@ -1,5 +0,0 @@
{
"extends": "./tsconfig.json",
"include": ["src"],
"exclude": ["node_modules"]
}

View File

@@ -25,7 +25,7 @@
"yargs": "^15.4.1"
},
"devDependencies": {
"@swc/core": "^1.5.29",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"cross-env": "^7.0.3",
"jest": "^29.7.0",

View File

@@ -1,15 +1,2 @@
module.exports = {
transform: {
"^.+\\.[jt]s$": [
"@swc/jest",
{
jsc: {
parser: { syntax: "typescript", decorators: true },
transform: { decoratorMetadata: true },
},
},
],
},
testEnvironment: `node`,
moduleFileExtensions: [`js`, `ts`],
}
const defineJestConfig = require("../../../define_jest_config")
module.exports = defineJestConfig()

View File

@@ -3,7 +3,9 @@
"version": "0.0.9",
"description": "Set of workflow definitions for Medusa",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": "./dist/index.js"
},
"repository": {
"type": "git",
"url": "https://github.com/medusajs/medusa",
@@ -13,31 +15,39 @@
"access": "public"
},
"engines": {
"node": ">=16"
"node": ">=20"
},
"files": [
"dist"
"dist",
"!dist/**/__tests__",
"!dist/**/__mocks__",
"!dist/**/__fixtures__"
],
"author": "Medusa",
"license": "MIT",
"devDependencies": {
"@medusajs/types": "^1.11.16",
"@swc/core": "^1.5.29",
"@medusajs/framework": "^0.0.1",
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"awilix": "^8.0.1",
"bignumber.js": "^9.1.2",
"cross-env": "^5.2.1",
"ioredis": "^5.4.1",
"jest": "^29.7.0",
"pg": "^8.13.0",
"rimraf": "^5.0.1",
"typescript": "^5.1.6"
"typescript": "^5.6.2"
},
"dependencies": {
"@medusajs/modules-sdk": "^1.12.11",
"@medusajs/utils": "^1.11.9",
"@medusajs/workflows-sdk": "^0.1.6",
"json-2-csv": "^5.5.4"
},
"peerDependencies": {
"awilix": "^8.0.1",
"ulid": "^2.3.0"
"@medusajs/framework": "^0.0.1",
"awilix": "^8.0.1"
},
"scripts": {
"build": "rimraf dist && tsc --build",

View File

@@ -1,6 +1,9 @@
import { CreateApiKeyDTO, IApiKeyModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
CreateApiKeyDTO,
IApiKeyModuleService,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export type CreateApiKeysStepInput = {
api_keys: CreateApiKeyDTO[]

View File

@@ -1,6 +1,6 @@
import { IApiKeyModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { IApiKeyModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const deleteApiKeysStepId = "delete-api-keys"
/**

View File

@@ -1,6 +1,10 @@
import { LinkWorkflowInput } from "@medusajs/types"
import { ContainerRegistrationKeys, Modules, promiseAll } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { LinkWorkflowInput } from "@medusajs/framework/types"
import {
ContainerRegistrationKeys,
Modules,
promiseAll,
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const linkSalesChannelsToApiKeyStepId = "link-sales-channels-to-api-key"
/**

View File

@@ -2,9 +2,9 @@ import {
FilterableApiKeyProps,
IApiKeyModuleService,
RevokeApiKeyDTO,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export type RevokeApiKeysStepInput = {
selector: FilterableApiKeyProps

View File

@@ -2,9 +2,12 @@ import {
FilterableApiKeyProps,
IApiKeyModuleService,
UpdateApiKeyDTO,
} from "@medusajs/types"
import { Modules, getSelectsAndRelationsFromObjectArray } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import {
Modules,
getSelectsAndRelationsFromObjectArray,
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export type UpdateApiKeysStepInput = {
selector: FilterableApiKeyProps

View File

@@ -1,6 +1,10 @@
import { ISalesChannelModuleService } from "@medusajs/types"
import { MedusaError, Modules, arrayDifference } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { ISalesChannelModuleService } from "@medusajs/framework/types"
import {
MedusaError,
Modules,
arrayDifference,
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface ValidateSalesChannelsExistStepInput {
sales_channel_ids: string[]

View File

@@ -1,9 +1,9 @@
import { ApiKeyDTO, CreateApiKeyDTO } from "@medusajs/types"
import { ApiKeyDTO, CreateApiKeyDTO } from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { createApiKeysStep } from "../steps"
export type CreateApiKeysWorkflowInput = { api_keys: CreateApiKeyDTO[] }
@@ -14,7 +14,9 @@ export const createApiKeysWorkflowId = "create-api-keys"
*/
export const createApiKeysWorkflow = createWorkflow(
createApiKeysWorkflowId,
(input: WorkflowData<CreateApiKeysWorkflowInput>): WorkflowResponse<ApiKeyDTO[]> => {
(
input: WorkflowData<CreateApiKeysWorkflowInput>
): WorkflowResponse<ApiKeyDTO[]> => {
return new WorkflowResponse(createApiKeysStep(input))
}
)

View File

@@ -1,7 +1,7 @@
import { createWorkflow, WorkflowData } from "@medusajs/workflows-sdk"
import { createWorkflow, WorkflowData } from "@medusajs/framework/workflows-sdk"
import { removeRemoteLinkStep } from "../../common/steps/remove-remote-links"
import { deleteApiKeysStep } from "../steps"
import { Modules } from "@medusajs/utils"
import { Modules } from "@medusajs/framework/utils"
export type DeleteApiKeysWorkflowInput = { ids: string[] }

View File

@@ -1,5 +1,5 @@
import { LinkWorkflowInput } from "@medusajs/types"
import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk"
import { LinkWorkflowInput } from "@medusajs/framework/types"
import { WorkflowData, createWorkflow } from "@medusajs/framework/workflows-sdk"
import {
linkSalesChannelsToApiKeyStep,
validateSalesChannelsExistStep,

View File

@@ -2,12 +2,12 @@ import {
ApiKeyDTO,
FilterableApiKeyProps,
RevokeApiKeyDTO,
} from "@medusajs/types"
} from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { revokeApiKeysStep } from "../steps"
export type RevokeApiKeysWorkflowInput = {
@@ -21,7 +21,9 @@ export const revokeApiKeysWorkflowId = "revoke-api-keys"
*/
export const revokeApiKeysWorkflow = createWorkflow(
revokeApiKeysWorkflowId,
(input: WorkflowData<RevokeApiKeysWorkflowInput>): WorkflowResponse<ApiKeyDTO[]> => {
(
input: WorkflowData<RevokeApiKeysWorkflowInput>
): WorkflowResponse<ApiKeyDTO[]> => {
return new WorkflowResponse(revokeApiKeysStep(input))
}
)

View File

@@ -2,12 +2,12 @@ import {
ApiKeyDTO,
FilterableApiKeyProps,
UpdateApiKeyDTO,
} from "@medusajs/types"
} from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { updateApiKeysStep } from "../steps"
export type UpdateApiKeysWorkflowInput = {
@@ -21,7 +21,9 @@ export const updateApiKeysWorkflowId = "update-api-keys"
*/
export const updateApiKeysWorkflow = createWorkflow(
updateApiKeysWorkflowId,
(input: WorkflowData<UpdateApiKeysWorkflowInput>): WorkflowResponse<ApiKeyDTO[]> => {
(
input: WorkflowData<UpdateApiKeysWorkflowInput>
): WorkflowResponse<ApiKeyDTO[]> => {
return new WorkflowResponse(updateApiKeysStep(input))
}
)

View File

@@ -1,7 +1,7 @@
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { IAuthModuleService } from "@medusajs/types"
import { isDefined, Modules } from "@medusajs/utils"
import { IAuthModuleService } from "@medusajs/framework/types"
import { isDefined, Modules } from "@medusajs/framework/utils"
export type SetAuthAppMetadataStepInput = {
authIdentityId: string

View File

@@ -2,12 +2,12 @@ import {
AuthWorkflowEvents,
generateJwtToken,
MedusaError,
} from "@medusajs/utils"
} from "@medusajs/framework/utils"
import {
createWorkflow,
transform,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { emitEventStep, useRemoteQueryStep } from "../../common"
export const generateResetPasswordTokenWorkflow = createWorkflow(

View File

@@ -1,6 +1,9 @@
import { CreateShippingMethodDTO, ICartModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
CreateShippingMethodDTO,
ICartModuleService,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface AddShippingMethodToCartStepInput {
shipping_methods: CreateShippingMethodDTO[]

View File

@@ -1,6 +1,11 @@
import { IInventoryService } from "@medusajs/types"
import { MathBN, MedusaError, Modules, promiseAll } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { IInventoryService } from "@medusajs/framework/types"
import {
MathBN,
MedusaError,
Modules,
promiseAll,
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface ConfirmVariantInventoryStepInput {
items: {

View File

@@ -1,6 +1,6 @@
import { CreateCartDTO, ICartModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { CreateCartDTO, ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const createCartsStepId = "create-carts"
/**

View File

@@ -1,9 +1,9 @@
import {
CreateLineItemAdjustmentDTO,
ICartModuleService,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface CreateLineItemAdjustmentsCartStepInput {
lineItemAdjustmentsToCreate: CreateLineItemAdjustmentDTO[]

View File

@@ -1,6 +1,9 @@
import { CreateLineItemForCartDTO, ICartModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
CreateLineItemForCartDTO,
ICartModuleService,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface CreateLineItemsCartStepInput {
id: string

View File

@@ -1,6 +1,9 @@
import { BigNumberInput, IPaymentModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
BigNumberInput,
IPaymentModuleService,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export type CreatePaymentCollectionCartStepInput = {
region_id: string

View File

@@ -1,9 +1,9 @@
import {
CreateShippingMethodAdjustmentDTO,
ICartModuleService,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface CreateShippingMethodAdjustmentsStepInput {
shippingMethodAdjustmentsToCreate: CreateShippingMethodAdjustmentDTO[]

View File

@@ -1,6 +1,9 @@
import { IRegionModuleService, IStoreModuleService } from "@medusajs/types"
import { MedusaError, Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
IRegionModuleService,
IStoreModuleService,
} from "@medusajs/framework/types"
import { MedusaError, Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const findOneOrAnyRegionStepId = "find-one-or-any-region"
/**

View File

@@ -1,6 +1,6 @@
import { CustomerDTO, ICustomerModuleService } from "@medusajs/types"
import { Modules, validateEmail } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { CustomerDTO, ICustomerModuleService } from "@medusajs/framework/types"
import { Modules, validateEmail } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface FindOrCreateCustomerStepInput {
customerId?: string | null

View File

@@ -2,9 +2,9 @@ import {
ISalesChannelModuleService,
IStoreModuleService,
SalesChannelDTO,
} from "@medusajs/types"
import { MedusaError, Modules, isDefined } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { MedusaError, Modules, isDefined } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface FindSalesChannelStepInput {
salesChannelId?: string | null

View File

@@ -1,6 +1,6 @@
import { CartDTO, IPromotionModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { CartDTO, IPromotionModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface GetActionsToComputeFromPromotionsStepInput {
cart: CartDTO

View File

@@ -8,9 +8,9 @@ import {
TaxCalculationContext,
TaxableItemDTO,
TaxableShippingDTO,
} from "@medusajs/types"
import { MedusaError, Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { MedusaError, Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface GetItemTaxLinesStepInput {
cart: CartWorkflowDTO

View File

@@ -3,9 +3,14 @@ import {
CreateLineItemForCartDTO,
ICartModuleService,
UpdateLineItemWithSelectorDTO,
} from "@medusajs/types"
import { MathBN, Modules, deepEqualObj, isPresent } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import {
MathBN,
Modules,
deepEqualObj,
isPresent,
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface GetLineItemActionsStepInput {
id: string

View File

@@ -1,6 +1,6 @@
import { IPromotionModuleService } from "@medusajs/types"
import { Modules, PromotionActions } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { IPromotionModuleService } from "@medusajs/framework/types"
import { Modules, PromotionActions } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface GetPromotionCodesToApplyStepInput {
cart: {

View File

@@ -1,6 +1,6 @@
import { IPricingModuleService } from "@medusajs/types"
import { MedusaError, Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { IPricingModuleService } from "@medusajs/framework/types"
import { MedusaError, Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface GetVariantPriceSetsStepInput {
variantIds: string[]

View File

@@ -3,9 +3,9 @@ import {
FindConfig,
IProductModuleService,
ProductVariantDTO,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface GetVariantsStepInput {
filter?: FilterableProductVariantProps

View File

@@ -6,9 +6,9 @@ import {
PromotionDTO,
RemoveItemAdjustmentAction,
RemoveShippingMethodAdjustment,
} from "@medusajs/types"
import { ComputedActions, Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { ComputedActions, Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface PrepareAdjustmentsFromPromotionActionsStepInput {
actions: ComputeActions[]

View File

@@ -2,9 +2,9 @@ import {
CartDTO,
ICartModuleService,
IFulfillmentModuleService,
} from "@medusajs/types"
import { Modules, arrayDifference } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { Modules, arrayDifference } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface RefreshCartShippingMethodsStepInput {
cart: CartDTO

View File

@@ -1,6 +1,6 @@
import { ICartModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface RemoveLineItemAdjustmentsStepInput {
lineItemAdjustmentIdsToRemove: string[]

View File

@@ -1,6 +1,6 @@
import { ICartModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface RemoveShippingMethodAdjustmentsStepInput {
shippingMethodAdjustmentIdsToRemove: string[]

View File

@@ -1,6 +1,6 @@
import { ICartModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { ICartModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface RemoveShippingMethodFromCartStepInput {
shipping_method_ids: string[]

View File

@@ -1,6 +1,6 @@
import { IInventoryService } from "@medusajs/types"
import { MathBN, Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { IInventoryService } from "@medusajs/framework/types"
import { MathBN, Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface ReserveVariantInventoryStepInput {
items: {

View File

@@ -1,6 +1,6 @@
import { CartWorkflowDTO } from "@medusajs/types"
import { ContainerRegistrationKeys, isObject } from "@medusajs/utils"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { CartWorkflowDTO } from "@medusajs/framework/types"
import { ContainerRegistrationKeys, isObject } from "@medusajs/framework/utils"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
export interface RetrieveCartWithLinksStepInput {
cart_or_cart_id: string | CartWorkflowDTO

View File

@@ -1,6 +1,10 @@
import { CartDTO, FindConfig, ICartModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
CartDTO,
FindConfig,
ICartModuleService,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface RetrieveCartStepInput {
id: string

View File

@@ -5,9 +5,9 @@ import {
ICartModuleService,
ItemTaxLineDTO,
ShippingTaxLineDTO,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface SetTaxLinesForItemsStepInput {
cart: CartWorkflowDTO

View File

@@ -1,10 +1,10 @@
import { IPromotionModuleService } from "@medusajs/types"
import { IPromotionModuleService } from "@medusajs/framework/types"
import {
ContainerRegistrationKeys,
Modules,
PromotionActions,
} from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface UpdateCartPromotionStepInput {
id: string

View File

@@ -2,9 +2,12 @@ import {
ICartModuleService,
UpdateCartDTO,
UpdateCartWorkflowInputDTO,
} from "@medusajs/types"
import { Modules, getSelectsAndRelationsFromObjectArray } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import {
Modules,
getSelectsAndRelationsFromObjectArray,
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const updateCartsStepId = "update-carts"
/**

View File

@@ -1,9 +1,12 @@
import {
ICartModuleService,
UpdateLineItemWithSelectorDTO,
} from "@medusajs/types"
import { Modules, getSelectsAndRelationsFromObjectArray } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import {
Modules,
getSelectsAndRelationsFromObjectArray,
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface UpdateLineItemsStepInput {
id: string
@@ -17,7 +20,7 @@ export const updateLineItemsStepId = "update-line-items-step"
export const updateLineItemsStep = createStep(
updateLineItemsStepId,
async (input: UpdateLineItemsStepInput, { container }) => {
const { id, items = [] } = input
const { items = [] } = input
if (!items?.length) {
return new StepResponse([], [])

View File

@@ -1,6 +1,10 @@
import { CartWorkflowDTO } from "@medusajs/types"
import { isPresent, MedusaError, PaymentSessionStatus } from "@medusajs/utils"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { CartWorkflowDTO } from "@medusajs/framework/types"
import {
isPresent,
MedusaError,
PaymentSessionStatus,
} from "@medusajs/framework/utils"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
export interface ValidateCartPaymentsStepInput {
cart: CartWorkflowDTO

View File

@@ -1,6 +1,10 @@
import { CartDTO, IFulfillmentModuleService } from "@medusajs/types"
import { MedusaError, Modules, arrayDifference } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { CartDTO, IFulfillmentModuleService } from "@medusajs/framework/types"
import {
MedusaError,
Modules,
arrayDifference,
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface ValidateCartShippingOptionsStepInput {
cart: CartDTO

View File

@@ -1,6 +1,6 @@
import { CartDTO, CartWorkflowDTO } from "@medusajs/types"
import { MedusaError, isPresent } from "@medusajs/utils"
import { createStep } from "@medusajs/workflows-sdk"
import { CartDTO, CartWorkflowDTO } from "@medusajs/framework/types"
import { MedusaError, isPresent } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
export interface ValidateCartStepInput {
cart: CartWorkflowDTO | CartDTO

View File

@@ -1,6 +1,6 @@
import { BigNumberInput } from "@medusajs/types"
import { MedusaError, isPresent } from "@medusajs/utils"
import { createStep } from "@medusajs/workflows-sdk"
import { BigNumberInput } from "@medusajs/framework/types"
import { MedusaError, isPresent } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
export interface ValidateVariantPricesStepInput {
variants: {

View File

@@ -1,8 +1,8 @@
import {
BigNumberInput,
ConfirmVariantInventoryWorkflowInputDTO,
} from "@medusajs/types"
import { MedusaError, deepFlatMap } from "@medusajs/utils"
} from "@medusajs/framework/types"
import { MedusaError, deepFlatMap } from "@medusajs/framework/utils"
interface ConfirmInventoryPreparationInput {
product_variant_inventory_items: {

View File

@@ -5,8 +5,8 @@ import {
CreateOrderLineItemTaxLineDTO,
InventoryItemDTO,
ProductVariantDTO,
} from "@medusajs/types"
import { isDefined } from "@medusajs/utils"
} from "@medusajs/framework/types"
import { isDefined } from "@medusajs/framework/utils"
interface Input {
item?: CartLineItemDTO

View File

@@ -2,7 +2,7 @@ import {
WorkflowData,
createWorkflow,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
import {
addShippingMethodToCartStep,

View File

@@ -1,14 +1,14 @@
import {
AddToCartWorkflowInputDTO,
CreateLineItemForCartDTO,
} from "@medusajs/types"
} from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
parallelize,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
import {
createLineItemsStep,

View File

@@ -2,15 +2,19 @@ import {
CartWorkflowDTO,
OrderDTO,
UsageComputedActions,
} from "@medusajs/types"
import { Modules, OrderStatus, OrderWorkflowEvents } from "@medusajs/utils"
} from "@medusajs/framework/types"
import {
Modules,
OrderStatus,
OrderWorkflowEvents,
} from "@medusajs/framework/utils"
import {
createWorkflow,
parallelize,
transform,
WorkflowData,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import {
createRemoteLinkStep,
emitEventStep,
@@ -61,28 +65,25 @@ export const completeCartWorkflow = createWorkflow(
context: { cart_id: cart.id },
})
const { variants, items, sales_channel_id } = transform(
{ cart },
(data) => {
const allItems: any[] = []
const allVariants: any[] = []
const { variants, sales_channel_id } = transform({ cart }, (data) => {
const allItems: any[] = []
const allVariants: any[] = []
data.cart?.items?.forEach((item) => {
allItems.push({
id: item.id,
variant_id: item.variant_id,
quantity: item.quantity,
})
allVariants.push(item.variant)
data.cart?.items?.forEach((item) => {
allItems.push({
id: item.id,
variant_id: item.variant_id,
quantity: item.quantity,
})
allVariants.push(item.variant)
})
return {
variants: allVariants,
items: allItems,
sales_channel_id: data.cart.sales_channel_id,
}
return {
variants: allVariants,
items: allItems,
sales_channel_id: data.cart.sales_channel_id,
}
)
})
const finalCart = useRemoteQueryStep({
entry_point: "cart",

View File

@@ -1,10 +1,10 @@
import { ConfirmVariantInventoryWorkflowInputDTO } from "@medusajs/types"
import { ConfirmVariantInventoryWorkflowInputDTO } from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { confirmInventoryStep } from "../steps"
import { prepareConfirmInventoryInput } from "../utils/prepare-confirm-inventory-input"

View File

@@ -1,5 +1,8 @@
import { AdditionalData, CreateCartWorkflowInputDTO } from "@medusajs/types"
import { MedusaError } from "@medusajs/utils"
import {
AdditionalData,
CreateCartWorkflowInputDTO,
} from "@medusajs/framework/types"
import { MedusaError } from "@medusajs/framework/utils"
import {
WorkflowData,
WorkflowResponse,
@@ -7,7 +10,7 @@ import {
createWorkflow,
parallelize,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
import {
createCartsStep,
@@ -126,9 +129,11 @@ export const createCartWorkflow = createWorkflow(
return prepareLineItemData({
variant: variant,
unitPrice: item.unit_price ||
unitPrice:
item.unit_price ||
data.priceSets[item.variant_id].calculated_amount,
isTaxInclusive: item.is_tax_inclusive ||
isTaxInclusive:
item.is_tax_inclusive ||
data.priceSets[item.variant_id].is_calculated_price_tax_inclusive,
quantity: item.quantity,
metadata: item?.metadata ?? {},

View File

@@ -1,14 +1,14 @@
import {
CartDTO,
CreatePaymentCollectionForCartWorkflowInputDTO,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import {
WorkflowData,
createStep,
createWorkflow,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { createRemoteLinkStep } from "../../common/steps/create-remote-links"
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
import { createPaymentCollectionsStep } from "../steps/create-payment-collection"

View File

@@ -1,11 +1,11 @@
import { ListShippingOptionsForCartWorkflowInputDTO } from "@medusajs/types"
import { deepFlatMap, isPresent, MedusaError } from "@medusajs/utils"
import { ListShippingOptionsForCartWorkflowInputDTO } from "@medusajs/framework/types"
import { deepFlatMap, isPresent, MedusaError } from "@medusajs/framework/utils"
import {
createWorkflow,
transform,
WorkflowData,
WorkflowResponse,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
export const listShippingOptionsForCartWorkflowId =

View File

@@ -1,11 +1,11 @@
import { MathBN, isPresent } from "@medusajs/utils"
import { MathBN, isPresent } from "@medusajs/framework/utils"
import {
WorkflowData,
createWorkflow,
parallelize,
transform,
when,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
import { updatePaymentCollectionStep } from "../../payment-collection"
import { deletePaymentSessionsWorkflow } from "../../payment-collection/workflows/delete-payment-sessions"
@@ -21,7 +21,9 @@ export const refreshPaymentCollectionForCartWorkflowId =
*/
export const refreshPaymentCollectionForCartWorkflow = createWorkflow(
refreshPaymentCollectionForCartWorkflowId,
(input: WorkflowData<RefreshPaymentCollectionForCartWorklowInput>): WorkflowData<void> => {
(
input: WorkflowData<RefreshPaymentCollectionForCartWorklowInput>
): WorkflowData<void> => {
const cart = useRemoteQueryStep({
entry_point: "cart",
fields: [

View File

@@ -1,9 +1,9 @@
import { PromotionActions } from "@medusajs/utils"
import { PromotionActions } from "@medusajs/framework/utils"
import {
WorkflowData,
createWorkflow,
parallelize,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../common"
import {
createLineItemAdjustmentsStep,

View File

@@ -1,5 +1,12 @@
import { AdditionalData, UpdateCartWorkflowInputDTO } from "@medusajs/types"
import { MedusaError, PromotionActions, isPresent } from "@medusajs/utils"
import {
AdditionalData,
UpdateCartWorkflowInputDTO,
} from "@medusajs/framework/types"
import {
MedusaError,
PromotionActions,
isPresent,
} from "@medusajs/framework/utils"
import {
WorkflowData,
WorkflowResponse,
@@ -7,7 +14,7 @@ import {
createWorkflow,
parallelize,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../common"
import {
findOneOrAnyRegionStep,

View File

@@ -1,10 +1,10 @@
import { UpdateLineItemInCartWorkflowInputDTO } from "@medusajs/types"
import { UpdateLineItemInCartWorkflowInputDTO } from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { useRemoteQueryStep } from "../../common/steps/use-remote-query"
import { updateLineItemsStepWithSelector } from "../../line-item/steps"
import { refreshCartShippingMethodsStep } from "../steps"

View File

@@ -2,12 +2,12 @@ import {
CartLineItemDTO,
CartShippingMethodDTO,
CartWorkflowDTO,
} from "@medusajs/types"
} from "@medusajs/framework/types"
import {
WorkflowData,
createWorkflow,
transform,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import {
getItemTaxLinesStep,
retrieveCartWithLinksStep,

View File

@@ -1,4 +1,4 @@
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface CreateEntitiesStepType {
moduleRegistrationName: string

View File

@@ -1,7 +1,7 @@
import { RemoteLink } from "@medusajs/modules-sdk"
import { LinkDefinition } from "@medusajs/types"
import { ContainerRegistrationKeys } from "@medusajs/utils"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { RemoteLink } from "@medusajs/framework/modules-sdk"
import { LinkDefinition } from "@medusajs/framework/types"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
export const createLinksStepId = "create-remote-links"
/**
@@ -12,13 +12,13 @@ export const createLinksStepId = "create-remote-links"
* @example
* import {
* createWorkflow
* } from "@medusajs/workflows-sdk"
* } from "@medusajs/framework/workflows-sdk"
* import {
* createRemoteLinkStep
* } from "@medusajs/core-flows"
* import {
* Modules
* } from "@medusajs/utils"
* } from "@medusajs/framework/utils"
*
* const helloWorldWorkflow = createWorkflow(
* "hello-world",

View File

@@ -1,4 +1,4 @@
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export interface DeleteEntitiesStepType {
moduleRegistrationName: string

View File

@@ -1,8 +1,8 @@
import { RemoteLink } from "@medusajs/modules-sdk"
import { LinkDefinition } from "@medusajs/types"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { RemoteLink } from "@medusajs/framework/modules-sdk"
import { LinkDefinition } from "@medusajs/framework/types"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys } from "@medusajs/utils"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
export type DismissRemoteLinksStepInput = LinkDefinition | LinkDefinition[]
@@ -16,13 +16,13 @@ export const dismissRemoteLinkStepId = "dismiss-remote-links"
* @example
* import {
* createWorkflow
* } from "@medusajs/workflows-sdk"
* } from "@medusajs/framework/workflows-sdk"
* import {
* dismissRemoteLinkStep
* } from "@medusajs/core-flows"
* import {
* Modules
* } from "@medusajs/utils"
* } from "@medusajs/framework/utils"
*
* const helloWorldWorkflow = createWorkflow(
* "hello-world",

View File

@@ -1,6 +1,12 @@
import { EventBusTypes, IEventBusModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepExecutionContext, createStep } from "@medusajs/workflows-sdk"
import {
EventBusTypes,
IEventBusModuleService,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import {
StepExecutionContext,
createStep,
} from "@medusajs/framework/workflows-sdk"
/**
* The event's details.
@@ -37,7 +43,7 @@ export const emitEventStepId = "emit-event-step"
* @example
* import {
* createWorkflow
* } from "@medusajs/workflows-sdk"
* } from "@medusajs/framework/workflows-sdk"
* import {
* emitEventStep
* } from "@medusajs/core-flows"

View File

@@ -1,5 +1,5 @@
import { Modules } from "@medusajs/utils"
import { createStep } from "@medusajs/workflows-sdk"
import { Modules } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
export const releaseEventsStepId = "release-events-step"
export const releaseEventsStep = createStep(

View File

@@ -1,27 +1,27 @@
import { DeleteEntityInput, RemoteLink } from "@medusajs/modules-sdk"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { DeleteEntityInput, RemoteLink } from "@medusajs/framework/modules-sdk"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
import { ContainerRegistrationKeys } from "@medusajs/utils"
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
type RemoveRemoteLinksStepInput = DeleteEntityInput | DeleteEntityInput[]
export const removeRemoteLinkStepId = "remove-remote-links"
/**
* This step deletes linked records of a record.
*
*
* Learn more in the [Remote Link documentation](https://docs.medusajs.com/v2/advanced-development/modules/remote-link#cascade-delete-linked-records)
*
*
* @example
* import {
* import {
* createWorkflow
* } from "@medusajs/workflows-sdk"
* } from "@medusajs/framework/workflows-sdk"
* import {
* removeRemoteLinkStep
* } from "@medusajs/core-flows"
* import {
* Modules
* } from "@medusajs/utils"
*
* } from "@medusajs/framework/utils"
*
* const helloWorldWorkflow = createWorkflow(
* "hello-world",
* () => {

View File

@@ -1,7 +1,10 @@
import { RemoteLink } from "@medusajs/modules-sdk"
import { LinkDefinition } from "@medusajs/types"
import { ContainerRegistrationKeys, MedusaError } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import { RemoteLink } from "@medusajs/framework/modules-sdk"
import { LinkDefinition } from "@medusajs/framework/types"
import {
ContainerRegistrationKeys,
MedusaError,
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const updateRemoteLinksStepId = "update-remote-links-step"
export const updateRemoteLinksStep = createStep(

View File

@@ -1,8 +1,8 @@
import {
ContainerRegistrationKeys,
remoteQueryObjectFromString,
} from "@medusajs/utils"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/utils"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
/**
* The remote query's details.
@@ -59,7 +59,7 @@ export const useRemoteQueryStepId = "use-remote-query"
* ```ts
* import {
* createWorkflow
* } from "@medusajs/workflows-sdk"
* } from "@medusajs/framework/workflows-sdk"
* import {
* useRemoteQueryStep
* } from "@medusajs/core-flows"
@@ -83,7 +83,7 @@ export const useRemoteQueryStepId = "use-remote-query"
* ```ts
* import {
* createWorkflow
* } from "@medusajs/workflows-sdk"
* } from "@medusajs/framework/workflows-sdk"
* import {
* useRemoteQueryStep
* } from "@medusajs/core-flows"
@@ -113,7 +113,7 @@ export const useRemoteQueryStepId = "use-remote-query"
* ```ts
* import {
* createWorkflow
* } from "@medusajs/workflows-sdk"
* } from "@medusajs/framework/workflows-sdk"
* import {
* useRemoteQueryStep
* } from "@medusajs/core-flows"
@@ -155,8 +155,6 @@ export const useRemoteQueryStep = createStep(
service: !isUsingEntryPoint ? data.service : undefined,
} as Parameters<typeof remoteQueryObjectFromString>[0]
const queryObject = remoteQueryObjectFromString(queryObjectConfig)
const config = {
throwIfKeyNotFound: !!data.throw_if_key_not_found,
throwIfRelationNotFound: data.throw_if_key_not_found

View File

@@ -1,10 +1,10 @@
import { BatchWorkflowInput, LinkDefinition } from "@medusajs/types"
import { BatchWorkflowInput, LinkDefinition } from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
parallelize,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { createRemoteLinkStep } from "../steps/create-remote-links"
import { dismissRemoteLinkStep } from "../steps/dismiss-remote-links"
import { updateRemoteLinksStep } from "../steps/update-remote-links"

View File

@@ -1,9 +1,9 @@
import { LinkDefinition } from "@medusajs/types"
import { LinkDefinition } from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { createRemoteLinkStep } from "../steps/create-remote-links"
export const createLinksWorkflowId = "create-link"

View File

@@ -1,9 +1,9 @@
import { LinkDefinition } from "@medusajs/types"
import { LinkDefinition } from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { dismissRemoteLinkStep } from "../steps/dismiss-remote-links"
export const dismissLinksWorkflowId = "dismiss-link"

View File

@@ -1,9 +1,9 @@
import { LinkDefinition } from "@medusajs/types"
import { LinkDefinition } from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { updateRemoteLinksStep } from "../steps/update-remote-links"
export const updateLinksWorkflowId = "update-link"

View File

@@ -1,6 +1,9 @@
import { CreateCustomerGroupDTO, ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
CreateCustomerGroupDTO,
ICustomerModuleService,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const createCustomerGroupsStepId = "create-customer-groups"
/**

View File

@@ -1,6 +1,9 @@
import { GroupCustomerPair, ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
GroupCustomerPair,
ICustomerModuleService,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const deleteCustomerGroupCustomersStepId =
"delete-customer-group-customers"

View File

@@ -1,6 +1,6 @@
import { ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
export const deleteCustomerGroupStepId = "delete-customer-groups"
/**

View File

@@ -1,6 +1,9 @@
import { ICustomerModuleService, LinkWorkflowInput } from "@medusajs/types"
import { Modules, promiseAll } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
ICustomerModuleService,
LinkWorkflowInput,
} from "@medusajs/framework/types"
import { Modules, promiseAll } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const linkCustomersToCustomerGroupStepId =
"link-customers-to-customer-group"

View File

@@ -2,13 +2,13 @@ import {
CustomerGroupUpdatableFields,
FilterableCustomerGroupProps,
ICustomerModuleService,
} from "@medusajs/types"
} from "@medusajs/framework/types"
import {
Modules,
getSelectsAndRelationsFromObjectArray,
promiseAll,
} from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export type UpdateCustomerGroupStepInput = {
selector: FilterableCustomerGroupProps

View File

@@ -1,12 +1,17 @@
import { CustomerGroupDTO, CreateCustomerGroupDTO } from "@medusajs/types"
import {
CustomerGroupDTO,
CreateCustomerGroupDTO,
} from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { createCustomerGroupsStep } from "../steps"
export type CreateCustomerGroupsWorkflowInput = { customersData: CreateCustomerGroupDTO[] }
export type CreateCustomerGroupsWorkflowInput = {
customersData: CreateCustomerGroupDTO[]
}
export const createCustomerGroupsWorkflowId = "create-customer-groups"
/**

View File

@@ -1,4 +1,4 @@
import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk"
import { WorkflowData, createWorkflow } from "@medusajs/framework/workflows-sdk"
import { deleteCustomerGroupStep } from "../steps"
export type DeleteCustomerGroupsWorkflowInput = { ids: string[] }
@@ -9,7 +9,9 @@ export const deleteCustomerGroupsWorkflowId = "delete-customer-groups"
*/
export const deleteCustomerGroupsWorkflow = createWorkflow(
deleteCustomerGroupsWorkflowId,
(input: WorkflowData<DeleteCustomerGroupsWorkflowInput>): WorkflowData<void> => {
(
input: WorkflowData<DeleteCustomerGroupsWorkflowInput>
): WorkflowData<void> => {
return deleteCustomerGroupStep(input.ids)
}
)

View File

@@ -1,5 +1,5 @@
import { LinkWorkflowInput } from "@medusajs/types"
import { WorkflowData, createWorkflow } from "@medusajs/workflows-sdk"
import { LinkWorkflowInput } from "@medusajs/framework/types"
import { WorkflowData, createWorkflow } from "@medusajs/framework/workflows-sdk"
import { linkCustomersToCustomerGroupStep } from "../steps"
export const linkCustomersToCustomerGroupWorkflowId =

View File

@@ -2,12 +2,12 @@ import {
CustomerGroupDTO,
FilterableCustomerGroupProps,
CustomerGroupUpdatableFields,
} from "@medusajs/types"
} from "@medusajs/framework/types"
import {
WorkflowData,
WorkflowResponse,
createWorkflow,
} from "@medusajs/workflows-sdk"
} from "@medusajs/framework/workflows-sdk"
import { updateCustomerGroupsStep } from "../steps"
export type UpdateCustomerGroupsWorkflowInput = {

View File

@@ -1,9 +1,9 @@
import {
CreateCustomerAddressDTO,
ICustomerModuleService,
} from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const createCustomerAddressesStepId = "create-customer-addresses"
/**

View File

@@ -1,6 +1,9 @@
import { CreateCustomerDTO, ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
import {
CreateCustomerDTO,
ICustomerModuleService,
} from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export const createCustomersStepId = "create-customers"
/**

View File

@@ -1,6 +1,6 @@
import { ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
export const deleteCustomerAddressesStepId = "delete-customer-addresses"
/**

View File

@@ -1,6 +1,6 @@
import { ICustomerModuleService } from "@medusajs/types"
import { Modules } from "@medusajs/utils"
import { createStep, StepResponse } from "@medusajs/workflows-sdk"
import { ICustomerModuleService } from "@medusajs/framework/types"
import { Modules } from "@medusajs/framework/utils"
import { createStep, StepResponse } from "@medusajs/framework/workflows-sdk"
export const deleteCustomersStepId = "delete-customers"
/**

View File

@@ -3,9 +3,9 @@ import {
FilterableCustomerAddressProps,
ICustomerModuleService,
UpdateCustomerAddressDTO,
} from "@medusajs/types"
import { Modules, isDefined } from "@medusajs/utils"
import { createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { Modules, isDefined } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
import { unsetForCreate, unsetForUpdate } from "./utils"
export type MaybeUnsetDefaultBillingAddressStepInput = {

View File

@@ -3,9 +3,9 @@ import {
FilterableCustomerAddressProps,
ICustomerModuleService,
UpdateCustomerAddressDTO,
} from "@medusajs/types"
import { Modules, isDefined } from "@medusajs/utils"
import { createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/types"
import { Modules, isDefined } from "@medusajs/framework/utils"
import { createStep } from "@medusajs/framework/workflows-sdk"
import { unsetForCreate, unsetForUpdate } from "./utils"
export type MaybeUnsetDefaultShippingAddressesStepInput = {

View File

@@ -2,13 +2,13 @@ import {
FilterableCustomerAddressProps,
ICustomerModuleService,
UpdateCustomerAddressDTO,
} from "@medusajs/types"
} from "@medusajs/framework/types"
import {
Modules,
getSelectsAndRelationsFromObjectArray,
promiseAll,
} from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export type UpdateCustomerAddresseStepInput = {
selector: FilterableCustomerAddressProps

View File

@@ -2,13 +2,13 @@ import {
CustomerUpdatableFields,
FilterableCustomerProps,
ICustomerModuleService,
} from "@medusajs/types"
} from "@medusajs/framework/types"
import {
Modules,
getSelectsAndRelationsFromObjectArray,
promiseAll,
} from "@medusajs/utils"
import { StepResponse, createStep } from "@medusajs/workflows-sdk"
} from "@medusajs/framework/utils"
import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
export type UpdateCustomersStepInput = {
selector: FilterableCustomerProps

Some files were not shown because too many files have changed in this diff Show More