chore: fixes to TSDocs (#14186)
* chore: fixes to TSDocs * update comments for auth provider
This commit is contained in:
@@ -5,7 +5,7 @@ import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
|
|||||||
/**
|
/**
|
||||||
* This step lists order change actions filtered by action type.
|
* This step lists order change actions filtered by action type.
|
||||||
*
|
*
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*/
|
*/
|
||||||
export const listOrderChangeActionsByTypeStep = createStep(
|
export const listOrderChangeActionsByTypeStep = createStep(
|
||||||
"list-order-change-actions-by-type",
|
"list-order-change-actions-by-type",
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export const computeAdjustmentsForPreviewWorkflowId =
|
|||||||
* You can use this workflow within your customizations or your own custom workflows, allowing you to compute adjustments
|
* You can use this workflow within your customizations or your own custom workflows, allowing you to compute adjustments
|
||||||
* in your custom flows.
|
* in your custom flows.
|
||||||
*
|
*
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* const { result } = await computeAdjustmentsForPreviewWorkflow(container)
|
* const { result } = await computeAdjustmentsForPreviewWorkflow(container)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export type OnCarryPromotionsFlagSetWorkflowInput = {
|
|||||||
*
|
*
|
||||||
* :::
|
* :::
|
||||||
*
|
*
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* const data = validateCarryPromotionsFlagStep({
|
* const data = validateCarryPromotionsFlagStep({
|
||||||
@@ -150,7 +150,7 @@ export const onCarryPromotionsFlagSetId = "on-carry-promotions-flag-set"
|
|||||||
* You can use this workflow within your customizations or your own custom workflows, allowing you to
|
* You can use this workflow within your customizations or your own custom workflows, allowing you to
|
||||||
* set the carry over promotions flag for an order change in your custom flows.
|
* set the carry over promotions flag for an order change in your custom flows.
|
||||||
*
|
*
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* const { result } = await onCarryPromotionsFlagSet(container)
|
* const { result } = await onCarryPromotionsFlagSet(container)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const updateOrderChangeWorkflowId = "update-order-change-workflow"
|
|||||||
* You can use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around
|
* You can use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around
|
||||||
* updating an order change and conditionally handling promotion carry-over.
|
* updating an order change and conditionally handling promotion carry-over.
|
||||||
*
|
*
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* const { result } = await updateOrderChangeWorkflow(container)
|
* const { result } = await updateOrderChangeWorkflow(container)
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ export class Order {
|
|||||||
* [Update Order Change](https://docs.medusajs.com/api/admin#order-changes_postorder-changesid)
|
* [Update Order Change](https://docs.medusajs.com/api/admin#order-changes_postorder-changesid)
|
||||||
* API route.
|
* API route.
|
||||||
*
|
*
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*
|
*
|
||||||
* @param id - The order change's ID.
|
* @param id - The order change's ID.
|
||||||
* @param body - The update details.
|
* @param body - The update details.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ type Providers = (string | {
|
|||||||
})[]
|
})[]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since v2.11.0
|
* @since 2.11.0
|
||||||
*/
|
*/
|
||||||
export interface ICachingModuleService extends IModuleService {
|
export interface ICachingModuleService extends IModuleService {
|
||||||
// Static trace methods
|
// Static trace methods
|
||||||
@@ -47,7 +47,7 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
* To retrieve by key:
|
* To retrieve by key:
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const data = await cacheModuleService.get({
|
* const data = await cachingModuleService.get({
|
||||||
* key: "products", // this key would typically be a hash
|
* key: "products", // this key would typically be a hash
|
||||||
* }) as { id: string; title: string; }
|
* }) as { id: string; title: string; }
|
||||||
* ```
|
* ```
|
||||||
@@ -55,7 +55,7 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
* To retrieve by tags:
|
* To retrieve by tags:
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const data = await cacheModuleService.get({
|
* const data = await cachingModuleService.get({
|
||||||
* tags: ["Product:list:*"],
|
* tags: ["Product:list:*"],
|
||||||
* }) as { id: string; title: string; }[]
|
* }) as { id: string; title: string; }[]
|
||||||
* ```
|
* ```
|
||||||
@@ -63,7 +63,7 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
* To retrieve by key from specific providers:
|
* To retrieve by key from specific providers:
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const data = await cacheModuleService.get({
|
* const data = await cachingModuleService.get({
|
||||||
* key: "products", // this key would typically be a hash
|
* key: "products", // this key would typically be a hash
|
||||||
* providers: ["caching-redis", "caching-memcached"]
|
* providers: ["caching-redis", "caching-memcached"]
|
||||||
* }) as { id: string; title: string; }
|
* }) as { id: string; title: string; }
|
||||||
@@ -106,8 +106,8 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const data = { id: "prod_123", title: "Product 123" }
|
* const data = { id: "prod_123", title: "Product 123" }
|
||||||
* const key = await cacheModuleService.computeKey(data)
|
* const key = await cachingModuleService.computeKey(data)
|
||||||
* await cacheModuleService.set({
|
* await cachingModuleService.set({
|
||||||
* key,
|
* key,
|
||||||
* data
|
* data
|
||||||
* })
|
* })
|
||||||
@@ -123,8 +123,8 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const data = [{ id: "prod_123", title: "Product 123" }]
|
* const data = [{ id: "prod_123", title: "Product 123" }]
|
||||||
* const key = await cacheModuleService.computeKey(data)
|
* const key = await cachingModuleService.computeKey(data)
|
||||||
* await cacheModuleService.set({
|
* await cachingModuleService.set({
|
||||||
* key,
|
* key,
|
||||||
* data,
|
* data,
|
||||||
* tags: [`Product:${data[0].id}`, "Product:list:*"]
|
* tags: [`Product:${data[0].id}`, "Product:list:*"]
|
||||||
@@ -135,8 +135,8 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const data = [{ id: "prod_123", title: "Product 123" }]
|
* const data = [{ id: "prod_123", title: "Product 123" }]
|
||||||
* const key = await cacheModuleService.computeKey(data)
|
* const key = await cachingModuleService.computeKey(data)
|
||||||
* await cacheModuleService.set({
|
* await cachingModuleService.set({
|
||||||
* key,
|
* key,
|
||||||
* data,
|
* data,
|
||||||
* options: { autoInvalidate: false }
|
* options: { autoInvalidate: false }
|
||||||
@@ -149,8 +149,8 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* const data = { id: "prod_123", title: "Product 123" }
|
* const data = { id: "prod_123", title: "Product 123" }
|
||||||
* const key = await cacheModuleService.computeKey(data)
|
* const key = await cachingModuleService.computeKey(data)
|
||||||
* await cacheModuleService.set({
|
* await cachingModuleService.set({
|
||||||
* key,
|
* key,
|
||||||
* data,
|
* data,
|
||||||
* providers: [
|
* providers: [
|
||||||
@@ -224,7 +224,7 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
* To invalidate cache by key:
|
* To invalidate cache by key:
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* await cacheModuleService.clear({
|
* await cachingModuleService.clear({
|
||||||
* key: "products" // this key would typically be a hash
|
* key: "products" // this key would typically be a hash
|
||||||
* })
|
* })
|
||||||
* ```
|
* ```
|
||||||
@@ -234,7 +234,7 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
* To invalidate cache by tags:
|
* To invalidate cache by tags:
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* await cacheModuleService.clear({
|
* await cachingModuleService.clear({
|
||||||
* tags: ["Product:list:*"]
|
* tags: ["Product:list:*"]
|
||||||
* })
|
* })
|
||||||
* ```
|
* ```
|
||||||
@@ -244,7 +244,7 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
* To invalidate only the cache data that were set to automatically invalidate:
|
* To invalidate only the cache data that were set to automatically invalidate:
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* await cacheModuleService.clear({
|
* await cachingModuleService.clear({
|
||||||
* tags: ["Product:list:*"],
|
* tags: ["Product:list:*"],
|
||||||
* options: { autoInvalidate: true }
|
* options: { autoInvalidate: true }
|
||||||
* })
|
* })
|
||||||
@@ -263,7 +263,7 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
* To invalidate cache from specific providers:
|
* To invalidate cache from specific providers:
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
* await cacheModuleService.clear({
|
* await cachingModuleService.clear({
|
||||||
* key: "products",
|
* key: "products",
|
||||||
* providers: ["caching-redis", "caching-memcached"]
|
* providers: ["caching-redis", "caching-memcached"]
|
||||||
* })
|
* })
|
||||||
@@ -311,7 +311,7 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
* @returns The computed cache key.
|
* @returns The computed cache key.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* const key = await cacheModuleService.computeKey({
|
* const key = await cachingModuleService.computeKey({
|
||||||
* id: "prod_123",
|
* id: "prod_123",
|
||||||
* title: "Product 123"
|
* title: "Product 123"
|
||||||
* })
|
* })
|
||||||
@@ -327,7 +327,7 @@ export interface ICachingModuleService extends IModuleService {
|
|||||||
* @returns An array of computed cache tags.
|
* @returns An array of computed cache tags.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* const tags = await cacheModuleService.computeTags({
|
* const tags = await cachingModuleService.computeTags({
|
||||||
* products: [{ id: "prod_123" }, { id: "prod_456" }],
|
* products: [{ id: "prod_123" }, { id: "prod_456" }],
|
||||||
* }, {
|
* }, {
|
||||||
* operation: "updated"
|
* operation: "updated"
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider {
|
|||||||
* // authentication is successful, retrieve the identity
|
* // authentication is successful, retrieve the identity
|
||||||
* const authIdentity = await authIdentityProviderService.retrieve({
|
* const authIdentity = await authIdentityProviderService.retrieve({
|
||||||
* entity_id: data.body.email, // email or some ID
|
* entity_id: data.body.email, // email or some ID
|
||||||
* provider: this.provider
|
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
* return {
|
* return {
|
||||||
@@ -215,6 +214,16 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider {
|
|||||||
* error: "Incorrect credentials"
|
* error: "Incorrect credentials"
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
|
*
|
||||||
|
* // optional, useful for third-party providers that require a redirect URL
|
||||||
|
* // to continue the authentication flow
|
||||||
|
* // const stateKey = crypto.randomBytes(32).toString("hex")
|
||||||
|
* // const state = {
|
||||||
|
* // callback_url: body?.callback_url ?? this.config_.callbackUrl,
|
||||||
|
* // }
|
||||||
|
*
|
||||||
|
* // verify this later in the `validateCallback` method
|
||||||
|
* // await authIdentityService.setState(stateKey, state)
|
||||||
*
|
*
|
||||||
* return {
|
* return {
|
||||||
* success: true,
|
* success: true,
|
||||||
@@ -396,6 +405,16 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider {
|
|||||||
* authIdentityProviderService: AuthIdentityProviderService
|
* authIdentityProviderService: AuthIdentityProviderService
|
||||||
* ): Promise<AuthenticationResponse> {
|
* ): Promise<AuthenticationResponse> {
|
||||||
* const isAuthenticated = false
|
* const isAuthenticated = false
|
||||||
|
*
|
||||||
|
* // optional, useful for third-party providers that require a redirect URL
|
||||||
|
* // to continue the authentication flow
|
||||||
|
* // const stateKey = data.query?.state as string
|
||||||
|
* // const state = await authIdentityService.getState(stateKey)
|
||||||
|
* // if (!state) {
|
||||||
|
* // return { success: false, error: "No state provided, or session expired" }
|
||||||
|
* // }
|
||||||
|
* // // use callback URL with the third-party service
|
||||||
|
* // const callbackUrl = state.callback_url
|
||||||
* // TODO perform custom logic to authenticate the user
|
* // TODO perform custom logic to authenticate the user
|
||||||
* // ...
|
* // ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*/
|
*/
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<
|
req: AuthenticatedMedusaRequest<
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const _OrderChange = model
|
|||||||
canceled_by: model.text().nullable(),
|
canceled_by: model.text().nullable(),
|
||||||
canceled_at: model.dateTime().nullable(),
|
canceled_at: model.dateTime().nullable(),
|
||||||
/**
|
/**
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*/
|
*/
|
||||||
carry_over_promotions: model.boolean().nullable(),
|
carry_over_promotions: model.boolean().nullable(),
|
||||||
order: model.belongsTo<() => typeof Order>(() => Order, {
|
order: model.belongsTo<() => typeof Order>(() => Order, {
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ const Promotion = model
|
|||||||
is_automatic: model.boolean().default(false),
|
is_automatic: model.boolean().default(false),
|
||||||
is_tax_inclusive: model.boolean().default(false),
|
is_tax_inclusive: model.boolean().default(false),
|
||||||
/**
|
/**
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*/
|
*/
|
||||||
limit: model.number().nullable(),
|
limit: model.number().nullable(),
|
||||||
/**
|
/**
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*/
|
*/
|
||||||
used: model.number().default(0),
|
used: model.number().default(0),
|
||||||
type: model.enum(PromotionUtils.PromotionType).index("IDX_promotion_type"),
|
type: model.enum(PromotionUtils.PromotionType).index("IDX_promotion_type"),
|
||||||
@@ -37,7 +37,7 @@ const Promotion = model
|
|||||||
mappedBy: "promotions",
|
mappedBy: "promotions",
|
||||||
}),
|
}),
|
||||||
/**
|
/**
|
||||||
* @since v2.12.0
|
* @since 2.12.0
|
||||||
*/
|
*/
|
||||||
metadata: model.json().nullable(),
|
metadata: model.json().nullable(),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user