@loopback/repository 2.11.1 → 3.1.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 (63) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/dist/common-types.d.ts +5 -3
  3. package/dist/common-types.js +9 -3
  4. package/dist/common-types.js.map +1 -1
  5. package/dist/connectors/crud.connector.d.ts +3 -3
  6. package/dist/connectors/kv.connector.d.ts +3 -3
  7. package/dist/decorators/model.decorator.js +7 -0
  8. package/dist/decorators/model.decorator.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +9 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/mixins/repository.mixin.d.ts +9 -3
  13. package/dist/model.d.ts +29 -6
  14. package/dist/model.js.map +1 -1
  15. package/dist/relations/belongs-to/belongs-to.decorator.js +10 -1
  16. package/dist/relations/belongs-to/belongs-to.decorator.js.map +1 -1
  17. package/dist/relations/has-many/has-many-through-repository.factory.d.ts +8 -2
  18. package/dist/relations/has-many/has-many-through-repository.factory.js +6 -0
  19. package/dist/relations/has-many/has-many-through-repository.factory.js.map +1 -1
  20. package/dist/relations/has-many/has-many-through.inclusion.resolver.d.ts +16 -0
  21. package/dist/relations/has-many/has-many-through.inclusion.resolver.js +74 -0
  22. package/dist/relations/has-many/has-many-through.inclusion.resolver.js.map +1 -0
  23. package/dist/relations/has-many/has-many.inclusion-resolver.js.map +1 -1
  24. package/dist/relations/has-many/has-many.repository.d.ts +1 -1
  25. package/dist/relations/has-one/has-one.repository.d.ts +1 -1
  26. package/dist/relations/has-one/has-one.repository.js.map +1 -1
  27. package/dist/relations/relation.helpers.d.ts +2 -2
  28. package/dist/relations/relation.helpers.js +1 -1
  29. package/dist/relations/relation.helpers.js.map +1 -1
  30. package/dist/relations/relation.types.d.ts +1 -1
  31. package/dist/relations/relation.types.js +1 -1
  32. package/dist/repositories/constraint-utils.d.ts +1 -1
  33. package/dist/repositories/constraint-utils.js +4 -4
  34. package/dist/repositories/constraint-utils.js.map +1 -1
  35. package/dist/repositories/legacy-juggler-bridge.d.ts +1 -1
  36. package/dist/repositories/legacy-juggler-bridge.js +1 -1
  37. package/dist/repositories/legacy-juggler-bridge.js.map +1 -1
  38. package/dist/repositories/repository.d.ts +1 -1
  39. package/dist/repositories/repository.js.map +1 -1
  40. package/package.json +16 -12
  41. package/src/common-types.ts +10 -4
  42. package/src/connectors/crud.connector.ts +3 -3
  43. package/src/connectors/kv.connector.ts +3 -3
  44. package/src/decorators/model.decorator.ts +9 -0
  45. package/src/index.ts +1 -1
  46. package/src/model.ts +32 -2
  47. package/src/relations/belongs-to/belongs-to.decorator.ts +21 -5
  48. package/src/relations/belongs-to/belongs-to.inclusion-resolver.ts +1 -1
  49. package/src/relations/has-many/has-many-through-repository.factory.ts +20 -3
  50. package/src/relations/has-many/has-many-through.inclusion.resolver.ts +135 -0
  51. package/src/relations/has-many/has-many.inclusion-resolver.ts +1 -1
  52. package/src/relations/has-many/has-many.repository.ts +1 -1
  53. package/src/relations/has-one/has-one.inclusion-resolver.ts +1 -1
  54. package/src/relations/has-one/has-one.repository.ts +1 -1
  55. package/src/relations/relation.helpers.ts +2 -5
  56. package/src/relations/relation.types.ts +1 -1
  57. package/src/repositories/constraint-utils.ts +1 -1
  58. package/src/repositories/legacy-juggler-bridge.ts +8 -7
  59. package/src/repositories/repository.ts +3 -2
  60. package/dist/query.d.ts +0 -382
  61. package/dist/query.js +0 -487
  62. package/dist/query.js.map +0 -1
  63. package/src/query.ts +0 -729
package/dist/query.js DELETED
@@ -1,487 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2017,2020. All Rights Reserved.
3
- // Node module: @loopback/repository
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.filterTemplate = exports.FilterBuilder = exports.WhereBuilder = exports.isFilter = void 0;
8
- const tslib_1 = require("tslib");
9
- const assert_1 = tslib_1.__importDefault(require("assert"));
10
- /* eslint-disable @typescript-eslint/no-explicit-any */
11
- const nonWhereFields = [
12
- 'fields',
13
- 'order',
14
- 'limit',
15
- 'skip',
16
- 'offset',
17
- 'include',
18
- ];
19
- const filterFields = ['where', ...nonWhereFields];
20
- /**
21
- * TypeGuard for Filter
22
- * @param candidate
23
- */
24
- function isFilter(candidate) {
25
- if (typeof candidate !== 'object')
26
- return false;
27
- for (const key in candidate) {
28
- if (!filterFields.includes(key)) {
29
- return false;
30
- }
31
- }
32
- return true;
33
- }
34
- exports.isFilter = isFilter;
35
- /**
36
- * A builder for Where object. It provides fluent APIs to add clauses such as
37
- * `and`, `or`, and other operators.
38
- *
39
- * @example
40
- * ```ts
41
- * const whereBuilder = new WhereBuilder();
42
- * const where = whereBuilder
43
- * .eq('a', 1)
44
- * .and({x: 'x'}, {y: {gt: 1}})
45
- * .and({b: 'b'}, {c: {lt: 1}})
46
- * .or({d: 'd'}, {e: {neq: 1}})
47
- * .build();
48
- * ```
49
- */
50
- class WhereBuilder {
51
- constructor(w) {
52
- this.where = w !== null && w !== void 0 ? w : {};
53
- }
54
- add(w) {
55
- for (const k of Object.keys(w)) {
56
- if (k in this.where) {
57
- // Found conflicting keys, create an `and` operator to join the existing
58
- // conditions with the new one
59
- const where = { and: [this.where, w] };
60
- this.where = where;
61
- return this;
62
- }
63
- }
64
- // Merge the where items
65
- this.where = Object.assign(this.where, w);
66
- return this;
67
- }
68
- /**
69
- * @deprecated
70
- * Starting from TypeScript 3.2, we don't have to cast any more. This method
71
- * should be considered as `deprecated`.
72
- *
73
- * Cast an `and`, `or`, or condition clause to Where
74
- * @param clause - And/Or/Condition clause
75
- */
76
- cast(clause) {
77
- return clause;
78
- }
79
- /**
80
- * Add an `and` clause.
81
- * @param w - One or more where objects
82
- */
83
- and(...w) {
84
- let clauses = [];
85
- w.forEach(where => {
86
- clauses = clauses.concat(Array.isArray(where) ? where : [where]);
87
- });
88
- return this.add({ and: clauses });
89
- }
90
- /**
91
- * Add an `or` clause.
92
- * @param w - One or more where objects
93
- */
94
- or(...w) {
95
- let clauses = [];
96
- w.forEach(where => {
97
- clauses = clauses.concat(Array.isArray(where) ? where : [where]);
98
- });
99
- return this.add({ or: clauses });
100
- }
101
- /**
102
- * Add an `=` condition
103
- * @param key - Property name
104
- * @param val - Property value
105
- */
106
- eq(key, val) {
107
- const w = {};
108
- w[key] = val;
109
- return this.add(w);
110
- }
111
- /**
112
- * Add a `!=` condition
113
- * @param key - Property name
114
- * @param val - Property value
115
- */
116
- neq(key, val) {
117
- const w = {};
118
- w[key] = { neq: val };
119
- return this.add(w);
120
- }
121
- /**
122
- * Add a `>` condition
123
- * @param key - Property name
124
- * @param val - Property value
125
- */
126
- gt(key, val) {
127
- const w = {};
128
- w[key] = { gt: val };
129
- return this.add(w);
130
- }
131
- /**
132
- * Add a `>=` condition
133
- * @param key - Property name
134
- * @param val - Property value
135
- */
136
- gte(key, val) {
137
- const w = {};
138
- w[key] = { gte: val };
139
- return this.add(w);
140
- }
141
- /**
142
- * Add a `<` condition
143
- * @param key - Property name
144
- * @param val - Property value
145
- */
146
- lt(key, val) {
147
- const w = {};
148
- w[key] = { lt: val };
149
- return this.add(w);
150
- }
151
- /**
152
- * Add a `<=` condition
153
- * @param key - Property name
154
- * @param val - Property value
155
- */
156
- lte(key, val) {
157
- const w = {};
158
- w[key] = { lte: val };
159
- return this.add(w);
160
- }
161
- /**
162
- * Add a `inq` condition
163
- * @param key - Property name
164
- * @param val - An array of property values
165
- */
166
- inq(key, val) {
167
- const w = {};
168
- w[key] = { inq: val };
169
- return this.add(w);
170
- }
171
- /**
172
- * Add a `nin` condition
173
- * @param key - Property name
174
- * @param val - An array of property values
175
- */
176
- nin(key, val) {
177
- const w = {};
178
- w[key] = { nin: val };
179
- return this.add(w);
180
- }
181
- /**
182
- * Add a `between` condition
183
- * @param key - Property name
184
- * @param val1 - Property value lower bound
185
- * @param val2 - Property value upper bound
186
- */
187
- between(key, val1, val2) {
188
- const w = {};
189
- w[key] = { between: [val1, val2] };
190
- return this.add(w);
191
- }
192
- /**
193
- * Add a `exists` condition
194
- * @param key - Property name
195
- * @param val - Exists or not
196
- */
197
- exists(key, val) {
198
- const w = {};
199
- w[key] = { exists: !!val || val == null };
200
- return this.add(w);
201
- }
202
- /**
203
- * Add a where object. For conflicting keys with the existing where object,
204
- * create an `and` clause.
205
- * @param where - Where filter
206
- */
207
- impose(where) {
208
- if (!this.where) {
209
- this.where = where || {};
210
- }
211
- else {
212
- this.add(where);
213
- }
214
- return this;
215
- }
216
- /**
217
- * Add a `like` condition
218
- * @param key - Property name
219
- * @param val - Regexp condition
220
- */
221
- like(key, val) {
222
- const w = {};
223
- w[key] = { like: val };
224
- return this.add(w);
225
- }
226
- /**
227
- * Add a `nlike` condition
228
- * @param key - Property name
229
- * @param val - Regexp condition
230
- */
231
- nlike(key, val) {
232
- const w = {};
233
- w[key] = { nlike: val };
234
- return this.add(w);
235
- }
236
- /**
237
- * Add a `ilike` condition
238
- * @param key - Property name
239
- * @param val - Regexp condition
240
- */
241
- ilike(key, val) {
242
- const w = {};
243
- w[key] = { ilike: val };
244
- return this.add(w);
245
- }
246
- /**
247
- * Add a `nilike` condition
248
- * @param key - Property name
249
- * @param val - Regexp condition
250
- */
251
- nilike(key, val) {
252
- const w = {};
253
- w[key] = { nilike: val };
254
- return this.add(w);
255
- }
256
- /**
257
- * Add a `regexp` condition
258
- * @param key - Property name
259
- * @param val - Regexp condition
260
- */
261
- regexp(key, val) {
262
- const w = {};
263
- w[key] = { regexp: val };
264
- return this.add(w);
265
- }
266
- /**
267
- * Get the where object
268
- */
269
- build() {
270
- return this.where;
271
- }
272
- }
273
- exports.WhereBuilder = WhereBuilder;
274
- /**
275
- * A builder for Filter. It provides fleunt APIs to add clauses such as
276
- * `fields`, `order`, `where`, `limit`, `offset`, and `include`.
277
- *
278
- * @example
279
- * ```ts
280
- * const filterBuilder = new FilterBuilder();
281
- * const filter = filterBuilder
282
- * .fields('id', a', 'b')
283
- * .limit(10)
284
- * .offset(0)
285
- * .order(['a ASC', 'b DESC'])
286
- * .where({id: 1})
287
- * .build();
288
- * ```
289
- */
290
- class FilterBuilder {
291
- constructor(f) {
292
- this.filter = f !== null && f !== void 0 ? f : {};
293
- }
294
- /**
295
- * Set `limit`
296
- * @param limit - Maximum number of records to be returned
297
- */
298
- limit(limit) {
299
- assert_1.default(limit >= 1, `Limit ${limit} must a positive number`);
300
- this.filter.limit = limit;
301
- return this;
302
- }
303
- /**
304
- * Set `offset`
305
- * @param offset - Offset of the number of records to be returned
306
- */
307
- offset(offset) {
308
- this.filter.offset = offset;
309
- return this;
310
- }
311
- /**
312
- * Alias to `offset`
313
- * @param skip
314
- */
315
- skip(skip) {
316
- return this.offset(skip);
317
- }
318
- /**
319
- * Describe what fields to be included/excluded
320
- * @param f - A field name to be included, an array of field names to be
321
- * included, or an Fields object for the inclusion/exclusion
322
- */
323
- fields(...f) {
324
- if (!this.filter.fields) {
325
- this.filter.fields = {};
326
- }
327
- const fields = this.filter.fields;
328
- for (const field of f) {
329
- if (Array.isArray(field)) {
330
- field.forEach(i => (fields[i] = true));
331
- }
332
- else if (typeof field === 'string') {
333
- fields[field] = true;
334
- }
335
- else {
336
- Object.assign(fields, field);
337
- }
338
- }
339
- return this;
340
- }
341
- validateOrder(order) {
342
- assert_1.default(order.match(/^[^\s]+( (ASC|DESC))?$/), 'Invalid order: ' + order);
343
- }
344
- /**
345
- * Describe the sorting order
346
- * @param o - A field name with optional direction, an array of field names,
347
- * or an Order object for the field/direction pairs
348
- */
349
- order(...o) {
350
- if (!this.filter.order) {
351
- this.filter.order = [];
352
- }
353
- o.forEach(order => {
354
- if (typeof order === 'string') {
355
- this.validateOrder(order);
356
- if (!order.endsWith(' ASC') && !order.endsWith(' DESC')) {
357
- order = order + ' ASC';
358
- }
359
- this.filter.order.push(order);
360
- return this;
361
- }
362
- if (Array.isArray(order)) {
363
- order.forEach(this.validateOrder);
364
- order = order.map(i => {
365
- if (!i.endsWith(' ASC') && !i.endsWith(' DESC')) {
366
- i = i + ' ASC';
367
- }
368
- return i;
369
- });
370
- this.filter.order = this.filter.order.concat(order);
371
- return this;
372
- }
373
- for (const i in order) {
374
- this.filter.order.push(`${i} ${order[i]}`);
375
- }
376
- });
377
- return this;
378
- }
379
- /**
380
- * Declare `include`
381
- * @param i - A relation name, an array of relation names, or an `Inclusion`
382
- * object for the relation/scope definitions
383
- */
384
- include(...i) {
385
- if (this.filter.include == null) {
386
- this.filter.include = [];
387
- }
388
- for (const include of i) {
389
- if (typeof include === 'string') {
390
- this.filter.include.push({ relation: include });
391
- }
392
- else if (Array.isArray(include)) {
393
- for (const inc of include)
394
- this.filter.include.push({ relation: inc });
395
- }
396
- else {
397
- this.filter.include.push(include);
398
- }
399
- }
400
- return this;
401
- }
402
- /**
403
- * Declare a where clause
404
- * @param w - Where object
405
- */
406
- where(w) {
407
- this.filter.where = w;
408
- return this;
409
- }
410
- /**
411
- * Add a Filter or Where constraint object. If it is a filter object, create
412
- * an `and` clause for conflicting keys with its where object. For any other
413
- * properties, throw an error. If it's not a Filter, coerce it to a filter,
414
- * and carry out the same logic.
415
- *
416
- * @param constraint - a constraint object to merge with own filter object
417
- */
418
- impose(constraint) {
419
- if (!this.filter) {
420
- // if constraint is a Where, turn into a Filter
421
- if (!isFilter(constraint)) {
422
- constraint = { where: constraint };
423
- }
424
- this.filter = constraint || {};
425
- }
426
- else {
427
- if (isFilter(constraint)) {
428
- // throw error if imposed Filter has non-where fields
429
- for (const key of Object.keys(constraint)) {
430
- if (nonWhereFields.includes(key)) {
431
- throw new Error('merging strategy for selection, pagination, and sorting not implemented');
432
- }
433
- }
434
- }
435
- this.filter.where = isFilter(constraint)
436
- ? new WhereBuilder(this.filter.where).impose(constraint.where).build()
437
- : new WhereBuilder(this.filter.where).impose(constraint).build();
438
- }
439
- return this;
440
- }
441
- /**
442
- * Return the filter object
443
- */
444
- build() {
445
- return this.filter;
446
- }
447
- }
448
- exports.FilterBuilder = FilterBuilder;
449
- /**
450
- * Get nested properties by path
451
- * @param value - Value of an object
452
- * @param path - Path to the property
453
- */
454
- function getDeepProperty(value, path) {
455
- const props = path.split('.');
456
- for (const p of props) {
457
- value = value[p];
458
- if (value == null) {
459
- return null;
460
- }
461
- }
462
- return value;
463
- }
464
- function filterTemplate(strings, ...keys) {
465
- return function filter(ctx) {
466
- const tokens = [strings[0]];
467
- keys.forEach((key, i) => {
468
- if (typeof key === 'object' ||
469
- typeof key === 'boolean' ||
470
- typeof key === 'number') {
471
- tokens.push(JSON.stringify(key), strings[i + 1]);
472
- return;
473
- }
474
- const value = getDeepProperty(ctx, key);
475
- tokens.push(JSON.stringify(value), strings[i + 1]);
476
- });
477
- const result = tokens.join('');
478
- try {
479
- return JSON.parse(result);
480
- }
481
- catch (e) {
482
- throw new Error('Invalid JSON: ' + result);
483
- }
484
- };
485
- }
486
- exports.filterTemplate = filterTemplate;
487
- //# sourceMappingURL=query.js.map
package/dist/query.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,4DAA4B;AAG5B,uDAAuD;AAEvD,MAAM,cAAc,GAAG;IACrB,QAAQ;IACR,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;CACV,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAC;AAoNlD;;;GAGG;AACH,SAAgB,QAAQ,CACtB,SAAc;IAEd,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAChD,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE;QAC3B,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC/B,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;A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