@puca/puca-core 9.25.2 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/core/services/bootstrap-commands.js +45 -1
  2. package/dist/core/services/bootstrap-commands.js.map +1 -1
  3. package/dist/core/services/crud-base-testable.service.d.ts +0 -4
  4. package/dist/core/services/crud-base-testable.service.js +0 -3
  5. package/dist/core/services/crud-base-testable.service.js.map +1 -1
  6. package/dist/core/services/crud-base.service.d.ts +0 -1
  7. package/dist/core/services/crud-base.service.js.map +1 -1
  8. package/dist/core/services/crud-front-base.service.d.ts +5 -4
  9. package/dist/core/services/crud-front-base.service.js +179 -18
  10. package/dist/core/services/crud-front-base.service.js.map +1 -1
  11. package/dist/core/services/index.js +1 -1
  12. package/dist/core/services/index.js.map +1 -1
  13. package/dist/core/services/install.service.js +3 -3
  14. package/dist/core/services/install.service.js.map +1 -1
  15. package/dist/core/services/life-cycle.service.d.ts +1 -5
  16. package/dist/core/services/life-cycle.service.js +1 -16
  17. package/dist/core/services/life-cycle.service.js.map +1 -1
  18. package/dist/core/services/select-many-data.service.d.ts +8 -1
  19. package/dist/core/services/select-many-data.service.js +69 -11
  20. package/dist/core/services/select-many-data.service.js.map +1 -1
  21. package/dist/core/services/table-permission.service.js +96 -54
  22. package/dist/core/services/table-permission.service.js.map +1 -1
  23. package/dist/core/services/user-config.service.js +1 -1
  24. package/dist/core/services/user-config.service.js.map +1 -1
  25. package/dist/core/services/user.service.js +2 -1
  26. package/dist/core/services/user.service.js.map +1 -1
  27. package/dist/models/crud-controller-especification-environment.d.ts +21 -11
  28. package/dist/models/crud-controller-especification-environment.js +7 -1
  29. package/dist/models/crud-controller-especification-environment.js.map +1 -1
  30. package/dist/models/crud-controller-especification.d.ts +2 -2
  31. package/dist/models/crud-controller-especification.js.map +1 -1
  32. package/dist/orm/services/index.js +1 -1
  33. package/dist/orm/services/index.js.map +1 -1
  34. package/dist/orm/services/sql/sql-layer.service.d.ts +5 -6
  35. package/dist/orm/services/sql/sql-layer.service.js +355 -128
  36. package/dist/orm/services/sql/sql-layer.service.js.map +1 -1
  37. package/dist/orm/services/sql/sql-security-layer.service.d.ts +3 -1
  38. package/dist/orm/services/sql/sql-security-layer.service.js +4 -1
  39. package/dist/orm/services/sql/sql-security-layer.service.js.map +1 -1
  40. package/dist/orm/services/sql/sql.service.d.ts +2 -1
  41. package/dist/orm/services/sql/sql.service.js +2 -2
  42. package/dist/orm/services/sql/sql.service.js.map +1 -1
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +1 -1
@@ -5,21 +5,139 @@ const _ = require("lodash");
5
5
  const logger_1 = require("../../../core/services/logger");
6
6
  const helpers_1 = require("./helpers");
7
7
  ;
8
+ class UnsafeResolver {
9
+ constructor() {
10
+ this.logPath = false;
11
+ }
12
+ setLogPath(logPath) {
13
+ this.logPath = logPath;
14
+ }
15
+ unsafeResolveStringValue(v, alias, path) {
16
+ if (!v) {
17
+ return v;
18
+ }
19
+ const r = v.replace(/\{\{alias\}\}/g, alias);
20
+ return r;
21
+ }
22
+ unsafeResolveValue({ field, alias, path, user }) {
23
+ if (!field) {
24
+ return field;
25
+ }
26
+ if (typeof field === 'string') {
27
+ return this.unsafeResolveStringValue(field, alias, path);
28
+ }
29
+ if (typeof field === 'number' || typeof field === 'boolean') {
30
+ throw new Error(`invalid typeof ${field} === ${typeof field === 'number'}`);
31
+ }
32
+ if ('function' in field) {
33
+ return {
34
+ function: field.function,
35
+ args: (field.args || []).map(arg => this.unsafeResolveValue({ field: arg, alias, path, user })),
36
+ alias: this.unsafeResolveStringValue(field.alias, alias, path),
37
+ cast: field.cast
38
+ };
39
+ }
40
+ if ('field' in field) {
41
+ return {
42
+ table: this.unsafeResolveStringValue(field.table, alias, path),
43
+ field: this.unsafeResolveValue({ field: field.field, alias, path, user }),
44
+ alias: this.unsafeResolveStringValue(field.alias, alias, path),
45
+ cast: field.cast
46
+ };
47
+ }
48
+ if ('conditions' in field) {
49
+ return {
50
+ conditions: field.conditions.map(c => ({
51
+ when: this.unsafeResolveWhere({ where: c.when, alias, path, user }),
52
+ then: this.unsafeResolveValue({ field: c.then, alias, path, user }),
53
+ })),
54
+ else: this.unsafeResolveValue({ field: field.else, alias, path, user }),
55
+ alias: field.alias,
56
+ cast: field.cast
57
+ };
58
+ }
59
+ if ('exists' in field) {
60
+ return {
61
+ exists: this.unsafeResolveSelect(Object.assign(Object.assign({}, field.exists), { user }), alias, `${path}.e`),
62
+ alias: field.alias,
63
+ cast: field.cast
64
+ };
65
+ }
66
+ return Object.assign(Object.assign({}, this.unsafeResolveSelect(Object.assign(Object.assign({}, field), { user }), alias, `${path}.f`)), { alias: field.alias, cast: field.cast });
67
+ }
68
+ unsafeResolveWhere({ where, alias, path, user, }) {
69
+ if (!where) {
70
+ return null;
71
+ }
72
+ const mapWhere = (w, orOrAnd) => {
73
+ const r = w[orOrAnd].map((where) => this.unsafeResolveWhere({
74
+ where,
75
+ alias,
76
+ path,
77
+ user,
78
+ }));
79
+ return { [orOrAnd]: r };
80
+ };
81
+ if ('and' in where) {
82
+ return mapWhere(where, 'and');
83
+ }
84
+ else if ('or' in where) {
85
+ return mapWhere(where, 'or');
86
+ }
87
+ else if ('exists' in where) {
88
+ return {
89
+ exists: this.unsafeResolveSelect(Object.assign(Object.assign({}, where.exists), { user }), alias, path)
90
+ };
91
+ }
92
+ else if ('not' in where) {
93
+ return {
94
+ not: this.unsafeResolveWhere({
95
+ where: where.not,
96
+ alias,
97
+ path,
98
+ user,
99
+ })
100
+ };
101
+ }
102
+ else {
103
+ return Object.assign(Object.assign({}, where), { v1: this.unsafeResolveValue({ field: where.v1, alias, path, user }), v2: this.unsafeResolveValue({ field: where.v2, alias, path, user }), comment: this.logPath ? path : undefined });
104
+ }
105
+ }
106
+ unsafeResolveSelect(select, alias, path) {
107
+ return Object.assign(Object.assign({}, select), { join: (select.join || []).map(join => {
108
+ return Object.assign(Object.assign({}, join), { on: this.unsafeResolveWhere({
109
+ where: join.on,
110
+ alias,
111
+ path,
112
+ user: select.user,
113
+ }) });
114
+ }).map(j => j), where: this.unsafeResolveWhere({
115
+ where: select.where,
116
+ alias,
117
+ path,
118
+ user: select.user,
119
+ }) });
120
+ }
121
+ }
8
122
  class SqlLayerService {
9
123
  constructor(prefix, getSimpleTableDictionary) {
10
124
  this.prefix = prefix;
11
125
  this.getSimpleTableDictionary = getSimpleTableDictionary;
12
126
  this.logger = new logger_1.Logger('SqlServiceLayer');
13
127
  this.MAX_DEEP = 100;
128
+ this.unsafeResolver = new UnsafeResolver();
129
+ }
130
+ setLogPath(logPath) {
131
+ this.unsafeResolver.setLogPath(logPath);
14
132
  }
15
133
  addRuleWhere(response, rule) {
16
134
  if (rule.where) {
17
135
  response.where.and.push(rule.where);
18
136
  }
19
- Object.entries(rule.args).forEach(([k, v]) => {
137
+ Object.entries(rule.args || {}).forEach(([k, v]) => {
20
138
  response.args[k] = v;
21
139
  });
22
- response.tables.push(...rule.tables);
140
+ response.tables.push(...(rule.tables || []));
23
141
  }
24
142
  insert(insert) {
25
143
  try {
@@ -37,7 +155,7 @@ class SqlLayerService {
37
155
  });
38
156
  const mode = 'insert';
39
157
  const path = `${this.prefix}.insert`;
40
- this.addRuleWhere(response, this.computeAccessRuleWhere({
158
+ this.addRuleWhere(response, this.safeResolveWhere({
41
159
  where: insert.condition,
42
160
  td,
43
161
  tableAlias: insert.tableName,
@@ -96,7 +214,7 @@ class SqlLayerService {
96
214
  });
97
215
  const mode = 'update';
98
216
  const path = `${this.prefix}.update`;
99
- this.addRuleWhere(response, this.computeAccessRuleWhere({
217
+ this.addRuleWhere(response, this.safeResolveWhere({
100
218
  where: update.where,
101
219
  td,
102
220
  tableAlias: update.tableName,
@@ -142,7 +260,7 @@ class SqlLayerService {
142
260
  });
143
261
  const mode = 'delete';
144
262
  const path = `${this.prefix}.delete`;
145
- this.addRuleWhere(response, this.computeAccessRuleWhere({
263
+ this.addRuleWhere(response, this.safeResolveWhere({
146
264
  where: d.where,
147
265
  td,
148
266
  tableAlias: d.tableName,
@@ -176,7 +294,7 @@ class SqlLayerService {
176
294
  let rules;
177
295
  const getRules = () => {
178
296
  if (!rules) {
179
- rules = this.computeAccessRules({
297
+ rules = this.safeResolveSelect({
180
298
  select,
181
299
  mode: 'select',
182
300
  path: `${this.prefix}.select`,
@@ -195,113 +313,7 @@ class SqlLayerService {
195
313
  throw e;
196
314
  }
197
315
  }
198
- resolveVStr(v, alias, path) {
199
- if (!v) {
200
- return v;
201
- }
202
- const r = v.replace(/\{\{alias\}\}/g, alias);
203
- return r;
204
- }
205
- resolveV({ field, alias, path, user }) {
206
- if (!field) {
207
- return field;
208
- }
209
- if (typeof field === 'string') {
210
- return this.resolveVStr(field, alias, path);
211
- }
212
- if (typeof field === 'number' || typeof field === 'boolean') {
213
- throw new Error(`invalid typeof ${field} === ${typeof field === 'number'}`);
214
- }
215
- if ('function' in field) {
216
- return {
217
- function: field.function,
218
- args: (field.args || []).map(arg => this.resolveV({ field: arg, alias, path, user })),
219
- alias: this.resolveVStr(field.alias, alias, path),
220
- cast: field.cast
221
- };
222
- }
223
- if ('field' in field) {
224
- return {
225
- table: this.resolveVStr(field.table, alias, path),
226
- field: this.resolveV({ field: field.field, alias, path, user }),
227
- alias: this.resolveVStr(field.alias, alias, path),
228
- cast: field.cast
229
- };
230
- }
231
- if ('conditions' in field) {
232
- return {
233
- conditions: field.conditions.map(c => ({
234
- when: this.resolveWhere({ where: c.when, alias, path, user }),
235
- then: this.resolveV({ field: c.then, alias, path, user }),
236
- })),
237
- else: this.resolveV({ field: field.else, alias, path, user }),
238
- alias: field.alias,
239
- cast: field.cast
240
- };
241
- }
242
- if ('exists' in field) {
243
- return {
244
- exists: this.resolveSelect(Object.assign(Object.assign({}, field.exists), { user }), alias, `${path}.e`),
245
- alias: field.alias,
246
- cast: field.cast
247
- };
248
- }
249
- return Object.assign(Object.assign({}, this.resolveSelect(Object.assign(Object.assign({}, field), { user }), alias, `${path}.f`)), { alias: field.alias, cast: field.cast });
250
- }
251
- resolveWhere({ where, alias, path, user, }) {
252
- if (!where) {
253
- return null;
254
- }
255
- const mapWhere = (w, orOrAnd) => {
256
- const r = w[orOrAnd].map((where) => this.resolveWhere({
257
- where,
258
- alias,
259
- path,
260
- user,
261
- }));
262
- return { [orOrAnd]: r };
263
- };
264
- if ('and' in where) {
265
- return mapWhere(where, 'and');
266
- }
267
- else if ('or' in where) {
268
- return mapWhere(where, 'or');
269
- }
270
- else if ('exists' in where) {
271
- return {
272
- exists: this.resolveSelect(Object.assign(Object.assign({}, where.exists), { user }), alias, path)
273
- };
274
- }
275
- else if ('not' in where) {
276
- return {
277
- not: this.resolveWhere({
278
- where: where.not,
279
- alias,
280
- path,
281
- user,
282
- })
283
- };
284
- }
285
- else {
286
- return Object.assign(Object.assign({}, where), { v1: this.resolveV({ field: where.v1, alias, path, user }), v2: this.resolveV({ field: where.v2, alias, path, user }) });
287
- }
288
- }
289
- resolveSelect(select, alias, path) {
290
- return Object.assign(Object.assign({}, select), { join: (select.join || []).map(join => {
291
- return Object.assign(Object.assign({}, join), { on: this.resolveWhere({
292
- where: join.on,
293
- alias,
294
- path,
295
- user: select.user,
296
- }) });
297
- }).map(j => j), where: this.resolveWhere({
298
- where: select.where,
299
- alias,
300
- path,
301
- user: select.user,
302
- }) });
303
- }
304
- computeAccessRuleWhere({ where, td, tableAlias, mode, path, user }) {
316
+ safeResolveWhere({ where, td, tableAlias, mode, path, user }) {
305
317
  this.checkCircularReference(path);
306
318
  const defaultResponse = {
307
319
  args: {},
@@ -312,7 +324,7 @@ class SqlLayerService {
312
324
  return defaultResponse;
313
325
  }
314
326
  if ('exists' in where) {
315
- const rules = this.computeAccessRules({
327
+ const rules = this.safeResolveSelect({
316
328
  select: Object.assign(Object.assign({}, where.exists), { user }),
317
329
  mode: 'select',
318
330
  path: `${path}.e`,
@@ -324,7 +336,7 @@ class SqlLayerService {
324
336
  };
325
337
  }
326
338
  else if ('not' in where) {
327
- const rules = this.computeAccessRuleWhere({
339
+ const rules = this.safeResolveWhere({
328
340
  where: where.not,
329
341
  td,
330
342
  tableAlias,
@@ -342,7 +354,7 @@ class SqlLayerService {
342
354
  }
343
355
  else if ('or' in where) {
344
356
  const or = where.or.map((w, i) => {
345
- return this.computeAccessRuleWhere({
357
+ return this.safeResolveWhere({
346
358
  where: w,
347
359
  td,
348
360
  tableAlias,
@@ -373,7 +385,7 @@ class SqlLayerService {
373
385
  }
374
386
  else if ('and' in where) {
375
387
  const and = where.and.map((w, i) => {
376
- return this.computeAccessRuleWhere({
388
+ return this.safeResolveWhere({
377
389
  where: w,
378
390
  td,
379
391
  tableAlias,
@@ -412,7 +424,7 @@ class SqlLayerService {
412
424
  }
413
425
  }
414
426
  tableRules({ td, alias: tableAlias, path, user, mode }) {
415
- const where = this.resolveWhere({
427
+ const where = this.unsafeResolver.unsafeResolveWhere({
416
428
  where: _.get(td.rules, [mode, 'where']),
417
429
  alias: tableAlias,
418
430
  path,
@@ -421,7 +433,7 @@ class SqlLayerService {
421
433
  if (!where) {
422
434
  return { where: null, args: {}, tables: [] };
423
435
  }
424
- const rules = this.computeAccessRuleWhere({
436
+ const rules = this.safeResolveWhere({
425
437
  where,
426
438
  mode,
427
439
  tableAlias,
@@ -443,7 +455,150 @@ class SqlLayerService {
443
455
  where: rules.where
444
456
  };
445
457
  }
446
- computeAccessRules({ select, mode, path, }) {
458
+ safeResolveValue({ field, td, tableAlias, mode, path, user }) {
459
+ this.checkCircularReference(path);
460
+ if (!field) {
461
+ return {
462
+ field,
463
+ args: {},
464
+ tables: []
465
+ };
466
+ }
467
+ if (typeof field === 'string') {
468
+ return {
469
+ field,
470
+ args: {},
471
+ tables: []
472
+ };
473
+ }
474
+ if (typeof field === 'number' || typeof field === 'boolean') {
475
+ throw new Error(`invalid typeof ${field} === ${typeof field === 'number'}`);
476
+ }
477
+ if ('function' in field) {
478
+ const tables = [];
479
+ const args = {};
480
+ return {
481
+ field: Object.assign(Object.assign({}, field), { args: (field.args || []).map(arg => {
482
+ const resolved = this.safeResolveValue({
483
+ field: arg,
484
+ td,
485
+ tableAlias,
486
+ mode,
487
+ path,
488
+ user
489
+ });
490
+ tables.push(...resolved.tables);
491
+ Object.entries(resolved.args).forEach(([k, v]) => {
492
+ args[k] = v;
493
+ });
494
+ return resolved.field;
495
+ }) }),
496
+ args,
497
+ tables
498
+ };
499
+ }
500
+ if ('field' in field) {
501
+ if (typeof field.field !== 'string') {
502
+ const resolved = this.safeResolveValue({
503
+ field: field.field,
504
+ td,
505
+ tableAlias,
506
+ mode,
507
+ path,
508
+ user
509
+ });
510
+ return {
511
+ field: Object.assign(Object.assign({}, field), { field: resolved.field }),
512
+ args: resolved.args,
513
+ tables: resolved.tables
514
+ };
515
+ }
516
+ if (field.table && typeof field.table !== 'string') {
517
+ throw new Error(`invalid typeof ${field.table} === ${typeof field.table}`);
518
+ }
519
+ if (field.alias && typeof field.alias !== 'string') {
520
+ throw new Error(`invalid typeof ${field.alias} === ${typeof field.alias}`);
521
+ }
522
+ return {
523
+ field: Object.assign(Object.assign({}, field), { table: this.unsafeResolver.unsafeResolveStringValue(field.table, tableAlias, path), field: this.unsafeResolver.unsafeResolveValue({ field: field.field, alias: tableAlias, path, user }), alias: this.unsafeResolver.unsafeResolveStringValue(field.alias, tableAlias, path), cast: field.cast }),
524
+ args: {},
525
+ tables: []
526
+ };
527
+ }
528
+ if ('conditions' in field) {
529
+ const tables = [];
530
+ const args = {};
531
+ return {
532
+ field: Object.assign(Object.assign({}, field), { conditions: field.conditions.map(c => {
533
+ const when = this.safeResolveWhere({
534
+ where: c.when,
535
+ td,
536
+ tableAlias,
537
+ mode,
538
+ path,
539
+ user
540
+ });
541
+ const then = this.safeResolveValue({
542
+ field: c.then,
543
+ td,
544
+ tableAlias,
545
+ mode,
546
+ path,
547
+ user
548
+ });
549
+ tables.push(...when.tables, ...then.tables);
550
+ Object.entries(when.args).forEach(([k, v]) => {
551
+ args[k] = v;
552
+ });
553
+ Object.entries(then.args).forEach(([k, v]) => {
554
+ args[k] = v;
555
+ });
556
+ return {
557
+ when: when.where,
558
+ then: then.field
559
+ };
560
+ }), else: this.safeResolveValue({
561
+ field: field.else,
562
+ td,
563
+ tableAlias,
564
+ mode,
565
+ path,
566
+ user
567
+ }) }),
568
+ args,
569
+ tables
570
+ };
571
+ }
572
+ if ('exists' in field) {
573
+ const tables = [];
574
+ const args = {};
575
+ const resolved = this.safeResolveSelect({
576
+ select: Object.assign(Object.assign({}, field.exists), { user }),
577
+ mode: 'select',
578
+ path: `${path}.e`,
579
+ });
580
+ tables.push(...resolved.tables);
581
+ Object.entries(resolved.args).forEach(([k, v]) => {
582
+ args[k] = v;
583
+ });
584
+ return {
585
+ field: Object.assign(Object.assign({}, field), { exists: resolved.select }),
586
+ args,
587
+ tables
588
+ };
589
+ }
590
+ const resolved = this.safeResolveSelect({
591
+ select: Object.assign(Object.assign({}, field), { user }),
592
+ mode: 'select',
593
+ path: `${path}.f`,
594
+ });
595
+ return {
596
+ field: resolved.select,
597
+ args: resolved.args,
598
+ tables: resolved.tables
599
+ };
600
+ }
601
+ safeResolveSelect({ select, mode, path, }) {
447
602
  this.checkCircularReference(path);
448
603
  const tableName = typeof select.from === 'string' ? select.from : select.from.table;
449
604
  const tableAlias = (typeof select.from === 'string' ? select.from : select.from.alias) || tableName;
@@ -459,7 +614,7 @@ class SqlLayerService {
459
614
  and: []
460
615
  }
461
616
  };
462
- this.addRuleWhere(response, this.computeAccessRuleWhere({
617
+ this.addRuleWhere(response, this.safeResolveWhere({
463
618
  where: select.where,
464
619
  td,
465
620
  tableAlias,
@@ -488,7 +643,7 @@ class SqlLayerService {
488
643
  statementType: 'select',
489
644
  statement: select
490
645
  });
491
- this.addRuleWhere(jResponse, this.computeAccessRuleWhere({
646
+ this.addRuleWhere(jResponse, this.safeResolveWhere({
492
647
  where: join.on,
493
648
  td,
494
649
  tableAlias: jAlias,
@@ -512,7 +667,7 @@ class SqlLayerService {
512
667
  };
513
668
  });
514
669
  const w = (select.with || []).map(w => {
515
- const rules = this.computeAccessRules({
670
+ const rules = this.safeResolveSelect({
516
671
  mode: 'select',
517
672
  path: `${path}.with`,
518
673
  select: Object.assign(Object.assign({}, w.select), { user: select.user })
@@ -525,10 +680,82 @@ class SqlLayerService {
525
680
  });
526
681
  return {
527
682
  select: {
528
- groupBy: select.groupBy,
529
- orderBy: select.orderBy,
530
- fields: select.fields,
531
- query: select.query,
683
+ groupBy: (select.groupBy || []).map(g => {
684
+ const resolved = this.safeResolveValue({
685
+ field: g,
686
+ td,
687
+ tableAlias,
688
+ mode,
689
+ path,
690
+ user: select.user
691
+ });
692
+ this.addRuleWhere(response, {
693
+ args: resolved.args,
694
+ tables: resolved.tables,
695
+ });
696
+ return resolved.field;
697
+ }),
698
+ orderBy: (select.orderBy || []).map(o => {
699
+ const resolved = this.safeResolveValue({
700
+ field: o,
701
+ td,
702
+ tableAlias,
703
+ mode,
704
+ path,
705
+ user: select.user
706
+ });
707
+ this.addRuleWhere(response, {
708
+ args: resolved.args,
709
+ tables: resolved.tables,
710
+ });
711
+ return resolved.field;
712
+ }),
713
+ fields: (select.fields || []).map(f => {
714
+ const resolved = this.safeResolveValue({
715
+ field: f,
716
+ td,
717
+ tableAlias,
718
+ mode,
719
+ path,
720
+ user: select.user
721
+ });
722
+ this.addRuleWhere(response, {
723
+ args: resolved.args,
724
+ tables: resolved.tables,
725
+ });
726
+ return resolved.field;
727
+ }),
728
+ query: (select.query || []).map(q => {
729
+ const resolvedField = this.safeResolveValue({
730
+ field: q.field,
731
+ td,
732
+ tableAlias,
733
+ mode,
734
+ path,
735
+ user: select.user
736
+ });
737
+ this.addRuleWhere(response, {
738
+ args: resolvedField.args,
739
+ tables: resolvedField.tables,
740
+ });
741
+ const resolvedValue = this.safeResolveValue({
742
+ field: q.value,
743
+ td,
744
+ tableAlias,
745
+ mode,
746
+ path,
747
+ user: select.user
748
+ });
749
+ this.addRuleWhere(response, {
750
+ args: resolvedValue.args,
751
+ tables: resolvedValue.tables,
752
+ });
753
+ return {
754
+ field: resolvedField.field,
755
+ value: resolvedValue.field,
756
+ orderByRank: q.orderByRank,
757
+ };
758
+ }),
532
759
  from: select.from,
533
760
  where: helpers_1.simplifyWhere(response.where),
534
761
  join,
@@ -537,7 +764,7 @@ class SqlLayerService {
537
764
  offset: select.offset,
538
765
  user: select.user,
539
766
  forUpdate: select.forUpdate,
540
- with: w,
767
+ with: w
541
768
  },
542
769
  args: response.args,
543
770
  tables: _.uniqBy(response.tables, 'name'),