@infrab4a/connect-nestjs 2.9.0-alpha.1 → 2.9.0-alpha.2
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 +1321 -1317
- package/index.esm.js +1316 -1318
- package/package.json +5 -8
- 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 -9
- 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.d.ts → index.cjs.d.ts} +0 -0
package/index.cjs.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
3
5
|
var elasticsearch = require('@elastic/elasticsearch');
|
|
4
6
|
var connect = require('@infrab4a/connect');
|
|
5
7
|
var common = require('@nestjs/common');
|
|
@@ -9,6 +11,10 @@ var discoveryengine = require('@google-cloud/discoveryengine');
|
|
|
9
11
|
var v1beta = require('@google-cloud/discoveryengine/build/src/v1beta');
|
|
10
12
|
var nestjsFirebase = require('nestjs-firebase');
|
|
11
13
|
|
|
14
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var pagarme__default = /*#__PURE__*/_interopDefaultLegacy(pagarme);
|
|
17
|
+
|
|
12
18
|
const ES_CONFIG = 'ES_CONFIG';
|
|
13
19
|
|
|
14
20
|
const HASURA_OPTIONS = 'HASURA_OPTIONS';
|
|
@@ -31,8 +37,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
31
37
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
32
38
|
PERFORMANCE OF THIS SOFTWARE.
|
|
33
39
|
***************************************************************************** */
|
|
34
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
35
|
-
|
|
36
40
|
|
|
37
41
|
function __decorate(decorators, target, key, desc) {
|
|
38
42
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -54,1351 +58,1351 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
54
58
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
55
59
|
};
|
|
56
60
|
|
|
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])
|
|
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])
|
|
156
160
|
], exports.NativeElasticSearchAdapter);
|
|
157
161
|
|
|
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
|
-
}
|
|
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
|
+
}
|
|
172
176
|
}
|
|
173
177
|
|
|
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
|
-
}
|
|
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
|
+
}
|
|
208
212
|
}
|
|
209
213
|
|
|
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
|
-
}
|
|
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
|
+
}
|
|
281
285
|
}
|
|
282
286
|
|
|
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])
|
|
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])
|
|
297
301
|
], exports.ConnectFirestoreService);
|
|
298
302
|
|
|
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
|
|
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
|
|
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
|
-
}
|
|
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 pagarme__default["default"].client.connect({ api_key: this.credentials.API_KEY });
|
|
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 pagarme__default["default"].client.connect({ api_key: this.credentials.API_KEY });
|
|
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
|
+
}
|
|
374
378
|
}
|
|
375
379
|
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
}
|
|
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 pagarme__default["default"].client.connect({ api_key: this.credentials.API_KEY });
|
|
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 pagarme__default["default"].client.connect({ api_key: this.credentials.API_KEY });
|
|
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 pagarme__default["default"].client.connect({ api_key: this.credentials.API_KEY });
|
|
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 pagarme__default["default"].client.connect({ api_key: this.credentials.API_KEY });
|
|
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
|
+
}
|
|
549
553
|
}
|
|
550
554
|
|
|
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
|
|
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
|
-
}
|
|
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 pagarme__default["default"].client.connect({ api_key: this.credentials.API_KEY });
|
|
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
|
+
}
|
|
606
610
|
}
|
|
607
611
|
|
|
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
|
-
}
|
|
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
|
+
}
|
|
654
658
|
}
|
|
655
659
|
|
|
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])
|
|
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
|
+
this.documentClient = new discoveryengine.DocumentServiceClient({
|
|
673
|
+
apiEndpoint: configuration.apiEndpoint,
|
|
674
|
+
});
|
|
675
|
+
this.servingConfig = this.searchClient.projectLocationCollectionDataStoreServingConfigPath(configuration.projectId, configuration.location, configuration.collectionId, configuration.dataStoreId, configuration.servingConfigId);
|
|
676
|
+
}
|
|
677
|
+
async save(product) {
|
|
678
|
+
const productSearch = ProductVertexHelper.productMapper(product);
|
|
679
|
+
const request = {
|
|
680
|
+
parent: this.parentEngine,
|
|
681
|
+
allowMissing: true,
|
|
682
|
+
document: {
|
|
683
|
+
name: this.parentDataStore + `/${product.id}`,
|
|
684
|
+
jsonData: JSON.stringify(productSearch),
|
|
685
|
+
data: 'jsonData',
|
|
686
|
+
},
|
|
687
|
+
};
|
|
688
|
+
const response = await this.documentClient.updateDocument(request);
|
|
689
|
+
return response;
|
|
690
|
+
}
|
|
691
|
+
async update(id, data) {
|
|
692
|
+
const productSearch = ProductVertexHelper.productMapper(data);
|
|
693
|
+
const request = {
|
|
694
|
+
parent: this.parentEngine,
|
|
695
|
+
allowMissing: true,
|
|
696
|
+
document: {
|
|
697
|
+
name: this.parentDataStore + `/${id}`,
|
|
698
|
+
jsonData: JSON.stringify(productSearch),
|
|
699
|
+
data: 'jsonData',
|
|
700
|
+
},
|
|
701
|
+
};
|
|
702
|
+
const response = await this.documentClient.updateDocument(request);
|
|
703
|
+
return response;
|
|
704
|
+
}
|
|
705
|
+
async query(term, total) {
|
|
706
|
+
const response = (await this.searchClient.search({
|
|
707
|
+
pageSize: total,
|
|
708
|
+
query: term,
|
|
709
|
+
filter: '',
|
|
710
|
+
languageCode: 'pt-BR',
|
|
711
|
+
servingConfig: this.servingConfig,
|
|
712
|
+
relevanceThreshold: 'MEDIUM',
|
|
713
|
+
}, {
|
|
714
|
+
autoPaginate: false,
|
|
715
|
+
}));
|
|
716
|
+
return ProductVertexHelper.resultProductMapper(response);
|
|
717
|
+
}
|
|
718
|
+
async get(id) {
|
|
719
|
+
const request = {
|
|
720
|
+
name: this.parentDataStore + `/${id}`,
|
|
721
|
+
};
|
|
722
|
+
const response = await this.documentClient.getDocument(request);
|
|
723
|
+
const document = JSON.parse(response[0].jsonData);
|
|
724
|
+
return document;
|
|
725
|
+
}
|
|
726
|
+
async delete(id) {
|
|
727
|
+
const request = {
|
|
728
|
+
name: this.parentDataStore + `/${id}`,
|
|
729
|
+
};
|
|
730
|
+
await this.documentClient.deleteDocument(request);
|
|
731
|
+
}
|
|
732
|
+
async bulkProducts(products) {
|
|
733
|
+
try {
|
|
734
|
+
const batchSize = 100;
|
|
735
|
+
let total = 0;
|
|
736
|
+
for (let index = 0; index < products.length; index += batchSize) {
|
|
737
|
+
const bulkProducts = products.slice(index, index + batchSize);
|
|
738
|
+
const [operation] = await this.documentClient.importDocuments({
|
|
739
|
+
parent: `projects/${this.config.projectId}/locations/${this.config.location}/` +
|
|
740
|
+
`collections/default_collection/dataStores/${this.config.dataStoreId}/branches/default_branch`,
|
|
741
|
+
inlineSource: {
|
|
742
|
+
documents: bulkProducts,
|
|
743
|
+
},
|
|
744
|
+
});
|
|
745
|
+
total += bulkProducts.length;
|
|
746
|
+
const [response] = await operation.promise();
|
|
747
|
+
console.warn(`Imported: ${total} documents`, ((total / products.length) * 100).toFixed(2) + '%', 'Erros: ', response.errorSamples ? response.errorSamples : []);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
catch (error) {
|
|
751
|
+
console.error(error);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
exports.DiscoveryEngineVertexAdapter = __decorate([
|
|
756
|
+
common.Injectable(),
|
|
757
|
+
__param(0, common.Inject(VERTEX_CONFIG)),
|
|
758
|
+
__metadata("design:paramtypes", [Object])
|
|
755
759
|
], exports.DiscoveryEngineVertexAdapter);
|
|
756
760
|
|
|
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
|
-
})
|
|
761
|
+
var NestElasticSeachModule_1;
|
|
762
|
+
exports.NestElasticSeachModule = NestElasticSeachModule_1 = class NestElasticSeachModule {
|
|
763
|
+
static initializeApp(options) {
|
|
764
|
+
return {
|
|
765
|
+
module: NestElasticSeachModule_1,
|
|
766
|
+
providers: [{ provide: ES_CONFIG, useValue: options }],
|
|
767
|
+
exports: [ES_CONFIG],
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
exports.NestElasticSeachModule = NestElasticSeachModule_1 = __decorate([
|
|
772
|
+
common.Module({
|
|
773
|
+
providers: [
|
|
774
|
+
exports.NativeElasticSearchAdapter,
|
|
775
|
+
{
|
|
776
|
+
provide: connect.ProductsIndex,
|
|
777
|
+
useFactory: (adapter) => new connect.ProductsIndex(adapter),
|
|
778
|
+
inject: [exports.NativeElasticSearchAdapter],
|
|
779
|
+
},
|
|
780
|
+
],
|
|
781
|
+
exports: [connect.ProductsIndex],
|
|
782
|
+
})
|
|
779
783
|
], exports.NestElasticSeachModule);
|
|
780
784
|
|
|
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
|
-
})
|
|
785
|
+
exports.NestStorageModule = class NestStorageModule {
|
|
786
|
+
};
|
|
787
|
+
exports.NestStorageModule = __decorate([
|
|
788
|
+
common.Module({
|
|
789
|
+
providers: [
|
|
790
|
+
{
|
|
791
|
+
provide: FIREBASE_STORAGE,
|
|
792
|
+
useFactory: (firebaseAdmin) => firebaseAdmin.storage,
|
|
793
|
+
inject: [nestjsFirebase.FirebaseConstants.FIREBASE_TOKEN],
|
|
794
|
+
},
|
|
795
|
+
],
|
|
796
|
+
exports: [FIREBASE_STORAGE],
|
|
797
|
+
})
|
|
794
798
|
], exports.NestStorageModule);
|
|
795
799
|
|
|
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
|
-
})
|
|
800
|
+
var NestFirestoreModule_1;
|
|
801
|
+
exports.NestFirestoreModule = NestFirestoreModule_1 = class NestFirestoreModule {
|
|
802
|
+
static initializeApp(options) {
|
|
803
|
+
var _a;
|
|
804
|
+
return {
|
|
805
|
+
module: NestFirestoreModule_1,
|
|
806
|
+
imports: [
|
|
807
|
+
nestjsFirebase.FirebaseModule.forRoot({
|
|
808
|
+
googleApplicationCredential: (_a = options === null || options === void 0 ? void 0 : options.firebase) === null || _a === void 0 ? void 0 : _a.googleApplicationCredential,
|
|
809
|
+
}),
|
|
810
|
+
exports.NestStorageModule,
|
|
811
|
+
],
|
|
812
|
+
exports: [nestjsFirebase.FirebaseModule, exports.NestStorageModule],
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
exports.NestFirestoreModule = NestFirestoreModule_1 = __decorate([
|
|
817
|
+
common.Module({
|
|
818
|
+
providers: [
|
|
819
|
+
{
|
|
820
|
+
provide: exports.ConnectFirestoreService,
|
|
821
|
+
useFactory: (firebaseAdmin) => new exports.ConnectFirestoreService(firebaseAdmin.firestore),
|
|
822
|
+
inject: [nestjsFirebase.FirebaseConstants.FIREBASE_TOKEN],
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
provide: 'FirestoreOptions',
|
|
826
|
+
useFactory: (connectFirestoreService) => ({
|
|
827
|
+
firestore: connectFirestoreService,
|
|
828
|
+
}),
|
|
829
|
+
inject: [exports.ConnectFirestoreService],
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
provide: 'BeautyProfileRepository',
|
|
833
|
+
useFactory: (config, userRepository) => {
|
|
834
|
+
return new connect.UserBeautyProfileFirestoreRepository(config, userRepository);
|
|
835
|
+
},
|
|
836
|
+
inject: ['FirestoreOptions', 'UserRepository'],
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
provide: 'Buy2WinRepository',
|
|
840
|
+
useFactory: (options) => {
|
|
841
|
+
return new connect.Buy2WinFirestoreRepository(options);
|
|
842
|
+
},
|
|
843
|
+
inject: ['FirestoreOptions'],
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
provide: connect.CategoryFirestoreRepository,
|
|
847
|
+
useFactory: (options) => {
|
|
848
|
+
return new connect.CategoryFirestoreRepository(options);
|
|
849
|
+
},
|
|
850
|
+
inject: ['FirestoreOptions'],
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
provide: 'CheckoutRepository',
|
|
854
|
+
useFactory: (options) => {
|
|
855
|
+
return new connect.CheckoutFirestoreRepository(options);
|
|
856
|
+
},
|
|
857
|
+
inject: ['FirestoreOptions'],
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
provide: 'CheckoutSubscriptionRepository',
|
|
861
|
+
useFactory: (options) => {
|
|
862
|
+
return new connect.CheckoutSubscriptionFirestoreRepository(options);
|
|
863
|
+
},
|
|
864
|
+
inject: ['FirestoreOptions'],
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
provide: 'CouponRepository',
|
|
868
|
+
useFactory: (options) => {
|
|
869
|
+
return new connect.CouponFirestoreRepository(options);
|
|
870
|
+
},
|
|
871
|
+
inject: ['FirestoreOptions'],
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
provide: 'CampaignHashtagRepository',
|
|
875
|
+
useFactory: (options) => {
|
|
876
|
+
return new connect.CampaignHashtagFirestoreRepository(options);
|
|
877
|
+
},
|
|
878
|
+
inject: ['FirestoreOptions'],
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
provide: 'CampaignDashboardRepository',
|
|
882
|
+
useFactory: (options) => {
|
|
883
|
+
return new connect.CampaignDashboardFirestoreRepository(options);
|
|
884
|
+
},
|
|
885
|
+
inject: ['FirestoreOptions'],
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
provide: 'EditionRepository',
|
|
889
|
+
useFactory: (options, subscriptionRepository) => {
|
|
890
|
+
return new connect.SubscriptionEditionFirestoreRepository(options, subscriptionRepository);
|
|
891
|
+
},
|
|
892
|
+
inject: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
provide: 'GroupRepository',
|
|
896
|
+
useFactory: (options) => {
|
|
897
|
+
return new connect.GroupFirestoreRepository(options);
|
|
898
|
+
},
|
|
899
|
+
inject: ['FirestoreOptions'],
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
provide: 'HomeRepository',
|
|
903
|
+
useFactory: (options) => {
|
|
904
|
+
return new connect.HomeFirestoreRepository(options);
|
|
905
|
+
},
|
|
906
|
+
inject: ['FirestoreOptions'],
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
provide: 'LeadRepository',
|
|
910
|
+
useFactory: (options) => {
|
|
911
|
+
return new connect.LeadFirestoreRepository(options);
|
|
912
|
+
},
|
|
913
|
+
inject: ['FirestoreOptions'],
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
provide: 'LegacyOrderRepository',
|
|
917
|
+
useFactory: (options) => {
|
|
918
|
+
return new connect.LegacyOrderFirestoreRepository(options);
|
|
919
|
+
},
|
|
920
|
+
inject: ['FirestoreOptions'],
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
provide: 'ShopMenuRepository',
|
|
924
|
+
useFactory: (options) => {
|
|
925
|
+
return new connect.ShopMenuFirestoreRepository(options);
|
|
926
|
+
},
|
|
927
|
+
inject: ['FirestoreOptions'],
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
provide: 'OrderRepository',
|
|
931
|
+
useFactory: (options) => {
|
|
932
|
+
return new connect.OrderFirestoreRepository(options);
|
|
933
|
+
},
|
|
934
|
+
inject: ['FirestoreOptions'],
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
provide: 'PaymentRepository',
|
|
938
|
+
useFactory: (options) => {
|
|
939
|
+
return new connect.PaymentFirestoreRepository(options);
|
|
940
|
+
},
|
|
941
|
+
inject: ['FirestoreOptions'],
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
provide: 'ShoppingRecurrenceRepository',
|
|
945
|
+
useFactory: (options) => {
|
|
946
|
+
return new connect.ShoppingRecurrenceFirestoreRepository(options);
|
|
947
|
+
},
|
|
948
|
+
inject: ['FirestoreOptions'],
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
provide: 'ShoppingRecurrenceEditionRepository',
|
|
952
|
+
useFactory: (options) => {
|
|
953
|
+
return new connect.ShoppingRecurrenceEditionFirestoreRepository(options);
|
|
954
|
+
},
|
|
955
|
+
inject: ['FirestoreOptions'],
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
provide: 'ShoppingRecurrenceErrorLogRepository',
|
|
959
|
+
useFactory: (options) => {
|
|
960
|
+
return new connect.ShoppingRecurrenceErrorLogFirestoreRepository(options);
|
|
961
|
+
},
|
|
962
|
+
inject: ['FirestoreOptions'],
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
provide: connect.ProductFirestoreRepository,
|
|
966
|
+
useFactory: (options) => {
|
|
967
|
+
return new connect.ProductFirestoreRepository(options);
|
|
968
|
+
},
|
|
969
|
+
inject: ['FirestoreOptions'],
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
provide: 'ShopSettingsRepository',
|
|
973
|
+
useFactory: (options) => {
|
|
974
|
+
return new connect.ShopSettingsFirestoreRepository(options);
|
|
975
|
+
},
|
|
976
|
+
inject: ['FirestoreOptions'],
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
provide: 'SubscriptionPaymentRepository',
|
|
980
|
+
useFactory: (options, subscriptionRepository) => {
|
|
981
|
+
return new connect.SubscriptionPaymentFirestoreRepository(options, subscriptionRepository);
|
|
982
|
+
},
|
|
983
|
+
inject: ['FirestoreOptions', 'SubscriptionRepository'],
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
provide: 'SubscriptionPlanRepository',
|
|
987
|
+
useFactory: (options) => {
|
|
988
|
+
return new connect.SubscriptionPlanFirestoreRepository(options);
|
|
989
|
+
},
|
|
990
|
+
inject: ['FirestoreOptions'],
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
provide: 'SubscriptionProductRepository',
|
|
994
|
+
useFactory: (options) => {
|
|
995
|
+
return new connect.SubscriptionProductFirestoreRepository(options);
|
|
996
|
+
},
|
|
997
|
+
inject: ['FirestoreOptions'],
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
provide: 'SubscriptionRepository',
|
|
1001
|
+
useFactory: (options) => {
|
|
1002
|
+
return new connect.SubscriptionFirestoreRepository(options);
|
|
1003
|
+
},
|
|
1004
|
+
inject: ['FirestoreOptions'],
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
provide: 'UserRepository',
|
|
1008
|
+
useFactory: (options) => {
|
|
1009
|
+
return new connect.UserFirestoreRepository(options);
|
|
1010
|
+
},
|
|
1011
|
+
inject: ['FirestoreOptions'],
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
provide: 'UserAddressRepository',
|
|
1015
|
+
useFactory: (options, userRepository) => {
|
|
1016
|
+
return new connect.UserAddressFirestoreRepository(options, userRepository);
|
|
1017
|
+
},
|
|
1018
|
+
inject: ['FirestoreOptions', 'UserRepository'],
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
provide: 'UserPaymentMethodRepository',
|
|
1022
|
+
useFactory: (options, userRepository) => {
|
|
1023
|
+
return new connect.UserPaymentMethodFirestoreRepository(options, userRepository);
|
|
1024
|
+
},
|
|
1025
|
+
inject: ['FirestoreOptions', 'UserRepository'],
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
provide: 'SubscriptionMaterializationRepository',
|
|
1029
|
+
useFactory: (options) => {
|
|
1030
|
+
return new connect.SubscriptionMaterializationFirestoreRepository(options);
|
|
1031
|
+
},
|
|
1032
|
+
inject: ['FirestoreOptions'],
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
provide: 'SubscriptionSummaryRepository',
|
|
1036
|
+
useFactory: (options) => {
|
|
1037
|
+
return new connect.SubscriptionSummaryFirestoreRepository(options);
|
|
1038
|
+
},
|
|
1039
|
+
inject: ['FirestoreOptions'],
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
provide: connect.ProductVariantFirestoreRepository,
|
|
1043
|
+
useFactory: (options, productRepository) => {
|
|
1044
|
+
return new connect.ProductVariantFirestoreRepository(options, productRepository);
|
|
1045
|
+
},
|
|
1046
|
+
inject: ['FirestoreOptions', connect.ProductFirestoreRepository],
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
provide: 'OrderBlockedRepository',
|
|
1050
|
+
useFactory: (options) => {
|
|
1051
|
+
return new connect.OrderBlockedFirestoreRepository(options);
|
|
1052
|
+
},
|
|
1053
|
+
inject: ['FirestoreOptions'],
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
provide: 'LogRepository',
|
|
1057
|
+
useFactory: (options) => {
|
|
1058
|
+
return new connect.LogFirestoreRepository(options);
|
|
1059
|
+
},
|
|
1060
|
+
inject: ['FirestoreOptions'],
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
provide: 'SequenceRepository',
|
|
1064
|
+
useFactory: (options) => {
|
|
1065
|
+
return new connect.SequenceFirestoreRepository(options);
|
|
1066
|
+
},
|
|
1067
|
+
inject: ['FirestoreOptions'],
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
provide: 'BrandCategoryRepository',
|
|
1071
|
+
useFactory: (options) => {
|
|
1072
|
+
return new connect.BrandCategoryFirestoreRepository(options);
|
|
1073
|
+
},
|
|
1074
|
+
inject: ['FirestoreOptions'],
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
provide: 'ShopConfigsRepository',
|
|
1078
|
+
useFactory: (options) => {
|
|
1079
|
+
return new connect.ShopConfigsFirestoreRepository(options);
|
|
1080
|
+
},
|
|
1081
|
+
inject: ['FirestoreOptions'],
|
|
1082
|
+
},
|
|
1083
|
+
],
|
|
1084
|
+
exports: [
|
|
1085
|
+
'BeautyProfileRepository',
|
|
1086
|
+
'Buy2WinRepository',
|
|
1087
|
+
connect.CategoryFirestoreRepository,
|
|
1088
|
+
'CheckoutRepository',
|
|
1089
|
+
'CheckoutSubscriptionRepository',
|
|
1090
|
+
'CouponRepository',
|
|
1091
|
+
'CampaignHashtagRepository',
|
|
1092
|
+
'CampaignDashboardRepository',
|
|
1093
|
+
'EditionRepository',
|
|
1094
|
+
'GroupRepository',
|
|
1095
|
+
'HomeRepository',
|
|
1096
|
+
'LeadRepository',
|
|
1097
|
+
'LegacyOrderRepository',
|
|
1098
|
+
'ShopMenuRepository',
|
|
1099
|
+
'OrderRepository',
|
|
1100
|
+
'OrderBlockedRepository',
|
|
1101
|
+
'PaymentRepository',
|
|
1102
|
+
'ShoppingRecurrenceRepository',
|
|
1103
|
+
'ShoppingRecurrenceEditionRepository',
|
|
1104
|
+
'ShoppingRecurrenceErrorLogRepository',
|
|
1105
|
+
'SequenceRepository',
|
|
1106
|
+
'LogRepository',
|
|
1107
|
+
connect.ProductFirestoreRepository,
|
|
1108
|
+
'ShopSettingsRepository',
|
|
1109
|
+
'SubscriptionPaymentRepository',
|
|
1110
|
+
'SubscriptionPlanRepository',
|
|
1111
|
+
'SubscriptionProductRepository',
|
|
1112
|
+
'SubscriptionRepository',
|
|
1113
|
+
'UserRepository',
|
|
1114
|
+
'UserAddressRepository',
|
|
1115
|
+
'UserPaymentMethodRepository',
|
|
1116
|
+
'SubscriptionMaterializationRepository',
|
|
1117
|
+
'SubscriptionSummaryRepository',
|
|
1118
|
+
connect.ProductVariantFirestoreRepository,
|
|
1119
|
+
exports.ConnectFirestoreService,
|
|
1120
|
+
'BrandCategoryRepository',
|
|
1121
|
+
'ShopConfigsRepository',
|
|
1122
|
+
],
|
|
1123
|
+
})
|
|
1120
1124
|
], exports.NestFirestoreModule);
|
|
1121
1125
|
|
|
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
|
-
})
|
|
1126
|
+
var NestHasuraGraphQLModule_1;
|
|
1127
|
+
exports.NestHasuraGraphQLModule = NestHasuraGraphQLModule_1 = class NestHasuraGraphQLModule {
|
|
1128
|
+
static initializeApp(options) {
|
|
1129
|
+
return {
|
|
1130
|
+
module: NestHasuraGraphQLModule_1,
|
|
1131
|
+
providers: [{ provide: HASURA_OPTIONS, useValue: options }],
|
|
1132
|
+
exports: [HASURA_OPTIONS],
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
exports.NestHasuraGraphQLModule = NestHasuraGraphQLModule_1 = __decorate([
|
|
1137
|
+
common.Module({
|
|
1138
|
+
providers: [
|
|
1139
|
+
{
|
|
1140
|
+
provide: 'HasuraConfig',
|
|
1141
|
+
useFactory: (options) => ({
|
|
1142
|
+
endpoint: options.endpoint,
|
|
1143
|
+
authOptions: options.credentials,
|
|
1144
|
+
cache: connect.resolveCacheConfig(options.cache),
|
|
1145
|
+
}),
|
|
1146
|
+
inject: [HASURA_OPTIONS],
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
provide: 'CategoryRepository',
|
|
1150
|
+
useExisting: connect.CategoryHasuraGraphQLRepository,
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
provide: connect.CategoryHasuraGraphQLRepository,
|
|
1154
|
+
useFactory: (options, productRepository, categoryFilterRepository) => {
|
|
1155
|
+
return new connect.CategoryHasuraGraphQLRepository(options, productRepository, categoryFilterRepository);
|
|
1156
|
+
},
|
|
1157
|
+
inject: ['HasuraConfig', connect.ProductHasuraGraphQLRepository, connect.CategoryFilterHasuraGraphQLRepository],
|
|
1158
|
+
},
|
|
1159
|
+
{
|
|
1160
|
+
provide: 'ProductRepository',
|
|
1161
|
+
useExisting: connect.ProductHasuraGraphQLRepository,
|
|
1162
|
+
},
|
|
1163
|
+
{
|
|
1164
|
+
provide: connect.ProductHasuraGraphQLRepository,
|
|
1165
|
+
useFactory: (hasuraConfig) => {
|
|
1166
|
+
return new connect.ProductHasuraGraphQLRepository(hasuraConfig);
|
|
1167
|
+
},
|
|
1168
|
+
inject: ['HasuraConfig'],
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
provide: 'ProductReviewRepository',
|
|
1172
|
+
useExisting: connect.ProductReviewHasuraGraphQLRepository,
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
provide: connect.ProductReviewHasuraGraphQLRepository,
|
|
1176
|
+
useFactory: (hasuraConfig) => {
|
|
1177
|
+
return new connect.ProductReviewHasuraGraphQLRepository(hasuraConfig);
|
|
1178
|
+
},
|
|
1179
|
+
inject: ['HasuraConfig'],
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
provide: 'VariantRepository',
|
|
1183
|
+
useExisting: connect.VariantHasuraGraphQLRepository,
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
provide: connect.VariantHasuraGraphQLRepository,
|
|
1187
|
+
useFactory: (hasuraConfig) => {
|
|
1188
|
+
return new connect.VariantHasuraGraphQLRepository(hasuraConfig);
|
|
1189
|
+
},
|
|
1190
|
+
inject: ['HasuraConfig'],
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
provide: 'ProductStockNotificationRepository',
|
|
1194
|
+
useExisting: connect.ProductStockNotificationHasuraGraphQLRepository,
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
provide: connect.ProductStockNotificationHasuraGraphQLRepository,
|
|
1198
|
+
useFactory: (hasuraConfig) => {
|
|
1199
|
+
return new connect.ProductStockNotificationHasuraGraphQLRepository(hasuraConfig);
|
|
1200
|
+
},
|
|
1201
|
+
inject: ['HasuraConfig'],
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
provide: 'CategoryFilterRepository',
|
|
1205
|
+
useExisting: connect.CategoryFilterHasuraGraphQLRepository,
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
provide: connect.CategoryFilterHasuraGraphQLRepository,
|
|
1209
|
+
useFactory: (options) => {
|
|
1210
|
+
return new connect.CategoryFilterHasuraGraphQLRepository(options);
|
|
1211
|
+
},
|
|
1212
|
+
inject: ['HasuraConfig'],
|
|
1213
|
+
},
|
|
1214
|
+
{
|
|
1215
|
+
provide: 'FilterOptionRepository',
|
|
1216
|
+
useExisting: connect.FilterOptionHasuraGraphQLRepository,
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
provide: connect.FilterOptionHasuraGraphQLRepository,
|
|
1220
|
+
useFactory: (options) => {
|
|
1221
|
+
return new connect.FilterOptionHasuraGraphQLRepository(options);
|
|
1222
|
+
},
|
|
1223
|
+
inject: ['HasuraConfig'],
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
provide: 'FilterRepository',
|
|
1227
|
+
useExisting: connect.FilterHasuraGraphQLRepository,
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
provide: connect.FilterHasuraGraphQLRepository,
|
|
1231
|
+
useFactory: (options, filterOptionRepository, categoryFilterRepository) => {
|
|
1232
|
+
return new connect.FilterHasuraGraphQLRepository(options, filterOptionRepository, categoryFilterRepository);
|
|
1233
|
+
},
|
|
1234
|
+
inject: ['HasuraConfig', connect.FilterOptionHasuraGraphQLRepository, connect.CategoryFilterHasuraGraphQLRepository],
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
provide: connect.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
1238
|
+
useFactory: (options) => new connect.CategoryCollectionChildrenHasuraGraphQLRepository(options),
|
|
1239
|
+
inject: ['HasuraConfig'],
|
|
1240
|
+
},
|
|
1241
|
+
{
|
|
1242
|
+
provide: 'CategoryCollectionChildrenRepository',
|
|
1243
|
+
useExisting: connect.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
1244
|
+
},
|
|
1245
|
+
{
|
|
1246
|
+
provide: connect.CategoryProductHasuraGraphQLRepository,
|
|
1247
|
+
useFactory: (options) => {
|
|
1248
|
+
return new connect.CategoryProductHasuraGraphQLRepository(options);
|
|
1249
|
+
},
|
|
1250
|
+
inject: ['HasuraConfig'],
|
|
1251
|
+
},
|
|
1252
|
+
{
|
|
1253
|
+
provide: 'CategoryProductRepository',
|
|
1254
|
+
useExisting: connect.CategoryProductHasuraGraphQLRepository,
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
provide: connect.WishlistHasuraGraphQLRepository,
|
|
1258
|
+
useFactory: (options, categoryProductRepository) => {
|
|
1259
|
+
return new connect.WishlistHasuraGraphQLRepository(options, categoryProductRepository);
|
|
1260
|
+
},
|
|
1261
|
+
inject: ['HasuraConfig', connect.CategoryProductHasuraGraphQLRepository],
|
|
1262
|
+
},
|
|
1263
|
+
{
|
|
1264
|
+
provide: 'WishlistRepository',
|
|
1265
|
+
useExisting: connect.WishlistHasuraGraphQLRepository,
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
provide: connect.ProductErrorsHasuraGraphQLRepository,
|
|
1269
|
+
useFactory: (options, productRepository) => {
|
|
1270
|
+
return new connect.ProductErrorsHasuraGraphQLRepository(options, productRepository);
|
|
1271
|
+
},
|
|
1272
|
+
inject: ['HasuraConfig', connect.ProductHasuraGraphQLRepository],
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
provide: 'ProductErrorsRepository',
|
|
1276
|
+
useExisting: connect.ProductErrorsHasuraGraphQLRepository,
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
provide: connect.ProductCatalogHasuraGraphQLRepository,
|
|
1280
|
+
useFactory: (options) => {
|
|
1281
|
+
return new connect.ProductCatalogHasuraGraphQLRepository(options);
|
|
1282
|
+
},
|
|
1283
|
+
inject: ['HasuraConfig'],
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
provide: 'ProductCatalogRepository',
|
|
1287
|
+
useExisting: connect.ProductCatalogHasuraGraphQLRepository,
|
|
1288
|
+
},
|
|
1289
|
+
{
|
|
1290
|
+
provide: connect.ProductStockEntryHasuraGraphQLRepository,
|
|
1291
|
+
useFactory: (options) => {
|
|
1292
|
+
return new connect.ProductStockEntryHasuraGraphQLRepository(options);
|
|
1293
|
+
},
|
|
1294
|
+
inject: ['HasuraConfig'],
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
provide: 'ProductStockEntryRepository',
|
|
1298
|
+
useExisting: connect.ProductStockEntryHasuraGraphQLRepository,
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
provide: connect.ProductGroupHasuraGraphQLRepository,
|
|
1302
|
+
useFactory: (options) => {
|
|
1303
|
+
return new connect.ProductGroupHasuraGraphQLRepository(options);
|
|
1304
|
+
},
|
|
1305
|
+
inject: ['HasuraConfig'],
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
provide: 'ProductGroupRepository',
|
|
1309
|
+
useExisting: connect.ProductGroupHasuraGraphQLRepository,
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
provide: connect.ProductPriceLogHasuraGraphQLRepository,
|
|
1313
|
+
useFactory: (options) => {
|
|
1314
|
+
return new connect.ProductPriceLogHasuraGraphQLRepository(options);
|
|
1315
|
+
},
|
|
1316
|
+
inject: ['HasuraConfig'],
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
provide: 'ProductPriceLogRepository',
|
|
1320
|
+
useExisting: connect.ProductPriceLogHasuraGraphQLRepository,
|
|
1321
|
+
},
|
|
1322
|
+
],
|
|
1323
|
+
exports: [
|
|
1324
|
+
'CategoryRepository',
|
|
1325
|
+
connect.CategoryHasuraGraphQLRepository,
|
|
1326
|
+
'ProductRepository',
|
|
1327
|
+
connect.ProductHasuraGraphQLRepository,
|
|
1328
|
+
'ProductReviewRepository',
|
|
1329
|
+
connect.ProductReviewHasuraGraphQLRepository,
|
|
1330
|
+
'VariantRepository',
|
|
1331
|
+
connect.VariantHasuraGraphQLRepository,
|
|
1332
|
+
'ProductStockNotificationRepository',
|
|
1333
|
+
connect.ProductStockNotificationHasuraGraphQLRepository,
|
|
1334
|
+
'CategoryFilterRepository',
|
|
1335
|
+
connect.CategoryFilterHasuraGraphQLRepository,
|
|
1336
|
+
'FilterOptionRepository',
|
|
1337
|
+
connect.FilterOptionHasuraGraphQLRepository,
|
|
1338
|
+
'FilterRepository',
|
|
1339
|
+
connect.FilterHasuraGraphQLRepository,
|
|
1340
|
+
'CategoryCollectionChildrenRepository',
|
|
1341
|
+
connect.CategoryCollectionChildrenHasuraGraphQLRepository,
|
|
1342
|
+
'WishlistRepository',
|
|
1343
|
+
connect.WishlistHasuraGraphQLRepository,
|
|
1344
|
+
'CategoryProductRepository',
|
|
1345
|
+
connect.CategoryProductHasuraGraphQLRepository,
|
|
1346
|
+
'ProductErrorsRepository',
|
|
1347
|
+
connect.ProductErrorsHasuraGraphQLRepository,
|
|
1348
|
+
'ProductCatalogRepository',
|
|
1349
|
+
connect.ProductCatalogHasuraGraphQLRepository,
|
|
1350
|
+
'ProductStockEntryRepository',
|
|
1351
|
+
connect.ProductStockEntryHasuraGraphQLRepository,
|
|
1352
|
+
'ProductGroupRepository',
|
|
1353
|
+
connect.ProductGroupHasuraGraphQLRepository,
|
|
1354
|
+
'ProductPriceLogRepository',
|
|
1355
|
+
connect.ProductPriceLogHasuraGraphQLRepository,
|
|
1356
|
+
],
|
|
1357
|
+
})
|
|
1354
1358
|
], exports.NestHasuraGraphQLModule);
|
|
1355
1359
|
|
|
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
|
-
})
|
|
1360
|
+
var NestVertexSeachModule_1;
|
|
1361
|
+
let NestVertexSeachModule = NestVertexSeachModule_1 = class NestVertexSeachModule {
|
|
1362
|
+
static initializeApp(options) {
|
|
1363
|
+
return {
|
|
1364
|
+
module: NestVertexSeachModule_1,
|
|
1365
|
+
providers: [{ provide: VERTEX_CONFIG, useValue: options }],
|
|
1366
|
+
exports: [VERTEX_CONFIG],
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
NestVertexSeachModule = NestVertexSeachModule_1 = __decorate([
|
|
1371
|
+
common.Module({
|
|
1372
|
+
providers: [
|
|
1373
|
+
exports.DiscoveryEngineVertexAdapter,
|
|
1374
|
+
{
|
|
1375
|
+
provide: connect.ProductsVertexSearch,
|
|
1376
|
+
useFactory: (adapter) => new connect.ProductsVertexSearch(adapter),
|
|
1377
|
+
inject: [exports.DiscoveryEngineVertexAdapter],
|
|
1378
|
+
},
|
|
1379
|
+
],
|
|
1380
|
+
exports: [connect.ProductsVertexSearch],
|
|
1381
|
+
})
|
|
1378
1382
|
], NestVertexSeachModule);
|
|
1379
1383
|
|
|
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({})
|
|
1384
|
+
var NestConnectModule_1;
|
|
1385
|
+
exports.NestConnectModule = NestConnectModule_1 = class NestConnectModule {
|
|
1386
|
+
static initializeApp(options) {
|
|
1387
|
+
return {
|
|
1388
|
+
module: NestConnectModule_1,
|
|
1389
|
+
imports: [
|
|
1390
|
+
...(options.firebase ? [exports.NestFirestoreModule.initializeApp({ firebase: options.firebase })] : []),
|
|
1391
|
+
...(connect.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [exports.NestHasuraGraphQLModule.initializeApp(options.hasura)]),
|
|
1392
|
+
...(connect.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [exports.NestElasticSeachModule.initializeApp(options.elasticSearch)]),
|
|
1393
|
+
...(connect.isNil(options === null || options === void 0 ? void 0 : options.vertex) ? [] : [NestVertexSeachModule.initializeApp(options.vertex)]),
|
|
1394
|
+
],
|
|
1395
|
+
exports: [
|
|
1396
|
+
...(options.firebase ? [exports.NestFirestoreModule] : []),
|
|
1397
|
+
...(connect.isNil(options === null || options === void 0 ? void 0 : options.hasura) ? [] : [exports.NestHasuraGraphQLModule]),
|
|
1398
|
+
...(connect.isNil(options === null || options === void 0 ? void 0 : options.elasticSearch) ? [] : [exports.NestElasticSeachModule]),
|
|
1399
|
+
...(connect.isNil(options === null || options === void 0 ? void 0 : options.vertex) ? [] : [NestVertexSeachModule]),
|
|
1400
|
+
],
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
exports.NestConnectModule = NestConnectModule_1 = __decorate([
|
|
1405
|
+
common.Module({})
|
|
1402
1406
|
], exports.NestConnectModule);
|
|
1403
1407
|
|
|
1404
1408
|
exports.ConnectCollectionService = ConnectCollectionService;
|