@resolveio/server-lib 4.4.13 → 4.4.15

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.
@@ -51,7 +51,9 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
51
51
  });
52
52
  DefaultSchema.index({ date: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 30 });
53
53
  DefaultSchema.index({ type: 1 });
54
- DefaultSchema.index({ date: 1, type: 1 });
54
+ DefaultSchema.index({ type: 1, date: 1 });
55
+ DefaultSchema.index({ user: 1, date: 1 });
56
+ DefaultSchema.index({ user: 1, type: 1, date: 1 });
55
57
  exports.Logs = index_1.ResolveIOServer.getMainDB().model('logs', DefaultSchema);
56
58
  schema._id = {
57
59
  type: mongoose_1.Schema.Types.Mixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "4.4.13",
3
+ "version": "4.4.15",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -12,5 +12,6 @@ $1$2,$3,\n
12
12
  export declare function buildRbLookups(rbLookups: LookupTables[], defaultSchema: Schema<any>, default_checked_array?: string[]): any;
13
13
  export declare function throwErr(err: any, lkp: any, lookupNode: any, newPropertyName?: string): void;
14
14
  export declare function buildTree(current_root: any, schemaTree: any, lookup?: any): any[];
15
- export declare function getLeafTypes(schemaTree: any, fieldPath: any): any[];
15
+ export declare function getLeafValueTypes(schemaTree: any, fieldPath: any): any[];
16
+ export declare function getLeafFormatTypes(schemaTree: any, fieldPath: any): any[];
16
17
  export declare function mongoCommand(commandstr: string, collection: string, field?: any): Promise<any>;
@@ -174,8 +174,10 @@ function buildTree(current_root, schemaTree, lookup) {
174
174
  columnName: common_1.toTitleCase(key.replace(/\_/g, ' ')),
175
175
  fieldName: key,
176
176
  fieldType: schemaTree[key].rbType,
177
+ fieldTypeName: schemaTree[key].rbType === 'String' ? 'Text' : (schemaTree[key].rbType === 'Boolean' ? 'T/F' : schemaTree[key].rbType),
177
178
  distinctFieldValues: [],
178
179
  fieldPath: lookup ? lookup.lookup_as + '.$.' + key : key,
180
+ fieldPathName: lookup ? (common_1.toTitleCase(lookup.lookup_as.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> '))) + ' (List) -> ' + (common_1.toTitleCase(key.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> '))) : common_1.toTitleCase(key.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> ')),
179
181
  lookup_collection: lookup ? lookup.lookup_collection : (schemaTree[key].lookup_collection ? schemaTree[key].lookup_collection : ''),
180
182
  lookup_local_key: lookup ? lookup.lookup_local_key : (schemaTree[key].lookup_collection ? schemaTree[key].local_key : ''),
181
183
  lookup_foreign_key: lookup ? lookup.lookup_foreign_key : (schemaTree[key].lookup_collection ? schemaTree[key].lookup_key : ''),
@@ -186,8 +188,10 @@ function buildTree(current_root, schemaTree, lookup) {
186
188
  isActive: false,
187
189
  isSelected: false,
188
190
  depth: 0,
189
- leafType: '',
190
- leafTypes: getLeafTypes(schemaTree[key], key)
191
+ leafValueType: '',
192
+ leafValueTypes: getLeafValueTypes(schemaTree[key], key),
193
+ leafFormatType: '',
194
+ leafFormatTypes: getLeafValueTypes(schemaTree[key], key)
191
195
  });
192
196
  }
193
197
  else {
@@ -196,8 +200,10 @@ function buildTree(current_root, schemaTree, lookup) {
196
200
  columnName: common_1.toTitleCase(key.replace(/\_/g, ' ')),
197
201
  fieldName: key,
198
202
  fieldType: schemaTree[key].lookup_collection ? 'Lookup' : schemaTree[key].rbType,
203
+ fieldTypeName: schemaTree[key].lookup_collection ? 'Lookup' : (schemaTree[key].rbType === 'Array' ? 'List' : 'Group'),
199
204
  distinctFieldValues: [],
200
205
  fieldPath: lookup ? lookup.lookup_as + '.$.' + key : key,
206
+ fieldPathName: lookup ? (common_1.toTitleCase(lookup.lookup_as.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> '))) + ' (List) -> ' + (common_1.toTitleCase(key.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> '))) : common_1.toTitleCase(key.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> ')),
201
207
  lookup_collection: lookup ? lookup.lookup_collection : (schemaTree[key].lookup_collection ? schemaTree[key].lookup_collection : ''),
202
208
  lookup_local_key: lookup ? lookup.lookup_local_key : (schemaTree[key].lookup_collection ? schemaTree[key].local_key : ''),
203
209
  lookup_foreign_key: lookup ? lookup.lookup_foreign_key : (schemaTree[key].lookup_collection ? schemaTree[key].lookup_key : ''),
@@ -208,7 +214,8 @@ function buildTree(current_root, schemaTree, lookup) {
208
214
  isActive: false,
209
215
  isSelected: false,
210
216
  depth: 0,
211
- leafTypeValue: '',
217
+ leafValueType: '',
218
+ leafFormatType: '',
212
219
  children: []
213
220
  });
214
221
  }
@@ -231,8 +238,10 @@ function buildTree(current_root, schemaTree, lookup) {
231
238
  columnName: common_1.toTitleCase(key.replace(/\_/g, ' ')),
232
239
  fieldName: layer,
233
240
  fieldType: schemaTree[key].rbType,
241
+ fieldTypeName: schemaTree[key].rbType === 'String' ? 'Text' : (schemaTree[key].rbType === 'Boolean' ? 'T/F' : schemaTree[key].rbType),
234
242
  distinctFieldValues: [],
235
243
  fieldPath: lookup ? lookup.lookup_as + '.$.' + key : key,
244
+ fieldPathName: lookup ? (common_1.toTitleCase(lookup.lookup_as.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> '))) + ' (List) -> ' + (common_1.toTitleCase(key.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> '))) : common_1.toTitleCase(key.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> ')),
236
245
  lookup_collection: lookup ? lookup.lookup_collection : (schemaTree[key].lookup_collection ? schemaTree[key].lookup_collection : ''),
237
246
  lookup_local_key: lookup ? lookup.lookup_local_key : (schemaTree[key].lookup_collection ? schemaTree[key].local_key : ''),
238
247
  lookup_foreign_key: lookup ? lookup.lookup_foreign_key : (schemaTree[key].lookup_collection ? schemaTree[key].lookup_key : ''),
@@ -243,8 +252,10 @@ function buildTree(current_root, schemaTree, lookup) {
243
252
  isActive: false,
244
253
  isSelected: false,
245
254
  depth: index,
246
- leafType: '',
247
- leafTypes: getLeafTypes(schemaTree[key], key)
255
+ leafValueType: '',
256
+ leafValueTypes: getLeafValueTypes(schemaTree[key], key),
257
+ leafFormatType: '',
258
+ leafFormatTypes: getLeafValueTypes(schemaTree[key], key)
248
259
  });
249
260
  }
250
261
  else {
@@ -253,8 +264,10 @@ function buildTree(current_root, schemaTree, lookup) {
253
264
  columnName: common_1.toTitleCase(key.replace(/\_/g, ' ')),
254
265
  fieldName: layer,
255
266
  fieldType: schemaTree[key].lookup_collection ? 'Lookup' : schemaTree[key].rbType,
267
+ fieldTypeName: schemaTree[key].lookup_collection ? 'Lookup' : (schemaTree[key].rbType === 'Array' ? 'List' : 'Group'),
256
268
  distinctFieldValues: [],
257
269
  fieldPath: lookup ? lookup.lookup_as + '.$.' + key : key,
270
+ fieldPathName: lookup ? (common_1.toTitleCase(lookup.lookup_as.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> '))) + ' (List) -> ' + (common_1.toTitleCase(key.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> '))) : common_1.toTitleCase(key.replace(/\.\$\./g, ' (List) -> ').replace(/\./g, ' (Group) -> ')),
258
271
  lookup_collection: lookup ? lookup.lookup_collection : (schemaTree[key].lookup_collection ? schemaTree[key].lookup_collection : ''),
259
272
  lookup_local_key: lookup ? lookup.lookup_local_key : (schemaTree[key].lookup_collection ? schemaTree[key].local_key : ''),
260
273
  lookup_foreign_key: lookup ? lookup.lookup_foreign_key : (schemaTree[key].lookup_collection ? schemaTree[key].lookup_key : ''),
@@ -265,7 +278,8 @@ function buildTree(current_root, schemaTree, lookup) {
265
278
  isActive: false,
266
279
  isSelected: false,
267
280
  depth: index,
268
- leafTypeValue: '',
281
+ leafValueType: '',
282
+ leafFormatType: '',
269
283
  children: []
270
284
  });
271
285
  }
@@ -279,13 +293,13 @@ function buildTree(current_root, schemaTree, lookup) {
279
293
  return res;
280
294
  }
281
295
  exports.buildTree = buildTree;
282
- function getLeafTypes(schemaTree, fieldPath) {
296
+ function getLeafValueTypes(schemaTree, fieldPath) {
283
297
  var leafTypes = [];
284
298
  if (schemaTree.rbType === 'String') {
285
299
  leafTypes = [
286
300
  {
287
- text: 'As Text',
288
- value: 'String'
301
+ text: 'As Value',
302
+ value: 'Value'
289
303
  },
290
304
  {
291
305
  text: 'As Count',
@@ -304,16 +318,8 @@ function getLeafTypes(schemaTree, fieldPath) {
304
318
  else if (schemaTree.rbType === 'Number') {
305
319
  leafTypes = [
306
320
  {
307
- text: 'As Number',
308
- value: 'Number'
309
- },
310
- {
311
- text: 'As Currency',
312
- value: 'Currency'
313
- },
314
- {
315
- text: 'As Text',
316
- value: 'String'
321
+ text: 'As Value',
322
+ value: 'Value'
317
323
  },
318
324
  {
319
325
  text: 'As Average',
@@ -348,21 +354,41 @@ function getLeafTypes(schemaTree, fieldPath) {
348
354
  else if (schemaTree.rbType === 'Boolean') {
349
355
  leafTypes = [
350
356
  {
351
- text: 'As Boolean (True/False)',
352
- value: 'Boolean'
357
+ text: 'As Value',
358
+ value: 'Value'
353
359
  },
354
360
  {
355
- text: 'As Text (Yes/No)',
356
- value: 'String'
361
+ text: 'As Count',
362
+ value: 'Count'
357
363
  },
358
364
  {
359
- text: 'As Number (1/0)',
360
- value: 'Number'
365
+ text: 'First',
366
+ value: 'First'
367
+ },
368
+ {
369
+ text: 'Last',
370
+ value: 'Last'
371
+ }
372
+ ];
373
+ }
374
+ else if (schemaTree.rbType === 'Date') {
375
+ leafTypes = [
376
+ {
377
+ text: 'As Value',
378
+ value: 'Value'
361
379
  },
362
380
  {
363
381
  text: 'As Count',
364
382
  value: 'Count'
365
383
  },
384
+ {
385
+ text: 'Minimum',
386
+ value: 'Minimum'
387
+ },
388
+ {
389
+ text: 'Maximum',
390
+ value: 'Maximum'
391
+ },
366
392
  {
367
393
  text: 'First',
368
394
  value: 'First'
@@ -373,6 +399,51 @@ function getLeafTypes(schemaTree, fieldPath) {
373
399
  }
374
400
  ];
375
401
  }
402
+ return leafTypes;
403
+ }
404
+ exports.getLeafValueTypes = getLeafValueTypes;
405
+ function getLeafFormatTypes(schemaTree, fieldPath) {
406
+ var leafTypes = [];
407
+ if (schemaTree.rbType === 'String') {
408
+ leafTypes = [
409
+ {
410
+ text: 'As Text',
411
+ value: 'String'
412
+ }
413
+ ];
414
+ }
415
+ else if (schemaTree.rbType === 'Number') {
416
+ leafTypes = [
417
+ {
418
+ text: 'As Number',
419
+ value: 'Number'
420
+ },
421
+ {
422
+ text: 'As Currency',
423
+ value: 'Currency'
424
+ },
425
+ {
426
+ text: 'As Text',
427
+ value: 'String'
428
+ }
429
+ ];
430
+ }
431
+ else if (schemaTree.rbType === 'Boolean') {
432
+ leafTypes = [
433
+ {
434
+ text: 'As Boolean (True/False)',
435
+ value: 'Boolean'
436
+ },
437
+ {
438
+ text: 'As Text (Yes/No)',
439
+ value: 'String'
440
+ },
441
+ {
442
+ text: 'As Number (1/0)',
443
+ value: 'Number'
444
+ }
445
+ ];
446
+ }
376
447
  else if (schemaTree.rbType === 'Date') {
377
448
  leafTypes = [
378
449
  {
@@ -398,32 +469,12 @@ function getLeafTypes(schemaTree, fieldPath) {
398
469
  {
399
470
  text: 'As Timestamp (MS since 1970)',
400
471
  value: 'Number'
401
- },
402
- {
403
- text: 'As Count',
404
- value: 'Count'
405
- },
406
- {
407
- text: 'Minimum',
408
- value: 'Minimum'
409
- },
410
- {
411
- text: 'Maximum',
412
- value: 'Maximum'
413
- },
414
- {
415
- text: 'First',
416
- value: 'First'
417
- },
418
- {
419
- text: 'Last',
420
- value: 'Last'
421
472
  }
422
473
  ];
423
474
  }
424
475
  return leafTypes;
425
476
  }
426
- exports.getLeafTypes = getLeafTypes;
477
+ exports.getLeafFormatTypes = getLeafFormatTypes;
427
478
  function mongoCommand(commandstr, collection, field) {
428
479
  return __awaiter(this, void 0, void 0, function () {
429
480
  var tmpObj, obj, obj, err_1;