@medusajs/order 0.1.3-snapshot-20240531102054 → 0.1.3-snapshot-20240701122250

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +7 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/joiner-config.d.ts +1 -3
  5. package/dist/joiner-config.js +4 -42
  6. package/dist/joiner-config.js.map +1 -1
  7. package/dist/migrations/Migration20240604100512.d.ts +4 -0
  8. package/dist/migrations/Migration20240604100512.js +364 -0
  9. package/dist/migrations/Migration20240604100512.js.map +1 -0
  10. package/dist/models/claim-item-image.d.ts +18 -0
  11. package/dist/models/claim-item-image.js +108 -0
  12. package/dist/models/claim-item-image.js.map +1 -0
  13. package/dist/models/claim-item.d.ts +28 -0
  14. package/dist/models/claim-item.js +156 -0
  15. package/dist/models/claim-item.js.map +1 -0
  16. package/dist/models/claim.d.ts +35 -0
  17. package/dist/models/claim.js +196 -0
  18. package/dist/models/claim.js.map +1 -0
  19. package/dist/models/exchange-item.d.ts +23 -0
  20. package/dist/models/exchange-item.js +138 -0
  21. package/dist/models/exchange-item.js.map +1 -0
  22. package/dist/models/exchange.d.ts +33 -0
  23. package/dist/models/exchange.js +189 -0
  24. package/dist/models/exchange.js.map +1 -0
  25. package/dist/models/index.d.ts +7 -0
  26. package/dist/models/index.js +15 -1
  27. package/dist/models/index.js.map +1 -1
  28. package/dist/models/line-item-adjustment.d.ts +2 -1
  29. package/dist/models/line-item-adjustment.js +1 -1
  30. package/dist/models/line-item-adjustment.js.map +1 -1
  31. package/dist/models/line-item-tax-line.d.ts +2 -1
  32. package/dist/models/line-item-tax-line.js +1 -1
  33. package/dist/models/line-item-tax-line.js.map +1 -1
  34. package/dist/models/line-item.d.ts +1 -1
  35. package/dist/models/line-item.js +3 -3
  36. package/dist/models/line-item.js.map +1 -1
  37. package/dist/models/order-change-action.d.ts +13 -3
  38. package/dist/models/order-change-action.js +94 -0
  39. package/dist/models/order-change-action.js.map +1 -1
  40. package/dist/models/order-change.d.ts +14 -3
  41. package/dist/models/order-change.js +107 -3
  42. package/dist/models/order-change.js.map +1 -1
  43. package/dist/models/order-item.d.ts +3 -3
  44. package/dist/models/order-item.js +7 -7
  45. package/dist/models/order-item.js.map +1 -1
  46. package/dist/models/order-shipping-method.d.ts +12 -3
  47. package/dist/models/order-shipping-method.js +83 -7
  48. package/dist/models/order-shipping-method.js.map +1 -1
  49. package/dist/models/order-summary.d.ts +3 -2
  50. package/dist/models/order-summary.js +7 -4
  51. package/dist/models/order-summary.js.map +1 -1
  52. package/dist/models/order.d.ts +3 -3
  53. package/dist/models/order.js +1 -1
  54. package/dist/models/order.js.map +1 -1
  55. package/dist/models/return-item.d.ts +28 -0
  56. package/dist/models/return-item.js +170 -0
  57. package/dist/models/return-item.js.map +1 -0
  58. package/dist/models/return-reason.d.ts +3 -3
  59. package/dist/models/return-reason.js.map +1 -1
  60. package/dist/models/return.d.ts +38 -0
  61. package/dist/models/return.js +213 -0
  62. package/dist/models/return.js.map +1 -0
  63. package/dist/models/shipping-method-adjustment.d.ts +2 -1
  64. package/dist/models/shipping-method-adjustment.js +1 -1
  65. package/dist/models/shipping-method-adjustment.js.map +1 -1
  66. package/dist/models/shipping-method-tax-line.d.ts +2 -1
  67. package/dist/models/shipping-method-tax-line.js +1 -1
  68. package/dist/models/shipping-method-tax-line.js.map +1 -1
  69. package/dist/models/shipping-method.js +1 -1
  70. package/dist/models/shipping-method.js.map +1 -1
  71. package/dist/models/tax-line.js.map +1 -1
  72. package/dist/models/transaction.d.ts +11 -2
  73. package/dist/models/transaction.js +80 -1
  74. package/dist/models/transaction.js.map +1 -1
  75. package/dist/repositories/claim.d.ts +8 -0
  76. package/dist/repositories/claim.js +11 -0
  77. package/dist/repositories/claim.js.map +1 -0
  78. package/dist/repositories/exchange.d.ts +8 -0
  79. package/dist/repositories/exchange.js +11 -0
  80. package/dist/repositories/exchange.js.map +1 -0
  81. package/dist/repositories/index.d.ts +3 -1
  82. package/dist/repositories/index.js +7 -16
  83. package/dist/repositories/index.js.map +1 -1
  84. package/dist/repositories/order.d.ts +0 -3
  85. package/dist/repositories/order.js +2 -83
  86. package/dist/repositories/order.js.map +1 -1
  87. package/dist/repositories/return.d.ts +8 -0
  88. package/dist/repositories/return.js +11 -0
  89. package/dist/repositories/return.js.map +1 -0
  90. package/dist/services/actions/cancel-fulfillment.d.ts +2 -0
  91. package/dist/services/actions/cancel-fulfillment.js +32 -0
  92. package/dist/services/actions/cancel-fulfillment.js.map +1 -0
  93. package/dist/services/actions/create-claim.d.ts +2 -0
  94. package/dist/services/actions/create-claim.js +229 -0
  95. package/dist/services/actions/create-claim.js.map +1 -0
  96. package/dist/services/actions/create-exchange.d.ts +2 -0
  97. package/dist/services/actions/create-exchange.js +194 -0
  98. package/dist/services/actions/create-exchange.js.map +1 -0
  99. package/dist/services/actions/create-return.d.ts +2 -0
  100. package/dist/services/actions/create-return.js +98 -0
  101. package/dist/services/actions/create-return.js.map +1 -0
  102. package/dist/services/actions/index.d.ts +7 -0
  103. package/dist/services/actions/index.js +24 -0
  104. package/dist/services/actions/index.js.map +1 -0
  105. package/dist/services/actions/receive-return.d.ts +2 -0
  106. package/dist/services/actions/receive-return.js +75 -0
  107. package/dist/services/actions/receive-return.js.map +1 -0
  108. package/dist/services/actions/register-fulfillment.d.ts +2 -0
  109. package/dist/services/actions/register-fulfillment.js +30 -0
  110. package/dist/services/actions/register-fulfillment.js.map +1 -0
  111. package/dist/services/actions/register-shipment.d.ts +2 -0
  112. package/dist/services/actions/register-shipment.js +38 -0
  113. package/dist/services/actions/register-shipment.js.map +1 -0
  114. package/dist/services/order-change-service.d.ts +6 -6
  115. package/dist/services/order-change-service.js +4 -3
  116. package/dist/services/order-change-service.js.map +1 -1
  117. package/dist/services/order-module-service.d.ts +103 -63
  118. package/dist/services/order-module-service.js +486 -266
  119. package/dist/services/order-module-service.js.map +1 -1
  120. package/dist/services/order-service.d.ts +4 -4
  121. package/dist/services/order-service.js +1 -1
  122. package/dist/services/order-service.js.map +1 -1
  123. package/dist/types/index.d.ts +1 -0
  124. package/dist/types/index.js +1 -0
  125. package/dist/types/index.js.map +1 -1
  126. package/dist/types/order-change.d.ts +32 -0
  127. package/dist/types/order-change.js +34 -0
  128. package/dist/types/order-change.js.map +1 -0
  129. package/dist/types/utils/index.d.ts +25 -1
  130. package/dist/types/utils/index.js.map +1 -1
  131. package/dist/utils/action-key.d.ts +1 -0
  132. package/dist/utils/action-key.js +1 -0
  133. package/dist/utils/action-key.js.map +1 -1
  134. package/dist/utils/actions/cancel-item-fulfillment.d.ts +1 -0
  135. package/dist/utils/actions/cancel-item-fulfillment.js +39 -0
  136. package/dist/utils/actions/cancel-item-fulfillment.js.map +1 -0
  137. package/dist/utils/actions/cancel-return.js +3 -1
  138. package/dist/utils/actions/cancel-return.js.map +1 -1
  139. package/dist/utils/actions/fulfill-item.js +3 -1
  140. package/dist/utils/actions/fulfill-item.js.map +1 -1
  141. package/dist/utils/actions/index.d.ts +2 -0
  142. package/dist/utils/actions/index.js +2 -0
  143. package/dist/utils/actions/index.js.map +1 -1
  144. package/dist/utils/actions/item-add.js +10 -7
  145. package/dist/utils/actions/item-add.js.map +1 -1
  146. package/dist/utils/actions/item-remove.js +7 -5
  147. package/dist/utils/actions/item-remove.js.map +1 -1
  148. package/dist/utils/actions/receive-damaged-return-item.js +3 -1
  149. package/dist/utils/actions/receive-damaged-return-item.js.map +1 -1
  150. package/dist/utils/actions/receive-return-item.js +3 -1
  151. package/dist/utils/actions/receive-return-item.js.map +1 -1
  152. package/dist/utils/actions/return-item.js +3 -1
  153. package/dist/utils/actions/return-item.js.map +1 -1
  154. package/dist/utils/actions/ship-item.js +3 -1
  155. package/dist/utils/actions/ship-item.js.map +1 -1
  156. package/dist/utils/actions/shipping-add.js +6 -2
  157. package/dist/utils/actions/shipping-add.js.map +1 -1
  158. package/dist/utils/actions/write-off-item.js +3 -1
  159. package/dist/utils/actions/write-off-item.js.map +1 -1
  160. package/dist/utils/apply-order-changes.d.ts +14 -0
  161. package/dist/utils/apply-order-changes.js +74 -0
  162. package/dist/utils/apply-order-changes.js.map +1 -0
  163. package/dist/utils/base-repository-find.d.ts +2 -0
  164. package/dist/utils/base-repository-find.js +117 -0
  165. package/dist/utils/base-repository-find.js.map +1 -0
  166. package/dist/utils/calculate-order-change.js +5 -1
  167. package/dist/utils/calculate-order-change.js.map +1 -1
  168. package/dist/utils/index.d.ts +3 -0
  169. package/dist/utils/index.js +3 -0
  170. package/dist/utils/index.js.map +1 -1
  171. package/dist/utils/set-action-reference.d.ts +1 -0
  172. package/dist/utils/set-action-reference.js +11 -0
  173. package/dist/utils/set-action-reference.js.map +1 -0
  174. package/dist/utils/transform-order.d.ts +3 -2
  175. package/dist/utils/transform-order.js +84 -17
  176. package/dist/utils/transform-order.js.map +1 -1
  177. package/package.json +7 -11
  178. package/dist/module-definition.d.ts +0 -2
  179. package/dist/module-definition.js +0 -9
  180. package/dist/module-definition.js.map +0 -1
  181. package/dist/scripts/bin/run-seed.d.ts +0 -3
  182. package/dist/scripts/bin/run-seed.js +0 -49
  183. package/dist/scripts/bin/run-seed.js.map +0 -1
@@ -0,0 +1,156 @@
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 claim_1 = __importDefault(require("./claim"));
18
+ const claim_item_image_1 = __importDefault(require("./claim-item-image"));
19
+ const line_item_1 = __importDefault(require("./line-item"));
20
+ const ClaimIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
21
+ tableName: "order_claim_item",
22
+ columns: "claim_id",
23
+ where: "deleted_at IS NOT NULL",
24
+ });
25
+ const ItemIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
26
+ tableName: "order_claim_item",
27
+ columns: "item_id",
28
+ where: "deleted_at IS NOT NULL",
29
+ });
30
+ const DeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
31
+ tableName: "order_claim_item_image",
32
+ columns: "deleted_at",
33
+ where: "deleted_at IS NOT NULL",
34
+ });
35
+ let OrderClaimItem = class OrderClaimItem {
36
+ constructor() {
37
+ this.images = new core_1.Collection(this);
38
+ this.reason = null;
39
+ this.is_additional_item = false;
40
+ this.metadata = null;
41
+ this.deleted_at = null;
42
+ }
43
+ onCreate() {
44
+ this.id = (0, utils_1.generateEntityId)(this.id, "claitem");
45
+ this.claim_id = this.claim?.id;
46
+ }
47
+ onInit() {
48
+ this.id = (0, utils_1.generateEntityId)(this.id, "claitem");
49
+ this.claim_id = this.claim?.id;
50
+ }
51
+ };
52
+ __decorate([
53
+ (0, core_1.PrimaryKey)({ columnType: "text" }),
54
+ __metadata("design:type", String)
55
+ ], OrderClaimItem.prototype, "id", void 0);
56
+ __decorate([
57
+ (0, core_1.OneToMany)(() => claim_item_image_1.default, (ci) => ci.item, {
58
+ cascade: [core_1.Cascade.PERSIST, core_1.Cascade.REMOVE],
59
+ }),
60
+ __metadata("design:type", Object)
61
+ ], OrderClaimItem.prototype, "images", void 0);
62
+ __decorate([
63
+ (0, core_1.Enum)({ items: () => utils_1.ClaimReason, nullable: true }),
64
+ __metadata("design:type", Object)
65
+ ], OrderClaimItem.prototype, "reason", void 0);
66
+ __decorate([
67
+ (0, utils_1.MikroOrmBigNumberProperty)(),
68
+ __metadata("design:type", Number)
69
+ ], OrderClaimItem.prototype, "quantity", void 0);
70
+ __decorate([
71
+ (0, core_1.Property)({ columnType: "jsonb" }),
72
+ __metadata("design:type", Object)
73
+ ], OrderClaimItem.prototype, "raw_quantity", void 0);
74
+ __decorate([
75
+ (0, core_1.ManyToOne)(() => claim_1.default, {
76
+ columnType: "text",
77
+ fieldName: "claim_id",
78
+ mapToPk: true,
79
+ onDelete: "cascade",
80
+ }),
81
+ ClaimIdIndex.MikroORMIndex(),
82
+ __metadata("design:type", String)
83
+ ], OrderClaimItem.prototype, "claim_id", void 0);
84
+ __decorate([
85
+ (0, core_1.ManyToOne)(() => claim_1.default, {
86
+ persist: false,
87
+ }),
88
+ __metadata("design:type", Object)
89
+ ], OrderClaimItem.prototype, "claim", void 0);
90
+ __decorate([
91
+ (0, core_1.ManyToOne)({
92
+ entity: () => line_item_1.default,
93
+ fieldName: "item_id",
94
+ mapToPk: true,
95
+ columnType: "text",
96
+ }),
97
+ ItemIdIndex.MikroORMIndex(),
98
+ __metadata("design:type", String)
99
+ ], OrderClaimItem.prototype, "item_id", void 0);
100
+ __decorate([
101
+ (0, core_1.ManyToOne)(() => line_item_1.default, {
102
+ persist: false,
103
+ }),
104
+ __metadata("design:type", Object)
105
+ ], OrderClaimItem.prototype, "item", void 0);
106
+ __decorate([
107
+ (0, core_1.Property)({ columnType: "boolean", default: false }),
108
+ __metadata("design:type", Boolean)
109
+ ], OrderClaimItem.prototype, "is_additional_item", void 0);
110
+ __decorate([
111
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
112
+ __metadata("design:type", String)
113
+ ], OrderClaimItem.prototype, "note", void 0);
114
+ __decorate([
115
+ (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
116
+ __metadata("design:type", Object)
117
+ ], OrderClaimItem.prototype, "metadata", void 0);
118
+ __decorate([
119
+ (0, core_1.Property)({
120
+ onCreate: () => new Date(),
121
+ columnType: "timestamptz",
122
+ defaultRaw: "now()",
123
+ }),
124
+ __metadata("design:type", Date)
125
+ ], OrderClaimItem.prototype, "created_at", void 0);
126
+ __decorate([
127
+ (0, core_1.Property)({
128
+ onCreate: () => new Date(),
129
+ onUpdate: () => new Date(),
130
+ columnType: "timestamptz",
131
+ defaultRaw: "now()",
132
+ }),
133
+ __metadata("design:type", Date)
134
+ ], OrderClaimItem.prototype, "updated_at", void 0);
135
+ __decorate([
136
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
137
+ DeletedAtIndex.MikroORMIndex(),
138
+ __metadata("design:type", Object)
139
+ ], OrderClaimItem.prototype, "deleted_at", void 0);
140
+ __decorate([
141
+ (0, core_1.BeforeCreate)(),
142
+ __metadata("design:type", Function),
143
+ __metadata("design:paramtypes", []),
144
+ __metadata("design:returntype", void 0)
145
+ ], OrderClaimItem.prototype, "onCreate", null);
146
+ __decorate([
147
+ (0, core_1.OnInit)(),
148
+ __metadata("design:type", Function),
149
+ __metadata("design:paramtypes", []),
150
+ __metadata("design:returntype", void 0)
151
+ ], OrderClaimItem.prototype, "onInit", null);
152
+ OrderClaimItem = __decorate([
153
+ (0, core_1.Entity)({ tableName: "order_claim_item" })
154
+ ], OrderClaimItem);
155
+ exports.default = OrderClaimItem;
156
+ //# sourceMappingURL=claim-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim-item.js","sourceRoot":"","sources":["../../src/models/claim-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,2CAKwB;AACxB,0CAawB;AACxB,oDAA2B;AAC3B,0EAA+C;AAC/C,4DAAkC;AAIlC,MAAM,YAAY,GAAG,IAAA,sCAA8B,EAAC;IAClD,SAAS,EAAE,kBAAkB;IAC7B,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,wBAAwB;CAChC,CAAC,CAAA;AAEF,MAAM,WAAW,GAAG,IAAA,sCAA8B,EAAC;IACjD,SAAS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QhB;IANC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;kDAAA;AAIhB;IAFC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvD,cAAc,CAAC,aAAa,EAAE;;kDACD;AAG9B;IADC,IAAA,mBAAY,GAAE;;;;8CAId;AAGD;IADC,IAAA,aAAM,GAAE;;;;4CAIR;AAtFkB,cAAc;IADlC,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;GACrB,cAAc,CAuFlC;kBAvFoB,cAAc"}
@@ -0,0 +1,35 @@
1
+ import { BigNumberRawValue, DAL } from "@medusajs/types";
2
+ import { BigNumber, ClaimType } from "@medusajs/utils";
3
+ import { Collection, OptionalProps, Rel } from "@mikro-orm/core";
4
+ import ClaimItem from "./claim-item";
5
+ import Order from "./order";
6
+ import OrderShippingMethod from "./order-shipping-method";
7
+ import Return from "./return";
8
+ import Transaction from "./transaction";
9
+ type OptionalOrderClaimProps = DAL.EntityDateColumns;
10
+ export default class OrderClaim {
11
+ [OptionalProps]?: OptionalOrderClaimProps;
12
+ id: string;
13
+ order_id: string;
14
+ order: Rel<Order>;
15
+ return: Rel<Return>;
16
+ return_id: string | null;
17
+ order_version: number;
18
+ display_id: number;
19
+ type: Rel<ClaimType>;
20
+ no_notification: boolean | null;
21
+ refund_amount: BigNumber | number;
22
+ raw_refund_amount: BigNumberRawValue;
23
+ additional_items: Collection<ClaimItem, object>;
24
+ claim_items: Collection<ClaimItem, object>;
25
+ shipping_methods: Collection<OrderShippingMethod, object>;
26
+ transactions: Collection<Transaction, object>;
27
+ metadata: Record<string, unknown> | null;
28
+ created_at: Date;
29
+ updated_at: Date;
30
+ deleted_at: Date | null;
31
+ canceled_at: Date | null;
32
+ onCreate(): void;
33
+ onInit(): void;
34
+ }
35
+ export {};
@@ -0,0 +1,196 @@
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 claim_item_1 = __importDefault(require("./claim-item"));
18
+ const order_1 = __importDefault(require("./order"));
19
+ const order_shipping_method_1 = __importDefault(require("./order-shipping-method"));
20
+ const return_1 = __importDefault(require("./return"));
21
+ const transaction_1 = __importDefault(require("./transaction"));
22
+ const DisplayIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
23
+ tableName: "order_claim",
24
+ columns: "display_id",
25
+ where: "deleted_at IS NOT NULL",
26
+ });
27
+ const OrderClaimDeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
28
+ tableName: "order_claim",
29
+ columns: "deleted_at",
30
+ where: "deleted_at IS NOT NULL",
31
+ });
32
+ const OrderIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
33
+ tableName: "order_claim",
34
+ columns: ["order_id"],
35
+ where: "deleted_at IS NOT NULL",
36
+ });
37
+ const ReturnIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
38
+ tableName: "order_claim",
39
+ columns: "return_id",
40
+ where: "return_id IS NOT NULL AND deleted_at IS NOT NULL",
41
+ });
42
+ let OrderClaim = class OrderClaim {
43
+ constructor() {
44
+ this.return_id = null;
45
+ this.no_notification = null;
46
+ this.additional_items = new core_1.Collection(this);
47
+ this.claim_items = new core_1.Collection(this);
48
+ this.shipping_methods = new core_1.Collection(this);
49
+ this.transactions = new core_1.Collection(this);
50
+ this.metadata = null;
51
+ this.deleted_at = null;
52
+ this.canceled_at = null;
53
+ }
54
+ onCreate() {
55
+ this.id = (0, utils_1.generateEntityId)(this.id, "claim");
56
+ }
57
+ onInit() {
58
+ this.id = (0, utils_1.generateEntityId)(this.id, "claim");
59
+ }
60
+ };
61
+ __decorate([
62
+ (0, core_1.PrimaryKey)({ columnType: "text" }),
63
+ __metadata("design:type", String)
64
+ ], OrderClaim.prototype, "id", void 0);
65
+ __decorate([
66
+ (0, core_1.ManyToOne)({
67
+ entity: () => order_1.default,
68
+ mapToPk: true,
69
+ fieldName: "order_id",
70
+ columnType: "text",
71
+ }),
72
+ OrderIdIndex.MikroORMIndex(),
73
+ __metadata("design:type", String)
74
+ ], OrderClaim.prototype, "order_id", void 0);
75
+ __decorate([
76
+ (0, core_1.ManyToOne)(() => order_1.default, {
77
+ persist: false,
78
+ }),
79
+ __metadata("design:type", Object)
80
+ ], OrderClaim.prototype, "order", void 0);
81
+ __decorate([
82
+ (0, core_1.OneToOne)({
83
+ entity: () => return_1.default,
84
+ mappedBy: (ret) => ret.claim,
85
+ cascade: ["soft-remove"],
86
+ fieldName: "return_id",
87
+ nullable: true,
88
+ owner: true,
89
+ }),
90
+ __metadata("design:type", Object)
91
+ ], OrderClaim.prototype, "return", void 0);
92
+ __decorate([
93
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
94
+ ReturnIdIndex.MikroORMIndex(),
95
+ __metadata("design:type", Object)
96
+ ], OrderClaim.prototype, "return_id", void 0);
97
+ __decorate([
98
+ (0, core_1.Property)({
99
+ columnType: "integer",
100
+ }),
101
+ __metadata("design:type", Number)
102
+ ], OrderClaim.prototype, "order_version", void 0);
103
+ __decorate([
104
+ (0, core_1.Property)({ autoincrement: true, primary: false }),
105
+ DisplayIdIndex.MikroORMIndex(),
106
+ __metadata("design:type", Number)
107
+ ], OrderClaim.prototype, "display_id", void 0);
108
+ __decorate([
109
+ (0, core_1.Enum)({ items: () => utils_1.ClaimType }),
110
+ __metadata("design:type", Object)
111
+ ], OrderClaim.prototype, "type", void 0);
112
+ __decorate([
113
+ (0, core_1.Property)({ columnType: "boolean", nullable: true }),
114
+ __metadata("design:type", Object)
115
+ ], OrderClaim.prototype, "no_notification", void 0);
116
+ __decorate([
117
+ (0, utils_1.MikroOrmBigNumberProperty)({
118
+ nullable: true,
119
+ }),
120
+ __metadata("design:type", Object)
121
+ ], OrderClaim.prototype, "refund_amount", void 0);
122
+ __decorate([
123
+ (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
124
+ __metadata("design:type", Object)
125
+ ], OrderClaim.prototype, "raw_refund_amount", void 0);
126
+ __decorate([
127
+ (0, core_1.OneToMany)(() => claim_item_1.default, (item) => item.claim, {
128
+ cascade: [core_1.Cascade.PERSIST],
129
+ }),
130
+ __metadata("design:type", Object)
131
+ ], OrderClaim.prototype, "additional_items", void 0);
132
+ __decorate([
133
+ (0, core_1.OneToMany)(() => claim_item_1.default, (item) => item.claim, {
134
+ cascade: [core_1.Cascade.PERSIST],
135
+ }),
136
+ __metadata("design:type", Object)
137
+ ], OrderClaim.prototype, "claim_items", void 0);
138
+ __decorate([
139
+ (0, core_1.OneToMany)(() => order_shipping_method_1.default, (shippingMethod) => shippingMethod.claim, {
140
+ cascade: [core_1.Cascade.PERSIST],
141
+ }),
142
+ __metadata("design:type", Object)
143
+ ], OrderClaim.prototype, "shipping_methods", void 0);
144
+ __decorate([
145
+ (0, core_1.OneToMany)(() => transaction_1.default, (transaction) => transaction.claim, {
146
+ cascade: [core_1.Cascade.PERSIST],
147
+ }),
148
+ __metadata("design:type", Object)
149
+ ], OrderClaim.prototype, "transactions", void 0);
150
+ __decorate([
151
+ (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
152
+ __metadata("design:type", Object)
153
+ ], OrderClaim.prototype, "metadata", 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
+ ], OrderClaim.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
+ ], OrderClaim.prototype, "updated_at", void 0);
171
+ __decorate([
172
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
173
+ OrderClaimDeletedAtIndex.MikroORMIndex(),
174
+ __metadata("design:type", Object)
175
+ ], OrderClaim.prototype, "deleted_at", void 0);
176
+ __decorate([
177
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
178
+ __metadata("design:type", Object)
179
+ ], OrderClaim.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
+ ], OrderClaim.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
+ ], OrderClaim.prototype, "onInit", null);
192
+ OrderClaim = __decorate([
193
+ (0, core_1.Entity)({ tableName: "order_claim" })
194
+ ], OrderClaim);
195
+ exports.default = OrderClaim;
196
+ //# sourceMappingURL=claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claim.js","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AAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;8CAAA;AAQhB;IANC,IAAA,eAAQ,EAAC;QACR,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAC1B,UAAU,EAAE,aAAa;QACzB,UAAU,EAAE,OAAO;KACpB,CAAC;8BACU,IAAI;8CAAA;AAIhB;IAFC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvD,wBAAwB,CAAC,aAAa,EAAE;;8CACX;AAG9B;IADC,IAAA,eAAQ,EAAC,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACzB;AAG/B;IADC,IAAA,mBAAY,GAAE;;;;0CAGd;AAGD;IADC,IAAA,aAAM,GAAE;;;;wCAGR;AAlHkB,UAAU;IAD9B,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;GAChB,UAAU,CAmH9B;kBAnHoB,UAAU"}
@@ -0,0 +1,23 @@
1
+ import { BigNumberRawValue, DAL } from "@medusajs/types";
2
+ import { OptionalProps } from "@mikro-orm/core";
3
+ import Exchange from "./exchange";
4
+ import LineItem from "./line-item";
5
+ type OptionalLineItemProps = DAL.EntityDateColumns;
6
+ export default class OrderExchangeItem {
7
+ [OptionalProps]?: OptionalLineItemProps;
8
+ id: string;
9
+ quantity: Number | number;
10
+ raw_quantity: BigNumberRawValue;
11
+ exchange_id: string;
12
+ exchange: Exchange;
13
+ item_id: string;
14
+ item: LineItem;
15
+ note: string;
16
+ metadata: Record<string, unknown> | null;
17
+ created_at: Date;
18
+ updated_at: Date;
19
+ deleted_at: Date | null;
20
+ onCreate(): void;
21
+ onInit(): void;
22
+ }
23
+ export {};
@@ -0,0 +1,138 @@
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 exchange_1 = __importDefault(require("./exchange"));
18
+ const line_item_1 = __importDefault(require("./line-item"));
19
+ const ExchangeIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
20
+ tableName: "order_exchange_item",
21
+ columns: "exchange_id",
22
+ where: "deleted_at IS NOT NULL",
23
+ });
24
+ const ItemIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
25
+ tableName: "order_exchange_item",
26
+ columns: "item_id",
27
+ where: "deleted_at IS NOT NULL",
28
+ });
29
+ const DeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
30
+ tableName: "order_claim_item_image",
31
+ columns: "deleted_at",
32
+ where: "deleted_at IS NOT NULL",
33
+ });
34
+ let OrderExchangeItem = class OrderExchangeItem {
35
+ constructor() {
36
+ this.metadata = null;
37
+ this.deleted_at = null;
38
+ }
39
+ onCreate() {
40
+ this.id = (0, utils_1.generateEntityId)(this.id, "oexcitem");
41
+ this.exchange_id = this.exchange?.id;
42
+ }
43
+ onInit() {
44
+ this.id = (0, utils_1.generateEntityId)(this.id, "oexcitem");
45
+ this.exchange_id = this.exchange?.id;
46
+ }
47
+ };
48
+ __decorate([
49
+ (0, core_1.PrimaryKey)({ columnType: "text" }),
50
+ __metadata("design:type", String)
51
+ ], OrderExchangeItem.prototype, "id", void 0);
52
+ __decorate([
53
+ (0, utils_1.MikroOrmBigNumberProperty)(),
54
+ __metadata("design:type", Number)
55
+ ], OrderExchangeItem.prototype, "quantity", void 0);
56
+ __decorate([
57
+ (0, core_1.Property)({ columnType: "jsonb" }),
58
+ __metadata("design:type", Object)
59
+ ], OrderExchangeItem.prototype, "raw_quantity", void 0);
60
+ __decorate([
61
+ (0, core_1.ManyToOne)(() => exchange_1.default, {
62
+ columnType: "text",
63
+ fieldName: "exchange_id",
64
+ mapToPk: true,
65
+ onDelete: "cascade",
66
+ }),
67
+ ExchangeIdIndex.MikroORMIndex(),
68
+ __metadata("design:type", String)
69
+ ], OrderExchangeItem.prototype, "exchange_id", void 0);
70
+ __decorate([
71
+ (0, core_1.ManyToOne)(() => exchange_1.default, {
72
+ persist: false,
73
+ }),
74
+ __metadata("design:type", exchange_1.default)
75
+ ], OrderExchangeItem.prototype, "exchange", void 0);
76
+ __decorate([
77
+ (0, core_1.ManyToOne)({
78
+ entity: () => line_item_1.default,
79
+ fieldName: "item_id",
80
+ mapToPk: true,
81
+ columnType: "text",
82
+ }),
83
+ ItemIdIndex.MikroORMIndex(),
84
+ __metadata("design:type", String)
85
+ ], OrderExchangeItem.prototype, "item_id", void 0);
86
+ __decorate([
87
+ (0, core_1.ManyToOne)(() => line_item_1.default, {
88
+ persist: false,
89
+ }),
90
+ __metadata("design:type", line_item_1.default)
91
+ ], OrderExchangeItem.prototype, "item", void 0);
92
+ __decorate([
93
+ (0, core_1.Property)({ columnType: "text", nullable: true }),
94
+ __metadata("design:type", String)
95
+ ], OrderExchangeItem.prototype, "note", void 0);
96
+ __decorate([
97
+ (0, core_1.Property)({ columnType: "jsonb", nullable: true }),
98
+ __metadata("design:type", Object)
99
+ ], OrderExchangeItem.prototype, "metadata", void 0);
100
+ __decorate([
101
+ (0, core_1.Property)({
102
+ onCreate: () => new Date(),
103
+ columnType: "timestamptz",
104
+ defaultRaw: "now()",
105
+ }),
106
+ __metadata("design:type", Date)
107
+ ], OrderExchangeItem.prototype, "created_at", void 0);
108
+ __decorate([
109
+ (0, core_1.Property)({
110
+ onCreate: () => new Date(),
111
+ onUpdate: () => new Date(),
112
+ columnType: "timestamptz",
113
+ defaultRaw: "now()",
114
+ }),
115
+ __metadata("design:type", Date)
116
+ ], OrderExchangeItem.prototype, "updated_at", void 0);
117
+ __decorate([
118
+ (0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
119
+ DeletedAtIndex.MikroORMIndex(),
120
+ __metadata("design:type", Object)
121
+ ], OrderExchangeItem.prototype, "deleted_at", void 0);
122
+ __decorate([
123
+ (0, core_1.BeforeCreate)(),
124
+ __metadata("design:type", Function),
125
+ __metadata("design:paramtypes", []),
126
+ __metadata("design:returntype", void 0)
127
+ ], OrderExchangeItem.prototype, "onCreate", null);
128
+ __decorate([
129
+ (0, core_1.OnInit)(),
130
+ __metadata("design:type", Function),
131
+ __metadata("design:paramtypes", []),
132
+ __metadata("design:returntype", void 0)
133
+ ], OrderExchangeItem.prototype, "onInit", null);
134
+ OrderExchangeItem = __decorate([
135
+ (0, core_1.Entity)({ tableName: "order_exchange_item" })
136
+ ], OrderExchangeItem);
137
+ exports.default = OrderExchangeItem;
138
+ //# sourceMappingURL=exchange-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange-item.js","sourceRoot":"","sources":["../../src/models/exchange-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,2CAIwB;AACxB,0CAQwB;AACxB,0DAAiC;AACjC,4DAAkC;AAIlC,MAAM,eAAe,GAAG,IAAA,sCAA8B,EAAC;IACrD,SAAS,EAAE,qBAAqB;IAChC,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,wBAAwB;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,iBAAiB;IADrC,IAAA,aAAM,EAAC,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;GACxB,iBAAiB,CA4ErC;kBA5EoB,iBAAiB"}
@@ -0,0 +1,33 @@
1
+ import { BigNumberRawValue, DAL } from "@medusajs/types";
2
+ import { BigNumber } from "@medusajs/utils";
3
+ import { Collection, OptionalProps, Rel } from "@mikro-orm/core";
4
+ import { ExchangeItem, Transaction } from ".";
5
+ import Order from "./order";
6
+ import OrderShippingMethod from "./order-shipping-method";
7
+ import Return from "./return";
8
+ type OptionalOrderExchangeProps = DAL.EntityDateColumns;
9
+ export default class OrderExchange {
10
+ [OptionalProps]?: OptionalOrderExchangeProps;
11
+ id: string;
12
+ order_id: string;
13
+ order: Rel<Order>;
14
+ return: Rel<Return>;
15
+ return_id: string | null;
16
+ order_version: number;
17
+ display_id: number;
18
+ no_notification: boolean | null;
19
+ difference_due: BigNumber | number;
20
+ raw_difference_due: BigNumberRawValue;
21
+ allow_backorder: boolean;
22
+ additional_items: Collection<ExchangeItem, object>;
23
+ shipping_methods: Collection<OrderShippingMethod, object>;
24
+ transactions: Collection<Transaction, object>;
25
+ metadata: Record<string, unknown> | null;
26
+ created_at: Date;
27
+ updated_at: Date;
28
+ deleted_at: Date | null;
29
+ canceled_at: Date | null;
30
+ onCreate(): void;
31
+ onInit(): void;
32
+ }
33
+ export {};