@medusajs/pricing 0.1.13-snapshot-20240607093839 → 0.1.13-snapshot-20240703074611
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 +50 -48
- package/dist/services/pricing-module.js +293 -482
- package/dist/types/services/price-list.d.ts +9 -9
- package/dist/utils/events.d.ts +0 -6
- package/dist/utils/events.js +6 -12
- 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 { PriceListService, RuleTypeService } from ".";
|
3
|
+
import { Price, PriceList, PriceListRule, PriceRule, PriceSet } from "../models";
|
5
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,37 +31,32 @@ 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
|
+
retrievePriceSet(id: string, config?: FindConfig<PriceSetDTO> | undefined, sharedContext?: Context | undefined): Promise<PriceSetDTO>;
|
47
|
+
listPriceSets(filters?: PricingTypes.FilterablePriceSetProps, config?: FindConfig<PricingTypes.PriceSetDTO>, sharedContext?: Context): Promise<PriceSetDTO[]>;
|
48
|
+
listAndCountPriceSets(filters?: PricingTypes.FilterablePriceSetProps, config?: FindConfig<PricingTypes.PriceSetDTO>, sharedContext?: Context): Promise<[PriceSetDTO[], number]>;
|
56
49
|
calculatePrices(pricingFilters: PricingFilters, pricingContext?: PricingContext, sharedContext?: Context): Promise<PricingTypes.CalculatedPriceSet[]>;
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
50
|
+
createPriceSets(data: PricingTypes.CreatePriceSetDTO, sharedContext?: Context): Promise<PriceSetDTO>;
|
51
|
+
createPriceSets(data: PricingTypes.CreatePriceSetDTO[], sharedContext?: Context): Promise<PriceSetDTO[]>;
|
52
|
+
upsertPriceSets(data: UpsertPriceSetDTO[], sharedContext?: Context): Promise<PriceSetDTO[]>;
|
53
|
+
upsertPriceSets(data: UpsertPriceSetDTO, sharedContext?: Context): Promise<PriceSetDTO>;
|
54
|
+
updatePriceSets(id: string, data: PricingTypes.UpdatePriceSetDTO, sharedContext?: Context): Promise<PriceSetDTO>;
|
55
|
+
updatePriceSets(selector: PricingTypes.FilterablePriceSetProps, data: PricingTypes.UpdatePriceSetDTO, sharedContext?: Context): Promise<PriceSetDTO[]>;
|
63
56
|
private normalizeUpdateData;
|
64
|
-
protected
|
65
|
-
addRules(data: PricingTypes.AddRulesDTO, sharedContext?: Context): Promise<PricingTypes.PriceSetDTO>;
|
66
|
-
addRules(data: PricingTypes.AddRulesDTO[], sharedContext?: Context): Promise<PricingTypes.PriceSetDTO[]>;
|
57
|
+
protected updatePriceSets_(data: ServiceTypes.UpdatePriceSetInput[], sharedContext?: Context): Promise<PriceSet[]>;
|
67
58
|
addPrices(data: AddPricesDTO, sharedContext?: Context): Promise<PricingTypes.PriceSetDTO>;
|
68
59
|
addPrices(data: AddPricesDTO[], sharedContext?: Context): Promise<PricingTypes.PriceSetDTO[]>;
|
69
|
-
removeRules(data: PricingTypes.RemovePriceSetRulesDTO[], sharedContext?: Context): Promise<void>;
|
70
60
|
createPriceLists(data: PricingTypes.CreatePriceListDTO[], sharedContext?: Context): Promise<PricingTypes.PriceListDTO[]>;
|
71
61
|
updatePriceLists(data: PricingTypes.UpdatePriceListDTO[], sharedContext?: Context): Promise<PricingTypes.PriceListDTO[]>;
|
72
62
|
updatePriceListPrices(data: PricingTypes.UpdatePriceListPricesDTO[], sharedContext?: Context): Promise<PricingTypes.PriceDTO[]>;
|
@@ -74,15 +64,27 @@ export default class PricingModuleService<TPriceSet extends PriceSet = PriceSet,
|
|
74
64
|
addPriceListPrices(data: PricingTypes.AddPriceListPricesDTO[], sharedContext?: Context): Promise<PricingTypes.PriceDTO[]>;
|
75
65
|
setPriceListRules(data: PricingTypes.SetPriceListRulesDTO, sharedContext?: Context): Promise<PricingTypes.PriceListDTO>;
|
76
66
|
removePriceListRules(data: PricingTypes.RemovePriceListRulesDTO, sharedContext?: Context): Promise<PricingTypes.PriceListDTO>;
|
77
|
-
protected
|
78
|
-
protected
|
79
|
-
protected
|
80
|
-
protected
|
81
|
-
protected
|
82
|
-
protected updatePriceListPrices_(data: PricingTypes.UpdatePriceListPricesDTO[], sharedContext?: Context): Promise<TPrice[]>;
|
67
|
+
protected createPriceSets_(data: PricingTypes.CreatePriceSetDTO[], sharedContext?: Context): Promise<PriceSet[]>;
|
68
|
+
protected addPrices_(input: AddPricesDTO[], sharedContext?: Context): Promise<Price[]>;
|
69
|
+
protected createPriceLists_(data: PricingTypes.CreatePriceListDTO[], sharedContext?: Context): Promise<PriceList[]>;
|
70
|
+
protected updatePriceLists_(data: PricingTypes.UpdatePriceListDTO[], sharedContext?: Context): Promise<PriceList[]>;
|
71
|
+
protected updatePriceListPrices_(data: PricingTypes.UpdatePriceListPricesDTO[], sharedContext?: Context): Promise<Price[]>;
|
83
72
|
protected removePrices_(ids: string[], sharedContext?: Context): Promise<void>;
|
84
|
-
protected addPriceListPrices_(data: PricingTypes.AddPriceListPricesDTO[], sharedContext?: Context): Promise<
|
85
|
-
protected setPriceListRules_(data: PricingTypes.SetPriceListRulesDTO[], sharedContext?: Context): Promise<
|
86
|
-
protected removePriceListRules_(data: PricingTypes.RemovePriceListRulesDTO[], sharedContext?: Context): Promise<
|
73
|
+
protected addPriceListPrices_(data: PricingTypes.AddPriceListPricesDTO[], sharedContext?: Context): Promise<Price[]>;
|
74
|
+
protected setPriceListRules_(data: PricingTypes.SetPriceListRulesDTO[], sharedContext?: Context): Promise<PriceList[]>;
|
75
|
+
protected removePriceListRules_(data: PricingTypes.RemovePriceListRulesDTO[], sharedContext?: Context): Promise<PriceList[]>;
|
76
|
+
protected normalizePriceListDate(data: (ServiceTypes.UpdatePriceListDTO | ServiceTypes.CreatePriceListDTO | CreatePriceListDTO)[]): any[];
|
77
|
+
protected normalizePriceSetConfig(config: FindConfig<PricingTypes.PriceSetDTO> | undefined): {
|
78
|
+
select?: string[] | undefined;
|
79
|
+
skip?: number | null | undefined;
|
80
|
+
take?: number | null | undefined;
|
81
|
+
relations?: string[] | undefined;
|
82
|
+
order?: {
|
83
|
+
[K: string]: "ASC" | "DESC";
|
84
|
+
} | undefined;
|
85
|
+
withDeleted?: boolean | undefined;
|
86
|
+
filters?: Record<string, any> | undefined;
|
87
|
+
options: Record<string, any>;
|
88
|
+
};
|
87
89
|
}
|
88
90
|
export {};
|