@accon/connect 0.3.2 → 0.4.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.
@@ -0,0 +1,61 @@
1
+ export declare class DeliveryAddressDto {
2
+ country: 'BR';
3
+ state: string;
4
+ city: string;
5
+ district: string;
6
+ street_name: string;
7
+ street_number: string;
8
+ postal_code: string;
9
+ reference?: string;
10
+ complement?: string;
11
+ coordinates: {
12
+ latitude: number;
13
+ longitude: number;
14
+ };
15
+ }
16
+ export type PaymentTypeCode = 'CRE' | 'CARD' | 'DEB' | 'DIN' | 'PARTNER_PAYMENT' | 'VALE' | 'OTHER';
17
+ export declare class PaymentTypeDto {
18
+ code: PaymentTypeCode;
19
+ amount: number;
20
+ change_for: number;
21
+ complement?: 'pix' | string;
22
+ type: 'OFFLINE' | 'ONLINE';
23
+ }
24
+ export declare class ChoiceDto {
25
+ integration_code: string;
26
+ desc_item_choice: string;
27
+ aditional_price: number;
28
+ quantity: number;
29
+ notes?: string;
30
+ }
31
+ export declare class ItemDto {
32
+ integration_code: string;
33
+ desc_item: string;
34
+ quantity: number;
35
+ unit_price: number;
36
+ notes?: string;
37
+ choice_items: Array<ChoiceDto>;
38
+ }
39
+ export declare class CreateOrderDto {
40
+ order_id: string;
41
+ display_id: string;
42
+ cod_store: string;
43
+ created_at: string;
44
+ total_discount: number;
45
+ total_amount: number;
46
+ customer: {
47
+ id: string;
48
+ name: string;
49
+ phone: string;
50
+ };
51
+ order_method: {
52
+ mode: 'DELIVERY' | 'TAKEOUT';
53
+ delivery_by: 'PARTNER' | 'RESTAURANT';
54
+ delivery_fee: number;
55
+ scheduled: boolean;
56
+ delivery_date_time?: string;
57
+ };
58
+ items: Array<ItemDto>;
59
+ payment_types: Array<PaymentTypeDto>;
60
+ delivery_address?: DeliveryAddressDto;
61
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateOrderDto = exports.ItemDto = exports.ChoiceDto = exports.PaymentTypeDto = exports.DeliveryAddressDto = void 0;
4
+ class DeliveryAddressDto {
5
+ country;
6
+ state;
7
+ city;
8
+ district;
9
+ street_name;
10
+ street_number;
11
+ postal_code;
12
+ reference;
13
+ complement;
14
+ coordinates;
15
+ }
16
+ exports.DeliveryAddressDto = DeliveryAddressDto;
17
+ class PaymentTypeDto {
18
+ code;
19
+ amount;
20
+ change_for;
21
+ complement;
22
+ type;
23
+ }
24
+ exports.PaymentTypeDto = PaymentTypeDto;
25
+ class ChoiceDto {
26
+ integration_code;
27
+ desc_item_choice;
28
+ aditional_price;
29
+ quantity;
30
+ notes;
31
+ }
32
+ exports.ChoiceDto = ChoiceDto;
33
+ class ItemDto {
34
+ integration_code;
35
+ desc_item;
36
+ quantity;
37
+ unit_price;
38
+ notes;
39
+ choice_items;
40
+ }
41
+ exports.ItemDto = ItemDto;
42
+ class CreateOrderDto {
43
+ order_id;
44
+ display_id;
45
+ cod_store;
46
+ created_at;
47
+ total_discount;
48
+ total_amount;
49
+ customer;
50
+ order_method;
51
+ items;
52
+ payment_types;
53
+ delivery_address;
54
+ }
55
+ exports.CreateOrderDto = CreateOrderDto;
56
+ //# sourceMappingURL=create-order.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-order.dto.js","sourceRoot":"","sources":["../../../../lib/order/saipos/dto/create-order.dto.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;IAC7B,OAAO,CAAO;IACd,KAAK,CAAS;IACd,IAAI,CAAS;IACb,QAAQ,CAAS;IACjB,WAAW,CAAS;IACpB,aAAa,CAAS;IACtB,WAAW,CAAS;IACpB,SAAS,CAAU;IACnB,UAAU,CAAU;IACpB,WAAW,CAGT;CACH;AAdD,gDAcC;AAWD,MAAa,cAAc;IACzB,IAAI,CAAkB;IACtB,MAAM,CAAS;IACf,UAAU,CAAS;IACnB,UAAU,CAAkB;IAC5B,IAAI,CAAuB;CAC5B;AAND,wCAMC;AAED,MAAa,SAAS;IACpB,gBAAgB,CAAS;IACzB,gBAAgB,CAAS;IACzB,eAAe,CAAS;IACxB,QAAQ,CAAS;IACjB,KAAK,CAAU;CAChB;AAND,8BAMC;AAED,MAAa,OAAO;IAClB,gBAAgB,CAAS;IACzB,SAAS,CAAS;IAClB,QAAQ,CAAS;IACjB,UAAU,CAAS;IACnB,KAAK,CAAU;IACf,YAAY,CAAmB;CAChC;AAPD,0BAOC;AAED,MAAa,cAAc;IACzB,QAAQ,CAAS;IACjB,UAAU,CAAS;IACnB,SAAS,CAAS;IAClB,UAAU,CAAS;IACnB,cAAc,CAAS;IACvB,YAAY,CAAS;IACrB,QAAQ,CAIN;IACF,YAAY,CAMV;IACF,KAAK,CAAiB;IACtB,aAAa,CAAwB;IACrC,gBAAgB,CAAsB;CACvC;AAtBD,wCAsBC"}
@@ -0,0 +1,15 @@
1
+ import { FromSchema } from 'json-schema-to-ts';
2
+ export declare const SAIPOS_CONFIG_SCHEMA: {
3
+ readonly $schema: "http://json-schema.org/draft-07/schema#";
4
+ readonly title: "Saipos Configuration";
5
+ readonly type: "object";
6
+ readonly properties: {
7
+ readonly idPartner: {
8
+ readonly type: "string";
9
+ readonly title: "Id Partner";
10
+ readonly description: "Identificador da loja com a integração. Solicite ao suporte Saipos";
11
+ };
12
+ };
13
+ readonly required: readonly ["idPartner"];
14
+ };
15
+ export type SaiposConfig = FromSchema<typeof SAIPOS_CONFIG_SCHEMA>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SAIPOS_CONFIG_SCHEMA = void 0;
4
+ exports.SAIPOS_CONFIG_SCHEMA = {
5
+ $schema: 'http://json-schema.org/draft-07/schema#',
6
+ title: 'Saipos Configuration',
7
+ type: 'object',
8
+ properties: {
9
+ idPartner: {
10
+ type: 'string',
11
+ title: 'Id Partner',
12
+ description: 'Identificador da loja com a integração. Solicite ao suporte Saipos',
13
+ },
14
+ },
15
+ required: ['idPartner'],
16
+ };
17
+ //# sourceMappingURL=saipos.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saipos.config.js","sourceRoot":"","sources":["../../../lib/order/saipos/saipos.config.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAG;IAClC,OAAO,EAAE,yCAAyC;IAClD,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,oEAAoE;SACvE;KACF;IACD,QAAQ,EAAE,CAAC,WAAW,CAAC;CACM,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { EventsService, IntegrationPayload, Order, OrderOutputIntegration } from '../../core/index.js';
2
+ import { SaiposConfig } from './saipos.config';
3
+ import { HttpService } from '@nestjs/axios';
4
+ import { CreateOrderDto, ItemDto, PaymentTypeDto } from './dto/create-order.dto';
5
+ export declare class SaiposOrderOutput implements OrderOutputIntegration<SaiposConfig> {
6
+ readonly eventsService: EventsService;
7
+ private readonly httpService;
8
+ private readonly logger;
9
+ private readonly SAIPOS_BASE_URL;
10
+ private readonly SAIPOS_SECRET;
11
+ private readonly ALLOWED_ORDER_TYPES;
12
+ private readonly dispatchEvent;
13
+ constructor(eventsService: EventsService, httpService: HttpService);
14
+ authenticate(idPartner: string): Promise<any>;
15
+ onOrderCreated(payload: IntegrationPayload, config: SaiposConfig): Promise<void>;
16
+ onOrderUpdated?(payload: IntegrationPayload, config: SaiposConfig): Promise<void>;
17
+ onOrderCanceled?(payload: IntegrationPayload, config: SaiposConfig): Promise<void>;
18
+ transformPayment(order: Order): Array<PaymentTypeDto>;
19
+ transformItems(order: Order): Array<ItemDto>;
20
+ getDeliveryDateTime(order: Order): string;
21
+ transformOrder(order: Order): CreateOrderDto;
22
+ }
@@ -0,0 +1,296 @@
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 SaiposOrderOutput_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.SaiposOrderOutput = void 0;
14
+ const core_1 = require("../../core/index.js");
15
+ const common_1 = require("@nestjs/common");
16
+ const saipos_config_1 = require("./saipos.config");
17
+ const axios_1 = require("@nestjs/axios");
18
+ const rxjs_1 = require("rxjs");
19
+ const axios_2 = require("axios");
20
+ const moment = require("moment");
21
+ let SaiposOrderOutput = SaiposOrderOutput_1 = class SaiposOrderOutput {
22
+ eventsService;
23
+ httpService;
24
+ logger = new common_1.Logger(SaiposOrderOutput_1.name);
25
+ SAIPOS_BASE_URL;
26
+ SAIPOS_SECRET;
27
+ ALLOWED_ORDER_TYPES = ['DELIVERY', 'TAKEOUT'];
28
+ dispatchEvent;
29
+ constructor(eventsService, httpService) {
30
+ this.eventsService = eventsService;
31
+ this.httpService = httpService;
32
+ this.SAIPOS_SECRET = process.env.SAIPOS_SECRET;
33
+ if (!this.SAIPOS_SECRET)
34
+ this.logger.error('SAIPOS_SECRET não fornecido via ambiente');
35
+ this.SAIPOS_BASE_URL =
36
+ process.env.SAIPOS_BASE_URL || 'https://order-api.saipos.com';
37
+ this.dispatchEvent = eventsService.createDispatcherFor('Saipos', 'OrderOutput');
38
+ }
39
+ async authenticate(idPartner) {
40
+ const { data } = await (0, rxjs_1.firstValueFrom)(this.httpService.post(`${this.SAIPOS_BASE_URL}/auth`, {
41
+ idPartner,
42
+ secret: this.SAIPOS_SECRET,
43
+ }));
44
+ return data?.token;
45
+ }
46
+ async onOrderCreated(payload, config) {
47
+ this.logger.verbose('onOrderCreated: iniciando integração');
48
+ const { order } = payload;
49
+ if (!this.ALLOWED_ORDER_TYPES.includes(order.type)) {
50
+ this.logger.verbose(`Ignorando tipo de pedido não permitido: ${order.type} [${this.ALLOWED_ORDER_TYPES.join(',')}]`);
51
+ return;
52
+ }
53
+ const orderId = parseInt(order.externalId);
54
+ this.dispatchEvent({
55
+ eventType: 'INTEGRATION_INITIATED',
56
+ orderId,
57
+ });
58
+ this.dispatchEvent({
59
+ eventType: 'INTEGRATION_PROCESSING',
60
+ orderId,
61
+ });
62
+ try {
63
+ const body = this.transformOrder(order);
64
+ const token = await this.authenticate(config.idPartner);
65
+ if (!token) {
66
+ throw new Error('Não foi possível autenticar com a Saipos');
67
+ }
68
+ const { data } = await (0, rxjs_1.firstValueFrom)(this.httpService.post(`${this.SAIPOS_BASE_URL}/order`, body, {
69
+ headers: {
70
+ Authorization: token,
71
+ },
72
+ }));
73
+ this.dispatchEvent({
74
+ eventType: 'INTEGRATION_COMPLETED',
75
+ orderId,
76
+ metadata: {
77
+ data,
78
+ },
79
+ });
80
+ return;
81
+ }
82
+ catch (error) {
83
+ if ((0, axios_2.isAxiosError)(error)) {
84
+ this.logger.error('onOrderCreated: falha ao realizar requisição no Saipos', JSON.stringify(error.response?.data));
85
+ this.dispatchEvent({
86
+ eventType: 'INTEGRATION_FAILED',
87
+ orderId,
88
+ metadata: { error: error.response?.data },
89
+ });
90
+ }
91
+ else {
92
+ this.dispatchEvent({
93
+ eventType: 'INTEGRATION_FAILED',
94
+ orderId,
95
+ metadata: { error },
96
+ });
97
+ this.logger.error('onOrderCreated: falha ao criar pedido no Saipos', error);
98
+ }
99
+ }
100
+ }
101
+ async onOrderUpdated(payload, config) {
102
+ throw new Error('Method not implemented.');
103
+ }
104
+ async onOrderCanceled(payload, config) {
105
+ this.logger.verbose('onOrderCanceled: iniciando integração');
106
+ const { order } = payload;
107
+ if (!this.ALLOWED_ORDER_TYPES.includes(payload.order.type)) {
108
+ this.logger.verbose(`Ignorando tipo de pedido não permitido: ${order.type} [${this.ALLOWED_ORDER_TYPES.join(',')}]`);
109
+ return;
110
+ }
111
+ const orderId = parseInt(order.externalId);
112
+ this.dispatchEvent({
113
+ eventType: 'INTEGRATION_INITIATED',
114
+ orderId,
115
+ });
116
+ this.dispatchEvent({
117
+ eventType: 'INTEGRATION_PROCESSING',
118
+ orderId,
119
+ });
120
+ try {
121
+ const token = await this.authenticate(config.idPartner);
122
+ if (!token) {
123
+ throw new Error('Não foi possível autenticar com a Saipos');
124
+ }
125
+ const { data } = await (0, rxjs_1.firstValueFrom)(this.httpService.post(`${this.SAIPOS_BASE_URL}/cancel-order`, { order_id: order.id, cod_store: config.idPartner }, {
126
+ headers: {
127
+ Authorization: token,
128
+ },
129
+ }));
130
+ this.dispatchEvent({
131
+ eventType: 'INTEGRATION_COMPLETED',
132
+ orderId,
133
+ metadata: {
134
+ data,
135
+ },
136
+ });
137
+ }
138
+ catch (error) {
139
+ if ((0, axios_2.isAxiosError)(error)) {
140
+ this.logger.error('onOrderCanceled: falha ao realizar requisição no Saipos', JSON.stringify(error.response?.data));
141
+ this.dispatchEvent({
142
+ eventType: 'INTEGRATION_FAILED',
143
+ orderId,
144
+ metadata: { error: error.response?.data },
145
+ });
146
+ }
147
+ else {
148
+ this.dispatchEvent({
149
+ eventType: 'INTEGRATION_FAILED',
150
+ orderId,
151
+ metadata: { error },
152
+ });
153
+ this.logger.error('onOrderCanceled: falha ao cancelar pedido no Saipos', error);
154
+ }
155
+ }
156
+ }
157
+ transformPayment(order) {
158
+ return order.payments.methods.map((method) => {
159
+ let code;
160
+ switch (method.method) {
161
+ case 'CREDIT':
162
+ code = 'CRE';
163
+ break;
164
+ case 'DEBIT':
165
+ code = 'DEB';
166
+ break;
167
+ case 'MEAL_VOUCHER':
168
+ case 'FOOD_VOUCHER':
169
+ code = 'VALE';
170
+ break;
171
+ case 'PIX':
172
+ code = 'PARTNER_PAYMENT';
173
+ break;
174
+ case 'CASH':
175
+ code = 'DIN';
176
+ break;
177
+ case 'CREDIT_DEBIT':
178
+ code = 'CARD';
179
+ break;
180
+ case 'DIGITAL_WALLET':
181
+ case 'COUPON':
182
+ case 'REDEEM':
183
+ case 'PREPAID_REDEEM':
184
+ case 'OTHER':
185
+ code = 'OTHER';
186
+ break;
187
+ default:
188
+ code = 'OTHER';
189
+ break;
190
+ }
191
+ if (!code) {
192
+ throw new core_1.InvalidOrderException(`Forma de pagamento inválida: ${method.method}`, 'payments');
193
+ }
194
+ return {
195
+ code,
196
+ amount: method.value,
197
+ change_for: method.changeFor || 0,
198
+ type: method.type === 'PREPAID' ? 'ONLINE' : 'OFFLINE',
199
+ complement: method.method === 'PIX' ? 'pix' : undefined,
200
+ };
201
+ });
202
+ }
203
+ transformItems(order) {
204
+ return order.items.map((item) => {
205
+ const options = item.options?.map((option) => {
206
+ return {
207
+ integration_code: option.externalCode?.trim(),
208
+ desc_item_choice: option.name,
209
+ aditional_price: option.unitPrice.value,
210
+ quantity: option.quantity,
211
+ };
212
+ });
213
+ return {
214
+ desc_item: item.name,
215
+ integration_code: item.externalCode?.trim(),
216
+ notes: item.specialInstructions,
217
+ quantity: item.quantity,
218
+ unit_price: item.unitPrice.value,
219
+ choice_items: options ?? [],
220
+ };
221
+ });
222
+ }
223
+ getDeliveryDateTime(order) {
224
+ if (order.schedule?.scheduledDateTimeStart) {
225
+ return order.schedule.scheduledDateTimeStart;
226
+ }
227
+ return moment(order.createdAt).add(30, 'minutes').toISOString();
228
+ }
229
+ transformOrder(order) {
230
+ if (!order.customer) {
231
+ throw new core_1.InvalidOrderException('Pedido sem cliente', 'customer');
232
+ }
233
+ if (order.type !== 'DELIVERY' && order.type !== 'TAKEOUT') {
234
+ throw new core_1.InvalidOrderException('Tipo de pedido inválido', 'type');
235
+ }
236
+ const deliveryFee = order.otherFees.find(({ type }) => type === 'DELIVERY_FEE');
237
+ const dto = {
238
+ order_id: order.id,
239
+ display_id: order.displayId,
240
+ cod_store: order.merchant.id.toString(),
241
+ created_at: order.createdAt,
242
+ total_discount: order.total.discount?.value ?? 0,
243
+ total_amount: order.total.orderAmount.value,
244
+ customer: {
245
+ id: order.customer.id,
246
+ name: order.customer.name,
247
+ phone: order.customer.phone.number,
248
+ },
249
+ order_method: {
250
+ mode: order.type,
251
+ delivery_by: 'RESTAURANT',
252
+ delivery_fee: deliveryFee?.price.value ?? 0,
253
+ scheduled: order.orderTiming === 'SCHEDULED',
254
+ delivery_date_time: this.getDeliveryDateTime(order),
255
+ },
256
+ items: this.transformItems(order),
257
+ payment_types: this.transformPayment(order),
258
+ };
259
+ if (order.type === 'DELIVERY') {
260
+ if (!order.delivery) {
261
+ throw new core_1.InvalidOrderException('Pedido de delivery sem informações para entrega', 'delivery');
262
+ }
263
+ const { delivery: { deliveryAddress }, } = order;
264
+ dto.delivery_address = {
265
+ country: 'BR',
266
+ state: deliveryAddress.state,
267
+ city: deliveryAddress.city,
268
+ district: deliveryAddress.district,
269
+ street_name: deliveryAddress.street,
270
+ street_number: deliveryAddress.number,
271
+ postal_code: deliveryAddress.postalCode,
272
+ reference: deliveryAddress.reference,
273
+ complement: deliveryAddress.complement,
274
+ coordinates: deliveryAddress.coordinates,
275
+ };
276
+ }
277
+ return dto;
278
+ }
279
+ };
280
+ exports.SaiposOrderOutput = SaiposOrderOutput;
281
+ exports.SaiposOrderOutput = SaiposOrderOutput = SaiposOrderOutput_1 = __decorate([
282
+ (0, core_1.RegistryIntegration)({
283
+ id: 'saipos',
284
+ category: 'POS',
285
+ type: 'OrderOutput',
286
+ title: 'Saipos',
287
+ description: 'Saipos, Sistema para Restaurante simples, ágil e inteligente',
288
+ logoUrl: 'https://cms-cdn.saipos.com/assets/2022/06/02/saipos_uid_62991602390a5.jpg',
289
+ websiteUrl: 'https://saipos.com/',
290
+ configSchema: saipos_config_1.SAIPOS_CONFIG_SCHEMA,
291
+ }),
292
+ (0, common_1.Injectable)(),
293
+ __metadata("design:paramtypes", [core_1.EventsService,
294
+ axios_1.HttpService])
295
+ ], SaiposOrderOutput);
296
+ //# sourceMappingURL=saipos.order-output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saipos.order-output.js","sourceRoot":"","sources":["../../../lib/order/saipos/saipos.order-output.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,oCAQmB;AACnB,2CAAoD;AACpD,mDAAqE;AACrE,yCAA4C;AAC5C,+BAAsC;AAOtC,iCAAqC;AACrC,iCAAiC;AAc1B,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAQjB;IACQ;IARF,MAAM,GAAW,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IACpD,eAAe,CAAC;IAChB,aAAa,CAAC;IACd,mBAAmB,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC9C,aAAa,CAA6B;IAE3D,YACW,aAA4B,EACpB,WAAwB;QADhC,kBAAa,GAAb,aAAa,CAAe;QACpB,gBAAW,GAAX,WAAW,CAAa;QAEzC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QAC/C,IAAI,CAAC,IAAI,CAAC,aAAa;YACrB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAEhE,IAAI,CAAC,eAAe;YAClB,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,8BAA8B,CAAC;QAEhE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC,mBAAmB,CACpD,QAAQ,EACR,aAAa,CACd,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,SAAiB;QAClC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,qBAAc,EACnC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,eAAe,OAAO,EAAE;YACp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