@medusajs/medusa 1.1.62 → 1.1.63-adminc.21

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 (150) hide show
  1. package/dist/api/routes/admin/collections/list-collections.d.ts +16 -3
  2. package/dist/api/routes/admin/collections/list-collections.js +88 -10
  3. package/dist/api/routes/admin/collections/list-collections.js.map +1 -1
  4. package/dist/api/routes/admin/discounts/list-discounts.d.ts +6 -0
  5. package/dist/api/routes/admin/discounts/list-discounts.js +45 -8
  6. package/dist/api/routes/admin/discounts/list-discounts.js.map +1 -1
  7. package/dist/api/routes/admin/orders/list-orders.js +1 -1
  8. package/dist/api/routes/admin/orders/list-orders.js.map +1 -1
  9. package/dist/api/routes/admin/products/list-products.js +1 -2
  10. package/dist/api/routes/admin/products/list-products.js.map +1 -1
  11. package/dist/api/routes/admin/tax-rates/add-to-product-types.d.ts +29 -0
  12. package/dist/api/routes/admin/tax-rates/add-to-product-types.js +177 -0
  13. package/dist/api/routes/admin/tax-rates/add-to-product-types.js.map +1 -0
  14. package/dist/api/routes/admin/tax-rates/add-to-products.d.ts +29 -0
  15. package/dist/api/routes/admin/tax-rates/add-to-products.js +173 -0
  16. package/dist/api/routes/admin/tax-rates/add-to-products.js.map +1 -0
  17. package/dist/api/routes/admin/tax-rates/add-to-shipping-options.d.ts +29 -0
  18. package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js +177 -0
  19. package/dist/api/routes/admin/tax-rates/add-to-shipping-options.js.map +1 -0
  20. package/dist/api/routes/admin/tax-rates/create-tax-rate.d.ts +35 -0
  21. package/dist/api/routes/admin/tax-rates/create-tax-rate.js +286 -0
  22. package/dist/api/routes/admin/tax-rates/create-tax-rate.js.map +1 -0
  23. package/dist/api/routes/admin/tax-rates/delete-tax-rate.d.ts +28 -0
  24. package/dist/api/routes/admin/tax-rates/delete-tax-rate.js +84 -0
  25. package/dist/api/routes/admin/tax-rates/delete-tax-rate.js.map +1 -0
  26. package/dist/api/routes/admin/tax-rates/get-tax-rate.d.ts +26 -0
  27. package/dist/api/routes/admin/tax-rates/get-tax-rate.js +106 -0
  28. package/dist/api/routes/admin/tax-rates/get-tax-rate.js.map +1 -0
  29. package/dist/api/routes/admin/tax-rates/index.d.ts +21 -0
  30. package/dist/api/routes/admin/tax-rates/index.js +74 -0
  31. package/dist/api/routes/admin/tax-rates/index.js.map +1 -0
  32. package/dist/api/routes/admin/tax-rates/list-tax-rates.d.ts +44 -0
  33. package/dist/api/routes/admin/tax-rates/list-tax-rates.js +178 -0
  34. package/dist/api/routes/admin/tax-rates/list-tax-rates.js.map +1 -0
  35. package/dist/api/routes/admin/tax-rates/update-tax-rate.d.ts +35 -0
  36. package/dist/api/routes/admin/tax-rates/update-tax-rate.js +286 -0
  37. package/dist/api/routes/admin/tax-rates/update-tax-rate.js.map +1 -0
  38. package/dist/api/routes/admin/tax-rates/utils/get-query-config.d.ts +7 -0
  39. package/dist/api/routes/admin/tax-rates/utils/get-query-config.js +91 -0
  40. package/dist/api/routes/admin/tax-rates/utils/get-query-config.js.map +1 -0
  41. package/dist/api/routes/store/carts/calculate-taxes.d.ts +24 -0
  42. package/dist/api/routes/store/carts/calculate-taxes.js +153 -0
  43. package/dist/api/routes/store/carts/calculate-taxes.js.map +1 -0
  44. package/dist/interfaces/cart-completion-strategy.d.ts +20 -0
  45. package/dist/interfaces/cart-completion-strategy.js +10 -0
  46. package/dist/interfaces/cart-completion-strategy.js.map +1 -0
  47. package/dist/interfaces/index.d.ts +3 -0
  48. package/dist/interfaces/index.js +16 -0
  49. package/dist/interfaces/index.js.map +1 -0
  50. package/dist/interfaces/tax-calculation-strategy.d.ts +16 -0
  51. package/dist/interfaces/tax-calculation-strategy.js +10 -0
  52. package/dist/interfaces/tax-calculation-strategy.js.map +1 -0
  53. package/dist/interfaces/tax-service.d.ts +51 -0
  54. package/dist/interfaces/tax-service.js +3 -0
  55. package/dist/interfaces/tax-service.js.map +1 -0
  56. package/dist/loaders/strategies.d.ts +12 -0
  57. package/dist/loaders/strategies.js +32 -0
  58. package/dist/loaders/strategies.js.map +1 -0
  59. package/dist/migrations/1641636508055-new_tax_system.d.ts +6 -0
  60. package/dist/migrations/1641636508055-new_tax_system.js +248 -0
  61. package/dist/migrations/1641636508055-new_tax_system.js.map +1 -0
  62. package/dist/models/discount.js +2 -1
  63. package/dist/models/discount.js.map +1 -1
  64. package/dist/models/line-item-tax-line.d.ts +7 -0
  65. package/dist/models/line-item-tax-line.js +65 -0
  66. package/dist/models/line-item-tax-line.js.map +1 -0
  67. package/dist/models/product-tax-rate.d.ts +40 -0
  68. package/dist/models/product-tax-rate.js +88 -0
  69. package/dist/models/product-tax-rate.js.map +1 -0
  70. package/dist/models/product-type-tax-rate.d.ts +40 -0
  71. package/dist/models/product-type-tax-rate.js +88 -0
  72. package/dist/models/product-type-tax-rate.js.map +1 -0
  73. package/dist/models/shipping-method-tax-line.d.ts +7 -0
  74. package/dist/models/shipping-method-tax-line.js +65 -0
  75. package/dist/models/shipping-method-tax-line.js.map +1 -0
  76. package/dist/models/shipping-tax-rate.d.ts +40 -0
  77. package/dist/models/shipping-tax-rate.js +88 -0
  78. package/dist/models/shipping-tax-rate.js.map +1 -0
  79. package/dist/models/tax-line.d.ts +39 -0
  80. package/dist/models/tax-line.js +79 -0
  81. package/dist/models/tax-line.js.map +1 -0
  82. package/dist/models/tax-provider.d.ts +17 -0
  83. package/dist/models/tax-provider.js +44 -0
  84. package/dist/models/tax-provider.js.map +1 -0
  85. package/dist/models/tax-rate.d.ts +58 -0
  86. package/dist/models/tax-rate.js +159 -0
  87. package/dist/models/tax-rate.js.map +1 -0
  88. package/dist/repositories/line-item-tax-line.d.ts +4 -0
  89. package/dist/repositories/line-item-tax-line.js +38 -0
  90. package/dist/repositories/line-item-tax-line.js.map +1 -0
  91. package/dist/repositories/product-tax-rate.d.ts +4 -0
  92. package/dist/repositories/product-tax-rate.js +38 -0
  93. package/dist/repositories/product-tax-rate.js.map +1 -0
  94. package/dist/repositories/shipping-method-tax-line.d.ts +4 -0
  95. package/dist/repositories/shipping-method-tax-line.js +38 -0
  96. package/dist/repositories/shipping-method-tax-line.js.map +1 -0
  97. package/dist/repositories/shipping-tax-rate.d.ts +4 -0
  98. package/dist/repositories/shipping-tax-rate.js +38 -0
  99. package/dist/repositories/shipping-tax-rate.js.map +1 -0
  100. package/dist/repositories/tax-rate.d.ts +18 -0
  101. package/dist/repositories/tax-rate.js +359 -0
  102. package/dist/repositories/tax-rate.js.map +1 -0
  103. package/dist/services/product-tax-rate.d.ts +25 -0
  104. package/dist/services/product-tax-rate.js +104 -0
  105. package/dist/services/product-tax-rate.js.map +1 -0
  106. package/dist/services/product-type.d.ts +27 -0
  107. package/dist/services/product-type.js +112 -0
  108. package/dist/services/product-type.js.map +1 -0
  109. package/dist/services/shipping-tax-rate.d.ts +26 -0
  110. package/dist/services/shipping-tax-rate.js +105 -0
  111. package/dist/services/shipping-tax-rate.js.map +1 -0
  112. package/dist/services/system-tax.d.ts +9 -0
  113. package/dist/services/system-tax.js +89 -0
  114. package/dist/services/system-tax.js.map +1 -0
  115. package/dist/services/tax-provider.d.ts +105 -0
  116. package/dist/services/tax-provider.js +455 -0
  117. package/dist/services/tax-provider.js.map +1 -0
  118. package/dist/services/tax-rate.d.ts +31 -0
  119. package/dist/services/tax-rate.js +405 -0
  120. package/dist/services/tax-rate.js.map +1 -0
  121. package/dist/strategies/cart-completion.d.ts +17 -0
  122. package/dist/strategies/cart-completion.js +336 -0
  123. package/dist/strategies/cart-completion.js.map +1 -0
  124. package/dist/strategies/tax-calculation.d.ts +11 -0
  125. package/dist/strategies/tax-calculation.js +147 -0
  126. package/dist/strategies/tax-calculation.js.map +1 -0
  127. package/dist/types/discount.js.map +1 -1
  128. package/dist/types/orders.js +1 -1
  129. package/dist/types/orders.js.map +1 -1
  130. package/dist/types/product-tax-rate.d.ts +10 -0
  131. package/dist/types/product-tax-rate.js +13 -0
  132. package/dist/types/product-tax-rate.js.map +1 -0
  133. package/dist/types/request.d.ts +3 -0
  134. package/dist/types/request.js +3 -0
  135. package/dist/types/request.js.map +1 -0
  136. package/dist/types/shipping-tax-rate.d.ts +10 -0
  137. package/dist/types/shipping-tax-rate.js +13 -0
  138. package/dist/types/shipping-tax-rate.js.map +1 -0
  139. package/dist/types/tax-rate.d.ts +25 -0
  140. package/dist/types/tax-rate.js +3 -0
  141. package/dist/types/tax-rate.js.map +1 -0
  142. package/dist/types/tax-service.d.ts +34 -0
  143. package/dist/types/tax-service.js +3 -0
  144. package/dist/types/tax-service.js.map +1 -0
  145. package/dist/types/totals.d.ts +42 -0
  146. package/dist/types/totals.js +3 -0
  147. package/dist/types/totals.js.map +1 -0
  148. package/jest.config.js +17 -0
  149. package/package.json +3 -3
  150. package/yarn-error.log +79 -5
@@ -0,0 +1,286 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ var __generator = (this && this.__generator) || function (thisArg, body) {
21
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
22
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
+ function verb(n) { return function (v) { return step([n, v]); }; }
24
+ function step(op) {
25
+ if (f) throw new TypeError("Generator is already executing.");
26
+ while (_) try {
27
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
28
+ if (y = 0, t) op = [op[0] & 2, t.value];
29
+ switch (op[0]) {
30
+ case 0: case 1: t = op; break;
31
+ case 4: _.label++; return { value: op[1], done: false };
32
+ case 5: _.label++; y = op[1]; op = [0]; continue;
33
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
34
+ default:
35
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
36
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
37
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
38
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
39
+ if (t[2]) _.ops.pop();
40
+ _.trys.pop(); continue;
41
+ }
42
+ op = body.call(thisArg, _);
43
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
44
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
45
+ }
46
+ };
47
+ var __read = (this && this.__read) || function (o, n) {
48
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
49
+ if (!m) return o;
50
+ var i = m.call(o), r, ar = [], e;
51
+ try {
52
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
53
+ }
54
+ catch (error) { e = { error: error }; }
55
+ finally {
56
+ try {
57
+ if (r && !r.done && (m = i["return"])) m.call(i);
58
+ }
59
+ finally { if (e) throw e.error; }
60
+ }
61
+ return ar;
62
+ };
63
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
64
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
65
+ if (ar || !(i in from)) {
66
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
67
+ ar[i] = from[i];
68
+ }
69
+ }
70
+ return to.concat(ar || Array.prototype.slice.call(from));
71
+ };
72
+ Object.defineProperty(exports, "__esModule", { value: true });
73
+ exports.AdminPostTaxRatesParams = exports.AdminPostTaxRatesReq = void 0;
74
+ var class_validator_1 = require("class-validator");
75
+ var lodash_1 = require("lodash");
76
+ var medusa_core_utils_1 = require("medusa-core-utils");
77
+ var get_query_config_1 = require("./utils/get-query-config");
78
+ var validator_1 = require("../../../../utils/validator");
79
+ var is_type_1 = require("../../../../utils/validators/is-type");
80
+ /**
81
+ * @oas [post] /tax-rates
82
+ * operationId: "PostTaxRates"
83
+ * summary: "Create a Tax Rate"
84
+ * description: "Creates a Tax Rate"
85
+ * x-authenticated: true
86
+ * tags:
87
+ * - Tax Rates
88
+ * responses:
89
+ * 200:
90
+ * description: OK
91
+ * content:
92
+ * application/json:
93
+ * schema:
94
+ * properties:
95
+ * tax_rate:
96
+ * type: array
97
+ * items:
98
+ * $ref: "#/components/schemas/tax_rate"
99
+ */
100
+ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
101
+ var value, query, manager, rateService, productService, productTypeService, shippingOptionService, id, config, rate, data;
102
+ return __generator(this, function (_a) {
103
+ switch (_a.label) {
104
+ case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminPostTaxRatesReq, req.body)];
105
+ case 1:
106
+ value = _a.sent();
107
+ return [4 /*yield*/, (0, validator_1.validator)(AdminPostTaxRatesParams, req.query)];
108
+ case 2:
109
+ query = _a.sent();
110
+ manager = req.scope.resolve("manager");
111
+ rateService = req.scope.resolve("taxRateService");
112
+ productService = req.scope.resolve("productService");
113
+ productTypeService = req.scope.resolve("productTypeService");
114
+ shippingOptionService = req.scope.resolve("shippingOptionService");
115
+ return [4 /*yield*/, manager.transaction(function (tx) { return __awaiter(void 0, void 0, void 0, function () {
116
+ var txRateService, created, err_1, err_2, err_3;
117
+ return __generator(this, function (_a) {
118
+ switch (_a.label) {
119
+ case 0:
120
+ txRateService = rateService.withTransaction(tx);
121
+ return [4 /*yield*/, txRateService.create((0, lodash_1.omit)(value, ["products", "product_types", "shipping_options"]))];
122
+ case 1:
123
+ created = _a.sent();
124
+ id = created.id;
125
+ if (!(typeof value.products !== "undefined")) return [3 /*break*/, 7];
126
+ _a.label = 2;
127
+ case 2:
128
+ _a.trys.push([2, 4, , 7]);
129
+ return [4 /*yield*/, txRateService.addToProduct(id, value.products)];
130
+ case 3:
131
+ _a.sent();
132
+ return [3 /*break*/, 7];
133
+ case 4:
134
+ err_1 = _a.sent();
135
+ if (!(err_1.code === "23503")) return [3 /*break*/, 6];
136
+ // A foreign key constraint failed meaning some thing doesn't exist
137
+ // either it is a product or the tax rate itself. Using Promise.all
138
+ // will try to retrieve all of the resources and will fail when
139
+ // something is not found.
140
+ return [4 /*yield*/, Promise.all(__spreadArray([
141
+ txRateService.retrieve(id, { select: ["id"] })
142
+ ], __read(value.products.map(function (pId) {
143
+ return productService.retrieve(pId, { select: ["id"] });
144
+ })), false))];
145
+ case 5:
146
+ // A foreign key constraint failed meaning some thing doesn't exist
147
+ // either it is a product or the tax rate itself. Using Promise.all
148
+ // will try to retrieve all of the resources and will fail when
149
+ // something is not found.
150
+ _a.sent();
151
+ _a.label = 6;
152
+ case 6: throw err_1;
153
+ case 7:
154
+ if (!(typeof value.product_types !== "undefined")) return [3 /*break*/, 13];
155
+ _a.label = 8;
156
+ case 8:
157
+ _a.trys.push([8, 10, , 13]);
158
+ return [4 /*yield*/, txRateService.addToProductType(id, value.product_types)];
159
+ case 9:
160
+ _a.sent();
161
+ return [3 /*break*/, 13];
162
+ case 10:
163
+ err_2 = _a.sent();
164
+ if (!(err_2.code === "23503")) return [3 /*break*/, 12];
165
+ // A foreign key constraint failed meaning some thing doesn't exist
166
+ // either it is a product or the tax rate itself. Using Promise.all
167
+ // will try to retrieve all of the resources and will fail when
168
+ // something is not found.
169
+ return [4 /*yield*/, Promise.all(__spreadArray([
170
+ txRateService.retrieve(id, { select: ["id"] })
171
+ ], __read(value.product_types.map(function (pId) {
172
+ return productTypeService.retrieve(pId, {
173
+ select: ["id"],
174
+ });
175
+ })), false))];
176
+ case 11:
177
+ // A foreign key constraint failed meaning some thing doesn't exist
178
+ // either it is a product or the tax rate itself. Using Promise.all
179
+ // will try to retrieve all of the resources and will fail when
180
+ // something is not found.
181
+ _a.sent();
182
+ _a.label = 12;
183
+ case 12: throw err_2;
184
+ case 13:
185
+ if (!(typeof value.shipping_options !== "undefined")) return [3 /*break*/, 19];
186
+ _a.label = 14;
187
+ case 14:
188
+ _a.trys.push([14, 16, , 19]);
189
+ return [4 /*yield*/, txRateService.addToShippingOption(id, value.shipping_options)];
190
+ case 15:
191
+ _a.sent();
192
+ return [3 /*break*/, 19];
193
+ case 16:
194
+ err_3 = _a.sent();
195
+ if (!(err_3.code === "23503")) return [3 /*break*/, 18];
196
+ // A foreign key constraint failed meaning some thing doesn't exist
197
+ // either it is a product or the tax rate itself. Using Promise.all
198
+ // will try to retrieve all of the resources and will fail when
199
+ // something is not found.
200
+ return [4 /*yield*/, Promise.all(__spreadArray([
201
+ txRateService.retrieve(id, { select: ["id"] })
202
+ ], __read(value.shipping_options.map(function (sId) {
203
+ return shippingOptionService.retrieve(sId, { select: ["id"] });
204
+ })), false))];
205
+ case 17:
206
+ // A foreign key constraint failed meaning some thing doesn't exist
207
+ // either it is a product or the tax rate itself. Using Promise.all
208
+ // will try to retrieve all of the resources and will fail when
209
+ // something is not found.
210
+ _a.sent();
211
+ _a.label = 18;
212
+ case 18: throw err_3;
213
+ case 19: return [2 /*return*/];
214
+ }
215
+ });
216
+ }); })];
217
+ case 3:
218
+ _a.sent();
219
+ if (typeof id === "undefined") {
220
+ throw new medusa_core_utils_1.MedusaError(medusa_core_utils_1.MedusaError.Types.UNEXPECTED_STATE, "Tax Rate was not created");
221
+ }
222
+ config = (0, get_query_config_1.getRetrieveConfig)(query.fields, query.expand);
223
+ return [4 /*yield*/, rateService.retrieve(id, config)];
224
+ case 4:
225
+ rate = _a.sent();
226
+ data = (0, get_query_config_1.pickByConfig)(rate, config);
227
+ res.json({ tax_rate: data });
228
+ return [2 /*return*/];
229
+ }
230
+ });
231
+ }); });
232
+ var AdminPostTaxRatesReq = /** @class */ (function () {
233
+ function AdminPostTaxRatesReq() {
234
+ }
235
+ __decorate([
236
+ (0, class_validator_1.IsString)(),
237
+ __metadata("design:type", String)
238
+ ], AdminPostTaxRatesReq.prototype, "code", void 0);
239
+ __decorate([
240
+ (0, class_validator_1.IsString)(),
241
+ __metadata("design:type", String)
242
+ ], AdminPostTaxRatesReq.prototype, "name", void 0);
243
+ __decorate([
244
+ (0, class_validator_1.IsString)(),
245
+ __metadata("design:type", String)
246
+ ], AdminPostTaxRatesReq.prototype, "region_id", void 0);
247
+ __decorate([
248
+ (0, class_validator_1.IsOptional)(),
249
+ (0, is_type_1.IsType)([Number, null]),
250
+ __metadata("design:type", Object)
251
+ ], AdminPostTaxRatesReq.prototype, "rate", void 0);
252
+ __decorate([
253
+ (0, class_validator_1.IsOptional)(),
254
+ (0, class_validator_1.IsArray)(),
255
+ __metadata("design:type", Array)
256
+ ], AdminPostTaxRatesReq.prototype, "products", void 0);
257
+ __decorate([
258
+ (0, class_validator_1.IsOptional)(),
259
+ (0, class_validator_1.IsArray)(),
260
+ __metadata("design:type", Array)
261
+ ], AdminPostTaxRatesReq.prototype, "shipping_options", void 0);
262
+ __decorate([
263
+ (0, class_validator_1.IsOptional)(),
264
+ (0, class_validator_1.IsArray)(),
265
+ __metadata("design:type", Array)
266
+ ], AdminPostTaxRatesReq.prototype, "product_types", void 0);
267
+ return AdminPostTaxRatesReq;
268
+ }());
269
+ exports.AdminPostTaxRatesReq = AdminPostTaxRatesReq;
270
+ var AdminPostTaxRatesParams = /** @class */ (function () {
271
+ function AdminPostTaxRatesParams() {
272
+ }
273
+ __decorate([
274
+ (0, class_validator_1.IsArray)(),
275
+ (0, class_validator_1.IsOptional)(),
276
+ __metadata("design:type", Array)
277
+ ], AdminPostTaxRatesParams.prototype, "expand", void 0);
278
+ __decorate([
279
+ (0, class_validator_1.IsArray)(),
280
+ (0, class_validator_1.IsOptional)(),
281
+ __metadata("design:type", Array)
282
+ ], AdminPostTaxRatesParams.prototype, "fields", void 0);
283
+ return AdminPostTaxRatesParams;
284
+ }());
285
+ exports.AdminPostTaxRatesParams = AdminPostTaxRatesParams;
286
+ //# sourceMappingURL=create-tax-rate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-tax-rate.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/create-tax-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mDAA+D;AAC/D,iCAA6B;AAC7B,uDAA+C;AAE/C,6DAA0E;AAQ1E,yDAAuD;AACvD,gEAA6D;AAE7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACd,qBAAM,IAAA,qBAAS,EAAC,oBAAoB,EAAE,GAAG,CAAC,IAAI,CAAC,EAAA;;gBAAvD,KAAK,GAAG,SAA+C;gBAE/C,qBAAM,IAAA,qBAAS,EAAC,uBAAuB,EAAE,GAAG,CAAC,KAAK,CAAC,EAAA;;gBAA3D,KAAK,GAAG,SAAmD;gBAE3D,OAAO,GAAkB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;gBACr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AAO,GAAE;;0DACS;IAInB;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,yBAAO,GAAE;;kEACiB;IAI3B;QAFC,IAAA,4BAAU,GAAE;QACZ,IAAA,yBAAO,GAAE;;+DACc;IAC1B,2BAAC;CAAA,AAzBD,IAyBC;AAzBY,oDAAoB;AA2BjC;IAAA;IAQA,CAAC;IALC;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;2DACI;IAIjB;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;2DACI;IACnB,8BAAC;CAAA,AARD,IAQC;AARY,0DAAuB"}
@@ -0,0 +1,28 @@
1
+ declare const _default: (req: any, res: any) => Promise<void>;
2
+ /**
3
+ * @oas [delete] /tax-rates/{id}
4
+ * operationId: "DeleteTaxRatesTaxRate"
5
+ * summary: "Delete a Tax Rate"
6
+ * description: "Deletes a Tax Rate"
7
+ * x-authenticated: true
8
+ * parameters:
9
+ * - (path) id=* {string} The id of the Shipping Option.
10
+ * tags:
11
+ * - Tax Rates
12
+ * responses:
13
+ * 200:
14
+ * description: OK
15
+ * content:
16
+ * application/json:
17
+ * schema:
18
+ * properties:
19
+ * id:
20
+ * type: string
21
+ * description: The id of the deleted Shipping Option.
22
+ * object:
23
+ * type: string
24
+ * description: The type of the object that was deleted.
25
+ * deleted:
26
+ * type: boolean
27
+ */
28
+ export default _default;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ /**
40
+ * @oas [delete] /tax-rates/{id}
41
+ * operationId: "DeleteTaxRatesTaxRate"
42
+ * summary: "Delete a Tax Rate"
43
+ * description: "Deletes a Tax Rate"
44
+ * x-authenticated: true
45
+ * parameters:
46
+ * - (path) id=* {string} The id of the Shipping Option.
47
+ * tags:
48
+ * - Tax Rates
49
+ * responses:
50
+ * 200:
51
+ * description: OK
52
+ * content:
53
+ * application/json:
54
+ * schema:
55
+ * properties:
56
+ * id:
57
+ * type: string
58
+ * description: The id of the deleted Shipping Option.
59
+ * object:
60
+ * type: string
61
+ * description: The type of the object that was deleted.
62
+ * deleted:
63
+ * type: boolean
64
+ */
65
+ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
66
+ var id, taxRateService;
67
+ return __generator(this, function (_a) {
68
+ switch (_a.label) {
69
+ case 0:
70
+ id = req.params.id;
71
+ taxRateService = req.scope.resolve("taxRateService");
72
+ return [4 /*yield*/, taxRateService.delete(id)];
73
+ case 1:
74
+ _a.sent();
75
+ res.json({
76
+ id: id,
77
+ object: "tax-rate",
78
+ deleted: true,
79
+ });
80
+ return [2 /*return*/];
81
+ }
82
+ });
83
+ }); });
84
+ //# sourceMappingURL=delete-tax-rate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-tax-rate.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/delete-tax-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;;gBACpB,EAAE,GAAK,GAAG,CAAC,MAAM,GAAf,CAAe;gBACnB,cAAc,GAAmB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;gBAE1E,qBAAM,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,EAAA;;gBAA/B,SAA+B,CAAA;gBAE/B,GAAG,CAAC,IAAI,CAAC;oBACP,EAAE,EAAE,EAAE;oBACN,MAAM,EAAE,UAAU;oBAClB,OAAO,EAAE,IAAI;iBACd,CAAC,CAAA;;;;KACH,EAAA"}
@@ -0,0 +1,26 @@
1
+ declare const _default: (req: any, res: any) => Promise<void>;
2
+ /**
3
+ * @oas [get] /tax-rates/:id
4
+ * operationId: "GetTaxRatesTaxRate"
5
+ * summary: "Get Tax Rate"
6
+ * description: "Retrieves a TaxRate"
7
+ * x-authenticated: true
8
+ * tags:
9
+ * - Tax Rates
10
+ * responses:
11
+ * 200:
12
+ * description: OK
13
+ * content:
14
+ * application/json:
15
+ * schema:
16
+ * properties:
17
+ * tax_rate:
18
+ * type: array
19
+ * items:
20
+ * $ref: "#/components/schemas/tax_rate"
21
+ */
22
+ export default _default;
23
+ export declare class AdminGetTaxRatesTaxRateParams {
24
+ expand?: string[];
25
+ fields?: string[];
26
+ }
@@ -0,0 +1,106 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ var __generator = (this && this.__generator) || function (thisArg, body) {
21
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
22
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
+ function verb(n) { return function (v) { return step([n, v]); }; }
24
+ function step(op) {
25
+ if (f) throw new TypeError("Generator is already executing.");
26
+ while (_) try {
27
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
28
+ if (y = 0, t) op = [op[0] & 2, t.value];
29
+ switch (op[0]) {
30
+ case 0: case 1: t = op; break;
31
+ case 4: _.label++; return { value: op[1], done: false };
32
+ case 5: _.label++; y = op[1]; op = [0]; continue;
33
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
34
+ default:
35
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
36
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
37
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
38
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
39
+ if (t[2]) _.ops.pop();
40
+ _.trys.pop(); continue;
41
+ }
42
+ op = body.call(thisArg, _);
43
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
44
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
45
+ }
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.AdminGetTaxRatesTaxRateParams = void 0;
49
+ var get_query_config_1 = require("./utils/get-query-config");
50
+ var class_validator_1 = require("class-validator");
51
+ var validator_1 = require("../../../../utils/validator");
52
+ /**
53
+ * @oas [get] /tax-rates/:id
54
+ * operationId: "GetTaxRatesTaxRate"
55
+ * summary: "Get Tax Rate"
56
+ * description: "Retrieves a TaxRate"
57
+ * x-authenticated: true
58
+ * tags:
59
+ * - Tax Rates
60
+ * responses:
61
+ * 200:
62
+ * description: OK
63
+ * content:
64
+ * application/json:
65
+ * schema:
66
+ * properties:
67
+ * tax_rate:
68
+ * type: array
69
+ * items:
70
+ * $ref: "#/components/schemas/tax_rate"
71
+ */
72
+ exports.default = (function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
73
+ var value, rateService, config, rate, data;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0: return [4 /*yield*/, (0, validator_1.validator)(AdminGetTaxRatesTaxRateParams, req.query)];
77
+ case 1:
78
+ value = _a.sent();
79
+ rateService = req.scope.resolve("taxRateService");
80
+ config = (0, get_query_config_1.getRetrieveConfig)(value.fields, value.expand);
81
+ return [4 /*yield*/, rateService.retrieve(req.params.id, config)];
82
+ case 2:
83
+ rate = _a.sent();
84
+ data = (0, get_query_config_1.pickByConfig)(rate, config);
85
+ res.json({ tax_rate: data });
86
+ return [2 /*return*/];
87
+ }
88
+ });
89
+ }); });
90
+ var AdminGetTaxRatesTaxRateParams = /** @class */ (function () {
91
+ function AdminGetTaxRatesTaxRateParams() {
92
+ }
93
+ __decorate([
94
+ (0, class_validator_1.IsArray)(),
95
+ (0, class_validator_1.IsOptional)(),
96
+ __metadata("design:type", Array)
97
+ ], AdminGetTaxRatesTaxRateParams.prototype, "expand", void 0);
98
+ __decorate([
99
+ (0, class_validator_1.IsArray)(),
100
+ (0, class_validator_1.IsOptional)(),
101
+ __metadata("design:type", Array)
102
+ ], AdminGetTaxRatesTaxRateParams.prototype, "fields", void 0);
103
+ return AdminGetTaxRatesTaxRateParams;
104
+ }());
105
+ exports.AdminGetTaxRatesTaxRateParams = AdminGetTaxRatesTaxRateParams;
106
+ //# sourceMappingURL=get-tax-rate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-tax-rate.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/get-tax-rate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA0E;AAC1E,mDAAqD;AAIrD,yDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mBAAe,UAAO,GAAG,EAAE,GAAG;;;;oBACd,qBAAM,IAAA,qBAAS,EAAC,6BAA6B,EAAE,GAAG,CAAC,KAAK,CAAC,EAAA;;gBAAjE,KAAK,GAAG,SAAyD;gBAEjE,WAAW,GAAmB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;gBACjE,MAAM,GAAG,IAAA,oCAAiB,EAC9B,KAAK,CAAC,MAA2B,EACjC,KAAK,CAAC,MAAM,CACb,CAAA;gBACY,qBAAM,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,EAAA;;gBAAxD,IAAI,GAAG,SAAiD;gBACxD,IAAI,GAAG,IAAA,+BAAY,EAAU,IAAI,EAAE,MAAM,CAAC,CAAA;gBAEhD,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;;;;KAC7B,EAAA;AAED;IAAA;IAQA,CAAC;IALC;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;iEACI;IAIjB;QAFC,IAAA,yBAAO,GAAE;QACT,IAAA,4BAAU,GAAE;;iEACI;IACnB,oCAAC;CAAA,AARD,IAQC;AARY,sEAA6B"}
@@ -0,0 +1,21 @@
1
+ import { TaxRate } from "../../../..";
2
+ import { DeleteResponse, PaginatedResponse } from "../../../../types/common";
3
+ declare const _default: (app: any) => any;
4
+ export default _default;
5
+ export declare const defaultAdminTaxRatesRelations: never[];
6
+ export declare const defaultAdminTaxRatesFields: (keyof TaxRate)[];
7
+ export declare type AdminTaxRatesDeleteRes = DeleteResponse;
8
+ export declare type AdminTaxRatesListRes = PaginatedResponse & {
9
+ tax_rates: TaxRate[];
10
+ };
11
+ export declare type AdminTaxRatesRes = {
12
+ tax_rate: TaxRate;
13
+ };
14
+ export * from "./list-tax-rates";
15
+ export * from "./get-tax-rate";
16
+ export * from "./add-to-product-types";
17
+ export * from "./add-to-products";
18
+ export * from "./add-to-shipping-options";
19
+ export * from "./create-tax-rate";
20
+ export * from "./delete-tax-rate";
21
+ export * from "./update-tax-rate";
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.defaultAdminTaxRatesFields = exports.defaultAdminTaxRatesRelations = void 0;
17
+ var express_1 = require("express");
18
+ var middlewares_1 = __importDefault(require("../../../middlewares"));
19
+ var route = (0, express_1.Router)();
20
+ exports.default = (function (app) {
21
+ app.use("/tax-rates", route);
22
+ /**
23
+ * List tax rates
24
+ */
25
+ route.get("/", middlewares_1.default.wrap(require("./list-tax-rates").default));
26
+ /**
27
+ * Get a tax rate
28
+ */
29
+ route.get("/:id", middlewares_1.default.wrap(require("./get-tax-rate").default));
30
+ /**
31
+ * Create a tax rate
32
+ */
33
+ route.post("/", middlewares_1.default.wrap(require("./create-tax-rate").default));
34
+ /**
35
+ * Update a tax rate
36
+ */
37
+ route.post("/:id", middlewares_1.default.wrap(require("./update-tax-rate").default));
38
+ /**
39
+ * Add products to tax rate
40
+ */
41
+ route.post("/:id/products", middlewares_1.default.wrap(require("./add-to-products").default));
42
+ /**
43
+ * Add product types to tax rate
44
+ */
45
+ route.post("/:id/product-types", middlewares_1.default.wrap(require("./add-to-product-types").default));
46
+ /**
47
+ * Add to shipping options
48
+ */
49
+ route.post("/:id/shipping-options", middlewares_1.default.wrap(require("./add-to-shipping-options").default));
50
+ /**
51
+ * Delete a tax rate
52
+ */
53
+ route.delete("/:id", middlewares_1.default.wrap(require("./delete-tax-rate").default));
54
+ return app;
55
+ });
56
+ exports.defaultAdminTaxRatesRelations = [];
57
+ exports.defaultAdminTaxRatesFields = [
58
+ "id",
59
+ "rate",
60
+ "code",
61
+ "name",
62
+ "region_id",
63
+ "created_at",
64
+ "updated_at",
65
+ ];
66
+ __exportStar(require("./list-tax-rates"), exports);
67
+ __exportStar(require("./get-tax-rate"), exports);
68
+ __exportStar(require("./add-to-product-types"), exports);
69
+ __exportStar(require("./add-to-products"), exports);
70
+ __exportStar(require("./add-to-shipping-options"), exports);
71
+ __exportStar(require("./create-tax-rate"), exports);
72
+ __exportStar(require("./delete-tax-rate"), exports);
73
+ __exportStar(require("./update-tax-rate"), exports);
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/api/routes/admin/tax-rates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAAgC;AAGhC,qEAA8C;AAE9C,IAAM,KAAK,GAAG,IAAA,gBAAM,GAAE,CAAA;AAEtB,mBAAe,UAAC,GAAG;IACjB,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;IAE5B;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,qBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAErE;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,qBAAW,CAAC,IAAI,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