@medusajs/types 3.0.0-preview-20250211091350 → 3.0.0-preview-20250406180144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache/service.d.ts +27 -0
- package/dist/cache/service.d.ts.map +1 -1
- package/dist/cart/common.d.ts +81 -0
- package/dist/cart/common.d.ts.map +1 -1
- package/dist/cart/mutations.d.ts +17 -2
- package/dist/cart/mutations.d.ts.map +1 -1
- package/dist/cart/mutations.js.map +1 -1
- package/dist/cart/service.d.ts +114 -1
- package/dist/cart/service.d.ts.map +1 -1
- package/dist/cart/workflows.d.ts +9 -0
- package/dist/cart/workflows.d.ts.map +1 -1
- package/dist/common/config-module.d.ts +5 -1
- package/dist/common/config-module.d.ts.map +1 -1
- package/dist/dal/repository-service.d.ts +2 -2
- package/dist/dal/repository-service.d.ts.map +1 -1
- package/dist/dml/index.d.ts +8 -0
- package/dist/dml/index.d.ts.map +1 -1
- package/dist/event-bus/common.d.ts +24 -0
- package/dist/event-bus/common.d.ts.map +1 -1
- package/dist/event-bus/event-bus-module.d.ts +58 -0
- package/dist/event-bus/event-bus-module.d.ts.map +1 -1
- package/dist/file/common.d.ts +3 -2
- package/dist/file/common.d.ts.map +1 -1
- package/dist/file/mutations.d.ts +5 -2
- package/dist/file/mutations.d.ts.map +1 -1
- package/dist/file/provider.d.ts +9 -3
- package/dist/file/provider.d.ts.map +1 -1
- package/dist/file/service.d.ts +10 -9
- package/dist/file/service.d.ts.map +1 -1
- package/dist/fulfillment/common/order.d.ts +2 -72
- package/dist/fulfillment/common/order.d.ts.map +1 -1
- package/dist/fulfillment/mutations/shipping-option.d.ts +23 -2
- package/dist/fulfillment/mutations/shipping-option.d.ts.map +1 -1
- package/dist/fulfillment/mutations/shipping-profile.d.ts +1 -1
- package/dist/fulfillment/mutations/shipping-profile.d.ts.map +1 -1
- package/dist/fulfillment/service.d.ts +3 -0
- package/dist/fulfillment/service.d.ts.map +1 -1
- package/dist/http/auth/payloads.d.ts +3 -0
- package/dist/http/auth/payloads.d.ts.map +1 -1
- package/dist/http/common/request.d.ts +2 -2
- package/dist/http/common/response.d.ts +21 -0
- package/dist/http/common/response.d.ts.map +1 -1
- package/dist/http/draft-order/admin/entities.d.ts +6 -0
- package/dist/http/draft-order/admin/entities.d.ts.map +1 -0
- package/dist/http/draft-order/admin/entities.js +3 -0
- package/dist/http/draft-order/admin/entities.js.map +1 -0
- package/dist/http/draft-order/admin/index.d.ts +5 -0
- package/dist/http/draft-order/admin/index.d.ts.map +1 -0
- package/dist/http/draft-order/admin/index.js +21 -0
- package/dist/http/draft-order/admin/index.js.map +1 -0
- package/dist/http/draft-order/admin/payloads.d.ts +243 -0
- package/dist/http/draft-order/admin/payloads.d.ts.map +1 -0
- package/dist/http/draft-order/admin/payloads.js +3 -0
- package/dist/http/draft-order/admin/payloads.js.map +1 -0
- package/dist/http/draft-order/admin/queries.d.ts +35 -0
- package/dist/http/draft-order/admin/queries.d.ts.map +1 -0
- package/dist/http/draft-order/admin/queries.js +3 -0
- package/dist/http/draft-order/admin/queries.js.map +1 -0
- package/dist/http/draft-order/admin/responses.d.ts +13 -0
- package/dist/http/draft-order/admin/responses.d.ts.map +1 -0
- package/dist/http/draft-order/admin/responses.js +3 -0
- package/dist/http/draft-order/admin/responses.js.map +1 -0
- package/dist/http/draft-order/index.d.ts +2 -0
- package/dist/http/draft-order/index.d.ts.map +1 -0
- package/dist/http/draft-order/index.js +18 -0
- package/dist/http/draft-order/index.js.map +1 -0
- package/dist/http/file/admin/responses.d.ts +6 -0
- package/dist/http/file/admin/responses.d.ts.map +1 -1
- package/dist/http/file/common.d.ts +17 -0
- package/dist/http/file/common.d.ts.map +1 -1
- package/dist/http/fulfillment/store/index.d.ts +4 -0
- package/dist/http/fulfillment/store/index.d.ts.map +1 -1
- package/dist/http/fulfillment-provider/admin/responses.d.ts +3 -0
- package/dist/http/fulfillment-provider/admin/responses.d.ts.map +1 -1
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +2 -0
- package/dist/http/index.js.map +1 -1
- package/dist/http/inventory-level/admin/payloads.d.ts +0 -16
- package/dist/http/inventory-level/admin/payloads.d.ts.map +1 -1
- package/dist/http/order/admin/entities.d.ts +10 -1
- package/dist/http/order/admin/entities.d.ts.map +1 -1
- package/dist/http/order/admin/queries.d.ts +0 -9
- package/dist/http/order/admin/queries.d.ts.map +1 -1
- package/dist/http/order/admin/responses.d.ts +0 -6
- package/dist/http/order/admin/responses.d.ts.map +1 -1
- package/dist/http/order/common.d.ts +6 -39
- package/dist/http/order/common.d.ts.map +1 -1
- package/dist/http/payment/admin/queries.d.ts +6 -0
- package/dist/http/payment/admin/queries.d.ts.map +1 -1
- package/dist/http/payment/admin/responses.d.ts +3 -0
- package/dist/http/payment/admin/responses.d.ts.map +1 -1
- package/dist/http/plugins/admin/responses.d.ts +10 -0
- package/dist/http/plugins/admin/responses.d.ts.map +1 -0
- package/dist/http/plugins/admin/responses.js +3 -0
- package/dist/http/plugins/admin/responses.js.map +1 -0
- package/dist/http/plugins/index.d.ts +2 -0
- package/dist/http/plugins/index.d.ts.map +1 -0
- package/dist/http/plugins/index.js +18 -0
- package/dist/http/plugins/index.js.map +1 -0
- package/dist/http/pricing/common.d.ts +8 -0
- package/dist/http/pricing/common.d.ts.map +1 -1
- package/dist/http/product/admin/payloads.d.ts +2 -2
- package/dist/http/product/admin/payloads.d.ts.map +1 -1
- package/dist/http/promotion/admin/entities.d.ts +20 -0
- package/dist/http/promotion/admin/entities.d.ts.map +1 -1
- package/dist/http/promotion/admin/payloads.d.ts +156 -0
- package/dist/http/promotion/admin/payloads.d.ts.map +1 -1
- package/dist/http/promotion/admin/queries.d.ts +45 -1
- package/dist/http/promotion/admin/queries.d.ts.map +1 -1
- package/dist/http/promotion/admin/responses.d.ts +17 -2
- package/dist/http/promotion/admin/responses.d.ts.map +1 -1
- package/dist/http/promotion/common.d.ts +53 -0
- package/dist/http/promotion/common.d.ts.map +1 -1
- package/dist/http/region/admin/entities.d.ts +3 -0
- package/dist/http/region/admin/entities.d.ts.map +1 -1
- package/dist/http/region/admin/payloads.d.ts +68 -0
- package/dist/http/region/admin/payloads.d.ts.map +1 -1
- package/dist/http/region/admin/queries.d.ts +21 -0
- package/dist/http/region/admin/queries.d.ts.map +1 -1
- package/dist/http/region/admin/responses.d.ts +6 -0
- package/dist/http/region/admin/responses.d.ts.map +1 -1
- package/dist/http/reservation/admin/entities.d.ts +39 -0
- package/dist/http/reservation/admin/entities.d.ts.map +1 -1
- package/dist/http/reservation/admin/payloads.d.ts +32 -0
- package/dist/http/reservation/admin/payloads.d.ts.map +1 -1
- package/dist/http/reservation/admin/queries.d.ts +34 -0
- package/dist/http/reservation/admin/queries.d.ts.map +1 -1
- package/dist/http/reservation/admin/responses.d.ts +6 -0
- package/dist/http/reservation/admin/responses.d.ts.map +1 -1
- package/dist/http/return/admin/entities.d.ts +3 -0
- package/dist/http/return/admin/entities.d.ts.map +1 -1
- package/dist/http/return/admin/payloads.d.ts +154 -0
- package/dist/http/return/admin/payloads.d.ts.map +1 -1
- package/dist/http/return/admin/queries.d.ts +15 -0
- package/dist/http/return/admin/queries.d.ts.map +1 -1
- package/dist/http/return/admin/responses.d.ts +6 -0
- package/dist/http/return/admin/responses.d.ts.map +1 -1
- package/dist/http/return/common.d.ts +73 -0
- package/dist/http/return/common.d.ts.map +1 -1
- package/dist/http/return-reason/admin/payloads.d.ts +21 -0
- package/dist/http/return-reason/admin/payloads.d.ts.map +1 -1
- package/dist/http/return-reason/admin/queries.d.ts +3 -0
- package/dist/http/return-reason/admin/queries.d.ts.map +1 -1
- package/dist/http/return-reason/admin/responses.d.ts +6 -0
- package/dist/http/return-reason/admin/responses.d.ts.map +1 -1
- package/dist/http/return-reason/common.d.ts +27 -0
- package/dist/http/return-reason/common.d.ts.map +1 -1
- package/dist/http/sales-channel/admin/entities.d.ts +24 -0
- package/dist/http/sales-channel/admin/entities.d.ts.map +1 -1
- package/dist/http/sales-channel/admin/payloads.d.ts +32 -0
- package/dist/http/sales-channel/admin/payloads.d.ts.map +1 -1
- package/dist/http/sales-channel/admin/queries.d.ts +32 -0
- package/dist/http/sales-channel/admin/queries.d.ts.map +1 -1
- package/dist/http/sales-channel/admin/responses.d.ts +6 -0
- package/dist/http/sales-channel/admin/responses.d.ts.map +1 -1
- package/dist/http/shipping-option/admin/entities.d.ts +187 -0
- package/dist/http/shipping-option/admin/entities.d.ts.map +1 -1
- package/dist/http/shipping-option/admin/payloads.d.ts +181 -0
- package/dist/http/shipping-option/admin/payloads.d.ts.map +1 -1
- package/dist/http/shipping-option/admin/queries.d.ts +36 -0
- package/dist/http/shipping-option/admin/queries.d.ts.map +1 -1
- package/dist/http/shipping-option/admin/responses.d.ts +6 -0
- package/dist/http/shipping-option/admin/responses.d.ts.map +1 -1
- package/dist/http/shipping-option/store/payloads.d.ts +12 -0
- package/dist/http/shipping-option/store/payloads.d.ts.map +1 -1
- package/dist/http/shipping-option/store/responses.d.ts +12 -0
- package/dist/http/shipping-option/store/responses.d.ts.map +1 -1
- package/dist/http/shipping-profile/admin/entities.d.ts +21 -0
- package/dist/http/shipping-profile/admin/entities.d.ts.map +1 -1
- package/dist/http/shipping-profile/admin/payloads.d.ts +18 -0
- package/dist/http/shipping-profile/admin/payloads.d.ts.map +1 -1
- package/dist/http/shipping-profile/admin/queries.d.ts +27 -0
- package/dist/http/shipping-profile/admin/queries.d.ts.map +1 -1
- package/dist/http/shipping-profile/admin/responses.d.ts +6 -0
- package/dist/http/shipping-profile/admin/responses.d.ts.map +1 -1
- package/dist/http/stock-locations/admin/entities.d.ts +21 -0
- package/dist/http/stock-locations/admin/entities.d.ts.map +1 -1
- package/dist/http/stock-locations/admin/payloads.d.ts +69 -0
- package/dist/http/stock-locations/admin/payloads.d.ts.map +1 -1
- package/dist/http/stock-locations/admin/queries.d.ts +24 -2
- package/dist/http/stock-locations/admin/queries.d.ts.map +1 -1
- package/dist/http/stock-locations/admin/responses.d.ts +6 -0
- package/dist/http/stock-locations/admin/responses.d.ts.map +1 -1
- package/dist/http/store/admin/entities.d.ts +54 -0
- package/dist/http/store/admin/entities.d.ts.map +1 -1
- package/dist/http/store/admin/queries.d.ts +9 -0
- package/dist/http/store/admin/queries.d.ts.map +1 -1
- package/dist/http/store/admin/responses.d.ts +6 -0
- package/dist/http/store/admin/responses.d.ts.map +1 -1
- package/dist/http/tax-rate/admin/entities.d.ts +54 -0
- package/dist/http/tax-rate/admin/entities.d.ts.map +1 -1
- package/dist/http/tax-rate/admin/payloads.d.ts +57 -0
- package/dist/http/tax-rate/admin/payloads.d.ts.map +1 -1
- package/dist/http/tax-rate/admin/queries.d.ts +30 -0
- package/dist/http/tax-rate/admin/queries.d.ts.map +1 -1
- package/dist/http/tax-rate/admin/responses.d.ts +6 -0
- package/dist/http/tax-rate/admin/responses.d.ts.map +1 -1
- package/dist/http/tax-region/admin/entities.d.ts +42 -0
- package/dist/http/tax-region/admin/entities.d.ts.map +1 -1
- package/dist/http/tax-region/admin/payloads.d.ts +30 -0
- package/dist/http/tax-region/admin/payloads.d.ts.map +1 -1
- package/dist/http/tax-region/admin/queries.d.ts +28 -0
- package/dist/http/tax-region/admin/queries.d.ts.map +1 -1
- package/dist/http/tax-region/admin/responses.d.ts +6 -0
- package/dist/http/tax-region/admin/responses.d.ts.map +1 -1
- package/dist/http/user/admin/entities.d.ts +27 -0
- package/dist/http/user/admin/entities.d.ts.map +1 -1
- package/dist/http/user/admin/payloads.d.ts +12 -0
- package/dist/http/user/admin/payloads.d.ts.map +1 -1
- package/dist/http/user/admin/queries.d.ts +24 -0
- package/dist/http/user/admin/queries.d.ts.map +1 -1
- package/dist/http/user/admin/responses.d.ts +6 -0
- package/dist/http/user/admin/responses.d.ts.map +1 -1
- package/dist/http/workflow-execution/admin/entities.d.ts +136 -2
- package/dist/http/workflow-execution/admin/entities.d.ts.map +1 -1
- package/dist/http/workflow-execution/admin/queries.d.ts +6 -0
- package/dist/http/workflow-execution/admin/queries.d.ts.map +1 -1
- package/dist/http/workflow-execution/admin/responses.d.ts +6 -0
- package/dist/http/workflow-execution/admin/responses.d.ts.map +1 -1
- package/dist/index-data/query-config/query-input-config.d.ts +1 -1
- package/dist/index-data/query-config/query-input-config.d.ts.map +1 -1
- package/dist/locking/index.d.ts +466 -0
- package/dist/locking/index.d.ts.map +1 -1
- package/dist/modules-sdk/index.d.ts +6 -1
- package/dist/modules-sdk/index.d.ts.map +1 -1
- package/dist/modules-sdk/medusa-internal-service.d.ts +5 -5
- package/dist/modules-sdk/medusa-internal-service.d.ts.map +1 -1
- package/dist/modules-sdk/remote-query-object-from-string.d.ts +4 -0
- package/dist/modules-sdk/remote-query-object-from-string.d.ts.map +1 -1
- package/dist/modules-sdk/remote-query.d.ts +16 -0
- package/dist/modules-sdk/remote-query.d.ts.map +1 -1
- package/dist/notification/mutations.d.ts +5 -4
- package/dist/notification/mutations.d.ts.map +1 -1
- package/dist/notification/service.d.ts +2 -5
- package/dist/notification/service.d.ts.map +1 -1
- package/dist/order/common.d.ts +45 -79
- package/dist/order/common.d.ts.map +1 -1
- package/dist/order/mutations.d.ts +38 -1
- package/dist/order/mutations.d.ts.map +1 -1
- package/dist/order/service.d.ts +101 -3
- package/dist/order/service.d.ts.map +1 -1
- package/dist/payment/common.d.ts +9 -1
- package/dist/payment/common.d.ts.map +1 -1
- package/dist/payment/mutations.d.ts +24 -1
- package/dist/payment/mutations.d.ts.map +1 -1
- package/dist/payment/provider.d.ts +121 -85
- package/dist/payment/provider.d.ts.map +1 -1
- package/dist/payment/service.d.ts +89 -10
- package/dist/payment/service.d.ts.map +1 -1
- package/dist/product/common.d.ts +11 -6
- package/dist/product/common.d.ts.map +1 -1
- package/dist/tax/provider.d.ts +9 -37
- package/dist/tax/provider.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/workflow/order/items.d.ts +5 -1
- package/dist/workflow/order/items.d.ts.map +1 -1
- package/dist/workflow/product-category/index.d.ts +5 -4
- package/dist/workflow/product-category/index.d.ts.map +1 -1
- package/dist/workflows/products/mutations.d.ts +2 -2
- package/dist/workflows/products/mutations.d.ts.map +1 -1
- package/dist/workflows-sdk/service.d.ts +12 -8
- package/dist/workflows-sdk/service.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/locking/index.d.ts
CHANGED
@@ -1,35 +1,501 @@
|
|
1
1
|
import { Context } from "../shared-context";
|
2
|
+
/**
|
3
|
+
* ### constructor
|
4
|
+
*
|
5
|
+
* The constructor allows you to access resources from the module's container using the first parameter,
|
6
|
+
* and the module's options using the second parameter.
|
7
|
+
*
|
8
|
+
* If you're creating a client or establishing a connection with a third-party service, do it in the constructor.
|
9
|
+
*
|
10
|
+
* #### Example
|
11
|
+
*
|
12
|
+
* ```ts
|
13
|
+
* import { ILockingProvider } from "@medusajs/framework/types"
|
14
|
+
* import { Logger } from "@medusajs/framework/types"
|
15
|
+
*
|
16
|
+
* type InjectedDependencies = {
|
17
|
+
* logger: Logger
|
18
|
+
* }
|
19
|
+
*
|
20
|
+
* type Options = {
|
21
|
+
* url: string
|
22
|
+
* }
|
23
|
+
*
|
24
|
+
* class MyLockingProviderService implements ILockingProvider {
|
25
|
+
* static identifier = "my-lock"
|
26
|
+
* protected logger_: Logger
|
27
|
+
* protected options_: Options
|
28
|
+
* // assuming you're initializing a client
|
29
|
+
* protected client
|
30
|
+
*
|
31
|
+
* constructor (
|
32
|
+
* { logger }: InjectedDependencies,
|
33
|
+
* options: Options
|
34
|
+
* ) {
|
35
|
+
* this.logger_ = logger
|
36
|
+
* this.options_ = options
|
37
|
+
*
|
38
|
+
* // assuming you're initializing a client
|
39
|
+
* this.client = new Client(options)
|
40
|
+
* }
|
41
|
+
*
|
42
|
+
* // ...
|
43
|
+
* }
|
44
|
+
*
|
45
|
+
* export default MyLockingProviderService
|
46
|
+
* ```
|
47
|
+
*
|
48
|
+
* ### Identifier
|
49
|
+
*
|
50
|
+
* Every locking module provider must have an `identifier` static property. The provider's ID
|
51
|
+
* will be stored as `lp_{identifier}`.
|
52
|
+
*
|
53
|
+
* For example:
|
54
|
+
*
|
55
|
+
* ```ts
|
56
|
+
* class MyLockingProviderService implements ILockingProvider {
|
57
|
+
* static identifier = "my-lock"
|
58
|
+
* // ...
|
59
|
+
* }
|
60
|
+
* ```
|
61
|
+
*/
|
2
62
|
export interface ILockingProvider {
|
63
|
+
/**
|
64
|
+
* This method executes a given asynchronous job with a lock on the given keys. The Locking Module uses this method
|
65
|
+
* when you call its `execute` method and your provider is the default provider, or you pass your provider's identifier to its `execute` method.
|
66
|
+
*
|
67
|
+
* In the method, you should first try to acquire the lock on the given keys before the specified timeout passes.
|
68
|
+
* Then, once the lock is acquired, you execute the job. Otherwise, if the timeout passes before the lock is acquired, you cancel the job.
|
69
|
+
*
|
70
|
+
* @param keys - The keys to lock during the job's execution.
|
71
|
+
* @param job - The asynchronous job to execute while the keys are locked.
|
72
|
+
* @param args - Additional arguments for the job execution.
|
73
|
+
* @param sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
74
|
+
* @returns The result of the job.
|
75
|
+
* @typeParam T - The type of the job's result.
|
76
|
+
*
|
77
|
+
* @example
|
78
|
+
* An example of how to implement the `execute` method:
|
79
|
+
*
|
80
|
+
* ```ts
|
81
|
+
* // other imports...
|
82
|
+
* import { Context } from "@medusajs/framework/types"
|
83
|
+
* import { setTimeout } from "node:timers/promises"
|
84
|
+
*
|
85
|
+
* class MyLockingProviderService implements ILockingProvider {
|
86
|
+
* // ...
|
87
|
+
* async execute<T>(
|
88
|
+
* keys: string | string[],
|
89
|
+
* job: () => Promise<T>,
|
90
|
+
* args?: { timeout?: number },
|
91
|
+
* sharedContext?: Context
|
92
|
+
* ): Promise<T> {
|
93
|
+
* // TODO you can add actions using the third-party client you initialized in the constructor
|
94
|
+
* const timeout = Math.max(args?.timeout ?? 5, 1)
|
95
|
+
* const timeoutSeconds = Number.isNaN(timeout) ? 1 : timeout
|
96
|
+
* const cancellationToken = { cancelled: false }
|
97
|
+
* const promises: Promise<any>[] = []
|
98
|
+
*
|
99
|
+
* if (timeoutSeconds > 0) {
|
100
|
+
* promises.push(this.getTimeout(timeoutSeconds, cancellationToken))
|
101
|
+
* }
|
102
|
+
*
|
103
|
+
* promises.push(
|
104
|
+
* this.acquire_(
|
105
|
+
* keys,
|
106
|
+
* {
|
107
|
+
* expire: args?.timeout ? timeoutSeconds : 0,
|
108
|
+
* },
|
109
|
+
* cancellationToken
|
110
|
+
* )
|
111
|
+
* )
|
112
|
+
*
|
113
|
+
* await Promise.race(promises)
|
114
|
+
*
|
115
|
+
* try {
|
116
|
+
* return await job()
|
117
|
+
* } finally {
|
118
|
+
* await this.release(keys)
|
119
|
+
* }
|
120
|
+
* }
|
121
|
+
*
|
122
|
+
* private async getTimeout(
|
123
|
+
* seconds: number,
|
124
|
+
* cancellationToken: { cancelled: boolean }
|
125
|
+
* ): Promise<void> {
|
126
|
+
* return new Promise(async (_, reject) => {
|
127
|
+
* await setTimeout(seconds * 1000)
|
128
|
+
* cancellationToken.cancelled = true
|
129
|
+
* reject(new Error("Timed-out acquiring lock."))
|
130
|
+
* })
|
131
|
+
* }
|
132
|
+
* }
|
133
|
+
* ```
|
134
|
+
*
|
135
|
+
* In this example, you first determine the timeout for acquiring the lock. You also create a `cancellationToken` object that you'll use to determine if the lock aquisition has timed out.
|
136
|
+
*
|
137
|
+
* You then create an array of the following promises:
|
138
|
+
*
|
139
|
+
* - A timeout promise that, if the lock acquisition takes longer than the timeout, sets the `cancelled` property of the `cancellationToken` object to `true`.
|
140
|
+
* - A promise that acquires the lock. You use a private `acquire_` method which you can find its implementation in the `aquire` method's example. If the first promise
|
141
|
+
* resolves and cancels the lock acquisition, the lock will not be acquired.
|
142
|
+
*
|
143
|
+
* Finally, if the lock is acquired, you execute the job and release the lock after the job is done using the `release` method.
|
144
|
+
*/
|
3
145
|
execute<T>(keys: string | string[], job: () => Promise<T>, args?: {
|
146
|
+
/**
|
147
|
+
* The timeout (in seconds) for acquiring the lock. If the time out is passed, the job is canceled and the lock is released.
|
148
|
+
*/
|
4
149
|
timeout?: number;
|
5
150
|
}, sharedContext?: Context): Promise<T>;
|
151
|
+
/**
|
152
|
+
* This method acquires a lock on the given keys. The Locking Module uses this method when you call its `acquire` method and your provider is the default provider,
|
153
|
+
* or you pass your provider's identifier to its `acquire` method.
|
154
|
+
*
|
155
|
+
* In this method, you should only aquire the lock if the timeout hasn't passed. As explained in the {@link execute} method's example,
|
156
|
+
* you can use a `cancellationToken` object to determine if the lock acquisition has timed out.
|
157
|
+
*
|
158
|
+
* If the lock aquisition isn't canceled, you should aquire the lock, setting its expiry and owner. You should account for the following scenarios:
|
159
|
+
*
|
160
|
+
* - The lock doesn't have an owner and you don't pass an owner, in which case the lock can be extended or released by anyone.
|
161
|
+
* - The lock doesn't have an owner or has the same owner that you pass, in which case you can extend the lock's expiration time and set the owner.
|
162
|
+
* - The lock has an owner, but you pass a different owner, in which case the method should throw an error.
|
163
|
+
*
|
164
|
+
* @param keys - The keys to acquire the lock on.
|
165
|
+
* @param args - Additional arguments for acquiring the lock.
|
166
|
+
* @param sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
167
|
+
* @returns Resolves when the lock is acquired.
|
168
|
+
*
|
169
|
+
* @example
|
170
|
+
* An example of how to implement the `acquire` method:
|
171
|
+
*
|
172
|
+
* ```ts
|
173
|
+
* type ResolvablePromise = {
|
174
|
+
* promise: Promise<any>
|
175
|
+
* resolve: () => void
|
176
|
+
* }
|
177
|
+
*
|
178
|
+
* class MyLockingProviderService implements ILockingProvider {
|
179
|
+
* // ...
|
180
|
+
* async acquire(
|
181
|
+
* keys: string | string[],
|
182
|
+
* args?: {
|
183
|
+
* ownerId?: string | null
|
184
|
+
* expire?: number
|
185
|
+
* awaitQueue?: boolean
|
186
|
+
* }
|
187
|
+
* ): Promise<void> {
|
188
|
+
* return this.acquire_(keys, args)
|
189
|
+
* }
|
190
|
+
*
|
191
|
+
* async acquire_(
|
192
|
+
* keys: string | string[],
|
193
|
+
* args?: {
|
194
|
+
* ownerId?: string | null
|
195
|
+
* expire?: number
|
196
|
+
* awaitQueue?: boolean
|
197
|
+
* },
|
198
|
+
* cancellationToken?: { cancelled: boolean }
|
199
|
+
* ): Promise<void> {
|
200
|
+
* keys = Array.isArray(keys) ? keys : [keys]
|
201
|
+
* const { ownerId, expire } = args ?? {}
|
202
|
+
*
|
203
|
+
* for (const key of keys) {
|
204
|
+
* if (cancellationToken?.cancelled) {
|
205
|
+
* throw new Error("Timed-out acquiring lock.")
|
206
|
+
* }
|
207
|
+
*
|
208
|
+
* // assuming your client has this method and it validates the owner and expiration
|
209
|
+
* const result = await this.client.acquireLock(key, ownerId, expire)
|
210
|
+
*
|
211
|
+
* if (result !== 1) {
|
212
|
+
* throw new Error(`Failed to acquire lock for key "${key}"`)
|
213
|
+
* }
|
214
|
+
* }
|
215
|
+
* }
|
216
|
+
* }
|
217
|
+
* ```
|
218
|
+
*
|
219
|
+
* In this example, you add a private `acquire_` method that you use to acquire the lock. This method accepts an additional `cancellationToken` argument that you can use to determine if the lock acquisition has timed out.
|
220
|
+
* You can then use this method in other methods, such as the `execute` method.
|
221
|
+
*
|
222
|
+
* In the `acquire_` method, you loop through the keys and try to acquire the lock on each key if the lock acquisition hasn't timed out. If the lock acquisition fails, you throw an error.
|
223
|
+
* This method assumes that the client you're integrating has a method called `acquireLock` that validates the owner and expiration time, and returns `1` if the lock is successfully acquired.
|
224
|
+
*/
|
6
225
|
acquire(keys: string | string[], args?: {
|
226
|
+
/**
|
227
|
+
* The ID of the lock's owner. If specified, only the owner can release the lock or extend its expiration time.
|
228
|
+
*/
|
7
229
|
ownerId?: string | null;
|
230
|
+
/**
|
231
|
+
* The expiration time (in seconds) for the lock. If the lock is already acquired and the owner is the same, the expiration time is extended
|
232
|
+
* by the value passed. If not specified, the lock does not expire.
|
233
|
+
*/
|
8
234
|
expire?: number;
|
9
235
|
}, sharedContext?: Context): Promise<void>;
|
236
|
+
/**
|
237
|
+
* This method releases a lock on the given keys. The Locking Module uses this method when you call its `release` method and your provider is the default provider,
|
238
|
+
* or you pass your provider's identifier to its `release` method.
|
239
|
+
*
|
240
|
+
* In this method, you should release the lock on the given keys. If the lock has an owner, you should only release the lock if the owner is the same as the one passed.
|
241
|
+
*
|
242
|
+
* @param keys - The keys to release the lock from.
|
243
|
+
* @param args - Additional arguments for releasing the lock.
|
244
|
+
* @param sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
245
|
+
* @returns Whether the lock was successfully released. If the lock has a different owner than the one passed, the method returns `false`.
|
246
|
+
*
|
247
|
+
* @example
|
248
|
+
* An example of how to implement the `release` method:
|
249
|
+
*
|
250
|
+
* ```ts
|
251
|
+
* // other imports...
|
252
|
+
* import { promiseAll } from "@medusajs/framework/utils"
|
253
|
+
*
|
254
|
+
* class MyLockingProviderService implements ILockingProvider {
|
255
|
+
* // ...
|
256
|
+
* async release(
|
257
|
+
* keys: string | string[],
|
258
|
+
* args?: { ownerId?: string | null },
|
259
|
+
* sharedContext?: Context
|
260
|
+
* ): Promise<boolean> {
|
261
|
+
* const ownerId = args?.ownerId ?? "*"
|
262
|
+
* keys = Array.isArray(keys) ? keys : [keys]
|
263
|
+
*
|
264
|
+
* const releasePromises = keys.map(async (key) => {
|
265
|
+
* // assuming your client has this method and it validates the owner
|
266
|
+
* const result = await this.client.releaseLock(key, ownerId)
|
267
|
+
* return result === 1
|
268
|
+
* })
|
269
|
+
*
|
270
|
+
* const results = await promiseAll(releasePromises)
|
271
|
+
*
|
272
|
+
* return results.every((released) => released)
|
273
|
+
* }
|
274
|
+
* }
|
275
|
+
* ```
|
276
|
+
*
|
277
|
+
* In this example, you loop through the keys and try to release the lock on each key using the client you're integrating. This implementation assumes that the client validates
|
278
|
+
* ownership of the lock and returns a result of `1` if the lock is successfully released.
|
279
|
+
*/
|
10
280
|
release(keys: string | string[], args?: {
|
281
|
+
/**
|
282
|
+
* The ID of the lock's owner. The lock can be released either if it doesn't have an owner, or
|
283
|
+
* if its owner ID matches the one passed in this property.
|
284
|
+
*/
|
11
285
|
ownerId?: string | null;
|
12
286
|
}, sharedContext?: Context): Promise<boolean>;
|
287
|
+
/**
|
288
|
+
* This method releases all locks. The Locking Module uses this method when you call its `releaseAll` method and your provider is the default provider,
|
289
|
+
* or you pass your provider's identifier to its `releaseAll` method.
|
290
|
+
*
|
291
|
+
* In this method, you should release all locks if no owner is passed. If an owner is passed, you should only release the locks that the owner has acquired.
|
292
|
+
*
|
293
|
+
* @param args - Additional arguments for releasing the locks.
|
294
|
+
* @param sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
295
|
+
*
|
296
|
+
* @example
|
297
|
+
* An example of how to implement the `releaseAll` method:
|
298
|
+
*
|
299
|
+
* ```ts
|
300
|
+
* class MyLockingProviderService implements ILockingProvider {
|
301
|
+
* // ...
|
302
|
+
* async releaseAll(
|
303
|
+
* args?: { ownerId?: string | null },
|
304
|
+
* sharedContext?: Context
|
305
|
+
* ): Promise<void> {
|
306
|
+
* const ownerId = args?.ownerId ?? "*"
|
307
|
+
*
|
308
|
+
* await this.client.releaseAllLock(ownerId)
|
309
|
+
* }
|
310
|
+
* }
|
311
|
+
* ```
|
312
|
+
*
|
313
|
+
* In this example, you release all locks either of all owners or the owner passed as an argument. This implementation assumes that the client you're integrating has a method called `releaseAllLock` that releases all locks
|
314
|
+
* for all owners or a specific owner.
|
315
|
+
*/
|
13
316
|
releaseAll(args?: {
|
317
|
+
/**
|
318
|
+
* The ID of a lock owner. If specified, all locks that the owner has acquired are released.
|
319
|
+
*/
|
14
320
|
ownerId?: string | null;
|
15
321
|
}, sharedContext?: Context): Promise<void>;
|
16
322
|
}
|
17
323
|
export interface ILockingModule {
|
324
|
+
/**
|
325
|
+
* This method executes a giuven asynchronous job with a lock on the given keys. You can optionally pass a
|
326
|
+
* provider name to be used for locking. If no provider is passed, the default provider (in-memory or the
|
327
|
+
* provider configuerd in `medusa-config.ts`) will be used.
|
328
|
+
*
|
329
|
+
* @param keys - The keys to lock durng the job's execution.
|
330
|
+
* @param job - The asynchronous job to execute while the keys are locked.
|
331
|
+
* @param args - Additional arguments for the job execution.
|
332
|
+
* @param sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
333
|
+
* @returns The result of the job execution.
|
334
|
+
* @typeParam T - The type of the job's result.
|
335
|
+
*
|
336
|
+
* @example
|
337
|
+
* For example, to use the lock module when deleting a product:
|
338
|
+
*
|
339
|
+
* ```ts
|
340
|
+
* await lockingModuleService.execute("prod_123", async () => {
|
341
|
+
* // assuming you've resolved the product service from the container
|
342
|
+
* await productModuleService.delete("prod_123")
|
343
|
+
* })
|
344
|
+
* ```
|
345
|
+
*
|
346
|
+
* In the above example, the product of ID `prod_123` is locked while it's being deleted.
|
347
|
+
*
|
348
|
+
* To specify the provider to use for locking, you can pass the provider name in the `args` argument:
|
349
|
+
*
|
350
|
+
* ```ts
|
351
|
+
* await lockingModuleService.execute("prod_123", async () => {
|
352
|
+
* // assuming you've resolved the product service from the container
|
353
|
+
* await productModuleService.delete("prod_123")
|
354
|
+
* }, {
|
355
|
+
* provider: "lp_my-lock"
|
356
|
+
* })
|
357
|
+
* ```
|
358
|
+
*/
|
18
359
|
execute<T>(keys: string | string[], job: () => Promise<T>, args?: {
|
360
|
+
/**
|
361
|
+
* The timeout (in seconds) for acquiring the lock. If the time out is passed, the job is canceled and the lock is released.
|
362
|
+
* Its value defaults to `5` seconds if no value is passed or if you pass a value less than `1`.
|
363
|
+
*/
|
19
364
|
timeout?: number;
|
365
|
+
/**
|
366
|
+
* The provider name to use for locking. If no provider is passed, the default provider (in-memory or the provider configuerd in `medusa-config.ts`) will be used.
|
367
|
+
*/
|
20
368
|
provider?: string;
|
21
369
|
}, sharedContext?: Context): Promise<T>;
|
370
|
+
/**
|
371
|
+
* This method acquires a lock on the given keys. You can optionally pass a provider name to be used for locking.
|
372
|
+
* If no provider is passed, the default provider (in-memory or the provider configuerd in `medusa-config.ts`) will be used.
|
373
|
+
*
|
374
|
+
* You can pass an owner for the lock, which limits who can extend or release the acquired lock. Then, if you use this method again
|
375
|
+
* passing the same owner, the lock's expiration time is extended with the value passed in the `expire` argument. Otherwise, if you pass a
|
376
|
+
* different owner, the method throws an error.
|
377
|
+
*
|
378
|
+
* @param keys - The keys to acquire the lock on.
|
379
|
+
* @param args - Additional arguments for acquiring the lock.
|
380
|
+
* @param sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
381
|
+
* @returns Resolves when the lock is acquired.
|
382
|
+
*
|
383
|
+
* @example
|
384
|
+
* For example, to acquire a lock on a product with ID `prod_123` for a user with ID `user_123`:
|
385
|
+
*
|
386
|
+
* ```ts
|
387
|
+
* await lockingModuleService.acquire("prod_123", {
|
388
|
+
* ownerId: "user_123",
|
389
|
+
* expire: 60
|
390
|
+
* })
|
391
|
+
* ```
|
392
|
+
*
|
393
|
+
* In this example, you acquire a lock on the product with ID `prod_123` for the user with ID `user_123`. You extend the
|
394
|
+
* lock's expiration time by `60` seconds.
|
395
|
+
*
|
396
|
+
* To specify the provider to use for locking, you can pass the provider name in the `args` argument:
|
397
|
+
*
|
398
|
+
* ```ts
|
399
|
+
* await lockingModuleService.acquire("prod_123", {
|
400
|
+
* ownerId: "user_123",
|
401
|
+
* expire: 60,
|
402
|
+
* provider: "lp_my-lock"
|
403
|
+
* })
|
404
|
+
* ```
|
405
|
+
*/
|
22
406
|
acquire(keys: string | string[], args?: {
|
407
|
+
/**
|
408
|
+
* The owner ID for the lock. If specified, only the owner can release the lock or extend its expiration time.
|
409
|
+
*/
|
23
410
|
ownerId?: string | null;
|
411
|
+
/**
|
412
|
+
* The expiration time (in seconds) for the lock. If the lock is already acquired and the owner is the same, the expiration time is extended
|
413
|
+
* by the value passed. If not specified, the lock does not expire.
|
414
|
+
*/
|
24
415
|
expire?: number;
|
416
|
+
/**
|
417
|
+
* The provider name to use for locking. If no provider is passed, the default provider (in-memory or the provider configuerd in `medusa-config.ts`) will be used.
|
418
|
+
*/
|
25
419
|
provider?: string;
|
26
420
|
}, sharedContext?: Context): Promise<void>;
|
421
|
+
/**
|
422
|
+
* This method releases a lock on the given keys. You can optionally pass a provider name to be used for locking.
|
423
|
+
* If no provider is passed, the default provider (in-memory or the provider configuerd in `medusa-config.ts`) will be used.
|
424
|
+
*
|
425
|
+
* If the lock has an owner, you must pass the same owner to release the lock.
|
426
|
+
*
|
427
|
+
* @param keys - The keys to release the lock from.
|
428
|
+
* @param args - Additional arguments for releasing the lock.
|
429
|
+
* @param sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
430
|
+
* @returns Whether the lock was successfully released. If the lock has a different owner than the one passed, the method returns `false`.
|
431
|
+
*
|
432
|
+
* @example
|
433
|
+
* For example, to release a lock on a product with ID `prod_123` for a user with ID `user_123`:
|
434
|
+
*
|
435
|
+
* ```ts
|
436
|
+
* await lockingModuleService.release("prod_123", {
|
437
|
+
* ownerId: "user_123"
|
438
|
+
* })
|
439
|
+
* ```
|
440
|
+
*
|
441
|
+
* In this example, you release the lock on the product with ID `prod_123` for the user with ID `user_123`.
|
442
|
+
*
|
443
|
+
* To specify the provider to use for locking, you can pass the provider name in the `args` argument:
|
444
|
+
*
|
445
|
+
* ```ts
|
446
|
+
* await lockingModuleService.release("prod_123", {
|
447
|
+
* ownerId: "user_123",
|
448
|
+
* provider: "lp_my-lock"
|
449
|
+
* })
|
450
|
+
* ```
|
451
|
+
*/
|
27
452
|
release(keys: string | string[], args?: {
|
453
|
+
/**
|
454
|
+
* The ID of the lock's owner. The lock can be released either if it doesn't have an owner, or
|
455
|
+
* if its owner ID matches the one passed in this property.
|
456
|
+
*/
|
28
457
|
ownerId?: string | null;
|
458
|
+
/**
|
459
|
+
* The provider name to use for locking. If no provider is passed, the default provider (in-memory or the provider configuerd in `medusa-config.ts`) will be used.
|
460
|
+
*/
|
29
461
|
provider?: string;
|
30
462
|
}, sharedContext?: Context): Promise<boolean>;
|
463
|
+
/**
|
464
|
+
* This method releases all locks. If you specify an owner ID, then all locks that the owner has acquired are released.
|
465
|
+
*
|
466
|
+
* You can also pass a provider name to be used for locking. If no provider is passed, the default provider (in-memory or the provider configuerd in `medusa-config.ts`) will be used.
|
467
|
+
*
|
468
|
+
* @param args - Additional arguments for releasing the locks.
|
469
|
+
* @param sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
470
|
+
*
|
471
|
+
* @example
|
472
|
+
* For example, to release all locks for a user with ID `user_123`:
|
473
|
+
*
|
474
|
+
* ```ts
|
475
|
+
* await lockingModuleService.releaseAll({
|
476
|
+
* ownerId: "user_123"
|
477
|
+
* })
|
478
|
+
* ```
|
479
|
+
*
|
480
|
+
* In this example, you release all locks for the user with ID `user_123`.
|
481
|
+
*
|
482
|
+
* To specify the provider to use for locking, you can pass the provider name in the `args` argument:
|
483
|
+
*
|
484
|
+
* ```ts
|
485
|
+
* await lockingModuleService.releaseAll({
|
486
|
+
* ownerId: "user_123",
|
487
|
+
* provider: "lp_my-lock"
|
488
|
+
* })
|
489
|
+
* ```
|
490
|
+
*/
|
31
491
|
releaseAll(args?: {
|
492
|
+
/**
|
493
|
+
* The ID of a lock owner. If specified, all locks that the owner has acquired are released.
|
494
|
+
*/
|
32
495
|
ownerId?: string | null;
|
496
|
+
/**
|
497
|
+
* The provider name to use for locking. If no provider is passed, the default provider (in-memory or the provider configuerd in `medusa-config.ts`) will be used.
|
498
|
+
*/
|
33
499
|
provider?: string;
|
34
500
|
}, sharedContext?: Context): Promise<void>;
|
35
501
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locking/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,CAAC,EACP,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACrB,IAAI,CAAC,EAAE;QACL,OAAO,CAAC,EAAE,MA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M,CAAC,EAAE,MAAM,CAAA;QACf;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,EACD,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,OAAO,CACL,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,IAAI,CAAC,EAAE;QACL;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACvB;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,EACD,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,OAAO,CAAC,CAAA;IACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,UAAU,CACR,IAAI,CAAC,EAAE;QACL;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;QACvB;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,EACD,aAAa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,IAAI,CAAC,CAAA;CACjB"}
|
@@ -136,7 +136,7 @@ export type ModuleJoinerConfig = Omit<JoinerServiceConfig, "serviceName" | "prim
|
|
136
136
|
forwardArgumentsOnPath?: string[];
|
137
137
|
isList?: boolean;
|
138
138
|
}>;
|
139
|
-
relationship: ModuleJoinerRelationship
|
139
|
+
relationship: Omit<ModuleJoinerRelationship, "hasMany">;
|
140
140
|
}[];
|
141
141
|
serviceName?: string;
|
142
142
|
primaryKeys?: string[];
|
@@ -174,6 +174,11 @@ export declare type ModuleJoinerRelationship = JoinerRelationship & {
|
|
174
174
|
* If true, the link joiner will cascade deleting the relationship
|
175
175
|
*/
|
176
176
|
deleteCascade?: boolean;
|
177
|
+
/**
|
178
|
+
* Allow multiple relationships to exist for this
|
179
|
+
* entity
|
180
|
+
*/
|
181
|
+
hasMany?: boolean;
|
177
182
|
};
|
178
183
|
export type ModuleExports<T = Constructor<any>> = {
|
179
184
|
service: T;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,iCAAiC,EAClC,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,iCAAiC,GAClC,CAAA;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAA;AAEtE,cAAc,4BAA4B,CAAA;AAC1C,cAAc,2BAA2B,CAAA;AACzC,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,mBAAmB,CAAA;AAEjC,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,QAAQ,GACR,OAAO,GACP,MAAM,GACN,MAAM,GACN,KAAK,GACL,WAAW,CAAA;AACf,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAA;AAExD,MAAM,MAAM,sBAAsB,GAAG;IACnC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,EA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,IAAI,CAAC,CAAA;QACxC,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;QAC3C,4BAA4B,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KACnD,CAAA;CACF"}
|
@@ -20,13 +20,13 @@ export interface IMedusaInternalService<TEntity extends {}, TContainer extends o
|
|
20
20
|
selector: FilterQuery<any> | BaseFilterable<FilterQuery<any>>;
|
21
21
|
data: any;
|
22
22
|
}[], sharedContext?: Context): Promise<InferEntityType<TEntity>[]>;
|
23
|
-
delete(idOrSelector: string, sharedContext?: Context): Promise<
|
24
|
-
delete(idOrSelector: string[], sharedContext?: Context): Promise<
|
25
|
-
delete(idOrSelector: object, sharedContext?: Context): Promise<
|
26
|
-
delete(idOrSelector: object[], sharedContext?: Context): Promise<
|
23
|
+
delete(idOrSelector: string, sharedContext?: Context): Promise<string[]>;
|
24
|
+
delete(idOrSelector: string[], sharedContext?: Context): Promise<string[]>;
|
25
|
+
delete(idOrSelector: object, sharedContext?: Context): Promise<string[]>;
|
26
|
+
delete(idOrSelector: object[], sharedContext?: Context): Promise<string[]>;
|
27
27
|
delete(idOrSelector: {
|
28
28
|
selector: FilterQuery<any> | BaseFilterable<FilterQuery<any>>;
|
29
|
-
}, sharedContext?: Context): Promise<
|
29
|
+
}, sharedContext?: Context): Promise<string[]>;
|
30
30
|
softDelete(idsOrFilter: string | string[] | InternalFilterQuery | InternalFilterQuery[], sharedContext?: Context): Promise<[InferEntityType<TEntity>[], Record<string, unknown[]>]>;
|
31
31
|
restore(idsOrFilter: string[] | InternalFilterQuery, sharedContext?: Context): Promise<[InferEntityType<TEntity>[], Record<string, unknown[]>]>;
|
32
32
|
upsert(data: any[], sharedContext?: Context): Promise<InferEntityType<TEntity>[]>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"medusa-internal-service.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/medusa-internal-service.ts"],"names":[],"mappings":"AAAA,OAA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Aa,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC;QACT,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,CAAA;QACpC,gBAAgB,EAAE,gBAAgB,CAAA;KACnC,CAAC,CAAA;CACH"}
|
@@ -45,6 +45,10 @@ export type RemoteQueryInput<TEntry extends string> = {
|
|
45
45
|
* Apply a query context on the retrieved data. For example, to retrieve product prices for a certain context.
|
46
46
|
*/
|
47
47
|
context?: any;
|
48
|
+
/**
|
49
|
+
* Apply a `withDeleted` flag on the retrieved data to retrieve soft deleted items.
|
50
|
+
*/
|
51
|
+
withDeleted?: boolean;
|
48
52
|
};
|
49
53
|
export type RemoteQueryGraph<TEntry extends string> = {
|
50
54
|
__TConfig: RemoteQueryObjectConfig<TEntry>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"remote-query-object-from-string.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/remote-query-object-from-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAA;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,MAAM,uBAAuB,CAAC,MAAM,SAAS,MAAM,IAAI;IAE3D,UAAU,EAAE,MAAM,GAAG,MAAM,sBAAsB,CAAA;IACjD,SAAS,CAAC,EAAE,GAAG,CAAA;IACf,MAAM,EAAE,yBAAyB,CAC/B,sBAAsB,CAAC,MAAM,GAAG,MAAM,sBAAsB,CAAC,CAC9D,SAAS,KAAK,GACX,MAAM,EAAE,GAEJ,yBAAyB,CACvB,sBAAsB,CAAC,MAAM,GAAG,MAAM,sBAAsB,CAAC,CAC9D,EAAE,GACH,MAAM,EAAE,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,iCAAiC,CAC3C,OAAO,SAAS,uBAAuB,CAAC,GAAG,CAAC,IAC1C;IACF,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,MAAM,IAAI;IAEpD;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,sBAAsB,CAAA;IAC7C;;OAEG;IACH,MAAM,EAAE,yBAAyB,CAC/B,sBAAsB,CAAC,MAAM,GAAG,MAAM,sBAAsB,CAAC,CAC9D,SAAS,KAAK,GACX,MAAM,EAAE,GAEJ,yBAAyB,CACvB,sBAAsB,CAAC,MAAM,GAAG,MAAM,sBAAsB,CAAC,CAC9D,EAAE,GACH,MAAM,EAAE,CAAA;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAA;QACb;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAA;QACb;;WAEG;QACH,KAAK,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAA;KAC7B,CAAA;IACD;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,CAAA;
|
1
|
+
{"version":3,"file":"remote-query-object-from-string.d.ts","sourceRoot":"","sources":["../../src/modules-sdk/remote-query-object-from-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAA;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,MAAM,MAAM,uBAAuB,CAAC,MAAM,SAAS,MAAM,IAAI;IAE3D,UAAU,EAAE,MAAM,GAAG,MAAM,sBAAsB,CAAA;IACjD,SAAS,CAAC,EAAE,GAA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CAC3C,CAAA"}
|
@@ -2,6 +2,7 @@ import { Prettify } from "../common";
|
|
2
2
|
import { RemoteJoinerOptions, RemoteJoinerQuery } from "../joiner";
|
3
3
|
import { RemoteQueryEntryPoints } from "./remote-query-entry-points";
|
4
4
|
import { RemoteQueryInput, RemoteQueryObjectConfig, RemoteQueryObjectFromStringResult } from "./remote-query-object-from-string";
|
5
|
+
import { RemoteQueryFilters } from "./to-remote-query";
|
5
6
|
export type RemoteQueryFunctionReturnPagination = {
|
6
7
|
skip: number;
|
7
8
|
take: number;
|
@@ -23,6 +24,16 @@ export type GraphResultSet<TEntry extends string> = {
|
|
23
24
|
export type QueryGraphFunction = {
|
24
25
|
<const TEntry extends string>(queryConfig: RemoteQueryInput<TEntry>, options?: RemoteJoinerOptions): Promise<Prettify<GraphResultSet<TEntry>>>;
|
25
26
|
};
|
27
|
+
/**
|
28
|
+
* QueryIndexFunction is a wrapper on top of remoteQuery
|
29
|
+
* that simplifies the input it accepts and returns
|
30
|
+
* a normalized/consistent output.
|
31
|
+
*/
|
32
|
+
export type QueryIndexFunction = {
|
33
|
+
<const TEntry extends string>(queryOptions: RemoteQueryInput<TEntry> & {
|
34
|
+
joinFilters?: RemoteQueryFilters<TEntry>;
|
35
|
+
}, options?: RemoteJoinerOptions): Promise<Prettify<GraphResultSet<TEntry>>>;
|
36
|
+
};
|
26
37
|
export type RemoteQueryFunction = {
|
27
38
|
/**
|
28
39
|
* Query wrapper to provide specific API's and pre processing around remoteQuery.query
|
@@ -47,6 +58,11 @@ export type RemoteQueryFunction = {
|
|
47
58
|
* returns a result set
|
48
59
|
*/
|
49
60
|
graph: QueryGraphFunction;
|
61
|
+
/**
|
62
|
+
* Index function uses the index module to query and remoteQuery to hydrate the data
|
63
|
+
* returns a result set
|
64
|
+
*/
|
65
|
+
index: QueryIndexFunction;
|
50
66
|
/**
|
51
67
|
* Query wrapper to provide specific GraphQL like API around remoteQuery.query
|
52
68
|
* @param query
|