chore: update imports in tsdocs (#9379)

This commit is contained in:
Shahed Nasser
2024-10-01 12:04:03 +03:00
committed by GitHub
parent 4587a69f3f
commit 20943902f9
22 changed files with 105 additions and 93 deletions

View File

@@ -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"

View File

@@ -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"

View File

@@ -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",

View File

@@ -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"

View File

@@ -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",

View File

@@ -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:
*

View File

@@ -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 {
* // ...

View File

@@ -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 {

View File

@@ -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(),

View File

@@ -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(),

View File

@@ -33,7 +33,7 @@ export abstract class BaseProperty<T> implements PropertyType<T> {
* 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<T> implements PropertyType<T> {
* 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<T> implements PropertyType<T> {
* 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<T> implements PropertyType<T> {
* @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

View File

@@ -33,7 +33,7 @@ export class IdProperty extends BaseProperty<string> {
* 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(),

View File

@@ -11,6 +11,21 @@ export class NumberProperty extends BaseProperty<number> {
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<number, NumberProperty>(this)
}

View File

@@ -22,7 +22,7 @@ export class TextProperty extends BaseProperty<string> {
* 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<string> {
* 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(),

View File

@@ -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

View File

@@ -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 {
* // ...

View File

@@ -34,8 +34,8 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* ```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<TConfig = Record<string, unknown>>
* import {
* PaymentProviderError,
* PaymentProviderSessionResponse,
* } from "@medusajs/types"
* } from "@medusajs/framework/types"
*
* class MyPaymentProviderService extends AbstractPaymentProvider<
* Options
@@ -193,7 +193,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* PaymentProviderError,
* PaymentProviderSessionResponse,
* PaymentSessionStatus
* } from "@medusajs/types"
* } from "@medusajs/framework/types"
*
*
* class MyPaymentProviderService extends AbstractPaymentProvider<
@@ -261,7 +261,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* import {
* PaymentProviderError,
* PaymentProviderSessionResponse,
* } from "@medusajs/types"
* } from "@medusajs/framework/types"
*
*
* class MyPaymentProviderService extends AbstractPaymentProvider<
@@ -303,7 +303,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* import {
* PaymentProviderError,
* PaymentProviderSessionResponse,
* } from "@medusajs/types"
* } from "@medusajs/framework/types"
*
*
* class MyPaymentProviderService extends AbstractPaymentProvider<
@@ -359,7 +359,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* import {
* PaymentProviderError,
* PaymentProviderSessionResponse,
* } from "@medusajs/types"
* } from "@medusajs/framework/types"
*
*
* class MyPaymentProviderService extends AbstractPaymentProvider<
@@ -401,7 +401,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* // other imports...
* import {
* PaymentSessionStatus
* } from "@medusajs/types"
* } from "@medusajs/framework/types"
*
*
* class MyPaymentProviderService extends AbstractPaymentProvider<
@@ -450,7 +450,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* import {
* PaymentProviderError,
* PaymentProviderSessionResponse,
* } from "@medusajs/types"
* } from "@medusajs/framework/types"
*
*
* class MyPaymentProviderService extends AbstractPaymentProvider<
@@ -503,7 +503,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* import {
* PaymentProviderError,
* PaymentProviderSessionResponse,
* } from "@medusajs/types"
* } from "@medusajs/framework/types"
*
*
* class MyPaymentProviderService extends AbstractPaymentProvider<
@@ -547,7 +547,7 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* UpdatePaymentProviderSession,
* PaymentProviderError,
* PaymentProviderSessionResponse,
* } from "@medusajs/types"
* } from "@medusajs/framework/types"
*
*
* class MyPaymentProviderService extends AbstractPaymentProvider<
@@ -610,11 +610,11 @@ export abstract class AbstractPaymentProvider<TConfig = Record<string, unknown>>
* // 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<

View File

@@ -35,7 +35,7 @@ export type Hook<Name extends string, Input> = {
* createHook,
* createWorkflow,
* WorkflowResponse,
* } from "@medusajs/workflows-sdk"
* } from "@medusajs/framework/workflows-sdk"
* import { createProductStep } from "./steps/create-product"
*
* export const myWorkflow = createWorkflow(

View File

@@ -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

View File

@@ -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))
* }
* )
*

View File

@@ -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))
* }
* )
*/

View File

@@ -30,32 +30,27 @@ type Func<T, U> = (input: T, context: StepExecutionContext) => U | Promise<U>
* @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