@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.
- package/CHANGELOG.md +57 -0
- package/dist/common-types.d.ts +1 -0
- package/dist/common-types.js +2 -0
- package/dist/common-types.js.map +1 -1
- package/dist/connectors/index.js +4 -0
- package/dist/connectors/index.js.map +1 -1
- package/dist/decorators/metadata.js +1 -0
- package/dist/decorators/metadata.js.map +1 -1
- package/dist/decorators/model.decorator.d.ts +1 -1
- package/dist/decorators/model.decorator.js +1 -0
- package/dist/decorators/model.decorator.js.map +1 -1
- package/dist/decorators/repository.decorator.js +1 -0
- package/dist/decorators/repository.decorator.js.map +1 -1
- package/dist/define-model-class.js +1 -0
- package/dist/define-model-class.js.map +1 -1
- package/dist/define-repository-class.d.ts +119 -0
- package/dist/define-repository-class.js +98 -0
- package/dist/define-repository-class.js.map +1 -0
- package/dist/errors/entity-not-found.error.js +1 -0
- package/dist/errors/entity-not-found.error.js.map +1 -1
- package/dist/errors/invalid-relation.error.js +1 -0
- package/dist/errors/invalid-relation.error.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/keys.d.ts +34 -0
- package/dist/keys.js +44 -0
- package/dist/keys.js.map +1 -0
- package/dist/mixins/repository.mixin.d.ts +91 -9
- package/dist/mixins/repository.mixin.js +62 -20
- package/dist/mixins/repository.mixin.js.map +1 -1
- package/dist/model.d.ts +16 -1
- package/dist/model.js +61 -9
- package/dist/model.js.map +1 -1
- package/dist/query.js +1 -0
- package/dist/query.js.map +1 -1
- package/dist/relations/belongs-to/belongs-to-accessor.js +1 -0
- package/dist/relations/belongs-to/belongs-to-accessor.js.map +1 -1
- package/dist/relations/belongs-to/belongs-to.decorator.js +1 -0
- package/dist/relations/belongs-to/belongs-to.decorator.js.map +1 -1
- package/dist/relations/belongs-to/belongs-to.helpers.js +1 -0
- package/dist/relations/belongs-to/belongs-to.helpers.js.map +1 -1
- package/dist/relations/belongs-to/belongs-to.inclusion-resolver.js +1 -0
- package/dist/relations/belongs-to/belongs-to.inclusion-resolver.js.map +1 -1
- package/dist/relations/belongs-to/belongs-to.repository.js +1 -0
- package/dist/relations/belongs-to/belongs-to.repository.js.map +1 -1
- package/dist/relations/has-many/has-many-repository.factory.js +1 -0
- package/dist/relations/has-many/has-many-repository.factory.js.map +1 -1
- package/dist/relations/has-many/has-many-through.helpers.d.ts +74 -0
- package/dist/relations/has-many/has-many-through.helpers.js +145 -0
- package/dist/relations/has-many/has-many-through.helpers.js.map +1 -0
- package/dist/relations/has-many/has-many.decorator.js +1 -0
- package/dist/relations/has-many/has-many.decorator.js.map +1 -1
- package/dist/relations/has-many/has-many.helpers.d.ts +9 -0
- package/dist/relations/has-many/has-many.helpers.js +33 -21
- package/dist/relations/has-many/has-many.helpers.js.map +1 -1
- package/dist/relations/has-many/has-many.inclusion-resolver.js +1 -0
- package/dist/relations/has-many/has-many.inclusion-resolver.js.map +1 -1
- package/dist/relations/has-many/has-many.repository.js +1 -0
- package/dist/relations/has-many/has-many.repository.js.map +1 -1
- package/dist/relations/has-one/has-one-repository.factory.js +1 -0
- package/dist/relations/has-one/has-one-repository.factory.js.map +1 -1
- package/dist/relations/has-one/has-one.decorator.js +1 -0
- package/dist/relations/has-one/has-one.decorator.js.map +1 -1
- package/dist/relations/has-one/has-one.helpers.js +1 -0
- package/dist/relations/has-one/has-one.helpers.js.map +1 -1
- package/dist/relations/has-one/has-one.inclusion-resolver.js +1 -0
- package/dist/relations/has-one/has-one.inclusion-resolver.js.map +1 -1
- package/dist/relations/has-one/has-one.repository.js +1 -0
- package/dist/relations/has-one/has-one.repository.js.map +1 -1
- package/dist/relations/relation.decorator.js +1 -0
- package/dist/relations/relation.decorator.js.map +1 -1
- package/dist/relations/relation.helpers.js +1 -0
- package/dist/relations/relation.helpers.js.map +1 -1
- package/dist/relations/relation.types.d.ts +25 -27
- package/dist/relations/relation.types.js +2 -1
- package/dist/relations/relation.types.js.map +1 -1
- package/dist/repositories/constraint-utils.js +1 -0
- package/dist/repositories/constraint-utils.js.map +1 -1
- package/dist/repositories/index.js +1 -0
- package/dist/repositories/index.js.map +1 -1
- package/dist/repositories/kv.repository.bridge.js +1 -0
- package/dist/repositories/kv.repository.bridge.js.map +1 -1
- package/dist/repositories/legacy-juggler-bridge.d.ts +3 -3
- package/dist/repositories/legacy-juggler-bridge.js +8 -18
- package/dist/repositories/legacy-juggler-bridge.js.map +1 -1
- package/dist/repositories/repository.js +1 -0
- package/dist/repositories/repository.js.map +1 -1
- package/dist/transaction.js +1 -0
- package/dist/transaction.js.map +1 -1
- package/dist/type-resolver.d.ts +4 -0
- package/dist/type-resolver.js +9 -0
- package/dist/type-resolver.js.map +1 -1
- package/dist/types/any.js +1 -0
- package/dist/types/any.js.map +1 -1
- package/dist/types/array.js +1 -0
- package/dist/types/array.js.map +1 -1
- package/dist/types/boolean.js +1 -0
- package/dist/types/boolean.js.map +1 -1
- package/dist/types/buffer.js +1 -0
- package/dist/types/buffer.js.map +1 -1
- package/dist/types/date.js +1 -0
- package/dist/types/date.js.map +1 -1
- package/dist/types/index.d.ts +11 -9
- package/dist/types/index.js +33 -17
- package/dist/types/index.js.map +1 -1
- package/dist/types/model.js +1 -0
- package/dist/types/model.js.map +1 -1
- package/dist/types/null.d.ts +12 -0
- package/dist/types/null.js +33 -0
- package/dist/types/null.js.map +1 -0
- package/dist/types/number.js +1 -0
- package/dist/types/number.js.map +1 -1
- package/dist/types/object.js +1 -0
- package/dist/types/object.js.map +1 -1
- package/dist/types/string.js +1 -0
- package/dist/types/string.js.map +1 -1
- package/dist/types/union.js +1 -0
- package/dist/types/union.js.map +1 -1
- package/package.json +13 -14
- package/src/common-types.ts +1 -0
- package/src/define-repository-class.ts +170 -0
- package/src/index.ts +2 -0
- package/src/keys.ts +40 -0
- package/src/mixins/repository.mixin.ts +120 -25
- package/src/model.ts +74 -11
- package/src/relations/has-many/has-many-through.helpers.ts +193 -0
- package/src/relations/has-many/has-many.helpers.ts +41 -27
- package/src/relations/relation.types.ts +24 -30
- package/src/repositories/legacy-juggler-bridge.ts +16 -24
- package/src/type-resolver.ts +8 -0
- package/src/types/index.ts +11 -8
- package/src/types/null.ts +35 -0
- package/index.d.ts +0 -6
- package/index.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,63 @@
|
|
|
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
|
+
## [2.5.1](https://github.com/strongloop/loopback-next/compare/@loopback/repository@2.5.0...@loopback/repository@2.5.1) (2020-05-20)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @loopback/repository
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [2.5.0](https://github.com/strongloop/loopback-next/compare/@loopback/repository@2.4.0...@loopback/repository@2.5.0) (2020-05-19)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* hidden properties when strict is false ([133cc6b](https://github.com/strongloop/loopback-next/commit/133cc6b267cd3e339821eb908c87e571773dc845))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* **repository:** add `model()` to RepositoryMixin ([8314612](https://github.com/strongloop/loopback-next/commit/8314612f816f0eb41d5a30f71dffa8738b84b2d6)), closes [/github.com/strongloop/loopback-next/pull/5378#discussion_r424980840](https://github.com//github.com/strongloop/loopback-next/pull/5378/issues/discussion_r424980840)
|
|
25
|
+
* **repository:** adding hasManyThrough to hasMany and its helpers ([fe4cf5e](https://github.com/strongloop/loopback-next/commit/fe4cf5e523bb86dd8b9160c0382e1aba2d096056))
|
|
26
|
+
* **repository:** define constants for repository binding namespaces and tags ([43e84a1](https://github.com/strongloop/loopback-next/commit/43e84a1ad53bc849f15dfbc5fc11123108463be4))
|
|
27
|
+
* **repository:** extract helper `rejectNavigationalPropertiesInData` ([4cc8eba](https://github.com/strongloop/loopback-next/commit/4cc8eba853232213f9f82408568587d81103142e))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [2.4.0](https://github.com/strongloop/loopback-next/compare/@loopback/repository@2.3.0...@loopback/repository@2.4.0) (2020-05-07)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* **repository:** updateById behaves like updateAll when called with an undefined value for id ([763dba0](https://github.com/strongloop/loopback-next/commit/763dba0abba568af5397f70f0928842bfbe92f3d))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* **core:** allow options for artifact registration on an application ([f3fdc3b](https://github.com/strongloop/loopback-next/commit/f3fdc3b94e34610dd1bebb600a497c77a2794019))
|
|
44
|
+
* **repository:** add null type ([0aa585a](https://github.com/strongloop/loopback-next/commit/0aa585a5ea686b9c9a06b5341a1dcdfa4c80787c))
|
|
45
|
+
* **repository:** generic factory for repository classes ([501f032](https://github.com/strongloop/loopback-next/commit/501f032f5dfcedf24f8c08a150a9efde657802d7))
|
|
46
|
+
* **repository:** to object preserves prototype ([52465c3](https://github.com/strongloop/loopback-next/commit/52465c35b774f7f04ee191333fc4d9b1126be23f))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# [2.3.0](https://github.com/strongloop/loopback-next/compare/@loopback/repository@2.2.1...@loopback/repository@2.3.0) (2020-04-29)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
* populate x-typescript-type for openapi schema ([02a2633](https://github.com/strongloop/loopback-next/commit/02a26339e8a49b92148aa9c05179458a4bc85a70))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
6
63
|
## [2.2.1](https://github.com/strongloop/loopback-next/compare/@loopback/repository@2.2.0...@loopback/repository@2.2.1) (2020-04-23)
|
|
7
64
|
|
|
8
65
|
**Note:** Version bump only for package @loopback/repository
|
package/dist/common-types.d.ts
CHANGED
package/dist/common-types.js
CHANGED
|
@@ -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.CountSchema = void 0;
|
|
7
8
|
/**
|
|
8
9
|
* JSON Schema describing the Count interface. It's the response type for
|
|
9
10
|
* REST calls to APIs which return Count
|
|
@@ -11,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
12
|
exports.CountSchema = {
|
|
12
13
|
type: 'object',
|
|
13
14
|
title: 'loopback.Count',
|
|
15
|
+
'x-typescript-type': '@loopback/repository#Count',
|
|
14
16
|
properties: { count: { type: 'number' } },
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=common-types.js.map
|
package/dist/common-types.js.map
CHANGED
|
@@ -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
|
|
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"}
|
package/dist/connectors/index.js
CHANGED
|
@@ -4,4 +4,8 @@
|
|
|
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
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
tslib_1.__exportStar(require("./connector"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./crud.connector"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./kv.connector"), exports);
|
|
7
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connectors/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,sDAA4B;AAC5B,2DAAiC;AACjC,yDAA+B"}
|
|
@@ -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.ModelMetadataHelper = void 0;
|
|
7
8
|
const context_1 = require("@loopback/context");
|
|
8
9
|
const model_1 = require("../model");
|
|
9
10
|
const relations_1 = require("../relations");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/decorators/metadata.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/decorators/metadata.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,+CAAuE;AACvE,o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kDAoEC"}
|
|
@@ -10,7 +10,7 @@ export declare type PropertyMap = MetadataMap<PropertyDefinition>;
|
|
|
10
10
|
* @returns A class decorator for `model`
|
|
11
11
|
*/
|
|
12
12
|
export declare function model(definition?: Partial<ModelDefinitionSyntax>): (target: Function & {
|
|
13
|
-
definition?: ModelDefinition
|
|
13
|
+
definition?: ModelDefinition;
|
|
14
14
|
}) => void;
|
|
15
15
|
/**
|
|
16
16
|
* Build model definition from decorations
|
|
@@ -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.property = exports.buildModelDefinition = exports.model = exports.MODEL_WITH_PROPERTIES_KEY = exports.MODEL_PROPERTIES_KEY = exports.MODEL_KEY = void 0;
|
|
7
8
|
const context_1 = require("@loopback/context");
|
|
8
9
|
const model_1 = require("../model");
|
|
9
10
|
const relation_decorator_1 = require("../relations/relation.decorator");
|
|
@@ -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
|
|
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,+CAM2B;AAC3B,oCAMkB;AAClB,wEAA8D;AAEjD,QAAA,SAAS,GAAG,0BAAgB,CAAC,MAAM,CAG9C,gBAAgB,CAAC,CAAC;AACP,QAAA,oBAAoB,GAAG,0BAAgB,CAAC,MAAM,CAGzD,2BAA2B,CAAC,CAAC;AAClB,QAAA,yBAAyB,GAAG,0BAAgB,CAAC,MAAM,CAG9D,+BAA+B,CAAC,CAAC;AAInC;;;;GAIG;AACH,S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AM,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"}
|
|
@@ -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.repository = exports.RepositoryMetadata = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const context_1 = require("@loopback/context");
|
|
9
10
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repository.decorator.js","sourceRoot":"","sources":["../../src/decorators/repository.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"repository.decorator.js","sourceRoot":"","sources":["../../src/decorators/repository.decorator.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,+CAA6D;AAC7D,4DAA4B;AAI5B,kDAAkE;AAClE,iFAA8D;AAY9D;;GAEG;AACH,MAAa,kBAAkB;IAsB7B;;;;;;;;;;;;;;;OAeG;IACH,YACE,WAAmC,EACnC,UAAqD;QAErD,IAAI,CAAC,IAAI;YACP,OAAO,WAAW,KAAK,QAAQ,IAAI,UAAU,KAAK,SAAS;gBACzD,CAAC,CAAC,WAAW;gBACb,CAAC,CAAC,SAAS,CAAC;QAChB,IAAI,C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,CAAC;AACJ,CAAC"}
|
|
@@ -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.defineModelClass = void 0;
|
|
7
8
|
const tslib_1 = require("tslib");
|
|
8
9
|
const assert = tslib_1.__importStar(require("assert"));
|
|
9
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-model-class.js","sourceRoot":"","sources":["../src/define-model-class.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"define-model-class.js","sourceRoot":"","sources":["../src/define-model-class.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,uDAAiC;AAIjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,SAAgB,gBAAgB,CAI9B,IAAc,CAAC,qBAAqB,EACpC,UAA2B;IAE3B,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC;IAClC,MAAM,qBAAqB,GAAG,IAAI,QAAQ,CACxC,IAAI,CAAC,IAAI,EACT,gBAAgB,SAAS,YAAY,IAAI,CAAC,IAAI,KAAK,CACpD,CAAC;IACF,MAAM,UAAU,GAAG,qBAAqB,CAAC,IAAI,CAG5C,CAAC;IACF,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACzC,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;IACnC,OAAO,UAAU,CAAC;AACpB,CAAC;AAnBD,4CAmBC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { PrototypeOf } from './common-types';
|
|
2
|
+
import { Entity, Model } from './model';
|
|
3
|
+
import { DefaultCrudRepository, DefaultKeyValueRepository, juggler, Repository } from './repositories';
|
|
4
|
+
/**
|
|
5
|
+
* Signature for a Repository class bound to a given model. The constructor
|
|
6
|
+
* accepts only the dataSource to use for persistence.
|
|
7
|
+
*
|
|
8
|
+
* `define*` functions return a class implementing this interface.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam M - Model class
|
|
11
|
+
* @typeParam R - Repository class/interface
|
|
12
|
+
*/
|
|
13
|
+
export interface ModelRepositoryClass<M extends Model, R extends Repository<M>> {
|
|
14
|
+
/**
|
|
15
|
+
* The constructor for the generated repository class
|
|
16
|
+
* @param dataSource - DataSource object
|
|
17
|
+
*/
|
|
18
|
+
new (dataSource: juggler.DataSource): R;
|
|
19
|
+
prototype: R;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Signature for repository classes that can be used as the base class for
|
|
23
|
+
* `define*` functions. The constructor of a base repository class accepts
|
|
24
|
+
* the target model constructor and the datasource to use.
|
|
25
|
+
*
|
|
26
|
+
* `define*` functions require a class implementing this interface on input.
|
|
27
|
+
*
|
|
28
|
+
* @typeParam M - Model class constructor, e.g `typeof Model`.
|
|
29
|
+
* **❗️IMPORTANT: The type argument `M` is describing the model constructor type
|
|
30
|
+
* (e.g. `typeof Model`), not the model instance type (`Model`) as is the case
|
|
31
|
+
* in other repository-related types. The constructor type is required
|
|
32
|
+
* to support custom repository classes requiring a Model subclass in the
|
|
33
|
+
* constructor arguments, e.g. `Entity` or a user-provided model.**
|
|
34
|
+
*
|
|
35
|
+
* @typeParam R - Repository class/interface
|
|
36
|
+
*/
|
|
37
|
+
export interface BaseRepositoryClass<M extends typeof Model, R extends Repository<PrototypeOf<M>>> {
|
|
38
|
+
/**
|
|
39
|
+
* The constructor for the generated repository class
|
|
40
|
+
* @param modelClass - Model class
|
|
41
|
+
* @param dataSource - DataSource object
|
|
42
|
+
*/
|
|
43
|
+
new (modelClass: M, dataSource: juggler.DataSource): R;
|
|
44
|
+
prototype: R;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create (define) a repository class for the given model.
|
|
48
|
+
*
|
|
49
|
+
* See also `defineCrudRepositoryClass` and `defineKeyValueRepositoryClass`
|
|
50
|
+
* for convenience wrappers providing repository class factory for the default
|
|
51
|
+
* CRUD and KeyValue implementations.
|
|
52
|
+
*
|
|
53
|
+
* **❗️IMPORTANT: The compiler (TypeScript 3.8) is not able to correctly infer
|
|
54
|
+
* generic arguments `M` and `R` from the class constructors provided in
|
|
55
|
+
* function arguments. You must always provide both M and R types explicitly.**
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
*
|
|
59
|
+
* ```ts
|
|
60
|
+
* const AddressRepository = defineRepositoryClass<
|
|
61
|
+
* typeof Address,
|
|
62
|
+
* DefaultEntityCrudRepository<
|
|
63
|
+
* Address,
|
|
64
|
+
* typeof Address.prototype.id,
|
|
65
|
+
* AddressRelations
|
|
66
|
+
* >,
|
|
67
|
+
* >(Address, DefaultCrudRepository);
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @param modelClass - A model class such as `Address`.
|
|
71
|
+
* @param baseRepositoryClass - Repository implementation to use as the base,
|
|
72
|
+
* e.g. `DefaultCrudRepository`.
|
|
73
|
+
*
|
|
74
|
+
* @typeParam M - Model class constructor (e.g. `typeof Address`)
|
|
75
|
+
* @typeParam R - Repository class (e.g. `DefaultCrudRepository<Address, number>`)
|
|
76
|
+
*/
|
|
77
|
+
export declare function defineRepositoryClass<M extends typeof Model, R extends Repository<PrototypeOf<M>>>(modelClass: M, baseRepositoryClass: BaseRepositoryClass<M, R>): ModelRepositoryClass<PrototypeOf<M>, R>;
|
|
78
|
+
/**
|
|
79
|
+
* Create (define) an entity CRUD repository class for the given model.
|
|
80
|
+
* This function always uses `DefaultCrudRepository` as the base class,
|
|
81
|
+
* use `defineRepositoryClass` if you want to use your own base repository.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
*
|
|
85
|
+
* ```ts
|
|
86
|
+
* const ProductRepository = defineCrudRepositoryClass<
|
|
87
|
+
* Product,
|
|
88
|
+
* typeof Product.prototype.id,
|
|
89
|
+
* ProductRelations
|
|
90
|
+
* >(Product);
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @param entityClass - An entity class such as `Product`.
|
|
94
|
+
*
|
|
95
|
+
* @typeParam E - An entity class
|
|
96
|
+
* @typeParam IdType - ID type for the entity
|
|
97
|
+
* @typeParam Relations - Relations for the entity
|
|
98
|
+
*/
|
|
99
|
+
export declare function defineCrudRepositoryClass<E extends Entity, IdType, Relations extends object>(entityClass: typeof Entity & {
|
|
100
|
+
prototype: E;
|
|
101
|
+
}): ModelRepositoryClass<E, DefaultCrudRepository<E, IdType, Relations>>;
|
|
102
|
+
/**
|
|
103
|
+
* Create (define) a KeyValue repository class for the given entity.
|
|
104
|
+
* This function always uses `DefaultKeyValueRepository` as the base class,
|
|
105
|
+
* use `defineRepositoryClass` if you want to use your own base repository.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
*
|
|
109
|
+
* ```ts
|
|
110
|
+
* const ProductKeyValueRepository = defineKeyValueRepositoryClass(Product);
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @param modelClass - An entity class such as `Product`.
|
|
114
|
+
*
|
|
115
|
+
* @typeParam M - Model class
|
|
116
|
+
*/
|
|
117
|
+
export declare function defineKeyValueRepositoryClass<M extends Model>(modelClass: typeof Model & {
|
|
118
|
+
prototype: M;
|
|
119
|
+
}): ModelRepositoryClass<M, DefaultKeyValueRepository<M>>;
|
|
@@ -0,0 +1,98 @@
|
|
|
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.defineKeyValueRepositoryClass = exports.defineCrudRepositoryClass = exports.defineRepositoryClass = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
10
|
+
const repositories_1 = require("./repositories");
|
|
11
|
+
/**
|
|
12
|
+
* Create (define) a repository class for the given model.
|
|
13
|
+
*
|
|
14
|
+
* See also `defineCrudRepositoryClass` and `defineKeyValueRepositoryClass`
|
|
15
|
+
* for convenience wrappers providing repository class factory for the default
|
|
16
|
+
* CRUD and KeyValue implementations.
|
|
17
|
+
*
|
|
18
|
+
* **❗️IMPORTANT: The compiler (TypeScript 3.8) is not able to correctly infer
|
|
19
|
+
* generic arguments `M` and `R` from the class constructors provided in
|
|
20
|
+
* function arguments. You must always provide both M and R types explicitly.**
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const AddressRepository = defineRepositoryClass<
|
|
26
|
+
* typeof Address,
|
|
27
|
+
* DefaultEntityCrudRepository<
|
|
28
|
+
* Address,
|
|
29
|
+
* typeof Address.prototype.id,
|
|
30
|
+
* AddressRelations
|
|
31
|
+
* >,
|
|
32
|
+
* >(Address, DefaultCrudRepository);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param modelClass - A model class such as `Address`.
|
|
36
|
+
* @param baseRepositoryClass - Repository implementation to use as the base,
|
|
37
|
+
* e.g. `DefaultCrudRepository`.
|
|
38
|
+
*
|
|
39
|
+
* @typeParam M - Model class constructor (e.g. `typeof Address`)
|
|
40
|
+
* @typeParam R - Repository class (e.g. `DefaultCrudRepository<Address, number>`)
|
|
41
|
+
*/
|
|
42
|
+
function defineRepositoryClass(modelClass, baseRepositoryClass) {
|
|
43
|
+
const repoName = modelClass.name + 'Repository';
|
|
44
|
+
const defineNamedRepo = new Function('ModelCtor', 'BaseRepository', `return class ${repoName} extends BaseRepository {
|
|
45
|
+
constructor(dataSource) {
|
|
46
|
+
super(ModelCtor, dataSource);
|
|
47
|
+
}
|
|
48
|
+
};`);
|
|
49
|
+
const repo = defineNamedRepo(modelClass, baseRepositoryClass);
|
|
50
|
+
assert_1.default.equal(repo.name, repoName);
|
|
51
|
+
return repo;
|
|
52
|
+
}
|
|
53
|
+
exports.defineRepositoryClass = defineRepositoryClass;
|
|
54
|
+
/**
|
|
55
|
+
* Create (define) an entity CRUD repository class for the given model.
|
|
56
|
+
* This function always uses `DefaultCrudRepository` as the base class,
|
|
57
|
+
* use `defineRepositoryClass` if you want to use your own base repository.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* const ProductRepository = defineCrudRepositoryClass<
|
|
63
|
+
* Product,
|
|
64
|
+
* typeof Product.prototype.id,
|
|
65
|
+
* ProductRelations
|
|
66
|
+
* >(Product);
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @param entityClass - An entity class such as `Product`.
|
|
70
|
+
*
|
|
71
|
+
* @typeParam E - An entity class
|
|
72
|
+
* @typeParam IdType - ID type for the entity
|
|
73
|
+
* @typeParam Relations - Relations for the entity
|
|
74
|
+
*/
|
|
75
|
+
function defineCrudRepositoryClass(entityClass) {
|
|
76
|
+
return defineRepositoryClass(entityClass, repositories_1.DefaultCrudRepository);
|
|
77
|
+
}
|
|
78
|
+
exports.defineCrudRepositoryClass = defineCrudRepositoryClass;
|
|
79
|
+
/**
|
|
80
|
+
* Create (define) a KeyValue repository class for the given entity.
|
|
81
|
+
* This function always uses `DefaultKeyValueRepository` as the base class,
|
|
82
|
+
* use `defineRepositoryClass` if you want to use your own base repository.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
*
|
|
86
|
+
* ```ts
|
|
87
|
+
* const ProductKeyValueRepository = defineKeyValueRepositoryClass(Product);
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @param modelClass - An entity class such as `Product`.
|
|
91
|
+
*
|
|
92
|
+
* @typeParam M - Model class
|
|
93
|
+
*/
|
|
94
|
+
function defineKeyValueRepositoryClass(modelClass) {
|
|
95
|
+
return defineRepositoryClass(modelClass, repositories_1.DefaultKeyValueRepository);
|
|
96
|
+
}
|
|
97
|
+
exports.defineKeyValueRepositoryClass = defineKeyValueRepositoryClass;
|
|
98
|
+
//# sourceMappingURL=define-repository-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-repository-class.js","sourceRoot":"","sources":["../src/define-repository-class.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;;AAEhE,4DAA4B;AAG5B,iDAKwB;AAoDxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,SAAgB,qBAAqB,CAInC,UAAa,EACb,mBAA8C;IAE9C,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,GAAG,YAAY,CAAC;IAChD,MAAM,eAAe,GAAG,IAAI,QAAQ,CAClC,WAAW,EACX,gBAAgB,EAChB,gBAAgB,QAAQ;;;;OAIrB,CACJ,CAAC;IAEF,MAAM,IAAI,GAAG,eAAe,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;IAC9D,gBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC;AArBD,sDAqBC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,yBAAyB,CAKvC,WAA2C;IAE3C,OAAO,qBAAqB,CAAC,WAAW,EAAE,oCAAqB,CAAC,CAAC;AACnE,CAAC;AARD,8DAQC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,6BAA6B,CAC3C,UAAyC;IAEzC,OAAO,qBAAqB,CAAC,UAAU,EAAE,wCAAyB,CAAC,CAAC;AACtE,CAAC;AAJD,sEAIC"}
|
|
@@ -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.isEntityNotFoundError = exports.EntityNotFoundError = void 0;
|
|
7
8
|
class EntityNotFoundError extends Error {
|
|
8
9
|
constructor(entityOrName, entityId, extraProperties) {
|
|
9
10
|
const entityName = typeof entityOrName === 'string'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-not-found.error.js","sourceRoot":"","sources":["../../src/errors/entity-not-found.error.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"entity-not-found.error.js","sourceRoot":"","sources":["../../src/errors/entity-not-found.error.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAIhE,MAAa,mBAAmD,SAAQ,KAAK;IAK3E,YACE,YAAoC,EACpC,QAAY,EACZ,eAAuB;QAEvB,MAAM,UAAU,GACd,OAAO,YAAY,KAAK,QAAQ;YAC9B,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,YAAY,CAAC,SAAS,IAAI,YAAY,CAAC,IAAI,CAAC;QAElD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE1C,KAAK,CAAC,qBAAqB,UAAU,YAAY,QAAQ,EAAE,CAAC,CAAC;QAE7D,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAEhD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACvC,CAAC;CACF;AA3BD,kDA2BC;AAED,8DAA8D;AAC9D,SAAgB,qBAAqB,CAAC,CAAM;IAC1C,OAAO,CAAC,YAAY,mBAAmB,CAAC;AAC1C,CAAC;AAFD,sDAEC"}
|
|
@@ -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.isInvalidRelationError = exports.InvalidRelationError = void 0;
|
|
7
8
|
class InvalidRelationError extends Error {
|
|
8
9
|
constructor(reason, relationMeta, extraProperties) {
|
|
9
10
|
const { name, type, source } = relationMeta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-relation.error.js","sourceRoot":"","sources":["../../src/errors/invalid-relation.error.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE
|
|
1
|
+
{"version":3,"file":"invalid-relation.error.js","sourceRoot":"","sources":["../../src/errors/invalid-relation.error.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAIhE,MAAa,oBAAgD,SAAQ,KAAK;IAOxE,YACE,MAAc,EACd,YAA8B,EAC9B,eAAuB;QAEvB,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,GAAG,YAAY,CAAC;QAC1C,MAAM,KAAK,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,KAAI,iBAAiB,CAAC;QACrD,MAAM,OAAO,GAAG,WAAW,IAAI,mBAAmB,KAAK,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QAC7E,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAEhD,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;QAC1C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAE7B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACvC,CAAC;CACF;AA1BD,oDA0BC;AAED,8DAA8D;AAC9D,SAAgB,sBAAsB,CAAC,CAAM;IAC3C,OAAO,CAAC,YAAY,oBAAoB,CAAC;AAC3C,CAAC;AAFD,wDAEC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ export * from './connectors';
|
|
|
18
18
|
export * from './datasource';
|
|
19
19
|
export * from './decorators';
|
|
20
20
|
export * from './define-model-class';
|
|
21
|
+
export * from './define-repository-class';
|
|
21
22
|
export * from './errors';
|
|
23
|
+
export * from './keys';
|
|
22
24
|
export * from './mixins';
|
|
23
25
|
export * from './model';
|
|
24
26
|
export * from './query';
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const tslib_1 = require("tslib");
|
|
8
8
|
tslib_1.__exportStar(require("./common-types"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./connectors"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./datasource"), exports);
|
|
9
11
|
tslib_1.__exportStar(require("./decorators"), exports);
|
|
10
12
|
tslib_1.__exportStar(require("./define-model-class"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./define-repository-class"), exports);
|
|
11
14
|
tslib_1.__exportStar(require("./errors"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./keys"), exports);
|
|
12
16
|
tslib_1.__exportStar(require("./mixins"), exports);
|
|
13
17
|
tslib_1.__exportStar(require("./model"), exports);
|
|
14
18
|
tslib_1.__exportStar(require("./query"), 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;;;AAkBhE,yDAA+B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAkBhE,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"}
|
package/dist/keys.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binding tags for repository related bindings
|
|
3
|
+
*/
|
|
4
|
+
export declare namespace RepositoryTags {
|
|
5
|
+
/**
|
|
6
|
+
* Tag for model class bindings
|
|
7
|
+
*/
|
|
8
|
+
const MODEL = "model";
|
|
9
|
+
/**
|
|
10
|
+
* Tag for repository bindings
|
|
11
|
+
*/
|
|
12
|
+
const REPOSITORY = "repository";
|
|
13
|
+
/**
|
|
14
|
+
* Tag for datasource bindings
|
|
15
|
+
*/
|
|
16
|
+
const DATASOURCE = "datasource";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Binding keys and namespaces for repository related bindings
|
|
20
|
+
*/
|
|
21
|
+
export declare namespace RepositoryBindings {
|
|
22
|
+
/**
|
|
23
|
+
* Namespace for model class bindings
|
|
24
|
+
*/
|
|
25
|
+
const MODELS = "models";
|
|
26
|
+
/**
|
|
27
|
+
* Namespace for repository bindings
|
|
28
|
+
*/
|
|
29
|
+
const REPOSITORIES = "repositories";
|
|
30
|
+
/**
|
|
31
|
+
* Namespace for datasource bindings
|
|
32
|
+
*/
|
|
33
|
+
const DATASOURCES = "datasources";
|
|
34
|
+
}
|
package/dist/keys.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
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.RepositoryBindings = exports.RepositoryTags = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Binding tags for repository related bindings
|
|
10
|
+
*/
|
|
11
|
+
var RepositoryTags;
|
|
12
|
+
(function (RepositoryTags) {
|
|
13
|
+
/**
|
|
14
|
+
* Tag for model class bindings
|
|
15
|
+
*/
|
|
16
|
+
RepositoryTags.MODEL = 'model';
|
|
17
|
+
/**
|
|
18
|
+
* Tag for repository bindings
|
|
19
|
+
*/
|
|
20
|
+
RepositoryTags.REPOSITORY = 'repository';
|
|
21
|
+
/**
|
|
22
|
+
* Tag for datasource bindings
|
|
23
|
+
*/
|
|
24
|
+
RepositoryTags.DATASOURCE = 'datasource';
|
|
25
|
+
})(RepositoryTags = exports.RepositoryTags || (exports.RepositoryTags = {}));
|
|
26
|
+
/**
|
|
27
|
+
* Binding keys and namespaces for repository related bindings
|
|
28
|
+
*/
|
|
29
|
+
var RepositoryBindings;
|
|
30
|
+
(function (RepositoryBindings) {
|
|
31
|
+
/**
|
|
32
|
+
* Namespace for model class bindings
|
|
33
|
+
*/
|
|
34
|
+
RepositoryBindings.MODELS = 'models';
|
|
35
|
+
/**
|
|
36
|
+
* Namespace for repository bindings
|
|
37
|
+
*/
|
|
38
|
+
RepositoryBindings.REPOSITORIES = 'repositories';
|
|
39
|
+
/**
|
|
40
|
+
* Namespace for datasource bindings
|
|
41
|
+
*/
|
|
42
|
+
RepositoryBindings.DATASOURCES = 'datasources';
|
|
43
|
+
})(RepositoryBindings = exports.RepositoryBindings || (exports.RepositoryBindings = {}));
|
|
44
|
+
//# sourceMappingURL=keys.js.map
|
package/dist/keys.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE;;GAEG;AACH,IAAiB,cAAc,CAa9B;AAbD,WAAiB,cAAc;IAC7B;;OAEG;IACU,oBAAK,GAAG,OAAO,CAAC;IAC7B;;OAEG;IACU,yBAAU,GAAG,YAAY,CAAC;IACvC;;OAEG;IACU,yBAAU,GAAG,YAAY,CAAC;AACzC,CAAC,EAbgB,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAa9B;AAED;;GAEG;AACH,IAAiB,kBAAkB,CAalC;AAbD,WAAiB,kBAAkB;IACjC;;OAEG;IACU,yBAAM,GAAG,QAAQ,CAAC;IAC/B;;OAEG;IACU,+BAAY,GAAG,cAAc,CAAC;IAC3C;;OAEG;IACU,8BAAW,GAAG,aAAa,CAAC;AAC3C,CAAC,EAbgB,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAalC"}
|