@loopback/repository 2.2.1 → 2.5.1

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 (135) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/common-types.d.ts +1 -0
  3. package/dist/common-types.js +2 -0
  4. package/dist/common-types.js.map +1 -1
  5. package/dist/connectors/index.js +4 -0
  6. package/dist/connectors/index.js.map +1 -1
  7. package/dist/decorators/metadata.js +1 -0
  8. package/dist/decorators/metadata.js.map +1 -1
  9. package/dist/decorators/model.decorator.d.ts +1 -1
  10. package/dist/decorators/model.decorator.js +1 -0
  11. package/dist/decorators/model.decorator.js.map +1 -1
  12. package/dist/decorators/repository.decorator.js +1 -0
  13. package/dist/decorators/repository.decorator.js.map +1 -1
  14. package/dist/define-model-class.js +1 -0
  15. package/dist/define-model-class.js.map +1 -1
  16. package/dist/define-repository-class.d.ts +119 -0
  17. package/dist/define-repository-class.js +98 -0
  18. package/dist/define-repository-class.js.map +1 -0
  19. package/dist/errors/entity-not-found.error.js +1 -0
  20. package/dist/errors/entity-not-found.error.js.map +1 -1
  21. package/dist/errors/invalid-relation.error.js +1 -0
  22. package/dist/errors/invalid-relation.error.js.map +1 -1
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.js +4 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/keys.d.ts +34 -0
  27. package/dist/keys.js +44 -0
  28. package/dist/keys.js.map +1 -0
  29. package/dist/mixins/repository.mixin.d.ts +91 -9
  30. package/dist/mixins/repository.mixin.js +62 -20
  31. package/dist/mixins/repository.mixin.js.map +1 -1
  32. package/dist/model.d.ts +16 -1
  33. package/dist/model.js +61 -9
  34. package/dist/model.js.map +1 -1
  35. package/dist/query.js +1 -0
  36. package/dist/query.js.map +1 -1
  37. package/dist/relations/belongs-to/belongs-to-accessor.js +1 -0
  38. package/dist/relations/belongs-to/belongs-to-accessor.js.map +1 -1
  39. package/dist/relations/belongs-to/belongs-to.decorator.js +1 -0
  40. package/dist/relations/belongs-to/belongs-to.decorator.js.map +1 -1
  41. package/dist/relations/belongs-to/belongs-to.helpers.js +1 -0
  42. package/dist/relations/belongs-to/belongs-to.helpers.js.map +1 -1
  43. package/dist/relations/belongs-to/belongs-to.inclusion-resolver.js +1 -0
  44. package/dist/relations/belongs-to/belongs-to.inclusion-resolver.js.map +1 -1
  45. package/dist/relations/belongs-to/belongs-to.repository.js +1 -0
  46. package/dist/relations/belongs-to/belongs-to.repository.js.map +1 -1
  47. package/dist/relations/has-many/has-many-repository.factory.js +1 -0
  48. package/dist/relations/has-many/has-many-repository.factory.js.map +1 -1
  49. package/dist/relations/has-many/has-many-through.helpers.d.ts +74 -0
  50. package/dist/relations/has-many/has-many-through.helpers.js +145 -0
  51. package/dist/relations/has-many/has-many-through.helpers.js.map +1 -0
  52. package/dist/relations/has-many/has-many.decorator.js +1 -0
  53. package/dist/relations/has-many/has-many.decorator.js.map +1 -1
  54. package/dist/relations/has-many/has-many.helpers.d.ts +9 -0
  55. package/dist/relations/has-many/has-many.helpers.js +33 -21
  56. package/dist/relations/has-many/has-many.helpers.js.map +1 -1
  57. package/dist/relations/has-many/has-many.inclusion-resolver.js +1 -0
  58. package/dist/relations/has-many/has-many.inclusion-resolver.js.map +1 -1
  59. package/dist/relations/has-many/has-many.repository.js +1 -0
  60. package/dist/relations/has-many/has-many.repository.js.map +1 -1
  61. package/dist/relations/has-one/has-one-repository.factory.js +1 -0
  62. package/dist/relations/has-one/has-one-repository.factory.js.map +1 -1
  63. package/dist/relations/has-one/has-one.decorator.js +1 -0
  64. package/dist/relations/has-one/has-one.decorator.js.map +1 -1
  65. package/dist/relations/has-one/has-one.helpers.js +1 -0
  66. package/dist/relations/has-one/has-one.helpers.js.map +1 -1
  67. package/dist/relations/has-one/has-one.inclusion-resolver.js +1 -0
  68. package/dist/relations/has-one/has-one.inclusion-resolver.js.map +1 -1
  69. package/dist/relations/has-one/has-one.repository.js +1 -0
  70. package/dist/relations/has-one/has-one.repository.js.map +1 -1
  71. package/dist/relations/relation.decorator.js +1 -0
  72. package/dist/relations/relation.decorator.js.map +1 -1
  73. package/dist/relations/relation.helpers.js +1 -0
  74. package/dist/relations/relation.helpers.js.map +1 -1
  75. package/dist/relations/relation.types.d.ts +25 -27
  76. package/dist/relations/relation.types.js +2 -1
  77. package/dist/relations/relation.types.js.map +1 -1
  78. package/dist/repositories/constraint-utils.js +1 -0
  79. package/dist/repositories/constraint-utils.js.map +1 -1
  80. package/dist/repositories/index.js +1 -0
  81. package/dist/repositories/index.js.map +1 -1
  82. package/dist/repositories/kv.repository.bridge.js +1 -0
  83. package/dist/repositories/kv.repository.bridge.js.map +1 -1
  84. package/dist/repositories/legacy-juggler-bridge.d.ts +3 -3
  85. package/dist/repositories/legacy-juggler-bridge.js +8 -18
  86. package/dist/repositories/legacy-juggler-bridge.js.map +1 -1
  87. package/dist/repositories/repository.js +1 -0
  88. package/dist/repositories/repository.js.map +1 -1
  89. package/dist/transaction.js +1 -0
  90. package/dist/transaction.js.map +1 -1
  91. package/dist/type-resolver.d.ts +4 -0
  92. package/dist/type-resolver.js +9 -0
  93. package/dist/type-resolver.js.map +1 -1
  94. package/dist/types/any.js +1 -0
  95. package/dist/types/any.js.map +1 -1
  96. package/dist/types/array.js +1 -0
  97. package/dist/types/array.js.map +1 -1
  98. package/dist/types/boolean.js +1 -0
  99. package/dist/types/boolean.js.map +1 -1
  100. package/dist/types/buffer.js +1 -0
  101. package/dist/types/buffer.js.map +1 -1
  102. package/dist/types/date.js +1 -0
  103. package/dist/types/date.js.map +1 -1
  104. package/dist/types/index.d.ts +11 -9
  105. package/dist/types/index.js +33 -17
  106. package/dist/types/index.js.map +1 -1
  107. package/dist/types/model.js +1 -0
  108. package/dist/types/model.js.map +1 -1
  109. package/dist/types/null.d.ts +12 -0
  110. package/dist/types/null.js +33 -0
  111. package/dist/types/null.js.map +1 -0
  112. package/dist/types/number.js +1 -0
  113. package/dist/types/number.js.map +1 -1
  114. package/dist/types/object.js +1 -0
  115. package/dist/types/object.js.map +1 -1
  116. package/dist/types/string.js +1 -0
  117. package/dist/types/string.js.map +1 -1
  118. package/dist/types/union.js +1 -0
  119. package/dist/types/union.js.map +1 -1
  120. package/package.json +13 -14
  121. package/src/common-types.ts +1 -0
  122. package/src/define-repository-class.ts +170 -0
  123. package/src/index.ts +2 -0
  124. package/src/keys.ts +40 -0
  125. package/src/mixins/repository.mixin.ts +120 -25
  126. package/src/model.ts +74 -11
  127. package/src/relations/has-many/has-many-through.helpers.ts +193 -0
  128. package/src/relations/has-many/has-many.helpers.ts +41 -27
  129. package/src/relations/relation.types.ts +24 -30
  130. package/src/repositories/legacy-juggler-bridge.ts +16 -24
  131. package/src/type-resolver.ts +8 -0
  132. package/src/types/index.ts +11 -8
  133. package/src/types/null.ts +35 -0
  134. package/index.d.ts +0 -6
  135. package/index.js +0 -6
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.resolveBelongsToMetadata = void 0;
7
8
  const tslib_1 = require("tslib");
8
9
  const debug_1 = tslib_1.__importDefault(require("debug"));
9
10
  const errors_1 = require("../../errors");
@@ -1 +1 @@
1
- {"version":3,"file":"belongs-to.helpers.js","sourceRoot":"","sources":["../../../src/relations/belongs-to/belongs-to.helpers.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,0DAAiC;AACjC,yCAAkD;AAClD,uDAAmD;AACnD,sDAAoE;AAEpE,MAAM,KAAK,GAAG,eAAY,CAAC,wCAAwC,CAAC,CAAC;AAQrE;;;;;;GAMG;AACH,SAAgB,wBAAwB,CAAC,YAAiC;IACxE,IAAK,YAAY,CAAC,IAAqB,KAAK,6BAAY,CAAC,SAAS,EAAE;QAClE,MAAM,MAAM,GAAG,iCAAiC,CAAC;QACjD,MAAM,IAAI,6BAAoB,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D;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAC,KAAK,EAAE,gBAAgB,EAAC,CAAC,CAAC;AAChE,CAAC;AAzCD,4DAyCC"}
1
+ {"version":3,"file":"belongs-to.helpers.js","sourceRoot":"","sources":["../../../src/relations/belongs-to/belongs-to.helpers.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,0DAAiC;AACjC,yCAAkD;AAClD,uDAAmD;AACnD,sDAAoE;AAEpE,MAAM,KAAK,GAAG,eAAY,CAAC,wCAAwC,CAAC,CAAC;AAQrE;;;;;;GAMG;AACH,SAAgB,wBAAwB,CAAC,YAAiC;IACxE,IAAK,YAAY,CAAC,IAAqB,KAAK,6BAAY,CAAC,SAAS,EAAE;QAClE,MAAM,MAAM,GAAG,iCAAiC,CAAC;QACjD,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,IAAI,CAAC,8BAAc,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;QACxC,MAAM,MAAM,GAAG,gCAAgC,CAAC;QAChD,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;QACzB,MAAM,MAAM,GAAG,qBAAqB,CAAC;QACrC,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC;IACxC,IAAI,CAAC,WAAW,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE;QAC1C,MAAM,MAAM,GAAG,8BAA8B,CAAC;QAC9C,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IAC1C,MAAM,UAAU,GAAG,WAAW,CAAC,SAAS,CAAC;IACzC,KAAK,CAAC,2CAA2C,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IAE5E,MAAM,gBAAgB,GAAG,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC;IAC3D,KAAK,CAAC,+BAA+B,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAErE,IAAI,YAAY,CAAC,KAAK,IAAI,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;QAC9D,wEAAwE;QACxE,OAAO,YAA2C,CAAC;KACpD;IAED,MAAM,gBAAgB,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,MAAM,GAAG,GAAG,UAAU,8CAA8C,CAAC;QAC3E,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAC,KAAK,EAAE,gBAAgB,EAAC,CAAC,CAAC;AAChE,CAAC;AAzCD,4DAyCC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createBelongsToInclusionResolver = void 0;
7
8
  const relation_helpers_1 = require("../relation.helpers");
8
9
  const belongs_to_helpers_1 = require("./belongs-to.helpers");
9
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"belongs-to.inclusion-resolver.js","sourceRoot":"","sources":["../../../src/relations/belongs-to/belongs-to.inclusion-resolver.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAMhE,0DAK6B;AAM7B,6DAA8D;AAE9D;;;;;;;;;GASG;AACH,SAAgB,gCAAgC,CAK9C,IAAyB,EACzB,aAEC;IAED,MAAM,YAAY,GAAG,6CAAwB,CAAC,IAAI,CAAC,CAAC;IAEpD,OAAO,KAAK,UAAU,mBAAmB,CACvC,QAAkB,EAClB,SAAoB,EACpB,OAAiB;QAEjB,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAEhC,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;QAC5D,MAAM,gBAAgB,GAAG,8BAAW,CAAC,SAAS,CAAC,CAAC;QAEhD,MAAM,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC;QACzC,MAAM,YAAY,GAAG,MAAM,oCAAiB,CAC1C,UAAU,EACV,SAAS,EACT,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAC/B,SAAS,CAAC,KAAuB,EACjC,OAAO,CACR,CAAC;QAEF,OAAO,mDAAgC,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC;AAnCD,4EAmCC"}
1
+ {"version":3,"file":"belongs-to.inclusion-resolver.js","sourceRoot":"","sources":["../../../src/relations/belongs-to/belongs-to.inclusion-resolver.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAMhE,0DAK6B;AAM7B,6DAA8D;AAE9D;;;;;;;;;GASG;AACH,SAAgB,gCAAgC,CAK9C,IAAyB,EACzB,aAEC;IAED,MAAM,YAAY,GAAG,6CAAwB,CAAC,IAAI,CAAC,CAAC;IAEpD,OAAO,KAAK,UAAU,mBAAmB,CACvC,QAAkB,EAClB,SAAoB,EACpB,OAAiB;QAEjB,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAEhC,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;QAC5D,MAAM,gBAAgB,GAAG,8BAAW,CAAC,SAAS,CAAC,CAAC;QAEhD,MAAM,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC;QACzC,MAAM,YAAY,GAAG,MAAM,oCAAiB,CAC1C,UAAU,EACV,SAAS,EACT,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAC/B,SAAS,CAAC,KAAuB,EACjC,OAAO,CACR,CAAC;QAEF,OAAO,mDAAgC,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC;AAnCD,4EAmCC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.DefaultBelongsToRepository = void 0;
7
8
  const errors_1 = require("../../errors");
8
9
  const constraint_utils_1 = require("../../repositories/constraint-utils");
9
10
  class DefaultBelongsToRepository {
@@ -1 +1 @@
1
- {"version":3,"file":"belongs-to.repository.js","sourceRoot":"","sources":["../../../src/relations/belongs-to/belongs-to.repository.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAIhE,yCAAiD;AAEjD,0EAAoE;AAgBpE,MAAa,0BAA0B;IAKrC;;;;;OAKG;IACH,YACS,mBAA6C,EAC7C,UAAoC;QADpC,wBAAmB,GAAnB,mBAAmB,CAA0B;QAC7C,eAAU,GAAV,UAAU,CAA0B;IAC1C,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,OAAiB;QACzB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAClC,kCAAe,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,EAC3C,OAAO,CACR,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,iEAAiE;YACjE,MAAM,EAAE,GAAG,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3D,MAAM,IAAI,4BAAmB,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;SAC3D;QACD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;CACF;AA7BD,gEA6BC"}
1
+ {"version":3,"file":"belongs-to.repository.js","sourceRoot":"","sources":["../../../src/relations/belongs-to/belongs-to.repository.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAIhE,yCAAiD;AAEjD,0EAAoE;AAgBpE,MAAa,0BAA0B;IAKrC;;;;;OAKG;IACH,YACS,mBAA6C,EAC7C,UAAoC;QADpC,wBAAmB,GAAnB,mBAAmB,CAA0B;QAC7C,eAAU,GAAV,UAAU,CAA0B;IAC1C,CAAC;IAEJ,KAAK,CAAC,GAAG,CAAC,OAAiB;QACzB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAClC,kCAAe,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,EAC3C,OAAO,CACR,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAClB,iEAAiE;YACjE,MAAM,EAAE,GAAG,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3D,MAAM,IAAI,4BAAmB,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;SAC3D;QACD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;CACF;AA7BD,gEA6BC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createHasManyRepositoryFactory = void 0;
7
8
  const tslib_1 = require("tslib");
8
9
  const debug_1 = tslib_1.__importDefault(require("debug"));
9
10
  const has_many_helpers_1 = require("./has-many.helpers");
@@ -1 +1 @@
1
- {"version":3,"file":"has-many-repository.factory.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many-repository.factory.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,0DAAiC;AAKjC,yDAA0D;AAC1D,+EAA6E;AAC7E,+DAG+B;AAE/B,MAAM,KAAK,GAAG,eAAY,CAAC,iDAAiD,CAAC,CAAC;AAiB9E;;;;;;;;;;;;GAYG;AACH,SAAgB,8BAA8B,CAK5C,gBAAmC,EACnC,sBAAsE;IAEtE,MAAM,IAAI,GAAG,yCAAsB,CAAC,gBAAgB,CAAC,CAAC;IACtD,KAAK,CAAC,wCAAwC,EAAE,IAAI,CAAC,CAAC;IACtD,MAAM,MAAM,GAAqD,UAC/D,OAAuB;QAEvB,8DAA8D;QAC9D,MAAM,UAAU,GAAQ,EAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAC,CAAC;QAChD,OAAO,IAAI,8CAAwB,CAIjC,sBAAsB,EAAE,UAAgC,CAAC,CAAC;IAC9D,CAAC,CAAC;IACF,MAAM,CAAC,iBAAiB,GAAG,4DAA8B,CACvD,IAAI,EACJ,sBAAsB,CACvB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AA1BD,wEA0BC"}
1
+ {"version":3,"file":"has-many-repository.factory.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many-repository.factory.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,0DAAiC;AAKjC,yDAA0D;AAC1D,+EAA6E;AAC7E,+DAG+B;AAE/B,MAAM,KAAK,GAAG,eAAY,CAAC,iDAAiD,CAAC,CAAC;AAiB9E;;;;;;;;;;;;GAYG;AACH,SAAgB,8BAA8B,CAK5C,gBAAmC,EACnC,sBAAsE;IAEtE,MAAM,IAAI,GAAG,yCAAsB,CAAC,gBAAgB,CAAC,CAAC;IACtD,KAAK,CAAC,wCAAwC,EAAE,IAAI,CAAC,CAAC;IACtD,MAAM,MAAM,GAAqD,UAC/D,OAAuB;QAEvB,8DAA8D;QAC9D,MAAM,UAAU,GAAQ,EAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAC,CAAC;QAChD,OAAO,IAAI,8CAAwB,CAIjC,sBAAsB,EAAE,UAAgC,CAAC,CAAC;IAC9D,CAAC,CAAC;IACF,MAAM,CAAC,iBAAiB,GAAG,4DAA8B,CACvD,IAAI,EACJ,sBAAsB,CACvB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AA1BD,wEA0BC"}
@@ -0,0 +1,74 @@
1
+ import { DataObject, Entity, HasManyDefinition } from '../..';
2
+ export declare type HasManyThroughResolvedDefinition = HasManyDefinition & {
3
+ keyTo: string;
4
+ keyFrom: string;
5
+ through: {
6
+ keyTo: string;
7
+ keyFrom: string;
8
+ };
9
+ };
10
+ /**
11
+ * Creates constraint used to query target
12
+ * @param relationMeta - hasManyThrough metadata to resolve
13
+ * @param throughInstances - Instances of through entities used to constrain the target
14
+ * @internal
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const resolvedMetadata = {
19
+ * // .. other props
20
+ * keyFrom: 'id',
21
+ * keyTo: 'id',
22
+ * through: {
23
+ * model: () => CategoryProductLink,
24
+ * keyFrom: 'categoryId',
25
+ * keyTo: 'productId',
26
+ * },
27
+ * };
28
+
29
+ * createTargetConstraint(resolvedMetadata, [
30
+ {
31
+ id: 2,
32
+ categoryId: 2,
33
+ productId: 8,
34
+ }, {
35
+ id: 2,
36
+ categoryId: 2,
37
+ productId: 9,
38
+ }
39
+ ]);
40
+ * ```
41
+ */
42
+ export declare function createTargetConstraint<Target extends Entity, Through extends Entity>(relationMeta: HasManyThroughResolvedDefinition, throughInstances: Through[]): DataObject<Target>;
43
+ /**
44
+ * Creates constraint used to query through model
45
+ *
46
+ * @param relationMeta - hasManyThrough metadata to resolve
47
+ * @param fkValue - Value of the foreign key of the source model used to constrain through
48
+ * @param targetInstance - Instance of target entity used to constrain through
49
+ * @internal
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const resolvedMetadata = {
54
+ * // .. other props
55
+ * keyFrom: 'id',
56
+ * keyTo: 'id',
57
+ * through: {
58
+ * model: () => CategoryProductLink,
59
+ * keyFrom: 'categoryId',
60
+ * keyTo: 'productId',
61
+ * },
62
+ * };
63
+ * createThroughConstraint(resolvedMetadata, 1);
64
+ * ```
65
+ */
66
+ export declare function createThroughConstraint<Through extends Entity, ForeignKeyType>(relationMeta: HasManyThroughResolvedDefinition, fkValue: ForeignKeyType): DataObject<Through>;
67
+ /**
68
+ * Resolves given hasMany metadata if target is specified to be a resolver.
69
+ * Mainly used to infer what the `keyTo` property should be from the target's
70
+ * belongsTo metadata
71
+ * @param relationMeta - hasManyThrough metadata to resolve
72
+ * @internal
73
+ */
74
+ export declare function resolveHasManyThroughMetadata(relationMeta: HasManyDefinition): HasManyThroughResolvedDefinition;
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveHasManyThroughMetadata = exports.createThroughConstraint = exports.createTargetConstraint = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const debug_1 = tslib_1.__importDefault(require("debug"));
6
+ const lodash_1 = require("lodash");
7
+ const __1 = require("../..");
8
+ const has_many_helpers_1 = require("./has-many.helpers");
9
+ const debug = debug_1.default('loopback:repository:has-many-through-helpers');
10
+ /**
11
+ * Creates constraint used to query target
12
+ * @param relationMeta - hasManyThrough metadata to resolve
13
+ * @param throughInstances - Instances of through entities used to constrain the target
14
+ * @internal
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const resolvedMetadata = {
19
+ * // .. other props
20
+ * keyFrom: 'id',
21
+ * keyTo: 'id',
22
+ * through: {
23
+ * model: () => CategoryProductLink,
24
+ * keyFrom: 'categoryId',
25
+ * keyTo: 'productId',
26
+ * },
27
+ * };
28
+
29
+ * createTargetConstraint(resolvedMetadata, [
30
+ {
31
+ id: 2,
32
+ categoryId: 2,
33
+ productId: 8,
34
+ }, {
35
+ id: 2,
36
+ categoryId: 2,
37
+ productId: 9,
38
+ }
39
+ ]);
40
+ * ```
41
+ */
42
+ function createTargetConstraint(relationMeta, throughInstances) {
43
+ const targetPrimaryKey = relationMeta.keyTo;
44
+ const targetFkName = relationMeta.through.keyTo;
45
+ const fkValues = throughInstances.map((throughInstance) => throughInstance[targetFkName]);
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+ const constraint = {
48
+ [targetPrimaryKey]: fkValues.length === 1 ? fkValues[0] : { inq: fkValues },
49
+ };
50
+ return constraint;
51
+ }
52
+ exports.createTargetConstraint = createTargetConstraint;
53
+ /**
54
+ * Creates constraint used to query through model
55
+ *
56
+ * @param relationMeta - hasManyThrough metadata to resolve
57
+ * @param fkValue - Value of the foreign key of the source model used to constrain through
58
+ * @param targetInstance - Instance of target entity used to constrain through
59
+ * @internal
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const resolvedMetadata = {
64
+ * // .. other props
65
+ * keyFrom: 'id',
66
+ * keyTo: 'id',
67
+ * through: {
68
+ * model: () => CategoryProductLink,
69
+ * keyFrom: 'categoryId',
70
+ * keyTo: 'productId',
71
+ * },
72
+ * };
73
+ * createThroughConstraint(resolvedMetadata, 1);
74
+ * ```
75
+ */
76
+ function createThroughConstraint(relationMeta, fkValue) {
77
+ const sourceFkName = relationMeta.through.keyFrom;
78
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
+ const constraint = { [sourceFkName]: fkValue };
80
+ return constraint;
81
+ }
82
+ exports.createThroughConstraint = createThroughConstraint;
83
+ /**
84
+ * Resolves given hasMany metadata if target is specified to be a resolver.
85
+ * Mainly used to infer what the `keyTo` property should be from the target's
86
+ * belongsTo metadata
87
+ * @param relationMeta - hasManyThrough metadata to resolve
88
+ * @internal
89
+ */
90
+ function resolveHasManyThroughMetadata(relationMeta) {
91
+ var _a, _b, _c, _d, _e, _f;
92
+ // some checks and relationMeta.keyFrom are handled in here
93
+ relationMeta = has_many_helpers_1.resolveHasManyMetaHelper(relationMeta);
94
+ if (!relationMeta.through) {
95
+ const reason = 'through must be specified';
96
+ throw new __1.InvalidRelationError(reason, relationMeta);
97
+ }
98
+ if (!__1.isTypeResolver((_a = relationMeta.through) === null || _a === void 0 ? void 0 : _a.model)) {
99
+ const reason = 'through.model must be a type resolver';
100
+ throw new __1.InvalidRelationError(reason, relationMeta);
101
+ }
102
+ const throughModel = relationMeta.through.model();
103
+ const throughModelProperties = (_b = throughModel.definition) === null || _b === void 0 ? void 0 : _b.properties;
104
+ const targetModel = relationMeta.target();
105
+ const targetModelProperties = (_c = targetModel.definition) === null || _c === void 0 ? void 0 : _c.properties;
106
+ // check if metadata is already complete
107
+ if (relationMeta.through.keyTo &&
108
+ throughModelProperties[relationMeta.through.keyTo] &&
109
+ relationMeta.through.keyFrom &&
110
+ throughModelProperties[relationMeta.through.keyFrom] &&
111
+ relationMeta.keyTo &&
112
+ targetModelProperties[relationMeta.keyTo]) {
113
+ // The explict cast is needed because of a limitation of type inference
114
+ return relationMeta;
115
+ }
116
+ const sourceModel = relationMeta.source;
117
+ debug('Resolved model %s from given metadata: %o', targetModel.modelName, targetModel);
118
+ debug('Resolved model %s from given metadata: %o', throughModel.modelName, throughModel);
119
+ const sourceFkName = (_d = relationMeta.through.keyFrom) !== null && _d !== void 0 ? _d : lodash_1.camelCase(sourceModel.modelName + '_id');
120
+ if (!throughModelProperties[sourceFkName]) {
121
+ const reason = `through model ${throughModel.name} is missing definition of source foreign key`;
122
+ throw new __1.InvalidRelationError(reason, relationMeta);
123
+ }
124
+ const targetFkName = (_e = relationMeta.through.keyTo) !== null && _e !== void 0 ? _e : lodash_1.camelCase(targetModel.modelName + '_id');
125
+ if (!throughModelProperties[targetFkName]) {
126
+ const reason = `through model ${throughModel.name} is missing definition of target foreign key`;
127
+ throw new __1.InvalidRelationError(reason, relationMeta);
128
+ }
129
+ const targetPrimaryKey = (_f = relationMeta.keyTo) !== null && _f !== void 0 ? _f : targetModel.definition.idProperties()[0];
130
+ if (!targetPrimaryKey || !targetModelProperties[targetPrimaryKey]) {
131
+ const reason = `target model ${targetModel.modelName} does not have any primary key (id property)`;
132
+ throw new __1.InvalidRelationError(reason, relationMeta);
133
+ }
134
+ return Object.assign(relationMeta, {
135
+ keyTo: targetPrimaryKey,
136
+ keyFrom: relationMeta.keyFrom,
137
+ through: {
138
+ ...relationMeta.through,
139
+ keyTo: targetFkName,
140
+ keyFrom: sourceFkName,
141
+ },
142
+ });
143
+ }
144
+ exports.resolveHasManyThroughMetadata = resolveHasManyThroughMetadata;
145
+ //# sourceMappingURL=has-many-through.helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"has-many-through.helpers.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many-through.helpers.ts"],"names":[],"mappings":";;;;AAAA,0DAAiC;AACjC,mCAAiC;AACjC,6BAMe;AACf,yDAA4D;AAE5D,MAAM,KAAK,GAAG,eAAY,CAAC,8CAA8C,CAAC,CAAC;AAW3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAgB,sBAAsB,CAIpC,YAA8C,EAC9C,gBAA2B;IAE3B,MAAM,gBAAgB,GAAG,YAAY,CAAC,KAAK,CAAC;IAC5C,MA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8C,CAAC;QAChG,MAAM,IAAI,wBAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,MAAM,gBAAgB,SACpB,YAAY,CAAC,KAAK,mCAAI,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;IACjE,IAAI,CAAC,gBAAgB,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,EAAE;QACjE,MAAM,MAAM,GAAG,gBAAgB,WAAW,CAAC,SAAS,8CAA8C,CAAC;QACnG,MAAM,IAAI,wBAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;QACjC,KAAK,EAAE,gBAAgB;QACvB,OAAO,EAAE,YAAY,CAAC,OAAQ;QAC9B,OAAO,EAAE;YACP,GAAG,YAAY,CAAC,OAAO;YACvB,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,YAAY;SACtB;KACF,CAAC,CAAC;AACL,CAAC;AA9ED,sEA8EC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.hasMany = void 0;
7
8
  const relation_decorator_1 = require("../relation.decorator");
8
9
  const relation_types_1 = require("../relation.types");
9
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"has-many.decorator.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAGhE,8DAA+C;AAC/C,sDAAkE;AAElE;;;;;;;GAOG;AACH,SAAgB,OAAO,CACrB,cAAiC,EACjC,UAAuC;IAEvC,OAAO,UAAU,eAAuB,EAAE,GAAW;QACnD,MAAM,IAAI,GAAsB,MAAM,CAAC,MAAM;QAC3C,kDAAkD;QAClD,EAAC,IAAI,EAAE,GAAG,EAAC;QACX,oCAAoC;QACpC,UAAU;QACV,uCAAuC;QACvC;YACE,IAAI,EAAE,6BAAY,CAAC,OAAO;YAC1B,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,eAAe,CAAC,WAAW;YACnC,MAAM,EAAE,cAAc;SACvB,CACF,CAAC;QACF,6BAAQ,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC,CAAC;AACJ,CAAC;AApBD,0BAoBC"}
1
+ {"version":3,"file":"has-many.decorator.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAGhE,8DAA+C;AAC/C,sDAAkE;AAElE;;;;;;;GAOG;AACH,SAAgB,OAAO,CACrB,cAAiC,EACjC,UAAuC;IAEvC,OAAO,UAAU,eAAuB,EAAE,GAAW;QACnD,MAAM,IAAI,GAAsB,MAAM,CAAC,MAAM;QAC3C,kDAAkD;QAClD,EAAC,IAAI,EAAE,GAAG,EAAC;QACX,oCAAoC;QACpC,UAAU;QACV,uCAAuC;QACvC;YACE,IAAI,EAAE,6BAAY,CAAC,OAAO;YAC1B,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,eAAe,CAAC,WAAW;YACnC,MAAM,EAAE,cAAc;SACvB,CACF,CAAC;QACF,6BAAQ,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC,CAAC;AACJ,CAAC;AApBD,0BAoBC"}
@@ -15,3 +15,12 @@ export declare type HasManyResolvedDefinition = HasManyDefinition & {
15
15
  * @internal
16
16
  */
17
17
  export declare function resolveHasManyMetadata(relationMeta: HasManyDefinition): HasManyResolvedDefinition;
18
+ /**
19
+ * A helper to check relation type and the existence of the source/target models
20
+ * and set up keyFrom
21
+ * for HasMany(Through) relations
22
+ * @param relationMeta
23
+ *
24
+ * @returns relationMeta that has set up keyFrom
25
+ */
26
+ export declare function resolveHasManyMetaHelper(relationMeta: HasManyDefinition): HasManyDefinition;
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.resolveHasManyMetaHelper = exports.resolveHasManyMetadata = void 0;
7
8
  const tslib_1 = require("tslib");
8
9
  const debug_1 = tslib_1.__importDefault(require("debug"));
9
10
  const lodash_1 = require("lodash");
@@ -19,6 +20,36 @@ const debug = debug_1.default('loopback:repository:has-many-helpers');
19
20
  * @internal
20
21
  */
21
22
  function resolveHasManyMetadata(relationMeta) {
23
+ // some checks and relationMeta.keyFrom are handled in here
24
+ relationMeta = resolveHasManyMetaHelper(relationMeta);
25
+ const targetModel = relationMeta.target();
26
+ const targetModelProperties = targetModel.definition && targetModel.definition.properties;
27
+ const sourceModel = relationMeta.source;
28
+ if (relationMeta.keyTo && targetModelProperties[relationMeta.keyTo]) {
29
+ // The explicit cast is needed because of a limitation of type inference
30
+ return relationMeta;
31
+ }
32
+ debug('Resolved model %s from given metadata: %o', targetModel.modelName, targetModel);
33
+ const defaultFkName = lodash_1.camelCase(sourceModel.modelName + '_id');
34
+ const hasDefaultFkProperty = targetModelProperties[defaultFkName];
35
+ if (!hasDefaultFkProperty) {
36
+ const reason = `target model ${targetModel.name} is missing definition of foreign key ${defaultFkName}`;
37
+ throw new errors_1.InvalidRelationError(reason, relationMeta);
38
+ }
39
+ return Object.assign(relationMeta, {
40
+ keyTo: defaultFkName,
41
+ });
42
+ }
43
+ exports.resolveHasManyMetadata = resolveHasManyMetadata;
44
+ /**
45
+ * A helper to check relation type and the existence of the source/target models
46
+ * and set up keyFrom
47
+ * for HasMany(Through) relations
48
+ * @param relationMeta
49
+ *
50
+ * @returns relationMeta that has set up keyFrom
51
+ */
52
+ function resolveHasManyMetaHelper(relationMeta) {
22
53
  if (relationMeta.type !== relation_types_1.RelationType.hasMany) {
23
54
  const reason = 'relation type must be HasMany';
24
55
  throw new errors_1.InvalidRelationError(reason, relationMeta);
@@ -27,14 +58,11 @@ function resolveHasManyMetadata(relationMeta) {
27
58
  const reason = 'target must be a type resolver';
28
59
  throw new errors_1.InvalidRelationError(reason, relationMeta);
29
60
  }
30
- const targetModel = relationMeta.target();
31
- const targetModelProperties = targetModel.definition && targetModel.definition.properties;
32
61
  const sourceModel = relationMeta.source;
33
62
  if (!sourceModel || !sourceModel.modelName) {
34
63
  const reason = 'source model must be defined';
35
64
  throw new errors_1.InvalidRelationError(reason, relationMeta);
36
65
  }
37
- // keyFrom defaults to id property
38
66
  let keyFrom;
39
67
  if (relationMeta.keyFrom &&
40
68
  relationMeta.source.definition.properties[relationMeta.keyFrom]) {
@@ -43,23 +71,7 @@ function resolveHasManyMetadata(relationMeta) {
43
71
  else {
44
72
  keyFrom = sourceModel.getIdProperties()[0];
45
73
  }
46
- // Make sure that if it already keys to the foreign key property,
47
- // the key exists in the target model
48
- if (relationMeta.keyTo && targetModelProperties[relationMeta.keyTo]) {
49
- // The explicit cast is needed because of a limitation of type inference
50
- return Object.assign(relationMeta, { keyFrom });
51
- }
52
- debug('Resolved model %s from given metadata: %o', targetModel.modelName, targetModel);
53
- const defaultFkName = lodash_1.camelCase(sourceModel.modelName + '_id');
54
- const hasDefaultFkProperty = targetModelProperties[defaultFkName];
55
- if (!hasDefaultFkProperty) {
56
- const reason = `target model ${targetModel.name} is missing definition of foreign key ${defaultFkName}`;
57
- throw new errors_1.InvalidRelationError(reason, relationMeta);
58
- }
59
- return Object.assign(relationMeta, {
60
- keyFrom,
61
- keyTo: defaultFkName,
62
- });
74
+ return Object.assign(relationMeta, { keyFrom });
63
75
  }
64
- exports.resolveHasManyMetadata = resolveHasManyMetadata;
76
+ exports.resolveHasManyMetaHelper = resolveHasManyMetaHelper;
65
77
  //# sourceMappingURL=has-many.helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"has-many.helpers.js","sourceRoot":"","sources":["../../../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,CAAC,CAAC,CAAC;KAC5C;IACD,iEAAiE;IACjE,qCAAqC;IACrC,IAAI,YAAY,CAAC,KAAK,IAAI,qBAAqB,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;QACnE,wEAAwE;QACxE,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAC,OAAO,EAAC,CAA8B,CAAC;KAC5E;IAED,KAAK,CACH,2CAA2C,EAC3C,WAAW,CAAC,SAAS,EACrB,WAAW,CACZ,CAAC;IACF,MAAM,aAAa,GAAG,kBAAS,CAAC,WAAW,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC;IAC/D,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAElE,IAAI,CAAC,oBAAoB,EAAE;QACzB,MAAM,MAAM,GAAG,gBAAgB,WAAW,CAAC,IAAI,yCAAyC,aAAa,EAAE,CAAC;QACxG,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE;QACjC,OAAO;QACP,KAAK,EAAE,aAAa;KACQ,CAAC,CAAC;AAClC,CAAC;AAzDD,wDAyDC"}
1
+ {"version":3,"file":"has-many.helpers.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many.helpers.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,0DAAiC;AACjC,mCAAiC;AACjC,yCAAkD;AAClD,uDAAmD;AACnD,sDAAkE;AAElE,MAAM,KAAK,GAAG,eAAY,CAAC,sCAAsC,CAAC,CAAC;AAWnE;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,YAA+B;IAE/B,2DAA2D;IAC3D,YAAY,GAAG,wBAAwB,CAAC,YAAY,CAAC,CAAC;IAEtD,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IAC1C,MAAM,qBAAqB,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C,SAAS,EAAE;QAC1C,MAAM,MAAM,GAAG,8BAA8B,CAAC;QAC9C,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IACD,IAAI,OAAO,CAAC;IACZ,IACE,YAAY,CAAC,OAAO;QACpB,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,EAC/D;QACA,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;KAChC;SAAM;QACL,OAAO,GAAG,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC;KAC5C;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAC,OAAO,EAAC,CAAsB,CAAC;AACrE,CAAC;AA5BD,4DA4BC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createHasManyInclusionResolver = void 0;
7
8
  const tslib_1 = require("tslib");
8
9
  const debug_1 = tslib_1.__importDefault(require("debug"));
9
10
  const relation_helpers_1 = require("../relation.helpers");
@@ -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;;;;AAEhE,0DAAiC;AAKjC,0DAI6B;AAE7B,yDAA0D;AAE1D,MAAM,KAAK,GAAG,eAAY,CAAC,iDAAiD,CAAC,CAAC;AAE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
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.DefaultHasManyRepository = void 0;
7
8
  const constraint_utils_1 = require("../../repositories/constraint-utils");
8
9
  class DefaultHasManyRepository {
9
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"has-many.repository.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many.repository.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAMhE,0EAI6C;AA6C7C,MAAa,wBAAwB;IAKnC;;;;;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,sCAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,EACrD,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CACR,MAA6B,EAC7B,OAAiB;QAEjB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,gBAAgB,CAAC,IAAI,CAC1B,kCAAe,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,EACxC,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAA2B,EAAE,OAAiB;QACzD,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,gBAAgB,CAAC,SAAS,CAC/B,iCAAc,CAAC,KAAK,EAAE,IAAI,CAAC,UAAiC,CAAC,EAC7D,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK,CACT,UAAoC,EACpC,KAA2B,EAC3B,OAAiB;QAEjB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,gBAAgB,CAAC,SAAS,CAC/B,sCAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,EAChD,iCAAc,CAAC,KAAK,EAAE,IAAI,CAAC,UAAiC,CAAC,EAC7D,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AA1DD,4DA0DC"}
1
+ {"version":3,"file":"has-many.repository.js","sourceRoot":"","sources":["../../../src/relations/has-many/has-many.repository.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAMhE,0EAI6C;AA6C7C,MAAa,wBAAwB;IAKnC;;;;;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,sCAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,UAAU,CAAC,EACrD,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CACR,MAA6B,EAC7B,OAAiB;QAEjB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,gBAAgB,CAAC,IAAI,CAC1B,kCAAe,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,EACxC,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAA2B,EAAE,OAAiB;QACzD,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,gBAAgB,CAAC,SAAS,CAC/B,iCAAc,CAAC,KAAK,EAAE,IAAI,CAAC,UAAiC,CAAC,EAC7D,OAAO,CACR,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK,CACT,UAAoC,EACpC,KAA2B,EAC3B,OAAiB;QAEjB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1D,OAAO,gBAAgB,CAAC,SAAS,CAC/B,sCAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,EAChD,iCAAc,CAAC,KAAK,EAAE,IAAI,CAAC,UAAiC,CAAC,EAC7D,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AA1DD,4DA0DC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createHasOneRepositoryFactory = void 0;
7
8
  const tslib_1 = require("tslib");
8
9
  const debug_1 = tslib_1.__importDefault(require("debug"));
9
10
  const has_one_helpers_1 = require("./has-one.helpers");
@@ -1 +1 @@
1
- {"version":3,"file":"has-one-repository.factory.js","sourceRoot":"","sources":["../../../src/relations/has-one/has-one-repository.factory.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,0DAAiC;AAKjC,uDAAwD;AACxD,6EAA2E;AAC3E,6DAA+E;AAE/E,MAAM,KAAK,GAAG,eAAY,CAAC,gDAAgD,CAAC,CAAC;AAgB7E;;;;;;;;;;;;GAYG;AACH,SAAgB,6BAA6B,CAK3C,gBAAkC,EAClC,sBAAsE;IAEtE,MAAM,IAAI,GAAG,uCAAqB,CAAC,gBAAgB,CAAC,CAAC;IACrD,KAAK,CAAC,uCAAuC,EAAE,IAAI,CAAC,CAAC;IACrD,MAAM,MAAM,GAAoD,UAC9D,OAAuB;QAEvB,8DAA8D;QAC9D,MAAM,UAAU,GAAQ,EAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAC,CAAC;QAChD,OAAO,IAAI,4CAAuB,CAIhC,sBAAsB,EAAE,UAAgC,CAAC,CAAC;IAC9D,CAAC,CAAC;IACF,MAAM,CAAC,iBAAiB,GAAG,0DAA6B,CACtD,IAAI,EACJ,sBAAsB,CACvB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AA1BD,sEA0BC"}
1
+ {"version":3,"file":"has-one-repository.factory.js","sourceRoot":"","sources":["../../../src/relations/has-one/has-one-repository.factory.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,0DAAiC;AAKjC,uDAAwD;AACxD,6EAA2E;AAC3E,6DAA+E;AAE/E,MAAM,KAAK,GAAG,eAAY,CAAC,gDAAgD,CAAC,CAAC;AAgB7E;;;;;;;;;;;;GAYG;AACH,SAAgB,6BAA6B,CAK3C,gBAAkC,EAClC,sBAAsE;IAEtE,MAAM,IAAI,GAAG,uCAAqB,CAAC,gBAAgB,CAAC,CAAC;IACrD,KAAK,CAAC,uCAAuC,EAAE,IAAI,CAAC,CAAC;IACrD,MAAM,MAAM,GAAoD,UAC9D,OAAuB;QAEvB,8DAA8D;QAC9D,MAAM,UAAU,GAAQ,EAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAC,CAAC;QAChD,OAAO,IAAI,4CAAuB,CAIhC,sBAAsB,EAAE,UAAgC,CAAC,CAAC;IAC9D,CAAC,CAAC;IACF,MAAM,CAAC,iBAAiB,GAAG,0DAA6B,CACtD,IAAI,EACJ,sBAAsB,CACvB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AA1BD,sEA0BC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.hasOne = void 0;
7
8
  const relation_decorator_1 = require("../relation.decorator");
8
9
  const relation_types_1 = require("../relation.types");
9
10
  /*
@@ -1 +1 @@
1
- {"version":3,"file":"has-one.decorator.js","sourceRoot":"","sources":["../../../src/relations/has-one/has-one.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAGhE,8DAA+C;AAC/C,sDAAiE;AAEjE;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,cAAiC,EACjC,UAAsC;IAEtC,OAAO,UAAU,eAAuB,EAAE,GAAW;QACnD,wDAAwD;QAExD,MAAM,IAAI,GAAqB,MAAM,CAAC,MAAM;QAC1C,kDAAkD;QAClD,EAAE;QACF,oCAAoC;QACpC,UAAU;QACV,uCAAuC;QACvC;YACE,IAAI,EAAE,6BAAY,CAAC,MAAM;YACzB,WAAW,EAAE,KAAK;YAClB,IAAI,EAAE,GAAG;YACT,MAAM,EAAE,eAAe,CAAC,WAAW;YACnC,MAAM,EAAE,cAAc;SACvB,CACF,CAAC;QACF,6BAAQ,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC,CAAC;AACJ,CAAC;AAvBD,wBAuBC"}
1
+ {"version":3,"file":"has-one.decorator.js","sourceRoot":"","sources":["../../../src/relations/has-one/has-one.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAGhE,8DAA+C;AAC/C,sDAAiE;AAEjE;;;;;;GAMG;AACH,SAAgB,MAAM,CACpB,cAAiC,EACjC,UAAsC;IAEtC,OAAO,UAAU,eAAuB,EAAE,GAAW;QACnD,wDAAwD;QAExD,MAAM,IAAI,GAAqB,MAAM,CAAC,MAAM;QAC1C,kDAAkD;QAClD,EAAE;QACF,oCAAoC;QACpC,UAAU;QACV,uCAAuC;QACvC;YACE,IAAI,EAAE,6BAAY,CAAC,MAAM;YACzB,WAAW,EAAE,KAAK;YAClB,IAAI,EAAE,GAAG;YACT,MAAM,EAAE,eAAe,CAAC,WAAW;YACnC,MAAM,EAAE,cAAc;SACvB,CACF,CAAC;QACF,6BAAQ,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC,CAAC;AACJ,CAAC;AAvBD,wBAuBC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.resolveHasOneMetadata = void 0;
7
8
  const tslib_1 = require("tslib");
8
9
  const debug_1 = tslib_1.__importDefault(require("debug"));
9
10
  const lodash_1 = require("lodash");
@@ -1 +1 @@
1
- {"version":3,"file":"has-one.helpers.js","sourceRoot":"","sources":["../../../src/relations/has-one/has-one.helpers.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,0DAAiC;AACjC,mCAAiC;AACjC,yCAAkD;AAClD,uDAAmD;AACnD,sDAAiE;AAEjE,MAAM,KAAK,GAAG,eAAY,CAAC,qCAAqC,CAAC,CAAC;AAWlE;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACnC,YAA8B;IAE9B,IAAK,YAAY,CAAC,IAAqB,KAAK,6BAAY,CAAC,MAAM,EAAE;QAC/D,MAAM,MAAM,GAAG,8BAA8B,CAAC;QAC9C,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,IAAI,CAAC,8BAAc,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;QACxC,MAAM,MAAM,GAAG,gCAAgC,CAAC;QAChD,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IAC1C,MAAM,qBAAq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O,CAAC,EAC/D;QACA,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;KAChC;SAAM;QACL,OAAO,GAAG,WAAW,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC;KAC5C;IAED,iEAAiE;IACjE,qCAAqC;IACrC,IAAI,YAAY,CAAC,KAAK,IAAI,qBAAqB,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;QACnE,wEAAwE;QACxE,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAC,OAAO,EAAC,CAA6B,CAAC;KAC3E;IAED,KAAK,CACH,2CAA2C,EAC3C,WAAW,CAAC,SAAS,EACrB,WAAW,CACZ,CAAC;IACF,MAAM,aAAa,GAAG,kBAAS,CAAC,WAAW,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC;IAC/D,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAElE,IAAI,CAAC,oBAAoB,EAAE;QACzB,MAAM,MAAM,GAAG,gBAAgB,WAAW,CAAC,IAAI,yCAAyC,aAAa,EAAE,CAAC;QACxG,MAAM,IAAI,6BAAoB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;KACtD;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAC,CAAC,CAAC;AACtE,CAAC;AAvDD,sDAuDC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createHasOneInclusionResolver = void 0;
7
8
  const relation_helpers_1 = require("../relation.helpers");
8
9
  const has_one_helpers_1 = require("./has-one.helpers");
9
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"has-one.inclusion-resolver.js","sourceRoot":"","sources":["../../../src/relations/has-one/has-one.inclusion-resolver.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAMhE,0DAI6B;AAE7B,uDAAwD;AAExD;;;;;;;;;GASG;AACH,SAAgB,6BAA6B,CAK3C,IAAsB,EACtB,aAEC;IAED,MAAM,YAAY,GAAG,uCAAqB,CAAC,IAAI,CAAC,CAAC;IAEjD,OAAO,KAAK,UAAU,gBAAgB,CACpC,QAAkB,EAClB,SAAoB,EACpB,OAAiB;QAEjB,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAEhC,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,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,OAAO,mDAAgC,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC;AAlCD,sEAkCC"}
1
+ {"version":3,"file":"has-one.inclusion-resolver.js","sourceRoot":"","sources":["../../../src/relations/has-one/has-one.inclusion-resolver.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAMhE,0DAI6B;AAE7B,uDAAwD;AAExD;;;;;;;;;GASG;AACH,SAAgB,6BAA6B,CAK3C,IAAsB,EACtB,aAEC;IAED,MAAM,YAAY,GAAG,uCAAqB,CAAC,IAAI,CAAC,CAAC;IAEjD,OAAO,KAAK,UAAU,gBAAgB,CACpC,QAAkB,EAClB,SAAoB,EACpB,OAAiB;QAEjB,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAEhC,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,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,OAAO,mDAAgC,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC9E,CAAC,CAAC;AACJ,CAAC;AAlCD,sEAkCC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.DefaultHasOneRepository = void 0;
7
8
  const errors_1 = require("../../errors");
8
9
  const repositories_1 = require("../../repositories");
9
10
  class DefaultHasOneRepository {
@@ -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,MAA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C"}
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"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.referencesMany = exports.referencesOne = exports.embedsMany = exports.embedsOne = exports.getModelRelations = exports.relation = exports.RELATIONS_KEY = void 0;
7
8
  const context_1 = require("@loopback/context");
8
9
  const decorators_1 = require("../decorators");
9
10
  const relation_types_1 = require("./relation.types");
@@ -1 +1 @@
1
- {"version":3,"file":"relation.decorator.js","sourceRoot":"","sources":["../../src/relations/relation.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAEhE,+CAA2D;AAC3D,8CAAmD;AAEnD,qDAA8C;AAEjC,QAAA,aAAa,GAAG,oBAAoB,CAAC;AAElD;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,UAAmB;IAC1C,+CAA+C;IAC/C,OAAO,kCAAwB,CAAC,eAAe,CAAC,qBAAa,EAAE,UAAU,EAAE;QACzE,aAAa,EAAE,WAAW;KAC3B,CAAC,CAAC;AACL,CAAC;AALD,4BAKC;AAED;;;;;GAKG;AACH,SAAgB,iB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,UAAmB;IAC5C,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,6BAAY,CAAC,UAAU,EAAC,EAAE,UAAU,CAAC,CAAC;IACvE,OAAO,kCAAwB,CAAC,eAAe,CAAC,qBAAa,EAAE,GAAG,EAAE;QAClE,aAAa,EAAE,aAAa;KAC7B,CAAC,CAAC;AACL,CAAC;AALD,gCAKC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAAC,UAAmB;IAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,6BAAY,CAAC,aAAa,EAAC,EAAE,UAAU,CAAC,CAAC;IAC1E,OAAO,kCAAwB,CAAC,eAAe,CAAC,qBAAa,EAAE,GAAG,EAAE;QAClE,aAAa,EAAE,gBAAgB;KAChC,CAAC,CAAC;AACL,CAAC;AALD,sCAKC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,UAAmB;IAChD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,6BAAY,CAAC,cAAc,EAAC,EAAE,UAAU,CAAC,CAAC;IAC3E,OAAO,kCAAwB,CAAC,eAAe,CAAC,qBAAa,EAAE,GAAG,EAAE;QAClE,aAAa,EAAE,iBAAiB;KACjC,CAAC,CAAC;AACL,CAAC;AALD,wCAKC"}
@@ -4,6 +4,7 @@
4
4
  // This file is licensed under the MIT License.
5
5
  // License text available at https://opensource.org/licenses/MIT
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.isBsonType = exports.deduplicate = exports.reduceAsSingleItem = exports.reduceAsArray = exports.normalizeKey = exports.getKeyValue = exports.buildLookupMap = exports.flattenMapByKeys = exports.flattenTargetsOfOneToManyRelation = exports.flattenTargetsOfOneToOneRelation = exports.includeRelatedModels = exports.findByForeignKeys = void 0;
7
8
  const tslib_1 = require("tslib");
8
9
  const assert_1 = tslib_1.__importDefault(require("assert"));
9
10
  const debug_1 = tslib_1.__importDefault(require("debug"));