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