@medusajs/pricing 0.1.13-snapshot-20240531102054 → 0.1.13-snapshot-20240701122250
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +2 -3
- package/dist/index.js +7 -4
- package/dist/joiner-config.d.ts +1 -8
- package/dist/joiner-config.js +10 -52
- package/dist/migrations/Migration20240626133555.d.ts +4 -0
- package/dist/migrations/Migration20240626133555.js +33 -0
- package/dist/models/index.d.ts +0 -3
- package/dist/models/index.js +1 -7
- package/dist/models/price-list-rule.d.ts +4 -7
- package/dist/models/price-list-rule.js +6 -27
- package/dist/models/price-list.d.ts +0 -2
- package/dist/models/price-list.js +0 -9
- package/dist/models/price-rule.d.ts +3 -8
- package/dist/models/price-rule.js +4 -43
- package/dist/models/price-set.d.ts +0 -4
- package/dist/models/price-set.js +0 -19
- package/dist/models/price.d.ts +3 -3
- package/dist/models/price.js +1 -1
- package/dist/repositories/pricing.js +25 -30
- package/dist/services/index.d.ts +0 -2
- package/dist/services/index.js +1 -5
- package/dist/services/pricing-module.d.ts +38 -52
- package/dist/services/pricing-module.js +405 -509
- package/dist/types/services/price-list.d.ts +9 -9
- package/dist/utils/events.d.ts +38 -0
- package/dist/utils/events.js +42 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +7 -10
- package/dist/models/price-list-rule-value.d.ts +0 -17
- package/dist/models/price-list-rule-value.js +0 -102
- package/dist/models/price-set-rule-type.d.ts +0 -10
- package/dist/models/price-set-rule-type.js +0 -108
- package/dist/models/rule-type.d.ts +0 -17
- package/dist/models/rule-type.js +0 -100
- package/dist/module-definition.d.ts +0 -2
- package/dist/module-definition.js +0 -8
- package/dist/scripts/bin/run-seed.d.ts +0 -3
- package/dist/scripts/bin/run-seed.js +0 -38
- package/dist/scripts/seed.d.ts +0 -4
- package/dist/scripts/seed.js +0 -67
- package/dist/services/price-list.d.ts +0 -16
- package/dist/services/price-list.js +0 -34
- package/dist/services/rule-type.d.ts +0 -15
- package/dist/services/rule-type.js +0 -53
package/dist/services/index.js
CHANGED
@@ -3,10 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.
|
7
|
-
var price_list_1 = require("./price-list");
|
8
|
-
Object.defineProperty(exports, "PriceListService", { enumerable: true, get: function () { return __importDefault(price_list_1).default; } });
|
6
|
+
exports.PricingModuleService = void 0;
|
9
7
|
var pricing_module_1 = require("./pricing-module");
|
10
8
|
Object.defineProperty(exports, "PricingModuleService", { enumerable: true, get: function () { return __importDefault(pricing_module_1).default; } });
|
11
|
-
var rule_type_1 = require("./rule-type");
|
12
|
-
Object.defineProperty(exports, "RuleTypeService", { enumerable: true, get: function () { return __importDefault(rule_type_1).default; } });
|
@@ -1,21 +1,21 @@
|
|
1
|
-
import { AddPricesDTO, Context, CreatePriceRuleDTO, DAL, FindConfig, InternalModuleDeclaration, ModuleJoinerConfig, ModulesSdkTypes, PriceSetDTO, PricingContext, PricingFilters, PricingRepositoryService, PricingTypes,
|
1
|
+
import { AddPricesDTO, Context, CreatePriceRuleDTO, DAL, FindConfig, InternalModuleDeclaration, ModuleJoinerConfig, ModulesSdkTypes, PriceDTO, PriceSetDTO, PricingContext, PricingFilters, PricingRepositoryService, PricingTypes, UpsertPriceSetDTO } from "@medusajs/types";
|
2
2
|
import { ModulesSdkUtils } from "@medusajs/utils";
|
3
|
-
import { Price, PriceList, PriceListRule,
|
4
|
-
import {
|
5
|
-
import {
|
3
|
+
import { Price, PriceList, PriceListRule, PriceRule, PriceSet } from "../models";
|
4
|
+
import { ServiceTypes } from "../types";
|
5
|
+
import { CreatePriceListDTO } from "src/types/services";
|
6
6
|
type InjectedDependencies = {
|
7
7
|
baseRepository: DAL.RepositoryService;
|
8
8
|
pricingRepository: PricingRepositoryService;
|
9
|
-
priceSetService: ModulesSdkTypes.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
priceListService: PriceListService<any>;
|
15
|
-
priceListRuleService: ModulesSdkTypes.InternalModuleService<any>;
|
16
|
-
priceListRuleValueService: ModulesSdkTypes.InternalModuleService<any>;
|
9
|
+
priceSetService: ModulesSdkTypes.IMedusaInternalService<any>;
|
10
|
+
priceRuleService: ModulesSdkTypes.IMedusaInternalService<any>;
|
11
|
+
priceService: ModulesSdkTypes.IMedusaInternalService<any>;
|
12
|
+
priceListService: ModulesSdkTypes.IMedusaInternalService<any>;
|
13
|
+
priceListRuleService: ModulesSdkTypes.IMedusaInternalService<any>;
|
17
14
|
};
|
18
|
-
declare const PricingModuleService_base: new (
|
15
|
+
declare const PricingModuleService_base: new (...args: any[]) => ModulesSdkUtils.AbstractModuleService<{
|
16
|
+
PriceSet: {
|
17
|
+
dto: PricingTypes.PriceSetDTO;
|
18
|
+
};
|
19
19
|
Price: {
|
20
20
|
dto: PricingTypes.PriceDTO;
|
21
21
|
};
|
@@ -24,11 +24,6 @@ declare const PricingModuleService_base: new (container: InjectedDependencies) =
|
|
24
24
|
create: PricingTypes.CreatePriceRuleDTO;
|
25
25
|
update: PricingTypes.UpdatePriceRuleDTO;
|
26
26
|
};
|
27
|
-
RuleType: {
|
28
|
-
dto: PricingTypes.RuleTypeDTO;
|
29
|
-
create: PricingTypes.CreateRuleTypeDTO;
|
30
|
-
update: PricingTypes.UpdateRuleTypeDTO;
|
31
|
-
};
|
32
27
|
PriceList: {
|
33
28
|
dto: PricingTypes.PriceListDTO;
|
34
29
|
};
|
@@ -36,56 +31,47 @@ declare const PricingModuleService_base: new (container: InjectedDependencies) =
|
|
36
31
|
dto: PricingTypes.PriceListRuleDTO;
|
37
32
|
};
|
38
33
|
}>;
|
39
|
-
export default class PricingModuleService
|
34
|
+
export default class PricingModuleService extends PricingModuleService_base implements PricingTypes.IPricingModuleService {
|
40
35
|
protected readonly moduleDeclaration: InternalModuleDeclaration;
|
41
36
|
protected baseRepository_: DAL.RepositoryService;
|
42
37
|
protected readonly pricingRepository_: PricingRepositoryService;
|
43
|
-
protected readonly
|
44
|
-
protected readonly
|
45
|
-
protected readonly
|
46
|
-
protected readonly
|
47
|
-
protected readonly
|
48
|
-
|
49
|
-
protected readonly priceListRuleService_: ModulesSdkTypes.InternalModuleService<TPriceListRule>;
|
50
|
-
protected readonly priceListRuleValueService_: ModulesSdkTypes.InternalModuleService<TPriceListRuleValue>;
|
51
|
-
constructor({ baseRepository, pricingRepository, ruleTypeService, priceSetService, priceRuleService, priceSetRuleTypeService, priceService, priceListService, priceListRuleService, priceListRuleValueService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
|
38
|
+
protected readonly priceSetService_: ModulesSdkTypes.IMedusaInternalService<PriceSet>;
|
39
|
+
protected readonly priceRuleService_: ModulesSdkTypes.IMedusaInternalService<PriceRule>;
|
40
|
+
protected readonly priceService_: ModulesSdkTypes.IMedusaInternalService<Price>;
|
41
|
+
protected readonly priceListService_: ModulesSdkTypes.IMedusaInternalService<PriceList>;
|
42
|
+
protected readonly priceListRuleService_: ModulesSdkTypes.IMedusaInternalService<PriceListRule>;
|
43
|
+
constructor({ baseRepository, pricingRepository, priceSetService, priceRuleService, priceService, priceListService, priceListRuleService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
|
52
44
|
__joinerConfig(): ModuleJoinerConfig;
|
53
45
|
private setupCalculatedPriceConfig_;
|
54
|
-
|
55
|
-
|
46
|
+
listPriceSets(filters?: PricingTypes.FilterablePriceSetProps, config?: FindConfig<PricingTypes.PriceSetDTO>, sharedContext?: Context): Promise<PriceSetDTO[]>;
|
47
|
+
listAndCountPriceSets(filters?: PricingTypes.FilterablePriceSetProps, config?: FindConfig<PricingTypes.PriceSetDTO>, sharedContext?: Context): Promise<[PriceSetDTO[], number]>;
|
56
48
|
calculatePrices(pricingFilters: PricingFilters, pricingContext?: PricingContext, sharedContext?: Context): Promise<PricingTypes.CalculatedPriceSet[]>;
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
49
|
+
createPriceSets(data: PricingTypes.CreatePriceSetDTO, sharedContext?: Context): Promise<PriceSetDTO>;
|
50
|
+
createPriceSets(data: PricingTypes.CreatePriceSetDTO[], sharedContext?: Context): Promise<PriceSetDTO[]>;
|
51
|
+
upsertPriceSets(data: UpsertPriceSetDTO[], sharedContext?: Context): Promise<PriceSetDTO[]>;
|
52
|
+
upsertPriceSets(data: UpsertPriceSetDTO, sharedContext?: Context): Promise<PriceSetDTO>;
|
53
|
+
updatePriceSets(id: string, data: PricingTypes.UpdatePriceSetDTO, sharedContext?: Context): Promise<PriceSetDTO>;
|
54
|
+
updatePriceSets(selector: PricingTypes.FilterablePriceSetProps, data: PricingTypes.UpdatePriceSetDTO, sharedContext?: Context): Promise<PriceSetDTO[]>;
|
63
55
|
private normalizeUpdateData;
|
64
|
-
protected
|
65
|
-
addRules(data: PricingTypes.AddRulesDTO, sharedContext?: Context): Promise<PricingTypes.PriceSetDTO>;
|
66
|
-
addRules(data: PricingTypes.AddRulesDTO[], sharedContext?: Context): Promise<PricingTypes.PriceSetDTO[]>;
|
56
|
+
protected updatePriceSets_(data: ServiceTypes.UpdatePriceSetInput[], sharedContext?: Context): Promise<PriceSet[]>;
|
67
57
|
addPrices(data: AddPricesDTO, sharedContext?: Context): Promise<PricingTypes.PriceSetDTO>;
|
68
58
|
addPrices(data: AddPricesDTO[], sharedContext?: Context): Promise<PricingTypes.PriceSetDTO[]>;
|
69
|
-
removeRules(data: PricingTypes.RemovePriceSetRulesDTO[], sharedContext?: Context): Promise<void>;
|
70
59
|
createPriceLists(data: PricingTypes.CreatePriceListDTO[], sharedContext?: Context): Promise<PricingTypes.PriceListDTO[]>;
|
71
60
|
updatePriceLists(data: PricingTypes.UpdatePriceListDTO[], sharedContext?: Context): Promise<PricingTypes.PriceListDTO[]>;
|
72
|
-
createPriceListRules(data: PricingTypes.CreatePriceListRuleDTO[], sharedContext?: Context): Promise<PricingTypes.PriceListRuleDTO[]>;
|
73
|
-
createPriceListRules_(data: PricingTypes.CreatePriceListRuleDTO[], sharedContext?: Context): Promise<TPriceListRule[]>;
|
74
|
-
updatePriceListRules(data: PricingTypes.UpdatePriceListRuleDTO[], sharedContext?: Context): Promise<PricingTypes.PriceListRuleDTO[]>;
|
75
61
|
updatePriceListPrices(data: PricingTypes.UpdatePriceListPricesDTO[], sharedContext?: Context): Promise<PricingTypes.PriceDTO[]>;
|
76
62
|
removePrices(ids: string[], sharedContext?: Context): Promise<void>;
|
77
63
|
addPriceListPrices(data: PricingTypes.AddPriceListPricesDTO[], sharedContext?: Context): Promise<PricingTypes.PriceDTO[]>;
|
78
64
|
setPriceListRules(data: PricingTypes.SetPriceListRulesDTO, sharedContext?: Context): Promise<PricingTypes.PriceListDTO>;
|
79
65
|
removePriceListRules(data: PricingTypes.RemovePriceListRulesDTO, sharedContext?: Context): Promise<PricingTypes.PriceListDTO>;
|
80
|
-
protected
|
81
|
-
protected
|
82
|
-
protected
|
83
|
-
protected
|
84
|
-
protected
|
85
|
-
protected updatePriceListPrices_(data: PricingTypes.UpdatePriceListPricesDTO[], sharedContext?: Context): Promise<TPrice[]>;
|
66
|
+
protected createPriceSets_(data: PricingTypes.CreatePriceSetDTO[], sharedContext?: Context): Promise<PriceSet[]>;
|
67
|
+
protected addPrices_(input: AddPricesDTO[], sharedContext?: Context): Promise<Price[]>;
|
68
|
+
protected createPriceLists_(data: PricingTypes.CreatePriceListDTO[], sharedContext?: Context): Promise<PriceList[]>;
|
69
|
+
protected updatePriceLists_(data: PricingTypes.UpdatePriceListDTO[], sharedContext?: Context): Promise<PriceList[]>;
|
70
|
+
protected updatePriceListPrices_(data: PricingTypes.UpdatePriceListPricesDTO[], sharedContext?: Context): Promise<Price[]>;
|
86
71
|
protected removePrices_(ids: string[], sharedContext?: Context): Promise<void>;
|
87
|
-
protected addPriceListPrices_(data: PricingTypes.AddPriceListPricesDTO[], sharedContext?: Context): Promise<
|
88
|
-
protected setPriceListRules_(data: PricingTypes.SetPriceListRulesDTO[], sharedContext?: Context): Promise<
|
89
|
-
protected removePriceListRules_(data: PricingTypes.RemovePriceListRulesDTO[], sharedContext?: Context): Promise<
|
72
|
+
protected addPriceListPrices_(data: PricingTypes.AddPriceListPricesDTO[], sharedContext?: Context): Promise<Price[]>;
|
73
|
+
protected setPriceListRules_(data: PricingTypes.SetPriceListRulesDTO[], sharedContext?: Context): Promise<PriceList[]>;
|
74
|
+
protected removePriceListRules_(data: PricingTypes.RemovePriceListRulesDTO[], sharedContext?: Context): Promise<PriceList[]>;
|
75
|
+
protected normalizePriceListDate(data: (ServiceTypes.UpdatePriceListDTO | ServiceTypes.CreatePriceListDTO | CreatePriceListDTO)[]): any[];
|
90
76
|
}
|
91
77
|
export {};
|