@medusajs/types 1.11.14 → 1.11.15
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/api-key/common/api-key.d.ts +55 -0
- package/dist/api-key/common/api-key.d.ts.map +1 -1
- package/dist/api-key/mutations/api-key.d.ts +43 -0
- package/dist/api-key/mutations/api-key.d.ts.map +1 -1
- package/dist/api-key/service.d.ts +203 -42
- package/dist/api-key/service.d.ts.map +1 -1
- package/dist/auth/common/provider.d.ts +4 -0
- package/dist/auth/common/provider.d.ts.map +1 -1
- package/dist/common/common.d.ts +2 -0
- package/dist/common/common.d.ts.map +1 -1
- package/dist/common/config-module.d.ts +52 -0
- package/dist/common/config-module.d.ts.map +1 -1
- package/dist/inventory/common/inventory-level.d.ts +5 -5
- package/dist/inventory/common/inventory-level.d.ts.map +1 -1
- package/dist/inventory/mutations/inventory-level.d.ts +1 -1
- package/dist/inventory/mutations/inventory-level.d.ts.map +1 -1
- package/dist/modules-sdk/index.d.ts +4 -1
- package/dist/modules-sdk/index.d.ts.map +1 -1
- package/dist/pricing/common/index.d.ts +2 -3
- package/dist/pricing/common/index.d.ts.map +1 -1
- package/dist/pricing/common/index.js +2 -3
- package/dist/pricing/common/index.js.map +1 -1
- package/dist/pricing/common/money-amount.d.ts +0 -5
- package/dist/pricing/common/money-amount.d.ts.map +1 -1
- package/dist/pricing/common/price-list.d.ts +2 -2
- package/dist/pricing/common/price-list.d.ts.map +1 -1
- package/dist/pricing/common/price-rule.d.ts +7 -7
- package/dist/pricing/common/price-rule.d.ts.map +1 -1
- package/dist/pricing/common/price-set-rule-type.d.ts +2 -2
- package/dist/pricing/common/price-set-rule-type.d.ts.map +1 -1
- package/dist/pricing/common/price-set.d.ts +10 -10
- package/dist/pricing/common/price-set.d.ts.map +1 -1
- package/dist/pricing/common/price.d.ts +137 -0
- package/dist/pricing/common/price.d.ts.map +1 -0
- package/dist/pricing/common/{price-set-money-amount.js → price.js} +1 -1
- package/dist/pricing/common/price.js.map +1 -0
- package/dist/pricing/service.d.ts +70 -797
- package/dist/pricing/service.d.ts.map +1 -1
- package/dist/product/common.d.ts +4 -6
- package/dist/product/common.d.ts.map +1 -1
- package/dist/product/service.d.ts +241 -37
- package/dist/product/service.d.ts.map +1 -1
- package/dist/stock-location/service-next.d.ts +17 -0
- package/dist/stock-location/service-next.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/pricing/common/price-set-money-amount-rules.d.ts +0 -96
- package/dist/pricing/common/price-set-money-amount-rules.d.ts.map +0 -1
- package/dist/pricing/common/price-set-money-amount-rules.js +0 -3
- package/dist/pricing/common/price-set-money-amount-rules.js.map +0 -1
- package/dist/pricing/common/price-set-money-amount.d.ts +0 -93
- package/dist/pricing/common/price-set-money-amount.d.ts.map +0 -1
- package/dist/pricing/common/price-set-money-amount.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddPriceListPricesDTO, AddPricesDTO, AddRulesDTO, CalculatedPriceSet,
|
|
1
|
+
import { AddPriceListPricesDTO, AddPricesDTO, AddRulesDTO, CalculatedPriceSet, CreatePriceListDTO, CreatePriceListRuleDTO, CreatePriceRuleDTO, CreatePriceSetDTO, CreateRuleTypeDTO, FilterablePriceListProps, FilterablePriceListRuleProps, FilterablePriceProps, FilterablePriceRuleProps, FilterablePriceSetProps, FilterableRuleTypeProps, PriceDTO, PriceListDTO, PriceListRuleDTO, PriceRuleDTO, PriceSetDTO, PricingContext, PricingFilters, RemovePriceListRulesDTO, RemovePriceSetRulesDTO, RuleTypeDTO, SetPriceListRulesDTO, UpdatePriceListDTO, UpdatePriceListPricesDTO, UpdatePriceListRuleDTO, UpdatePriceRuleDTO, UpdatePriceSetDTO, UpdateRuleTypeDTO } from "./common";
|
|
2
2
|
import { FindConfig } from "../common";
|
|
3
3
|
import { RestoreReturn, SoftDeleteReturn } from "../dal";
|
|
4
4
|
import { IModuleService } from "../modules-sdk";
|
|
@@ -129,7 +129,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
129
129
|
* const priceSet = await pricingService.retrieve(
|
|
130
130
|
* priceSetId,
|
|
131
131
|
* {
|
|
132
|
-
* relations: ["
|
|
132
|
+
* relations: ["prices"]
|
|
133
133
|
* }
|
|
134
134
|
* )
|
|
135
135
|
*
|
|
@@ -185,7 +185,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
185
185
|
* id: priceSetIds
|
|
186
186
|
* },
|
|
187
187
|
* {
|
|
188
|
-
* relations: ["
|
|
188
|
+
* relations: ["prices"]
|
|
189
189
|
* }
|
|
190
190
|
* )
|
|
191
191
|
*
|
|
@@ -208,7 +208,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
208
208
|
* id: priceSetIds
|
|
209
209
|
* },
|
|
210
210
|
* {
|
|
211
|
-
* relations: ["
|
|
211
|
+
* relations: ["prices"],
|
|
212
212
|
* skip,
|
|
213
213
|
* take
|
|
214
214
|
* }
|
|
@@ -225,7 +225,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
225
225
|
* initialize as initializePricingModule,
|
|
226
226
|
* } from "@medusajs/pricing"
|
|
227
227
|
*
|
|
228
|
-
* async function retrievePriceSets (priceSetIds: string[],
|
|
228
|
+
* async function retrievePriceSets (priceSetIds: string[], priceIds: string[], skip: number, take: number) {
|
|
229
229
|
* const pricingService = await initializePricingModule()
|
|
230
230
|
*
|
|
231
231
|
* const priceSets = await pricingService.list(
|
|
@@ -235,14 +235,14 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
235
235
|
* id: priceSetIds
|
|
236
236
|
* },
|
|
237
237
|
* {
|
|
238
|
-
*
|
|
239
|
-
* id:
|
|
238
|
+
* prices: {
|
|
239
|
+
* id: priceIds
|
|
240
240
|
* }
|
|
241
241
|
* }
|
|
242
242
|
* ]
|
|
243
243
|
* },
|
|
244
244
|
* {
|
|
245
|
-
* relations: ["
|
|
245
|
+
* relations: ["prices"],
|
|
246
246
|
* skip,
|
|
247
247
|
* take
|
|
248
248
|
* }
|
|
@@ -300,7 +300,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
300
300
|
* id: priceSetIds
|
|
301
301
|
* },
|
|
302
302
|
* {
|
|
303
|
-
* relations: ["
|
|
303
|
+
* relations: ["prices"]
|
|
304
304
|
* }
|
|
305
305
|
* )
|
|
306
306
|
*
|
|
@@ -323,7 +323,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
323
323
|
* id: priceSetIds
|
|
324
324
|
* },
|
|
325
325
|
* {
|
|
326
|
-
* relations: ["
|
|
326
|
+
* relations: ["prices"],
|
|
327
327
|
* skip,
|
|
328
328
|
* take
|
|
329
329
|
* }
|
|
@@ -340,7 +340,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
340
340
|
* initialize as initializePricingModule,
|
|
341
341
|
* } from "@medusajs/pricing"
|
|
342
342
|
*
|
|
343
|
-
* async function retrievePriceSets (priceSetIds: string[],
|
|
343
|
+
* async function retrievePriceSets (priceSetIds: string[], priceIds: string[], skip: number, take: number) {
|
|
344
344
|
* const pricingService = await initializePricingModule()
|
|
345
345
|
*
|
|
346
346
|
* const [priceSets, count] = await pricingService.listAndCount(
|
|
@@ -350,14 +350,14 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
350
350
|
* id: priceSetIds
|
|
351
351
|
* },
|
|
352
352
|
* {
|
|
353
|
-
*
|
|
354
|
-
* id:
|
|
353
|
+
* prices: {
|
|
354
|
+
* id: priceIds
|
|
355
355
|
* }
|
|
356
356
|
* }
|
|
357
357
|
* ]
|
|
358
358
|
* },
|
|
359
359
|
* {
|
|
360
|
-
* relations: ["
|
|
360
|
+
* relations: ["prices"],
|
|
361
361
|
* skip,
|
|
362
362
|
* take
|
|
363
363
|
* }
|
|
@@ -806,412 +806,6 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
806
806
|
* }
|
|
807
807
|
*/
|
|
808
808
|
addRules(data: AddRulesDTO[], sharedContext?: Context): Promise<PriceSetDTO[]>;
|
|
809
|
-
/**
|
|
810
|
-
* This method retrieves a money amount by its ID.
|
|
811
|
-
*
|
|
812
|
-
* @param {string} id - The ID of the money amount to retrieve.
|
|
813
|
-
* @param {FindConfig<MoneyAmountDTO>} config -
|
|
814
|
-
* The configurations determining how a money amount is retrieved. Its properties, such as `select` or `relations`, accept the
|
|
815
|
-
* attributes or relations associated with a money amount.
|
|
816
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
817
|
-
* @returns {Promise<MoneyAmountDTO>} The retrieved money amount.
|
|
818
|
-
*
|
|
819
|
-
* @example
|
|
820
|
-
* To retrieve a money amount by its ID:
|
|
821
|
-
*
|
|
822
|
-
* ```ts
|
|
823
|
-
* import {
|
|
824
|
-
* initialize as initializePricingModule,
|
|
825
|
-
* } from "@medusajs/pricing"
|
|
826
|
-
*
|
|
827
|
-
* async function retrieveMoneyAmount (moneyAmountId: string) {
|
|
828
|
-
* const pricingService = await initializePricingModule()
|
|
829
|
-
*
|
|
830
|
-
* const moneyAmount = await pricingService.retrieveMoneyAmount(
|
|
831
|
-
* moneyAmountId,
|
|
832
|
-
* )
|
|
833
|
-
*
|
|
834
|
-
* // do something with the money amount or return it
|
|
835
|
-
* }
|
|
836
|
-
* ```
|
|
837
|
-
*
|
|
838
|
-
* To retrieve relations along with the money amount:
|
|
839
|
-
*
|
|
840
|
-
* ```ts
|
|
841
|
-
* import {
|
|
842
|
-
* initialize as initializePricingModule,
|
|
843
|
-
* } from "@medusajs/pricing"
|
|
844
|
-
*
|
|
845
|
-
* async function retrieveMoneyAmount (moneyAmountId: string) {
|
|
846
|
-
* const pricingService = await initializePricingModule()
|
|
847
|
-
*
|
|
848
|
-
* const moneyAmount = await pricingService.retrieveMoneyAmount(
|
|
849
|
-
* moneyAmountId,
|
|
850
|
-
* {
|
|
851
|
-
* relations: ["price_set_money_amount"]
|
|
852
|
-
* }
|
|
853
|
-
* )
|
|
854
|
-
*
|
|
855
|
-
* // do something with the money amount or return it
|
|
856
|
-
* }
|
|
857
|
-
* ```
|
|
858
|
-
*/
|
|
859
|
-
retrieveMoneyAmount(id: string, config?: FindConfig<MoneyAmountDTO>, sharedContext?: Context): Promise<MoneyAmountDTO>;
|
|
860
|
-
/**
|
|
861
|
-
* This method is used to retrieve a paginated list of money amounts based on optional filters and configuration.
|
|
862
|
-
*
|
|
863
|
-
* @param {FilterableMoneyAmountProps} filters - The filtes to apply on the retrieved money amounts.
|
|
864
|
-
* @param {FindConfig<MoneyAmountDTO>} config -
|
|
865
|
-
* The configurations determining how the money amounts are retrieved. Its properties, such as `select` or `relations`, accept the
|
|
866
|
-
* attributes or relations associated with a money amount.
|
|
867
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
868
|
-
* @returns {Promise<MoneyAmountDTO[]>} The list of money amounts.
|
|
869
|
-
*
|
|
870
|
-
* @example
|
|
871
|
-
*
|
|
872
|
-
* To retrieve a list of money amounts using their IDs:
|
|
873
|
-
*
|
|
874
|
-
* ```ts
|
|
875
|
-
* import {
|
|
876
|
-
* initialize as initializePricingModule,
|
|
877
|
-
* } from "@medusajs/pricing"
|
|
878
|
-
*
|
|
879
|
-
* async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
|
|
880
|
-
* const pricingService = await initializePricingModule()
|
|
881
|
-
*
|
|
882
|
-
* const moneyAmounts = await pricingService.listMoneyAmounts(
|
|
883
|
-
* {
|
|
884
|
-
* id: moneyAmountIds
|
|
885
|
-
* }
|
|
886
|
-
* )
|
|
887
|
-
*
|
|
888
|
-
* // do something with the money amounts or return them
|
|
889
|
-
* }
|
|
890
|
-
* ```
|
|
891
|
-
*
|
|
892
|
-
* To specify relations that should be retrieved within the money amounts:
|
|
893
|
-
*
|
|
894
|
-
* ```ts
|
|
895
|
-
* import {
|
|
896
|
-
* initialize as initializePricingModule,
|
|
897
|
-
* } from "@medusajs/pricing"
|
|
898
|
-
*
|
|
899
|
-
* async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
|
|
900
|
-
* const pricingService = await initializePricingModule()
|
|
901
|
-
*
|
|
902
|
-
* const moneyAmounts = await pricingService.listMoneyAmounts(
|
|
903
|
-
* {
|
|
904
|
-
* id: moneyAmountIds
|
|
905
|
-
* },
|
|
906
|
-
* {
|
|
907
|
-
* relations: ["price_set_money_amount"]
|
|
908
|
-
* }
|
|
909
|
-
* )
|
|
910
|
-
*
|
|
911
|
-
* // do something with the money amounts or return them
|
|
912
|
-
* }
|
|
913
|
-
* ```
|
|
914
|
-
*
|
|
915
|
-
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
916
|
-
*
|
|
917
|
-
* ```ts
|
|
918
|
-
* import {
|
|
919
|
-
* initialize as initializePricingModule,
|
|
920
|
-
* } from "@medusajs/pricing"
|
|
921
|
-
*
|
|
922
|
-
* async function retrieveMoneyAmounts (moneyAmountIds: string[], skip: number, take: number) {
|
|
923
|
-
* const pricingService = await initializePricingModule()
|
|
924
|
-
*
|
|
925
|
-
* const moneyAmounts = await pricingService.listMoneyAmounts(
|
|
926
|
-
* {
|
|
927
|
-
* id: moneyAmountIds
|
|
928
|
-
* },
|
|
929
|
-
* {
|
|
930
|
-
* relations: ["price_set_money_amount"],
|
|
931
|
-
* skip,
|
|
932
|
-
* take
|
|
933
|
-
* }
|
|
934
|
-
* )
|
|
935
|
-
*
|
|
936
|
-
* // do something with the money amounts or return them
|
|
937
|
-
* }
|
|
938
|
-
* ```
|
|
939
|
-
*
|
|
940
|
-
* You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
|
941
|
-
*
|
|
942
|
-
* ```ts
|
|
943
|
-
* import {
|
|
944
|
-
* initialize as initializePricingModule,
|
|
945
|
-
* } from "@medusajs/pricing"
|
|
946
|
-
*
|
|
947
|
-
* async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: string[], skip: number, take: number) {
|
|
948
|
-
* const pricingService = await initializePricingModule()
|
|
949
|
-
*
|
|
950
|
-
* const moneyAmounts = await pricingService.listMoneyAmounts(
|
|
951
|
-
* {
|
|
952
|
-
* $and: [
|
|
953
|
-
* {
|
|
954
|
-
* id: moneyAmountIds
|
|
955
|
-
* },
|
|
956
|
-
* {
|
|
957
|
-
* currency_code: currencyCode
|
|
958
|
-
* }
|
|
959
|
-
* ]
|
|
960
|
-
* },
|
|
961
|
-
* {
|
|
962
|
-
* relations: ["price_set_money_amount"],
|
|
963
|
-
* skip,
|
|
964
|
-
* take
|
|
965
|
-
* }
|
|
966
|
-
* )
|
|
967
|
-
*
|
|
968
|
-
* // do something with the money amounts or return them
|
|
969
|
-
* }
|
|
970
|
-
* ```
|
|
971
|
-
*/
|
|
972
|
-
listMoneyAmounts(filters?: FilterableMoneyAmountProps, config?: FindConfig<MoneyAmountDTO>, sharedContext?: Context): Promise<MoneyAmountDTO[]>;
|
|
973
|
-
/**
|
|
974
|
-
* This method is used to retrieve a paginated list of money amounts along with the total count of available money amounts satisfying the provided filters.
|
|
975
|
-
*
|
|
976
|
-
* @param {FilterableMoneyAmountProps} filters - The filters to apply on the retrieved money amounts.
|
|
977
|
-
* @param {FindConfig<MoneyAmountDTO>} config -
|
|
978
|
-
* The configurations determining how the money amounts are retrieved. Its properties, such as `select` or `relations`, accept the
|
|
979
|
-
* attributes or relations associated with a money amount.
|
|
980
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
981
|
-
* @returns {Promise<[MoneyAmountDTO[], number]>} The list of money amounts along with their total count.
|
|
982
|
-
*
|
|
983
|
-
* @example
|
|
984
|
-
*
|
|
985
|
-
* To retrieve a list of money amounts using their IDs:
|
|
986
|
-
*
|
|
987
|
-
* ```ts
|
|
988
|
-
* import {
|
|
989
|
-
* initialize as initializePricingModule,
|
|
990
|
-
* } from "@medusajs/pricing"
|
|
991
|
-
*
|
|
992
|
-
* async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
|
|
993
|
-
* const pricingService = await initializePricingModule()
|
|
994
|
-
*
|
|
995
|
-
* const [moneyAmounts, count] = await pricingService.listAndCountMoneyAmounts(
|
|
996
|
-
* {
|
|
997
|
-
* id: moneyAmountIds
|
|
998
|
-
* }
|
|
999
|
-
* )
|
|
1000
|
-
*
|
|
1001
|
-
* // do something with the money amounts or return them
|
|
1002
|
-
* }
|
|
1003
|
-
* ```
|
|
1004
|
-
*
|
|
1005
|
-
* To specify relations that should be retrieved within the money amounts:
|
|
1006
|
-
*
|
|
1007
|
-
* ```ts
|
|
1008
|
-
* import {
|
|
1009
|
-
* initialize as initializePricingModule,
|
|
1010
|
-
* } from "@medusajs/pricing"
|
|
1011
|
-
*
|
|
1012
|
-
* async function retrieveMoneyAmounts (moneyAmountIds: string[]) {
|
|
1013
|
-
* const pricingService = await initializePricingModule()
|
|
1014
|
-
*
|
|
1015
|
-
* const [moneyAmounts, count] = await pricingService.listAndCountMoneyAmounts(
|
|
1016
|
-
* {
|
|
1017
|
-
* id: moneyAmountIds
|
|
1018
|
-
* },
|
|
1019
|
-
* {
|
|
1020
|
-
* relations: ["price_set_money_amount"]
|
|
1021
|
-
* }
|
|
1022
|
-
* )
|
|
1023
|
-
*
|
|
1024
|
-
* // do something with the money amounts or return them
|
|
1025
|
-
* }
|
|
1026
|
-
* ```
|
|
1027
|
-
*
|
|
1028
|
-
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
1029
|
-
*
|
|
1030
|
-
* ```ts
|
|
1031
|
-
* import {
|
|
1032
|
-
* initialize as initializePricingModule,
|
|
1033
|
-
* } from "@medusajs/pricing"
|
|
1034
|
-
*
|
|
1035
|
-
* async function retrieveMoneyAmounts (moneyAmountIds: string[], skip: number, take: number) {
|
|
1036
|
-
* const pricingService = await initializePricingModule()
|
|
1037
|
-
*
|
|
1038
|
-
* const [moneyAmounts, count] = await pricingService.listAndCountMoneyAmounts(
|
|
1039
|
-
* {
|
|
1040
|
-
* id: moneyAmountIds
|
|
1041
|
-
* },
|
|
1042
|
-
* {
|
|
1043
|
-
* relations: ["price_set_money_amount"],
|
|
1044
|
-
* skip,
|
|
1045
|
-
* take
|
|
1046
|
-
* }
|
|
1047
|
-
* )
|
|
1048
|
-
*
|
|
1049
|
-
* // do something with the money amounts or return them
|
|
1050
|
-
* }
|
|
1051
|
-
* ```
|
|
1052
|
-
*
|
|
1053
|
-
* You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
|
1054
|
-
*
|
|
1055
|
-
* ```ts
|
|
1056
|
-
* import {
|
|
1057
|
-
* initialize as initializePricingModule,
|
|
1058
|
-
* } from "@medusajs/pricing"
|
|
1059
|
-
*
|
|
1060
|
-
* async function retrieveMoneyAmounts (moneyAmountIds: string[], currencyCode: string[], skip: number, take: number) {
|
|
1061
|
-
* const pricingService = await initializePricingModule()
|
|
1062
|
-
*
|
|
1063
|
-
* const [moneyAmounts, count] = await pricingService.listAndCountMoneyAmounts(
|
|
1064
|
-
* {
|
|
1065
|
-
* $and: [
|
|
1066
|
-
* {
|
|
1067
|
-
* id: moneyAmountIds
|
|
1068
|
-
* },
|
|
1069
|
-
* {
|
|
1070
|
-
* currency_code: currencyCode
|
|
1071
|
-
* }
|
|
1072
|
-
* ]
|
|
1073
|
-
* },
|
|
1074
|
-
* {
|
|
1075
|
-
* relations: ["price_set_money_amount"],
|
|
1076
|
-
* skip,
|
|
1077
|
-
* take
|
|
1078
|
-
* }
|
|
1079
|
-
* )
|
|
1080
|
-
*
|
|
1081
|
-
* // do something with the money amounts or return them
|
|
1082
|
-
* }
|
|
1083
|
-
* ```
|
|
1084
|
-
*/
|
|
1085
|
-
listAndCountMoneyAmounts(filters?: FilterableMoneyAmountProps, config?: FindConfig<MoneyAmountDTO>, sharedContext?: Context): Promise<[MoneyAmountDTO[], number]>;
|
|
1086
|
-
/**
|
|
1087
|
-
* This method creates money amounts.
|
|
1088
|
-
*
|
|
1089
|
-
* @param {CreateMoneyAmountDTO[]} data - The money amounts to create.
|
|
1090
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1091
|
-
* @returns {Promise<MoneyAmountDTO[]>} The list of created money amounts.
|
|
1092
|
-
*
|
|
1093
|
-
* @example
|
|
1094
|
-
* import {
|
|
1095
|
-
* initialize as initializePricingModule,
|
|
1096
|
-
* } from "@medusajs/pricing"
|
|
1097
|
-
*
|
|
1098
|
-
* async function retrieveMoneyAmounts () {
|
|
1099
|
-
* const pricingService = await initializePricingModule()
|
|
1100
|
-
*
|
|
1101
|
-
* const moneyAmounts = await pricingService.createMoneyAmounts([
|
|
1102
|
-
* {
|
|
1103
|
-
* amount: 500,
|
|
1104
|
-
* currency_code: "USD",
|
|
1105
|
-
* },
|
|
1106
|
-
* {
|
|
1107
|
-
* amount: 400,
|
|
1108
|
-
* currency_code: "USD",
|
|
1109
|
-
* min_quantity: 0,
|
|
1110
|
-
* max_quantity: 4
|
|
1111
|
-
* }
|
|
1112
|
-
* ])
|
|
1113
|
-
*
|
|
1114
|
-
* // do something with the money amounts or return them
|
|
1115
|
-
* }
|
|
1116
|
-
*/
|
|
1117
|
-
createMoneyAmounts(data: CreateMoneyAmountDTO[], sharedContext?: Context): Promise<MoneyAmountDTO[]>;
|
|
1118
|
-
/**
|
|
1119
|
-
* This method updates existing money amounts.
|
|
1120
|
-
*
|
|
1121
|
-
* @param {UpdateMoneyAmountDTO[]} data - The money amounts to update, each having the attributes that should be updated in a money amount.
|
|
1122
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1123
|
-
* @returns {Promise<MoneyAmountDTO[]>} The list of updated money amounts.
|
|
1124
|
-
*
|
|
1125
|
-
* @example
|
|
1126
|
-
* import {
|
|
1127
|
-
* initialize as initializePricingModule,
|
|
1128
|
-
* } from "@medusajs/pricing"
|
|
1129
|
-
*
|
|
1130
|
-
* async function updateMoneyAmounts (moneyAmountId: string, amount: number) {
|
|
1131
|
-
* const pricingService = await initializePricingModule()
|
|
1132
|
-
*
|
|
1133
|
-
* const moneyAmounts = await pricingService.updateMoneyAmounts([
|
|
1134
|
-
* {
|
|
1135
|
-
* id: moneyAmountId,
|
|
1136
|
-
* amount
|
|
1137
|
-
* }
|
|
1138
|
-
* ])
|
|
1139
|
-
*
|
|
1140
|
-
* // do something with the money amounts or return them
|
|
1141
|
-
* }
|
|
1142
|
-
*/
|
|
1143
|
-
updateMoneyAmounts(data: UpdateMoneyAmountDTO[], sharedContext?: Context): Promise<MoneyAmountDTO[]>;
|
|
1144
|
-
/**
|
|
1145
|
-
* This method deletes money amounts by their IDs.
|
|
1146
|
-
*
|
|
1147
|
-
* @param {string[]} ids - The IDs of the money amounts to delete.
|
|
1148
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1149
|
-
* @returns {Promise<void>} Resolves when the money amounts are successfully deleted.
|
|
1150
|
-
*
|
|
1151
|
-
* @example
|
|
1152
|
-
* import {
|
|
1153
|
-
* initialize as initializePricingModule,
|
|
1154
|
-
* } from "@medusajs/pricing"
|
|
1155
|
-
*
|
|
1156
|
-
* async function deleteMoneyAmounts (moneyAmountIds: string[]) {
|
|
1157
|
-
* const pricingService = await initializePricingModule()
|
|
1158
|
-
*
|
|
1159
|
-
* await pricingService.deleteMoneyAmounts(
|
|
1160
|
-
* moneyAmountIds
|
|
1161
|
-
* )
|
|
1162
|
-
* }
|
|
1163
|
-
*/
|
|
1164
|
-
deleteMoneyAmounts(ids: string[], sharedContext?: Context): Promise<void>;
|
|
1165
|
-
/**
|
|
1166
|
-
* This method soft deletes money amounts by their IDs.
|
|
1167
|
-
*
|
|
1168
|
-
* @param {string[]} ids - The IDs of the money amounts to delete.
|
|
1169
|
-
* @param {SoftDeleteReturn<TReturnableLinkableKeys>} config
|
|
1170
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1171
|
-
* @returns {Promise<void>} Resolves when the money amounts are successfully deleted.
|
|
1172
|
-
*
|
|
1173
|
-
* @example
|
|
1174
|
-
* import {
|
|
1175
|
-
* initialize as initializePricingModule,
|
|
1176
|
-
* } from "@medusajs/pricing"
|
|
1177
|
-
*
|
|
1178
|
-
* async function softDeleteMoneyAmounts (moneyAmountIds: string[]) {
|
|
1179
|
-
* const pricingService = await initializePricingModule()
|
|
1180
|
-
*
|
|
1181
|
-
* await pricingService.softDeleteMoneyAmounts(
|
|
1182
|
-
* moneyAmountIds
|
|
1183
|
-
* )
|
|
1184
|
-
* }
|
|
1185
|
-
*/
|
|
1186
|
-
softDeleteMoneyAmounts<TReturnableLinkableKeys extends string = string>(ids: string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
|
1187
|
-
/**
|
|
1188
|
-
* This method restores soft deleted money amounts by their IDs.
|
|
1189
|
-
*
|
|
1190
|
-
* @param {string[]} ids - The IDs of the money amounts to delete.
|
|
1191
|
-
* @param {RestoreReturn<TReturnableLinkableKeys>} config -
|
|
1192
|
-
* Configurations determining which relations to restore along with each of the money amounts. You can pass to its `returnLinkableKeys`
|
|
1193
|
-
* property any of the money amount's relation attribute names, such as `price_set_money_amount`.
|
|
1194
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1195
|
-
* @returns {Promise<Record<string, string[]> | void>}
|
|
1196
|
-
* An object that includes the IDs of related records that were restored, such as the ID of associated price set money amounts.
|
|
1197
|
-
* The object's keys are the ID attribute names of the money amount entity's relations, such as `price_set_money_amount_id`,
|
|
1198
|
-
* and its value is an array of strings, each being the ID of the record associated with the money amount through this relation,
|
|
1199
|
-
* such as the IDs of associated price set money amounts.
|
|
1200
|
-
*
|
|
1201
|
-
* @example
|
|
1202
|
-
* import {
|
|
1203
|
-
* initialize as initializePricingModule,
|
|
1204
|
-
* } from "@medusajs/pricing"
|
|
1205
|
-
*
|
|
1206
|
-
* async function softDeleteMoneyAmounts (moneyAmountIds: string[]) {
|
|
1207
|
-
* const pricingService = await initializePricingModule()
|
|
1208
|
-
*
|
|
1209
|
-
* await pricingService.softDeleteMoneyAmounts(
|
|
1210
|
-
* moneyAmountIds
|
|
1211
|
-
* )
|
|
1212
|
-
* }
|
|
1213
|
-
*/
|
|
1214
|
-
restoreMoneyAmounts<TReturnableLinkableKeys extends string = string>(ids: string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
|
1215
809
|
/**
|
|
1216
810
|
* This method is used to retrieve a rule type by its ID and and optionally based on the provided configurations.
|
|
1217
811
|
*
|
|
@@ -1546,303 +1140,52 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
1546
1140
|
*/
|
|
1547
1141
|
deleteRuleTypes(ruleTypeIds: string[], sharedContext?: Context): Promise<void>;
|
|
1548
1142
|
/**
|
|
1549
|
-
* This method is used to a
|
|
1550
|
-
*
|
|
1551
|
-
* @param {string} id - The ID of the price set money amount rule to retrieve.
|
|
1552
|
-
* @param {FindConfig<PriceSetMoneyAmountRulesDTO>} config -
|
|
1553
|
-
* The configurations determining how the price set money amount rule is retrieved. Its properties, such as `select` or `relations`, accept the
|
|
1554
|
-
* attributes or relations associated with a price set money amount rule.
|
|
1555
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1556
|
-
* @returns {Promise<PriceSetMoneyAmountRulesDTO>} The retrieved price set money amount rule.
|
|
1557
|
-
*
|
|
1558
|
-
* @example
|
|
1559
|
-
* A simple example that retrieves a price set money amount rule by its ID:
|
|
1560
|
-
*
|
|
1561
|
-
* ```ts
|
|
1562
|
-
* import {
|
|
1563
|
-
* initialize as initializePricingModule,
|
|
1564
|
-
* } from "@medusajs/pricing"
|
|
1565
|
-
*
|
|
1566
|
-
* async function retrievePriceSetMoneyAmountRule (id: string) {
|
|
1567
|
-
* const pricingService = await initializePricingModule()
|
|
1568
|
-
*
|
|
1569
|
-
* const priceSetMoneyAmountRule = await pricingService.retrievePriceSetMoneyAmountRules(id)
|
|
1570
|
-
*
|
|
1571
|
-
* // do something with the price set money amount rule or return it
|
|
1572
|
-
* }
|
|
1573
|
-
* ```
|
|
1574
|
-
*
|
|
1575
|
-
* To specify relations that should be retrieved:
|
|
1576
|
-
*
|
|
1577
|
-
* ```ts
|
|
1578
|
-
* import {
|
|
1579
|
-
* initialize as initializePricingModule,
|
|
1580
|
-
* } from "@medusajs/pricing"
|
|
1581
|
-
*
|
|
1582
|
-
* async function retrievePriceSetMoneyAmountRule (id: string) {
|
|
1583
|
-
* const pricingService = await initializePricingModule()
|
|
1584
|
-
*
|
|
1585
|
-
* const priceSetMoneyAmountRule = await pricingService.retrievePriceSetMoneyAmountRules(id, {
|
|
1586
|
-
* relations: ["price_set_money_amount"]
|
|
1587
|
-
* })
|
|
1588
|
-
*
|
|
1589
|
-
* // do something with the price set money amount rule or return it
|
|
1590
|
-
* }
|
|
1591
|
-
* ```
|
|
1592
|
-
*/
|
|
1593
|
-
retrievePriceSetMoneyAmountRules(id: string, config?: FindConfig<PriceSetMoneyAmountRulesDTO>, sharedContext?: Context): Promise<PriceSetMoneyAmountRulesDTO>;
|
|
1594
|
-
/**
|
|
1595
|
-
* This method is used to retrieve a paginated list of price set money amount rules based on optional filters and configuration.
|
|
1596
|
-
*
|
|
1597
|
-
* @param {FilterablePriceSetMoneyAmountRulesProps} filters - The filters to apply on the retrieved price set money amount rules.
|
|
1598
|
-
* @param {FindConfig<PriceSetMoneyAmountRulesDTO>} config -
|
|
1599
|
-
* The configurations determining how the price set money amount rules are retrieved. Its properties, such as `select` or `relations`, accept the
|
|
1600
|
-
* attributes or relations associated with a price set money amount rule.
|
|
1601
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1602
|
-
* @returns {Promise<PriceSetMoneyAmountRulesDTO[]>} The list of price set money amount rules.
|
|
1603
|
-
*
|
|
1604
|
-
* @example
|
|
1605
|
-
*
|
|
1606
|
-
* To retrieve a list of price set money amount rules using their IDs:
|
|
1607
|
-
*
|
|
1608
|
-
* ```ts
|
|
1609
|
-
* import {
|
|
1610
|
-
* initialize as initializePricingModule,
|
|
1611
|
-
* } from "@medusajs/pricing"
|
|
1612
|
-
*
|
|
1613
|
-
* async function retrievePriceSetMoneyAmountRules (id: string) {
|
|
1614
|
-
* const pricingService = await initializePricingModule()
|
|
1615
|
-
*
|
|
1616
|
-
* const priceSetMoneyAmountRules = await pricingService.listPriceSetMoneyAmountRules({
|
|
1617
|
-
* id: [id]
|
|
1618
|
-
* })
|
|
1619
|
-
*
|
|
1620
|
-
* // do something with the price set money amount rules or return them
|
|
1621
|
-
* }
|
|
1622
|
-
* ```
|
|
1623
|
-
*
|
|
1624
|
-
* To specify relations that should be retrieved within the price set money amount rules:
|
|
1625
|
-
*
|
|
1626
|
-
* ```ts
|
|
1627
|
-
* import {
|
|
1628
|
-
* initialize as initializePricingModule,
|
|
1629
|
-
* } from "@medusajs/pricing"
|
|
1630
|
-
*
|
|
1631
|
-
* async function retrievePriceSetMoneyAmountRules (id: string) {
|
|
1632
|
-
* const pricingService = await initializePricingModule()
|
|
1633
|
-
*
|
|
1634
|
-
* const priceSetMoneyAmountRules = await pricingService.listPriceSetMoneyAmountRules({
|
|
1635
|
-
* id: [id]
|
|
1636
|
-
* }, {
|
|
1637
|
-
* relations: ["price_set_money_amount"]
|
|
1638
|
-
* })
|
|
1639
|
-
*
|
|
1640
|
-
* // do something with the price set money amount rules or return them
|
|
1641
|
-
* }
|
|
1642
|
-
* ```
|
|
1643
|
-
*
|
|
1644
|
-
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
1645
|
-
*
|
|
1646
|
-
* ```ts
|
|
1647
|
-
* import {
|
|
1648
|
-
* initialize as initializePricingModule,
|
|
1649
|
-
* } from "@medusajs/pricing"
|
|
1650
|
-
*
|
|
1651
|
-
* async function retrievePriceSetMoneyAmountRules (id: string, skip: number, take: number) {
|
|
1652
|
-
* const pricingService = await initializePricingModule()
|
|
1653
|
-
*
|
|
1654
|
-
* const priceSetMoneyAmountRules = await pricingService.listPriceSetMoneyAmountRules({
|
|
1655
|
-
* id: [id]
|
|
1656
|
-
* }, {
|
|
1657
|
-
* relations: ["price_set_money_amount"],
|
|
1658
|
-
* skip,
|
|
1659
|
-
* take
|
|
1660
|
-
* })
|
|
1661
|
-
*
|
|
1662
|
-
* // do something with the price set money amount rules or return them
|
|
1663
|
-
* }
|
|
1664
|
-
* ```
|
|
1665
|
-
*
|
|
1666
|
-
* You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
|
1667
|
-
*
|
|
1668
|
-
* ```ts
|
|
1669
|
-
* import {
|
|
1670
|
-
* initialize as initializePricingModule,
|
|
1671
|
-
* } from "@medusajs/pricing"
|
|
1672
|
-
*
|
|
1673
|
-
* async function retrievePriceSetMoneyAmountRules (ids: string[], ruleTypeId: string[], skip: number, take: number) {
|
|
1674
|
-
* const pricingService = await initializePricingModule()
|
|
1675
|
-
*
|
|
1676
|
-
* const priceSetMoneyAmountRules = await pricingService.listPriceSetMoneyAmountRules({
|
|
1677
|
-
* $and: [
|
|
1678
|
-
* {
|
|
1679
|
-
* id: ids
|
|
1680
|
-
* },
|
|
1681
|
-
* {
|
|
1682
|
-
* rule_type_id: ruleTypeId
|
|
1683
|
-
* }
|
|
1684
|
-
* ]
|
|
1685
|
-
* }, {
|
|
1686
|
-
* relations: ["price_set_money_amount"],
|
|
1687
|
-
* skip,
|
|
1688
|
-
* take
|
|
1689
|
-
* })
|
|
1690
|
-
*
|
|
1691
|
-
* // do something with the price set money amount rules or return them
|
|
1692
|
-
* }
|
|
1693
|
-
* ```
|
|
1694
|
-
*/
|
|
1695
|
-
listPriceSetMoneyAmountRules(filters?: FilterablePriceSetMoneyAmountRulesProps, config?: FindConfig<PriceSetMoneyAmountRulesDTO>, sharedContext?: Context): Promise<PriceSetMoneyAmountRulesDTO[]>;
|
|
1696
|
-
/**
|
|
1697
|
-
* This method is used to retrieve a paginated list of price set money amount rules along with the total count of
|
|
1698
|
-
* available price set money amount rules satisfying the provided filters.
|
|
1699
|
-
*
|
|
1700
|
-
* @param {FilterablePriceSetMoneyAmountRulesProps} filters - The filters to apply on the retrieved price set money amount rules.
|
|
1701
|
-
* @param {FindConfig<PriceSetMoneyAmountRulesDTO>} config -
|
|
1702
|
-
* The configurations determining how the price set money amount rules are retrieved. Its properties, such as `select` or `relations`, accept the
|
|
1703
|
-
* attributes or relations associated with a price set money amount rule.
|
|
1704
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1705
|
-
* @returns {Promise<[PriceSetMoneyAmountRulesDTO[], number]>} The list of price set money amount rules and their total count.
|
|
1706
|
-
*
|
|
1707
|
-
* @example
|
|
1708
|
-
*
|
|
1709
|
-
* To retrieve a list of price set money amounts using their IDs:
|
|
1710
|
-
*
|
|
1711
|
-
* ```ts
|
|
1712
|
-
* import {
|
|
1713
|
-
* initialize as initializePricingModule,
|
|
1714
|
-
* } from "@medusajs/pricing"
|
|
1715
|
-
*
|
|
1716
|
-
* async function retrievePriceSetMoneyAmountRules (id: string) {
|
|
1717
|
-
* const pricingService = await initializePricingModule()
|
|
1718
|
-
*
|
|
1719
|
-
* const [priceSetMoneyAmountRules, count] = await pricingService.listAndCountPriceSetMoneyAmountRules({
|
|
1720
|
-
* id: [id]
|
|
1721
|
-
* })
|
|
1722
|
-
*
|
|
1723
|
-
* // do something with the price set money amount rules or return them
|
|
1724
|
-
* }
|
|
1725
|
-
* ```
|
|
1726
|
-
*
|
|
1727
|
-
* To specify relations that should be retrieved within the price set money amount rules:
|
|
1728
|
-
*
|
|
1729
|
-
* ```ts
|
|
1730
|
-
* import {
|
|
1731
|
-
* initialize as initializePricingModule,
|
|
1732
|
-
* } from "@medusajs/pricing"
|
|
1733
|
-
*
|
|
1734
|
-
* async function retrievePriceSetMoneyAmountRules (id: string) {
|
|
1735
|
-
* const pricingService = await initializePricingModule()
|
|
1736
|
-
*
|
|
1737
|
-
* const [priceSetMoneyAmountRules, count] = await pricingService.listAndCountPriceSetMoneyAmountRules({
|
|
1738
|
-
* id: [id]
|
|
1739
|
-
* }, {
|
|
1740
|
-
* relations: ["price_set_money_amount"],
|
|
1741
|
-
* })
|
|
1742
|
-
*
|
|
1743
|
-
* // do something with the price set money amount rules or return them
|
|
1744
|
-
* }
|
|
1745
|
-
* ```
|
|
1746
|
-
*
|
|
1747
|
-
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
|
1748
|
-
*
|
|
1749
|
-
* ```ts
|
|
1750
|
-
* import {
|
|
1751
|
-
* initialize as initializePricingModule,
|
|
1752
|
-
* } from "@medusajs/pricing"
|
|
1753
|
-
*
|
|
1754
|
-
* async function retrievePriceSetMoneyAmountRules (id: string, skip: number, take: number) {
|
|
1755
|
-
* const pricingService = await initializePricingModule()
|
|
1756
|
-
*
|
|
1757
|
-
* const [priceSetMoneyAmountRules, count] = await pricingService.listAndCountPriceSetMoneyAmountRules({
|
|
1758
|
-
* id: [id]
|
|
1759
|
-
* }, {
|
|
1760
|
-
* relations: ["price_set_money_amount"],
|
|
1761
|
-
* skip,
|
|
1762
|
-
* take
|
|
1763
|
-
* })
|
|
1764
|
-
*
|
|
1765
|
-
* // do something with the price set money amount rules or return them
|
|
1766
|
-
* }
|
|
1767
|
-
* ```
|
|
1768
|
-
*
|
|
1769
|
-
* You can also use the `$and` or `$or` properties of the `filter` parameter to use and/or conditions in your filters. For example:
|
|
1770
|
-
*
|
|
1771
|
-
* ```ts
|
|
1772
|
-
* import {
|
|
1773
|
-
* initialize as initializePricingModule,
|
|
1774
|
-
* } from "@medusajs/pricing"
|
|
1775
|
-
*
|
|
1776
|
-
* async function retrievePriceSetMoneyAmountRules (ids: string[], ruleTypeId: string[], skip: number, take: number) {
|
|
1777
|
-
* const pricingService = await initializePricingModule()
|
|
1778
|
-
*
|
|
1779
|
-
* const [priceSetMoneyAmountRules, count] = await pricingService.listAndCountPriceSetMoneyAmountRules({
|
|
1780
|
-
* $and: [
|
|
1781
|
-
* {
|
|
1782
|
-
* id: ids
|
|
1783
|
-
* },
|
|
1784
|
-
* {
|
|
1785
|
-
* rule_type_id: ruleTypeId
|
|
1786
|
-
* }
|
|
1787
|
-
* ]
|
|
1788
|
-
* }, {
|
|
1789
|
-
* relations: ["price_set_money_amount"],
|
|
1790
|
-
* skip,
|
|
1791
|
-
* take
|
|
1792
|
-
* })
|
|
1793
|
-
*
|
|
1794
|
-
* // do something with the price set money amount rules or return them
|
|
1795
|
-
* }
|
|
1796
|
-
* ```
|
|
1797
|
-
*/
|
|
1798
|
-
listAndCountPriceSetMoneyAmountRules(filters?: FilterablePriceSetMoneyAmountRulesProps, config?: FindConfig<PriceSetMoneyAmountRulesDTO>, sharedContext?: Context): Promise<[PriceSetMoneyAmountRulesDTO[], number]>;
|
|
1799
|
-
/**
|
|
1800
|
-
* This method is used to retrieve a paginated list of price set money amounts based on optional filters and configuration.
|
|
1143
|
+
* This method is used to retrieve a paginated list of prices based on optional filters and configuration.
|
|
1801
1144
|
*
|
|
1802
|
-
* @param {
|
|
1803
|
-
* @param {FindConfig<
|
|
1804
|
-
* The configurations determining how the
|
|
1805
|
-
* attributes or relations associated with a price
|
|
1145
|
+
* @param {FilterablePriceProps} filters - The filters to apply on the retrieved prices.
|
|
1146
|
+
* @param {FindConfig<PriceDTO>} config -
|
|
1147
|
+
* The configurations determining how the prices are retrieved. Its properties, such as `select` or `relations`, accept the
|
|
1148
|
+
* attributes or relations associated with a price.
|
|
1806
1149
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1807
|
-
* @returns {Promise<
|
|
1150
|
+
* @returns {Promise<PriceDTO[]>} The list of prices.
|
|
1808
1151
|
*
|
|
1809
1152
|
* @example
|
|
1810
1153
|
*
|
|
1811
|
-
* To retrieve a list of
|
|
1154
|
+
* To retrieve a list of prices using their IDs:
|
|
1812
1155
|
*
|
|
1813
1156
|
* ```ts
|
|
1814
1157
|
* import {
|
|
1815
1158
|
* initialize as initializePricingModule,
|
|
1816
1159
|
* } from "@medusajs/pricing"
|
|
1817
1160
|
*
|
|
1818
|
-
* async function
|
|
1161
|
+
* async function retrievePrices (id: string) {
|
|
1819
1162
|
* const pricingService = await initializePricingModule()
|
|
1820
1163
|
*
|
|
1821
|
-
* const
|
|
1164
|
+
* const prices = await pricingService.listPrices({
|
|
1822
1165
|
* id: [id]
|
|
1823
1166
|
* })
|
|
1824
1167
|
*
|
|
1825
|
-
* // do something with the
|
|
1168
|
+
* // do something with the prices or return them
|
|
1826
1169
|
* }
|
|
1827
1170
|
* ```
|
|
1828
1171
|
*
|
|
1829
|
-
* To specify relations that should be retrieved within the
|
|
1172
|
+
* To specify relations that should be retrieved within the prices:
|
|
1830
1173
|
*
|
|
1831
1174
|
* ```ts
|
|
1832
1175
|
* import {
|
|
1833
1176
|
* initialize as initializePricingModule,
|
|
1834
1177
|
* } from "@medusajs/pricing"
|
|
1835
1178
|
*
|
|
1836
|
-
* async function
|
|
1179
|
+
* async function retrievePrices (id: string) {
|
|
1837
1180
|
* const pricingService = await initializePricingModule()
|
|
1838
1181
|
*
|
|
1839
|
-
* const
|
|
1182
|
+
* const prices = await pricingService.listPrices({
|
|
1840
1183
|
* id: [id]
|
|
1841
1184
|
* }, {
|
|
1842
1185
|
* relations: ["price_rules"]
|
|
1843
1186
|
* })
|
|
1844
1187
|
*
|
|
1845
|
-
* // do something with the
|
|
1188
|
+
* // do something with the prices or return them
|
|
1846
1189
|
* }
|
|
1847
1190
|
* ```
|
|
1848
1191
|
*
|
|
@@ -1853,10 +1196,10 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
1853
1196
|
* initialize as initializePricingModule,
|
|
1854
1197
|
* } from "@medusajs/pricing"
|
|
1855
1198
|
*
|
|
1856
|
-
* async function
|
|
1199
|
+
* async function retrievePrices (id: string, skip: number, take: number) {
|
|
1857
1200
|
* const pricingService = await initializePricingModule()
|
|
1858
1201
|
*
|
|
1859
|
-
* const
|
|
1202
|
+
* const prices = await pricingService.listPrices({
|
|
1860
1203
|
* id: [id]
|
|
1861
1204
|
* }, {
|
|
1862
1205
|
* relations: ["price_rules"],
|
|
@@ -1864,7 +1207,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
1864
1207
|
* take
|
|
1865
1208
|
* })
|
|
1866
1209
|
*
|
|
1867
|
-
* // do something with the
|
|
1210
|
+
* // do something with the prices or return them
|
|
1868
1211
|
* }
|
|
1869
1212
|
* ```
|
|
1870
1213
|
*
|
|
@@ -1875,10 +1218,10 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
1875
1218
|
* initialize as initializePricingModule,
|
|
1876
1219
|
* } from "@medusajs/pricing"
|
|
1877
1220
|
*
|
|
1878
|
-
* async function
|
|
1221
|
+
* async function retrievePrices (ids: string[], titles: string[], skip: number, take: number) {
|
|
1879
1222
|
* const pricingService = await initializePricingModule()
|
|
1880
1223
|
*
|
|
1881
|
-
* const
|
|
1224
|
+
* const prices = await pricingService.listPrices({
|
|
1882
1225
|
* $and: [
|
|
1883
1226
|
* {
|
|
1884
1227
|
* id: ids
|
|
@@ -1893,59 +1236,61 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
1893
1236
|
* take
|
|
1894
1237
|
* })
|
|
1895
1238
|
*
|
|
1896
|
-
* // do something with the
|
|
1239
|
+
* // do something with the prices or return them
|
|
1897
1240
|
* }
|
|
1898
1241
|
* ```
|
|
1899
1242
|
*/
|
|
1900
|
-
|
|
1243
|
+
listPrices(filters?: FilterablePriceProps, config?: FindConfig<PriceDTO>, sharedContext?: Context): Promise<PriceDTO[]>;
|
|
1244
|
+
softDeletePrices<TReturnableLinkableKeys extends string = string>(priceIds: string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
|
1245
|
+
restorePrices<TReturnableLinkableKeys extends string = string>(priceIds: string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
|
1901
1246
|
/**
|
|
1902
|
-
* This method is used to retrieve a paginated list of
|
|
1903
|
-
* available
|
|
1247
|
+
* This method is used to retrieve a paginated list of prices along with the total count of
|
|
1248
|
+
* available prices satisfying the provided filters.
|
|
1904
1249
|
*
|
|
1905
|
-
* @param {
|
|
1906
|
-
* @param {FindConfig<
|
|
1907
|
-
* The configurations determining how the
|
|
1908
|
-
* attributes or relations associated with a price
|
|
1250
|
+
* @param {FilterablePriceProps} filters - The filters to apply on the retrieved prices.
|
|
1251
|
+
* @param {FindConfig<PriceDTO>} config -
|
|
1252
|
+
* The configurations determining how the prices are retrieved. Its properties, such as `select` or `relations`, accept the
|
|
1253
|
+
* attributes or relations associated with a price.
|
|
1909
1254
|
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
1910
|
-
* @returns {Promise<[
|
|
1255
|
+
* @returns {Promise<[PriceDTO[], number]>} The list of prices and their total count.
|
|
1911
1256
|
*
|
|
1912
1257
|
* @example
|
|
1913
1258
|
*
|
|
1914
|
-
* To retrieve a list of
|
|
1259
|
+
* To retrieve a list of prices using their IDs:
|
|
1915
1260
|
*
|
|
1916
1261
|
* ```ts
|
|
1917
1262
|
* import {
|
|
1918
1263
|
* initialize as initializePricingModule,
|
|
1919
1264
|
* } from "@medusajs/pricing"
|
|
1920
1265
|
*
|
|
1921
|
-
* async function
|
|
1266
|
+
* async function retrievePrices (id: string) {
|
|
1922
1267
|
* const pricingService = await initializePricingModule()
|
|
1923
1268
|
*
|
|
1924
|
-
* const [
|
|
1269
|
+
* const [prices, count] = await pricingService.listAndCountPrices({
|
|
1925
1270
|
* id: [id]
|
|
1926
1271
|
* })
|
|
1927
1272
|
*
|
|
1928
|
-
* // do something with the
|
|
1273
|
+
* // do something with the prices or return them
|
|
1929
1274
|
* }
|
|
1930
1275
|
* ```
|
|
1931
1276
|
*
|
|
1932
|
-
* To specify relations that should be retrieved within the
|
|
1277
|
+
* To specify relations that should be retrieved within the prices:
|
|
1933
1278
|
*
|
|
1934
1279
|
* ```ts
|
|
1935
1280
|
* import {
|
|
1936
1281
|
* initialize as initializePricingModule,
|
|
1937
1282
|
* } from "@medusajs/pricing"
|
|
1938
1283
|
*
|
|
1939
|
-
* async function
|
|
1284
|
+
* async function retrievePrices (id: string) {
|
|
1940
1285
|
* const pricingService = await initializePricingModule()
|
|
1941
1286
|
*
|
|
1942
|
-
* const [
|
|
1287
|
+
* const [prices, count] = await pricingService.listAndCountPrices({
|
|
1943
1288
|
* id: [id]
|
|
1944
1289
|
* }, {
|
|
1945
1290
|
* relations: ["price_rules"],
|
|
1946
1291
|
* })
|
|
1947
1292
|
*
|
|
1948
|
-
* // do something with the
|
|
1293
|
+
* // do something with the prices or return them
|
|
1949
1294
|
* }
|
|
1950
1295
|
* ```
|
|
1951
1296
|
*
|
|
@@ -1956,10 +1301,10 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
1956
1301
|
* initialize as initializePricingModule,
|
|
1957
1302
|
* } from "@medusajs/pricing"
|
|
1958
1303
|
*
|
|
1959
|
-
* async function
|
|
1304
|
+
* async function retrievePrices (id: string, skip: number, take: number) {
|
|
1960
1305
|
* const pricingService = await initializePricingModule()
|
|
1961
1306
|
*
|
|
1962
|
-
* const [
|
|
1307
|
+
* const [prices, count] = await pricingService.listAndCountPrices({
|
|
1963
1308
|
* id: [id]
|
|
1964
1309
|
* }, {
|
|
1965
1310
|
* relations: ["price_rules"],
|
|
@@ -1967,7 +1312,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
1967
1312
|
* take
|
|
1968
1313
|
* })
|
|
1969
1314
|
*
|
|
1970
|
-
* // do something with the
|
|
1315
|
+
* // do something with the prices or return them
|
|
1971
1316
|
* }
|
|
1972
1317
|
* ```
|
|
1973
1318
|
*
|
|
@@ -1978,10 +1323,10 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
1978
1323
|
* initialize as initializePricingModule,
|
|
1979
1324
|
* } from "@medusajs/pricing"
|
|
1980
1325
|
*
|
|
1981
|
-
* async function
|
|
1326
|
+
* async function retrievePrices (ids: string[], titles: string[], skip: number, take: number) {
|
|
1982
1327
|
* const pricingService = await initializePricingModule()
|
|
1983
1328
|
*
|
|
1984
|
-
* const [
|
|
1329
|
+
* const [prices, count] = await pricingService.listAndCountPrices({
|
|
1985
1330
|
* $and: [
|
|
1986
1331
|
* {
|
|
1987
1332
|
* id: ids
|
|
@@ -1996,85 +1341,11 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
1996
1341
|
* take
|
|
1997
1342
|
* })
|
|
1998
1343
|
*
|
|
1999
|
-
* // do something with the
|
|
1344
|
+
* // do something with the prices or return them
|
|
2000
1345
|
* }
|
|
2001
1346
|
* ```
|
|
2002
1347
|
*/
|
|
2003
|
-
|
|
2004
|
-
/**
|
|
2005
|
-
* This method is used to create new price set money amount rules. A price set money amount rule creates an association between a price set money amount and
|
|
2006
|
-
* a rule type.
|
|
2007
|
-
*
|
|
2008
|
-
* @param {CreatePriceSetMoneyAmountRulesDTO[]} data - The price set money amount rules to create.
|
|
2009
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
2010
|
-
* @returns {Promise<PriceSetMoneyAmountRulesDTO[]>} The list of created price set money amount rules.
|
|
2011
|
-
*
|
|
2012
|
-
* @example
|
|
2013
|
-
* import {
|
|
2014
|
-
* initialize as initializePricingModule,
|
|
2015
|
-
* } from "@medusajs/pricing"
|
|
2016
|
-
*
|
|
2017
|
-
* async function createPriceSetMoneyAmountRules (priceSetMoneyAmountId: string, ruleTypeId: string, value: string) {
|
|
2018
|
-
* const pricingService = await initializePricingModule()
|
|
2019
|
-
*
|
|
2020
|
-
* const priceSetMoneyAmountRules = await pricingService.createPriceSetMoneyAmountRules([
|
|
2021
|
-
* {
|
|
2022
|
-
* price_set_money_amount: priceSetMoneyAmountId,
|
|
2023
|
-
* rule_type: ruleTypeId,
|
|
2024
|
-
* value
|
|
2025
|
-
* }
|
|
2026
|
-
* ])
|
|
2027
|
-
*
|
|
2028
|
-
* // do something with the price set money amount rules or return them
|
|
2029
|
-
* }
|
|
2030
|
-
*/
|
|
2031
|
-
createPriceSetMoneyAmountRules(data: CreatePriceSetMoneyAmountRulesDTO[], sharedContext?: Context): Promise<PriceSetMoneyAmountRulesDTO[]>;
|
|
2032
|
-
/**
|
|
2033
|
-
* This method is used to update price set money amount rules, each with their provided data.
|
|
2034
|
-
*
|
|
2035
|
-
* @param {UpdatePriceSetMoneyAmountRulesDTO[]} data -
|
|
2036
|
-
* The price set money amounts to update, each having the attributes to update in a price set money amount.
|
|
2037
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
2038
|
-
* @returns {Promise<PriceSetMoneyAmountRulesDTO[]>} The list of updated price set money amount rules.
|
|
2039
|
-
*
|
|
2040
|
-
* @example
|
|
2041
|
-
* import {
|
|
2042
|
-
* initialize as initializePricingModule,
|
|
2043
|
-
* } from "@medusajs/pricing"
|
|
2044
|
-
*
|
|
2045
|
-
* async function updatePriceSetMoneyAmountRules (id: string, value: string) {
|
|
2046
|
-
* const pricingService = await initializePricingModule()
|
|
2047
|
-
*
|
|
2048
|
-
* const priceSetMoneyAmountRules = await pricingService.updatePriceSetMoneyAmountRules([
|
|
2049
|
-
* {
|
|
2050
|
-
* id,
|
|
2051
|
-
* value
|
|
2052
|
-
* }
|
|
2053
|
-
* ])
|
|
2054
|
-
*
|
|
2055
|
-
* // do something with the price set money amount rules or return them
|
|
2056
|
-
* }
|
|
2057
|
-
*/
|
|
2058
|
-
updatePriceSetMoneyAmountRules(data: UpdatePriceSetMoneyAmountRulesDTO[], sharedContext?: Context): Promise<PriceSetMoneyAmountRulesDTO[]>;
|
|
2059
|
-
/**
|
|
2060
|
-
* This method is used to delete price set money amount rules based on the specified IDs.
|
|
2061
|
-
*
|
|
2062
|
-
* @param {string[]} ids - The IDs of the price set money amount rules to delete.
|
|
2063
|
-
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
|
2064
|
-
* @returns {Promise<void>} Resolves once the price set money amount rules are deleted.
|
|
2065
|
-
*
|
|
2066
|
-
* @example
|
|
2067
|
-
* import {
|
|
2068
|
-
* initialize as initializePricingModule,
|
|
2069
|
-
* } from "@medusajs/pricing"
|
|
2070
|
-
*
|
|
2071
|
-
* async function deletePriceSetMoneyAmountRule (id: string) {
|
|
2072
|
-
* const pricingService = await initializePricingModule()
|
|
2073
|
-
*
|
|
2074
|
-
* await pricingService.deletePriceSetMoneyAmountRules([id])
|
|
2075
|
-
* }
|
|
2076
|
-
*/
|
|
2077
|
-
deletePriceSetMoneyAmountRules(ids: string[], sharedContext?: Context): Promise<void>;
|
|
1348
|
+
listAndCountPrices(filters?: FilterablePriceProps, config?: FindConfig<PriceDTO>, sharedContext?: Context): Promise<[PriceDTO[], number]>;
|
|
2078
1349
|
/**
|
|
2079
1350
|
* This method is used to retrieve a price rule by its ID.
|
|
2080
1351
|
*
|
|
@@ -2342,7 +1613,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2342
1613
|
* priceSetId: string,
|
|
2343
1614
|
* ruleTypeId: string,
|
|
2344
1615
|
* value: string,
|
|
2345
|
-
*
|
|
1616
|
+
* priceId: string,
|
|
2346
1617
|
* priceListId: string
|
|
2347
1618
|
* ) {
|
|
2348
1619
|
* const pricingService = await initializePricingModule()
|
|
@@ -2353,7 +1624,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2353
1624
|
* price_set_id: priceSetId,
|
|
2354
1625
|
* rule_type_id: ruleTypeId,
|
|
2355
1626
|
* value,
|
|
2356
|
-
*
|
|
1627
|
+
* price_id: priceId,
|
|
2357
1628
|
* price_list_id: priceListId
|
|
2358
1629
|
* }
|
|
2359
1630
|
* ])
|
|
@@ -2454,7 +1725,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2454
1725
|
* const priceList = await pricingService.retrievePriceList(
|
|
2455
1726
|
* priceListId,
|
|
2456
1727
|
* {
|
|
2457
|
-
* relations: ["
|
|
1728
|
+
* relations: ["prices"]
|
|
2458
1729
|
* }
|
|
2459
1730
|
* )
|
|
2460
1731
|
*
|
|
@@ -2510,7 +1781,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2510
1781
|
* id: priceListIds
|
|
2511
1782
|
* },
|
|
2512
1783
|
* {
|
|
2513
|
-
* relations: ["
|
|
1784
|
+
* relations: ["prices"]
|
|
2514
1785
|
* }
|
|
2515
1786
|
* )
|
|
2516
1787
|
*
|
|
@@ -2533,7 +1804,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2533
1804
|
* id: priceListIds
|
|
2534
1805
|
* },
|
|
2535
1806
|
* {
|
|
2536
|
-
* relations: ["
|
|
1807
|
+
* relations: ["prices"],
|
|
2537
1808
|
* skip,
|
|
2538
1809
|
* take
|
|
2539
1810
|
* }
|
|
@@ -2565,7 +1836,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2565
1836
|
* ]
|
|
2566
1837
|
* },
|
|
2567
1838
|
* {
|
|
2568
|
-
* relations: ["
|
|
1839
|
+
* relations: ["prices"],
|
|
2569
1840
|
* skip,
|
|
2570
1841
|
* take
|
|
2571
1842
|
* }
|
|
@@ -2623,7 +1894,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2623
1894
|
* id: priceListIds
|
|
2624
1895
|
* },
|
|
2625
1896
|
* {
|
|
2626
|
-
* relations: ["
|
|
1897
|
+
* relations: ["prices"]
|
|
2627
1898
|
* }
|
|
2628
1899
|
* )
|
|
2629
1900
|
*
|
|
@@ -2646,7 +1917,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2646
1917
|
* id: priceListIds
|
|
2647
1918
|
* },
|
|
2648
1919
|
* {
|
|
2649
|
-
* relations: ["
|
|
1920
|
+
* relations: ["prices"],
|
|
2650
1921
|
* skip,
|
|
2651
1922
|
* take
|
|
2652
1923
|
* }
|
|
@@ -2678,7 +1949,7 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2678
1949
|
* ]
|
|
2679
1950
|
* },
|
|
2680
1951
|
* {
|
|
2681
|
-
* relations: ["
|
|
1952
|
+
* relations: ["prices"],
|
|
2682
1953
|
* skip,
|
|
2683
1954
|
* take
|
|
2684
1955
|
* }
|
|
@@ -2761,6 +2032,8 @@ export interface IPricingModuleService extends IModuleService {
|
|
|
2761
2032
|
* }
|
|
2762
2033
|
*/
|
|
2763
2034
|
deletePriceLists(priceListIds: string[], sharedContext?: Context): Promise<void>;
|
|
2035
|
+
softDeletePriceLists<TReturnableLinkableKeys extends string = string>(priceListIds: string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
|
2036
|
+
restorePriceLists<TReturnableLinkableKeys extends string = string>(priceListIds: string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
|
|
2764
2037
|
/**
|
|
2765
2038
|
* This method is used to retrieve a price list rule by its ID.
|
|
2766
2039
|
*
|