@infrab4a/connect-nestjs 2.3.4-alpha.2 → 2.3.4-alpha.3

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 (46) hide show
  1. package/index.cjs.js +1225 -1225
  2. package/index.esm.js +1225 -1225
  3. package/package.json +2 -2
  4. package/src/consts/es-config.const.d.ts +1 -1
  5. package/src/consts/hasura-options.const.d.ts +1 -1
  6. package/src/consts/index.d.ts +4 -4
  7. package/src/consts/storage.const.d.ts +1 -1
  8. package/src/consts/vertex-config.const.d.ts +1 -1
  9. package/src/index.d.ts +7 -7
  10. package/src/infra/elasticsearch/adapters/index.d.ts +1 -1
  11. package/src/infra/elasticsearch/adapters/native-elasticsearch-adapter.d.ts +19 -19
  12. package/src/infra/elasticsearch/index.d.ts +1 -1
  13. package/src/infra/firebase/firestore/index.d.ts +2 -2
  14. package/src/infra/firebase/firestore/services/connect-collection-reference.d.ts +19 -19
  15. package/src/infra/firebase/firestore/services/connect-collection.service.d.ts +32 -32
  16. package/src/infra/firebase/firestore/services/connect-document-reference.d.ts +11 -11
  17. package/src/infra/firebase/firestore/services/connect-document.service.d.ts +17 -17
  18. package/src/infra/firebase/firestore/services/connect-firestore.d.ts +7 -7
  19. package/src/infra/firebase/firestore/services/connect-firestore.service.d.ts +8 -8
  20. package/src/infra/firebase/firestore/services/index.d.ts +6 -6
  21. package/src/infra/firebase/firestore/types/connect-query-snapshot.type.d.ts +4 -4
  22. package/src/infra/firebase/firestore/types/index.d.ts +1 -1
  23. package/src/infra/firebase/firestore/vo/connect-base-document-snapshot.vo.d.ts +12 -12
  24. package/src/infra/firebase/firestore/vo/index.d.ts +1 -1
  25. package/src/infra/firebase/index.d.ts +1 -1
  26. package/src/infra/index.d.ts +4 -4
  27. package/src/infra/pagarme/adapters/index.d.ts +3 -3
  28. package/src/infra/pagarme/adapters/pagarme-bank-slip-api.adapter.d.ts +9 -9
  29. package/src/infra/pagarme/adapters/pagarme-card-api.adapter.d.ts +21 -21
  30. package/src/infra/pagarme/adapters/pagarme-pix-api.adapter.d.ts +8 -8
  31. package/src/infra/pagarme/index.d.ts +1 -1
  32. package/src/infra/vertex-ai/adapters/discovery-engine-adapter.d.ts +17 -17
  33. package/src/infra/vertex-ai/adapters/index.d.ts +1 -1
  34. package/src/infra/vertex-ai/helpers/index.d.ts +1 -1
  35. package/src/infra/vertex-ai/helpers/product-vertex-ai.helper.d.ts +7 -7
  36. package/src/infra/vertex-ai/index.d.ts +3 -3
  37. package/src/infra/vertex-ai/types/index.d.ts +2 -2
  38. package/src/infra/vertex-ai/types/vertex-config.d.ts +23 -23
  39. package/src/infra/vertex-ai/types/vertex-search-result.d.ts +18 -18
  40. package/src/nest-connect.module.d.ts +13 -13
  41. package/src/nest-elastic-search.module.d.ts +5 -5
  42. package/src/nest-firestore.module.d.ts +10 -10
  43. package/src/nest-hasura-graphql.module.d.ts +13 -13
  44. package/src/nest-storage.module.d.ts +2 -2
  45. package/src/nest-vertex-ai-search.module.d.ts +5 -5
  46. package/index.esm.d.ts +0 -1
package/index.esm.js CHANGED
@@ -50,1261 +50,1261 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
50
50
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
51
51
  };
52
52
 
53
- let NativeElasticSearchAdapter = class NativeElasticSearchAdapter {
54
- constructor(config) {
55
- this.logger = DebugHelper.from(this);
56
- try {
57
- this.client = !isEmpty(config.cloud.id) && !isEmpty(config.auth.apiKey) && new Client(config);
58
- }
59
- catch (error) {
60
- this.logger.error({ req: config, res: error });
61
- throw error;
62
- }
63
- }
64
- async get(index, id) {
65
- const logger = this.logger.with('get');
66
- const req = { index, id };
67
- try {
68
- const data = await this.client.get({ index, id });
69
- logger.log({ req, res: data });
70
- return data._source;
71
- }
72
- catch (error) {
73
- const message = error instanceof Error ? error.message : `${index}/${id} not found`;
74
- logger.log({ req, res: error });
75
- throw new NotFoundError(message);
76
- }
77
- }
78
- async query(index, query) {
79
- const logger = this.logger.with('query');
80
- const params = {
81
- index,
82
- query,
83
- };
84
- try {
85
- const result = await this.client.search(params);
86
- const res = {
87
- total: result.hits.total,
88
- hits: result.hits.hits,
89
- };
90
- logger.log({ req: params, res });
91
- return res;
92
- }
93
- catch (error) {
94
- logger.error({ req: params, res: error });
95
- throw error;
96
- }
97
- }
98
- async save(index, data) {
99
- const logger = this.logger.with('save');
100
- const req = {
101
- index,
102
- id: data.identifiersFields.length > 1
103
- ? JSON.stringify(data.identifier)
104
- : Object.values(data.identifier).shift().toString(),
105
- document: data.toPlain(),
106
- };
107
- try {
108
- const res = await this.client.index(req);
109
- logger.log({ req, res });
110
- }
111
- catch (error) {
112
- logger.error({ req, res: error });
113
- throw error;
114
- }
115
- }
116
- async update(index, id, data) {
117
- const logger = this.logger.with('update');
118
- const req = {
119
- index,
120
- id,
121
- doc: data,
122
- };
123
- try {
124
- await this.client.update(req);
125
- logger.log({ req, res: undefined });
126
- }
127
- catch (error) {
128
- logger.error({ req, res: error });
129
- throw error;
130
- }
131
- }
132
- async delete(index, id) {
133
- const logger = this.logger.with('delete');
134
- const req = {
135
- index,
136
- id,
137
- };
138
- try {
139
- await this.client.delete(req);
140
- logger.log({ req, res: undefined });
141
- }
142
- catch (error) {
143
- logger.error({ req, res: error });
144
- throw error;
145
- }
146
- }
147
- };
148
- NativeElasticSearchAdapter = __decorate([
149
- Injectable(),
150
- __param(0, Inject(ES_CONFIG)),
151
- __metadata("design:paramtypes", [Object])
53
+ let NativeElasticSearchAdapter = class NativeElasticSearchAdapter {
54
+ constructor(config) {
55
+ this.logger = DebugHelper.from(this);
56
+ try {
57
+ this.client = !isEmpty(config.cloud.id) && !isEmpty(config.auth.apiKey) && new Client(config);
58
+ }
59
+ catch (error) {
60
+ this.logger.error({ req: config, res: error });
61
+ throw error;
62
+ }
63
+ }
64
+ async get(index, id) {
65
+ const logger = this.logger.with('get');
66
+ const req = { index, id };
67
+ try {
68
+ const data = await this.client.get({ index, id });
69
+ logger.log({ req, res: data });
70
+ return data._source;
71
+ }
72
+ catch (error) {
73
+ const message = error instanceof Error ? error.message : `${index}/${id} not found`;
74
+ logger.log({ req, res: error });
75
+ throw new NotFoundError(message);
76
+ }
77
+ }
78
+ async query(index, query) {
79
+ const logger = this.logger.with('query');
80
+ const params = {
81
+ index,
82
+ query,
83
+ };
84
+ try {
85
+ const result = await this.client.search(params);
86
+ const res = {
87
+ total: result.hits.total,
88
+ hits: result.hits.hits,
89
+ };
90
+ logger.log({ req: params, res });
91
+ return res;
92
+ }
93
+ catch (error) {
94
+ logger.error({ req: params, res: error });
95
+ throw error;
96
+ }
97
+ }
98
+ async save(index, data) {
99
+ const logger = this.logger.with('save');
100
+ const req = {
101
+ index,
102
+ id: data.identifiersFields.length > 1
103
+ ? JSON.stringify(data.identifier)
104
+ : Object.values(data.identifier).shift().toString(),
105
+ document: data.toPlain(),
106
+ };
107
+ try {
108
+ const res = await this.client.index(req);
109
+ logger.log({ req, res });
110
+ }
111
+ catch (error) {
112
+ logger.error({ req, res: error });
113
+ throw error;
114
+ }
115
+ }
116
+ async update(index, id, data) {
117
+ const logger = this.logger.with('update');
118
+ const req = {
119
+ index,
120
+ id,
121
+ doc: data,
122
+ };
123
+ try {
124
+ await this.client.update(req);
125
+ logger.log({ req, res: undefined });
126
+ }
127
+ catch (error) {
128
+ logger.error({ req, res: error });
129
+ throw error;
130
+ }
131
+ }
132
+ async delete(index, id) {
133
+ const logger = this.logger.with('delete');
134
+ const req = {
135
+ index,
136
+ id,
137
+ };
138
+ try {
139
+ await this.client.delete(req);
140
+ logger.log({ req, res: undefined });
141
+ }
142
+ catch (error) {
143
+ logger.error({ req, res: error });
144
+ throw error;
145
+ }
146
+ }
147
+ };
148
+ NativeElasticSearchAdapter = __decorate([
149
+ Injectable(),
150
+ __param(0, Inject(ES_CONFIG)),
151
+ __metadata("design:paramtypes", [Object])
152
152
  ], NativeElasticSearchAdapter);
153
153
 
154
- class ConnectBaseDocumentSnapshot {
155
- constructor(connectDocumentSnapshot) {
156
- this.connectDocumentSnapshot = connectDocumentSnapshot;
157
- this.id = connectDocumentSnapshot.id;
158
- }
159
- isNotEmpty() {
160
- return this.connectDocumentSnapshot.exists;
161
- }
162
- data(_options) {
163
- return this.connectDocumentSnapshot.data();
164
- }
165
- get(fieldPath) {
166
- return this.connectDocumentSnapshot.get(fieldPath);
167
- }
154
+ class ConnectBaseDocumentSnapshot {
155
+ constructor(connectDocumentSnapshot) {
156
+ this.connectDocumentSnapshot = connectDocumentSnapshot;
157
+ this.id = connectDocumentSnapshot.id;
158
+ }
159
+ isNotEmpty() {
160
+ return this.connectDocumentSnapshot.exists;
161
+ }
162
+ data(_options) {
163
+ return this.connectDocumentSnapshot.data();
164
+ }
165
+ get(fieldPath) {
166
+ return this.connectDocumentSnapshot.get(fieldPath);
167
+ }
168
168
  }
169
169
 
170
- class ConnectDocumentService {
171
- constructor(path, firestore) {
172
- this.path = path;
173
- this.firestore = firestore;
174
- this.reference = this.firestore.doc(this.path).withConverter({
175
- toFirestore: (data) => data,
176
- fromFirestore: (snapshot) => {
177
- return Object.assign({ id: snapshot.id }, snapshot.data());
178
- },
179
- });
180
- }
181
- async get() {
182
- return new ConnectBaseDocumentSnapshot(await this.reference.get());
183
- }
184
- getId() {
185
- return this.reference.id;
186
- }
187
- async save(data) {
188
- if (this.reference)
189
- this.reference.update(data);
190
- else
191
- await this.reference.set(data);
192
- return this;
193
- }
194
- async delete() {
195
- await this.reference.delete();
196
- }
197
- withConverter(params) {
198
- this.reference = this.reference.withConverter({
199
- toFirestore: (data) => params.toFirestore(data),
200
- fromFirestore: (snapshot, options) => params.fromFirestore(new ConnectBaseDocumentSnapshot(snapshot), options),
201
- });
202
- return this;
203
- }
170
+ class ConnectDocumentService {
171
+ constructor(path, firestore) {
172
+ this.path = path;
173
+ this.firestore = firestore;
174
+ this.reference = this.firestore.doc(this.path).withConverter({
175
+ toFirestore: (data) => data,
176
+ fromFirestore: (snapshot) => {
177
+ return Object.assign({ id: snapshot.id }, snapshot.data());
178
+ },
179
+ });
180
+ }
181
+ async get() {
182
+ return new ConnectBaseDocumentSnapshot(await this.reference.get());
183
+ }
184
+ getId() {
185
+ return this.reference.id;
186
+ }
187
+ async save(data) {
188
+ if (this.reference)
189
+ this.reference.update(data);
190
+ else
191
+ await this.reference.set(data);
192
+ return this;
193
+ }
194
+ async delete() {
195
+ await this.reference.delete();
196
+ }
197
+ withConverter(params) {
198
+ this.reference = this.reference.withConverter({
199
+ toFirestore: (data) => params.toFirestore(data),
200
+ fromFirestore: (snapshot, options) => params.fromFirestore(new ConnectBaseDocumentSnapshot(snapshot), options),
201
+ });
202
+ return this;
203
+ }
204
204
  }
205
205
 
206
- class ConnectCollectionService {
207
- constructor(path, firestore) {
208
- this.firestore = firestore;
209
- this.reference = firestore.collection(path).withConverter({
210
- toFirestore: (data) => data,
211
- fromFirestore: (snapshot) => {
212
- return Object.assign({ id: snapshot.id }, snapshot.data());
213
- },
214
- });
215
- }
216
- async add(data, id) {
217
- const newDoc = await this.save(data, id);
218
- return new ConnectDocumentService(newDoc.path, this.firestore).withConverter(this.converter);
219
- }
220
- async getDocs() {
221
- if (this.startingAt)
222
- this.limitBy += this.startingAt;
223
- let query = this.query ? this.query : this.reference;
224
- query = this.orderBy ? query.orderBy(this.orderBy.fieldPath, this.orderBy.directionStr) : query;
225
- query = this.limitBy ? query.limit(this.limitBy) : query;
226
- return query.get().then((docs) => {
227
- const docsPaginated = this.startingAt ? docs.docs.slice(this.startingAt, this.limitBy) : docs.docs;
228
- return {
229
- empty: Boolean(docsPaginated.length),
230
- size: docsPaginated.length,
231
- docs: docsPaginated.map((doc) => new ConnectBaseDocumentSnapshot(doc)),
232
- };
233
- });
234
- }
235
- getDoc(id) {
236
- return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore).withConverter(this.converter);
237
- }
238
- where(fieldPath, opStr, value) {
239
- this.query = this.query ? this.query.where(fieldPath, opStr, value) : this.reference.where(fieldPath, opStr, value);
240
- return this;
241
- }
242
- order(attribute, order) {
243
- this.orderBy = { fieldPath: attribute, directionStr: order };
244
- return this;
245
- }
246
- limit(quantity) {
247
- this.limitBy = quantity;
248
- return this;
249
- }
250
- offset(offsetBy) {
251
- this.offsetBy = offsetBy;
252
- return this;
253
- }
254
- fromStartAt(startingAt) {
255
- this.startingAt = startingAt;
256
- return this;
257
- }
258
- fromStartAfter(startingAt) {
259
- this.startingAfter = startingAt;
260
- return this;
261
- }
262
- withConverter(params) {
263
- this.converter = params;
264
- this.reference = this.reference.withConverter({
265
- toFirestore: (data) => params.toFirestore(data),
266
- fromFirestore: (snapshot, options) => params.fromFirestore(new ConnectBaseDocumentSnapshot(snapshot), options),
267
- });
268
- return this;
269
- }
270
- async save(data, id) {
271
- if (isEmpty(id))
272
- return this.reference.add(data);
273
- const docRef = this.reference.doc(id);
274
- await docRef.set(data);
275
- return docRef;
276
- }
206
+ class ConnectCollectionService {
207
+ constructor(path, firestore) {
208
+ this.firestore = firestore;
209
+ this.reference = firestore.collection(path).withConverter({
210
+ toFirestore: (data) => data,
211
+ fromFirestore: (snapshot) => {
212
+ return Object.assign({ id: snapshot.id }, snapshot.data());
213
+ },
214
+ });
215
+ }
216
+ async add(data, id) {
217
+ const newDoc = await this.save(data, id);
218
+ return new ConnectDocumentService(newDoc.path, this.firestore).withConverter(this.converter);
219
+ }
220
+ async getDocs() {
221
+ if (this.startingAt)
222
+ this.limitBy += this.startingAt;
223
+ let query = this.query ? this.query : this.reference;
224
+ query = this.orderBy ? query.orderBy(this.orderBy.fieldPath, this.orderBy.directionStr) : query;
225
+ query = this.limitBy ? query.limit(this.limitBy) : query;
226
+ return query.get().then((docs) => {
227
+ const docsPaginated = this.startingAt ? docs.docs.slice(this.startingAt, this.limitBy) : docs.docs;
228
+ return {
229
+ empty: Boolean(docsPaginated.length),
230
+ size: docsPaginated.length,
231
+ docs: docsPaginated.map((doc) => new ConnectBaseDocumentSnapshot(doc)),
232
+ };
233
+ });
234
+ }
235
+ getDoc(id) {
236
+ return new ConnectDocumentService(`${this.reference.path}/${id}`, this.firestore).withConverter(this.converter);
237
+ }
238
+ where(fieldPath, opStr, value) {
239
+ this.query = this.query ? this.query.where(fieldPath, opStr, value) : this.reference.where(fieldPath, opStr, value);
240
+ return this;
241
+ }
242
+ order(attribute, order) {
243
+ this.orderBy = { fieldPath: attribute, directionStr: order };
244
+ return this;
245
+ }
246
+ limit(quantity) {
247
+ this.limitBy = quantity;
248
+ return this;
249
+ }
250
+ offset(offsetBy) {
251
+ this.offsetBy = offsetBy;
252
+ return this;
253
+ }
254
+ fromStartAt(startingAt) {
255
+ this.startingAt = startingAt;
256
+ return this;
257
+ }
258
+ fromStartAfter(startingAt) {
259
+ this.startingAfter = startingAt;
260
+ return this;
261
+ }
262
+ withConverter(params) {
263
+ this.converter = params;
264
+ this.reference = this.reference.withConverter({
265
+ toFirestore: (data) => params.toFirestore(data),
266
+ fromFirestore: (snapshot, options) => params.fromFirestore(new ConnectBaseDocumentSnapshot(snapshot), options),
267
+ });
268
+ return this;
269
+ }
270
+ async save(data, id) {
271
+ if (isEmpty(id))
272
+ return this.reference.add(data);
273
+ const docRef = this.reference.doc(id);
274
+ await docRef.set(data);
275
+ return docRef;
276
+ }
277
277
  }
278
278
 
279
- let ConnectFirestoreService = class ConnectFirestoreService {
280
- constructor(firestore) {
281
- this.firestore = firestore;
282
- }
283
- getCollection(path) {
284
- return new ConnectCollectionService(path, this.firestore);
285
- }
286
- getDocument(path) {
287
- return new ConnectDocumentService(path, this.firestore);
288
- }
289
- };
290
- ConnectFirestoreService = __decorate([
291
- Injectable(),
292
- __metadata("design:paramtypes", [Firestore])
279
+ let ConnectFirestoreService = class ConnectFirestoreService {
280
+ constructor(firestore) {
281
+ this.firestore = firestore;
282
+ }
283
+ getCollection(path) {
284
+ return new ConnectCollectionService(path, this.firestore);
285
+ }
286
+ getDocument(path) {
287
+ return new ConnectDocumentService(path, this.firestore);
288
+ }
289
+ };
290
+ ConnectFirestoreService = __decorate([
291
+ Injectable(),
292
+ __metadata("design:paramtypes", [Firestore])
293
293
  ], ConnectFirestoreService);
294
294
 
295
- class PagarmeBankSlipAPIAdapter {
296
- constructor(credentials, paymentRepository) {
297
- this.credentials = credentials;
298
- this.paymentRepository = paymentRepository;
299
- }
300
- async pay(checkout) {
301
- try {
302
- const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
303
- const payload = this.createBoletoPayment(checkout);
304
- const result = await client.transactions.create(payload);
305
- console.warn('[PAGARME BOLETO DATA TO SEND]', payload);
306
- console.warn('result PagarmeBankSlipAPIAdapter', JSON.stringify(result));
307
- if (result.status !== PagarmePaymentStatus['Em processamento']) {
308
- return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
309
- checkoutId: checkout.id,
310
- userEmail: checkout.user.email,
311
- info: result,
312
- }));
313
- }
314
- const payment = await this.paymentRepository.create({
315
- createdAt: new Date(),
316
- updatedAt: new Date(),
317
- userId: checkout.user.id,
318
- checkoutId: checkout.id,
319
- totalPrice: checkout.totalPrice,
320
- paymentProvider: 'pagarMe',
321
- transaction: result,
322
- });
323
- return payment;
324
- }
325
- catch (error) {
326
- console.error('Error PagarmeBankSlipAPIAdapter', JSON.stringify(error));
327
- throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
328
- checkoutId: checkout.id,
329
- userEmail: checkout.user.email,
330
- info: error,
331
- });
332
- }
333
- }
334
- async getBoletoTransaction(paymentId) {
335
- try {
336
- const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
337
- const result = await client.transactions.find({ id: paymentId });
338
- return result;
339
- }
340
- catch (error) {
341
- throw new BusinessError('Houve uma falha buscar o boleto com paymentId: ' + paymentId, {
342
- paymentId,
343
- info: error,
344
- });
345
- }
346
- }
347
- createBoletoPayment(checkout) {
348
- return {
349
- api_key: this.credentials.API_KEY,
350
- amount: Math.floor(checkout.totalPrice * 100),
351
- boleto_rules: ['strict_expiration_date'],
352
- boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
353
- boleto_expiration_date: format(addDays(new Date(), 3), 'yyyy-MM-dd'),
354
- payment_method: 'boleto',
355
- postback_url: this.credentials.URL_POSTBACK,
356
- customer: {
357
- external_id: checkout.user.id,
358
- type: 'individual',
359
- country: 'br',
360
- name: checkout.user.displayName,
361
- documents: [
362
- {
363
- type: 'cpf',
364
- number: checkout.user.cpf,
365
- },
366
- ],
367
- },
368
- };
369
- }
295
+ class PagarmeBankSlipAPIAdapter {
296
+ constructor(credentials, paymentRepository) {
297
+ this.credentials = credentials;
298
+ this.paymentRepository = paymentRepository;
299
+ }
300
+ async pay(checkout) {
301
+ try {
302
+ const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
303
+ const payload = this.createBoletoPayment(checkout);
304
+ const result = await client.transactions.create(payload);
305
+ console.warn('[PAGARME BOLETO DATA TO SEND]', payload);
306
+ console.warn('result PagarmeBankSlipAPIAdapter', JSON.stringify(result));
307
+ if (result.status !== PagarmePaymentStatus['Em processamento']) {
308
+ return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
309
+ checkoutId: checkout.id,
310
+ userEmail: checkout.user.email,
311
+ info: result,
312
+ }));
313
+ }
314
+ const payment = await this.paymentRepository.create({
315
+ createdAt: new Date(),
316
+ updatedAt: new Date(),
317
+ userId: checkout.user.id,
318
+ checkoutId: checkout.id,
319
+ totalPrice: checkout.totalPrice,
320
+ paymentProvider: 'pagarMe',
321
+ transaction: result,
322
+ });
323
+ return payment;
324
+ }
325
+ catch (error) {
326
+ console.error('Error PagarmeBankSlipAPIAdapter', JSON.stringify(error));
327
+ throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
328
+ checkoutId: checkout.id,
329
+ userEmail: checkout.user.email,
330
+ info: error,
331
+ });
332
+ }
333
+ }
334
+ async getBoletoTransaction(paymentId) {
335
+ try {
336
+ const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
337
+ const result = await client.transactions.find({ id: paymentId });
338
+ return result;
339
+ }
340
+ catch (error) {
341
+ throw new BusinessError('Houve uma falha buscar o boleto com paymentId: ' + paymentId, {
342
+ paymentId,
343
+ info: error,
344
+ });
345
+ }
346
+ }
347
+ createBoletoPayment(checkout) {
348
+ return {
349
+ api_key: this.credentials.API_KEY,
350
+ amount: Math.floor(checkout.totalPrice * 100),
351
+ boleto_rules: ['strict_expiration_date'],
352
+ boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
353
+ boleto_expiration_date: format(addDays(new Date(), 3), 'yyyy-MM-dd'),
354
+ payment_method: 'boleto',
355
+ postback_url: this.credentials.URL_POSTBACK,
356
+ customer: {
357
+ external_id: checkout.user.id,
358
+ type: 'individual',
359
+ country: 'br',
360
+ name: checkout.user.displayName,
361
+ documents: [
362
+ {
363
+ type: 'cpf',
364
+ number: checkout.user.cpf,
365
+ },
366
+ ],
367
+ },
368
+ };
369
+ }
370
370
  }
371
371
 
372
- class PagarmeCardAPIAdapter {
373
- constructor(credentials, paymentRepository, orderBlockedRepository) {
374
- this.credentials = credentials;
375
- this.paymentRepository = paymentRepository;
376
- this.orderBlockedRepository = orderBlockedRepository;
377
- }
378
- async pay(checkout, card) {
379
- try {
380
- const client = await this.createPagarmeClient();
381
- const transactionResult = await this.executeCardTransaction(client, checkout, card);
382
- await this.validateTransactionResult(transactionResult, checkout, card);
383
- return await this.createPaymentRecord(checkout, transactionResult);
384
- }
385
- catch (error) {
386
- this.handlePaymentError(error, checkout);
387
- }
388
- }
389
- async createPagarmeClient() {
390
- return await pagarme.client.connect({ api_key: this.credentials.API_KEY });
391
- }
392
- async executeCardTransaction(client, checkout, card) {
393
- const payload = this.createCardPayment(checkout, card);
394
- const result = await client.transactions.create(payload);
395
- this.logTransactionDetails(payload, result);
396
- return result;
397
- }
398
- logTransactionDetails(payload, result) {
399
- console.warn('[PAGARME CARD DATA TO SEND]', payload);
400
- console.warn('result PagarmeCardAPIAdapter', JSON.stringify(result));
401
- }
402
- async validateTransactionResult(result, checkout, card) {
403
- if (result.status !== PagarmePaymentStatus.Pago) {
404
- await this.handleUnauthorizedPayment(checkout, card, result);
405
- }
406
- }
407
- async handleUnauthorizedPayment(checkout, card, result) {
408
- await this.createBlockedOrderRecord(checkout, card);
409
- throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
410
- checkoutId: checkout.id,
411
- userEmail: checkout.user.email,
412
- info: result,
413
- });
414
- }
415
- async createBlockedOrderRecord(checkout, card) {
416
- await this.orderBlockedRepository.createBlockedOrderOrPayment({
417
- checkout,
418
- blockType: 'Card not authorized',
419
- type: 'Card',
420
- limiteRange: 'day',
421
- card,
422
- });
423
- }
424
- async createPaymentRecord(checkout, transactionResult) {
425
- return await this.paymentRepository.create({
426
- createdAt: new Date(),
427
- updatedAt: new Date(),
428
- userId: checkout.user.id,
429
- checkoutId: checkout.id,
430
- totalPrice: checkout.totalPrice,
431
- paymentProvider: PaymentProviders.PAGARME,
432
- transaction: Object.assign(Object.assign({}, transactionResult), { paidAt: new Date() }),
433
- });
434
- }
435
- handlePaymentError(error, checkout) {
436
- console.error('Error PagarmeCardAPIAdapter', JSON.stringify(error));
437
- throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
438
- checkoutId: checkout.id,
439
- userEmail: checkout.user.email,
440
- info: error,
441
- });
442
- }
443
- async addCard(card) {
444
- try {
445
- const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
446
- const result = await client.cards.create({
447
- card_number: card.number,
448
- card_expiration_date: card.expirationDate.replace('/', ''),
449
- card_holder_name: card.name,
450
- card_cvv: card.cvv,
451
- });
452
- return result;
453
- }
454
- catch (error) {
455
- throw new BusinessError('Houve uma falha adicionar o cartão', {
456
- info: error,
457
- });
458
- }
459
- }
460
- async createCardHash(bu, shop) {
461
- try {
462
- return JSON.stringify({ bu, shop });
463
- }
464
- catch (error) {
465
- throw new BusinessError('Houve uma falha ao gerar o hash do cartão', {
466
- info: error,
467
- });
468
- }
469
- }
470
- async getCardByToken(id) {
471
- try {
472
- const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
473
- const result = await client.cards.find({
474
- id,
475
- });
476
- return result;
477
- }
478
- catch (error) {
479
- throw new BusinessError('Houve uma falha buscar o cartão com id: ' + id, {
480
- info: error,
481
- });
482
- }
483
- }
484
- async createTransaction(data) {
485
- try {
486
- const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
487
- const result = await client.transactions.create(data);
488
- return result;
489
- }
490
- catch (error) {
491
- throw new BusinessError('Houve uma falha ao criar a transação', {
492
- info: error,
493
- });
494
- }
495
- }
496
- createCardPayment(checkout, card) {
497
- var _a, _b, _c, _d, _e, _f;
498
- return {
499
- api_key: this.credentials.API_KEY,
500
- amount: Math.floor(checkout.totalPrice * 100),
501
- card_id: card.cardId,
502
- card_cvv: card.cardCvv,
503
- payment_method: 'credit_card',
504
- installments: card.installments,
505
- soft_descriptor: checkout.shop === Shops.GLAMSHOP ? 'Glam' : "Men's Market",
506
- customer: {
507
- external_id: checkout.user.id,
508
- name: checkout.user.displayName,
509
- type: 'individual',
510
- country: 'br',
511
- email: checkout.user.email,
512
- phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
513
- documents: [
514
- {
515
- type: 'cpf',
516
- number: checkout.user.cpf,
517
- },
518
- ],
519
- },
520
- billing: {
521
- name: checkout.user.displayName,
522
- address: {
523
- country: 'br',
524
- state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
525
- city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
526
- neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
527
- street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
528
- street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
529
- zipcode: checkout.billingAddress
530
- ? checkout.billingAddress.zip.replace('-', '')
531
- : (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
532
- },
533
- },
534
- items: checkout.lineItems.map((item) => {
535
- return {
536
- id: item.id,
537
- title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
538
- unit_price: Math.floor(item.pricePaid * 100),
539
- quantity: item.quantity,
540
- tangible: true,
541
- };
542
- }),
543
- };
544
- }
372
+ class PagarmeCardAPIAdapter {
373
+ constructor(credentials, paymentRepository, orderBlockedRepository) {
374
+ this.credentials = credentials;
375
+ this.paymentRepository = paymentRepository;
376
+ this.orderBlockedRepository = orderBlockedRepository;
377
+ }
378
+ async pay(checkout, card) {
379
+ try {
380
+ const client = await this.createPagarmeClient();
381
+ const transactionResult = await this.executeCardTransaction(client, checkout, card);
382
+ await this.validateTransactionResult(transactionResult, checkout, card);
383
+ return await this.createPaymentRecord(checkout, transactionResult);
384
+ }
385
+ catch (error) {
386
+ this.handlePaymentError(error, checkout);
387
+ }
388
+ }
389
+ async createPagarmeClient() {
390
+ return await pagarme.client.connect({ api_key: this.credentials.API_KEY });
391
+ }
392
+ async executeCardTransaction(client, checkout, card) {
393
+ const payload = this.createCardPayment(checkout, card);
394
+ const result = await client.transactions.create(payload);
395
+ this.logTransactionDetails(payload, result);
396
+ return result;
397
+ }
398
+ logTransactionDetails(payload, result) {
399
+ console.warn('[PAGARME CARD DATA TO SEND]', payload);
400
+ console.warn('result PagarmeCardAPIAdapter', JSON.stringify(result));
401
+ }
402
+ async validateTransactionResult(result, checkout, card) {
403
+ if (result.status !== PagarmePaymentStatus.Pago) {
404
+ await this.handleUnauthorizedPayment(checkout, card, result);
405
+ }
406
+ }
407
+ async handleUnauthorizedPayment(checkout, card, result) {
408
+ await this.createBlockedOrderRecord(checkout, card);
409
+ throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
410
+ checkoutId: checkout.id,
411
+ userEmail: checkout.user.email,
412
+ info: result,
413
+ });
414
+ }
415
+ async createBlockedOrderRecord(checkout, card) {
416
+ await this.orderBlockedRepository.createBlockedOrderOrPayment({
417
+ checkout,
418
+ blockType: 'Card not authorized',
419
+ type: 'Card',
420
+ limiteRange: 'day',
421
+ card,
422
+ });
423
+ }
424
+ async createPaymentRecord(checkout, transactionResult) {
425
+ return await this.paymentRepository.create({
426
+ createdAt: new Date(),
427
+ updatedAt: new Date(),
428
+ userId: checkout.user.id,
429
+ checkoutId: checkout.id,
430
+ totalPrice: checkout.totalPrice,
431
+ paymentProvider: PaymentProviders.PAGARME,
432
+ transaction: Object.assign(Object.assign({}, transactionResult), { paidAt: new Date() }),
433
+ });
434
+ }
435
+ handlePaymentError(error, checkout) {
436
+ console.error('Error PagarmeCardAPIAdapter', JSON.stringify(error));
437
+ throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
438
+ checkoutId: checkout.id,
439
+ userEmail: checkout.user.email,
440
+ info: error,
441
+ });
442
+ }
443
+ async addCard(card) {
444
+ try {
445
+ const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
446
+ const result = await client.cards.create({
447
+ card_number: card.number,
448
+ card_expiration_date: card.expirationDate.replace('/', ''),
449
+ card_holder_name: card.name,
450
+ card_cvv: card.cvv,
451
+ });
452
+ return result;
453
+ }
454
+ catch (error) {
455
+ throw new BusinessError('Houve uma falha adicionar o cartão', {
456
+ info: error,
457
+ });
458
+ }
459
+ }
460
+ async createCardHash(bu, shop) {
461
+ try {
462
+ return JSON.stringify({ bu, shop });
463
+ }
464
+ catch (error) {
465
+ throw new BusinessError('Houve uma falha ao gerar o hash do cartão', {
466
+ info: error,
467
+ });
468
+ }
469
+ }
470
+ async getCardByToken(id) {
471
+ try {
472
+ const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
473
+ const result = await client.cards.find({
474
+ id,
475
+ });
476
+ return result;
477
+ }
478
+ catch (error) {
479
+ throw new BusinessError('Houve uma falha buscar o cartão com id: ' + id, {
480
+ info: error,
481
+ });
482
+ }
483
+ }
484
+ async createTransaction(data) {
485
+ try {
486
+ const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
487
+ const result = await client.transactions.create(data);
488
+ return result;
489
+ }
490
+ catch (error) {
491
+ throw new BusinessError('Houve uma falha ao criar a transação', {
492
+ info: error,
493
+ });
494
+ }
495
+ }
496
+ createCardPayment(checkout, card) {
497
+ var _a, _b, _c, _d, _e, _f;
498
+ return {
499
+ api_key: this.credentials.API_KEY,
500
+ amount: Math.floor(checkout.totalPrice * 100),
501
+ card_id: card.cardId,
502
+ card_cvv: card.cardCvv,
503
+ payment_method: 'credit_card',
504
+ installments: card.installments,
505
+ soft_descriptor: checkout.shop === Shops.GLAMSHOP ? 'Glam' : "Men's Market",
506
+ customer: {
507
+ external_id: checkout.user.id,
508
+ name: checkout.user.displayName,
509
+ type: 'individual',
510
+ country: 'br',
511
+ email: checkout.user.email,
512
+ phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
513
+ documents: [
514
+ {
515
+ type: 'cpf',
516
+ number: checkout.user.cpf,
517
+ },
518
+ ],
519
+ },
520
+ billing: {
521
+ name: checkout.user.displayName,
522
+ address: {
523
+ country: 'br',
524
+ state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
525
+ city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
526
+ neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
527
+ street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
528
+ street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
529
+ zipcode: checkout.billingAddress
530
+ ? checkout.billingAddress.zip.replace('-', '')
531
+ : (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
532
+ },
533
+ },
534
+ items: checkout.lineItems.map((item) => {
535
+ return {
536
+ id: item.id,
537
+ title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
538
+ unit_price: Math.floor(item.pricePaid * 100),
539
+ quantity: item.quantity,
540
+ tangible: true,
541
+ };
542
+ }),
543
+ };
544
+ }
545
545
  }
546
546
 
547
- class PagarmePixAPIAdapter {
548
- constructor(credentials, paymentRepository) {
549
- this.credentials = credentials;
550
- this.paymentRepository = paymentRepository;
551
- }
552
- async pay(checkout) {
553
- try {
554
- const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
555
- const payload = this.createPixPayment(checkout);
556
- const result = await client.transactions.create(payload);
557
- console.warn('[PAGARME PIX DATA TO SEND]', payload);
558
- console.warn('result PagarmePixAPIAdapter', JSON.stringify(result));
559
- const payment = await this.paymentRepository.create({
560
- createdAt: new Date(),
561
- updatedAt: new Date(),
562
- userId: checkout.user.id,
563
- checkoutId: checkout.id,
564
- totalPrice: checkout.totalPrice,
565
- paymentProvider: 'pagarMe',
566
- transaction: result,
567
- });
568
- return payment;
569
- }
570
- catch (error) {
571
- console.error('Error PagarmePixAPIAdapter', JSON.stringify(error));
572
- throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
573
- checkoutId: checkout.id,
574
- userEmail: checkout.user.email,
575
- info: error,
576
- });
577
- }
578
- }
579
- createPixPayment(checkout) {
580
- return {
581
- payment_method: 'pix',
582
- amount: Math.floor(checkout.totalPrice * 100),
583
- api_key: this.credentials.API_KEY,
584
- postback_url: this.credentials.URL_POSTBACK,
585
- pix_expiration_date: format(addDays(new Date(), 1), 'yyyy-MM-dd'),
586
- customer: {
587
- external_id: checkout.user.id,
588
- type: 'individual',
589
- country: 'br',
590
- name: checkout.user.displayName,
591
- email: checkout.user.email.trim(),
592
- phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
593
- documents: [
594
- {
595
- type: 'cpf',
596
- number: checkout.user.cpf,
597
- },
598
- ],
599
- },
600
- };
601
- }
547
+ class PagarmePixAPIAdapter {
548
+ constructor(credentials, paymentRepository) {
549
+ this.credentials = credentials;
550
+ this.paymentRepository = paymentRepository;
551
+ }
552
+ async pay(checkout) {
553
+ try {
554
+ const client = await pagarme.client.connect({ api_key: this.credentials.API_KEY });
555
+ const payload = this.createPixPayment(checkout);
556
+ const result = await client.transactions.create(payload);
557
+ console.warn('[PAGARME PIX DATA TO SEND]', payload);
558
+ console.warn('result PagarmePixAPIAdapter', JSON.stringify(result));
559
+ const payment = await this.paymentRepository.create({
560
+ createdAt: new Date(),
561
+ updatedAt: new Date(),
562
+ userId: checkout.user.id,
563
+ checkoutId: checkout.id,
564
+ totalPrice: checkout.totalPrice,
565
+ paymentProvider: 'pagarMe',
566
+ transaction: result,
567
+ });
568
+ return payment;
569
+ }
570
+ catch (error) {
571
+ console.error('Error PagarmePixAPIAdapter', JSON.stringify(error));
572
+ throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
573
+ checkoutId: checkout.id,
574
+ userEmail: checkout.user.email,
575
+ info: error,
576
+ });
577
+ }
578
+ }
579
+ createPixPayment(checkout) {
580
+ return {
581
+ payment_method: 'pix',
582
+ amount: Math.floor(checkout.totalPrice * 100),
583
+ api_key: this.credentials.API_KEY,
584
+ postback_url: this.credentials.URL_POSTBACK,
585
+ pix_expiration_date: format(addDays(new Date(), 1), 'yyyy-MM-dd'),
586
+ customer: {
587
+ external_id: checkout.user.id,
588
+ type: 'individual',
589
+ country: 'br',
590
+ name: checkout.user.displayName,
591
+ email: checkout.user.email.trim(),
592
+ phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
593
+ documents: [
594
+ {
595
+ type: 'cpf',
596
+ number: checkout.user.cpf,
597
+ },
598
+ ],
599
+ },
600
+ };
601
+ }
602
602
  }
603
603
 
604
- class ProductVertexHelper {
605
- constructor() { }
606
- static productMapper(product) {
607
- var _a, _b;
608
- const image = product.miniatures && product.miniatures.length ? product.miniatures[0] : null;
609
- return {
610
- id: product.id.toString(),
611
- miniatures: image,
612
- icon: image,
613
- name: product.name,
614
- brand: ((_a = product.brand) === null || _a === void 0 ? void 0 : _a.toString().trim()) ? (_b = product.brand) === null || _b === void 0 ? void 0 : _b.toString().trim() : null,
615
- ean: product.EAN,
616
- sku: product.sku,
617
- slug: product.slug,
618
- published: product.published,
619
- gender: product.gender,
620
- stock: product.stock.quantity,
621
- rating: product.rate,
622
- shoppingCount: product.shoppingCount,
623
- description: product.description.description,
624
- fullPrice: product.fullPrice,
625
- price: product.price.price,
626
- subscriberPrice: product.subscriberPrice,
627
- outlet: product.outlet,
628
- createdAt: product.createdAt,
629
- };
630
- }
631
- static resultProductMapper(result) {
632
- return result[0].length
633
- ? result[0].map((result) => {
634
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
635
- return {
636
- id: (_a = result.document) === null || _a === void 0 ? void 0 : _a.structData.fields.id.stringValue,
637
- name: (_b = result.document) === null || _b === void 0 ? void 0 : _b.structData.fields.name.stringValue,
638
- brand: (_d = (_c = result.document) === null || _c === void 0 ? void 0 : _c.structData.fields.brand) === null || _d === void 0 ? void 0 : _d.stringValue,
639
- stock: (_f = (_e = result.document) === null || _e === void 0 ? void 0 : _e.structData.fields.stock) === null || _f === void 0 ? void 0 : _f.numberValue,
640
- rating: (_h = (_g = result.document) === null || _g === void 0 ? void 0 : _g.structData.fields.rating) === null || _h === void 0 ? void 0 : _h.stringValue,
641
- gender: (_k = (_j = result.document) === null || _j === void 0 ? void 0 : _j.structData.fields.gender) === null || _k === void 0 ? void 0 : _k.stringValue,
642
- slug: (_m = (_l = result.document) === null || _l === void 0 ? void 0 : _l.structData.fields.slug) === null || _m === void 0 ? void 0 : _m.stringValue,
643
- sku: (_p = (_o = result.document) === null || _o === void 0 ? void 0 : _o.structData.fields.sku) === null || _p === void 0 ? void 0 : _p.stringValue,
644
- ean: (_r = (_q = result.document) === null || _q === void 0 ? void 0 : _q.structData.fields.ean) === null || _r === void 0 ? void 0 : _r.stringValue,
645
- description: (_t = (_s = result.document) === null || _s === void 0 ? void 0 : _s.structData.fields.description) === null || _t === void 0 ? void 0 : _t.stringValue,
646
- };
647
- })
648
- : [];
649
- }
604
+ class ProductVertexHelper {
605
+ constructor() { }
606
+ static productMapper(product) {
607
+ var _a, _b;
608
+ const image = product.miniatures && product.miniatures.length ? product.miniatures[0] : null;
609
+ return {
610
+ id: product.id.toString(),
611
+ miniatures: image,
612
+ icon: image,
613
+ name: product.name,
614
+ brand: ((_a = product.brand) === null || _a === void 0 ? void 0 : _a.toString().trim()) ? (_b = product.brand) === null || _b === void 0 ? void 0 : _b.toString().trim() : null,
615
+ ean: product.EAN,
616
+ sku: product.sku,
617
+ slug: product.slug,
618
+ published: product.published,
619
+ gender: product.gender,
620
+ stock: product.stock.quantity,
621
+ rating: product.rate,
622
+ shoppingCount: product.shoppingCount,
623
+ description: product.description.description,
624
+ fullPrice: product.fullPrice,
625
+ price: product.price.price,
626
+ subscriberPrice: product.subscriberPrice,
627
+ outlet: product.outlet,
628
+ createdAt: product.createdAt,
629
+ };
630
+ }
631
+ static resultProductMapper(result) {
632
+ return result[0].length
633
+ ? result[0].map((result) => {
634
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
635
+ return {
636
+ id: (_a = result.document) === null || _a === void 0 ? void 0 : _a.structData.fields.id.stringValue,
637
+ name: (_b = result.document) === null || _b === void 0 ? void 0 : _b.structData.fields.name.stringValue,
638
+ brand: (_d = (_c = result.document) === null || _c === void 0 ? void 0 : _c.structData.fields.brand) === null || _d === void 0 ? void 0 : _d.stringValue,
639
+ stock: (_f = (_e = result.document) === null || _e === void 0 ? void 0 : _e.structData.fields.stock) === null || _f === void 0 ? void 0 : _f.numberValue,
640
+ rating: (_h = (_g = result.document) === null || _g === void 0 ? void 0 : _g.structData.fields.rating) === null || _h === void 0 ? void 0 : _h.stringValue,
641
+ gender: (_k = (_j = result.document) === null || _j === void 0 ? void 0 : _j.structData.fields.gender) === null || _k === void 0 ? void 0 : _k.stringValue,
642
+ slug: (_m = (_l = result.document) === null || _l === void 0 ? void 0 : _l.structData.fields.slug) === null || _m === void 0 ? void 0 : _m.stringValue,
643
+ sku: (_p = (_o = result.document) === null || _o === void 0 ? void 0 : _o.structData.fields.sku) === null || _p === void 0 ? void 0 : _p.stringValue,
644
+ ean: (_r = (_q = result.document) === null || _q === void 0 ? void 0 : _q.structData.fields.ean) === null || _r === void 0 ? void 0 : _r.stringValue,
645
+ description: (_t = (_s = result.document) === null || _s === void 0 ? void 0 : _s.structData.fields.description) === null || _t === void 0 ? void 0 : _t.stringValue,
646
+ };
647
+ })
648
+ : [];
649
+ }
650
650
  }
651
651
 
652
- let DiscoveryEngineVertexAdapter = class DiscoveryEngineVertexAdapter {
653
- constructor(configuration) {
654
- this.config = configuration;
655
- this.parentEngine =
656
- `projects/${this.config.projectId}/locations/${this.config.location}/` +
657
- `collections/default_collection/engines/${this.config.dataStoreId}`;
658
- this.parentDataStore =
659
- `projects/${this.config.projectId}/locations/${this.config.location}/` +
660
- `collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents`;
661
- this.searchClient = new SearchServiceClient({
662
- apiEndpoint: configuration.apiEndpoint,
663
- credentials: configuration.credentials,
664
- });
665
- this.documentClient = new DocumentServiceClient({
666
- apiEndpoint: configuration.apiEndpoint,
667
- credentials: configuration.credentials,
668
- });
669
- this.servingConfig = this.searchClient.projectLocationCollectionDataStoreServingConfigPath(configuration.projectId, configuration.location, configuration.collectionId, configuration.dataStoreId, configuration.servingConfigId);
670
- }
671
- async save(product) {
672
- const productSearch = ProductVertexHelper.productMapper(product);
673
- const request = {
674
- parent: this.parentEngine,
675
- allowMissing: true,
676
- document: {
677
- name: this.parentDataStore + `/${product.id}`,
678
- jsonData: JSON.stringify(productSearch),
679
- data: 'jsonData',
680
- },
681
- };
682
- const response = await this.documentClient.updateDocument(request);
683
- return response;
684
- }
685
- async update(id, data) {
686
- const productSearch = ProductVertexHelper.productMapper(data);
687
- const request = {
688
- parent: this.parentEngine,
689
- allowMissing: true,
690
- document: {
691
- name: this.parentDataStore + `/${id}`,
692
- jsonData: JSON.stringify(productSearch),
693
- data: 'jsonData',
694
- },
695
- };
696
- const response = await this.documentClient.updateDocument(request);
697
- return response;
698
- }
699
- async query(term, total) {
700
- const response = (await this.searchClient.search({
701
- pageSize: total,
702
- query: term,
703
- filter: '',
704
- languageCode: 'pt-BR',
705
- servingConfig: this.servingConfig,
706
- relevanceThreshold: 'MEDIUM',
707
- }, {
708
- autoPaginate: false,
709
- }));
710
- return ProductVertexHelper.resultProductMapper(response);
711
- }
712
- async get(id) {
713
- const request = {
714
- name: this.parentDataStore + `/${id}`,
715
- };
716
- const response = await this.documentClient.getDocument(request);
717
- const document = JSON.parse(response[0].jsonData);
718
- return document;
719
- }
720
- async delete(id) {
721
- const request = {
722
- name: this.parentDataStore + `/${id}`,
723
- };
724
- await this.documentClient.deleteDocument(request);
725
- }
726
- async bulkProducts(products) {
727
- try {
728
- const batchSize = 100;
729
- let total = 0;
730
- for (let index = 0; index < products.length; index += batchSize) {
731
- const bulkProducts = products.slice(index, index + batchSize);
732
- const [operation] = await this.documentClient.importDocuments({
733
- parent: `projects/${this.config.projectId}/locations/${this.config.location}/` +
734
- `collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch`,
735
- inlineSource: {
736
- documents: bulkProducts,
737
- },
738
- });
739
- total += bulkProducts.length;
740
- const [response] = await operation.promise();
741
- console.warn(`Imported: ${total} documents`, ((total / products.length) * 100).toFixed(2) + '%', 'Erros: ', response.errorSamples ? response.errorSamples : []);
742
- }
743
- }
744
- catch (error) {
745
- console.error(error);
746
- }
747
- }
748
- };
749
- DiscoveryEngineVertexAdapter = __decorate([
750
- Injectable(),
751
- __param(0, Inject(VERTEX_CONFIG)),
752
- __metadata("design:paramtypes", [Object])
652
+ let DiscoveryEngineVertexAdapter = class DiscoveryEngineVertexAdapter {
653
+ constructor(configuration) {
654
+ this.config = configuration;
655
+ this.parentEngine =
656
+ `projects/${this.config.projectId}/locations/${this.config.location}/` +
657
+ `collections/default_collection/engines/${this.config.dataStoreId}`;
658
+ this.parentDataStore =
659
+ `projects/${this.config.projectId}/locations/${this.config.location}/` +
660
+ `collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch/documents`;
661
+ this.searchClient = new SearchServiceClient({
662
+ apiEndpoint: configuration.apiEndpoint,
663
+ credentials: configuration.credentials,
664
+ });
665
+ this.documentClient = new DocumentServiceClient({
666
+ apiEndpoint: configuration.apiEndpoint,
667
+ credentials: configuration.credentials,
668
+ });
669
+ this.servingConfig = this.searchClient.projectLocationCollectionDataStoreServingConfigPath(configuration.projectId, configuration.location, configuration.collectionId, configuration.dataStoreId, configuration.servingConfigId);
670
+ }
671
+ async save(product) {
672
+ const productSearch = ProductVertexHelper.productMapper(product);
673
+ const request = {
674
+ parent: this.parentEngine,
675
+ allowMissing: true,
676
+ document: {
677
+ name: this.parentDataStore + `/${product.id}`,
678
+ jsonData: JSON.stringify(productSearch),
679
+ data: 'jsonData',
680
+ },
681
+ };
682
+ const response = await this.documentClient.updateDocument(request);
683
+ return response;
684
+ }
685
+ async update(id, data) {
686
+ const productSearch = ProductVertexHelper.productMapper(data);
687
+ const request = {
688
+ parent: this.parentEngine,
689
+ allowMissing: true,
690
+ document: {
691
+ name: this.parentDataStore + `/${id}`,
692
+ jsonData: JSON.stringify(productSearch),
693
+ data: 'jsonData',
694
+ },
695
+ };
696
+ const response = await this.documentClient.updateDocument(request);
697
+ return response;
698
+ }
699
+ async query(term, total) {
700
+ const response = (await this.searchClient.search({
701
+ pageSize: total,
702
+ query: term,
703
+ filter: '',
704
+ languageCode: 'pt-BR',
705
+ servingConfig: this.servingConfig,
706
+ relevanceThreshold: 'MEDIUM',
707
+ }, {
708
+ autoPaginate: false,
709
+ }));
710
+ return ProductVertexHelper.resultProductMapper(response);
711
+ }
712
+ async get(id) {
713
+ const request = {
714
+ name: this.parentDataStore + `/${id}`,
715
+ };
716
+ const response = await this.documentClient.getDocument(request);
717
+ const document = JSON.parse(response[0].jsonData);
718
+ return document;
719
+ }
720
+ async delete(id) {
721
+ const request = {
722
+ name: this.parentDataStore + `/${id}`,
723
+ };
724
+ await this.documentClient.deleteDocument(request);
725
+ }
726
+ async bulkProducts(products) {
727
+ try {
728
+ const batchSize = 100;
729
+ let total = 0;
730
+ for (let index = 0; index < products.length; index += batchSize) {
731
+ const bulkProducts = products.slice(index, index + batchSize);
732
+ const [operation] = await this.documentClient.importDocuments({
733
+ parent: `projects/${this.config.projectId}/locations/${this.config.location}/` +
734
+ `collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch`,
735
+ inlineSource: {
736
+ documents: bulkProducts,
737
+ },
738
+ });
739
+ total += bulkProducts.length;
740
+ const [response] = await operation.promise();
741
+ console.warn(`Imported: ${total} documents`, ((total / products.length) * 100).toFixed(2) + '%', 'Erros: ', response.errorSamples ? response.errorSamples : []);
742
+ }
743
+ }
744
+ catch (error) {
745
+ console.error(error);
746
+ }
747
+ }
748
+ };
749
+ DiscoveryEngineVertexAdapter = __decorate([
750
+ Injectable(),
751
+ __param(0, Inject(VERTEX_CONFIG)),
752
+ __metadata("design:paramtypes", [Object])
753
753
  ], DiscoveryEngineVertexAdapter);
754
754
 
755
- var NestElasticSeachModule_1;
756
- let NestElasticSeachModule = NestElasticSeachModule_1 = class NestElasticSeachModule {
757
- static initializeApp(options) {
758
- return {
759
- module: NestElasticSeachModule_1,
760
- providers: [{ provide: ES_CONFIG, useValue: options }],
761
- exports: [ES_CONFIG],
762
- };
763
- }
764
- };
765
- NestElasticSeachModule = NestElasticSeachModule_1 = __decorate([
766
- Module({
767
- providers: [
768
- NativeElasticSearchAdapter,
769
- {
770
- provide: ProductsIndex,
771
- useFactory: (adapter) => new ProductsIndex(adapter),
772
- inject: [NativeElasticSearchAdapter],
773
- },
774
- ],
775
- exports: [ProductsIndex],
776
- })
755
+ var NestElasticSeachModule_1;
756
+ let NestElasticSeachModule = NestElasticSeachModule_1 = class NestElasticSeachModule {
757
+ static initializeApp(options) {
758
+ return {
759
+ module: NestElasticSeachModule_1,
760
+ providers: [{ provide: ES_CONFIG, useValue: options }],
761
+ exports: [ES_CONFIG],
762
+ };
763
+ }
764
+ };
765
+ NestElasticSeachModule = NestElasticSeachModule_1 = __decorate([
766
+ Module({
767
+ providers: [
768
+ NativeElasticSearchAdapter,
769
+ {
770
+ provide: ProductsIndex,
771
+ useFactory: (adapter) => new ProductsIndex(adapter),
772
+ inject: [NativeElasticSearchAdapter],
773
+ },
774
+ ],
775
+ exports: [ProductsIndex],
776
+ })
777
777
  ], NestElasticSeachModule);
778
778
 
779
- let NestStorageModule = class NestStorageModule {
780
- };
781
- NestStorageModule = __decorate([
782
- Module({
783
- providers: [
784
- {
785
- provide: FIREBASE_STORAGE,
786
- useFactory: (firebaseAdmin) => firebaseAdmin.storage,
787
- inject: [FirebaseConstants.FIREBASE_TOKEN],
788
- },
789
- ],
790
- exports: [FIREBASE_STORAGE],
791
- })
779
+ let NestStorageModule = class NestStorageModule {
780
+ };
781
+ NestStorageModule = __decorate([
782
+ Module({
783
+ providers: [
784
+ {
785
+ provide: FIREBASE_STORAGE,
786
+ useFactory: (firebaseAdmin) => firebaseAdmin.storage,
787
+ inject: [FirebaseConstants.FIREBASE_TOKEN],
788
+ },
789
+ ],
790
+ exports: [FIREBASE_STORAGE],
791
+ })
792
792
  ], NestStorageModule);
793
793
 
794
- var NestFirestoreModule_1;
795
- let NestFirestoreModule = NestFirestoreModule_1 = class NestFirestoreModule {
796
- static initializeApp(options) {
797
- var _a;
798
- return {
799
- module: NestFirestoreModule_1,
800
- imports: [
801
- FirebaseModule.forRoot({
802
- googleApplicationCredential: (_a = options === null || options === void 0 ? void 0 : options.firebase) === null || _a === void 0 ? void 0 : _a.googleApplicationCredential,
803
- }),
804
- NestStorageModule,
805
- ],
806
- exports: [FirebaseModule, NestStorageModule],
807
- };
808
- }
809
- };
810
- NestFirestoreModule = NestFirestoreModule_1 = __decorate([
811
- Module({
812
- providers: [
813
- {
814
- provide: ConnectFirestoreService,
815
- useFactory: (firebaseAdmin) => new ConnectFirestoreService(firebaseAdmin.firestore),
816
- inject: [FirebaseConstants.FIREBASE_TOKEN],
817
- },
818
- {
819
- provide: 'FirestoreOptions',
820
- useFactory: (connectFirestoreService) => ({
821
- firestore: connectFirestoreService,
822
- }),
823
- inject: [ConnectFirestoreService],
824
- },
825
- {
826
- provide: 'BeautyProfileRepository',
827
- useFactory: (config, userRepository) => {
828
- return new UserBeautyProfileFirestoreRepository(config, userRepository);
829
- },
830
- inject: ['FirestoreOptions', 'UserRepository'],
831
- },
832
- {
833
- provide: 'Buy2WinRepository',
834
- useFactory: (options) => {
835
- return new Buy2WinFirestoreRepository(options);
836
- },
837
- inject: ['FirestoreOptions'],
838
- },
839
- {
840
- provide: CategoryFirestoreRepository,
841
- useFactory: (options) => {
842
- return new CategoryFirestoreRepository(options);
843
- },
844
- inject: ['FirestoreOptions'],
845
- },
846
- {
847
- provide: 'CheckoutRepository',
848
- useFactory: (options) => {
849
- return new CheckoutFirestoreRepository(options);
850
- },
851
- inject: ['FirestoreOptions'],
852
- },
853
- {
854
- provide: 'CheckoutSubscriptionRepository',
855
- useFactory: (options) => {
856
- return new CheckoutSubscriptionFirestoreRepository(options);
857
- },
858
- inject: ['FirestoreOptions'],
859
- },
860
- {
861
- provide: 'CouponRepository',
862
- useFactory: (options) => {
863
- return new CouponFirestoreRepository(options);
864
- },
865
- inject: ['FirestoreOptions'],
866
- },
867
- {
868
- provide: 'CampaignHashtagRepository',
869
- useFactory: (options) => {
870
- return new CampaignHashtagFirestoreRepository(options);
871
- },
872
- inject: ['FirestoreOptions'],
873
- },
874
- {
875
- provide: 'CampaignDashboardRepository',
876
- useFactory: (options) => {
877
- return new CampaignDashboardFirestoreRepository(options);
878
- },
879
- inject: ['FirestoreOptions'],
880
- },
881
- {
882
- provide: 'EditionRepository',
883
- useFactory: (options, subscriptionRepository) => {
884
- return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
885
- },
886
- inject: ['FirestoreOptions', 'SubscriptionRepository'],
887
- },
888
- {
889
- provide: 'GroupRepository',
890
- useFactory: (options) => {
891
- return new GroupFirestoreRepository(options);
892
- },
893
- inject: ['FirestoreOptions'],
894
- },
895
- {
896
- provide: 'HomeRepository',
897
- useFactory: (options) => {
898
- return new HomeFirestoreRepository(options);
899
- },
900
- inject: ['FirestoreOptions'],
901
- },
902
- {
903
- provide: 'LeadRepository',
904
- useFactory: (options) => {
905
- return new LeadFirestoreRepository(options);
906
- },
907
- inject: ['FirestoreOptions'],
908
- },
909
- {
910
- provide: 'LegacyOrderRepository',
911
- useFactory: (options) => {
912
- return new LegacyOrderFirestoreRepository(options);
913
- },
914
- inject: ['FirestoreOptions'],
915
- },
916
- {
917
- provide: 'ShopMenuRepository',
918
- useFactory: (options) => {
919
- return new ShopMenuFirestoreRepository(options);
920
- },
921
- inject: ['FirestoreOptions'],
922
- },
923
- {
924
- provide: 'OrderRepository',
925
- useFactory: (options) => {
926
- return new OrderFirestoreRepository(options);
927
- },
928
- inject: ['FirestoreOptions'],
929
- },
930
- {
931
- provide: 'PaymentRepository',
932
- useFactory: (options) => {
933
- return new PaymentFirestoreRepository(options);
934
- },
935
- inject: ['FirestoreOptions'],
936
- },
937
- {
938
- provide: ProductFirestoreRepository,
939
- useFactory: (options) => {
940
- return new ProductFirestoreRepository(options);
941
- },
942
- inject: ['FirestoreOptions'],
943
- },
944
- {
945
- provide: 'ShopSettingsRepository',
946
- useFactory: (options) => {
947
- return new ShopSettingsFirestoreRepository(options);
948
- },
949
- inject: ['FirestoreOptions'],
950
- },
951
- {
952
- provide: 'SubscriptionPaymentRepository',
953
- useFactory: (options, subscriptionRepository) => {
954
- return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
955
- },
956
- inject: ['FirestoreOptions', 'SubscriptionRepository'],
957
- },
958
- {
959
- provide: 'SubscriptionPlanRepository',
960
- useFactory: (options) => {
961
- return new SubscriptionPlanFirestoreRepository(options);
962
- },
963
- inject: ['FirestoreOptions'],
964
- },
965
- {
966
- provide: 'SubscriptionProductRepository',
967
- useFactory: (options) => {
968
- return new SubscriptionProductFirestoreRepository(options);
969
- },
970
- inject: ['FirestoreOptions'],
971
- },
972
- {
973
- provide: 'SubscriptionRepository',
974
- useFactory: (options) => {
975
- return new SubscriptionFirestoreRepository(options);
976
- },
977
- inject: ['FirestoreOptions'],
978
- },
979
- {
980
- provide: 'UserRepository',
981
- useFactory: (options) => {
982
- return new UserFirestoreRepository(options);
983
- },
984
- inject: ['FirestoreOptions'],
985
- },
986
- {
987
- provide: 'UserAddressRepository',
988
- useFactory: (options, userRepository) => {
989
- return new UserAddressFirestoreRepository(options, userRepository);
990
- },
991
- inject: ['FirestoreOptions', 'UserRepository'],
992
- },
993
- {
994
- provide: 'UserPaymentMethodRepository',
995
- useFactory: (options, userRepository) => {
996
- return new UserPaymentMethodFirestoreRepository(options, userRepository);
997
- },
998
- inject: ['FirestoreOptions', 'UserRepository'],
999
- },
1000
- {
1001
- provide: 'SubscriptionMaterializationRepository',
1002
- useFactory: (options) => {
1003
- return new SubscriptionMaterializationFirestoreRepository(options);
1004
- },
1005
- inject: ['FirestoreOptions'],
1006
- },
1007
- {
1008
- provide: 'SubscriptionSummaryRepository',
1009
- useFactory: (options) => {
1010
- return new SubscriptionSummaryFirestoreRepository(options);
1011
- },
1012
- inject: ['FirestoreOptions'],
1013
- },
1014
- {
1015
- provide: ProductVariantFirestoreRepository,
1016
- useFactory: (options, productRepository) => {
1017
- return new ProductVariantFirestoreRepository(options, productRepository);
1018
- },
1019
- inject: ['FirestoreOptions', ProductFirestoreRepository],
1020
- },
1021
- {
1022
- provide: 'OrderBlockedRepository',
1023
- useFactory: (options) => {
1024
- return new OrderBlockedFirestoreRepository(options);
1025
- },
1026
- inject: ['FirestoreOptions'],
1027
- },
1028
- {
1029
- provide: 'LogRepository',
1030
- useFactory: (options) => {
1031
- return new LogFirestoreRepository(options);
1032
- },
1033
- inject: ['FirestoreOptions'],
1034
- },
1035
- {
1036
- provide: 'SequenceRepository',
1037
- useFactory: (options) => {
1038
- return new SequenceFirestoreRepository(options);
1039
- },
1040
- inject: ['FirestoreOptions'],
1041
- },
1042
- ],
1043
- exports: [
1044
- 'BeautyProfileRepository',
1045
- 'Buy2WinRepository',
1046
- CategoryFirestoreRepository,
1047
- 'CheckoutRepository',
1048
- 'CheckoutSubscriptionRepository',
1049
- 'CouponRepository',
1050
- 'CampaignHashtagRepository',
1051
- 'CampaignDashboardRepository',
1052
- 'EditionRepository',
1053
- 'GroupRepository',
1054
- 'HomeRepository',
1055
- 'LeadRepository',
1056
- 'LegacyOrderRepository',
1057
- 'ShopMenuRepository',
1058
- 'OrderRepository',
1059
- 'OrderBlockedRepository',
1060
- 'PaymentRepository',
1061
- 'SequenceRepository',
1062
- 'LogRepository',
1063
- ProductFirestoreRepository,
1064
- 'ShopSettingsRepository',
1065
- 'SubscriptionPaymentRepository',
1066
- 'SubscriptionPlanRepository',
1067
- 'SubscriptionProductRepository',
1068
- 'SubscriptionRepository',
1069
- 'UserRepository',
1070
- 'UserAddressRepository',
1071
- 'UserPaymentMethodRepository',
1072
- 'SubscriptionMaterializationRepository',
1073
- 'SubscriptionSummaryRepository',
1074
- ProductVariantFirestoreRepository,
1075
- ConnectFirestoreService,
1076
- ],
1077
- })
794
+ var NestFirestoreModule_1;
795
+ let NestFirestoreModule = NestFirestoreModule_1 = class NestFirestoreModule {
796
+ static initializeApp(options) {
797
+ var _a;
798
+ return {
799
+ module: NestFirestoreModule_1,
800
+ imports: [
801
+ FirebaseModule.forRoot({
802
+ googleApplicationCredential: (_a = options === null || options === void 0 ? void 0 : options.firebase) === null || _a === void 0 ? void 0 : _a.googleApplicationCredential,
803
+ }),
804
+ NestStorageModule,
805
+ ],
806
+ exports: [FirebaseModule, NestStorageModule],
807
+ };
808
+ }
809
+ };
810
+ NestFirestoreModule = NestFirestoreModule_1 = __decorate([
811
+ Module({
812
+ providers: [
813
+ {
814
+ provide: ConnectFirestoreService,
815
+ useFactory: (firebaseAdmin) => new ConnectFirestoreService(firebaseAdmin.firestore),
816
+ inject: [FirebaseConstants.FIREBASE_TOKEN],
817
+ },
818
+ {
819
+ provide: 'FirestoreOptions',
820
+ useFactory: (connectFirestoreService) => ({
821
+ firestore: connectFirestoreService,
822
+ }),
823
+ inject: [ConnectFirestoreService],
824
+ },
825
+ {
826
+ provide: 'BeautyProfileRepository',
827
+ useFactory: (config, userRepository) => {
828
+ return new UserBeautyProfileFirestoreRepository(config, userRepository);
829
+ },
830
+ inject: ['FirestoreOptions', 'UserRepository'],
831
+ },
832
+ {
833
+ provide: 'Buy2WinRepository',
834
+ useFactory: (options) => {
835
+ return new Buy2WinFirestoreRepository(options);
836
+ },
837
+ inject: ['FirestoreOptions'],
838
+ },
839
+ {
840
+ provide: CategoryFirestoreRepository,
841
+ useFactory: (options) => {
842
+ return new CategoryFirestoreRepository(options);
843
+ },
844
+ inject: ['FirestoreOptions'],
845
+ },
846
+ {
847
+ provide: 'CheckoutRepository',
848
+ useFactory: (options) => {
849
+ return new CheckoutFirestoreRepository(options);
850
+ },
851
+ inject: ['FirestoreOptions'],
852
+ },
853
+ {
854
+ provide: 'CheckoutSubscriptionRepository',
855
+ useFactory: (options) => {
856
+ return new CheckoutSubscriptionFirestoreRepository(options);
857
+ },
858
+ inject: ['FirestoreOptions'],
859
+ },
860
+ {
861
+ provide: 'CouponRepository',
862
+ useFactory: (options) => {
863
+ return new CouponFirestoreRepository(options);
864
+ },
865
+ inject: ['FirestoreOptions'],
866
+ },
867
+ {
868
+ provide: 'CampaignHashtagRepository',
869
+ useFactory: (options) => {
870
+ return new CampaignHashtagFirestoreRepository(options);
871
+ },
872
+ inject: ['FirestoreOptions'],
873
+ },
874
+ {
875
+ provide: 'CampaignDashboardRepository',
876
+ useFactory: (options) => {
877
+ return new CampaignDashboardFirestoreRepository(options);
878
+ },
879
+ inject: ['FirestoreOptions'],
880
+ },
881
+ {
882
+ provide: 'EditionRepository',
883
+ useFactory: (options, subscriptionRepository) => {
884
+ return new SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
885
+ },
886
+ inject: ['FirestoreOptions', 'SubscriptionRepository'],
887
+ },
888
+ {
889
+ provide: 'GroupRepository',
890
+ useFactory: (options) => {
891
+ return new GroupFirestoreRepository(options);
892
+ },
893
+ inject: ['FirestoreOptions'],
894
+ },
895
+ {
896
+ provide: 'HomeRepository',
897
+ useFactory: (options) => {
898
+ return new HomeFirestoreRepository(options);
899
+ },
900
+ inject: ['FirestoreOptions'],
901
+ },
902
+ {
903
+ provide: 'LeadRepository',
904
+ useFactory: (options) => {
905
+ return new LeadFirestoreRepository(options);
906
+ },
907
+ inject: ['FirestoreOptions'],
908
+ },
909
+ {
910
+ provide: 'LegacyOrderRepository',
911
+ useFactory: (options) => {
912
+ return new LegacyOrderFirestoreRepository(options);
913
+ },
914
+ inject: ['FirestoreOptions'],
915
+ },
916
+ {
917
+ provide: 'ShopMenuRepository',
918
+ useFactory: (options) => {
919
+ return new ShopMenuFirestoreRepository(options);
920
+ },
921
+ inject: ['FirestoreOptions'],
922
+ },
923
+ {
924
+ provide: 'OrderRepository',
925
+ useFactory: (options) => {
926
+ return new OrderFirestoreRepository(options);
927
+ },
928
+ inject: ['FirestoreOptions'],
929
+ },
930
+ {
931
+ provide: 'PaymentRepository',
932
+ useFactory: (options) => {
933
+ return new PaymentFirestoreRepository(options);
934
+ },
935
+ inject: ['FirestoreOptions'],
936
+ },
937
+ {
938
+ provide: ProductFirestoreRepository,
939
+ useFactory: (options) => {
940
+ return new ProductFirestoreRepository(options);
941
+ },
942
+ inject: ['FirestoreOptions'],
943
+ },
944
+ {
945
+ provide: 'ShopSettingsRepository',
946
+ useFactory: (options) => {
947
+ return new ShopSettingsFirestoreRepository(options);
948
+ },
949
+ inject: ['FirestoreOptions'],
950
+ },
951
+ {
952
+ provide: 'SubscriptionPaymentRepository',
953
+ useFactory: (options, subscriptionRepository) => {
954
+ return new SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
955
+ },
956
+ inject: ['FirestoreOptions', 'SubscriptionRepository'],
957
+ },
958
+ {
959
+ provide: 'SubscriptionPlanRepository',
960
+ useFactory: (options) => {
961
+ return new SubscriptionPlanFirestoreRepository(options);
962
+ },
963
+ inject: ['FirestoreOptions'],
964
+ },
965
+ {
966
+ provide: 'SubscriptionProductRepository',
967
+ useFactory: (options) => {
968
+ return new SubscriptionProductFirestoreRepository(options);
969
+ },
970
+ inject: ['FirestoreOptions'],
971
+ },
972
+ {
973
+ provide: 'SubscriptionRepository',
974
+ useFactory: (options) => {
975
+ return new SubscriptionFirestoreRepository(options);
976
+ },
977
+ inject: ['FirestoreOptions'],
978
+ },
979
+ {
980
+ provide: 'UserRepository',
981
+ useFactory: (options) => {
982
+ return new UserFirestoreRepository(options);
983
+ },
984
+ inject: ['FirestoreOptions'],
985
+ },
986
+ {
987
+ provide: 'UserAddressRepository',
988
+ useFactory: (options, userRepository) => {
989
+ return new UserAddressFirestoreRepository(options, userRepository);
990
+ },
991
+ inject: ['FirestoreOptions', 'UserRepository'],
992
+ },
993
+ {
994
+ provide: 'UserPaymentMethodRepository',
995
+ useFactory: (options, userRepository) => {
996
+ return new UserPaymentMethodFirestoreRepository(options, userRepository);
997
+ },
998
+ inject: ['FirestoreOptions', 'UserRepository'],
999
+ },
1000
+ {
1001
+ provide: 'SubscriptionMaterializationRepository',
1002
+ useFactory: (options) => {
1003
+ return new SubscriptionMaterializationFirestoreRepository(options);
1004
+ },
1005
+ inject: ['FirestoreOptions'],
1006
+ },
1007
+ {
1008
+ provide: 'SubscriptionSummaryRepository',
1009
+ useFactory: (options) => {
1010
+ return new SubscriptionSummaryFirestoreRepository(options);
1011
+ },
1012
+ inject: ['FirestoreOptions'],
1013
+ },
1014
+ {
1015
+ provide: ProductVariantFirestoreRepository,
1016
+ useFactory: (options, productRepository) => {
1017
+ return new ProductVariantFirestoreRepository(options, productRepository);
1018
+ },
1019
+ inject: ['FirestoreOptions', ProductFirestoreRepository],
1020
+ },
1021
+ {
1022
+ provide: 'OrderBlockedRepository',
1023
+ useFactory: (options) => {
1024
+ return new OrderBlockedFirestoreRepository(options);
1025
+ },
1026
+ inject: ['FirestoreOptions'],
1027
+ },
1028
+ {
1029
+ provide: 'LogRepository',
1030
+ useFactory: (options) => {
1031
+ return new LogFirestoreRepository(options);
1032
+ },
1033
+ inject: ['FirestoreOptions'],
1034
+ },
1035
+ {
1036
+ provide: 'SequenceRepository',
1037
+ useFactory: (options) => {
1038
+ return new SequenceFirestoreRepository(options);
1039
+ },
1040
+ inject: ['FirestoreOptions'],
1041
+ },
1042
+ ],
1043
+ exports: [
1044
+ 'BeautyProfileRepository',
1045
+ 'Buy2WinRepository',
1046
+ CategoryFirestoreRepository,
1047
+ 'CheckoutRepository',
1048
+ 'CheckoutSubscriptionRepository',
1049
+ 'CouponRepository',
1050
+ 'CampaignHashtagRepository',
1051
+ 'CampaignDashboardRepository',
1052
+ 'EditionRepository',
1053
+ 'GroupRepository',
1054
+ 'HomeRepository',
1055
+ 'LeadRepository',
1056
+ 'LegacyOrderRepository',
1057
+ 'ShopMenuRepository',
1058
+ 'OrderRepository',
1059
+ 'OrderBlockedRepository',
1060
+ 'PaymentRepository',
1061
+ 'SequenceRepository',
1062
+ 'LogRepository',
1063
+ ProductFirestoreRepository,
1064
+ 'ShopSettingsRepository',
1065
+ 'SubscriptionPaymentRepository',
1066
+ 'SubscriptionPlanRepository',
1067
+ 'SubscriptionProductRepository',
1068
+ 'SubscriptionRepository',
1069
+ 'UserRepository',
1070
+ 'UserAddressRepository',
1071
+ 'UserPaymentMethodRepository',
1072
+ 'SubscriptionMaterializationRepository',
1073
+ 'SubscriptionSummaryRepository',
1074
+ ProductVariantFirestoreRepository,
1075
+ ConnectFirestoreService,
1076
+ ],
1077
+ })
1078
1078
  ], NestFirestoreModule);
1079
1079
 
1080
- var NestHasuraGraphQLModule_1;
1081
- let NestHasuraGraphQLModule = NestHasuraGraphQLModule_1 = class NestHasuraGraphQLModule {
1082
- static initializeApp(options) {
1083
- return {
1084
- module: NestHasuraGraphQLModule_1,
1085
- providers: [{ provide: HASURA_OPTIONS, useValue: options }],
1086
- exports: [HASURA_OPTIONS],
1087
- };
1088
- }
1089
- };
1090
- NestHasuraGraphQLModule = NestHasuraGraphQLModule_1 = __decorate([
1091
- Module({
1092
- providers: [
1093
- {
1094
- provide: 'HasuraConfig',
1095
- useFactory: (options) => ({
1096
- endpoint: options.endpoint,
1097
- authOptions: options.credentials,
1098
- cache: options.cache,
1099
- }),
1100
- inject: [HASURA_OPTIONS],
1101
- },
1102
- {
1103
- provide: 'CategoryRepository',
1104
- useExisting: CategoryHasuraGraphQLRepository,
1105
- },
1106
- {
1107
- provide: CategoryHasuraGraphQLRepository,
1108
- useFactory: (options, productRepository, categoryFilterRepository) => {
1109
- return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
1110
- },
1111
- inject: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1112
- },
1113
- {
1114
- provide: 'ProductRepository',
1115
- useExisting: ProductHasuraGraphQLRepository,
1116
- },
1117
- {
1118
- provide: ProductHasuraGraphQLRepository,
1119
- useFactory: (hasuraConfig) => {
1120
- return new ProductHasuraGraphQLRepository(hasuraConfig);
1121
- },
1122
- inject: ['HasuraConfig'],
1123
- },
1124
- {
1125
- provide: 'ProductReviewRepository',
1126
- useExisting: ProductReviewHasuraGraphQLRepository,
1127
- },
1128
- {
1129
- provide: ProductReviewHasuraGraphQLRepository,
1130
- useFactory: (hasuraConfig) => {
1131
- return new ProductReviewHasuraGraphQLRepository(hasuraConfig);
1132
- },
1133
- inject: ['HasuraConfig'],
1134
- },
1135
- {
1136
- provide: 'VariantRepository',
1137
- useExisting: VariantHasuraGraphQLRepository,
1138
- },
1139
- {
1140
- provide: VariantHasuraGraphQLRepository,
1141
- useFactory: (hasuraConfig) => {
1142
- return new VariantHasuraGraphQLRepository(hasuraConfig);
1143
- },
1144
- inject: ['HasuraConfig'],
1145
- },
1146
- {
1147
- provide: 'ProductStockNotificationRepository',
1148
- useExisting: ProductStockNotificationHasuraGraphQLRepository,
1149
- },
1150
- {
1151
- provide: ProductStockNotificationHasuraGraphQLRepository,
1152
- useFactory: (hasuraConfig) => {
1153
- return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
1154
- },
1155
- inject: ['HasuraConfig'],
1156
- },
1157
- {
1158
- provide: 'CategoryFilterRepository',
1159
- useExisting: CategoryFilterHasuraGraphQLRepository,
1160
- },
1161
- {
1162
- provide: CategoryFilterHasuraGraphQLRepository,
1163
- useFactory: (options) => {
1164
- return new CategoryFilterHasuraGraphQLRepository(options);
1165
- },
1166
- inject: ['HasuraConfig'],
1167
- },
1168
- {
1169
- provide: 'FilterOptionRepository',
1170
- useExisting: FilterOptionHasuraGraphQLRepository,
1171
- },
1172
- {
1173
- provide: FilterOptionHasuraGraphQLRepository,
1174
- useFactory: (options) => {
1175
- return new FilterOptionHasuraGraphQLRepository(options);
1176
- },
1177
- inject: ['HasuraConfig'],
1178
- },
1179
- {
1180
- provide: 'FilterRepository',
1181
- useExisting: FilterHasuraGraphQLRepository,
1182
- },
1183
- {
1184
- provide: FilterHasuraGraphQLRepository,
1185
- useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
1186
- return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
1187
- },
1188
- inject: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1189
- },
1190
- {
1191
- provide: CategoryCollectionChildrenHasuraGraphQLRepository,
1192
- useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options),
1193
- inject: ['HasuraConfig'],
1194
- },
1195
- {
1196
- provide: 'CategoryCollectionChildrenRepository',
1197
- useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
1198
- },
1199
- {
1200
- provide: CategoryProductHasuraGraphQLRepository,
1201
- useFactory: (options) => {
1202
- return new CategoryProductHasuraGraphQLRepository(options);
1203
- },
1204
- inject: ['HasuraConfig'],
1205
- },
1206
- {
1207
- provide: 'CategoryProductRepository',
1208
- useExisting: CategoryProductHasuraGraphQLRepository,
1209
- },
1210
- {
1211
- provide: WishlistHasuraGraphQLRepository,
1212
- useFactory: (options, categoryProductRepository) => {
1213
- return new WishlistHasuraGraphQLRepository(options, categoryProductRepository);
1214
- },
1215
- inject: ['HasuraConfig', CategoryProductHasuraGraphQLRepository],
1216
- },
1217
- {
1218
- provide: 'WishlistRepository',
1219
- useExisting: WishlistHasuraGraphQLRepository,
1220
- },
1221
- {
1222
- provide: ProductErrorsHasuraGraphQLRepository,
1223
- useFactory: (options, productRepository) => {
1224
- return new ProductErrorsHasuraGraphQLRepository(options, productRepository);
1225
- },
1226
- inject: ['HasuraConfig', ProductHasuraGraphQLRepository],
1227
- },
1228
- {
1229
- provide: 'ProductErrorsRepository',
1230
- useExisting: ProductErrorsHasuraGraphQLRepository,
1231
- },
1232
- ],
1233
- exports: [
1234
- 'CategoryRepository',
1235
- CategoryHasuraGraphQLRepository,
1236
- 'ProductRepository',
1237
- ProductHasuraGraphQLRepository,
1238
- 'ProductReviewRepository',
1239
- ProductReviewHasuraGraphQLRepository,
1240
- 'VariantRepository',
1241
- VariantHasuraGraphQLRepository,
1242
- 'ProductStockNotificationRepository',
1243
- ProductStockNotificationHasuraGraphQLRepository,
1244
- 'CategoryFilterRepository',
1245
- CategoryFilterHasuraGraphQLRepository,
1246
- 'FilterOptionRepository',
1247
- FilterOptionHasuraGraphQLRepository,
1248
- 'FilterRepository',
1249
- FilterHasuraGraphQLRepository,
1250
- 'CategoryCollectionChildrenRepository',
1251
- CategoryCollectionChildrenHasuraGraphQLRepository,
1252
- 'WishlistRepository',
1253
- WishlistHasuraGraphQLRepository,
1254
- 'CategoryProductRepository',
1255
- CategoryProductHasuraGraphQLRepository,
1256
- 'ProductErrorsRepository',
1257
- ProductErrorsHasuraGraphQLRepository,
1258
- ],
1259
- })
1080
+ var NestHasuraGraphQLModule_1;
1081
+ let NestHasuraGraphQLModule = NestHasuraGraphQLModule_1 = class NestHasuraGraphQLModule {
1082
+ static initializeApp(options) {
1083
+ return {
1084
+ module: NestHasuraGraphQLModule_1,
1085
+ providers: [{ provide: HASURA_OPTIONS, useValue: options }],
1086
+ exports: [HASURA_OPTIONS],
1087
+ };
1088
+ }
1089
+ };
1090
+ NestHasuraGraphQLModule = NestHasuraGraphQLModule_1 = __decorate([
1091
+ Module({
1092
+ providers: [
1093
+ {
1094
+ provide: 'HasuraConfig',
1095
+ useFactory: (options) => ({
1096
+ endpoint: options.endpoint,
1097
+ authOptions: options.credentials,
1098
+ cache: options.cache,
1099
+ }),
1100
+ inject: [HASURA_OPTIONS],
1101
+ },
1102
+ {
1103
+ provide: 'CategoryRepository',
1104
+ useExisting: CategoryHasuraGraphQLRepository,
1105
+ },
1106
+ {
1107
+ provide: CategoryHasuraGraphQLRepository,
1108
+ useFactory: (options, productRepository, categoryFilterRepository) => {
1109
+ return new CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
1110
+ },
1111
+ inject: ['HasuraConfig', ProductHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1112
+ },
1113
+ {
1114
+ provide: 'ProductRepository',
1115
+ useExisting: ProductHasuraGraphQLRepository,
1116
+ },
1117
+ {
1118
+ provide: ProductHasuraGraphQLRepository,
1119
+ useFactory: (hasuraConfig) => {
1120
+ return new ProductHasuraGraphQLRepository(hasuraConfig);
1121
+ },
1122
+ inject: ['HasuraConfig'],
1123
+ },
1124
+ {
1125
+ provide: 'ProductReviewRepository',
1126
+ useExisting: ProductReviewHasuraGraphQLRepository,
1127
+ },
1128
+ {
1129
+ provide: ProductReviewHasuraGraphQLRepository,
1130
+ useFactory: (hasuraConfig) => {
1131
+ return new ProductReviewHasuraGraphQLRepository(hasuraConfig);
1132
+ },
1133
+ inject: ['HasuraConfig'],
1134
+ },
1135
+ {
1136
+ provide: 'VariantRepository',
1137
+ useExisting: VariantHasuraGraphQLRepository,
1138
+ },
1139
+ {
1140
+ provide: VariantHasuraGraphQLRepository,
1141
+ useFactory: (hasuraConfig) => {
1142
+ return new VariantHasuraGraphQLRepository(hasuraConfig);
1143
+ },
1144
+ inject: ['HasuraConfig'],
1145
+ },
1146
+ {
1147
+ provide: 'ProductStockNotificationRepository',
1148
+ useExisting: ProductStockNotificationHasuraGraphQLRepository,
1149
+ },
1150
+ {
1151
+ provide: ProductStockNotificationHasuraGraphQLRepository,
1152
+ useFactory: (hasuraConfig) => {
1153
+ return new ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
1154
+ },
1155
+ inject: ['HasuraConfig'],
1156
+ },
1157
+ {
1158
+ provide: 'CategoryFilterRepository',
1159
+ useExisting: CategoryFilterHasuraGraphQLRepository,
1160
+ },
1161
+ {
1162
+ provide: CategoryFilterHasuraGraphQLRepository,
1163
+ useFactory: (options) => {
1164
+ return new CategoryFilterHasuraGraphQLRepository(options);
1165
+ },
1166
+ inject: ['HasuraConfig'],
1167
+ },
1168
+ {
1169
+ provide: 'FilterOptionRepository',
1170
+ useExisting: FilterOptionHasuraGraphQLRepository,
1171
+ },
1172
+ {
1173
+ provide: FilterOptionHasuraGraphQLRepository,
1174
+ useFactory: (options) => {
1175
+ return new FilterOptionHasuraGraphQLRepository(options);
1176
+ },
1177
+ inject: ['HasuraConfig'],
1178
+ },
1179
+ {
1180
+ provide: 'FilterRepository',
1181
+ useExisting: FilterHasuraGraphQLRepository,
1182
+ },
1183
+ {
1184
+ provide: FilterHasuraGraphQLRepository,
1185
+ useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
1186
+ return new FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
1187
+ },
1188
+ inject: ['HasuraConfig', FilterOptionHasuraGraphQLRepository, CategoryFilterHasuraGraphQLRepository],
1189
+ },
1190
+ {
1191
+ provide: CategoryCollectionChildrenHasuraGraphQLRepository,
1192
+ useFactory: (options) => new CategoryCollectionChildrenHasuraGraphQLRepository(options),
1193
+ inject: ['HasuraConfig'],
1194
+ },
1195
+ {
1196
+ provide: 'CategoryCollectionChildrenRepository',
1197
+ useExisting: CategoryCollectionChildrenHasuraGraphQLRepository,
1198
+ },
1199
+ {
1200
+ provide: CategoryProductHasuraGraphQLRepository,
1201
+ useFactory: (options) => {
1202
+ return new CategoryProductHasuraGraphQLRepository(options);
1203
+ },
1204
+ inject: ['HasuraConfig'],
1205
+ },
1206
+ {
1207
+ provide: 'CategoryProductRepository',
1208
+ useExisting: CategoryProductHasuraGraphQLRepository,
1209
+ },
1210
+ {
1211
+ provide: WishlistHasuraGraphQLRepository,
1212
+ useFactory: (options, categoryProductRepository) => {
1213
+ return new WishlistHasuraGraphQLRepository(options, categoryProductRepository);
1214
+ },
1215
+ inject: ['HasuraConfig', CategoryProductHasuraGraphQLRepository],
1216
+ },
1217
+ {
1218
+ provide: 'WishlistRepository',
1219
+ useExisting: WishlistHasuraGraphQLRepository,
1220
+ },
1221
+ {
1222
+ provide: ProductErrorsHasuraGraphQLRepository,
1223
+ useFactory: (options, productRepository) => {
1224
+ return new ProductErrorsHasuraGraphQLRepository(options, productRepository);
1225
+ },
1226
+ inject: ['HasuraConfig', ProductHasuraGraphQLRepository],
1227
+ },
1228
+ {
1229
+ provide: 'ProductErrorsRepository',
1230
+ useExisting: ProductErrorsHasuraGraphQLRepository,
1231
+ },
1232
+ ],
1233
+ exports: [
1234
+ 'CategoryRepository',
1235
+ CategoryHasuraGraphQLRepository,
1236
+ 'ProductRepository',
1237
+ ProductHasuraGraphQLRepository,
1238
+ 'ProductReviewRepository',
1239
+ ProductReviewHasuraGraphQLRepository,
1240
+ 'VariantRepository',
1241
+ VariantHasuraGraphQLRepository,
1242
+ 'ProductStockNotificationRepository',
1243
+ ProductStockNotificationHasuraGraphQLRepository,
1244
+ 'CategoryFilterRepository',
1245
+ CategoryFilterHasuraGraphQLRepository,
1246
+ 'FilterOptionRepository',
1247
+ FilterOptionHasuraGraphQLRepository,
1248
+ 'FilterRepository',
1249
+ FilterHasuraGraphQLRepository,
1250
+ 'CategoryCollectionChildrenRepository',
1251
+ CategoryCollectionChildrenHasuraGraphQLRepository,
1252
+ 'WishlistRepository',
1253
+ WishlistHasuraGraphQLRepository,
1254
+ 'CategoryProductRepository',
1255
+ CategoryProductHasuraGraphQLRepository,
1256
+ 'ProductErrorsRepository',
1257
+ ProductErrorsHasuraGraphQLRepository,
1258
+ ],
1259
+ })
1260
1260
  ], NestHasuraGraphQLModule);
1261
1261
 
1262
- var NestVertexSeachModule_1;
1263
- let NestVertexSeachModule = NestVertexSeachModule_1 = class NestVertexSeachModule {
1264
- static initializeApp(options) {
1265
- return {
1266
- module: NestVertexSeachModule_1,
1267
- providers: [{ provide: VERTEX_CONFIG, useValue: options }],
1268
- exports: [VERTEX_CONFIG],
1269
- };
1270
- }
1271
- };
1272
- NestVertexSeachModule = NestVertexSeachModule_1 = __decorate([
1273
- Module({
1274
- providers: [
1275
- DiscoveryEngineVertexAdapter,
1276
- {
1277
- provide: ProductsVertexSearch,
1278
- useFactory: (adapter) => new ProductsVertexSearch(adapter),
1279
- inject: [DiscoveryEngineVertexAdapter],
1280
- },
1281
- ],
1282
- exports: [ProductsVertexSearch],
1283
- })
1262
+ var NestVertexSeachModule_1;
1263
+ let NestVertexSeachModule = NestVertexSeachModule_1 = class NestVertexSeachModule {
1264
+ static initializeApp(options) {
1265
+ return {
1266
+ module: NestVertexSeachModule_1,
1267
+ providers: [{ provide: VERTEX_CONFIG, useValue: options }],
1268
+ exports: [VERTEX_CONFIG],
1269
+ };
1270
+ }
1271
+ };
1272
+ NestVertexSeachModule = NestVertexSeachModule_1 = __decorate([
1273
+ Module({
1274
+ providers: [
1275
+ DiscoveryEngineVertexAdapter,
1276
+ {
1277
+ provide: ProductsVertexSearch,
1278
+ useFactory: (adapter) => new ProductsVertexSearch(adapter),
1279
+ inject: [DiscoveryEngineVertexAdapter],
1280
+ },
1281
+ ],
1282
+ exports: [ProductsVertexSearch],
1283
+ })
1284
1284
  ], NestVertexSeachModule);
1285
1285
 
1286
- var NestConnectModule_1;
1287
- let NestConnectModule = NestConnectModule_1 = class NestConnectModule {
1288
- static initializeApp(options) {
1289
- return {
1290
- module: NestConnectModule_1,
1291
- imports: [
1292
- ...(options.firebase ? [NestFirestoreModule.initializeApp({ firebase: options.firebase })] : []),
1293
- ...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [NestHasuraGraphQLModule.initializeApp(options.hasura)]),
1294
- ...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [NestElasticSeachModule.initializeApp(options.elasticSearch)]),
1295
- ...(isNil(options === null || options === void 0 ? void 0 : options.vertex) ? [] : [NestVertexSeachModule.initializeApp(options.vertex)]),
1296
- ],
1297
- exports: [
1298
- ...(options.firebase ? [NestFirestoreModule] : []),
1299
- ...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [NestHasuraGraphQLModule]),
1300
- ...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [NestElasticSeachModule]),
1301
- ...(isNil(options === null || options === void 0 ? void 0 : options.vertex) ? [] : [NestVertexSeachModule]),
1302
- ],
1303
- };
1304
- }
1305
- };
1306
- NestConnectModule = NestConnectModule_1 = __decorate([
1307
- Module({})
1286
+ var NestConnectModule_1;
1287
+ let NestConnectModule = NestConnectModule_1 = class NestConnectModule {
1288
+ static initializeApp(options) {
1289
+ return {
1290
+ module: NestConnectModule_1,
1291
+ imports: [
1292
+ ...(options.firebase ? [NestFirestoreModule.initializeApp({ firebase: options.firebase })] : []),
1293
+ ...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [NestHasuraGraphQLModule.initializeApp(options.hasura)]),
1294
+ ...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [NestElasticSeachModule.initializeApp(options.elasticSearch)]),
1295
+ ...(isNil(options === null || options === void 0 ? void 0 : options.vertex) ? [] : [NestVertexSeachModule.initializeApp(options.vertex)]),
1296
+ ],
1297
+ exports: [
1298
+ ...(options.firebase ? [NestFirestoreModule] : []),
1299
+ ...(isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [NestHasuraGraphQLModule]),
1300
+ ...(isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [NestElasticSeachModule]),
1301
+ ...(isNil(options === null || options === void 0 ? void 0 : options.vertex) ? [] : [NestVertexSeachModule]),
1302
+ ],
1303
+ };
1304
+ }
1305
+ };
1306
+ NestConnectModule = NestConnectModule_1 = __decorate([
1307
+ Module({})
1308
1308
  ], NestConnectModule);
1309
1309
 
1310
1310
  export { ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, DiscoveryEngineVertexAdapter, ES_CONFIG, FIREBASE_STORAGE, HASURA_OPTIONS, NativeElasticSearchAdapter, NestConnectModule, NestElasticSeachModule, NestFirestoreModule, NestHasuraGraphQLModule, NestStorageModule, PagarmeBankSlipAPIAdapter, PagarmeCardAPIAdapter, PagarmePixAPIAdapter, ProductVertexHelper, VERTEX_CONFIG };