@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
@@ -1,34 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const utils_1 = require("@medusajs/utils");
|
4
|
-
const _models_1 = require("../models");
|
5
|
-
class PriceListService extends utils_1.ModulesSdkUtils.internalModuleServiceFactory(_models_1.PriceList) {
|
6
|
-
constructor(container) {
|
7
|
-
// @ts-ignore
|
8
|
-
super(...arguments);
|
9
|
-
}
|
10
|
-
async create(data, sharedContext) {
|
11
|
-
const data_ = Array.isArray(data) ? data : [data];
|
12
|
-
const priceLists = this.normalizePriceListDate(data_);
|
13
|
-
return await super.create(priceLists, sharedContext);
|
14
|
-
}
|
15
|
-
// TODO: Add support for selector? and then rm ts ignore
|
16
|
-
// @ts-ignore
|
17
|
-
async update(data, sharedContext) {
|
18
|
-
const data_ = Array.isArray(data) ? data : [data];
|
19
|
-
const priceLists = this.normalizePriceListDate(data_);
|
20
|
-
return await super.update(priceLists, sharedContext);
|
21
|
-
}
|
22
|
-
normalizePriceListDate(data) {
|
23
|
-
return data.map((priceListData) => {
|
24
|
-
if (!!priceListData.starts_at) {
|
25
|
-
priceListData.starts_at = (0, utils_1.GetIsoStringFromDate)(priceListData.starts_at);
|
26
|
-
}
|
27
|
-
if (!!priceListData.ends_at) {
|
28
|
-
priceListData.ends_at = (0, utils_1.GetIsoStringFromDate)(priceListData.ends_at);
|
29
|
-
}
|
30
|
-
return priceListData;
|
31
|
-
});
|
32
|
-
}
|
33
|
-
}
|
34
|
-
exports.default = PriceListService;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { Context, DAL, PricingTypes } from "@medusajs/types";
|
2
|
-
import { RuleType } from "../models";
|
3
|
-
type InjectedDependencies = {
|
4
|
-
ruleTypeRepository: DAL.RepositoryService;
|
5
|
-
};
|
6
|
-
declare const RuleTypeService_base: new <TEntity_1 extends object = any>(container: InjectedDependencies) => import("@medusajs/types").InternalModuleService<TEntity_1, InjectedDependencies>;
|
7
|
-
export default class RuleTypeService<TEntity extends RuleType = RuleType> extends RuleTypeService_base<TEntity> {
|
8
|
-
protected readonly ruleTypeRepository_: DAL.RepositoryService<TEntity>;
|
9
|
-
constructor({ ruleTypeRepository }: InjectedDependencies);
|
10
|
-
create(data: PricingTypes.CreateRuleTypeDTO, sharedContext: Context): Promise<TEntity>;
|
11
|
-
create(data: PricingTypes.CreateRuleTypeDTO[], sharedContext: Context): Promise<TEntity[]>;
|
12
|
-
update(data: PricingTypes.UpdateRuleTypeDTO[], sharedContext: Context): Promise<TEntity[]>;
|
13
|
-
update(data: PricingTypes.UpdateRuleTypeDTO, sharedContext: Context): Promise<TEntity>;
|
14
|
-
}
|
15
|
-
export {};
|
@@ -1,53 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7
|
-
};
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
|
-
};
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
13
|
-
};
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
-
const utils_1 = require("@medusajs/utils");
|
16
|
-
const _models_1 = require("../models");
|
17
|
-
class RuleTypeService extends utils_1.ModulesSdkUtils.internalModuleServiceFactory(_models_1.RuleType) {
|
18
|
-
constructor({ ruleTypeRepository }) {
|
19
|
-
// @ts-ignore
|
20
|
-
super(...arguments);
|
21
|
-
this.ruleTypeRepository_ = ruleTypeRepository;
|
22
|
-
}
|
23
|
-
async create(data, sharedContext = {}) {
|
24
|
-
const data_ = Array.isArray(data) ? data : [data];
|
25
|
-
(0, utils_1.validateRuleAttributes)(data_.map((d) => d.rule_attribute));
|
26
|
-
return await super.create(data, sharedContext);
|
27
|
-
}
|
28
|
-
// TODO: add support for selector? and then rm ts ignore
|
29
|
-
// @ts-ignore
|
30
|
-
async update(data, sharedContext = {}) {
|
31
|
-
const data_ = Array.isArray(data) ? data : [data];
|
32
|
-
(0, utils_1.validateRuleAttributes)(data_.map((d) => d.rule_attribute));
|
33
|
-
return await super.update(data, sharedContext);
|
34
|
-
}
|
35
|
-
}
|
36
|
-
exports.default = RuleTypeService;
|
37
|
-
__decorate([
|
38
|
-
(0, utils_1.InjectTransactionManager)("ruleTypeRepository_"),
|
39
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
40
|
-
__metadata("design:type", Function),
|
41
|
-
__metadata("design:paramtypes", [Object, Object]),
|
42
|
-
__metadata("design:returntype", Promise)
|
43
|
-
], RuleTypeService.prototype, "create", null);
|
44
|
-
__decorate([
|
45
|
-
(0, utils_1.InjectTransactionManager)("ruleTypeRepository_")
|
46
|
-
// TODO: add support for selector? and then rm ts ignore
|
47
|
-
// @ts-ignore
|
48
|
-
,
|
49
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
50
|
-
__metadata("design:type", Function),
|
51
|
-
__metadata("design:paramtypes", [Object, Object]),
|
52
|
-
__metadata("design:returntype", Promise)
|
53
|
-
], RuleTypeService.prototype, "update", null);
|