@medusajs/order 0.1.0

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.
Files changed (60) hide show
  1. package/README.md +1 -0
  2. package/dist/index.d.ts +8 -0
  3. package/dist/index.js +29 -0
  4. package/dist/joiner-config.d.ts +5 -0
  5. package/dist/joiner-config.js +23 -0
  6. package/dist/models/address.d.ts +24 -0
  7. package/dist/models/address.js +125 -0
  8. package/dist/models/adjustment-line.d.ts +21 -0
  9. package/dist/models/adjustment-line.js +73 -0
  10. package/dist/models/index.d.ts +8 -0
  11. package/dist/models/index.js +22 -0
  12. package/dist/models/line-item-adjustment.d.ts +8 -0
  13. package/dist/models/line-item-adjustment.js +57 -0
  14. package/dist/models/line-item-tax-line.d.ts +8 -0
  15. package/dist/models/line-item-tax-line.js +54 -0
  16. package/dist/models/line-item.d.ts +45 -0
  17. package/dist/models/line-item.js +241 -0
  18. package/dist/models/order.d.ts +32 -0
  19. package/dist/models/order.js +195 -0
  20. package/dist/models/shipping-method-adjustment.d.ts +8 -0
  21. package/dist/models/shipping-method-adjustment.js +55 -0
  22. package/dist/models/shipping-method-tax-line.d.ts +8 -0
  23. package/dist/models/shipping-method-tax-line.js +55 -0
  24. package/dist/models/shipping-method.d.ts +26 -0
  25. package/dist/models/shipping-method.js +157 -0
  26. package/dist/models/tax-line.d.ts +17 -0
  27. package/dist/models/tax-line.js +67 -0
  28. package/dist/module-definition.d.ts +2 -0
  29. package/dist/module-definition.js +58 -0
  30. package/dist/repositories/index.d.ts +1 -0
  31. package/dist/repositories/index.js +5 -0
  32. package/dist/scripts/bin/run-seed.d.ts +3 -0
  33. package/dist/scripts/bin/run-seed.js +48 -0
  34. package/dist/services/index.d.ts +1 -0
  35. package/dist/services/index.js +8 -0
  36. package/dist/services/order-module-service.d.ts +114 -0
  37. package/dist/services/order-module-service.js +671 -0
  38. package/dist/types/UpdateOrderShippingMethodDTO.d.ts +7 -0
  39. package/dist/types/UpdateOrderShippingMethodDTO.js +2 -0
  40. package/dist/types/address.d.ts +19 -0
  41. package/dist/types/address.js +2 -0
  42. package/dist/types/index.d.ts +13 -0
  43. package/dist/types/index.js +24 -0
  44. package/dist/types/line-item-adjustment.d.ts +12 -0
  45. package/dist/types/line-item-adjustment.js +2 -0
  46. package/dist/types/line-item-tax-line.d.ts +7 -0
  47. package/dist/types/line-item-tax-line.js +2 -0
  48. package/dist/types/line-item.d.ts +31 -0
  49. package/dist/types/line-item.js +2 -0
  50. package/dist/types/order.d.ts +24 -0
  51. package/dist/types/order.js +2 -0
  52. package/dist/types/shipping-method-adjustment.d.ts +17 -0
  53. package/dist/types/shipping-method-adjustment.js +2 -0
  54. package/dist/types/shipping-method-tax-line.d.ts +7 -0
  55. package/dist/types/shipping-method-tax-line.js +2 -0
  56. package/dist/types/shipping-method.d.ts +13 -0
  57. package/dist/types/shipping-method.js +2 -0
  58. package/dist/types/tax-line.d.ts +16 -0
  59. package/dist/types/tax-line.js +2 -0
  60. package/package.json +61 -0
@@ -0,0 +1,241 @@
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 line_item_adjustment_1 = __importDefault(require("./line-item-adjustment"));
18
+ const line_item_tax_line_1 = __importDefault(require("./line-item-tax-line"));
19
+ const order_1 = __importDefault(require("./order"));
20
+ const productIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
21
+ tableName: "order_line_item",
22
+ columns: "product_id",
23
+ });
24
+ const variantIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
25
+ tableName: "order_line_item",
26
+ columns: "variant_id",
27
+ });
28
+ let LineItem = class LineItem {
29
+ constructor() {
30
+ this.subtitle = null;
31
+ this.thumbnail = null;
32
+ this.variant_id = null;
33
+ this.product_id = null;
34
+ this.product_title = null;
35
+ this.product_description = null;
36
+ this.product_subtitle = null;
37
+ this.product_type = null;
38
+ this.product_collection = null;
39
+ this.product_handle = null;
40
+ this.variant_sku = null;
41
+ this.variant_barcode = null;
42
+ this.variant_title = null;
43
+ this.variant_option_values = null;
44
+ this.requires_shipping = true;
45
+ this.is_discountable = true;
46
+ this.is_tax_inclusive = false;
47
+ this.compare_at_unit_price = null;
48
+ this.raw_compare_at_unit_price = null;
49
+ this.tax_lines = new core_1.Collection(this);
50
+ this.adjustments = new core_1.Collection(this);
51
+ }
52
+ onCreate() {
53
+ this.id = (0, utils_1.generateEntityId)(this.id, "ordli");
54
+ const val = new utils_1.BigNumber(this.raw_unit_price ?? this.unit_price);
55
+ this.unit_price = val.numeric;
56
+ this.raw_unit_price = val.raw;
57
+ }
58
+ onUpdate() {
59
+ const val = new utils_1.BigNumber(this.raw_unit_price ?? this.unit_price);
60
+ this.unit_price = val.numeric;
61
+ this.raw_unit_price = val.raw;
62
+ }
63
+ onInit() {
64
+ this.id = (0, utils_1.generateEntityId)(this.id, "ordli");
65
+ const val = new utils_1.BigNumber(this.raw_unit_price ?? this.unit_price);
66
+ this.unit_price = val.numeric;
67
+ this.raw_unit_price = val.raw;
68
+ }
69
+ };
70
+ __decorate([
71
+ (0, core_1.PrimaryKey)({ columnType: "text" }),
72
+ __metadata("design:type", String)
73
+ ], LineItem.prototype, "id", void 0);
74
+ __decorate([
75
+ (0, core_1.Property)({ columnType: "text" }),
76
+ __metadata("design:type", String)
77
+ ], LineItem.prototype, "order_id", void 0);
78
+ __decorate([
79
+ (0, core_1.ManyToOne)({
80
+ entity: () => order_1.default,
81
+ onDelete: "cascade",
82
+ index: "IDX_order_line_item_order_id",
83
+ cascade: [core_1.Cascade.REMOVE, core_1.Cascade.PERSIST],
84
+ }),
85
+ __metadata("design:type", order_1.default)
86
+ ], LineItem.prototype, "order", void 0);
87
+ __decorate([
88
+ (0, core_1.Property)({ columnType: "text" }),
89
+ __metadata("design:type", String)
90
+ ], LineItem.prototype, "title", void 0);
91
+ __decorate([
92
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
93
+ __metadata("design:type", Object)
94
+ ], LineItem.prototype, "subtitle", void 0);
95
+ __decorate([
96
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
97
+ __metadata("design:type", Object)
98
+ ], LineItem.prototype, "thumbnail", void 0);
99
+ __decorate([
100
+ (0, core_1.Property)({ columnType: "numeric" }),
101
+ __metadata("design:type", Object)
102
+ ], LineItem.prototype, "quantity", void 0);
103
+ __decorate([
104
+ (0, core_1.Property)({ columnType: "jsonb" }),
105
+ __metadata("design:type", Object)
106
+ ], LineItem.prototype, "raw_quantity", void 0);
107
+ __decorate([
108
+ (0, core_1.Property)({
109
+ columnType: "text",
110
+ nullable: true,
111
+ }),
112
+ variantIdIndex.MikroORMIndex(),
113
+ __metadata("design:type", Object)
114
+ ], LineItem.prototype, "variant_id", void 0);
115
+ __decorate([
116
+ (0, core_1.Property)({
117
+ columnType: "text",
118
+ nullable: true,
119
+ }),
120
+ productIdIndex.MikroORMIndex(),
121
+ __metadata("design:type", Object)
122
+ ], LineItem.prototype, "product_id", void 0);
123
+ __decorate([
124
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
125
+ __metadata("design:type", Object)
126
+ ], LineItem.prototype, "product_title", void 0);
127
+ __decorate([
128
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
129
+ __metadata("design:type", Object)
130
+ ], LineItem.prototype, "product_description", void 0);
131
+ __decorate([
132
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
133
+ __metadata("design:type", Object)
134
+ ], LineItem.prototype, "product_subtitle", void 0);
135
+ __decorate([
136
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
137
+ __metadata("design:type", Object)
138
+ ], LineItem.prototype, "product_type", void 0);
139
+ __decorate([
140
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
141
+ __metadata("design:type", Object)
142
+ ], LineItem.prototype, "product_collection", void 0);
143
+ __decorate([
144
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
145
+ __metadata("design:type", Object)
146
+ ], LineItem.prototype, "product_handle", void 0);
147
+ __decorate([
148
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
149
+ __metadata("design:type", Object)
150
+ ], LineItem.prototype, "variant_sku", void 0);
151
+ __decorate([
152
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
153
+ __metadata("design:type", Object)
154
+ ], LineItem.prototype, "variant_barcode", void 0);
155
+ __decorate([
156
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
157
+ __metadata("design:type", Object)
158
+ ], LineItem.prototype, "variant_title", void 0);
159
+ __decorate([
160
+ (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
161
+ __metadata("design:type", Object)
162
+ ], LineItem.prototype, "variant_option_values", void 0);
163
+ __decorate([
164
+ (0, core_1.Property)({ columnType: "boolean" }),
165
+ __metadata("design:type", Object)
166
+ ], LineItem.prototype, "requires_shipping", void 0);
167
+ __decorate([
168
+ (0, core_1.Property)({ columnType: "boolean" }),
169
+ __metadata("design:type", Object)
170
+ ], LineItem.prototype, "is_discountable", void 0);
171
+ __decorate([
172
+ (0, core_1.Property)({ columnType: "boolean" }),
173
+ __metadata("design:type", Object)
174
+ ], LineItem.prototype, "is_tax_inclusive", void 0);
175
+ __decorate([
176
+ (0, core_1.Property)({ columnType: "numeric", nullable: true }),
177
+ __metadata("design:type", Object)
178
+ ], LineItem.prototype, "compare_at_unit_price", void 0);
179
+ __decorate([
180
+ (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
181
+ __metadata("design:type", Object)
182
+ ], LineItem.prototype, "raw_compare_at_unit_price", void 0);
183
+ __decorate([
184
+ (0, core_1.Property)({ columnType: "numeric" }),
185
+ __metadata("design:type", Object)
186
+ ], LineItem.prototype, "unit_price", void 0);
187
+ __decorate([
188
+ (0, core_1.Property)({ columnType: "jsonb" }),
189
+ __metadata("design:type", Object)
190
+ ], LineItem.prototype, "raw_unit_price", void 0);
191
+ __decorate([
192
+ (0, core_1.OneToMany)(() => line_item_tax_line_1.default, (taxLine) => taxLine.item, {
193
+ cascade: [core_1.Cascade.REMOVE],
194
+ }),
195
+ __metadata("design:type", Object)
196
+ ], LineItem.prototype, "tax_lines", void 0);
197
+ __decorate([
198
+ (0, core_1.OneToMany)(() => line_item_adjustment_1.default, (adjustment) => adjustment.item, {
199
+ cascade: [core_1.Cascade.REMOVE],
200
+ }),
201
+ __metadata("design:type", Object)
202
+ ], LineItem.prototype, "adjustments", void 0);
203
+ __decorate([
204
+ (0, core_1.Property)({
205
+ onCreate: () => new Date(),
206
+ columnType: "timestamptz",
207
+ defaultRaw: "now()",
208
+ }),
209
+ __metadata("design:type", Date)
210
+ ], LineItem.prototype, "created_at", void 0);
211
+ __decorate([
212
+ (0, core_1.Property)({
213
+ onCreate: () => new Date(),
214
+ onUpdate: () => new Date(),
215
+ columnType: "timestamptz",
216
+ defaultRaw: "now()",
217
+ }),
218
+ __metadata("design:type", Date)
219
+ ], LineItem.prototype, "updated_at", void 0);
220
+ __decorate([
221
+ (0, core_1.BeforeCreate)(),
222
+ __metadata("design:type", Function),
223
+ __metadata("design:paramtypes", []),
224
+ __metadata("design:returntype", void 0)
225
+ ], LineItem.prototype, "onCreate", null);
226
+ __decorate([
227
+ (0, core_1.BeforeUpdate)(),
228
+ __metadata("design:type", Function),
229
+ __metadata("design:paramtypes", []),
230
+ __metadata("design:returntype", void 0)
231
+ ], LineItem.prototype, "onUpdate", null);
232
+ __decorate([
233
+ (0, core_1.OnInit)(),
234
+ __metadata("design:type", Function),
235
+ __metadata("design:paramtypes", []),
236
+ __metadata("design:returntype", void 0)
237
+ ], LineItem.prototype, "onInit", null);
238
+ LineItem = __decorate([
239
+ (0, core_1.Entity)({ tableName: "order_line_item" })
240
+ ], LineItem);
241
+ exports.default = LineItem;
@@ -0,0 +1,32 @@
1
+ import { DAL } from "@medusajs/types";
2
+ import { OrderStatus } from "@medusajs/utils";
3
+ import { Collection, OptionalProps } from "@mikro-orm/core";
4
+ import Address from "./address";
5
+ import LineItem from "./line-item";
6
+ import ShippingMethod from "./shipping-method";
7
+ type OptionalOrderProps = "shipping_address" | "billing_address" | DAL.EntityDateColumns;
8
+ export default class Order {
9
+ [OptionalProps]?: OptionalOrderProps;
10
+ id: string;
11
+ region_id: string | null;
12
+ customer_id: string | null;
13
+ sales_channel_id: string | null;
14
+ status: OrderStatus;
15
+ email: string | null;
16
+ currency_code: string;
17
+ shipping_address_id?: string | null;
18
+ shipping_address?: Address | null;
19
+ billing_address_id?: string | null;
20
+ billing_address?: Address | null;
21
+ no_notification: boolean | null;
22
+ metadata: Record<string, unknown> | null;
23
+ items: Collection<LineItem, object>;
24
+ shipping_methods: Collection<ShippingMethod, object>;
25
+ created_at: Date;
26
+ updated_at: Date;
27
+ deleted_at: Date | null;
28
+ canceled_at: Date | null;
29
+ onCreate(): void;
30
+ onInit(): void;
31
+ }
32
+ export {};
@@ -0,0 +1,195 @@
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 address_1 = __importDefault(require("./address"));
18
+ const line_item_1 = __importDefault(require("./line-item"));
19
+ const shipping_method_1 = __importDefault(require("./shipping-method"));
20
+ const regionIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
21
+ tableName: "order",
22
+ columns: "region_id",
23
+ where: "deleted_at IS NOT NULL",
24
+ });
25
+ const customerIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
26
+ tableName: "order",
27
+ columns: "customer_id",
28
+ where: "deleted_at IS NOT NULL",
29
+ });
30
+ const salesChannelIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
31
+ tableName: "order",
32
+ columns: "customer_id",
33
+ where: "deleted_at IS NOT NULL",
34
+ });
35
+ const orderDeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
36
+ tableName: "order",
37
+ columns: "deleted_at",
38
+ where: "deleted_at IS NOT NULL",
39
+ });
40
+ const currencyCodeIndex = (0, utils_1.createPsqlIndexStatementHelper)({
41
+ tableName: "order",
42
+ columns: "currency_code",
43
+ where: "deleted_at IS NOT NULL",
44
+ });
45
+ let Order = class Order {
46
+ constructor() {
47
+ this.region_id = null;
48
+ this.customer_id = null;
49
+ this.sales_channel_id = null;
50
+ this.email = null;
51
+ this.no_notification = null;
52
+ this.metadata = null;
53
+ this.items = new core_1.Collection(this);
54
+ this.shipping_methods = new core_1.Collection(this);
55
+ this.deleted_at = null;
56
+ this.canceled_at = null;
57
+ }
58
+ onCreate() {
59
+ this.id = (0, utils_1.generateEntityId)(this.id, "order");
60
+ }
61
+ onInit() {
62
+ this.id = (0, utils_1.generateEntityId)(this.id, "order");
63
+ }
64
+ };
65
+ __decorate([
66
+ (0, core_1.PrimaryKey)({ columnType: "text" }),
67
+ __metadata("design:type", String)
68
+ ], Order.prototype, "id", void 0);
69
+ __decorate([
70
+ (0, core_1.Property)({
71
+ columnType: "text",
72
+ nullable: true,
73
+ }),
74
+ regionIdIndex.MikroORMIndex(),
75
+ __metadata("design:type", Object)
76
+ ], Order.prototype, "region_id", void 0);
77
+ __decorate([
78
+ (0, core_1.Property)({
79
+ columnType: "text",
80
+ nullable: true,
81
+ }),
82
+ customerIdIndex.MikroORMIndex(),
83
+ __metadata("design:type", Object)
84
+ ], Order.prototype, "customer_id", void 0);
85
+ __decorate([
86
+ (0, core_1.Property)({
87
+ columnType: "text",
88
+ nullable: true,
89
+ }),
90
+ salesChannelIdIndex.MikroORMIndex(),
91
+ __metadata("design:type", Object)
92
+ ], Order.prototype, "sales_channel_id", void 0);
93
+ __decorate([
94
+ (0, core_1.Enum)({ items: () => utils_1.OrderStatus, default: utils_1.OrderStatus.PENDING }),
95
+ __metadata("design:type", String)
96
+ ], Order.prototype, "status", void 0);
97
+ __decorate([
98
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
99
+ __metadata("design:type", Object)
100
+ ], Order.prototype, "email", void 0);
101
+ __decorate([
102
+ (0, core_1.Property)({ columnType: "text" }),
103
+ currencyCodeIndex.MikroORMIndex(),
104
+ __metadata("design:type", String)
105
+ ], Order.prototype, "currency_code", void 0);
106
+ __decorate([
107
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
108
+ __metadata("design:type", Object)
109
+ ], Order.prototype, "shipping_address_id", void 0);
110
+ __decorate([
111
+ (0, core_1.ManyToOne)({
112
+ entity: () => address_1.default,
113
+ fieldName: "shipping_address_id",
114
+ nullable: true,
115
+ index: "IDX_order_shipping_address_id",
116
+ cascade: [core_1.Cascade.PERSIST],
117
+ }),
118
+ __metadata("design:type", Object)
119
+ ], Order.prototype, "shipping_address", void 0);
120
+ __decorate([
121
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
122
+ __metadata("design:type", Object)
123
+ ], Order.prototype, "billing_address_id", void 0);
124
+ __decorate([
125
+ (0, core_1.ManyToOne)({
126
+ entity: () => address_1.default,
127
+ fieldName: "billing_address_id",
128
+ nullable: true,
129
+ index: "IDX_order_billing_address_id",
130
+ cascade: [core_1.Cascade.PERSIST],
131
+ }),
132
+ __metadata("design:type", Object)
133
+ ], Order.prototype, "billing_address", void 0);
134
+ __decorate([
135
+ (0, core_1.Property)({ columnType: "boolean", nullable: true }),
136
+ __metadata("design:type", Object)
137
+ ], Order.prototype, "no_notification", void 0);
138
+ __decorate([
139
+ (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
140
+ __metadata("design:type", Object)
141
+ ], Order.prototype, "metadata", void 0);
142
+ __decorate([
143
+ (0, core_1.OneToMany)(() => line_item_1.default, (lineItem) => lineItem.order, {
144
+ cascade: [core_1.Cascade.REMOVE],
145
+ }),
146
+ __metadata("design:type", Object)
147
+ ], Order.prototype, "items", void 0);
148
+ __decorate([
149
+ (0, core_1.OneToMany)(() => shipping_method_1.default, (shippingMethod) => shippingMethod.order, {
150
+ cascade: [core_1.Cascade.REMOVE],
151
+ }),
152
+ __metadata("design:type", Object)
153
+ ], Order.prototype, "shipping_methods", void 0);
154
+ __decorate([
155
+ (0, core_1.Property)({
156
+ onCreate: () => new Date(),
157
+ columnType: "timestamptz",
158
+ defaultRaw: "now()",
159
+ }),
160
+ __metadata("design:type", Date)
161
+ ], Order.prototype, "created_at", void 0);
162
+ __decorate([
163
+ (0, core_1.Property)({
164
+ onCreate: () => new Date(),
165
+ onUpdate: () => new Date(),
166
+ columnType: "timestamptz",
167
+ defaultRaw: "now()",
168
+ }),
169
+ __metadata("design:type", Date)
170
+ ], Order.prototype, "updated_at", void 0);
171
+ __decorate([
172
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
173
+ orderDeletedAtIndex.MikroORMIndex(),
174
+ __metadata("design:type", Object)
175
+ ], Order.prototype, "deleted_at", void 0);
176
+ __decorate([
177
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
178
+ __metadata("design:type", Object)
179
+ ], Order.prototype, "canceled_at", void 0);
180
+ __decorate([
181
+ (0, core_1.BeforeCreate)(),
182
+ __metadata("design:type", Function),
183
+ __metadata("design:paramtypes", []),
184
+ __metadata("design:returntype", void 0)
185
+ ], Order.prototype, "onCreate", null);
186
+ __decorate([
187
+ (0, core_1.OnInit)(),
188
+ __metadata("design:type", Function),
189
+ __metadata("design:paramtypes", []),
190
+ __metadata("design:returntype", void 0)
191
+ ], Order.prototype, "onInit", null);
192
+ Order = __decorate([
193
+ (0, core_1.Entity)({ tableName: "order" })
194
+ ], Order);
195
+ exports.default = Order;
@@ -0,0 +1,8 @@
1
+ import AdjustmentLine from "./adjustment-line";
2
+ import ShippingMethod from "./shipping-method";
3
+ export default class ShippingMethodAdjustment extends AdjustmentLine {
4
+ shipping_method: ShippingMethod;
5
+ shipping_method_id: string;
6
+ onCreate(): void;
7
+ onInit(): void;
8
+ }
@@ -0,0 +1,55 @@
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 adjustment_line_1 = __importDefault(require("./adjustment-line"));
18
+ const shipping_method_1 = __importDefault(require("./shipping-method"));
19
+ let ShippingMethodAdjustment = class ShippingMethodAdjustment extends adjustment_line_1.default {
20
+ onCreate() {
21
+ this.id = (0, utils_1.generateEntityId)(this.id, "ordsmadj");
22
+ }
23
+ onInit() {
24
+ this.id = (0, utils_1.generateEntityId)(this.id, "ordsmadj");
25
+ }
26
+ };
27
+ __decorate([
28
+ (0, core_1.ManyToOne)({
29
+ entity: () => shipping_method_1.default,
30
+ fieldName: "shipping_method_id",
31
+ index: "IDX_order_shipping_method_adjustment_shipping_method_id",
32
+ cascade: [core_1.Cascade.REMOVE, core_1.Cascade.PERSIST],
33
+ }),
34
+ __metadata("design:type", shipping_method_1.default)
35
+ ], ShippingMethodAdjustment.prototype, "shipping_method", void 0);
36
+ __decorate([
37
+ (0, core_1.Property)({ columnType: "text" }),
38
+ __metadata("design:type", String)
39
+ ], ShippingMethodAdjustment.prototype, "shipping_method_id", void 0);
40
+ __decorate([
41
+ (0, core_1.BeforeCreate)(),
42
+ __metadata("design:type", Function),
43
+ __metadata("design:paramtypes", []),
44
+ __metadata("design:returntype", void 0)
45
+ ], ShippingMethodAdjustment.prototype, "onCreate", null);
46
+ __decorate([
47
+ (0, core_1.OnInit)(),
48
+ __metadata("design:type", Function),
49
+ __metadata("design:paramtypes", []),
50
+ __metadata("design:returntype", void 0)
51
+ ], ShippingMethodAdjustment.prototype, "onInit", null);
52
+ ShippingMethodAdjustment = __decorate([
53
+ (0, core_1.Entity)({ tableName: "order_shipping_method_adjustment" })
54
+ ], ShippingMethodAdjustment);
55
+ exports.default = ShippingMethodAdjustment;
@@ -0,0 +1,8 @@
1
+ import ShippingMethod from "./shipping-method";
2
+ import TaxLine from "./tax-line";
3
+ export default class ShippingMethodTaxLine extends TaxLine {
4
+ shipping_method: ShippingMethod;
5
+ shipping_method_id: string;
6
+ onCreate(): void;
7
+ onInit(): void;
8
+ }
@@ -0,0 +1,55 @@
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 shipping_method_1 = __importDefault(require("./shipping-method"));
18
+ const tax_line_1 = __importDefault(require("./tax-line"));
19
+ let ShippingMethodTaxLine = class ShippingMethodTaxLine extends tax_line_1.default {
20
+ onCreate() {
21
+ this.id = (0, utils_1.generateEntityId)(this.id, "ordsmtxl");
22
+ }
23
+ onInit() {
24
+ this.id = (0, utils_1.generateEntityId)(this.id, "ordsmtxl");
25
+ }
26
+ };
27
+ __decorate([
28
+ (0, core_1.ManyToOne)({
29
+ entity: () => shipping_method_1.default,
30
+ fieldName: "shipping_method_id",
31
+ index: "IDX_order_tax_line_shipping_method_id",
32
+ cascade: [core_1.Cascade.REMOVE, core_1.Cascade.PERSIST],
33
+ }),
34
+ __metadata("design:type", shipping_method_1.default)
35
+ ], ShippingMethodTaxLine.prototype, "shipping_method", void 0);
36
+ __decorate([
37
+ (0, core_1.Property)({ columnType: "text" }),
38
+ __metadata("design:type", String)
39
+ ], ShippingMethodTaxLine.prototype, "shipping_method_id", void 0);
40
+ __decorate([
41
+ (0, core_1.BeforeCreate)(),
42
+ __metadata("design:type", Function),
43
+ __metadata("design:paramtypes", []),
44
+ __metadata("design:returntype", void 0)
45
+ ], ShippingMethodTaxLine.prototype, "onCreate", null);
46
+ __decorate([
47
+ (0, core_1.OnInit)(),
48
+ __metadata("design:type", Function),
49
+ __metadata("design:paramtypes", []),
50
+ __metadata("design:returntype", void 0)
51
+ ], ShippingMethodTaxLine.prototype, "onInit", null);
52
+ ShippingMethodTaxLine = __decorate([
53
+ (0, core_1.Entity)({ tableName: "order_shipping_method_tax_line" })
54
+ ], ShippingMethodTaxLine);
55
+ exports.default = ShippingMethodTaxLine;
@@ -0,0 +1,26 @@
1
+ import { BigNumberRawValue } from "@medusajs/types";
2
+ import { BigNumber } from "@medusajs/utils";
3
+ import { Collection } from "@mikro-orm/core";
4
+ import Order from "./order";
5
+ import ShippingMethodAdjustment from "./shipping-method-adjustment";
6
+ import ShippingMethodTaxLine from "./shipping-method-tax-line";
7
+ export default class ShippingMethod {
8
+ id: string;
9
+ order_id: string;
10
+ order: Order;
11
+ name: string;
12
+ description: string | null;
13
+ amount: BigNumber | number;
14
+ raw_amount: BigNumberRawValue;
15
+ is_tax_inclusive: boolean;
16
+ shipping_option_id: string | null;
17
+ data: Record<string, unknown> | null;
18
+ metadata: Record<string, unknown> | null;
19
+ tax_lines: Collection<ShippingMethodTaxLine, object>;
20
+ adjustments: Collection<ShippingMethodAdjustment, object>;
21
+ created_at: Date;
22
+ updated_at: Date;
23
+ onCreate(): void;
24
+ onUpdate(): void;
25
+ onInit(): void;
26
+ }