Skip to content

Commit 92769b2

Browse files
authored
chore: fixes to TSDocs (medusajs#14186)
* chore: fixes to TSDocs * update comments for auth provider
1 parent 9372a17 commit 92769b2

File tree

10 files changed

+49
-30
lines changed

10 files changed

+49
-30
lines changed

packages/core/core-flows/src/order/steps/list-order-change-actions-by-type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { StepResponse, createStep } from "@medusajs/framework/workflows-sdk"
55
/**
66
* This step lists order change actions filtered by action type.
77
*
8-
* @since v2.12.0
8+
* @since 2.12.0
99
*/
1010
export const listOrderChangeActionsByTypeStep = createStep(
1111
"list-order-change-actions-by-type",

packages/core/core-flows/src/order/workflows/compute-adjustments-for-preview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const computeAdjustmentsForPreviewWorkflowId =
5353
* You can use this workflow within your customizations or your own custom workflows, allowing you to compute adjustments
5454
* in your custom flows.
5555
*
56-
* @since v2.12.0
56+
* @since 2.12.0
5757
*
5858
* @example
5959
* const { result } = await computeAdjustmentsForPreviewWorkflow(container)

packages/core/core-flows/src/order/workflows/on-carry-promotions-flag-set.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type OnCarryPromotionsFlagSetWorkflowInput = {
4444
*
4545
* :::
4646
*
47-
* @since v2.12.0
47+
* @since 2.12.0
4848
*
4949
* @example
5050
* const data = validateCarryPromotionsFlagStep({
@@ -150,7 +150,7 @@ export const onCarryPromotionsFlagSetId = "on-carry-promotions-flag-set"
150150
* You can use this workflow within your customizations or your own custom workflows, allowing you to
151151
* set the carry over promotions flag for an order change in your custom flows.
152152
*
153-
* @since v2.12.0
153+
* @since 2.12.0
154154
*
155155
* @example
156156
* const { result } = await onCarryPromotionsFlagSet(container)

packages/core/core-flows/src/order/workflows/update-order-change.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const updateOrderChangeWorkflowId = "update-order-change-workflow"
1919
* You can use this workflow within your customizations or your own custom workflows, allowing you to wrap custom logic around
2020
* updating an order change and conditionally handling promotion carry-over.
2121
*
22-
* @since v2.12.0
22+
* @since 2.12.0
2323
*
2424
* @example
2525
* const { result } = await updateOrderChangeWorkflow(container)

packages/core/js-sdk/src/admin/order.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ export class Order {
639639
* [Update Order Change](https://docs.medusajs.com/api/admin#order-changes_postorder-changesid)
640640
* API route.
641641
*
642-
* @since v2.12.0
642+
* @since 2.12.0
643643
*
644644
* @param id - The order change's ID.
645645
* @param body - The update details.

packages/core/types/src/caching/index.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Providers = (string | {
1313
})[]
1414

1515
/**
16-
* @since v2.11.0
16+
* @since 2.11.0
1717
*/
1818
export interface ICachingModuleService extends IModuleService {
1919
// Static trace methods
@@ -47,23 +47,23 @@ export interface ICachingModuleService extends IModuleService {
4747
* To retrieve by key:
4848
*
4949
* ```ts
50-
* const data = await cacheModuleService.get({
50+
* const data = await cachingModuleService.get({
5151
* key: "products", // this key would typically be a hash
5252
* }) as { id: string; title: string; }
5353
* ```
5454
*
5555
* To retrieve by tags:
5656
*
5757
* ```ts
58-
* const data = await cacheModuleService.get({
58+
* const data = await cachingModuleService.get({
5959
* tags: ["Product:list:*"],
6060
* }) as { id: string; title: string; }[]
6161
* ```
6262
*
6363
* To retrieve by key from specific providers:
6464
*
6565
* ```ts
66-
* const data = await cacheModuleService.get({
66+
* const data = await cachingModuleService.get({
6767
* key: "products", // this key would typically be a hash
6868
* providers: ["caching-redis", "caching-memcached"]
6969
* }) as { id: string; title: string; }
@@ -106,8 +106,8 @@ export interface ICachingModuleService extends IModuleService {
106106
*
107107
* ```ts
108108
* const data = { id: "prod_123", title: "Product 123" }
109-
* const key = await cacheModuleService.computeKey(data)
110-
* await cacheModuleService.set({
109+
* const key = await cachingModuleService.computeKey(data)
110+
* await cachingModuleService.set({
111111
* key,
112112
* data
113113
* })
@@ -123,8 +123,8 @@ export interface ICachingModuleService extends IModuleService {
123123
*
124124
* ```ts
125125
* const data = [{ id: "prod_123", title: "Product 123" }]
126-
* const key = await cacheModuleService.computeKey(data)
127-
* await cacheModuleService.set({
126+
* const key = await cachingModuleService.computeKey(data)
127+
* await cachingModuleService.set({
128128
* key,
129129
* data,
130130
* tags: [`Product:${data[0].id}`, "Product:list:*"]
@@ -135,8 +135,8 @@ export interface ICachingModuleService extends IModuleService {
135135
*
136136
* ```ts
137137
* const data = [{ id: "prod_123", title: "Product 123" }]
138-
* const key = await cacheModuleService.computeKey(data)
139-
* await cacheModuleService.set({
138+
* const key = await cachingModuleService.computeKey(data)
139+
* await cachingModuleService.set({
140140
* key,
141141
* data,
142142
* options: { autoInvalidate: false }
@@ -149,8 +149,8 @@ export interface ICachingModuleService extends IModuleService {
149149
*
150150
* ```ts
151151
* const data = { id: "prod_123", title: "Product 123" }
152-
* const key = await cacheModuleService.computeKey(data)
153-
* await cacheModuleService.set({
152+
* const key = await cachingModuleService.computeKey(data)
153+
* await cachingModuleService.set({
154154
* key,
155155
* data,
156156
* providers: [
@@ -224,7 +224,7 @@ export interface ICachingModuleService extends IModuleService {
224224
* To invalidate cache by key:
225225
*
226226
* ```ts
227-
* await cacheModuleService.clear({
227+
* await cachingModuleService.clear({
228228
* key: "products" // this key would typically be a hash
229229
* })
230230
* ```
@@ -234,7 +234,7 @@ export interface ICachingModuleService extends IModuleService {
234234
* To invalidate cache by tags:
235235
*
236236
* ```ts
237-
* await cacheModuleService.clear({
237+
* await cachingModuleService.clear({
238238
* tags: ["Product:list:*"]
239239
* })
240240
* ```
@@ -244,7 +244,7 @@ export interface ICachingModuleService extends IModuleService {
244244
* To invalidate only the cache data that were set to automatically invalidate:
245245
*
246246
* ```ts
247-
* await cacheModuleService.clear({
247+
* await cachingModuleService.clear({
248248
* tags: ["Product:list:*"],
249249
* options: { autoInvalidate: true }
250250
* })
@@ -263,7 +263,7 @@ export interface ICachingModuleService extends IModuleService {
263263
* To invalidate cache from specific providers:
264264
*
265265
* ```ts
266-
* await cacheModuleService.clear({
266+
* await cachingModuleService.clear({
267267
* key: "products",
268268
* providers: ["caching-redis", "caching-memcached"]
269269
* })
@@ -311,7 +311,7 @@ export interface ICachingModuleService extends IModuleService {
311311
* @returns The computed cache key.
312312
*
313313
* @example
314-
* const key = await cacheModuleService.computeKey({
314+
* const key = await cachingModuleService.computeKey({
315315
* id: "prod_123",
316316
* title: "Product 123"
317317
* })
@@ -327,7 +327,7 @@ export interface ICachingModuleService extends IModuleService {
327327
* @returns An array of computed cache tags.
328328
*
329329
* @example
330-
* const tags = await cacheModuleService.computeTags({
330+
* const tags = await cachingModuleService.computeTags({
331331
* products: [{ id: "prod_123" }, { id: "prod_456" }],
332332
* }, {
333333
* operation: "updated"

packages/core/utils/src/auth/abstract-auth-provider.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider {
176176
* // authentication is successful, retrieve the identity
177177
* const authIdentity = await authIdentityProviderService.retrieve({
178178
* entity_id: data.body.email, // email or some ID
179-
* provider: this.provider
180179
* })
181180
*
182181
* return {
@@ -215,6 +214,16 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider {
215214
* error: "Incorrect credentials"
216215
* }
217216
* }
217+
*
218+
* // optional, useful for third-party providers that require a redirect URL
219+
* // to continue the authentication flow
220+
* // const stateKey = crypto.randomBytes(32).toString("hex")
221+
* // const state = {
222+
* // callback_url: body?.callback_url ?? this.config_.callbackUrl,
223+
* // }
224+
*
225+
* // verify this later in the `validateCallback` method
226+
* // await authIdentityService.setState(stateKey, state)
218227
*
219228
* return {
220229
* success: true,
@@ -396,6 +405,16 @@ export abstract class AbstractAuthModuleProvider implements IAuthProvider {
396405
* authIdentityProviderService: AuthIdentityProviderService
397406
* ): Promise<AuthenticationResponse> {
398407
* const isAuthenticated = false
408+
*
409+
* // optional, useful for third-party providers that require a redirect URL
410+
* // to continue the authentication flow
411+
* // const stateKey = data.query?.state as string
412+
* // const state = await authIdentityService.getState(stateKey)
413+
* // if (!state) {
414+
* // return { success: false, error: "No state provided, or session expired" }
415+
* // }
416+
* // // use callback URL with the third-party service
417+
* // const callbackUrl = state.callback_url
399418
* // TODO perform custom logic to authenticate the user
400419
* // ...
401420
*

packages/medusa/src/api/admin/order-changes/[id]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { ContainerRegistrationKeys } from "@medusajs/framework/utils"
88

99
/**
10-
* @since v2.12.0
10+
* @since 2.12.0
1111
*/
1212
export const POST = async (
1313
req: AuthenticatedMedusaRequest<

packages/modules/order/src/models/order-change.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const _OrderChange = model
2828
canceled_by: model.text().nullable(),
2929
canceled_at: model.dateTime().nullable(),
3030
/**
31-
* @since v2.12.0
31+
* @since 2.12.0
3232
*/
3333
carry_over_promotions: model.boolean().nullable(),
3434
order: model.belongsTo<() => typeof Order>(() => Order, {

packages/modules/promotion/src/models/promotion.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ const Promotion = model
1010
is_automatic: model.boolean().default(false),
1111
is_tax_inclusive: model.boolean().default(false),
1212
/**
13-
* @since v2.12.0
13+
* @since 2.12.0
1414
*/
1515
limit: model.number().nullable(),
1616
/**
17-
* @since v2.12.0
17+
* @since 2.12.0
1818
*/
1919
used: model.number().default(0),
2020
type: model.enum(PromotionUtils.PromotionType).index("IDX_promotion_type"),
@@ -37,7 +37,7 @@ const Promotion = model
3737
mappedBy: "promotions",
3838
}),
3939
/**
40-
* @since v2.12.0
40+
* @since 2.12.0
4141
*/
4242
metadata: model.json().nullable(),
4343
})

0 commit comments

Comments
 (0)