@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/CHANGELOG.md CHANGED
@@ -3,6 +3,72 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.1.0](https://github.com/strongloop/loopback-next/compare/@loopback/repository@3.0.1...@loopback/repository@3.1.0) (2020-10-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * tidy up type inferences for OpenAPI SchemaObject ([013bb7e](https://github.com/strongloop/loopback-next/commit/013bb7e4c0f7499a7f77c152dea7caa14e19b7cc))
12
+
13
+
14
+ ### Features
15
+
16
+ * **repository:** implement hasManyThrough resolver ([8e7767d](https://github.com/strongloop/loopback-next/commit/8e7767df0a4679c8c70ad524e56aea9783def521))
17
+
18
+
19
+
20
+
21
+
22
+ ## [3.0.1](https://github.com/strongloop/loopback-next/compare/@loopback/repository@3.0.0...@loopback/repository@3.0.1) (2020-09-17)
23
+
24
+ **Note:** Version bump only for package @loopback/repository
25
+
26
+
27
+
28
+
29
+
30
+ # [3.0.0](https://github.com/strongloop/loopback-next/compare/@loopback/repository@2.11.2...@loopback/repository@3.0.0) (2020-09-15)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * improve handling of missing design-time type metadata ([95b6a2b](https://github.com/strongloop/loopback-next/commit/95b6a2b7ce64e614720df43b905f77a53a54e438))
36
+
37
+
38
+ ### Features
39
+
40
+ * **repository:** add types to the configuration for autocompletion ([6fbf23d](https://github.com/strongloop/loopback-next/commit/6fbf23d3e6366a99ee0ff543fd05fe15bdb711ca))
41
+ * move framework packages to `devDependencies` ([e2c61ce](https://github.com/strongloop/loopback-next/commit/e2c61ce79aa68d76f6e7138642034160b50063f0))
42
+ * refactor filters into standalone package ([f52d4df](https://github.com/strongloop/loopback-next/commit/f52d4dffb1873446e3eec4d6c0f50bbeb528c922)), closes [#5957](https://github.com/strongloop/loopback-next/issues/5957)
43
+
44
+
45
+ ### BREAKING CHANGES
46
+
47
+ * components no longer install core framework packages as
48
+ their own dependencies, they use the framework packages provided by the
49
+ target application instead.
50
+
51
+ If you are getting `npm install` errors after upgrade, then make sure
52
+ your project lists all dependencies required by the extensions you are
53
+ using.
54
+
55
+ Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
56
+
57
+
58
+
59
+
60
+
61
+ ## [2.11.2](https://github.com/strongloop/loopback-next/compare/@loopback/repository@2.11.1...@loopback/repository@2.11.2) (2020-08-27)
62
+
63
+
64
+ ### Bug Fixes
65
+
66
+ * **repository:** fix test case for repository.execute ([ff0c969](https://github.com/strongloop/loopback-next/commit/ff0c969b441030cc21c0d2e6413ab6b1943f2281))
67
+
68
+
69
+
70
+
71
+
6
72
  ## [2.11.1](https://github.com/strongloop/loopback-next/compare/@loopback/repository@2.11.0...@loopback/repository@2.11.1) (2020-08-19)
7
73
 
8
74
 
@@ -72,15 +72,17 @@ export interface Count {
72
72
  }
73
73
  /**
74
74
  * JSON Schema describing the Count interface. It's the response type for
75
- * REST calls to APIs which return Count
75
+ * REST calls to APIs which return `count`. The type is compatible with
76
+ * `SchemaObject` from `@loopback/openapi-v3`, which is not an explicit
77
+ * dependency for `@loopback/repository`.
76
78
  */
77
79
  export declare const CountSchema: {
78
- type: string;
80
+ type: "object";
79
81
  title: string;
80
82
  'x-typescript-type': string;
81
83
  properties: {
82
84
  count: {
83
- type: string;
85
+ type: "number";
84
86
  };
85
87
  };
86
88
  };
@@ -7,12 +7,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.CountSchema = void 0;
8
8
  /**
9
9
  * JSON Schema describing the Count interface. It's the response type for
10
- * REST calls to APIs which return Count
10
+ * REST calls to APIs which return `count`. The type is compatible with
11
+ * `SchemaObject` from `@loopback/openapi-v3`, which is not an explicit
12
+ * dependency for `@loopback/repository`.
11
13
  */
12
- exports.CountSchema = {
14
+ exports.CountSchema /* :SchemaObject */ = {
13
15
  type: 'object',
14
16
  title: 'loopback.Count',
15
17
  'x-typescript-type': '@loopback/repository#Count',
16
- properties: { count: { type: 'number' } },
18
+ properties: {
19
+ count: {
20
+ type: 'number',
21
+ },
22
+ },
17
23
  };
18
24
  //# sourceMappingURL=common-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common-types.js","sourceRoot":"","sources":["../src/common-types.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AA6FhE;;;GAGG;AACU,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,gBAAgB;IACvB,mBAAmB,EAAE,4BAA4B;IACjD,UAAU,EAAE,EAAC,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC;CACtC,CAAC"}
1
+ {"version":3,"file":"common-types.js","sourceRoot":"","sources":["../src/common-types.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AA6FhE;;;;;GAKG;AACU,QAAA,WAAW,CAAC,mBAAmB,GAAG;IAC7C,IAAI,EAAE,QAAiB;IACvB,KAAK,EAAE,gBAAgB;IACvB,mBAAmB,EAAE,4BAA4B;IACjD,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,QAAiB;SACxB;KACF;CACF,CAAC"}
@@ -1,7 +1,7 @@
1
- import { Connector } from './connector';
1
+ import { Filter, Where } from '@loopback/filter';
2
+ import { Class, Count, Options } from '../common-types';
2
3
  import { Entity, EntityData } from '../model';
3
- import { Filter, Where } from '../query';
4
- import { Class, Options, Count } from '../common-types';
4
+ import { Connector } from './connector';
5
5
  /**
6
6
  * CRUD operations for connector implementations
7
7
  */
@@ -1,7 +1,7 @@
1
- import { Connector } from './connector';
2
- import { Entity, EntityData } from '../model';
1
+ import { Filter } from '@loopback/filter';
3
2
  import { Class, Options } from '../common-types';
4
- import { Filter } from '../query';
3
+ import { Entity, EntityData } from '../model';
4
+ import { Connector } from './connector';
5
5
  /**
6
6
  * Key/Value operations for connector implementations
7
7
  */
@@ -53,6 +53,13 @@ function buildModelDefinition(target, def) {
53
53
  const propertyDef = propertyMap[p];
54
54
  const designType = core_1.MetadataInspector.getDesignTypeForProperty(prototype, p);
55
55
  if (!propertyDef.type) {
56
+ if (!designType) {
57
+ const err = new Error(`The definition of model property ${modelDef.name}.${p} is missing ` +
58
+ '`type` field and TypeScript did not provide any design-time type. ' +
59
+ 'Learn more at https://loopback.io/doc/en/lb4/Error-codes.html#cannot_infer_property_type');
60
+ err.code = 'CANNOT_INFER_PROPERTY_TYPE';
61
+ throw err;
62
+ }
56
63
  propertyDef.type = designType;
57
64
  }
58
65
  modelDef.addProperty(p, propertyDef);
@@ -1 +1 @@
1
- {"version":3,"file":"model.decorator.js","sourceRoot":"","sources":["../../src/decorators/model.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,yCAMwB;AACxB,oCAMkB;AAClB,wEAA8D;AAEjD,QAAA,SAAS,GAAG,uBAAgB,CAAC,MAAM,CAG9C,gBAAgB,CAAC,CAAC;AACP,QAAA,oBAAoB,GAAG,uBAAgB,CAAC,MAAM,CAGzD,2BAA2B,CAAC,CAAC;AAClB,QAAA,yBAAyB,GAAG,uBAAgB,CAAC,MAAM,CAG9D,+BAA+B,CAAC,CAAC;AAInC;;;;GAIG;AACH,SAAgB,KAAK,CAAC,UAA2C;IAC/D,OAAO,UAAU,MAAiD;;QAChE,UAAU,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,CAAC;QAC9B,MAAM,GAAG,GAA0B,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;YAC3D,IAAI,QAAE,UAAU,CAAC,IAAI,mCAAI,MAAM,CAAC,IAAI;SACrC,CAAC,CAAC;QACH,MAAM,SAAS,GAAG,4BAAqB,CAAC,eAAe,CACrD,iBAAS,EACT,UAAU,EACV,EAAC,aAAa,EAAE,QAAQ,EAAC,CAC1B,CAAC;QAEF,SAAS,CAAC,MAAM,CAAC,CAAC;QAElB,4DAA4D;QAC5D,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC;AAjBD,sBAiBC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAClC,MAA6D,EAC7D,GAA2B;;IAE3B,4EAA4E;IAC5E,SAAS;IACT,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CA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MC;AAED,WAAiB,QAAQ;IACV,2BAAkB,GAC7B,qDAAqD,CAAC;IAC3C,oBAAW,GAAG,6CAA6C,CAAC;IAEzE;;;;;;OAMG;IACH,SAAgB,KAAK,CACnB,QAAsB,EACtB,UAAwC;QAExC,OAAO,UAAU,MAAc,EAAE,YAAoB;YACnD,MAAM,QAAQ,GAAG,wBAAiB,CAAC,wBAAwB,CACzD,MAAM,EACN,YAAY,CACb,CAAC;YACF,IAAI,QAAQ,KAAK,KAAK,EAAE;gBACtB,MAAM,IAAI,KAAK,CAAC,SAAA,kBAAkB,CAAC,CAAC;aACrC;iBAAM;gBACL,QAAQ,CACN,MAAM,CAAC,MAAM,CACX,EAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAgC,EACtD,UAAU,CACX,CACF,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;aACzB;QACH,CAAC,CAAC;IACJ,CAAC;IApBe,cAAK,QAoBpB,CAAA;AACH,CAAC,EAjCgB,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAiCxB"}
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
+ export * from '@loopback/filter';
9
10
  export { JSONSchema7 as JsonSchema } from 'json-schema';
10
11
  export * from './common-types';
11
12
  export * from './connectors';
@@ -17,7 +18,6 @@ export * from './errors';
17
18
  export * from './keys';
18
19
  export * from './mixins';
19
20
  export * from './model';
20
- export * from './query';
21
21
  export * from './relations';
22
22
  export * from './repositories';
23
23
  export * from './transaction';
package/dist/index.js CHANGED
@@ -5,6 +5,15 @@
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const tslib_1 = require("tslib");
8
+ /**
9
+ * A common set of interfaces for interacting with databases.
10
+ *
11
+ * This module provides data access facilities to various databases and services
12
+ * as well as the constructs for modeling and accessing those data.
13
+ *
14
+ * @packageDocumentation
15
+ */
16
+ tslib_1.__exportStar(require("@loopback/filter"), exports);
8
17
  tslib_1.__exportStar(require("./common-types"), exports);
9
18
  tslib_1.__exportStar(require("./connectors"), exports);
10
19
  tslib_1.__exportStar(require("./datasource"), exports);
@@ -15,7 +24,6 @@ tslib_1.__exportStar(require("./errors"), exports);
15
24
  tslib_1.__exportStar(require("./keys"), exports);
16
25
  tslib_1.__exportStar(require("./mixins"), exports);
17
26
  tslib_1.__exportStar(require("./model"), exports);
18
- tslib_1.__exportStar(require("./query"), exports);
19
27
  tslib_1.__exportStar(require("./relations"), exports);
20
28
  tslib_1.__exportStar(require("./repositories"), exports);
21
29
  tslib_1.__exportStar(require("./transaction"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAYhE,yDAA+B;AAC/B,uDAA6B;AAC7B,uDAA6B;AAC7B,uDAA6B;AAC7B,+DAAqC;AACrC,oEAA0C;AAC1C,mDAAyB;AACzB,iDAAuB;AACvB,mDAAyB;AACzB,kDAAwB;AACxB,kDAAwB;AACxB,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,0DAAgC;AAChC,kDAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE;;;;;;;GAOG;AAEH,2DAAiC;AAEjC,yDAA+B;AAC/B,uDAA6B;AAC7B,uDAA6B;AAC7B,uDAA6B;AAC7B,+DAAqC;AACrC,oEAA0C;AAC1C,mDAAyB;AACzB,iDAAuB;AACvB,mDAAyB;AACzB,kDAAwB;AACxB,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,0DAAgC;AAChC,kDAAwB"}
@@ -1,4 +1,4 @@
1
- import { Binding, BindingFromClassOptions } from '@loopback/core';
1
+ import { Binding, BindingFromClassOptions, BindingScope } from '@loopback/core';
2
2
  import { Application, Component, Constructor, MixinTarget } from '@loopback/core';
3
3
  import { Class } from '../common-types';
4
4
  import { SchemaMigrationOptions } from '../datasource';
@@ -155,13 +155,16 @@ export declare function RepositoryMixin<T extends MixinTarget<Application>>(supe
155
155
  servers: <T_3 extends loopbackContext.Server>(ctors: Constructor<T_3>[]) => Binding<any>[];
156
156
  getServer: <T_4 extends loopbackContext.Server>(target: string | Constructor<T_4>) => Promise<T_4>;
157
157
  start: () => Promise<void>;
158
+ onStart: (fn: () => void | PromiseLike<void>) => Binding<loopbackContext.LifeCycleObserver>;
158
159
  stop: () => Promise<void>;
160
+ onStop: (fn: () => void | PromiseLike<void>) => Binding<loopbackContext.LifeCycleObserver>;
159
161
  setMetadata: (metadata: loopbackContext.ApplicationMetadata) => void;
160
162
  lifeCycleObserver: <T_5 extends loopbackContext.LifeCycleObserver>(ctor: Constructor<T_5>, nameOrOptions?: string | BindingFromClassOptions | undefined) => Binding<T_5>;
161
- service: <S>(cls: Constructor<S | loopbackContext.Provider<S>>, nameOrOptions?: string | loopbackContext.ServiceOptions | undefined) => Binding<S>;
163
+ service: <S>(cls: loopbackContext.ServiceOrProviderClass<S>, nameOrOptions?: string | loopbackContext.ServiceOptions | undefined) => Binding<S>;
162
164
  interceptor: (interceptor: loopbackContext.Interceptor | Constructor<loopbackContext.Provider<loopbackContext.Interceptor>>, nameOrOptions?: string | loopbackContext.InterceptorBindingOptions | undefined) => Binding<loopbackContext.Interceptor>;
163
165
  readonly name: string;
164
166
  readonly subscriptionManager: loopbackContext.ContextSubscriptionManager;
167
+ scope: BindingScope;
165
168
  readonly parent: loopbackContext.Context | undefined;
166
169
  emitEvent: <T_6 extends loopbackContext.ContextEvent>(type: string, event: T_6) => void;
167
170
  emitError: (err: unknown) => void;
@@ -179,7 +182,10 @@ export declare function RepositoryMixin<T extends MixinTarget<Application>>(supe
179
182
  createView: <T_7 = unknown>(filter: loopbackContext.BindingFilter, comparator?: loopbackContext.BindingComparator | undefined) => loopbackContext.ContextView<T_7>;
180
183
  contains: (key: loopbackContext.BindingAddress<unknown>) => boolean;
181
184
  isBound: (key: loopbackContext.BindingAddress<unknown>) => boolean;
182
- getOwnerContext: (key: loopbackContext.BindingAddress<unknown>) => loopbackContext.Context | undefined;
185
+ getOwnerContext: (keyOrBinding: string | loopbackContext.BindingKey<unknown> | Readonly<Binding<unknown>>) => loopbackContext.Context | undefined;
186
+ getScopedContext: (scope: BindingScope.APPLICATION | BindingScope.SERVER | BindingScope.REQUEST) => loopbackContext.Context | undefined;
187
+ getResolutionContext: (binding: Readonly<Binding<unknown>>) => loopbackContext.Context | undefined;
188
+ isVisibleTo: (ctx: loopbackContext.Context) => boolean;
183
189
  find: <ValueType_1 = any>(pattern?: string | RegExp | loopbackContext.BindingFilter | undefined) => Readonly<Binding<ValueType_1>>[];
184
190
  findByTag: <ValueType_2 = any>(tagFilter: string | RegExp | Record<string, any>) => Readonly<Binding<ValueType_2>>[];
185
191
  get: {
package/dist/model.d.ts CHANGED
@@ -23,6 +23,33 @@ export interface PropertyDefinition {
23
23
  itemType?: PropertyType;
24
24
  [attribute: string]: any;
25
25
  }
26
+ /**
27
+ * Defining the settings for a model
28
+ * See https://loopback.io/doc/en/lb4/Model.html#supported-entries-of-model-definition
29
+ */
30
+ export interface ModelSettings {
31
+ /**
32
+ * Description of the model
33
+ */
34
+ description?: string;
35
+ /**
36
+ * Prevent clients from setting the auto-generated ID value manually
37
+ */
38
+ forceId?: boolean;
39
+ /**
40
+ * Hides properties from response bodies
41
+ */
42
+ hiddenProperties?: string[];
43
+ /**
44
+ * Scope enables you to set a scope that will apply to every query made by the model's repository
45
+ */
46
+ scope?: object;
47
+ /**
48
+ * Specifies whether the model accepts only predefined properties or not
49
+ */
50
+ strict?: boolean | 'filter';
51
+ [name: string]: any;
52
+ }
26
53
  /**
27
54
  * See https://github.com/strongloop/loopback-datasource-juggler/issues/432
28
55
  */
@@ -46,9 +73,7 @@ export interface ModelDefinitionSyntax {
46
73
  properties?: {
47
74
  [name: string]: PropertyDefinition | PropertyType;
48
75
  };
49
- settings?: {
50
- [name: string]: any;
51
- };
76
+ settings?: ModelSettings;
52
77
  relations?: RelationDefinitionMap;
53
78
  jsonSchema?: JsonSchemaWithExtensions;
54
79
  [attribute: string]: any;
@@ -61,9 +86,7 @@ export declare class ModelDefinition {
61
86
  properties: {
62
87
  [name: string]: PropertyDefinition;
63
88
  };
64
- settings: {
65
- [name: string]: any;
66
- };
89
+ settings: ModelSettings;
67
90
  relations: RelationDefinitionMap;
68
91
  [attribute: string]: any;
69
92
  constructor(nameOrDef: string | ModelDefinitionSyntax);
package/dist/model.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAGhE,mCAOiB;AAiEjB;;GAEG;AACH,MAAa,eAAe;IAQ1B,YAAY,SAAyC;QACnD,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YACjC,SAAS,GAAG,EAAC,IAAI,EAAE,SAAS,EAAC,CAAC;SAC/B;QACD,MAAM,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAC,GAAG,SAAS,CAAC;QAE1D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,UAAU,EAAE;YACd,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE;gBAC1B,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;aACpC;SACF;QAED,IAAI,CAAC,QAAQ,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,IAAI,GAAG,EAAE,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,SAAS,aAAT,SA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/C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;SACxB;aAAM;YACL,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;gBAC5B,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;aAC5B;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAxED,wBAwEC;AAED;;GAEG;AACH,MAAa,KAAK;CAGjB;AAHD,sBAGC;AAMD;;;;;;;GAOG;AACH,SAAgB,kCAAkC,CAChD,UAAa,EACb,IAAgC;IAEhC,MAAM,GAAG,GAAG,UAAU,CAAC,UAAU,CAAC;IAClC,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC;IAE7B,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,SAAS,EAAE;QAC7B,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACtC,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC;YAAE,SAAS;QAEjC,IAAI,GAAG,GACL,wDAAwD;YACxD,WAAW,UAAU,CAAC,SAAS,eAAe,OAAO,MAAM;YAC3D,mBAAmB,CAAC;QAEtB,IAAI,OAAO,IAAI,KAAK,EAAE;YACpB,GAAG;gBACD,iEAAiE;oBACjE,+DAA+D,CAAC;SACnE;QAED,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;KACtB;AACH,CAAC;AAxBD,gFAwBC"}
@@ -19,12 +19,21 @@ const relation_types_1 = require("../relation.types");
19
19
  */
20
20
  function belongsTo(targetResolver, definition, propertyDefinition) {
21
21
  return function (decoratedTarget, decoratedKey) {
22
+ var _a;
23
+ const propType = (_a = core_1.MetadataInspector.getDesignTypeForProperty(decoratedTarget, decoratedKey)) !== null && _a !== void 0 ? _a : propertyDefinition === null || propertyDefinition === void 0 ? void 0 : propertyDefinition.type;
24
+ if (!propType) {
25
+ const fullPropName = core_1.DecoratorFactory.getTargetName(decoratedTarget, decoratedKey);
26
+ throw new Error(`Cannot infer type of model property ${fullPropName} because ` +
27
+ 'TypeScript compiler option `emitDecoratorMetadata` is not set. ' +
28
+ 'Please enable `emitDecoratorMetadata` or use the third argument of ' +
29
+ '`@belongsTo` decorator to specify the property type explicitly.');
30
+ }
22
31
  const propMeta = Object.assign({},
23
32
  // properties provided by the caller
24
33
  propertyDefinition,
25
34
  // properties enforced by the decorator
26
35
  {
27
- type: core_1.MetadataInspector.getDesignTypeForProperty(decoratedTarget, decoratedKey),
36
+ type: propType,
28
37
  });
29
38
  model_decorator_1.property(propMeta)(decoratedTarget, decoratedKey);
30
39
  // @belongsTo() is typically decorating the foreign key property,
@@ -1 +1 @@
1
- {"version":3,"file":"belongs-to.decorator.js","sourceRoot":"","sources":["../../../src/relations/belongs-to/belongs-to.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,yCAAiD;AACjD,sEAA0D;AAE1D,8DAA+C;AAC/C,sDAAoE;AAEpE;;;;;;;GAOG;AACH,SAAgB,SAAS,CACvB,cAAiC,EACjC,UAAyC,EACzC,kBAAgD;IAEhD,OAAO,UAAU,eAAuB,EAAE,YAAoB;QAC5D,MAAM,QAAQ,GAAuB,MAAM,CAAC,MAAM,CAChD,EAAE;QACF,oCAAoC;QACpC,kBAAkB;QAClB,uCAAuC;QACvC;YACE,IAAI,EAAE,wBAAiB,CAAC,wBAAwB,CAC9C,eAAe,EACf,YAAY,CACb;SAIF,CACF,CAAC;QACF,0BAAQ,CAAC,QAAQ,CAAC,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QAElD,iEAAiE;QACjE,4EAA4E;QAC5E,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAErD,MAAM,IAAI,GAAwB,MAAM,CAAC,MAAM;QAC7C,kDAAkD;QAClD;YACE,OAAO,EAAE,YAAY;YACrB,IAAI,EAAE,YAAY;SACnB;QACD,oCAAoC;QACpC,UAAU;QACV,uCAAuC;QACvC;YACE,IAAI,EAAE,6BAAY,CAAC,SAAS;YAC5B,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,eAAe,CAAC,WAAW;YACnC,MAAM,EAAE,cAAc;SACvB,CACF,CAAC;QACF,6BAAQ,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC;AA7CD,8BA6CC"}
1
+ {"version":3,"file":"belongs-to.decorator.js","sourceRoot":"","sources":["../../../src/relations/belongs-to/belongs-to.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,yCAAmE;AACnE,sEAA0D;AAE1D,8DAA+C;AAC/C,sDAAoE;AAEpE;;;;;;;GAOG;AACH,SAAgB,SAAS,CACvB,cAAiC,EACjC,UAAyC,EACzC,kBAAgD;IAEhD,OAAO,UAAU,eAAuB,EAAE,YAAoB;;QAC5D,MAAM,QAAQ,SACZ,wBAAiB,CAAC,wBAAwB,CACxC,eAAe,EACf,YAAY,CACb,mCAAI,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAE,IAAI,CAAC;QAEhC,IAAI,CAAC,QAAQ,EAAE;YACb,MAAM,YAAY,GAAG,uBAAgB,CAAC,aAAa,CACjD,eAAe,EACf,YAAY,CACb,CAAC;YACF,MAAM,IAAI,KAAK,CACb,uCAAuC,YAAY,WAAW;gBAC5D,iEAAiE;gBACjE,qEAAqE;gBACrE,iEAAiE,CACpE,CAAC;SACH;QAED,MAAM,QAAQ,GAAuB,MAAM,CAAC,MAAM,CAChD,EAAE;QACF,oCAAoC;QACpC,kBAAkB;QAClB,uCAAuC;QACvC;YACE,IAAI,EAAE,QAAQ;SAIf,CACF,CAAC;QACF,0BAAQ,CAAC,QAAQ,CAAC,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QAElD,iEAAiE;QACjE,4EAA4E;QAC5E,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAErD,MAAM,IAAI,GAAwB,MAAM,CAAC,MAAM;QAC7C,kDAAkD;QAClD;YACE,OAAO,EAAE,YAAY;YACrB,IAAI,EAAE,YAAY;SACnB;QACD,oCAAoC;QACpC,UAAU;QACV,uCAAuC;QACvC;YACE,IAAI,EAAE,6BAAY,CAAC,SAAS;YAC5B,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,eAAe,CAAC,WAAW;YACnC,MAAM,EAAE,cAAc;SACvB,CACF,CAAC;QACF,6BAAQ,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC;AA7DD,8BA6DC"}
@@ -1,4 +1,4 @@
1
- import { Entity, EntityCrudRepository, Getter, HasManyDefinition } from '../..';
1
+ import { Entity, EntityCrudRepository, Getter, HasManyDefinition, InclusionResolver } from '../..';
2
2
  import { HasManyThroughRepository } from './has-many-through.repository';
3
3
  /**
4
4
  * a factory to generate hasManyThrough repository class.
@@ -7,5 +7,11 @@ import { HasManyThroughRepository } from './has-many-through.repository';
7
7
  * If backwards-incompatible changes are made, a new major version may not be
8
8
  * released.
9
9
  */
10
- export declare type HasManyThroughRepositoryFactory<TargetEntity extends Entity, TargetID, ThroughEntity extends Entity, SourceID> = (fkValue: SourceID) => HasManyThroughRepository<TargetEntity, TargetID, ThroughEntity>;
10
+ export declare type HasManyThroughRepositoryFactory<TargetEntity extends Entity, TargetID, ThroughEntity extends Entity, SourceID> = {
11
+ (fkValue: SourceID): HasManyThroughRepository<TargetEntity, TargetID, ThroughEntity>;
12
+ /**
13
+ * Use `resolver` property to obtain an InclusionResolver for this relation.
14
+ */
15
+ inclusionResolver: InclusionResolver<Entity, TargetEntity>;
16
+ };
11
17
  export declare function createHasManyThroughRepositoryFactory<Target extends Entity, TargetID, Through extends Entity, ThroughID, SourceID>(relationMetadata: HasManyDefinition, targetRepositoryGetter: Getter<EntityCrudRepository<Target, TargetID>>, throughRepositoryGetter: Getter<EntityCrudRepository<Through, ThroughID>>): HasManyThroughRepositoryFactory<Target, TargetID, Through, SourceID>;
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
+ // Copyright IBM Corp. 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
2
6
  Object.defineProperty(exports, "__esModule", { value: true });
3
7
  exports.createHasManyThroughRepositoryFactory = void 0;
4
8
  const has_many_through_helpers_1 = require("./has-many-through.helpers");
9
+ const has_many_through_inclusion_resolver_1 = require("./has-many-through.inclusion.resolver");
5
10
  const has_many_through_repository_1 = require("./has-many-through.repository");
6
11
  function createHasManyThroughRepositoryFactory(relationMetadata, targetRepositoryGetter, throughRepositoryGetter) {
7
12
  const meta = has_many_through_helpers_1.resolveHasManyThroughMetadata(relationMetadata);
@@ -25,6 +30,7 @@ function createHasManyThroughRepositoryFactory(relationMetadata, targetRepositor
25
30
  }
26
31
  return new has_many_through_repository_1.DefaultHasManyThroughRepository(targetRepositoryGetter, throughRepositoryGetter, getTargetConstraintFromThroughModels, getTargetKeys, getThroughConstraintFromSource, getTargetIds, getThroughConstraintFromTarget);
27
32
  };
33
+ result.inclusionResolver = has_many_through_inclusion_resolver_1.createHasManyThroughInclusionResolver(meta, throughRepositoryGetter, targetRepositoryGetter);
28
34
  return result;
29
35
  }
30
36
  exports.createHasManyThroughRepositoryFactory = createHasManyThroughRepositoryFactory;
@@ -1 +1 @@
1
- {"version":3,"file":"has-many-through-repository.factory.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many-through-repository.factory.ts"],"names":[],"mappings":";;;AAWA,yEAOoC;AACpC,+EAGuC;AAmBvC,SAAgB,qCAAqC,CAOnD,gBAAmC,EACnC,sBAAsE,EACtE,uBAAyE;IAEzE,MAAM,IAAI,GAAG,wDAA6B,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,UAAU,OAAiB;QACxC,SAAS,oCAAoC,CAC3C,gBAA2B;YAE3B,OAAO,4DAAiC,CACtC,IAAI,EACJ,gBAAgB,CACjB,CAAC;QACJ,CAAC;QACD,SAAS,aAAa,CAAC,gBAA2B;YAChD,OAAO,yDAA8B,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAChE,CAAC;QACD,SAAS,8BAA8B;YACrC,MAAM,UAAU,GAAwB,4DAAiC,CAGvE,IAAI,EAAE,OAAO,CAAC,CAAC;YACjB,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,SAAS,YAAY,CAAC,eAAyB;YAC7C,OAAO,uDAA4B,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAC7D,CAAC;QACD,SAAS,8BAA8B,CACrC,QAAoB;YAEpB,MAAM,UAAU,GAAwB,4DAAiC,CAGvE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAClB,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,6DAA+B,CAQxC,sBAAsB,EACtB,uBAAuB,EACvB,oCAAoC,EACpC,aAAa,EACb,8BAA8B,EAC9B,YAAY,EACZ,8BAA8B,CAC/B,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AA9DD,sFA8DC"}
1
+ {"version":3,"file":"has-many-through-repository.factory.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many-through-repository.factory.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAUhE,yEAOoC;AACpC,+FAA4F;AAC5F,+EAGuC;AA4BvC,SAAgB,qCAAqC,CAOnD,gBAAmC,EACnC,sBAAsE,EACtE,uBAAyE;IAEzE,MAAM,IAAI,GAAG,wDAA6B,CAAC,gBAAgB,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,UAAU,OAAiB;QACxC,SAAS,oCAAoC,CAC3C,gBAA2B;YAE3B,OAAO,4DAAiC,CACtC,IAAI,EACJ,gBAAgB,CACjB,CAAC;QACJ,CAAC;QACD,SAAS,aAAa,CAAC,gBAA2B;YAChD,OAAO,yDAA8B,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAChE,CAAC;QACD,SAAS,8BAA8B;YACrC,MAAM,UAAU,GAAwB,4DAAiC,CAGvE,IAAI,EAAE,OAAO,CAAC,CAAC;YACjB,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,SAAS,YAAY,CAAC,eAAyB;YAC7C,OAAO,uDAA4B,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAC7D,CAAC;QACD,SAAS,8BAA8B,CACrC,QAAoB;YAEpB,MAAM,UAAU,GAAwB,4DAAiC,CAGvE,IAAI,EAAE,QAAQ,CAAC,CAAC;YAClB,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,6DAA+B,CAQxC,sBAAsB,EACtB,uBAAuB,EACvB,oCAAoC,EACpC,aAAa,EACb,8BAA8B,EAC9B,YAAY,EACZ,8BAA8B,CAC/B,CAAC;IACJ,CAAC,CAAC;IACF,MAAM,CAAC,iBAAiB,GAAG,2EAAqC,CAC9D,IAAI,EACJ,uBAAuB,EACvB,sBAAsB,CACvB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAnED,sFAmEC"}
@@ -0,0 +1,16 @@
1
+ import { Entity } from '../../model';
2
+ import { EntityCrudRepository } from '../../repositories/repository';
3
+ import { Getter, HasManyDefinition, InclusionResolver } from '../relation.types';
4
+ /**
5
+ * Creates InclusionResolver for HasManyThrough relation.
6
+ * Notice that this function only generates the inclusionResolver.
7
+ * It doesn't register it for the source repository.
8
+ *
9
+ *
10
+ * @param meta - metadata of the hasMany relation (including through)
11
+ * @param getThroughRepo - through repository getter i.e. where through
12
+ * instances are
13
+ * @param getTargetRepo - target repository getter i.e where target instances
14
+ * are
15
+ */
16
+ export declare function createHasManyThroughInclusionResolver<Through extends Entity, ThroughID, ThroughRelations extends object, Target extends Entity, TargetID, TargetRelations extends object>(meta: HasManyDefinition, getThroughRepo: Getter<EntityCrudRepository<Through, ThroughID, ThroughRelations>>, getTargetRepo: Getter<EntityCrudRepository<Target, TargetID, TargetRelations>>): InclusionResolver<Entity, Target>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ // Copyright IBM Corp. 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.createHasManyThroughInclusionResolver = void 0;
8
+ const tslib_1 = require("tslib");
9
+ const debug_1 = tslib_1.__importDefault(require("debug"));
10
+ const relation_helpers_1 = require("../relation.helpers");
11
+ const has_many_helpers_1 = require("./has-many.helpers");
12
+ const debug = debug_1.default('loopback:repository:has-many-through-inclusion-resolver');
13
+ /**
14
+ * Creates InclusionResolver for HasManyThrough relation.
15
+ * Notice that this function only generates the inclusionResolver.
16
+ * It doesn't register it for the source repository.
17
+ *
18
+ *
19
+ * @param meta - metadata of the hasMany relation (including through)
20
+ * @param getThroughRepo - through repository getter i.e. where through
21
+ * instances are
22
+ * @param getTargetRepo - target repository getter i.e where target instances
23
+ * are
24
+ */
25
+ function createHasManyThroughInclusionResolver(meta, getThroughRepo, getTargetRepo) {
26
+ const relationMeta = has_many_helpers_1.resolveHasManyMetadata(meta);
27
+ return async function fetchHasManyThroughModels(entities, inclusion, options) {
28
+ if (!entities.length)
29
+ return [];
30
+ debug('Fetching target models for entities:', entities);
31
+ debug('Relation metadata:', relationMeta);
32
+ const sourceKey = relationMeta.keyFrom;
33
+ const sourceIds = entities.map(e => e[sourceKey]);
34
+ const targetKey = relationMeta.keyTo;
35
+ if (!relationMeta.through) {
36
+ throw new Error(`relationMeta.through must be defined on ${relationMeta}`);
37
+ }
38
+ const throughKeyTo = relationMeta.through.keyTo;
39
+ const throughKeyFrom = relationMeta.through.keyFrom;
40
+ debug('Parameters:', {
41
+ sourceKey,
42
+ sourceIds,
43
+ targetKey,
44
+ throughKeyTo,
45
+ throughKeyFrom,
46
+ });
47
+ debug('sourceId types', sourceIds.map(i => typeof i));
48
+ const throughRepo = await getThroughRepo();
49
+ const targetRepo = await getTargetRepo();
50
+ // find through models
51
+ const throughFound = await relation_helpers_1.findByForeignKeys(throughRepo, throughKeyFrom, sourceIds, {}, // scope will be applied at the target level
52
+ options);
53
+ const throughResult = relation_helpers_1.flattenTargetsOfOneToManyRelation(sourceIds, throughFound, throughKeyFrom);
54
+ const result = [];
55
+ // convert from through entities to the target entities
56
+ for (const entityList of throughResult) {
57
+ if (entityList) {
58
+ // get target ids from the through entities by foreign key
59
+ const targetIds = entityList.map(entity => entity[throughKeyTo]);
60
+ // the explicit types and casts are needed
61
+ const targetEntityList = await relation_helpers_1.findByForeignKeys(targetRepo, targetKey, targetIds, inclusion.scope, options);
62
+ result.push(targetEntityList);
63
+ }
64
+ else {
65
+ // no entities found, add undefined to results
66
+ result.push(entityList);
67
+ }
68
+ }
69
+ debug('fetchHasManyThroughModels result', result);
70
+ return result;
71
+ };
72
+ }
73
+ exports.createHasManyThroughInclusionResolver = createHasManyThroughInclusionResolver;
74
+ //# sourceMappingURL=has-many-through.inclusion.resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-many-through.inclusion.resolver.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many-through.inclusion.resolver.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAGhE,0DAAiC;AAIjC,0DAI6B;AAE7B,yDAA0D;AAE1D,MAAM,KAAK,GAAG,eAAY,CACxB,yDAAyD,CAC1D,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,SAAgB,qCAAqC,CAQnD,IAAu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G,oDAAiC,CACrD,SAAS,EACT,YAAY,EACZ,cAAc,CACf,CAAC;QAEF,MAAM,MAAM,GAAG,EAAE,CAAC;QAElB,uDAAuD;QACvD,KAAK,MAAM,UAAU,IAAI,aAAa,EAAE;YACtC,IAAI,UAAU,EAAE;gBACd,0DAA0D;gBAC1D,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;gBAEjE,0CAA0C;gBAC1C,MAAM,gBAAgB,GAAG,MAAM,oCAAiB,CAK9C,UAAU,EACV,SAAS,EACR,SAA2B,EAC5B,SAAS,CAAC,KAAuB,EACjC,OAAO,CACR,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aAC/B;iBAAM;gBACL,8CAA8C;gBAC9C,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aACzB;SACF;QAED,KAAK,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;QAClD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AApGD,sFAoGC"}
@@ -1 +1 @@
1
- {"version":3,"file":"has-many.inclusion-resolver.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many.inclusion-resolver.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,0DAAiC;AAKjC,0DAI6B;AAE7B,yDAA0D;AAE1D,MAAM,KAAK,GAAG,eAAY,CAAC,iDAAiD,CAAC,CAAC;AAE9E;;;;;;;;;GASG;AACH,SAAgB,8BAA8B,CAK5C,IAAuB,EACvB,aAEC;IAED,MAAM,YAAY,GAAG,yCAAsB,CAAC,IAAI,CAAC,CAAC;IAElD,OAAO,KAAK,UAAU,kBAAkB,CACtC,QAAkB,EAClB,SAAoB,EACpB,OAAiB;QAEjB,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAEhC,KAAK,CAAC,sCAAsC,EAAE,QAAQ,CAAC,CAAC;QACxD,KAAK,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;QAE1C,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;QACvC,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAE,CAAe,CAAC,SAAS,CAAC,CAAC,CAAC;QACjE,MAAM,SAAS,GAAG,YAAY,CAAC,KAA4B,CAAC;QAE5D,KAAK,CAAC,aAAa,EAAE,EAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAC,CAAC,CAAC;QACxD,KAAK,CACH,gBAAgB,EAChB,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAC7B,CAAC;QAEF,MAAM,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC;QACzC,MAAM,YAAY,GAAG,MAAM,oCAAiB,CAC1C,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,CAAC,KAAuB,EACjC,OAAO,CACR,CAAC;QAEF,KAAK,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAEtC,MAAM,MAAM,GAAG,oDAAiC,CAC9C,SAAS,EACT,YAAY,EACZ,SAAS,CACV,CAAC;QAEF,KAAK,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;QAC3C,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AApDD,wEAoDC"}
1
+ {"version":3,"file":"has-many.inclusion-resolver.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many.inclusion-resolver.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAGhE,0DAAiC;AAIjC,0DAI6B;AAE7B,yDAA0D;AAE1D,MAAM,KAAK,GAAG,eAAY,CAAC,iDAAiD,CAAC,CAAC;AAE9E;;;;;;;;;GASG;AACH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filter';
2
3
  import { Count, DataObject, Options } from '../../common-types';
3
4
  import { Entity } from '../../model';
4
- import { Filter, Where } from '../../query';
5
5
  import { EntityCrudRepository } from '../../repositories/repository';
6
6
  /**
7
7
  * CRUD operations for a target repository of a HasMany relation
@@ -1,7 +1,7 @@
1
1
  import { Getter } from '@loopback/core';
2
+ import { Filter } from '@loopback/filter';
2
3
  import { Count, DataObject, Options } from '../../common-types';
3
4
  import { Entity } from '../../model';
4
- import { Filter } from '../../query';
5
5
  import { EntityCrudRepository } from '../../repositories';
6
6
  /**
7
7
  * CRUD operations for a target repository of a HasMany relation
@@ -1 +1 @@
1
- {"version":3,"file":"has-one.repository.js","sourceRoot":"","sources":["../../../src/relations/has-one/has-one.repository.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAIhE,yCAAiD;AAGjD,qDAK4B;AA6C5B,MAAa,uBAAuB;IAKlC;;;;;OAKG;IACH,YACS,mBAA6C,EAC7C,UAAoC;QADpC,wBAAmB,GAAnB,mBAAmB,CAA0B;QAC7C,eAAU,GAAV,UAAU,CAA0B;IAC1C,CAAC;IAEJ,KAAK,CAAC,MAAM,CACV,eAAyC,EACzC,OAAiB;QAEjB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,gBAAgB,CAAC,MAAM,CAC5B,kCAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,EACrD,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CACP,MAGC,EACD,OAAiB;QAEjB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,IAAI,CACvC,MAAM,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,CAAC,EAAC,EAAE,8BAAe,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,EACnE,OAAO,CACR,CAAC;QACF,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YACpB,iEAAiE;YACjE,MAAM,EAAE,GAAG,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3D,MAAM,IAAI,4BAAmB,CAAC,gBAAgB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;SACjE;QACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,OAAiB;QAC5B,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,gBAAgB,CAAC,SAAS,CAC/B,6BAAc,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,EACnC,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK,CACT,UAAoC,EACpC,OAAiB;QAEjB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,gBAAgB,CAAC,SAAS,CAC/B,kCAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,EAChD,6BAAc,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,EACnC,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAjED,0DAiEC"}
1
+ {"version":3,"file":"has-one.repository.js","sourceRoot":"","sources":["../../../src/relations/has-one/has-one.repository.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAKhE,yCAAiD;AAEjD,qDAK4B;AA6C5B,MAAa,uBAAuB;IAKlC;;;;;OAKG;IACH,YACS,mBAA6C,EAC7C,UAAoC;QADpC,wBAAmB,GAAnB,mBAAmB,CAA0B;QAC7C,eAAU,GAAV,UAAU,CAA0B;IAC1C,CAAC;IAEJ,KAAK,CAAC,MAAM,C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C,UAAU,CAAC,EAChD,6BAAc,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,EACnC,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAjED,0DAiEC"}
@@ -5,7 +5,7 @@ import { AnyObject, Entity, EntityCrudRepository, Filter, Inclusion, Options } f
5
5
  * @param targetRepository - The target repository where the related model instances are found
6
6
  * @param fkName - Name of the foreign key
7
7
  * @param fkValues - One value or array of values of the foreign key to be included
8
- * @param scope - Additional scope constraints (not currently supported)
8
+ * @param scope - Additional scope constraints
9
9
  * @param options - Options for the operations
10
10
  */
11
11
  export declare function findByForeignKeys<Target extends Entity, TargetRelations extends object, ForeignKey extends StringKeyOf<Target>>(targetRepository: EntityCrudRepository<Target, unknown, TargetRelations>, fkName: ForeignKey, fkValues: Target[ForeignKey][] | Target[ForeignKey], scope?: Filter<Target>, options?: Options): Promise<(Target & TargetRelations)[]>;
@@ -29,7 +29,7 @@ export declare function includeRelatedModels<T extends Entity, Relations extends
29
29
  * @param targetKey - name of the target key
30
30
  *
31
31
  */
32
- export declare function flattenTargetsOfOneToOneRelation<SourceWithRelations extends Entity, Target extends Entity>(sourceIds: unknown[], targetEntities: Target[], targetKey: StringKeyOf<Target>): (Target | undefined)[];
32
+ export declare function flattenTargetsOfOneToOneRelation<Target extends Entity>(sourceIds: unknown[], targetEntities: Target[], targetKey: StringKeyOf<Target>): (Target | undefined)[];
33
33
  /**
34
34
  * Returns an array of instances. The order of arrays is based on
35
35
  * as a result of one to many relation. The order of arrays is based on
@@ -17,7 +17,7 @@ const debug = debug_1.default('loopback:repository:relation-helpers');
17
17
  * @param targetRepository - The target repository where the related model instances are found
18
18
  * @param fkName - Name of the foreign key
19
19
  * @param fkValues - One value or array of values of the foreign key to be included
20
- * @param scope - Additional scope constraints (not currently supported)
20
+ * @param scope - Additional scope constraints
21
21
  * @param options - Options for the operations
22
22
  */
23
23
  async function findByForeignKeys(targetRepository, fkName, fkValues, scope, options) {