@medusajs/pricing 0.1.7 → 0.1.8-next-20240124093206
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/index.d.ts +3 -4
- package/dist/index.js +5 -3
- package/dist/loaders/container.d.ts +1 -3
- package/dist/loaders/container.js +8 -46
- package/dist/module-definition.d.ts +2 -0
- package/dist/module-definition.js +36 -1
- package/dist/repositories/index.d.ts +0 -11
- package/dist/repositories/index.js +1 -23
- package/dist/repositories/pricing.d.ts +1 -5
- package/dist/repositories/pricing.js +1 -2
- package/dist/scripts/bin/run-seed.js +0 -0
- package/dist/services/currency.d.ts +11 -11
- package/dist/services/currency.js +4 -90
- package/dist/services/money-amount.d.ts +11 -12
- package/dist/services/money-amount.js +4 -104
- package/dist/services/price-list-rule-value.d.ts +11 -10
- package/dist/services/price-list-rule-value.js +13 -83
- package/dist/services/price-list-rule.d.ts +13 -10
- package/dist/services/price-list-rule.js +28 -82
- package/dist/services/price-list.d.ts +10 -9
- package/dist/services/price-list.js +20 -81
- package/dist/services/price-rule.d.ts +10 -9
- package/dist/services/price-rule.js +13 -83
- package/dist/services/price-set-money-amount-rules.d.ts +10 -10
- package/dist/services/price-set-money-amount-rules.js +3 -87
- package/dist/services/price-set-money-amount.d.ts +11 -11
- package/dist/services/price-set-money-amount.js +4 -91
- package/dist/services/price-set-rule-type.d.ts +11 -11
- package/dist/services/price-set-rule-type.js +4 -89
- package/dist/services/price-set.d.ts +11 -10
- package/dist/services/price-set.js +4 -84
- package/dist/services/rule-type.d.ts +11 -7
- package/dist/services/rule-type.js +7 -53
- package/dist/types/repositories/index.d.ts +68 -0
- package/package.json +4 -6
- package/dist/repositories/currency.d.ts +0 -16
- package/dist/repositories/currency.js +0 -69
- package/dist/repositories/money-amount.d.ts +0 -16
- package/dist/repositories/money-amount.js +0 -69
- package/dist/repositories/price-list-rule-value.d.ts +0 -16
- package/dist/repositories/price-list-rule-value.js +0 -74
- package/dist/repositories/price-list-rule.d.ts +0 -16
- package/dist/repositories/price-list-rule.js +0 -84
- package/dist/repositories/price-list.d.ts +0 -16
- package/dist/repositories/price-list.js +0 -81
- package/dist/repositories/price-rule.d.ts +0 -16
- package/dist/repositories/price-rule.js +0 -76
- package/dist/repositories/price-set-money-amount-rules.d.ts +0 -16
- package/dist/repositories/price-set-money-amount-rules.js +0 -69
- package/dist/repositories/price-set-money-amount.d.ts +0 -16
- package/dist/repositories/price-set-money-amount.js +0 -66
- package/dist/repositories/price-set-rule-type.d.ts +0 -16
- package/dist/repositories/price-set-rule-type.js +0 -69
- package/dist/repositories/price-set.d.ts +0 -16
- package/dist/repositories/price-set.js +0 -69
- package/dist/repositories/rule-type.d.ts +0 -16
- package/dist/repositories/rule-type.js +0 -71
- package/dist/scripts/bin/run-migration-down.d.ts +0 -3
- package/dist/scripts/bin/run-migration-down.js +0 -32
- package/dist/scripts/bin/run-migration-up.d.ts +0 -3
- package/dist/scripts/bin/run-migration-up.js +0 -32
- package/dist/scripts/index.d.ts +0 -2
- package/dist/scripts/index.js +0 -18
- package/dist/scripts/migration-down.d.ts +0 -9
- package/dist/scripts/migration-down.js +0 -52
- package/dist/scripts/migration-up.d.ts +0 -9
- package/dist/scripts/migration-up.js +0 -56
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { moduleDefinition } from "./module-definition";
|
|
1
|
+
import { moduleDefinition, revertMigration, runMigrations } from "./module-definition";
|
|
2
2
|
export default moduleDefinition;
|
|
3
|
-
export
|
|
3
|
+
export { revertMigration, runMigrations };
|
|
4
4
|
export * from "./initialize";
|
|
5
|
-
export * from "./types";
|
|
6
|
-
export * from "./loaders";
|
|
7
5
|
export * from "./models";
|
|
8
6
|
export * from "./services";
|
|
7
|
+
export * from "./types";
|
package/dist/index.js
CHANGED
|
@@ -14,11 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.runMigrations = exports.revertMigration = void 0;
|
|
17
18
|
const module_definition_1 = require("./module-definition");
|
|
19
|
+
Object.defineProperty(exports, "revertMigration", { enumerable: true, get: function () { return module_definition_1.revertMigration; } });
|
|
20
|
+
Object.defineProperty(exports, "runMigrations", { enumerable: true, get: function () { return module_definition_1.runMigrations; } });
|
|
18
21
|
exports.default = module_definition_1.moduleDefinition;
|
|
19
|
-
__exportStar(require("./scripts"), exports);
|
|
20
22
|
__exportStar(require("./initialize"), exports);
|
|
21
|
-
|
|
22
|
-
__exportStar(require("./loaders"), exports);
|
|
23
|
+
// TODO: remove export from models and services
|
|
23
24
|
__exportStar(require("./models"), exports);
|
|
24
25
|
__exportStar(require("./services"), exports);
|
|
26
|
+
__exportStar(require("./types"), exports);
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { ModulesSdkTypes } from "@medusajs/types";
|
|
3
|
-
declare const _default: ({ container, options, }: LoaderOptions<ModulesSdkTypes.ModuleServiceInitializeOptions | ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions>) => Promise<void>;
|
|
1
|
+
declare const _default: ({ container, options }: import("@medusajs/types").LoaderOptions) => Promise<void>;
|
|
4
2
|
export default _default;
|
|
@@ -23,50 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const defaultRepositories = __importStar(require("../repositories"));
|
|
27
|
-
const defaultServices = __importStar(require("../services"));
|
|
28
26
|
const utils_1 = require("@medusajs/utils");
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
priceSetMoneyAmountRulesService: (0, awilix_1.asClass)(defaultServices.PriceSetMoneyAmountRulesService).singleton(),
|
|
38
|
-
priceRuleService: (0, awilix_1.asClass)(defaultServices.PriceRuleService).singleton(),
|
|
39
|
-
priceSetRuleTypeService: (0, awilix_1.asClass)(defaultServices.PriceSetRuleTypeService).singleton(),
|
|
40
|
-
priceSetMoneyAmountService: (0, awilix_1.asClass)(defaultServices.PriceSetMoneyAmountService).singleton(),
|
|
41
|
-
priceListService: (0, awilix_1.asClass)(defaultServices.PriceListService).singleton(),
|
|
42
|
-
priceListRuleService: (0, awilix_1.asClass)(defaultServices.PriceListRuleService).singleton(),
|
|
43
|
-
priceListRuleValueService: (0, awilix_1.asClass)(defaultServices.PriceListRuleValueService).singleton(),
|
|
44
|
-
});
|
|
45
|
-
if (customRepositories) {
|
|
46
|
-
(0, utils_1.loadCustomRepositories)({
|
|
47
|
-
defaultRepositories,
|
|
48
|
-
customRepositories,
|
|
49
|
-
container,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
loadDefaultRepositories({ container });
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
function loadDefaultRepositories({ container }) {
|
|
57
|
-
container.register({
|
|
58
|
-
baseRepository: (0, awilix_1.asClass)(defaultRepositories.BaseRepository).singleton(),
|
|
59
|
-
pricingRepository: (0, awilix_1.asClass)(defaultRepositories.PricingRepository).singleton(),
|
|
60
|
-
currencyRepository: (0, awilix_1.asClass)(defaultRepositories.CurrencyRepository).singleton(),
|
|
61
|
-
moneyAmountRepository: (0, awilix_1.asClass)(defaultRepositories.MoneyAmountRepository).singleton(),
|
|
62
|
-
priceSetRepository: (0, awilix_1.asClass)(defaultRepositories.PriceSetRepository).singleton(),
|
|
63
|
-
ruleTypeRepository: (0, awilix_1.asClass)(defaultRepositories.RuleTypeRepository).singleton(),
|
|
64
|
-
priceSetMoneyAmountRulesRepository: (0, awilix_1.asClass)(defaultRepositories.PriceSetMoneyAmountRulesRepository).singleton(),
|
|
65
|
-
priceRuleRepository: (0, awilix_1.asClass)(defaultRepositories.PriceRuleRepository).singleton(),
|
|
66
|
-
priceSetRuleTypeRepository: (0, awilix_1.asClass)(defaultRepositories.PriceSetRuleTypeRepository).singleton(),
|
|
67
|
-
priceSetMoneyAmountRepository: (0, awilix_1.asClass)(defaultRepositories.PriceSetMoneyAmountRepository).singleton(),
|
|
68
|
-
priceListRepository: (0, awilix_1.asClass)(defaultRepositories.PriceListRepository).singleton(),
|
|
69
|
-
priceListRuleRepository: (0, awilix_1.asClass)(defaultRepositories.PriceListRuleRepository).singleton(),
|
|
70
|
-
priceListRuleValueRepository: (0, awilix_1.asClass)(defaultRepositories.PriceListRuleValueRepository).singleton(),
|
|
71
|
-
});
|
|
72
|
-
}
|
|
27
|
+
const ModuleModels = __importStar(require("../models"));
|
|
28
|
+
const ModuleRepositories = __importStar(require("../repositories"));
|
|
29
|
+
const ModuleServices = __importStar(require("../services"));
|
|
30
|
+
exports.default = utils_1.ModulesSdkUtils.moduleContainerLoaderFactory({
|
|
31
|
+
moduleModels: ModuleModels,
|
|
32
|
+
moduleRepositories: ModuleRepositories,
|
|
33
|
+
moduleServices: ModuleServices,
|
|
34
|
+
});
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { ModuleExports } from "@medusajs/types";
|
|
2
|
+
export declare const runMigrations: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
|
|
3
|
+
export declare const revertMigration: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
|
|
2
4
|
export declare const moduleDefinition: ModuleExports;
|
|
@@ -1,15 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.moduleDefinition = void 0;
|
|
29
|
+
exports.moduleDefinition = exports.revertMigration = exports.runMigrations = void 0;
|
|
30
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
31
|
+
const utils_1 = require("@medusajs/utils");
|
|
32
|
+
const Models = __importStar(require("./models"));
|
|
7
33
|
const _services_1 = require("./services");
|
|
8
34
|
const connection_1 = __importDefault(require("./loaders/connection"));
|
|
9
35
|
const container_1 = __importDefault(require("./loaders/container"));
|
|
36
|
+
const migrationScriptOptions = {
|
|
37
|
+
moduleName: modules_sdk_1.Modules.PRICING,
|
|
38
|
+
models: Models,
|
|
39
|
+
pathToMigrations: __dirname + "/migrations",
|
|
40
|
+
};
|
|
41
|
+
exports.runMigrations = utils_1.ModulesSdkUtils.buildMigrationScript(migrationScriptOptions);
|
|
42
|
+
exports.revertMigration = utils_1.ModulesSdkUtils.buildRevertMigrationScript(migrationScriptOptions);
|
|
10
43
|
const service = _services_1.PricingModuleService;
|
|
11
44
|
const loaders = [container_1.default, connection_1.default];
|
|
12
45
|
exports.moduleDefinition = {
|
|
13
46
|
service,
|
|
14
47
|
loaders,
|
|
48
|
+
runMigrations: exports.runMigrations,
|
|
49
|
+
revertMigration: exports.revertMigration,
|
|
15
50
|
};
|
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
export { MikroOrmBaseRepository as BaseRepository } from "@medusajs/utils";
|
|
2
|
-
export { CurrencyRepository } from "./currency";
|
|
3
|
-
export { MoneyAmountRepository } from "./money-amount";
|
|
4
|
-
export { PriceListRepository } from "./price-list";
|
|
5
|
-
export { PriceListRuleRepository } from "./price-list-rule";
|
|
6
|
-
export { PriceListRuleValueRepository } from "./price-list-rule-value";
|
|
7
|
-
export { PriceRuleRepository } from "./price-rule";
|
|
8
|
-
export { PriceSetRepository } from "./price-set";
|
|
9
|
-
export { PriceSetMoneyAmountRepository } from "./price-set-money-amount";
|
|
10
|
-
export { PriceSetMoneyAmountRulesRepository } from "./price-set-money-amount-rules";
|
|
11
|
-
export { PriceSetRuleTypeRepository } from "./price-set-rule-type";
|
|
12
2
|
export { PricingRepository } from "./pricing";
|
|
13
|
-
export { RuleTypeRepository } from "./rule-type";
|
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PricingRepository = exports.BaseRepository = void 0;
|
|
4
4
|
var utils_1 = require("@medusajs/utils");
|
|
5
5
|
Object.defineProperty(exports, "BaseRepository", { enumerable: true, get: function () { return utils_1.MikroOrmBaseRepository; } });
|
|
6
|
-
var currency_1 = require("./currency");
|
|
7
|
-
Object.defineProperty(exports, "CurrencyRepository", { enumerable: true, get: function () { return currency_1.CurrencyRepository; } });
|
|
8
|
-
var money_amount_1 = require("./money-amount");
|
|
9
|
-
Object.defineProperty(exports, "MoneyAmountRepository", { enumerable: true, get: function () { return money_amount_1.MoneyAmountRepository; } });
|
|
10
|
-
var price_list_1 = require("./price-list");
|
|
11
|
-
Object.defineProperty(exports, "PriceListRepository", { enumerable: true, get: function () { return price_list_1.PriceListRepository; } });
|
|
12
|
-
var price_list_rule_1 = require("./price-list-rule");
|
|
13
|
-
Object.defineProperty(exports, "PriceListRuleRepository", { enumerable: true, get: function () { return price_list_rule_1.PriceListRuleRepository; } });
|
|
14
|
-
var price_list_rule_value_1 = require("./price-list-rule-value");
|
|
15
|
-
Object.defineProperty(exports, "PriceListRuleValueRepository", { enumerable: true, get: function () { return price_list_rule_value_1.PriceListRuleValueRepository; } });
|
|
16
|
-
var price_rule_1 = require("./price-rule");
|
|
17
|
-
Object.defineProperty(exports, "PriceRuleRepository", { enumerable: true, get: function () { return price_rule_1.PriceRuleRepository; } });
|
|
18
|
-
var price_set_1 = require("./price-set");
|
|
19
|
-
Object.defineProperty(exports, "PriceSetRepository", { enumerable: true, get: function () { return price_set_1.PriceSetRepository; } });
|
|
20
|
-
var price_set_money_amount_1 = require("./price-set-money-amount");
|
|
21
|
-
Object.defineProperty(exports, "PriceSetMoneyAmountRepository", { enumerable: true, get: function () { return price_set_money_amount_1.PriceSetMoneyAmountRepository; } });
|
|
22
|
-
var price_set_money_amount_rules_1 = require("./price-set-money-amount-rules");
|
|
23
|
-
Object.defineProperty(exports, "PriceSetMoneyAmountRulesRepository", { enumerable: true, get: function () { return price_set_money_amount_rules_1.PriceSetMoneyAmountRulesRepository; } });
|
|
24
|
-
var price_set_rule_type_1 = require("./price-set-rule-type");
|
|
25
|
-
Object.defineProperty(exports, "PriceSetRuleTypeRepository", { enumerable: true, get: function () { return price_set_rule_type_1.PriceSetRuleTypeRepository; } });
|
|
26
6
|
var pricing_1 = require("./pricing");
|
|
27
7
|
Object.defineProperty(exports, "PricingRepository", { enumerable: true, get: function () { return pricing_1.PricingRepository; } });
|
|
28
|
-
var rule_type_1 = require("./rule-type");
|
|
29
|
-
Object.defineProperty(exports, "RuleTypeRepository", { enumerable: true, get: function () { return rule_type_1.RuleTypeRepository; } });
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { MikroOrmBase } from "@medusajs/utils";
|
|
2
2
|
import { CalculatedPriceSetDTO, Context, PricingContext, PricingFilters, PricingRepositoryService } from "@medusajs/types";
|
|
3
|
-
import { SqlEntityManager } from "@mikro-orm/postgresql";
|
|
4
3
|
export declare class PricingRepository extends MikroOrmBase implements PricingRepositoryService {
|
|
5
|
-
|
|
6
|
-
constructor({ manager }: {
|
|
7
|
-
manager: SqlEntityManager;
|
|
8
|
-
});
|
|
4
|
+
constructor();
|
|
9
5
|
calculatePrices(pricingFilters: PricingFilters, pricingContext?: PricingContext, sharedContext?: Context): Promise<CalculatedPriceSetDTO[]>;
|
|
10
6
|
}
|
|
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PricingRepository = void 0;
|
|
4
4
|
const utils_1 = require("@medusajs/utils");
|
|
5
5
|
class PricingRepository extends utils_1.MikroOrmBase {
|
|
6
|
-
constructor(
|
|
6
|
+
constructor() {
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
// eslint-disable-next-line prefer-rest-params
|
|
9
9
|
super(...arguments);
|
|
10
|
-
this.manager_ = manager;
|
|
11
10
|
}
|
|
12
11
|
async calculatePrices(pricingFilters, pricingContext = { context: {} }, sharedContext = {}) {
|
|
13
12
|
const manager = this.getActiveManager(sharedContext);
|
|
File without changes
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { ModulesSdkUtils } from "@medusajs/utils";
|
|
2
3
|
import { Currency } from "../models";
|
|
3
4
|
import { ServiceTypes } from "../types";
|
|
4
5
|
type InjectedDependencies = {
|
|
5
6
|
currencyRepository: DAL.RepositoryService;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
list
|
|
12
|
-
listAndCount
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
delete(ids: string[], sharedContext?: Context): Promise<void>;
|
|
8
|
+
declare const CurrencyService_base: new <TEntity_1 extends object = any>(container: InjectedDependencies) => ModulesSdkUtils.AbstractService<TEntity_1, InjectedDependencies, {
|
|
9
|
+
create: ServiceTypes.CreateCurrencyDTO;
|
|
10
|
+
update: ServiceTypes.UpdateCurrencyDTO;
|
|
11
|
+
}, {
|
|
12
|
+
list?: any;
|
|
13
|
+
listAndCount?: any;
|
|
14
|
+
}>;
|
|
15
|
+
export default class CurrencyService<TEntity extends Currency = Currency> extends CurrencyService_base<TEntity> {
|
|
16
|
+
constructor(container: InjectedDependencies);
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -1,97 +1,11 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
const utils_1 = require("@medusajs/utils");
|
|
16
4
|
const _models_1 = require("../models");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
async retrieve(currencyCode, config = {}, sharedContext = {}) {
|
|
23
|
-
return (await (0, utils_1.retrieveEntity)({
|
|
24
|
-
id: currencyCode,
|
|
25
|
-
identifierColumn: "code",
|
|
26
|
-
entityName: _models_1.Currency.name,
|
|
27
|
-
repository: this.currencyRepository_,
|
|
28
|
-
config,
|
|
29
|
-
sharedContext,
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
async list(filters = {}, config = {}, sharedContext = {}) {
|
|
33
|
-
return (await this.currencyRepository_.find(this.buildQueryForList(filters, config), sharedContext));
|
|
34
|
-
}
|
|
35
|
-
async listAndCount(filters = {}, config = {}, sharedContext = {}) {
|
|
36
|
-
return (await this.currencyRepository_.findAndCount(this.buildQueryForList(filters, config), sharedContext));
|
|
37
|
-
}
|
|
38
|
-
buildQueryForList(filters = {}, config = {}) {
|
|
39
|
-
const queryOptions = utils_1.ModulesSdkUtils.buildQuery(filters, config);
|
|
40
|
-
if (filters.code) {
|
|
41
|
-
queryOptions.where["code"] = { $in: filters.code };
|
|
42
|
-
}
|
|
43
|
-
return queryOptions;
|
|
44
|
-
}
|
|
45
|
-
async create(data, sharedContext = {}) {
|
|
46
|
-
return (await this.currencyRepository_.create(data, sharedContext));
|
|
47
|
-
}
|
|
48
|
-
async update(data, sharedContext = {}) {
|
|
49
|
-
return (await this.currencyRepository_.update(data, sharedContext));
|
|
50
|
-
}
|
|
51
|
-
async delete(ids, sharedContext = {}) {
|
|
52
|
-
await this.currencyRepository_.delete(ids, sharedContext);
|
|
5
|
+
class CurrencyService extends utils_1.ModulesSdkUtils.abstractServiceFactory(_models_1.Currency) {
|
|
6
|
+
constructor(container) {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
super(...arguments);
|
|
53
9
|
}
|
|
54
10
|
}
|
|
55
11
|
exports.default = CurrencyService;
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, utils_1.InjectManager)("currencyRepository_"),
|
|
58
|
-
__param(2, (0, utils_1.MedusaContext)()),
|
|
59
|
-
__metadata("design:type", Function),
|
|
60
|
-
__metadata("design:paramtypes", [String, Object, Object]),
|
|
61
|
-
__metadata("design:returntype", Promise)
|
|
62
|
-
], CurrencyService.prototype, "retrieve", null);
|
|
63
|
-
__decorate([
|
|
64
|
-
(0, utils_1.InjectManager)("currencyRepository_"),
|
|
65
|
-
__param(2, (0, utils_1.MedusaContext)()),
|
|
66
|
-
__metadata("design:type", Function),
|
|
67
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
68
|
-
__metadata("design:returntype", Promise)
|
|
69
|
-
], CurrencyService.prototype, "list", null);
|
|
70
|
-
__decorate([
|
|
71
|
-
(0, utils_1.InjectManager)("currencyRepository_"),
|
|
72
|
-
__param(2, (0, utils_1.MedusaContext)()),
|
|
73
|
-
__metadata("design:type", Function),
|
|
74
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
75
|
-
__metadata("design:returntype", Promise)
|
|
76
|
-
], CurrencyService.prototype, "listAndCount", null);
|
|
77
|
-
__decorate([
|
|
78
|
-
(0, utils_1.InjectTransactionManager)("currencyRepository_"),
|
|
79
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
|
80
|
-
__metadata("design:type", Function),
|
|
81
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
82
|
-
__metadata("design:returntype", Promise)
|
|
83
|
-
], CurrencyService.prototype, "create", null);
|
|
84
|
-
__decorate([
|
|
85
|
-
(0, utils_1.InjectTransactionManager)("currencyRepository_"),
|
|
86
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
|
87
|
-
__metadata("design:type", Function),
|
|
88
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
89
|
-
__metadata("design:returntype", Promise)
|
|
90
|
-
], CurrencyService.prototype, "update", null);
|
|
91
|
-
__decorate([
|
|
92
|
-
(0, utils_1.InjectTransactionManager)("currencyRepository_"),
|
|
93
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
|
94
|
-
__metadata("design:type", Function),
|
|
95
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
96
|
-
__metadata("design:returntype", Promise)
|
|
97
|
-
], CurrencyService.prototype, "delete", null);
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { ModulesSdkUtils } from "@medusajs/utils";
|
|
2
3
|
import { MoneyAmount } from "../models";
|
|
3
4
|
import { ServiceTypes } from "../types";
|
|
4
5
|
type InjectedDependencies = {
|
|
5
6
|
moneyAmountRepository: DAL.RepositoryService;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
list
|
|
12
|
-
listAndCount
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
softDelete(ids: string[], sharedContext?: Context): Promise<void>;
|
|
17
|
-
restore(ids: string[], sharedContext?: Context): Promise<[TEntity[], Record<string, unknown[]>]>;
|
|
8
|
+
declare const MoneyAmountService_base: new <TEntity_1 extends object = any>(container: InjectedDependencies) => ModulesSdkUtils.AbstractService<TEntity_1, InjectedDependencies, {
|
|
9
|
+
create: ServiceTypes.CreateMoneyAmountDTO;
|
|
10
|
+
update: ServiceTypes.UpdateMoneyAmountDTO;
|
|
11
|
+
}, {
|
|
12
|
+
list: ServiceTypes.FilterableMoneyAmountProps;
|
|
13
|
+
listAndCount: ServiceTypes.FilterableMoneyAmountProps;
|
|
14
|
+
}>;
|
|
15
|
+
export default class MoneyAmountService<TEntity extends MoneyAmount = MoneyAmount> extends MoneyAmountService_base<TEntity> {
|
|
16
|
+
constructor(container: InjectedDependencies);
|
|
18
17
|
}
|
|
19
18
|
export {};
|
|
@@ -1,111 +1,11 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
const utils_1 = require("@medusajs/utils");
|
|
16
4
|
const _models_1 = require("../models");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
async retrieve(moneyAmountId, config = {}, sharedContext = {}) {
|
|
23
|
-
return (await (0, utils_1.retrieveEntity)({
|
|
24
|
-
id: moneyAmountId,
|
|
25
|
-
entityName: _models_1.MoneyAmount.name,
|
|
26
|
-
repository: this.moneyAmountRepository_,
|
|
27
|
-
config,
|
|
28
|
-
sharedContext,
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
async list(filters = {}, config = {}, sharedContext = {}) {
|
|
32
|
-
const queryOptions = utils_1.ModulesSdkUtils.buildQuery(filters, config);
|
|
33
|
-
return (await this.moneyAmountRepository_.find(queryOptions, sharedContext));
|
|
34
|
-
}
|
|
35
|
-
async listAndCount(filters = {}, config = {}, sharedContext = {}) {
|
|
36
|
-
const queryOptions = utils_1.ModulesSdkUtils.buildQuery(filters, config);
|
|
37
|
-
return (await this.moneyAmountRepository_.findAndCount(queryOptions, sharedContext));
|
|
38
|
-
}
|
|
39
|
-
async create(data, sharedContext = {}) {
|
|
40
|
-
return (await this.moneyAmountRepository_.create(data, sharedContext));
|
|
41
|
-
}
|
|
42
|
-
async update(data, sharedContext = {}) {
|
|
43
|
-
return (await this.moneyAmountRepository_.update(data, sharedContext));
|
|
44
|
-
}
|
|
45
|
-
async delete(ids, sharedContext = {}) {
|
|
46
|
-
await this.moneyAmountRepository_.delete(ids, sharedContext);
|
|
47
|
-
}
|
|
48
|
-
async softDelete(ids, sharedContext = {}) {
|
|
49
|
-
await this.moneyAmountRepository_.softDelete(ids, sharedContext);
|
|
50
|
-
}
|
|
51
|
-
async restore(ids, sharedContext = {}) {
|
|
52
|
-
return await this.moneyAmountRepository_.restore(ids, sharedContext);
|
|
5
|
+
class MoneyAmountService extends utils_1.ModulesSdkUtils.abstractServiceFactory(_models_1.MoneyAmount) {
|
|
6
|
+
constructor(container) {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
super(...arguments);
|
|
53
9
|
}
|
|
54
10
|
}
|
|
55
11
|
exports.default = MoneyAmountService;
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, utils_1.InjectManager)("moneyAmountRepository_"),
|
|
58
|
-
__param(2, (0, utils_1.MedusaContext)()),
|
|
59
|
-
__metadata("design:type", Function),
|
|
60
|
-
__metadata("design:paramtypes", [String, Object, Object]),
|
|
61
|
-
__metadata("design:returntype", Promise)
|
|
62
|
-
], MoneyAmountService.prototype, "retrieve", null);
|
|
63
|
-
__decorate([
|
|
64
|
-
(0, utils_1.InjectManager)("moneyAmountRepository_"),
|
|
65
|
-
__param(2, (0, utils_1.MedusaContext)()),
|
|
66
|
-
__metadata("design:type", Function),
|
|
67
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
68
|
-
__metadata("design:returntype", Promise)
|
|
69
|
-
], MoneyAmountService.prototype, "list", null);
|
|
70
|
-
__decorate([
|
|
71
|
-
(0, utils_1.InjectManager)("moneyAmountRepository_"),
|
|
72
|
-
__param(2, (0, utils_1.MedusaContext)()),
|
|
73
|
-
__metadata("design:type", Function),
|
|
74
|
-
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
75
|
-
__metadata("design:returntype", Promise)
|
|
76
|
-
], MoneyAmountService.prototype, "listAndCount", null);
|
|
77
|
-
__decorate([
|
|
78
|
-
(0, utils_1.InjectTransactionManager)("moneyAmountRepository_"),
|
|
79
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
|
80
|
-
__metadata("design:type", Function),
|
|
81
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
82
|
-
__metadata("design:returntype", Promise)
|
|
83
|
-
], MoneyAmountService.prototype, "create", null);
|
|
84
|
-
__decorate([
|
|
85
|
-
(0, utils_1.InjectTransactionManager)("moneyAmountRepository_"),
|
|
86
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
|
87
|
-
__metadata("design:type", Function),
|
|
88
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
89
|
-
__metadata("design:returntype", Promise)
|
|
90
|
-
], MoneyAmountService.prototype, "update", null);
|
|
91
|
-
__decorate([
|
|
92
|
-
(0, utils_1.InjectTransactionManager)("moneyAmountRepository_"),
|
|
93
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
|
94
|
-
__metadata("design:type", Function),
|
|
95
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
96
|
-
__metadata("design:returntype", Promise)
|
|
97
|
-
], MoneyAmountService.prototype, "delete", null);
|
|
98
|
-
__decorate([
|
|
99
|
-
(0, utils_1.InjectTransactionManager)("moneyAmountRepository_"),
|
|
100
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
|
101
|
-
__metadata("design:type", Function),
|
|
102
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
103
|
-
__metadata("design:returntype", Promise)
|
|
104
|
-
], MoneyAmountService.prototype, "softDelete", null);
|
|
105
|
-
__decorate([
|
|
106
|
-
(0, utils_1.InjectTransactionManager)("moneyAmountRepository_"),
|
|
107
|
-
__param(1, (0, utils_1.MedusaContext)()),
|
|
108
|
-
__metadata("design:type", Function),
|
|
109
|
-
__metadata("design:paramtypes", [Array, Object]),
|
|
110
|
-
__metadata("design:returntype", Promise)
|
|
111
|
-
], MoneyAmountService.prototype, "restore", null);
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { Context, DAL
|
|
1
|
+
import { Context, DAL } from "@medusajs/types";
|
|
2
|
+
import { ModulesSdkUtils } from "@medusajs/utils";
|
|
2
3
|
import { PriceListRuleValue } from "../models";
|
|
3
4
|
import { ServiceTypes } from "../types";
|
|
4
5
|
type InjectedDependencies = {
|
|
5
6
|
priceListRuleValueRepository: DAL.RepositoryService;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
declare const PriceListRuleValueService_base: new <TEntity_1 extends object = any>(container: InjectedDependencies) => ModulesSdkUtils.AbstractService<TEntity_1, InjectedDependencies, {
|
|
9
|
+
update: ServiceTypes.UpdatePriceListRuleValueDTO;
|
|
10
|
+
}, {
|
|
11
|
+
list: ServiceTypes.FilterablePriceListRuleValueProps;
|
|
12
|
+
listAndCount: ServiceTypes.FilterablePriceListRuleValueProps;
|
|
13
|
+
}>;
|
|
14
|
+
export default class PriceListRuleValueService<TEntity extends PriceListRuleValue = PriceListRuleValue> extends PriceListRuleValueService_base<TEntity> {
|
|
15
|
+
constructor(container: InjectedDependencies);
|
|
16
|
+
create(data: ServiceTypes.CreatePriceListRuleValueDTO[], context?: Context): Promise<TEntity[]>;
|
|
16
17
|
}
|
|
17
18
|
export {};
|