@loopback/repository 4.0.0-alpha.8 → 4.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.
- package/LICENSE +25 -0
- package/README.md +93 -389
- package/dist/common-types.d.ts +96 -0
- package/dist/common-types.js +24 -0
- package/dist/common-types.js.map +1 -0
- package/dist/connectors/connector.d.ts +48 -0
- package/{lib → dist/connectors}/connector.js +1 -1
- package/dist/connectors/connector.js.map +1 -0
- package/{lib/crud-connector.d.ts → dist/connectors/crud.connector.d.ts} +51 -51
- package/{lib/common-types.js → dist/connectors/crud.connector.js} +2 -2
- package/dist/connectors/crud.connector.js.map +1 -0
- package/dist/connectors/index.d.ts +3 -0
- package/dist/connectors/index.js +11 -0
- package/dist/connectors/index.js.map +1 -0
- package/{lib6/kv-connector.d.ts → dist/connectors/kv.connector.d.ts} +28 -28
- package/{lib/datasource.js → dist/connectors/kv.connector.js} +2 -2
- package/dist/connectors/kv.connector.js.map +1 -0
- package/dist/datasource.d.ts +27 -0
- package/{lib6 → dist}/datasource.js +1 -1
- package/dist/datasource.js.map +1 -0
- package/dist/decorators/index.d.ts +3 -0
- package/dist/decorators/index.js +11 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/metadata.d.ts +12 -0
- package/dist/decorators/metadata.js +51 -0
- package/dist/decorators/metadata.js.map +1 -0
- package/dist/decorators/model.decorator.d.ts +40 -0
- package/dist/decorators/model.decorator.js +112 -0
- package/dist/decorators/model.decorator.js.map +1 -0
- package/dist/decorators/repository.decorator.d.ts +106 -0
- package/dist/decorators/repository.decorator.js +114 -0
- package/dist/decorators/repository.decorator.js.map +1 -0
- package/dist/define-model-class.d.ts +55 -0
- package/dist/define-model-class.js +57 -0
- package/dist/define-model-class.js.map +1 -0
- 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.d.ts +8 -0
- package/dist/errors/entity-not-found.error.js +28 -0
- package/dist/errors/entity-not-found.error.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +10 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/invalid-relation.error.d.ts +10 -0
- package/dist/errors/invalid-relation.error.js +28 -0
- package/dist/errors/invalid-relation.error.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +34 -0
- package/dist/keys.js +44 -0
- package/dist/keys.js.map +1 -0
- package/dist/mixins/index.d.ts +1 -0
- package/dist/mixins/index.js +9 -0
- package/dist/mixins/index.js.map +1 -0
- package/dist/mixins/repository.mixin.d.ts +377 -0
- package/dist/mixins/repository.mixin.js +405 -0
- package/dist/mixins/repository.mixin.js.map +1 -0
- package/dist/model.d.ts +232 -0
- package/dist/model.js +367 -0
- package/dist/model.js.map +1 -0
- package/dist/relations/belongs-to/belongs-to.accessor.d.ts +17 -0
- package/dist/relations/belongs-to/belongs-to.accessor.js +40 -0
- package/dist/relations/belongs-to/belongs-to.accessor.js.map +1 -0
- package/dist/relations/belongs-to/belongs-to.decorator.d.ts +11 -0
- package/dist/relations/belongs-to/belongs-to.decorator.js +64 -0
- package/dist/relations/belongs-to/belongs-to.decorator.js.map +1 -0
- package/dist/relations/belongs-to/belongs-to.helpers.d.ts +17 -0
- package/dist/relations/belongs-to/belongs-to.helpers.js +63 -0
- package/dist/relations/belongs-to/belongs-to.helpers.js.map +1 -0
- package/dist/relations/belongs-to/belongs-to.inclusion-resolver.d.ts +14 -0
- package/dist/relations/belongs-to/belongs-to.inclusion-resolver.js +36 -0
- package/dist/relations/belongs-to/belongs-to.inclusion-resolver.js.map +1 -0
- package/dist/relations/belongs-to/belongs-to.repository.d.ts +28 -0
- package/dist/relations/belongs-to/belongs-to.repository.js +33 -0
- package/dist/relations/belongs-to/belongs-to.repository.js.map +1 -0
- package/dist/relations/belongs-to/index.d.ts +4 -0
- package/dist/relations/belongs-to/index.js +12 -0
- package/dist/relations/belongs-to/index.js.map +1 -0
- package/dist/relations/has-many/has-many-through.helpers.d.ts +182 -0
- package/dist/relations/has-many/has-many-through.helpers.js +282 -0
- package/dist/relations/has-many/has-many-through.helpers.js.map +1 -0
- package/dist/relations/has-many/has-many-through.inclusion-resolver.d.ts +16 -0
- package/dist/relations/has-many/has-many-through.inclusion-resolver.js +78 -0
- package/dist/relations/has-many/has-many-through.inclusion-resolver.js.map +1 -0
- package/dist/relations/has-many/has-many-through.repository-factory.d.ts +17 -0
- package/dist/relations/has-many/has-many-through.repository-factory.js +37 -0
- package/dist/relations/has-many/has-many-through.repository-factory.js.map +1 -0
- package/dist/relations/has-many/has-many-through.repository.d.ts +114 -0
- package/dist/relations/has-many/has-many-through.repository.js +103 -0
- package/dist/relations/has-many/has-many-through.repository.js.map +1 -0
- package/dist/relations/has-many/has-many.decorator.d.ts +11 -0
- package/dist/relations/has-many/has-many.decorator.js +36 -0
- package/dist/relations/has-many/has-many.decorator.js.map +1 -0
- package/dist/relations/has-many/has-many.helpers.d.ts +26 -0
- package/dist/relations/has-many/has-many.helpers.js +78 -0
- package/dist/relations/has-many/has-many.helpers.js.map +1 -0
- package/dist/relations/has-many/has-many.inclusion-resolver.d.ts +14 -0
- package/dist/relations/has-many/has-many.inclusion-resolver.js +45 -0
- package/dist/relations/has-many/has-many.inclusion-resolver.js.map +1 -0
- package/dist/relations/has-many/has-many.repository-factory.d.ts +28 -0
- package/dist/relations/has-many/has-many.repository-factory.js +39 -0
- package/dist/relations/has-many/has-many.repository-factory.js.map +1 -0
- package/dist/relations/has-many/has-many.repository.d.ts +54 -0
- package/dist/relations/has-many/has-many.repository.js +38 -0
- package/dist/relations/has-many/has-many.repository.js.map +1 -0
- package/dist/relations/has-many/index.d.ts +6 -0
- package/dist/relations/has-many/index.js +14 -0
- package/dist/relations/has-many/index.js.map +1 -0
- package/dist/relations/has-one/has-one.decorator.d.ts +3 -0
- package/dist/relations/has-one/has-one.decorator.js +37 -0
- package/dist/relations/has-one/has-one.decorator.js.map +1 -0
- package/dist/relations/has-one/has-one.helpers.d.ts +17 -0
- package/dist/relations/has-one/has-one.helpers.js +64 -0
- package/dist/relations/has-one/has-one.helpers.js.map +1 -0
- package/dist/relations/has-one/has-one.inclusion-resolver.d.ts +14 -0
- package/dist/relations/has-one/has-one.inclusion-resolver.js +35 -0
- package/dist/relations/has-one/has-one.inclusion-resolver.js.map +1 -0
- package/dist/relations/has-one/has-one.repository-factory.d.ts +28 -0
- package/dist/relations/has-one/has-one.repository-factory.js +39 -0
- package/dist/relations/has-one/has-one.repository-factory.js.map +1 -0
- package/dist/relations/has-one/has-one.repository.d.ts +53 -0
- package/dist/relations/has-one/has-one.repository.js +45 -0
- package/dist/relations/has-one/has-one.repository.js.map +1 -0
- package/dist/relations/has-one/index.d.ts +3 -0
- package/dist/relations/has-one/index.js +11 -0
- package/dist/relations/has-one/index.js.map +1 -0
- package/dist/relations/index.d.ts +6 -0
- package/dist/relations/index.js +14 -0
- package/dist/relations/index.js.map +1 -0
- package/dist/relations/relation.decorator.d.ts +39 -0
- package/dist/relations/relation.decorator.js +88 -0
- package/dist/relations/relation.decorator.js.map +1 -0
- package/dist/relations/relation.helpers.d.ts +105 -0
- package/dist/relations/relation.helpers.js +304 -0
- package/dist/relations/relation.helpers.js.map +1 -0
- package/dist/relations/relation.types.d.ts +142 -0
- package/dist/relations/relation.types.js +21 -0
- package/dist/relations/relation.types.js.map +1 -0
- package/dist/repositories/constraint-utils.d.ts +49 -0
- package/dist/repositories/constraint-utils.js +87 -0
- package/dist/repositories/constraint-utils.js.map +1 -0
- package/dist/repositories/index.d.ts +5 -0
- package/dist/repositories/index.js +13 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/kv.repository.bridge.d.ts +30 -0
- package/dist/repositories/kv.repository.bridge.js +76 -0
- package/dist/repositories/kv.repository.bridge.js.map +1 -0
- package/dist/repositories/kv.repository.d.ts +74 -0
- package/{lib/crud-connector.js → dist/repositories/kv.repository.js} +2 -2
- package/dist/repositories/kv.repository.js.map +1 -0
- package/dist/repositories/legacy-juggler-bridge.d.ts +305 -0
- package/dist/repositories/legacy-juggler-bridge.js +452 -0
- package/dist/repositories/legacy-juggler-bridge.js.map +1 -0
- package/dist/repositories/repository.d.ts +223 -0
- package/dist/repositories/repository.js +157 -0
- package/dist/repositories/repository.js.map +1 -0
- package/dist/transaction.d.ts +30 -0
- package/dist/transaction.js +18 -0
- package/dist/transaction.js.map +1 -0
- package/dist/type-resolver.d.ts +42 -0
- package/dist/type-resolver.js +61 -0
- package/dist/type-resolver.js.map +1 -0
- package/{lib → dist}/types/any.d.ts +1 -1
- package/{lib6 → dist}/types/any.js +3 -2
- package/dist/types/any.js.map +1 -0
- package/{lib6 → dist}/types/array.d.ts +4 -4
- package/{lib → dist}/types/array.js +6 -4
- package/dist/types/array.js.map +1 -0
- package/{lib → dist}/types/boolean.d.ts +1 -1
- package/{lib6 → dist}/types/boolean.js +3 -2
- package/dist/types/boolean.js.map +1 -0
- package/{lib6 → dist}/types/buffer.d.ts +2 -2
- package/{lib → dist}/types/buffer.js +8 -6
- package/dist/types/buffer.js.map +1 -0
- package/{lib → dist}/types/date.d.ts +1 -1
- package/{lib → dist}/types/date.js +6 -4
- package/dist/types/date.js.map +1 -0
- package/{lib → dist}/types/index.d.ts +11 -9
- package/dist/types/index.js +49 -0
- package/dist/types/index.js.map +1 -0
- package/{lib6 → dist}/types/model.d.ts +2 -1
- package/{lib6 → dist}/types/model.js +2 -2
- package/dist/types/model.js.map +1 -0
- package/dist/types/null.d.ts +12 -0
- package/{lib/types/boolean.js → dist/types/null.js} +12 -11
- package/dist/types/null.js.map +1 -0
- package/{lib6 → dist}/types/number.d.ts +1 -1
- package/{lib → dist}/types/number.js +6 -4
- package/dist/types/number.js.map +1 -0
- package/{lib → dist}/types/object.d.ts +1 -1
- package/{lib → dist}/types/object.js +7 -6
- package/dist/types/object.js.map +1 -0
- package/{lib → dist}/types/string.d.ts +1 -1
- package/{lib → dist}/types/string.js +3 -2
- package/dist/types/string.js.map +1 -0
- package/{lib6 → dist}/types/type.d.ts +7 -7
- package/{lib6 → dist}/types/type.js +1 -1
- package/dist/types/type.js.map +1 -0
- package/{lib → dist}/types/union.d.ts +1 -1
- package/{lib → dist}/types/union.js +6 -4
- package/dist/types/union.js.map +1 -0
- package/package.json +49 -33
- package/src/common-types.ts +123 -0
- package/src/connectors/connector.ts +70 -0
- package/src/connectors/crud.connector.ts +208 -0
- package/src/connectors/index.ts +8 -0
- package/src/connectors/kv.connector.ts +113 -0
- package/src/datasource.ts +37 -0
- package/src/decorators/index.ts +8 -0
- package/src/decorators/metadata.ts +84 -0
- package/src/decorators/model.decorator.ts +166 -0
- package/src/decorators/repository.decorator.ts +223 -0
- package/src/define-model-class.ts +90 -0
- package/src/define-repository-class.ts +170 -0
- package/src/errors/entity-not-found.error.ts +40 -0
- package/src/errors/index.ts +7 -0
- package/src/errors/invalid-relation.error.ts +39 -0
- package/src/index.ts +36 -0
- package/src/keys.ts +40 -0
- package/{index.d.ts → src/mixins/index.ts} +2 -2
- package/src/mixins/repository.mixin.ts +499 -0
- package/src/model.ts +539 -0
- package/src/relations/belongs-to/belongs-to.accessor.ts +74 -0
- package/src/relations/belongs-to/belongs-to.decorator.ts +81 -0
- package/src/relations/belongs-to/belongs-to.helpers.ts +78 -0
- package/src/relations/belongs-to/belongs-to.inclusion-resolver.ts +71 -0
- package/src/relations/belongs-to/belongs-to.repository.ts +55 -0
- package/src/relations/belongs-to/index.ts +9 -0
- package/src/relations/has-many/has-many-through.helpers.ts +361 -0
- package/src/relations/has-many/has-many-through.inclusion-resolver.ts +135 -0
- package/src/relations/has-many/has-many-through.repository-factory.ts +121 -0
- package/src/relations/has-many/has-many-through.repository.ts +318 -0
- package/src/relations/has-many/has-many.decorator.ts +38 -0
- package/src/relations/has-many/has-many.helpers.ts +100 -0
- package/src/relations/has-many/has-many.inclusion-resolver.ts +88 -0
- package/src/relations/has-many/has-many.repository-factory.ts +76 -0
- package/src/relations/has-many/has-many.repository.ts +118 -0
- package/src/relations/has-many/index.ts +11 -0
- package/src/relations/has-one/has-one.decorator.ts +40 -0
- package/src/relations/has-one/has-one.helpers.ts +84 -0
- package/src/relations/has-one/has-one.inclusion-resolver.ts +65 -0
- package/src/relations/has-one/has-one.repository-factory.ts +72 -0
- package/src/relations/has-one/has-one.repository.ts +127 -0
- package/src/relations/has-one/index.ts +8 -0
- package/src/relations/index.ts +11 -0
- package/src/relations/relation.decorator.ts +90 -0
- package/src/relations/relation.helpers.ts +373 -0
- package/src/relations/relation.types.ts +180 -0
- package/src/repositories/constraint-utils.ts +98 -0
- package/src/repositories/index.ts +10 -0
- package/src/repositories/kv.repository.bridge.ts +97 -0
- package/src/repositories/kv.repository.ts +87 -0
- package/src/repositories/legacy-juggler-bridge.ts +788 -0
- package/src/repositories/repository.ts +441 -0
- package/src/transaction.ts +39 -0
- package/src/type-resolver.ts +98 -0
- package/src/types/any.ts +38 -0
- package/src/types/array.ts +53 -0
- package/src/types/boolean.ts +35 -0
- package/src/types/buffer.ts +53 -0
- package/src/types/date.ts +61 -0
- package/src/types/index.ts +52 -0
- package/src/types/model.ts +24 -0
- package/src/types/null.ts +35 -0
- package/src/types/number.ts +42 -0
- package/src/types/object.ts +53 -0
- package/src/types/string.ts +42 -0
- package/src/types/type.ts +51 -0
- package/src/types/union.ts +55 -0
- package/api-docs/apple-touch-icon-114x114-precomposed.png +0 -0
- package/api-docs/apple-touch-icon-144x144-precomposed.png +0 -0
- package/api-docs/apple-touch-icon-57x57-precomposed.png +0 -0
- package/api-docs/apple-touch-icon-72x72-precomposed.png +0 -0
- package/api-docs/apple-touch-icon-precomposed.png +0 -0
- package/api-docs/apple-touch-icon.png +0 -0
- package/api-docs/css/bootstrap.min.css +0 -9
- package/api-docs/css/code-themes/arta.css +0 -158
- package/api-docs/css/code-themes/ascetic.css +0 -50
- package/api-docs/css/code-themes/brown_paper.css +0 -104
- package/api-docs/css/code-themes/brown_papersq.png +0 -0
- package/api-docs/css/code-themes/dark.css +0 -103
- package/api-docs/css/code-themes/default.css +0 -135
- package/api-docs/css/code-themes/far.css +0 -111
- package/api-docs/css/code-themes/github.css +0 -127
- package/api-docs/css/code-themes/googlecode.css +0 -144
- package/api-docs/css/code-themes/idea.css +0 -121
- package/api-docs/css/code-themes/ir_black.css +0 -104
- package/api-docs/css/code-themes/magula.css +0 -121
- package/api-docs/css/code-themes/monokai.css +0 -114
- package/api-docs/css/code-themes/pojoaque.css +0 -104
- package/api-docs/css/code-themes/pojoaque.jpg +0 -0
- package/api-docs/css/code-themes/rainbow.css +0 -114
- package/api-docs/css/code-themes/school_book.css +0 -111
- package/api-docs/css/code-themes/school_book.png +0 -0
- package/api-docs/css/code-themes/sl-theme.css +0 -45
- package/api-docs/css/code-themes/solarized_dark.css +0 -88
- package/api-docs/css/code-themes/solarized_light.css +0 -88
- package/api-docs/css/code-themes/sunburst.css +0 -158
- package/api-docs/css/code-themes/tomorrow-night-blue.css +0 -52
- package/api-docs/css/code-themes/tomorrow-night-bright.css +0 -51
- package/api-docs/css/code-themes/tomorrow-night-eighties.css +0 -51
- package/api-docs/css/code-themes/tomorrow-night.css +0 -52
- package/api-docs/css/code-themes/tomorrow.css +0 -49
- package/api-docs/css/code-themes/vs.css +0 -86
- package/api-docs/css/code-themes/xcode.css +0 -154
- package/api-docs/css/code-themes/zenburn.css +0 -115
- package/api-docs/css/main.css +0 -139
- package/api-docs/favicon.ico +0 -0
- package/api-docs/fonts/0ihfXUL2emPh0ROJezvraLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
- package/api-docs/fonts/OsJ2DjdpjqFRVUSto6IffLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
- package/api-docs/fonts/_aijTyevf54tkVDLy-dlnLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
- package/api-docs/index.html +0 -18017
- package/api-docs/js/main.js +0 -19
- package/api-docs/js/vendor/bootstrap.min.js +0 -6
- package/api-docs/js/vendor/jquery-1.10.1.min.js +0 -6
- package/api-docs/js/vendor/jquery.scrollTo-1.4.3.1.js +0 -218
- package/api-docs/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js +0 -11
- package/index.js +0 -9
- package/lib/common-types.d.ts +0 -44
- package/lib/common-types.js.map +0 -1
- package/lib/connector.d.ts +0 -12
- package/lib/connector.js.map +0 -1
- package/lib/crud-connector.js.map +0 -1
- package/lib/datasource.d.ts +0 -11
- package/lib/datasource.js.map +0 -1
- package/lib/decorators/model.d.ts +0 -17
- package/lib/decorators/model.js +0 -55
- package/lib/decorators/model.js.map +0 -1
- package/lib/decorators/relation.d.ts +0 -65
- package/lib/decorators/relation.js +0 -126
- package/lib/decorators/relation.js.map +0 -1
- package/lib/decorators/repository.d.ts +0 -61
- package/lib/decorators/repository.js +0 -107
- package/lib/decorators/repository.js.map +0 -1
- package/lib/index.d.ts +0 -17
- package/lib/index.js +0 -21
- package/lib/index.js.map +0 -1
- package/lib/kv-connector.d.ts +0 -77
- package/lib/kv-connector.js +0 -7
- package/lib/kv-connector.js.map +0 -1
- package/lib/kv-repository.d.ts +0 -78
- package/lib/kv-repository.js +0 -7
- package/lib/kv-repository.js.map +0 -1
- package/lib/legacy-juggler-bridge.d.ts +0 -53
- package/lib/legacy-juggler-bridge.js +0 -142
- package/lib/legacy-juggler-bridge.js.map +0 -1
- package/lib/loopback-datasource-juggler.d.ts +0 -666
- package/lib/loopback-datasource-juggler.js +0 -8
- package/lib/loopback-datasource-juggler.js.map +0 -1
- package/lib/mixin.d.ts +0 -43
- package/lib/mixin.js +0 -34
- package/lib/mixin.js.map +0 -1
- package/lib/model.d.ts +0 -137
- package/lib/model.js +0 -182
- package/lib/model.js.map +0 -1
- package/lib/query.d.ts +0 -112
- package/lib/query.js +0 -25
- package/lib/query.js.map +0 -1
- package/lib/repository-mixin.d.ts +0 -20
- package/lib/repository-mixin.js +0 -111
- package/lib/repository-mixin.js.map +0 -1
- package/lib/repository.d.ts +0 -172
- package/lib/repository.js +0 -127
- package/lib/repository.js.map +0 -1
- package/lib/types/any.js +0 -35
- package/lib/types/any.js.map +0 -1
- package/lib/types/array.d.ts +0 -14
- package/lib/types/array.js.map +0 -1
- package/lib/types/boolean.js.map +0 -1
- package/lib/types/buffer.d.ts +0 -14
- package/lib/types/buffer.js.map +0 -1
- package/lib/types/date.js.map +0 -1
- package/lib/types/index.js +0 -33
- package/lib/types/index.js.map +0 -1
- package/lib/types/model.d.ts +0 -11
- package/lib/types/model.js +0 -25
- package/lib/types/model.js.map +0 -1
- package/lib/types/number.d.ts +0 -12
- package/lib/types/number.js.map +0 -1
- package/lib/types/object.js.map +0 -1
- package/lib/types/string.js.map +0 -1
- package/lib/types/type.d.ts +0 -38
- package/lib/types/type.js +0 -7
- package/lib/types/type.js.map +0 -1
- package/lib/types/union.js.map +0 -1
- package/lib6/common-types.d.ts +0 -44
- package/lib6/common-types.js +0 -7
- package/lib6/common-types.js.map +0 -1
- package/lib6/connector.d.ts +0 -12
- package/lib6/connector.js +0 -7
- package/lib6/connector.js.map +0 -1
- package/lib6/crud-connector.d.ts +0 -130
- package/lib6/crud-connector.js +0 -7
- package/lib6/crud-connector.js.map +0 -1
- package/lib6/datasource.d.ts +0 -11
- package/lib6/datasource.js.map +0 -1
- package/lib6/decorators/model.d.ts +0 -17
- package/lib6/decorators/model.js +0 -55
- package/lib6/decorators/model.js.map +0 -1
- package/lib6/decorators/relation.d.ts +0 -65
- package/lib6/decorators/relation.js +0 -126
- package/lib6/decorators/relation.js.map +0 -1
- package/lib6/decorators/repository.d.ts +0 -61
- package/lib6/decorators/repository.js +0 -117
- package/lib6/decorators/repository.js.map +0 -1
- package/lib6/index.d.ts +0 -17
- package/lib6/index.js +0 -21
- package/lib6/index.js.map +0 -1
- package/lib6/kv-connector.js +0 -7
- package/lib6/kv-connector.js.map +0 -1
- package/lib6/kv-repository.d.ts +0 -78
- package/lib6/kv-repository.js +0 -7
- package/lib6/kv-repository.js.map +0 -1
- package/lib6/legacy-juggler-bridge.d.ts +0 -53
- package/lib6/legacy-juggler-bridge.js +0 -158
- package/lib6/legacy-juggler-bridge.js.map +0 -1
- package/lib6/loopback-datasource-juggler.d.ts +0 -666
- package/lib6/loopback-datasource-juggler.js +0 -8
- package/lib6/loopback-datasource-juggler.js.map +0 -1
- package/lib6/mixin.d.ts +0 -43
- package/lib6/mixin.js +0 -34
- package/lib6/mixin.js.map +0 -1
- package/lib6/model.d.ts +0 -137
- package/lib6/model.js +0 -182
- package/lib6/model.js.map +0 -1
- package/lib6/query.d.ts +0 -112
- package/lib6/query.js +0 -25
- package/lib6/query.js.map +0 -1
- package/lib6/repository-mixin.d.ts +0 -20
- package/lib6/repository-mixin.js +0 -111
- package/lib6/repository-mixin.js.map +0 -1
- package/lib6/repository.d.ts +0 -172
- package/lib6/repository.js +0 -127
- package/lib6/repository.js.map +0 -1
- package/lib6/types/any.d.ts +0 -12
- package/lib6/types/any.js.map +0 -1
- package/lib6/types/array.js +0 -53
- package/lib6/types/array.js.map +0 -1
- package/lib6/types/boolean.d.ts +0 -12
- package/lib6/types/boolean.js.map +0 -1
- package/lib6/types/buffer.js +0 -57
- package/lib6/types/buffer.js.map +0 -1
- package/lib6/types/date.d.ts +0 -12
- package/lib6/types/date.js +0 -60
- package/lib6/types/date.js.map +0 -1
- package/lib6/types/index.d.ts +0 -30
- package/lib6/types/index.js +0 -33
- package/lib6/types/index.js.map +0 -1
- package/lib6/types/model.js.map +0 -1
- package/lib6/types/number.js +0 -40
- package/lib6/types/number.js.map +0 -1
- package/lib6/types/object.d.ts +0 -15
- package/lib6/types/object.js +0 -49
- package/lib6/types/object.js.map +0 -1
- package/lib6/types/string.d.ts +0 -12
- package/lib6/types/string.js +0 -40
- package/lib6/types/string.js.map +0 -1
- package/lib6/types/type.js.map +0 -1
- package/lib6/types/union.d.ts +0 -14
- package/lib6/types/union.js +0 -51
- package/lib6/types/union.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation.types.js","sourceRoot":"","sources":["../../src/relations/relation.types.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAOhE,IAAY,YAQX;AARD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;IACnB,uCAAuB,CAAA;IACvB,yCAAyB,CAAA;IACzB,+CAA+B,CAAA;IAC/B,iDAAiC,CAAA;AACnC,CAAC,EARW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAQvB;AA0ID,6EAA6E;AAC7E,uCAAsC;AAA9B,8FAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Filter, Where } from '@loopback/filter';
|
|
2
|
+
import { AnyObject, DataObject } from '../common-types';
|
|
3
|
+
import { Entity } from '../model';
|
|
4
|
+
/**
|
|
5
|
+
* A utility function which takes a filter and enforces constraint(s)
|
|
6
|
+
* on it
|
|
7
|
+
* @param originalFilter - the filter to apply the constrain(s) to
|
|
8
|
+
* @param constraint - the constraint which is to be applied on the filter
|
|
9
|
+
* @returns Filter the modified filter with the constraint, otherwise
|
|
10
|
+
* the original filter
|
|
11
|
+
*/
|
|
12
|
+
export declare function constrainFilter<T extends object>(originalFilter: Filter<T> | undefined, constraint: AnyObject): Filter<T>;
|
|
13
|
+
/**
|
|
14
|
+
* A utility function which takes a where filter and enforces constraint(s)
|
|
15
|
+
* on it
|
|
16
|
+
* @param originalWhere - the where filter to apply the constrain(s) to
|
|
17
|
+
* @param constraint - the constraint which is to be applied on the filter
|
|
18
|
+
* @returns Filter the modified filter with the constraint, otherwise
|
|
19
|
+
* the original filter
|
|
20
|
+
*/
|
|
21
|
+
export declare function constrainWhere<T extends object>(originalWhere: Where<T> | undefined, constraint: Where<T>): Where<T>;
|
|
22
|
+
/**
|
|
23
|
+
* A utility function which takes a where filter and enforces constraint(s)
|
|
24
|
+
* on it with OR clause
|
|
25
|
+
* @param originalWhere - the where filter to apply the constrain(s) to
|
|
26
|
+
* @param constraint - the constraint which is to be applied on the filter with
|
|
27
|
+
* or clause
|
|
28
|
+
* @returns Filter the modified filter with the constraint, otherwise
|
|
29
|
+
* the original filter
|
|
30
|
+
*/
|
|
31
|
+
export declare function constrainWhereOr<T extends object>(originalWhere: Where<T> | undefined, constraint: Where<T>[]): Where<T>;
|
|
32
|
+
/**
|
|
33
|
+
* A utility function which takes a model instance data and enforces constraint(s)
|
|
34
|
+
* on it
|
|
35
|
+
* @param originalData - the model data to apply the constrain(s) to
|
|
36
|
+
* @param constraint - the constraint which is to be applied on the data object
|
|
37
|
+
* @returns the modified data with the constraint, otherwise
|
|
38
|
+
* the original instance data
|
|
39
|
+
*/
|
|
40
|
+
export declare function constrainDataObject<T extends Entity>(originalData: DataObject<T>, constraint: DataObject<T>): DataObject<T>;
|
|
41
|
+
/**
|
|
42
|
+
* A utility function which takes an array of model instance data and
|
|
43
|
+
* enforces constraint(s) on it
|
|
44
|
+
* @param originalData - the array of model data to apply the constrain(s) to
|
|
45
|
+
* @param constraint - the constraint which is to be applied on the data objects
|
|
46
|
+
* @returns an array of the modified data with the constraint, otherwise
|
|
47
|
+
* the original instance data array
|
|
48
|
+
*/
|
|
49
|
+
export declare function constrainDataObjects<T extends Entity>(originalData: DataObject<T>[], constraint: DataObject<T>): DataObject<T>[];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2018,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.constrainDataObjects = exports.constrainDataObject = exports.constrainWhereOr = exports.constrainWhere = exports.constrainFilter = void 0;
|
|
8
|
+
const filter_1 = require("@loopback/filter");
|
|
9
|
+
const lodash_1 = require("lodash");
|
|
10
|
+
/**
|
|
11
|
+
* A utility function which takes a filter and enforces constraint(s)
|
|
12
|
+
* on it
|
|
13
|
+
* @param originalFilter - the filter to apply the constrain(s) to
|
|
14
|
+
* @param constraint - the constraint which is to be applied on the filter
|
|
15
|
+
* @returns Filter the modified filter with the constraint, otherwise
|
|
16
|
+
* the original filter
|
|
17
|
+
*/
|
|
18
|
+
function constrainFilter(originalFilter, constraint) {
|
|
19
|
+
const filter = (0, lodash_1.cloneDeep)(originalFilter);
|
|
20
|
+
const builder = new filter_1.FilterBuilder(filter);
|
|
21
|
+
return builder.impose(constraint).build();
|
|
22
|
+
}
|
|
23
|
+
exports.constrainFilter = constrainFilter;
|
|
24
|
+
/**
|
|
25
|
+
* A utility function which takes a where filter and enforces constraint(s)
|
|
26
|
+
* on it
|
|
27
|
+
* @param originalWhere - the where filter to apply the constrain(s) to
|
|
28
|
+
* @param constraint - the constraint which is to be applied on the filter
|
|
29
|
+
* @returns Filter the modified filter with the constraint, otherwise
|
|
30
|
+
* the original filter
|
|
31
|
+
*/
|
|
32
|
+
function constrainWhere(originalWhere, constraint) {
|
|
33
|
+
const where = (0, lodash_1.cloneDeep)(originalWhere);
|
|
34
|
+
const builder = new filter_1.WhereBuilder(where);
|
|
35
|
+
return builder.impose(constraint).build();
|
|
36
|
+
}
|
|
37
|
+
exports.constrainWhere = constrainWhere;
|
|
38
|
+
/**
|
|
39
|
+
* A utility function which takes a where filter and enforces constraint(s)
|
|
40
|
+
* on it with OR clause
|
|
41
|
+
* @param originalWhere - the where filter to apply the constrain(s) to
|
|
42
|
+
* @param constraint - the constraint which is to be applied on the filter with
|
|
43
|
+
* or clause
|
|
44
|
+
* @returns Filter the modified filter with the constraint, otherwise
|
|
45
|
+
* the original filter
|
|
46
|
+
*/
|
|
47
|
+
function constrainWhereOr(originalWhere, constraint) {
|
|
48
|
+
const where = (0, lodash_1.cloneDeep)(originalWhere);
|
|
49
|
+
const builder = new filter_1.WhereBuilder(where);
|
|
50
|
+
return builder.or(constraint).build();
|
|
51
|
+
}
|
|
52
|
+
exports.constrainWhereOr = constrainWhereOr;
|
|
53
|
+
/**
|
|
54
|
+
* A utility function which takes a model instance data and enforces constraint(s)
|
|
55
|
+
* on it
|
|
56
|
+
* @param originalData - the model data to apply the constrain(s) to
|
|
57
|
+
* @param constraint - the constraint which is to be applied on the data object
|
|
58
|
+
* @returns the modified data with the constraint, otherwise
|
|
59
|
+
* the original instance data
|
|
60
|
+
*/
|
|
61
|
+
function constrainDataObject(originalData, constraint) {
|
|
62
|
+
const constrainedData = (0, lodash_1.cloneDeep)(originalData);
|
|
63
|
+
for (const c in constraint) {
|
|
64
|
+
if (Object.prototype.hasOwnProperty.call(constrainedData, c)) {
|
|
65
|
+
// Known limitation: === does not work for objects such as ObjectId
|
|
66
|
+
if (originalData[c] === constraint[c])
|
|
67
|
+
continue;
|
|
68
|
+
throw new Error(`Property "${c}" cannot be changed!`);
|
|
69
|
+
}
|
|
70
|
+
constrainedData[c] = constraint[c];
|
|
71
|
+
}
|
|
72
|
+
return constrainedData;
|
|
73
|
+
}
|
|
74
|
+
exports.constrainDataObject = constrainDataObject;
|
|
75
|
+
/**
|
|
76
|
+
* A utility function which takes an array of model instance data and
|
|
77
|
+
* enforces constraint(s) on it
|
|
78
|
+
* @param originalData - the array of model data to apply the constrain(s) to
|
|
79
|
+
* @param constraint - the constraint which is to be applied on the data objects
|
|
80
|
+
* @returns an array of the modified data with the constraint, otherwise
|
|
81
|
+
* the original instance data array
|
|
82
|
+
*/
|
|
83
|
+
function constrainDataObjects(originalData, constraint) {
|
|
84
|
+
return originalData.map(obj => constrainDataObject(obj, constraint));
|
|
85
|
+
}
|
|
86
|
+
exports.constrainDataObjects = constrainDataObjects;
|
|
87
|
+
//# sourceMappingURL=constraint-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraint-utils.js","sourceRoot":"","sources":["../../src/repositories/constraint-utils.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,6CAA4E;AAC5E,mCAAiC;AAIjC;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC7B,cAAqC,EACrC,UAAqB;IAErB,MAAM,MAAM,GAAG,IAAA,kBAAS,EAAC,cAAc,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,sBAAa,CAAI,MAAM,CAAC,CAAC;IAC7C,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC;AAC5C,CAAC;AAPD,0CAOC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,aAAmC,EACnC,UAAoB;IAEpB,MAAM,KAAK,GAAG,IAAA,kBAAS,EAAC,aAAa,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,qBAAY,CAAI,KAAK,CAAC,CAAC;IAC3C,OAAO,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC;AAC5C,CAAC;AAPD,wCAOC;AACD;;;;;;;;GAQG;AACH,SAAgB,gBAAgB,CAC9B,aAAmC,EACnC,UAAsB;IAEtB,MAAM,KAAK,GAAG,IAAA,kBAAS,EAAC,aAAa,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,qBAAY,CAAI,KAAK,CAAC,CAAC;IAC3C,OAAO,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC;AACxC,CAAC;AAPD,4CAOC;AACD;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CACjC,YAA2B,EAC3B,UAAyB;IAEzB,MAAM,eAAe,GAAG,IAAA,kBAAS,EAAC,YAAY,CAAC,CAAC;IAChD,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE;QAC1B,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE;YAC5D,mEAAmE;YACnE,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC;gBAAE,SAAS;YAChD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC;SACvD;QACA,eAA6B,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;KACnD;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAdD,kDAcC;AAED;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAClC,YAA6B,EAC7B,UAAyB;IAEzB,OAAO,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;AACvE,CAAC;AALD,oDAKC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2018,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
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
(0, tslib_1.__exportStar)(require("./kv.repository"), exports);
|
|
9
|
+
(0, tslib_1.__exportStar)(require("./legacy-juggler-bridge"), exports);
|
|
10
|
+
(0, tslib_1.__exportStar)(require("./kv.repository.bridge"), exports);
|
|
11
|
+
(0, tslib_1.__exportStar)(require("./repository"), exports);
|
|
12
|
+
(0, tslib_1.__exportStar)(require("./constraint-utils"), exports);
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;;AAEhE,+DAAgC;AAChC,uEAAwC;AACxC,sEAAuC;AACvC,4DAA6B;AAC7B,kEAAmC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import legacy from 'loopback-datasource-juggler';
|
|
2
|
+
import { DataObject, Options } from '../common-types';
|
|
3
|
+
import { Model } from '../model';
|
|
4
|
+
import { KeyValueFilter, KeyValueRepository } from './kv.repository';
|
|
5
|
+
import { juggler } from './legacy-juggler-bridge';
|
|
6
|
+
/**
|
|
7
|
+
* An implementation of KeyValueRepository based on loopback-datasource-juggler
|
|
8
|
+
*/
|
|
9
|
+
export declare class DefaultKeyValueRepository<T extends Model> implements KeyValueRepository<T> {
|
|
10
|
+
private entityClass;
|
|
11
|
+
/**
|
|
12
|
+
* A legacy KeyValueModel class
|
|
13
|
+
*/
|
|
14
|
+
kvModelClass: typeof juggler.KeyValueModel;
|
|
15
|
+
/**
|
|
16
|
+
* Construct a KeyValueRepository with a legacy DataSource
|
|
17
|
+
* @param ds - Legacy DataSource
|
|
18
|
+
*/
|
|
19
|
+
constructor(entityClass: typeof Model & {
|
|
20
|
+
prototype: T;
|
|
21
|
+
}, ds: juggler.DataSource);
|
|
22
|
+
delete(key: string, options?: Options): Promise<void>;
|
|
23
|
+
deleteAll(options?: Options): Promise<void>;
|
|
24
|
+
protected toEntity(modelData: legacy.ModelData): T;
|
|
25
|
+
get(key: string, options?: Options): Promise<T>;
|
|
26
|
+
set(key: string, value: DataObject<T>, options?: Options): Promise<void>;
|
|
27
|
+
expire(key: string, ttl: number, options?: Options): Promise<void>;
|
|
28
|
+
ttl(key: string, options?: Options): Promise<number>;
|
|
29
|
+
keys(filter?: KeyValueFilter, options?: Options): AsyncIterable<string>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright IBM Corp. 2018,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.DefaultKeyValueRepository = void 0;
|
|
8
|
+
const legacy_juggler_bridge_1 = require("./legacy-juggler-bridge");
|
|
9
|
+
/**
|
|
10
|
+
* An implementation of KeyValueRepository based on loopback-datasource-juggler
|
|
11
|
+
*/
|
|
12
|
+
class DefaultKeyValueRepository {
|
|
13
|
+
/**
|
|
14
|
+
* Construct a KeyValueRepository with a legacy DataSource
|
|
15
|
+
* @param ds - Legacy DataSource
|
|
16
|
+
*/
|
|
17
|
+
constructor(entityClass, ds) {
|
|
18
|
+
this.entityClass = entityClass;
|
|
19
|
+
// KVModel class is placeholder to receive methods from KeyValueAccessObject
|
|
20
|
+
// through mixin
|
|
21
|
+
this.kvModelClass =
|
|
22
|
+
ds.createModel('_kvModel');
|
|
23
|
+
}
|
|
24
|
+
delete(key, options) {
|
|
25
|
+
return (0, legacy_juggler_bridge_1.ensurePromise)(this.kvModelClass.delete(key, options));
|
|
26
|
+
}
|
|
27
|
+
deleteAll(options) {
|
|
28
|
+
return (0, legacy_juggler_bridge_1.ensurePromise)(this.kvModelClass.deleteAll(options));
|
|
29
|
+
}
|
|
30
|
+
toEntity(modelData) {
|
|
31
|
+
if (modelData == null)
|
|
32
|
+
return modelData;
|
|
33
|
+
let data = modelData;
|
|
34
|
+
if (typeof modelData.toObject === 'function') {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
data = modelData.toObject();
|
|
37
|
+
}
|
|
38
|
+
return new this.entityClass(data);
|
|
39
|
+
}
|
|
40
|
+
async get(key, options) {
|
|
41
|
+
const val = this.kvModelClass.get(key, options);
|
|
42
|
+
const result = await (0, legacy_juggler_bridge_1.ensurePromise)(val);
|
|
43
|
+
return this.toEntity(result);
|
|
44
|
+
}
|
|
45
|
+
set(key, value, options) {
|
|
46
|
+
return (0, legacy_juggler_bridge_1.ensurePromise)(this.kvModelClass.set(key, value, options));
|
|
47
|
+
}
|
|
48
|
+
expire(key, ttl, options) {
|
|
49
|
+
return (0, legacy_juggler_bridge_1.ensurePromise)(this.kvModelClass.expire(key, ttl, options));
|
|
50
|
+
}
|
|
51
|
+
ttl(key, options) {
|
|
52
|
+
return (0, legacy_juggler_bridge_1.ensurePromise)(this.kvModelClass.ttl(key, options));
|
|
53
|
+
}
|
|
54
|
+
keys(filter, options) {
|
|
55
|
+
const kvModelClass = this.kvModelClass;
|
|
56
|
+
const iterator = {
|
|
57
|
+
[Symbol.asyncIterator]() {
|
|
58
|
+
return new AsyncKeyIteratorImpl(kvModelClass.iterateKeys(filter, options));
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
return iterator;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.DefaultKeyValueRepository = DefaultKeyValueRepository;
|
|
65
|
+
class AsyncKeyIteratorImpl {
|
|
66
|
+
constructor(keys) {
|
|
67
|
+
this.keys = keys;
|
|
68
|
+
}
|
|
69
|
+
next() {
|
|
70
|
+
const key = (0, legacy_juggler_bridge_1.ensurePromise)(this.keys.next());
|
|
71
|
+
return key.then(k => {
|
|
72
|
+
return { done: k === undefined, value: k !== null && k !== void 0 ? k : '' };
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=kv.repository.bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kv.repository.bridge.js","sourceRoot":"","sources":["../../src/repositories/kv.repository.bridge.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Repository } from './repository';
|
|
2
|
+
import { Options, DataObject } from '../common-types';
|
|
3
|
+
import { Model } from '../model';
|
|
4
|
+
/**
|
|
5
|
+
* Filter for keys
|
|
6
|
+
*/
|
|
7
|
+
export declare type KeyValueFilter = {
|
|
8
|
+
/**
|
|
9
|
+
* Glob string to use to filter returned keys (i.e. `userid.*`). All
|
|
10
|
+
* connectors are required to support `*` and `?`. They may also support
|
|
11
|
+
* additional special characters that are specific to the backing database.
|
|
12
|
+
*/
|
|
13
|
+
match: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Key/Value operations for connector implementations
|
|
17
|
+
*/
|
|
18
|
+
export interface KeyValueRepository<T extends Model> extends Repository<T> {
|
|
19
|
+
/**
|
|
20
|
+
* Delete an entry by key
|
|
21
|
+
*
|
|
22
|
+
* @param key - Key for the entry
|
|
23
|
+
* @param options - Options for the operation
|
|
24
|
+
*/
|
|
25
|
+
delete(key: string, options?: Options): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Delete all entries
|
|
28
|
+
*
|
|
29
|
+
* @param key - Key for the entry
|
|
30
|
+
* @param options - Options for the operation
|
|
31
|
+
*/
|
|
32
|
+
deleteAll(options?: Options): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Get an entry by key
|
|
35
|
+
*
|
|
36
|
+
* @param key - Key for the entry
|
|
37
|
+
* @param options - Options for the operation
|
|
38
|
+
* @returns A promise of the entry
|
|
39
|
+
*/
|
|
40
|
+
get(key: string, options?: Options): Promise<T>;
|
|
41
|
+
/**
|
|
42
|
+
* Set an entry with key/value
|
|
43
|
+
*
|
|
44
|
+
* @param key - Key for the entry
|
|
45
|
+
* @param value - Value for the entry
|
|
46
|
+
* @param options - Options for the operation
|
|
47
|
+
*/
|
|
48
|
+
set(key: string, value: DataObject<T>, options?: Options): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Set up ttl for an entry by key
|
|
51
|
+
*
|
|
52
|
+
* @param key - Key for the entry
|
|
53
|
+
* @param ttl - Ttl for the entry
|
|
54
|
+
* @param options - Options for the operation
|
|
55
|
+
*/
|
|
56
|
+
expire(key: string, ttl: number, options?: Options): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Get ttl for an entry by key
|
|
59
|
+
*
|
|
60
|
+
* @param key - Key for the entry
|
|
61
|
+
* @param options - Options for the operation
|
|
62
|
+
* @returns A promise of the TTL value
|
|
63
|
+
*/
|
|
64
|
+
ttl?(key: string, options?: Options): Promise<number>;
|
|
65
|
+
/**
|
|
66
|
+
* Get an Iterator for matching keys
|
|
67
|
+
*
|
|
68
|
+
* @param filter - Filter for keys
|
|
69
|
+
* @param options - Options for the operation
|
|
70
|
+
* @returns An async iteratable iterator of keys so that the return value can
|
|
71
|
+
* be used with `for-await-of`.
|
|
72
|
+
*/
|
|
73
|
+
keys?(filter?: KeyValueFilter, options?: Options): AsyncIterable<string>;
|
|
74
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright IBM Corp.
|
|
2
|
+
// Copyright IBM Corp. 2018,2020. All Rights Reserved.
|
|
3
3
|
// Node module: @loopback/repository
|
|
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
|
-
//# sourceMappingURL=
|
|
7
|
+
//# sourceMappingURL=kv.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kv.repository.js","sourceRoot":"","sources":["../../src/repositories/kv.repository.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE"}
|