From 20943902f9c212cae74d8fc5306a7ce7fb8f9c10 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 1 Oct 2024 12:04:03 +0300 Subject: [PATCH] chore: update imports in tsdocs (#9379) --- .../src/common/steps/create-remote-links.ts | 2 +- .../src/common/steps/dismiss-remote-links.ts | 2 +- .../core-flows/src/common/steps/emit-event.ts | 2 +- .../src/common/steps/remove-remote-links.ts | 2 +- .../src/common/steps/use-remote-query.ts | 2 +- packages/core/framework/src/config/types.ts | 2 +- packages/core/types/src/tax/provider.ts | 4 +-- .../utils/src/auth/abstract-auth-provider.ts | 18 ++++++------ packages/core/utils/src/dml/entity-builder.ts | 28 ++++++++++--------- packages/core/utils/src/dml/entity.ts | 8 +++--- .../core/utils/src/dml/properties/base.ts | 8 +++--- packages/core/utils/src/dml/properties/id.ts | 2 +- .../core/utils/src/dml/properties/number.ts | 15 ++++++++++ .../core/utils/src/dml/properties/text.ts | 4 +-- .../utils/src/file/abstract-file-provider.ts | 4 +-- .../abstract-notification-provider.ts | 6 ++-- .../src/payment/abstract-payment-provider.ts | 26 ++++++++--------- .../src/utils/composer/create-hook.ts | 2 +- .../src/utils/composer/create-step.ts | 6 ++-- .../src/utils/composer/create-workflow.ts | 16 ++++++----- .../src/utils/composer/parallelize.ts | 14 +++++----- .../src/utils/composer/transform.ts | 25 +++++++---------- 22 files changed, 105 insertions(+), 93 deletions(-) diff --git a/packages/core/core-flows/src/common/steps/create-remote-links.ts b/packages/core/core-flows/src/common/steps/create-remote-links.ts index e60fac9022001..87eef77df2ab0 100644 --- a/packages/core/core-flows/src/common/steps/create-remote-links.ts +++ b/packages/core/core-flows/src/common/steps/create-remote-links.ts @@ -15,7 +15,7 @@ export const createLinksStepId = "create-remote-links" * } from "@medusajs/framework/workflows-sdk" * import { * createRemoteLinkStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * import { * Modules * } from "@medusajs/framework/utils" diff --git a/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts b/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts index 7b6d34f0314b3..9849789f0a928 100644 --- a/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts +++ b/packages/core/core-flows/src/common/steps/dismiss-remote-links.ts @@ -19,7 +19,7 @@ export const dismissRemoteLinkStepId = "dismiss-remote-links" * } from "@medusajs/framework/workflows-sdk" * import { * dismissRemoteLinkStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * import { * Modules * } from "@medusajs/framework/utils" diff --git a/packages/core/core-flows/src/common/steps/emit-event.ts b/packages/core/core-flows/src/common/steps/emit-event.ts index 000eeafc0724c..63448568eb2bb 100644 --- a/packages/core/core-flows/src/common/steps/emit-event.ts +++ b/packages/core/core-flows/src/common/steps/emit-event.ts @@ -46,7 +46,7 @@ export const emitEventStepId = "emit-event-step" * } from "@medusajs/framework/workflows-sdk" * import { * emitEventStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * * const helloWorldWorkflow = createWorkflow( * "hello-world", diff --git a/packages/core/core-flows/src/common/steps/remove-remote-links.ts b/packages/core/core-flows/src/common/steps/remove-remote-links.ts index 3a3cd00f64470..fc194d0a908cc 100644 --- a/packages/core/core-flows/src/common/steps/remove-remote-links.ts +++ b/packages/core/core-flows/src/common/steps/remove-remote-links.ts @@ -17,7 +17,7 @@ export const removeRemoteLinkStepId = "remove-remote-links" * } from "@medusajs/framework/workflows-sdk" * import { * removeRemoteLinkStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * import { * Modules * } from "@medusajs/framework/utils" diff --git a/packages/core/core-flows/src/common/steps/use-remote-query.ts b/packages/core/core-flows/src/common/steps/use-remote-query.ts index b6eae2e9a8ea1..734e253d6f2e0 100644 --- a/packages/core/core-flows/src/common/steps/use-remote-query.ts +++ b/packages/core/core-flows/src/common/steps/use-remote-query.ts @@ -62,7 +62,7 @@ export const useRemoteQueryStepId = "use-remote-query" * } from "@medusajs/framework/workflows-sdk" * import { * useRemoteQueryStep - * } from "@medusajs/core-flows" + * } from "@medusajs/medusa/core-flows" * * const helloWorldWorkflow = createWorkflow( * "hello-world", diff --git a/packages/core/framework/src/config/types.ts b/packages/core/framework/src/config/types.ts index 5bcec447ffc34..928b268317a27 100644 --- a/packages/core/framework/src/config/types.ts +++ b/packages/core/framework/src/config/types.ts @@ -760,7 +760,7 @@ export type ProjectConfigOptions = { * * The configurations for your Medusa application are in `medusa-config.js` located in the root of your Medusa project. The configurations include configurations for database, modules, and more. * - * `medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/utils`. + * `medusa-config.js` exports the value returned by the `defineConfig` utility function imported from `@medusajs/framework/utils`. * * `defineConfig` accepts as a parameter an object with the following properties: * diff --git a/packages/core/types/src/tax/provider.ts b/packages/core/types/src/tax/provider.ts index 302418799eede..2016ba6ac9951 100644 --- a/packages/core/types/src/tax/provider.ts +++ b/packages/core/types/src/tax/provider.ts @@ -48,7 +48,7 @@ export type ItemTaxCalculationLine = { * ## How to Create a Tax Provider * * A tax provider class is defined in a TypeScript or JavaScript file. The class must implement the - * `ITaxProvider` interface imported from `@medusajs/types`. + * `ITaxProvider` interface imported from `@medusajs/framework/types`. * * The file can be defined in a plugin, a provider module, or under the `src/services` directory of your Medusa application. You can later pass the package's name or the * path to the file in the `providers` option of the Tax Module. @@ -56,7 +56,7 @@ export type ItemTaxCalculationLine = { * For example: * * ```ts title="src/services/my-tax.ts" - * import { ITaxProvider } from "@medusajs/types" + * import { ITaxProvider } from "@medusajs/framework/types" * * export default class MyTaxProvider implements ITaxProvider { * // ... diff --git a/packages/core/utils/src/auth/abstract-auth-provider.ts b/packages/core/utils/src/auth/abstract-auth-provider.ts index 628d715c9e374..fe17774b7f425 100644 --- a/packages/core/utils/src/auth/abstract-auth-provider.ts +++ b/packages/core/utils/src/auth/abstract-auth-provider.ts @@ -23,8 +23,8 @@ import { * #### Example * * ```ts - * import { AbstractAuthModuleProvider } from "@medusajs/utils" - * import { Logger } from "@medusajs/types" + * import { AbstractAuthModuleProvider } from "@medusajs/framework/utils" + * import { Logger } from "@medusajs/framework/types" * * type InjectedDependencies = { * logger: Logger @@ -136,7 +136,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -179,7 +179,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -238,8 +238,8 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" - * import { MedusaError } from "@medusajs/utils" + * } from "@medusajs/framework/types" + * import { MedusaError } from "@medusajs/framework/utils" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -305,8 +305,8 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" - * import { MedusaError } from "@medusajs/utils" + * } from "@medusajs/framework/types" + * import { MedusaError } from "@medusajs/framework/utils" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { @@ -371,7 +371,7 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider { * AuthIdentityProviderService, * AuthenticationInput, * AuthenticationResponse - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * // ... * * class MyAuthProviderService extends AbstractAuthModuleProvider { diff --git a/packages/core/utils/src/dml/entity-builder.ts b/packages/core/utils/src/dml/entity-builder.ts index 6472055842469..1cb76c32e328b 100644 --- a/packages/core/utils/src/dml/entity-builder.ts +++ b/packages/core/utils/src/dml/entity-builder.ts @@ -100,7 +100,7 @@ export class EntityBuilder { * @param {Schema} schema - The schema of the data model's properties. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), @@ -135,7 +135,7 @@ export class EntityBuilder { * primary key. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const User = model.define("User", { * id: model.id().primaryKey(), @@ -154,7 +154,7 @@ export class EntityBuilder { * This method defines a string property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * name: model.text(), @@ -173,7 +173,7 @@ export class EntityBuilder { * This method defines a boolean property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * hasAccount: model.boolean(), @@ -192,7 +192,7 @@ export class EntityBuilder { * This method defines a number property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * age: model.number(), @@ -211,7 +211,7 @@ export class EntityBuilder { * This method defines a number property that expects large numbers, such as prices. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * price: model.bigNumber(), @@ -235,7 +235,7 @@ export class EntityBuilder { * This method defines an array of strings property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * names: model.array(), @@ -254,7 +254,7 @@ export class EntityBuilder { * This method defines a timestamp property. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * date_of_birth: model.dateTime(), @@ -273,7 +273,7 @@ export class EntityBuilder { * This method defines a property whose value is a stringified JSON object. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * metadata: model.json(), @@ -296,7 +296,7 @@ export class EntityBuilder { * @param {Values[]} values - An array of possible values. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * color: model.enum(["black", "white"]), @@ -328,7 +328,7 @@ export class EntityBuilder { * @param {RelationshipOptions} options - The relationship's options. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const User = model.define("user", { * id: model.id(), @@ -353,6 +353,8 @@ export class EntityBuilder { * @param {RelationshipOptions} options - The relationship's options. * * @example + * import { model } from "@medusajs/framework/utils" + * * const Product = model.define("product", { * id: model.id(), * store: model.belongsTo(() => Store, { @@ -380,7 +382,7 @@ export class EntityBuilder { * @param {RelationshipOptions} options - The relationship's options. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Store = model.define("store", { * id: model.id(), @@ -407,7 +409,7 @@ export class EntityBuilder { * @param {RelationshipOptions} options - The relationship's options. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Order = model.define("order", { * id: model.id(), diff --git a/packages/core/utils/src/dml/entity.ts b/packages/core/utils/src/dml/entity.ts index 233937a1bcc80..ab0f4931be9f7 100644 --- a/packages/core/utils/src/dml/entity.ts +++ b/packages/core/utils/src/dml/entity.ts @@ -117,7 +117,7 @@ export class DmlEntity< * action should be cascaded to. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Store = model.define("store", { * id: model.id(), @@ -162,7 +162,7 @@ export class DmlEntity< * An example of a simple index: * * ```ts - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), @@ -180,7 +180,7 @@ export class DmlEntity< * To add a condition on the index, use the `where` option: * * ```ts - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), @@ -201,7 +201,7 @@ export class DmlEntity< * The condition can also be a negation. For example: * * ```ts - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), diff --git a/packages/core/utils/src/dml/properties/base.ts b/packages/core/utils/src/dml/properties/base.ts index 189cd0fff26e8..e108b2d22679a 100644 --- a/packages/core/utils/src/dml/properties/base.ts +++ b/packages/core/utils/src/dml/properties/base.ts @@ -33,7 +33,7 @@ export abstract class BaseProperty implements PropertyType { * This method indicates that a property's value can be `null`. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * price: model.bigNumber().nullable(), @@ -55,7 +55,7 @@ export abstract class BaseProperty implements PropertyType { * Medusa generates the name. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * id: model.id(), @@ -81,7 +81,7 @@ export abstract class BaseProperty implements PropertyType { * Medusa generates the name. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const User = model.define("user", { * email: model.text().unique(), @@ -103,7 +103,7 @@ export abstract class BaseProperty implements PropertyType { * @param {T} value - The default value. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * color: model diff --git a/packages/core/utils/src/dml/properties/id.ts b/packages/core/utils/src/dml/properties/id.ts index c836972239e7c..a2d7bbf30d40f 100644 --- a/packages/core/utils/src/dml/properties/id.ts +++ b/packages/core/utils/src/dml/properties/id.ts @@ -33,7 +33,7 @@ export class IdProperty extends BaseProperty { * This method indicates that the property is the data model's primary key. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Product = model.define("Product", { * id: model.id().primaryKey(), diff --git a/packages/core/utils/src/dml/properties/number.ts b/packages/core/utils/src/dml/properties/number.ts index f8c8fc149084f..a541bd3783224 100644 --- a/packages/core/utils/src/dml/properties/number.ts +++ b/packages/core/utils/src/dml/properties/number.ts @@ -11,6 +11,21 @@ export class NumberProperty extends BaseProperty { options: {} } + /** + * This method indicates that the property is the data model's primary key. + * + * @example + * import { model } from "@medusajs/framework/utils" + * + * const Product = model.define("Product", { + * code: model.number().primaryKey(), + * // ... + * }) + * + * export default Product + * + * @customNamespace Property Configuration Methods + */ primaryKey() { return new PrimaryKeyModifier(this) } diff --git a/packages/core/utils/src/dml/properties/text.ts b/packages/core/utils/src/dml/properties/text.ts index f329d348e164a..a86d0695fc301 100644 --- a/packages/core/utils/src/dml/properties/text.ts +++ b/packages/core/utils/src/dml/properties/text.ts @@ -22,7 +22,7 @@ export class TextProperty extends BaseProperty { * This method indicates that the property is the data model's primary key. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const Product = model.define("Product", { * code: model.text().primaryKey(), @@ -41,7 +41,7 @@ export class TextProperty extends BaseProperty { * This method indicates that a text property is searchable. * * @example - * import { model } from "@medusajs/utils" + * import { model } from "@medusajs/framework/utils" * * const MyCustom = model.define("my_custom", { * name: model.text().searchable(), diff --git a/packages/core/utils/src/file/abstract-file-provider.ts b/packages/core/utils/src/file/abstract-file-provider.ts index 51e0d9471186e..26c3a0d62b877 100644 --- a/packages/core/utils/src/file/abstract-file-provider.ts +++ b/packages/core/utils/src/file/abstract-file-provider.ts @@ -11,8 +11,8 @@ import { FileTypes, IFileProvider } from "@medusajs/types" * #### Example * * ```ts - * import { Logger } from "@medusajs/types" - * import { AbstractFileProviderService } from "@medusajs/utils" + * import { Logger } from "@medusajs/framework/types" + * import { AbstractFileProviderService } from "@medusajs/framework/utils" * * type InjectedDependencies = { * logger: Logger diff --git a/packages/core/utils/src/notification/abstract-notification-provider.ts b/packages/core/utils/src/notification/abstract-notification-provider.ts index 50e9ada76b46b..ec0e9cc190257 100644 --- a/packages/core/utils/src/notification/abstract-notification-provider.ts +++ b/packages/core/utils/src/notification/abstract-notification-provider.ts @@ -11,8 +11,8 @@ import { INotificationProvider, NotificationTypes } from "@medusajs/types" * #### Example * * ```ts - * import { AbstractNotificationProviderService } from "@medusajs/utils" - * import { Logger } from "@medusajs/types" + * import { AbstractNotificationProviderService } from "@medusajs/framework/utils" + * import { Logger } from "@medusajs/framework/types" * * type InjectedDependencies = { * logger: Logger @@ -67,7 +67,7 @@ export class AbstractNotificationProviderService * import { * ProviderSendNotificationDTO, * ProviderSendNotificationResultsDTO - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * class MyNotificationProviderService extends AbstractNotificationProviderService { * // ... diff --git a/packages/core/utils/src/payment/abstract-payment-provider.ts b/packages/core/utils/src/payment/abstract-payment-provider.ts index 652ff1f5f45d0..9715aa04d6f7e 100644 --- a/packages/core/utils/src/payment/abstract-payment-provider.ts +++ b/packages/core/utils/src/payment/abstract-payment-provider.ts @@ -34,8 +34,8 @@ export abstract class AbstractPaymentProvider> * ```ts * import { * AbstractPaymentProvider - * } from "@medusajs/utils" - * import { Logger } from "@medusajs/types" + * } from "@medusajs/framework/utils" + * import { Logger } from "@medusajs/framework/types" * * type InjectedDependencies = { * logger: Logger @@ -138,7 +138,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * class MyPaymentProviderService extends AbstractPaymentProvider< * Options @@ -193,7 +193,7 @@ export abstract class AbstractPaymentProvider> * PaymentProviderError, * PaymentProviderSessionResponse, * PaymentSessionStatus - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -261,7 +261,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -303,7 +303,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -359,7 +359,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -401,7 +401,7 @@ export abstract class AbstractPaymentProvider> * // other imports... * import { * PaymentSessionStatus - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -450,7 +450,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -503,7 +503,7 @@ export abstract class AbstractPaymentProvider> * import { * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -547,7 +547,7 @@ export abstract class AbstractPaymentProvider> * UpdatePaymentProviderSession, * PaymentProviderError, * PaymentProviderSessionResponse, - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< @@ -610,11 +610,11 @@ export abstract class AbstractPaymentProvider> * // other imports... * import { * BigNumber - * } from "@medusajs/utils" + * } from "@medusajs/framework/utils" * import { * ProviderWebhookPayload, * WebhookActionResult - * } from "@medusajs/types" + * } from "@medusajs/framework/types" * * * class MyPaymentProviderService extends AbstractPaymentProvider< diff --git a/packages/core/workflows-sdk/src/utils/composer/create-hook.ts b/packages/core/workflows-sdk/src/utils/composer/create-hook.ts index f5fcb0b77558d..8b290944c3910 100644 --- a/packages/core/workflows-sdk/src/utils/composer/create-hook.ts +++ b/packages/core/workflows-sdk/src/utils/composer/create-hook.ts @@ -35,7 +35,7 @@ export type Hook = { * createHook, * createWorkflow, * WorkflowResponse, - * } from "@medusajs/workflows-sdk" + * } from "@medusajs/framework/workflows-sdk" * import { createProductStep } from "./steps/create-product" * * export const myWorkflow = createWorkflow( diff --git a/packages/core/workflows-sdk/src/utils/composer/create-step.ts b/packages/core/workflows-sdk/src/utils/composer/create-step.ts index 2aaf0d04da5b1..def2b1ad86a0e 100644 --- a/packages/core/workflows-sdk/src/utils/composer/create-step.ts +++ b/packages/core/workflows-sdk/src/utils/composer/create-step.ts @@ -311,10 +311,8 @@ function wrapConditionalStep( * @example * import { * createStep, - * StepResponse, - * StepExecutionContext, - * WorkflowData - * } from "@medusajs/workflows-sdk" + * StepResponse + * } from "@medusajs/framework/workflows-sdk" * * interface CreateProductInput { * title: string diff --git a/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts b/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts index 8e11efa2ac61f..970dc6046434a 100644 --- a/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts +++ b/packages/core/workflows-sdk/src/utils/composer/create-workflow.ts @@ -34,8 +34,11 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null * @returns The created workflow. You can later execute the workflow by invoking it, then using its `run` method. * * @example - * import { createWorkflow } from "@medusajs/workflows-sdk" - * import { MedusaRequest, MedusaResponse, Product } from "@medusajs/medusa" + * import { + * createWorkflow, + * WorkflowResponse + * } from "@medusajs/framework/workflows-sdk" + * import { MedusaRequest, MedusaResponse } from "@medusajs/medusa" * import { * createProductStep, * getProductStep, @@ -46,16 +49,15 @@ global[OrchestrationUtils.SymbolMedusaWorkflowComposerContext] = null * title: string * } * - * const myWorkflow = createWorkflow< - * WorkflowInput, - * Product - * >("my-workflow", (input) => { + * const myWorkflow = createWorkflow( + * "my-workflow", + * (input: WorkflowInput) => { * // Everything here will be executed and resolved later * // during the execution. Including the data access. * * const product = createProductStep(input) * const prices = createPricesStep(product) - * return getProductStep(product.id) + * return new WorkflowResponse(getProductStep(product.id)) * } * ) * diff --git a/packages/core/workflows-sdk/src/utils/composer/parallelize.ts b/packages/core/workflows-sdk/src/utils/composer/parallelize.ts index f9ab8df14947e..dc6b6dd6de7cd 100644 --- a/packages/core/workflows-sdk/src/utils/composer/parallelize.ts +++ b/packages/core/workflows-sdk/src/utils/composer/parallelize.ts @@ -11,8 +11,9 @@ import { OrchestrationUtils } from "@medusajs/utils" * @example * import { * createWorkflow, - * parallelize - * } from "@medusajs/workflows-sdk" + * parallelize, + * WorkflowResponse + * } from "@medusajs/framework/workflows-sdk" * import { * createProductStep, * getProductStep, @@ -24,10 +25,9 @@ import { OrchestrationUtils } from "@medusajs/utils" * title: string * } * - * const myWorkflow = createWorkflow< - * WorkflowInput, - * Product - * >("my-workflow", (input) => { + * const myWorkflow = createWorkflow( + * "my-workflow", + * (input: WorkflowInput) => { * const product = createProductStep(input) * * const [prices, productSalesChannel] = parallelize( @@ -36,7 +36,7 @@ import { OrchestrationUtils } from "@medusajs/utils" * ) * * const id = product.id - * return getProductStep(product.id) + * return new WorkflowResponse(getProductStep(product.id)) * } * ) */ diff --git a/packages/core/workflows-sdk/src/utils/composer/transform.ts b/packages/core/workflows-sdk/src/utils/composer/transform.ts index 0b7020e63091c..0369a4ddfbdeb 100644 --- a/packages/core/workflows-sdk/src/utils/composer/transform.ts +++ b/packages/core/workflows-sdk/src/utils/composer/transform.ts @@ -30,32 +30,27 @@ type Func = (input: T, context: StepExecutionContext) => U | Promise * @example * import { * createWorkflow, - * transform - * } from "@medusajs/workflows-sdk" + * transform, + * WorkflowResponse + * } from "@medusajs/framework/workflows-sdk" * import { step1, step2 } from "./steps" * * type WorkflowInput = { * name: string * } * - * type WorkflowOutput = { - * message: string - * } - * - * const myWorkflow = createWorkflow< - * WorkflowInput, - * WorkflowOutput - * > - * ("hello-world", (input) => { + * const myWorkflow = createWorkflow( + * "hello-world", + * (input: WorkflowInput) => { * const str1 = step1(input) * const str2 = step2(input) * - * return transform({ + * const message = transform({ * str1, * str2 - * }, (input) => ({ - * message: `${input.str1}${input.str2}` - * })) + * }, (input) => `${input.str1}${input.str2}`) + * + * return new WorkflowResponse(message) * }) */ // prettier-ignore