@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
package/README.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.runMigrations = exports.revertMigration = void 0;
|
|
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; } });
|
|
21
|
+
exports.default = module_definition_1.moduleDefinition;
|
|
22
|
+
__exportStar(require("./initialize"), exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExternalModuleDeclaration, InternalModuleDeclaration } from "@medusajs/modules-sdk";
|
|
2
|
+
import { ICustomerModuleService, ModulesSdkTypes } from "@medusajs/types";
|
|
3
|
+
import { InitializeModuleInjectableDependencies } from "../types";
|
|
4
|
+
export declare const initialize: (options?: ModulesSdkTypes.ModuleServiceInitializeOptions | ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions | ExternalModuleDeclaration | InternalModuleDeclaration, injectedDependencies?: InitializeModuleInjectableDependencies) => Promise<ICustomerModuleService>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialize = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const module_definition_1 = require("../module-definition");
|
|
6
|
+
const initialize = async (options, injectedDependencies) => {
|
|
7
|
+
const loaded = await modules_sdk_1.MedusaModule.bootstrap({
|
|
8
|
+
moduleKey: modules_sdk_1.Modules.CUSTOMER,
|
|
9
|
+
defaultPath: modules_sdk_1.MODULE_PACKAGE_NAMES[modules_sdk_1.Modules.CUSTOMER],
|
|
10
|
+
declaration: options,
|
|
11
|
+
injectedDependencies,
|
|
12
|
+
moduleExports: module_definition_1.moduleDefinition,
|
|
13
|
+
});
|
|
14
|
+
return loaded[modules_sdk_1.Modules.CUSTOMER];
|
|
15
|
+
};
|
|
16
|
+
exports.initialize = initialize;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ModuleJoinerConfig } from "@medusajs/types";
|
|
2
|
+
import { MapToConfig } from "@medusajs/utils";
|
|
3
|
+
export declare const LinkableKeys: {
|
|
4
|
+
customer_id: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const entityNameToLinkableKeysMap: MapToConfig;
|
|
7
|
+
export declare const joinerConfig: ModuleJoinerConfig;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.joinerConfig = exports.entityNameToLinkableKeysMap = exports.LinkableKeys = void 0;
|
|
4
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
5
|
+
const _models_1 = require("./models");
|
|
6
|
+
exports.LinkableKeys = {
|
|
7
|
+
customer_id: _models_1.Customer.name,
|
|
8
|
+
};
|
|
9
|
+
const entityLinkableKeysMap = {};
|
|
10
|
+
Object.entries(exports.LinkableKeys).forEach(([key, value]) => {
|
|
11
|
+
entityLinkableKeysMap[value] ?? (entityLinkableKeysMap[value] = []);
|
|
12
|
+
entityLinkableKeysMap[value].push({
|
|
13
|
+
mapTo: key,
|
|
14
|
+
valueFrom: key.split("_").pop(),
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
exports.entityNameToLinkableKeysMap = entityLinkableKeysMap;
|
|
18
|
+
exports.joinerConfig = {
|
|
19
|
+
serviceName: modules_sdk_1.Modules.CUSTOMER,
|
|
20
|
+
primaryKeys: ["id"],
|
|
21
|
+
linkableKeys: exports.LinkableKeys,
|
|
22
|
+
alias: {
|
|
23
|
+
name: ["customer", "customers"],
|
|
24
|
+
args: {
|
|
25
|
+
entity: _models_1.Customer.name,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InternalModuleDeclaration, LoaderOptions } from "@medusajs/modules-sdk";
|
|
2
|
+
import { ModulesSdkTypes } from "@medusajs/types";
|
|
3
|
+
declare const _default: ({ options, container, logger, }: LoaderOptions<ModulesSdkTypes.ModuleServiceInitializeOptions | ModulesSdkTypes.ModuleServiceInitializeCustomDataLayerOptions>, moduleDeclaration?: InternalModuleDeclaration) => Promise<void>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
27
|
+
const utils_1 = require("@medusajs/utils");
|
|
28
|
+
const CustomerModels = __importStar(require("../models"));
|
|
29
|
+
exports.default = async ({ options, container, logger, }, moduleDeclaration) => {
|
|
30
|
+
const entities = Object.values(CustomerModels);
|
|
31
|
+
const pathToMigrations = __dirname + "/../migrations";
|
|
32
|
+
await utils_1.ModulesSdkUtils.mikroOrmConnectionLoader({
|
|
33
|
+
moduleName: modules_sdk_1.Modules.CUSTOMER,
|
|
34
|
+
entities,
|
|
35
|
+
container,
|
|
36
|
+
options,
|
|
37
|
+
moduleDeclaration,
|
|
38
|
+
logger,
|
|
39
|
+
pathToMigrations,
|
|
40
|
+
});
|
|
41
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
const utils_1 = require("@medusajs/utils");
|
|
27
|
+
const ModuleModels = __importStar(require("../models"));
|
|
28
|
+
const ModuleServices = __importStar(require("../services"));
|
|
29
|
+
exports.default = utils_1.ModulesSdkUtils.moduleContainerLoaderFactory({
|
|
30
|
+
moduleModels: ModuleModels,
|
|
31
|
+
moduleServices: ModuleServices,
|
|
32
|
+
moduleRepositories: { BaseRepository: utils_1.MikroOrmBaseRepository },
|
|
33
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./connection"), exports);
|
|
18
|
+
__exportStar(require("./container"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { OptionalProps } from "@mikro-orm/core";
|
|
3
|
+
import Customer from "./customer";
|
|
4
|
+
type OptionalAddressProps = DAL.EntityDateColumns;
|
|
5
|
+
export default class Address {
|
|
6
|
+
[OptionalProps]: OptionalAddressProps;
|
|
7
|
+
id: string;
|
|
8
|
+
customer_id: string;
|
|
9
|
+
customer?: Customer;
|
|
10
|
+
company: string | null;
|
|
11
|
+
first_name: string | null;
|
|
12
|
+
last_name: string | null;
|
|
13
|
+
address_1: string | null;
|
|
14
|
+
address_2: string | null;
|
|
15
|
+
city: string | null;
|
|
16
|
+
country_code: string | null;
|
|
17
|
+
province: string | null;
|
|
18
|
+
postal_code: string | null;
|
|
19
|
+
phone: string | null;
|
|
20
|
+
metadata: Record<string, unknown> | null;
|
|
21
|
+
created_at: Date;
|
|
22
|
+
updated_at: Date;
|
|
23
|
+
onCreate(): void;
|
|
24
|
+
onInit(): void;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
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_1 = __importDefault(require("./customer"));
|
|
18
|
+
let Address = class Address {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.company = null;
|
|
21
|
+
this.first_name = null;
|
|
22
|
+
this.last_name = null;
|
|
23
|
+
this.address_1 = null;
|
|
24
|
+
this.address_2 = null;
|
|
25
|
+
this.city = null;
|
|
26
|
+
this.country_code = null;
|
|
27
|
+
this.province = null;
|
|
28
|
+
this.postal_code = null;
|
|
29
|
+
this.phone = null;
|
|
30
|
+
this.metadata = null;
|
|
31
|
+
}
|
|
32
|
+
onCreate() {
|
|
33
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "cuaddr");
|
|
34
|
+
}
|
|
35
|
+
onInit() {
|
|
36
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "cuaddr");
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, core_1.PrimaryKey)({ columnType: "text" }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], Address.prototype, "id", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, core_1.Property)({ columnType: "text" }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], Address.prototype, "customer_id", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, core_1.ManyToOne)(() => customer_1.default, {
|
|
49
|
+
fieldName: "customer_id",
|
|
50
|
+
nullable: true,
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", customer_1.default)
|
|
53
|
+
], Address.prototype, "customer", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
56
|
+
__metadata("design:type", Object)
|
|
57
|
+
], Address.prototype, "company", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], Address.prototype, "first_name", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
64
|
+
__metadata("design:type", Object)
|
|
65
|
+
], Address.prototype, "last_name", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], Address.prototype, "address_1", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
72
|
+
__metadata("design:type", Object)
|
|
73
|
+
], Address.prototype, "address_2", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], Address.prototype, "city", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
80
|
+
__metadata("design:type", Object)
|
|
81
|
+
], Address.prototype, "country_code", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
84
|
+
__metadata("design:type", Object)
|
|
85
|
+
], Address.prototype, "province", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], Address.prototype, "postal_code", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
92
|
+
__metadata("design:type", Object)
|
|
93
|
+
], Address.prototype, "phone", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, core_1.Property)({ columnType: "jsonb", nullable: true }),
|
|
96
|
+
__metadata("design:type", Object)
|
|
97
|
+
], Address.prototype, "metadata", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, core_1.Property)({
|
|
100
|
+
onCreate: () => new Date(),
|
|
101
|
+
columnType: "timestamptz",
|
|
102
|
+
defaultRaw: "now()",
|
|
103
|
+
}),
|
|
104
|
+
__metadata("design:type", Date)
|
|
105
|
+
], Address.prototype, "created_at", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, core_1.Property)({
|
|
108
|
+
onCreate: () => new Date(),
|
|
109
|
+
onUpdate: () => new Date(),
|
|
110
|
+
columnType: "timestamptz",
|
|
111
|
+
defaultRaw: "now()",
|
|
112
|
+
}),
|
|
113
|
+
__metadata("design:type", Date)
|
|
114
|
+
], Address.prototype, "updated_at", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, core_1.BeforeCreate)(),
|
|
117
|
+
__metadata("design:type", Function),
|
|
118
|
+
__metadata("design:paramtypes", []),
|
|
119
|
+
__metadata("design:returntype", void 0)
|
|
120
|
+
], Address.prototype, "onCreate", null);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, core_1.OnInit)(),
|
|
123
|
+
__metadata("design:type", Function),
|
|
124
|
+
__metadata("design:paramtypes", []),
|
|
125
|
+
__metadata("design:returntype", void 0)
|
|
126
|
+
], Address.prototype, "onInit", null);
|
|
127
|
+
Address = __decorate([
|
|
128
|
+
(0, core_1.Entity)({ tableName: "customer_address" })
|
|
129
|
+
], Address);
|
|
130
|
+
exports.default = Address;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { OptionalProps } from "@mikro-orm/core";
|
|
3
|
+
import Customer from "./customer";
|
|
4
|
+
import CustomerGroup from "./customer-group";
|
|
5
|
+
type OptionalGroupProps = "customer_group" | "customer" | DAL.EntityDateColumns;
|
|
6
|
+
export default class CustomerGroupCustomer {
|
|
7
|
+
[OptionalProps]: OptionalGroupProps;
|
|
8
|
+
id: string;
|
|
9
|
+
customer_id: string;
|
|
10
|
+
customer_group_id: string;
|
|
11
|
+
customer: Customer | null;
|
|
12
|
+
customer_group: CustomerGroup | null;
|
|
13
|
+
metadata: Record<string, unknown> | null;
|
|
14
|
+
created_at: Date;
|
|
15
|
+
updated_at: Date;
|
|
16
|
+
created_by: string | null;
|
|
17
|
+
onCreate(): void;
|
|
18
|
+
onInit(): void;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
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_1 = __importDefault(require("./customer"));
|
|
18
|
+
const customer_group_1 = __importDefault(require("./customer-group"));
|
|
19
|
+
let CustomerGroupCustomer = class CustomerGroupCustomer {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.metadata = null;
|
|
22
|
+
this.created_by = null;
|
|
23
|
+
}
|
|
24
|
+
onCreate() {
|
|
25
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "cusgc");
|
|
26
|
+
}
|
|
27
|
+
onInit() {
|
|
28
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "cusgc");
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, core_1.PrimaryKey)({ columnType: "text" }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], CustomerGroupCustomer.prototype, "id", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, core_1.Property)({ columnType: "text" }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], CustomerGroupCustomer.prototype, "customer_id", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, core_1.Property)({ columnType: "text" }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], CustomerGroupCustomer.prototype, "customer_group_id", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, core_1.ManyToOne)({
|
|
45
|
+
entity: () => customer_1.default,
|
|
46
|
+
fieldName: "customer_id",
|
|
47
|
+
index: "IDX_customer_group_customer_customer_id",
|
|
48
|
+
nullable: true,
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], CustomerGroupCustomer.prototype, "customer", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, core_1.ManyToOne)({
|
|
54
|
+
entity: () => customer_group_1.default,
|
|
55
|
+
fieldName: "customer_group_id",
|
|
56
|
+
index: "IDX_customer_group_customer_group_id",
|
|
57
|
+
nullable: true,
|
|
58
|
+
}),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], CustomerGroupCustomer.prototype, "customer_group", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, core_1.Property)({ columnType: "jsonb", nullable: true }),
|
|
63
|
+
__metadata("design:type", Object)
|
|
64
|
+
], CustomerGroupCustomer.prototype, "metadata", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, core_1.Property)({
|
|
67
|
+
onCreate: () => new Date(),
|
|
68
|
+
columnType: "timestamptz",
|
|
69
|
+
defaultRaw: "now()",
|
|
70
|
+
}),
|
|
71
|
+
__metadata("design:type", Date)
|
|
72
|
+
], CustomerGroupCustomer.prototype, "created_at", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, core_1.Property)({
|
|
75
|
+
onCreate: () => new Date(),
|
|
76
|
+
onUpdate: () => new Date(),
|
|
77
|
+
columnType: "timestamptz",
|
|
78
|
+
defaultRaw: "now()",
|
|
79
|
+
}),
|
|
80
|
+
__metadata("design:type", Date)
|
|
81
|
+
], CustomerGroupCustomer.prototype, "updated_at", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
84
|
+
__metadata("design:type", Object)
|
|
85
|
+
], CustomerGroupCustomer.prototype, "created_by", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, core_1.BeforeCreate)(),
|
|
88
|
+
__metadata("design:type", Function),
|
|
89
|
+
__metadata("design:paramtypes", []),
|
|
90
|
+
__metadata("design:returntype", void 0)
|
|
91
|
+
], CustomerGroupCustomer.prototype, "onCreate", null);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, core_1.OnInit)(),
|
|
94
|
+
__metadata("design:type", Function),
|
|
95
|
+
__metadata("design:paramtypes", []),
|
|
96
|
+
__metadata("design:returntype", void 0)
|
|
97
|
+
], CustomerGroupCustomer.prototype, "onInit", null);
|
|
98
|
+
CustomerGroupCustomer = __decorate([
|
|
99
|
+
(0, core_1.Entity)({ tableName: "customer_group_customer" })
|
|
100
|
+
], CustomerGroupCustomer);
|
|
101
|
+
exports.default = CustomerGroupCustomer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { OptionalProps, Collection } from "@mikro-orm/core";
|
|
3
|
+
import Customer from "./customer";
|
|
4
|
+
type OptionalGroupProps = DAL.EntityDateColumns;
|
|
5
|
+
export default class CustomerGroup {
|
|
6
|
+
[OptionalProps]: OptionalGroupProps;
|
|
7
|
+
id: string;
|
|
8
|
+
name: string | null;
|
|
9
|
+
customers: Collection<Customer, object>;
|
|
10
|
+
metadata: Record<string, unknown> | null;
|
|
11
|
+
created_by: string | null;
|
|
12
|
+
created_at: Date;
|
|
13
|
+
updated_at: Date;
|
|
14
|
+
onCreate(): void;
|
|
15
|
+
onInit(): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
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_1 = __importDefault(require("./customer"));
|
|
18
|
+
const customer_group_customer_1 = __importDefault(require("./customer-group-customer"));
|
|
19
|
+
let CustomerGroup = class CustomerGroup {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.name = null;
|
|
22
|
+
this.customers = new core_1.Collection(this);
|
|
23
|
+
this.metadata = null;
|
|
24
|
+
this.created_by = null;
|
|
25
|
+
}
|
|
26
|
+
onCreate() {
|
|
27
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "cusgroup");
|
|
28
|
+
}
|
|
29
|
+
onInit() {
|
|
30
|
+
this.id = (0, utils_1.generateEntityId)(this.id, "cusgroup");
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, core_1.PrimaryKey)({ columnType: "text" }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], CustomerGroup.prototype, "id", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], CustomerGroup.prototype, "name", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, core_1.ManyToMany)({
|
|
43
|
+
entity: () => customer_1.default,
|
|
44
|
+
pivotEntity: () => customer_group_customer_1.default,
|
|
45
|
+
}),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], CustomerGroup.prototype, "customers", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, core_1.Property)({ columnType: "jsonb", nullable: true }),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], CustomerGroup.prototype, "metadata", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, core_1.Property)({ columnType: "text", nullable: true }),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], CustomerGroup.prototype, "created_by", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, core_1.Property)({
|
|
58
|
+
onCreate: () => new Date(),
|
|
59
|
+
columnType: "timestamptz",
|
|
60
|
+
defaultRaw: "now()",
|
|
61
|
+
}),
|
|
62
|
+
__metadata("design:type", Date)
|
|
63
|
+
], CustomerGroup.prototype, "created_at", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, core_1.Property)({
|
|
66
|
+
onCreate: () => new Date(),
|
|
67
|
+
onUpdate: () => new Date(),
|
|
68
|
+
columnType: "timestamptz",
|
|
69
|
+
defaultRaw: "now()",
|
|
70
|
+
}),
|
|
71
|
+
__metadata("design:type", Date)
|
|
72
|
+
], CustomerGroup.prototype, "updated_at", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, core_1.BeforeCreate)(),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", []),
|
|
77
|
+
__metadata("design:returntype", void 0)
|
|
78
|
+
], CustomerGroup.prototype, "onCreate", null);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, core_1.OnInit)(),
|
|
81
|
+
__metadata("design:type", Function),
|
|
82
|
+
__metadata("design:paramtypes", []),
|
|
83
|
+
__metadata("design:returntype", void 0)
|
|
84
|
+
], CustomerGroup.prototype, "onInit", null);
|
|
85
|
+
CustomerGroup = __decorate([
|
|
86
|
+
(0, core_1.Entity)({ tableName: "customer_group" })
|
|
87
|
+
], CustomerGroup);
|
|
88
|
+
exports.default = CustomerGroup;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { Collection, OptionalProps } from "@mikro-orm/core";
|
|
3
|
+
import CustomerGroup from "./customer-group";
|
|
4
|
+
import Address from "./address";
|
|
5
|
+
type OptionalCustomerProps = "groups" | "addresses" | "default_shipping_address" | "default_billing_address" | DAL.EntityDateColumns;
|
|
6
|
+
export default class Customer {
|
|
7
|
+
[OptionalProps]?: OptionalCustomerProps;
|
|
8
|
+
id: string;
|
|
9
|
+
company_name: string | null;
|
|
10
|
+
first_name: string | null;
|
|
11
|
+
last_name: string | null;
|
|
12
|
+
email: string | null;
|
|
13
|
+
phone: string | null;
|
|
14
|
+
default_shipping_address_id: string | null;
|
|
15
|
+
default_shipping_address: Address | null;
|
|
16
|
+
default_billing_address_id: string | null;
|
|
17
|
+
default_billing_address: Address | null;
|
|
18
|
+
metadata: Record<string, unknown> | null;
|
|
19
|
+
groups: Collection<CustomerGroup, object>;
|
|
20
|
+
addresses: Collection<Address, object>;
|
|
21
|
+
created_at: Date;
|
|
22
|
+
updated_at: Date;
|
|
23
|
+
deleted_at: Date | null;
|
|
24
|
+
created_by: string | null;
|
|
25
|
+
onCreate(): void;
|
|
26
|
+
onInit(): void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|