drapcode-utility 1.2.0 → 1.2.1-beta
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/build/utils/query-parser.js +66 -65
- package/build/utils/query-paser-new.js +66 -65
- package/build/utils/s3-util.js +1 -0
- package/package.json +1 -1
|
@@ -119,21 +119,21 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
|
|
|
119
119
|
finder = query.finder, sortBy = query.sortBy, orderBy = query.orderBy;
|
|
120
120
|
if (!(finder != "COUNT" && refCollectionFieldsInItems)) return [3 /*break*/, 2];
|
|
121
121
|
return [4 /*yield*/, Promise.all(refCollectionFieldsInItems.map(function (field) {
|
|
122
|
-
var _a
|
|
122
|
+
var _a;
|
|
123
123
|
if (["reference", "multi_reference", "belongsTo"].includes(field.type)) {
|
|
124
124
|
var collectionName_1 = field.refCollection
|
|
125
125
|
? field.refCollection["collectionName"]
|
|
126
126
|
: null;
|
|
127
127
|
if (collectionName_1) {
|
|
128
128
|
if (field.type === "belongsTo") {
|
|
129
|
-
aggregateQuery.push({
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
129
|
+
// aggregateQuery.push({
|
|
130
|
+
// $lookup: {
|
|
131
|
+
// from: `${collectionName}`,
|
|
132
|
+
// localField: field.fieldName,
|
|
133
|
+
// foreignField: "uuid",
|
|
134
|
+
// as: field.fieldName,
|
|
135
|
+
// },
|
|
136
|
+
// });
|
|
137
137
|
aggregateQuery.push({
|
|
138
138
|
$addFields: (_a = {},
|
|
139
139
|
_a["_$belongsToMetaData"] = field,
|
|
@@ -141,65 +141,66 @@ var queryParser = function (collectionName, query, constants, externalParams, cu
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
|
-
aggregateQuery.push({
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
});
|
|
144
|
+
// aggregateQuery.push({
|
|
145
|
+
// $lookup: {
|
|
146
|
+
// from: `${collectionName}`,
|
|
147
|
+
// let: { [`${field.fieldName}`]: `$${field.fieldName}` },
|
|
148
|
+
// pipeline: [
|
|
149
|
+
// {
|
|
150
|
+
// $match: {
|
|
151
|
+
// $expr: {
|
|
152
|
+
// $in: [
|
|
153
|
+
// "$uuid",
|
|
154
|
+
// {
|
|
155
|
+
// $cond: {
|
|
156
|
+
// if: {
|
|
157
|
+
// $in: [`$$${field.fieldName}`, ["", null]],
|
|
158
|
+
// },
|
|
159
|
+
// then: [],
|
|
160
|
+
// else: { $ifNull: [`$$${field.fieldName}`, []] },
|
|
161
|
+
// },
|
|
162
|
+
// },
|
|
163
|
+
// ],
|
|
164
|
+
// },
|
|
165
|
+
// },
|
|
166
|
+
// },
|
|
167
|
+
// {
|
|
168
|
+
// $lookup: {
|
|
169
|
+
// from: "user",
|
|
170
|
+
// let: { createdBy: "$createdBy" },
|
|
171
|
+
// pipeline: [
|
|
172
|
+
// {
|
|
173
|
+
// $match: {
|
|
174
|
+
// $expr: { $eq: ["$uuid", "$$createdBy"] },
|
|
175
|
+
// },
|
|
176
|
+
// },
|
|
177
|
+
// { $project: { _id: 0, password: 0 } },
|
|
178
|
+
// ],
|
|
179
|
+
// as: "createdBy",
|
|
180
|
+
// },
|
|
181
|
+
// },
|
|
182
|
+
// ],
|
|
183
|
+
// as: field.fieldName,
|
|
184
|
+
// },
|
|
185
|
+
// });
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
if (field.type === "createdBy")
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
189
|
+
if (field.type === "createdBy") {
|
|
190
|
+
}
|
|
191
|
+
// aggregateQuery.push({
|
|
192
|
+
// $lookup: {
|
|
193
|
+
// from: `user`,
|
|
194
|
+
// let: { [`${field.fieldName}`]: `$${field.fieldName}` },
|
|
195
|
+
// pipeline: [
|
|
196
|
+
// {
|
|
197
|
+
// $match: { $expr: { $eq: ["$uuid", `$$${field.fieldName}`] } },
|
|
198
|
+
// },
|
|
199
|
+
// { $project: { _id: 0, password: 0 } },
|
|
200
|
+
// ],
|
|
201
|
+
// as: field.fieldName,
|
|
202
|
+
// },
|
|
203
|
+
// });
|
|
203
204
|
}))];
|
|
204
205
|
case 1:
|
|
205
206
|
_e.sent();
|
|
@@ -209,21 +209,21 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
|
|
|
209
209
|
finder = query.finder, sortBy = query.sortBy, orderBy = query.orderBy, aggregateFunctionField = query.aggregateFunctionField;
|
|
210
210
|
if (!(finder != "COUNT" && refCollectionFieldsInItems)) return [3 /*break*/, 2];
|
|
211
211
|
return [4 /*yield*/, Promise.all(refCollectionFieldsInItems.map(function (field) {
|
|
212
|
-
var _a
|
|
212
|
+
var _a;
|
|
213
213
|
if (["reference", "multi_reference", "belongsTo"].includes(field.type)) {
|
|
214
214
|
var collectionName_1 = field.refCollection
|
|
215
215
|
? field.refCollection["collectionName"]
|
|
216
216
|
: null;
|
|
217
217
|
if (collectionName_1) {
|
|
218
218
|
if (field.type === "belongsTo") {
|
|
219
|
-
aggregateQuery.push({
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
});
|
|
219
|
+
// aggregateQuery.push({
|
|
220
|
+
// $lookup: {
|
|
221
|
+
// from: `${collectionName}`,
|
|
222
|
+
// localField: field.fieldName,
|
|
223
|
+
// foreignField: "uuid",
|
|
224
|
+
// as: field.fieldName,
|
|
225
|
+
// },
|
|
226
|
+
// });
|
|
227
227
|
aggregateQuery.push({
|
|
228
228
|
$addFields: (_a = {},
|
|
229
229
|
_a["_$belongsToMetaData"] = field,
|
|
@@ -231,65 +231,66 @@ var queryParserNew = function (collectionName, query, constants, externalParams,
|
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
233
|
else {
|
|
234
|
-
aggregateQuery.push({
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
});
|
|
234
|
+
// aggregateQuery.push({
|
|
235
|
+
// $lookup: {
|
|
236
|
+
// from: `${collectionName}`,
|
|
237
|
+
// let: { [`${field.fieldName}`]: `$${field.fieldName}` },
|
|
238
|
+
// pipeline: [
|
|
239
|
+
// {
|
|
240
|
+
// $match: {
|
|
241
|
+
// $expr: {
|
|
242
|
+
// $in: [
|
|
243
|
+
// "$uuid",
|
|
244
|
+
// {
|
|
245
|
+
// $cond: {
|
|
246
|
+
// if: {
|
|
247
|
+
// $in: [`$$${field.fieldName}`, ["", null]],
|
|
248
|
+
// },
|
|
249
|
+
// then: [],
|
|
250
|
+
// else: { $ifNull: [`$$${field.fieldName}`, []] },
|
|
251
|
+
// },
|
|
252
|
+
// },
|
|
253
|
+
// ],
|
|
254
|
+
// },
|
|
255
|
+
// },
|
|
256
|
+
// },
|
|
257
|
+
// {
|
|
258
|
+
// $lookup: {
|
|
259
|
+
// from: "user",
|
|
260
|
+
// let: { createdBy: "$createdBy" },
|
|
261
|
+
// pipeline: [
|
|
262
|
+
// {
|
|
263
|
+
// $match: {
|
|
264
|
+
// $expr: { $eq: ["$uuid", "$$createdBy"] },
|
|
265
|
+
// },
|
|
266
|
+
// },
|
|
267
|
+
// { $project: { _id: 0, password: 0 } },
|
|
268
|
+
// ],
|
|
269
|
+
// as: "createdBy",
|
|
270
|
+
// },
|
|
271
|
+
// },
|
|
272
|
+
// ],
|
|
273
|
+
// as: field.fieldName,
|
|
274
|
+
// },
|
|
275
|
+
// });
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
if (field.type === "createdBy")
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
279
|
+
if (field.type === "createdBy") {
|
|
280
|
+
}
|
|
281
|
+
// aggregateQuery.push({
|
|
282
|
+
// $lookup: {
|
|
283
|
+
// from: `user`,
|
|
284
|
+
// let: { [`${field.fieldName}`]: `$${field.fieldName}` },
|
|
285
|
+
// pipeline: [
|
|
286
|
+
// {
|
|
287
|
+
// $match: { $expr: { $eq: ["$uuid", `$$${field.fieldName}`] } },
|
|
288
|
+
// },
|
|
289
|
+
// { $project: { _id: 0, password: 0 } },
|
|
290
|
+
// ],
|
|
291
|
+
// as: field.fieldName,
|
|
292
|
+
// },
|
|
293
|
+
// });
|
|
293
294
|
}))];
|
|
294
295
|
case 1:
|
|
295
296
|
_b.sent();
|
package/build/utils/s3-util.js
CHANGED
|
@@ -79,6 +79,7 @@ var fileUploadToS3 = function (files, s3Client, s3Config, encryption, options) {
|
|
|
79
79
|
return __generator(this, function (_d) {
|
|
80
80
|
switch (_d.label) {
|
|
81
81
|
case 0:
|
|
82
|
+
if (!encryption) return [3 /*break*/, 2];
|
|
82
83
|
awsConfig = encryption.awsConfig, encryptionType = encryption.encryptionType, dataKey = encryption.dataKey;
|
|
83
84
|
if (!(encryptionType === "KMS")) return [3 /*break*/, 2];
|
|
84
85
|
accessKeyId = awsConfig.accessKeyId, secretAccessKey = awsConfig.secretAccessKey, region = awsConfig.region;
|