@medusajs/customer 0.0.1
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/README.md +8 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +22 -0
- package/dist/initialize/index.d.ts +4 -0
- package/dist/initialize/index.js +16 -0
- package/dist/joiner-config.d.ts +7 -0
- package/dist/joiner-config.js +28 -0
- package/dist/loaders/connection.d.ts +4 -0
- package/dist/loaders/connection.js +41 -0
- package/dist/loaders/container.d.ts +2 -0
- package/dist/loaders/container.js +33 -0
- package/dist/loaders/index.d.ts +2 -0
- package/dist/loaders/index.js +18 -0
- package/dist/models/address.d.ts +26 -0
- package/dist/models/address.js +130 -0
- package/dist/models/customer-group-customer.d.ts +20 -0
- package/dist/models/customer-group-customer.js +101 -0
- package/dist/models/customer-group.d.ts +17 -0
- package/dist/models/customer-group.js +88 -0
- package/dist/models/customer.d.ts +28 -0
- package/dist/models/customer.js +148 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +14 -0
- package/dist/module-definition.d.ts +4 -0
- package/dist/module-definition.js +50 -0
- package/dist/scripts/bin/run-seed.d.ts +3 -0
- package/dist/scripts/bin/run-seed.js +38 -0
- package/dist/scripts/seed.d.ts +4 -0
- package/dist/scripts/seed.js +54 -0
- package/dist/services/address.d.ts +18 -0
- package/dist/services/address.js +11 -0
- package/dist/services/customer-group-customer.d.ts +21 -0
- package/dist/services/customer-group-customer.js +11 -0
- package/dist/services/customer-group.d.ts +18 -0
- package/dist/services/customer-group.js +11 -0
- package/dist/services/customer-module.d.ts +46 -0
- package/dist/services/customer-module.js +253 -0
- package/dist/services/customer.d.ts +17 -0
- package/dist/services/customer.js +11 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.js +16 -0
- package/dist/types/address.d.ts +27 -0
- package/dist/types/address.js +2 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +17 -0
- package/package.json +61 -0
|
@@ -0,0 +1,148 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const utils_1 = require("@medusajs/utils");
|
|
16
|
+
const core_1 = require("@mikro-orm/core");
|
|
17
|
+
const customer_group_1 = __importDefault(require("./customer-group"));
|
|
18
|
+
const customer_group_customer_1 = __importDefault(require("./customer-group-customer"));
|
|
19
|
+
const address_1 = __importDefault(require("./address"));
|
|
20
|
+
let Customer = class Customer {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.company_name = null;
|
|
23
|
+
this.first_name = null;
|
|
24
|
+
this.last_name = null;
|
|
25
|
+
this.email = null;
|
|
26
|
+
this.phone = null;
|
|
27
|
+
this.default_shipping_address_id = null;
|
|
28
|
+
this.default_billing_address_id = null;
|
|
29
|
+
this.metadata = null;
|
|
30
|
+
this.groups = new core_1.Collection(this);
|
|
31
|
+
this.addresses = new core_1.Collection(this);
|
|
32
|
+
this.deleted_at = null;
|
|
33
|
+
this.created_by = null;
|
|
34
|
+
}
|
|
35
|
+
onCreate() {
|
|
36
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "cus");
|
|
37
|
+
}
|
|
38
|
+
onInit() {
|
|
39
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "cus");
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, core_1.PrimaryKey)({ columnType: "text" }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], Customer.prototype, "id", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], Customer.prototype, "company_name", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
52
|
+
__metadata("design:type", Object)
|
|
53
|
+
], Customer.prototype, "first_name", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
56
|
+
__metadata("design:type", Object)
|
|
57
|
+
], Customer.prototype, "last_name", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], Customer.prototype, "email", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
64
|
+
__metadata("design:type", Object)
|
|
65
|
+
], Customer.prototype, "phone", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, core_1.Index)({ name: "IDX_customer_default_shipping_address_id" }),
|
|
68
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
69
|
+
__metadata("design:type", Object)
|
|
70
|
+
], Customer.prototype, "default_shipping_address_id", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, core_1.ManyToOne)(() => address_1.default, {
|
|
73
|
+
fieldName: "default_shipping_address_id",
|
|
74
|
+
nullable: true,
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], Customer.prototype, "default_shipping_address", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, core_1.Index)({ name: "IDX_customer_default_billing_address_id" }),
|
|
80
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], Customer.prototype, "default_billing_address_id", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, core_1.ManyToOne)(() => address_1.default, {
|
|
85
|
+
fieldName: "default_billing_address_id",
|
|
86
|
+
nullable: true,
|
|
87
|
+
}),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], Customer.prototype, "default_billing_address", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, core_1.Property)({ columnType: "jsonb", nullable: true }),
|
|
92
|
+
__metadata("design:type", Object)
|
|
93
|
+
], Customer.prototype, "metadata", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, core_1.ManyToMany)({
|
|
96
|
+
mappedBy: "customers",
|
|
97
|
+
entity: () => customer_group_1.default,
|
|
98
|
+
pivotEntity: () => customer_group_customer_1.default,
|
|
99
|
+
}),
|
|
100
|
+
__metadata("design:type", Object)
|
|
101
|
+
], Customer.prototype, "groups", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, core_1.OneToMany)(() => address_1.default, (address) => address.customer, {
|
|
104
|
+
cascade: [core_1.Cascade.REMOVE],
|
|
105
|
+
}),
|
|
106
|
+
__metadata("design:type", Object)
|
|
107
|
+
], Customer.prototype, "addresses", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, core_1.Property)({
|
|
110
|
+
onCreate: () => new Date(),
|
|
111
|
+
columnType: "timestamptz",
|
|
112
|
+
defaultRaw: "now()",
|
|
113
|
+
}),
|
|
114
|
+
__metadata("design:type", Date)
|
|
115
|
+
], Customer.prototype, "created_at", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, core_1.Property)({
|
|
118
|
+
onCreate: () => new Date(),
|
|
119
|
+
onUpdate: () => new Date(),
|
|
120
|
+
columnType: "timestamptz",
|
|
121
|
+
defaultRaw: "now()",
|
|
122
|
+
}),
|
|
123
|
+
__metadata("design:type", Date)
|
|
124
|
+
], Customer.prototype, "updated_at", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
(0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
|
|
127
|
+
__metadata("design:type", Object)
|
|
128
|
+
], Customer.prototype, "deleted_at", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
131
|
+
__metadata("design:type", Object)
|
|
132
|
+
], Customer.prototype, "created_by", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, core_1.BeforeCreate)(),
|
|
135
|
+
__metadata("design:type", Function),
|
|
136
|
+
__metadata("design:paramtypes", []),
|
|
137
|
+
__metadata("design:returntype", void 0)
|
|
138
|
+
], Customer.prototype, "onCreate", null);
|
|
139
|
+
__decorate([
|
|
140
|
+
(0, core_1.OnInit)(),
|
|
141
|
+
__metadata("design:type", Function),
|
|
142
|
+
__metadata("design:paramtypes", []),
|
|
143
|
+
__metadata("design:returntype", void 0)
|
|
144
|
+
], Customer.prototype, "onInit", null);
|
|
145
|
+
Customer = __decorate([
|
|
146
|
+
(0, core_1.Entity)({ tableName: "customer" })
|
|
147
|
+
], Customer);
|
|
148
|
+
exports.default = Customer;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CustomerGroupCustomer = exports.CustomerGroup = exports.Customer = exports.Address = void 0;
|
|
7
|
+
var address_1 = require("./address");
|
|
8
|
+
Object.defineProperty(exports, "Address", { enumerable: true, get: function () { return __importDefault(address_1).default; } });
|
|
9
|
+
var customer_1 = require("./customer");
|
|
10
|
+
Object.defineProperty(exports, "Customer", { enumerable: true, get: function () { return __importDefault(customer_1).default; } });
|
|
11
|
+
var customer_group_1 = require("./customer-group");
|
|
12
|
+
Object.defineProperty(exports, "CustomerGroup", { enumerable: true, get: function () { return __importDefault(customer_group_1).default; } });
|
|
13
|
+
var customer_group_customer_1 = require("./customer-group-customer");
|
|
14
|
+
Object.defineProperty(exports, "CustomerGroupCustomer", { enumerable: true, get: function () { return __importDefault(customer_group_customer_1).default; } });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ModuleExports } from "@medusajs/types";
|
|
2
|
+
export declare const revertMigration: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
|
|
3
|
+
export declare const runMigrations: ({ options, logger, }?: Pick<import("@medusajs/modules-sdk").LoaderOptions<import("@medusajs/modules-sdk").ModuleServiceInitializeOptions>, "options" | "logger"> | undefined) => Promise<void>;
|
|
4
|
+
export declare const moduleDefinition: ModuleExports;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.moduleDefinition = exports.runMigrations = exports.revertMigration = void 0;
|
|
30
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
31
|
+
const utils_1 = require("@medusajs/utils");
|
|
32
|
+
const Models = __importStar(require("./models"));
|
|
33
|
+
const _services_1 = require("./services");
|
|
34
|
+
const connection_1 = __importDefault(require("./loaders/connection"));
|
|
35
|
+
const container_1 = __importDefault(require("./loaders/container"));
|
|
36
|
+
const migrationScriptOptions = {
|
|
37
|
+
moduleName: modules_sdk_1.Modules.CUSTOMER,
|
|
38
|
+
models: Models,
|
|
39
|
+
pathToMigrations: __dirname + "/migrations",
|
|
40
|
+
};
|
|
41
|
+
exports.revertMigration = utils_1.ModulesSdkUtils.buildRevertMigrationScript(migrationScriptOptions);
|
|
42
|
+
exports.runMigrations = utils_1.ModulesSdkUtils.buildMigrationScript(migrationScriptOptions);
|
|
43
|
+
const service = _services_1.CustomerModuleService;
|
|
44
|
+
const loaders = [container_1.default, connection_1.default];
|
|
45
|
+
exports.moduleDefinition = {
|
|
46
|
+
service,
|
|
47
|
+
loaders,
|
|
48
|
+
runMigrations: exports.runMigrations,
|
|
49
|
+
revertMigration: exports.revertMigration,
|
|
50
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
const os_1 = require("os");
|
|
28
|
+
const seed_1 = require("../seed");
|
|
29
|
+
const args = process.argv;
|
|
30
|
+
const path = args.pop();
|
|
31
|
+
exports.default = (async () => {
|
|
32
|
+
const { config } = await Promise.resolve().then(() => __importStar(require("dotenv")));
|
|
33
|
+
config();
|
|
34
|
+
if (!path) {
|
|
35
|
+
throw new Error(`filePath is required.${os_1.EOL}Example: medusa-cart-seed <filePath>`);
|
|
36
|
+
}
|
|
37
|
+
await (0, seed_1.run)({ path });
|
|
38
|
+
})();
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.run = void 0;
|
|
27
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
28
|
+
const utils_1 = require("@medusajs/utils");
|
|
29
|
+
const CustomerModels = __importStar(require("../models"));
|
|
30
|
+
const os_1 = require("os");
|
|
31
|
+
const path_1 = require("path");
|
|
32
|
+
async function run({ options, logger, path, }) {
|
|
33
|
+
logger ?? (logger = console);
|
|
34
|
+
logger.info(`Loading seed data from ${path}...`);
|
|
35
|
+
const { customerData } = await Promise.resolve(`${(0, path_1.resolve)(process.cwd(), path)}`).then(s => __importStar(require(s))).catch((e) => {
|
|
36
|
+
logger?.error(`Failed to load seed data from ${path}. Please, provide a relative path and check that you export the following: customerData.${os_1.EOL}${e}`);
|
|
37
|
+
throw e;
|
|
38
|
+
});
|
|
39
|
+
const dbData = utils_1.ModulesSdkUtils.loadDatabaseConfig(modules_sdk_1.Modules.CUSTOMER, options);
|
|
40
|
+
const entities = Object.values(CustomerModels);
|
|
41
|
+
const pathToMigrations = __dirname + "/../migrations";
|
|
42
|
+
const orm = await utils_1.DALUtils.mikroOrmCreateConnection(dbData, entities, pathToMigrations);
|
|
43
|
+
const manager = orm.em.fork();
|
|
44
|
+
try {
|
|
45
|
+
logger.info("Seeding customer data..");
|
|
46
|
+
// TODO: implement customer seed data
|
|
47
|
+
// await createCustomers(manager, customersData)
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
logger.error(`Failed to insert the seed data in the PostgreSQL database ${dbData.clientUrl}.${os_1.EOL}${e}`);
|
|
51
|
+
}
|
|
52
|
+
await orm.close(true);
|
|
53
|
+
}
|
|
54
|
+
exports.run = run;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { ModulesSdkUtils } from "@medusajs/utils";
|
|
3
|
+
import { Address } from "../models";
|
|
4
|
+
import { CreateAddressDTO, UpdateAddressDTO } from "../types";
|
|
5
|
+
type InjectedDependencies = {
|
|
6
|
+
addressRepository: DAL.RepositoryService;
|
|
7
|
+
};
|
|
8
|
+
declare const AddressService_base: new <TEntity_1 extends object = any>(container: InjectedDependencies) => ModulesSdkUtils.AbstractService<TEntity_1, InjectedDependencies, {
|
|
9
|
+
create: CreateAddressDTO;
|
|
10
|
+
update: UpdateAddressDTO;
|
|
11
|
+
}, {
|
|
12
|
+
list?: any;
|
|
13
|
+
listAndCount?: any;
|
|
14
|
+
}>;
|
|
15
|
+
export default class AddressService<TEntity extends Address = Address> extends AddressService_base<TEntity> {
|
|
16
|
+
constructor(container: InjectedDependencies);
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 AddressService extends utils_1.ModulesSdkUtils.abstractServiceFactory(_models_1.Address) {
|
|
6
|
+
constructor(container) {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
super(...arguments);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.default = AddressService;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { ModulesSdkUtils } from "@medusajs/utils";
|
|
3
|
+
import { CustomerGroupCustomer } from "../models";
|
|
4
|
+
type CreateCustomerGroupCustomerDTO = {
|
|
5
|
+
customer_id: string;
|
|
6
|
+
customer_group_id: string;
|
|
7
|
+
created_by?: string;
|
|
8
|
+
};
|
|
9
|
+
type InjectedDependencies = {
|
|
10
|
+
customerGroupRepository: DAL.RepositoryService;
|
|
11
|
+
};
|
|
12
|
+
declare const CustomerGroupCustomerService_base: new <TEntity_1 extends object = any>(container: InjectedDependencies) => ModulesSdkUtils.AbstractService<TEntity_1, InjectedDependencies, {
|
|
13
|
+
create: CreateCustomerGroupCustomerDTO;
|
|
14
|
+
}, {
|
|
15
|
+
list?: any;
|
|
16
|
+
listAndCount?: any;
|
|
17
|
+
}>;
|
|
18
|
+
export default class CustomerGroupCustomerService<TEntity extends CustomerGroupCustomer = CustomerGroupCustomer> extends CustomerGroupCustomerService_base<TEntity> {
|
|
19
|
+
constructor(container: InjectedDependencies);
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 CustomerGroupCustomerService extends utils_1.ModulesSdkUtils.abstractServiceFactory(_models_1.CustomerGroupCustomer) {
|
|
6
|
+
constructor(container) {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
super(...arguments);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.default = CustomerGroupCustomerService;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { ModulesSdkUtils } from "@medusajs/utils";
|
|
3
|
+
import { CustomerGroup } from "../models";
|
|
4
|
+
import { CreateCustomerGroupDTO, UpdateCustomerGroupDTO } from "@medusajs/types";
|
|
5
|
+
type InjectedDependencies = {
|
|
6
|
+
customerGroupRepository: DAL.RepositoryService;
|
|
7
|
+
};
|
|
8
|
+
declare const CustomerGroupService_base: new <TEntity_1 extends object = any>(container: InjectedDependencies) => ModulesSdkUtils.AbstractService<TEntity_1, InjectedDependencies, {
|
|
9
|
+
create: CreateCustomerGroupDTO;
|
|
10
|
+
update: UpdateCustomerGroupDTO;
|
|
11
|
+
}, {
|
|
12
|
+
list?: any;
|
|
13
|
+
listAndCount?: any;
|
|
14
|
+
}>;
|
|
15
|
+
export default class CustomerGroupService<TEntity extends CustomerGroup = CustomerGroup> extends CustomerGroupService_base<TEntity> {
|
|
16
|
+
constructor(container: InjectedDependencies);
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
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 CustomerGroupService extends utils_1.ModulesSdkUtils.abstractServiceFactory(_models_1.CustomerGroup) {
|
|
6
|
+
constructor(container) {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
super(...arguments);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.default = CustomerGroupService;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Context, DAL, FindConfig, ICustomerModuleService, InternalModuleDeclaration, ModuleJoinerConfig, CustomerTypes } from "@medusajs/types";
|
|
2
|
+
import * as services from "../services";
|
|
3
|
+
type InjectedDependencies = {
|
|
4
|
+
baseRepository: DAL.RepositoryService;
|
|
5
|
+
customerService: services.CustomerService;
|
|
6
|
+
addressService: services.AddressService;
|
|
7
|
+
customerGroupService: services.CustomerGroupService;
|
|
8
|
+
customerGroupCustomerService: services.CustomerGroupCustomerService;
|
|
9
|
+
};
|
|
10
|
+
export default class CustomerModuleService implements ICustomerModuleService {
|
|
11
|
+
protected readonly moduleDeclaration: InternalModuleDeclaration;
|
|
12
|
+
protected baseRepository_: DAL.RepositoryService;
|
|
13
|
+
protected customerService_: services.CustomerService;
|
|
14
|
+
protected addressService_: services.AddressService;
|
|
15
|
+
protected customerGroupService_: services.CustomerGroupService;
|
|
16
|
+
protected customerGroupCustomerService_: services.CustomerGroupCustomerService;
|
|
17
|
+
constructor({ baseRepository, customerService, addressService, customerGroupService, customerGroupCustomerService, }: InjectedDependencies, moduleDeclaration: InternalModuleDeclaration);
|
|
18
|
+
__joinerConfig(): ModuleJoinerConfig;
|
|
19
|
+
retrieve(id: string, config?: FindConfig<CustomerTypes.CustomerDTO>, sharedContext?: Context): Promise<CustomerTypes.CustomerDTO>;
|
|
20
|
+
create(data: CustomerTypes.CreateCustomerDTO, sharedContext?: Context): Promise<CustomerTypes.CustomerDTO>;
|
|
21
|
+
create(data: CustomerTypes.CreateCustomerDTO[], sharedContext?: Context): Promise<CustomerTypes.CustomerDTO[]>;
|
|
22
|
+
update(customerId: string, data: Partial<CustomerTypes.CreateCustomerDTO>, sharedContext?: Context): Promise<CustomerTypes.CustomerDTO>;
|
|
23
|
+
update(customerIds: string[], data: Partial<CustomerTypes.CreateCustomerDTO>, sharedContext?: Context): Promise<CustomerTypes.CustomerDTO[]>;
|
|
24
|
+
update(selector: CustomerTypes.FilterableCustomerProps, data: Partial<CustomerTypes.CreateCustomerDTO>, sharedContext?: Context): Promise<CustomerTypes.CustomerDTO[]>;
|
|
25
|
+
delete(customerId: string, sharedContext?: Context): Promise<void>;
|
|
26
|
+
delete(customerIds: string[], sharedContext?: Context): Promise<void>;
|
|
27
|
+
delete(selector: CustomerTypes.FilterableCustomerProps, sharedContext?: Context): Promise<void>;
|
|
28
|
+
list(filters?: CustomerTypes.FilterableCustomerProps, config?: FindConfig<CustomerTypes.CustomerDTO>, sharedContext?: Context): Promise<CustomerTypes.CustomerDTO[]>;
|
|
29
|
+
listAndCount(filters?: CustomerTypes.FilterableCustomerProps, config?: FindConfig<CustomerTypes.CustomerDTO>, sharedContext?: Context): Promise<[CustomerTypes.CustomerDTO[], number]>;
|
|
30
|
+
createCustomerGroup(dataOrArrayOfData: CustomerTypes.CreateCustomerGroupDTO, sharedContext?: Context): Promise<CustomerTypes.CustomerGroupDTO>;
|
|
31
|
+
createCustomerGroup(dataOrArrayOfData: CustomerTypes.CreateCustomerGroupDTO[], sharedContext?: Context): Promise<CustomerTypes.CustomerGroupDTO[]>;
|
|
32
|
+
updateCustomerGroup(groupId: string, data: Partial<CustomerTypes.CreateCustomerGroupDTO>, sharedContext?: Context): Promise<CustomerTypes.CustomerGroupDTO>;
|
|
33
|
+
updateCustomerGroup(groupIds: string[], data: Partial<CustomerTypes.CreateCustomerGroupDTO>, sharedContext?: Context): Promise<CustomerTypes.CustomerGroupDTO[]>;
|
|
34
|
+
updateCustomerGroup(selector: CustomerTypes.FilterableCustomerGroupProps, data: Partial<CustomerTypes.CreateCustomerGroupDTO>, sharedContext?: Context): Promise<CustomerTypes.CustomerGroupDTO[]>;
|
|
35
|
+
addCustomerToGroup(groupCustomerPair: CustomerTypes.GroupCustomerPair, sharedContext?: Context): Promise<{
|
|
36
|
+
id: string;
|
|
37
|
+
}>;
|
|
38
|
+
addCustomerToGroup(groupCustomerPairs: CustomerTypes.GroupCustomerPair[], sharedContext?: Context): Promise<{
|
|
39
|
+
id: string;
|
|
40
|
+
}[]>;
|
|
41
|
+
removeCustomerFromGroup(groupCustomerPair: CustomerTypes.GroupCustomerPair, sharedContext?: Context): Promise<void>;
|
|
42
|
+
removeCustomerFromGroup(groupCustomerPairs: CustomerTypes.GroupCustomerPair[], sharedContext?: Context): Promise<void>;
|
|
43
|
+
listCustomerGroups(filters?: CustomerTypes.FilterableCustomerGroupProps, config?: FindConfig<CustomerTypes.CustomerGroupDTO>, sharedContext?: Context): Promise<CustomerTypes.CustomerGroupDTO[]>;
|
|
44
|
+
listAndCountCustomerGroups(filters?: CustomerTypes.FilterableCustomerGroupProps, config?: FindConfig<CustomerTypes.CustomerGroupDTO>, sharedContext?: Context): Promise<[CustomerTypes.CustomerGroupDTO[], number]>;
|
|
45
|
+
}
|
|
46
|
+
export {};
|