@loopback/repository 4.0.0-alpha.9 → 4.0.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 +298 -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 +364 -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 -128
- 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 -128
- 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
package/lib6/repository.d.ts
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { Entity, ValueObject, Model } from './model';
|
|
2
|
-
import { Class, DataObject, Options } from './common-types';
|
|
3
|
-
import { DataSource } from './datasource';
|
|
4
|
-
import { Filter, Where } from './query';
|
|
5
|
-
export interface Repository<T extends Model> {
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Basic CRUD operations for ValueObject and Entity. No ID is required.
|
|
9
|
-
*/
|
|
10
|
-
export interface CrudRepository<T extends ValueObject | Entity> extends Repository<T> {
|
|
11
|
-
/**
|
|
12
|
-
* Create a new record
|
|
13
|
-
* @param dataObject The data to be created
|
|
14
|
-
* @param options Options for the operations
|
|
15
|
-
* @returns A promise of record created
|
|
16
|
-
*/
|
|
17
|
-
create(dataObject: DataObject<T>, options?: Options): Promise<T>;
|
|
18
|
-
/**
|
|
19
|
-
* Create all records
|
|
20
|
-
* @param dataObjects An array of data to be created
|
|
21
|
-
* @param options Options for the operations
|
|
22
|
-
* @returns A promise of an array of records created
|
|
23
|
-
*/
|
|
24
|
-
createAll(dataObjects: DataObject<T>[], options?: Options): Promise<T[]>;
|
|
25
|
-
/**
|
|
26
|
-
* Find matching records
|
|
27
|
-
* @param filter Query filter
|
|
28
|
-
* @param options Options for the operations
|
|
29
|
-
* @returns A promise of an array of records found
|
|
30
|
-
*/
|
|
31
|
-
find(filter?: Filter, options?: Options): Promise<T[]>;
|
|
32
|
-
/**
|
|
33
|
-
* Updating matching records with attributes from the data object
|
|
34
|
-
* @param dataObject The data to be updated
|
|
35
|
-
* @param where Matching criteria
|
|
36
|
-
* @param options Options for the operations
|
|
37
|
-
* @returns A promise of number of records updated
|
|
38
|
-
*/
|
|
39
|
-
updateAll(dataObject: DataObject<T>, where?: Where, options?: Options): Promise<number>;
|
|
40
|
-
/**
|
|
41
|
-
* Delete matching records
|
|
42
|
-
* @param where Matching criteria
|
|
43
|
-
* @param options Options for the operations
|
|
44
|
-
* @returns A promise of number of records deleted
|
|
45
|
-
*/
|
|
46
|
-
deleteAll(where?: Where, options?: Options): Promise<number>;
|
|
47
|
-
/**
|
|
48
|
-
* Count matching records
|
|
49
|
-
* @param where Matching criteria
|
|
50
|
-
* @param options Options for the operations
|
|
51
|
-
* @returns A promise of number of records matched
|
|
52
|
-
*/
|
|
53
|
-
count(where?: Where, options?: Options): Promise<number>;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Base interface for a repository of entities
|
|
57
|
-
*/
|
|
58
|
-
export interface EntityRepository<T extends Entity, ID> extends Repository<T> {
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* CRUD operations for a repository of entities
|
|
62
|
-
*/
|
|
63
|
-
export interface EntityCrudRepository<T extends Entity, ID> extends EntityRepository<T, ID>, CrudRepository<T> {
|
|
64
|
-
/**
|
|
65
|
-
* Save an entity. If no id is present, create a new entity
|
|
66
|
-
* @param entity Entity to be saved
|
|
67
|
-
* @param options Options for the operations
|
|
68
|
-
* @returns A promise of an entity saved or null if the entity does not exist
|
|
69
|
-
*/
|
|
70
|
-
save(entity: DataObject<T>, options?: Options): Promise<T | null>;
|
|
71
|
-
/**
|
|
72
|
-
* Update an entity
|
|
73
|
-
* @param entity Entity to be updated
|
|
74
|
-
* @param options Options for the operations
|
|
75
|
-
* @returns Promise<true> if the entity is updated, otherwise
|
|
76
|
-
* Promise<false>
|
|
77
|
-
*/
|
|
78
|
-
update(entity: DataObject<T>, options?: Options): Promise<boolean>;
|
|
79
|
-
/**
|
|
80
|
-
* Delete an entity
|
|
81
|
-
* @param entity Entity to be deleted
|
|
82
|
-
* @param options Options for the operations
|
|
83
|
-
* @returns Promise<true> if the entity is deleted, otherwise
|
|
84
|
-
* Promise<false>
|
|
85
|
-
*/
|
|
86
|
-
delete(entity: DataObject<T>, options?: Options): Promise<boolean>;
|
|
87
|
-
/**
|
|
88
|
-
* Find an entity by id
|
|
89
|
-
* @param id Value for the entity id
|
|
90
|
-
* @param options Options for the operations
|
|
91
|
-
* @returns A promise of an entity found for the id
|
|
92
|
-
*/
|
|
93
|
-
findById(id: ID, filter?: Filter, options?: Options): Promise<T>;
|
|
94
|
-
/**
|
|
95
|
-
* Update an entity by id with property/value pairs in the data object
|
|
96
|
-
* @param data Data attributes to be updated
|
|
97
|
-
* @param id Value for the entity id
|
|
98
|
-
* @param options Options for the operations
|
|
99
|
-
* @returns Promise<true> if the entity is updated, otherwise
|
|
100
|
-
* Promise<false>
|
|
101
|
-
*/
|
|
102
|
-
updateById(id: ID, data: DataObject<T>, options?: Options): Promise<boolean>;
|
|
103
|
-
/**
|
|
104
|
-
* Replace an entity by id
|
|
105
|
-
* @param data Data attributes to be replaced
|
|
106
|
-
* @param id Value for the entity id
|
|
107
|
-
* @param options Options for the operations
|
|
108
|
-
* @returns Promise<true> if an entity is replaced, otherwise
|
|
109
|
-
* Promise<false>
|
|
110
|
-
*/
|
|
111
|
-
replaceById(id: ID, data: DataObject<T>, options?: Options): Promise<boolean>;
|
|
112
|
-
/**
|
|
113
|
-
* Delete an entity by id
|
|
114
|
-
* @param id Value for the entity id
|
|
115
|
-
* @param options Options for the operations
|
|
116
|
-
* @returns Promise<true> if an entity is deleted for the id, otherwise
|
|
117
|
-
* Promise<false>
|
|
118
|
-
*/
|
|
119
|
-
deleteById(id: ID, options?: Options): Promise<boolean>;
|
|
120
|
-
/**
|
|
121
|
-
* Check if an entity exists for the given id
|
|
122
|
-
* @param id Value for the entity id
|
|
123
|
-
* @param options Options for the operations
|
|
124
|
-
* @returns Promise<true> if an entity exists for the id, otherwise
|
|
125
|
-
* Promise<false>
|
|
126
|
-
*/
|
|
127
|
-
exists(id: ID, options?: Options): Promise<boolean>;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Repository implementation
|
|
131
|
-
*
|
|
132
|
-
* Example:
|
|
133
|
-
*
|
|
134
|
-
* User can import `CrudRepositoryImpl` and call its functions like:
|
|
135
|
-
* `CrudRepositoryImpl.find(somefilters, someoptions)`
|
|
136
|
-
*
|
|
137
|
-
* Or extend class `CrudRepositoryImpl` and override its functions:
|
|
138
|
-
* ```ts
|
|
139
|
-
* export class TestRepository extends CrudRepositoryImpl<Test> {
|
|
140
|
-
* constructor(dataSource: DataSource, model: Test) {
|
|
141
|
-
* super(dataSource, Customer);
|
|
142
|
-
* }
|
|
143
|
-
*
|
|
144
|
-
* // Override `deleteAll` to disable the operation
|
|
145
|
-
* deleteAll(where?: Where, options?: Options) {
|
|
146
|
-
* return Promise.reject(new Error('deleteAll is disabled'));
|
|
147
|
-
* }
|
|
148
|
-
* }
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
export declare class CrudRepositoryImpl<T extends Entity, ID> implements EntityCrudRepository<T, ID> {
|
|
152
|
-
dataSource: DataSource;
|
|
153
|
-
model: Class<T>;
|
|
154
|
-
private connector;
|
|
155
|
-
constructor(dataSource: DataSource, model: Class<T>);
|
|
156
|
-
private toModels(data);
|
|
157
|
-
private toModel(data);
|
|
158
|
-
create(entity: DataObject<T>, options?: Options): Promise<T>;
|
|
159
|
-
createAll(entities: DataObject<T>[], options?: Options): Promise<T[]>;
|
|
160
|
-
save(entity: DataObject<T>, options?: Options): Promise<T | null>;
|
|
161
|
-
find(filter?: Filter, options?: Options): Promise<T[]>;
|
|
162
|
-
findById(id: ID, options?: Options): Promise<T>;
|
|
163
|
-
update(entity: DataObject<T>, options?: Options): Promise<boolean>;
|
|
164
|
-
delete(entity: DataObject<T>, options?: Options): Promise<boolean>;
|
|
165
|
-
updateAll(data: DataObject<T>, where?: Where, options?: Options): Promise<number>;
|
|
166
|
-
updateById(id: ID, data: DataObject<T>, options?: Options): Promise<boolean>;
|
|
167
|
-
replaceById(id: ID, data: DataObject<T>, options?: Options): Promise<boolean>;
|
|
168
|
-
deleteAll(where?: Where, options?: Options): Promise<number>;
|
|
169
|
-
deleteById(id: ID, options?: Options): Promise<boolean>;
|
|
170
|
-
count(where?: Where, options?: Options): Promise<number>;
|
|
171
|
-
exists(id: ID, options?: Options): Promise<boolean>;
|
|
172
|
-
}
|
package/lib6/repository.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2017. 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
|
-
/**
|
|
8
|
-
* Repository implementation
|
|
9
|
-
*
|
|
10
|
-
* Example:
|
|
11
|
-
*
|
|
12
|
-
* User can import `CrudRepositoryImpl` and call its functions like:
|
|
13
|
-
* `CrudRepositoryImpl.find(somefilters, someoptions)`
|
|
14
|
-
*
|
|
15
|
-
* Or extend class `CrudRepositoryImpl` and override its functions:
|
|
16
|
-
* ```ts
|
|
17
|
-
* export class TestRepository extends CrudRepositoryImpl<Test> {
|
|
18
|
-
* constructor(dataSource: DataSource, model: Test) {
|
|
19
|
-
* super(dataSource, Customer);
|
|
20
|
-
* }
|
|
21
|
-
*
|
|
22
|
-
* // Override `deleteAll` to disable the operation
|
|
23
|
-
* deleteAll(where?: Where, options?: Options) {
|
|
24
|
-
* return Promise.reject(new Error('deleteAll is disabled'));
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
class CrudRepositoryImpl {
|
|
30
|
-
constructor(dataSource, model) {
|
|
31
|
-
this.dataSource = dataSource;
|
|
32
|
-
this.model = model;
|
|
33
|
-
this.connector = dataSource.connector;
|
|
34
|
-
}
|
|
35
|
-
toModels(data) {
|
|
36
|
-
return data.then(items => items.map(i => new this.model(i)));
|
|
37
|
-
}
|
|
38
|
-
toModel(data) {
|
|
39
|
-
return data.then(d => new this.model(d));
|
|
40
|
-
}
|
|
41
|
-
create(entity, options) {
|
|
42
|
-
return this.toModel(this.connector.create(this.model, entity, options));
|
|
43
|
-
}
|
|
44
|
-
createAll(entities, options) {
|
|
45
|
-
return this.toModels(this.connector.createAll(this.model, entities, options));
|
|
46
|
-
}
|
|
47
|
-
save(entity, options) {
|
|
48
|
-
if (typeof this.connector.save === 'function') {
|
|
49
|
-
return this.toModel(this.connector.save(this.model, entity, options));
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
if (entity.getId() != null) {
|
|
53
|
-
return this.replaceById(entity.getId(), entity, options).then((result) => result
|
|
54
|
-
? this.toModel(Promise.resolve(entity))
|
|
55
|
-
: Promise.reject(new Error('Not found')));
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
return this.create(entity, options);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
find(filter, options) {
|
|
63
|
-
return this.toModels(this.connector.find(this.model, filter, options));
|
|
64
|
-
}
|
|
65
|
-
findById(id, options) {
|
|
66
|
-
if (typeof this.connector.findById === 'function') {
|
|
67
|
-
return this.toModel(this.connector.findById(this.model, id, options));
|
|
68
|
-
}
|
|
69
|
-
const where = this.model.buildWhereForId(id);
|
|
70
|
-
return this.connector
|
|
71
|
-
.find(this.model, { where: where }, options)
|
|
72
|
-
.then((entities) => {
|
|
73
|
-
return entities[0];
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
update(entity, options) {
|
|
77
|
-
return this.updateById(entity.getId(), entity, options);
|
|
78
|
-
}
|
|
79
|
-
delete(entity, options) {
|
|
80
|
-
return this.deleteById(entity.getId(), options);
|
|
81
|
-
}
|
|
82
|
-
updateAll(data, where, options) {
|
|
83
|
-
return this.connector.updateAll(this.model, data, where, options);
|
|
84
|
-
}
|
|
85
|
-
updateById(id, data, options) {
|
|
86
|
-
if (typeof this.connector.updateById === 'function') {
|
|
87
|
-
return this.connector.updateById(this.model, id, data, options);
|
|
88
|
-
}
|
|
89
|
-
const where = this.model.buildWhereForId(id);
|
|
90
|
-
return this.updateAll(data, where, options).then((count) => count > 0);
|
|
91
|
-
}
|
|
92
|
-
replaceById(id, data, options) {
|
|
93
|
-
if (typeof this.connector.replaceById === 'function') {
|
|
94
|
-
return this.connector.replaceById(this.model, id, data, options);
|
|
95
|
-
}
|
|
96
|
-
// FIXME: populate inst with all properties
|
|
97
|
-
// tslint:disable-next-line:no-unused-variable
|
|
98
|
-
const inst = data;
|
|
99
|
-
const where = this.model.buildWhereForId(id);
|
|
100
|
-
return this.updateAll(data, where, options).then((count) => count > 0);
|
|
101
|
-
}
|
|
102
|
-
deleteAll(where, options) {
|
|
103
|
-
return this.connector.deleteAll(this.model, where, options);
|
|
104
|
-
}
|
|
105
|
-
deleteById(id, options) {
|
|
106
|
-
if (typeof this.connector.deleteById === 'function') {
|
|
107
|
-
return this.connector.deleteById(this.model, id, options);
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
const where = this.model.buildWhereForId(id);
|
|
111
|
-
return this.deleteAll(where, options).then((count) => count > 0);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
count(where, options) {
|
|
115
|
-
return this.connector.count(this.model, where, options);
|
|
116
|
-
}
|
|
117
|
-
exists(id, options) {
|
|
118
|
-
if (typeof this.connector.exists === 'function') {
|
|
119
|
-
return this.connector.exists(this.model, id, options);
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
const where = this.model.buildWhereForId(id);
|
|
123
|
-
return this.count(where, options).then(result => result > 0);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
exports.CrudRepositoryImpl = CrudRepositoryImpl;
|
|
128
|
-
//# sourceMappingURL=repository.js.map
|
package/lib6/repository.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../src/repository.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AA2JhE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IAIE,YAAmB,UAAsB,EAAS,KAAe;QAA9C,eAAU,GAAV,UAAU,CAAY;QAAS,UAAK,GAAL,KAAK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E,OAAiB;QAC9B,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC;YAChD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF;AA/HD,gDA+HC"}
|
package/lib6/types/any.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Type } from './type';
|
|
2
|
-
/**
|
|
3
|
-
* Any type
|
|
4
|
-
*/
|
|
5
|
-
export declare class AnyType implements Type<any> {
|
|
6
|
-
readonly name: string;
|
|
7
|
-
isInstance(value: any): boolean;
|
|
8
|
-
isCoercible(value: any): boolean;
|
|
9
|
-
defaultValue(): any;
|
|
10
|
-
coerce(value: any): any;
|
|
11
|
-
serialize(value: any): any;
|
|
12
|
-
}
|
package/lib6/types/any.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../src/types/any.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAIhE,wBAAwB;AAExB;;GAEG;AACH;IAAA;QACW,SAAI,GAAG,KAAK,CAAC;IAwBxB,CAAC;IAtBC,UAAU,CAAC,KAAU;QACnB,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,KAAU;QACpB,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,YAAY;QACV,MAAM,CAAC,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,KAAU;QACf,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;IAED,SAAS,CAAC,KAAU;QAClB,EAAE,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC;YAChD,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;QACD,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;CACF;AAzBD,0BAyBC"}
|
package/lib6/types/array.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2017. 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 util = require("util");
|
|
8
|
-
// tslint:disable:no-any
|
|
9
|
-
/**
|
|
10
|
-
* Array type, such as string[]
|
|
11
|
-
*/
|
|
12
|
-
class ArrayType {
|
|
13
|
-
constructor(itemType) {
|
|
14
|
-
this.itemType = itemType;
|
|
15
|
-
this.name = 'array';
|
|
16
|
-
}
|
|
17
|
-
isInstance(value) {
|
|
18
|
-
if (value == null)
|
|
19
|
-
return true;
|
|
20
|
-
if (!Array.isArray(value)) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
const list = value;
|
|
24
|
-
return list.every(i => this.itemType.isInstance(i));
|
|
25
|
-
}
|
|
26
|
-
isCoercible(value) {
|
|
27
|
-
if (value == null)
|
|
28
|
-
return true;
|
|
29
|
-
if (!Array.isArray(value)) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
return value.every(i => this.itemType.isCoercible(i));
|
|
33
|
-
}
|
|
34
|
-
defaultValue() {
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
coerce(value) {
|
|
38
|
-
if (value == null)
|
|
39
|
-
return value;
|
|
40
|
-
if (!Array.isArray(value)) {
|
|
41
|
-
const msg = util.format('Invalid %s: %j', this.name, value);
|
|
42
|
-
throw new TypeError(msg);
|
|
43
|
-
}
|
|
44
|
-
return value.map(i => this.itemType.coerce(i));
|
|
45
|
-
}
|
|
46
|
-
serialize(value) {
|
|
47
|
-
if (value == null)
|
|
48
|
-
return value;
|
|
49
|
-
return value.map(i => this.itemType.serialize(i));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.ArrayType = ArrayType;
|
|
53
|
-
//# sourceMappingURL=array.js.map
|
package/lib6/types/array.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/types/array.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAGhE,6BAA6B;AAE7B,wBAAwB;AAExB;;GAEG;AACH;IACE,YAAmB,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;QAE3B,SAAI,GAAG,OAAO,CAAC;IAFe,CAAC;IAIxC,UAAU,CAAC,KAAU;QACnB,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC;YAAC,MAAM,CAAC,IAAI,CAAC;QAC/B,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,CAAC,KAAK,CAAC;QACf,CAAC;QACD,MAAM,IAAI,GAAG,KAAoC,CAAC;QAClD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,WAAW,CAAC,KAAU;QACpB,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC;YAAC,MAAM,CAAC,IAAI,CA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Type<boolean> {
|
|
6
|
-
readonly name: string;
|
|
7
|
-
isInstance(value: any): boolean;
|
|
8
|
-
defaultValue(): boolean;
|
|
9
|
-
isCoercible(value: any): boolean;
|
|
10
|
-
coerce(value: any): any;
|
|
11
|
-
serialize(value: boolean | null | undefined): boolean | null | undefined;
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/types/boolean.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAIhE,wBAAwB;AAExB;;GAEG;AACH;IAAA;QACW,SAAI,GAAG,SAAS,CAAC;IAqB5B,CAAC;IAnBC,UAAU,CAAC,KAAU;QACnB,MAAM,CAAC,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,SAAS,CAAC;IACrD,CAAC;IAED,YAAY;QACV,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;IAED,WAAW,CAAC,KAAU;QACpB,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAU;QACf,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,SAAS,CAAC,KAAiC;QACzC,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;CACF;AAtBD,kCAsBC"}
|
package/lib6/types/buffer.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2017. 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 util = require("util");
|
|
8
|
-
// tslint:disable:no-any
|
|
9
|
-
/**
|
|
10
|
-
* Buffer (binary) type
|
|
11
|
-
*/
|
|
12
|
-
class BufferType {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.name = 'buffer';
|
|
15
|
-
}
|
|
16
|
-
isInstance(value) {
|
|
17
|
-
return value == null || Buffer.isBuffer(value);
|
|
18
|
-
}
|
|
19
|
-
defaultValue() {
|
|
20
|
-
return Buffer.from([]);
|
|
21
|
-
}
|
|
22
|
-
isCoercible(value) {
|
|
23
|
-
if (value == null)
|
|
24
|
-
return true;
|
|
25
|
-
if (typeof value === 'string')
|
|
26
|
-
return true;
|
|
27
|
-
if (Buffer.isBuffer(value))
|
|
28
|
-
return true;
|
|
29
|
-
if (Array.isArray(value))
|
|
30
|
-
return true;
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
coerce(value, options) {
|
|
34
|
-
if (value == null)
|
|
35
|
-
return value;
|
|
36
|
-
if (Buffer.isBuffer(value))
|
|
37
|
-
return value;
|
|
38
|
-
if (typeof value === 'string') {
|
|
39
|
-
options = options || {};
|
|
40
|
-
const encoding = options.encoding || 'utf-8';
|
|
41
|
-
return Buffer.from(value, encoding);
|
|
42
|
-
}
|
|
43
|
-
else if (Array.isArray(value)) {
|
|
44
|
-
return Buffer.from(value);
|
|
45
|
-
}
|
|
46
|
-
const msg = util.format('Invalid %s: %j', this.name, value);
|
|
47
|
-
throw new TypeError(msg);
|
|
48
|
-
}
|
|
49
|
-
serialize(value, options) {
|
|
50
|
-
if (value == null)
|
|
51
|
-
return value;
|
|
52
|
-
const encoding = (options && options.encoding) || 'base64';
|
|
53
|
-
return value.toString(encoding);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.BufferType = BufferType;
|
|
57
|
-
//# sourceMappingURL=buffer.js.map
|
package/lib6/types/buffer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../src/types/buffer.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CA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,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5D,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,SAAS,CAAC,KAAgC,EAAE,OAAiB;QAC3D,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC;YAAC,MAAM,CAAC,KAAK,CAAC;QAChC,MAAM,QAAQ,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;QAC3D,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;CACF;AAtCD,gCAsCC"}
|
package/lib6/types/date.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Type } from './type';
|
|
2
|
-
/**
|
|
3
|
-
* Date type
|
|
4
|
-
*/
|
|
5
|
-
export declare class DateType implements Type<Date> {
|
|
6
|
-
readonly name: string;
|
|
7
|
-
isInstance(value: any): boolean;
|
|
8
|
-
isCoercible(value: any): boolean;
|
|
9
|
-
defaultValue(): Date;
|
|
10
|
-
coerce(value: any): any;
|
|
11
|
-
serialize(value: Date | null | undefined): string | null | undefined;
|
|
12
|
-
}
|
package/lib6/types/date.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2017. 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 util = require("util");
|
|
8
|
-
// tslint:disable:no-any
|
|
9
|
-
/**
|
|
10
|
-
* Date type
|
|
11
|
-
*/
|
|
12
|
-
class DateType {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.name = 'date';
|
|
15
|
-
}
|
|
16
|
-
isInstance(value) {
|
|
17
|
-
return value == null || value instanceof Date;
|
|
18
|
-
}
|
|
19
|
-
isCoercible(value) {
|
|
20
|
-
// Please note new Date(...) allows the following
|
|
21
|
-
/*
|
|
22
|
-
> new Date('1')
|
|
23
|
-
2001-01-01T08:00:00.000Z
|
|
24
|
-
> new Date('0')
|
|
25
|
-
2000-01-01T08:00:00.000Z
|
|
26
|
-
> new Date(1)
|
|
27
|
-
1970-01-01T00:00:00.001Z
|
|
28
|
-
> new Date(0)
|
|
29
|
-
1970-01-01T00:00:00.000Z
|
|
30
|
-
> new Date(true)
|
|
31
|
-
1970-01-01T00:00:00.001Z
|
|
32
|
-
> new Date(false)
|
|
33
|
-
1970-01-01T00:00:00.000Z
|
|
34
|
-
*/
|
|
35
|
-
return value == null || !isNaN(new Date(value).getTime());
|
|
36
|
-
}
|
|
37
|
-
defaultValue() {
|
|
38
|
-
return new Date();
|
|
39
|
-
}
|
|
40
|
-
coerce(value) {
|
|
41
|
-
if (value == null)
|
|
42
|
-
return value;
|
|
43
|
-
if (value instanceof Date) {
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
46
|
-
const d = new Date(value);
|
|
47
|
-
if (isNaN(d.getTime())) {
|
|
48
|
-
const msg = util.format('Invalid %s: %j', this.name, value);
|
|
49
|
-
throw new TypeError(msg);
|
|
50
|
-
}
|
|
51
|
-
return d;
|
|
52
|
-
}
|
|
53
|
-
serialize(value) {
|
|
54
|
-
if (value == null)
|
|
55
|
-
return value;
|
|
56
|
-
return value.toJSON();
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.DateType = DateType;
|
|
60
|
-
//# sourceMappingURL=date.js.map
|
package/lib6/types/date.js.map
DELETED
|
@@ -1 +0,0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,MAAM,CAAC,KAAK,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;CACF;AA/CD,4BA+CC"}
|
package/lib6/types/index.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Built-in types for LoopBack modeling
|
|
3
|
-
* - Type: abstract base type
|
|
4
|
-
* - StringType: string
|
|
5
|
-
* - BooleanType: boolean
|
|
6
|
-
* - NumberType: number
|
|
7
|
-
* - DateType: Date
|
|
8
|
-
* - BufferType: Buffer
|
|
9
|
-
* - AnyType: any
|
|
10
|
-
* - ArrayType: Array<T>
|
|
11
|
-
* - UnionType: Union of types
|
|
12
|
-
*/
|
|
13
|
-
import { Type } from './type';
|
|
14
|
-
import { StringType } from './string';
|
|
15
|
-
import { BooleanType } from './boolean';
|
|
16
|
-
import { NumberType } from './number';
|
|
17
|
-
import { DateType } from './date';
|
|
18
|
-
import { BufferType } from './buffer';
|
|
19
|
-
import { AnyType } from './any';
|
|
20
|
-
import { ArrayType } from './array';
|
|
21
|
-
import { UnionType } from './union';
|
|
22
|
-
import { ObjectType } from './object';
|
|
23
|
-
import { ModelType } from './model';
|
|
24
|
-
export { Type, StringType, BooleanType, NumberType, DateType, BufferType, AnyType, ArrayType, UnionType, ModelType, ObjectType };
|
|
25
|
-
export declare const STRING: StringType;
|
|
26
|
-
export declare const BOOLEAN: BooleanType;
|
|
27
|
-
export declare const NUMBER: NumberType;
|
|
28
|
-
export declare const DATE: DateType;
|
|
29
|
-
export declare const BUFFER: BufferType;
|
|
30
|
-
export declare const ANY: AnyType;
|
package/lib6/types/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2017. 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 string_1 = require("./string");
|
|
8
|
-
exports.StringType = string_1.StringType;
|
|
9
|
-
const boolean_1 = require("./boolean");
|
|
10
|
-
exports.BooleanType = boolean_1.BooleanType;
|
|
11
|
-
const number_1 = require("./number");
|
|
12
|
-
exports.NumberType = number_1.NumberType;
|
|
13
|
-
const date_1 = require("./date");
|
|
14
|
-
exports.DateType = date_1.DateType;
|
|
15
|
-
const buffer_1 = require("./buffer");
|
|
16
|
-
exports.BufferType = buffer_1.BufferType;
|
|
17
|
-
const any_1 = require("./any");
|
|
18
|
-
exports.AnyType = any_1.AnyType;
|
|
19
|
-
const array_1 = require("./array");
|
|
20
|
-
exports.ArrayType = array_1.ArrayType;
|
|
21
|
-
const union_1 = require("./union");
|
|
22
|
-
exports.UnionType = union_1.UnionType;
|
|
23
|
-
const object_1 = require("./object");
|
|
24
|
-
exports.ObjectType = object_1.ObjectType;
|
|
25
|
-
const model_1 = require("./model");
|
|
26
|
-
exports.ModelType = model_1.ModelType;
|
|
27
|
-
exports.STRING = new string_1.StringType();
|
|
28
|
-
exports.BOOLEAN = new boolean_1.BooleanType();
|
|
29
|
-
exports.NUMBER = new number_1.NumberType();
|
|
30
|
-
exports.DATE = new date_1.DateType();
|
|
31
|
-
exports.BUFFER = new buffer_1.BufferType();
|
|
32
|
-
exports.ANY = new any_1.AnyType();
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
package/lib6/types/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAehE,qCAAoC;AAalC,qBAbM,mBAAU,CAaN;AAZZ,uCAAsC;AAapC,sBAbM,qBAAW,CAaN;AAZb,qCAAoC;AAalC,qBAbM,mBAAU,CAaN;AAZZ,iCAAgC;AAa9B,mBAbM,eAAQ,CAaN;AAZV,qCAAoC;AAalC,qBAbM,mBAAU,CAaN;AAZZ,+BAA8B;AAa5B,kBAbM,aAAO,CAaN;AAZT,mCAAkC;AAahC,oBAbM,iBAAS,CAaN;AAZX,mCAAkC;AAahC,oBAbM,iBAAS,CAaN;AAZX,qCAAoC;AAclC,qBAdM,mBAAU,CAcN;AAbZ,mCAAkC;AAYhC,oBAZM,iBAAS,CAYN;AAIE,QAAA,MAAM,GAAG,IAAI,mBAAU,EAAE,CAAC;AAC1B,QAAA,OAAO,GAAG,IAAI,qBAAW,EAAE,CAAC;AAC5B,QAAA,MAAM,GAAG,IAAI,mBAAU,EAAE,CAAC;AAC1B,QAAA,IAAI,GAAG,IAAI,eAAQ,EAAE,CAAC;AACtB,QAAA,MAAM,GAAG,IAAI,mBAAU,EAAE,CAAC;AAC1B,QAAA,GAAG,GAAG,IAAI,aAAO,EAAE,CAAC"}
|
package/lib6/types/model.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/types/model.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAGhE,qCAAoC;AAEpC,wBAAwB;AAExB;;GAEG;AACH,eAAwC,SAAQ,mBAAa;IAG3D,YAAmB,UAAoB;QACrC,KAAK,CAAC,UAAU,CAAC,CAAC;QADD,eAAU,GAAV,UAAU,CAAU;QAF9B,SAAI,GAAW,OAAO,CAAC;IAIhC,CAAC;IAED,SAAS,CAAC,KAA2B;QACnC,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC;YAAC,MAAM,CAAC,KAAK,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,CAAC;CACF;AAXD,8BAWC"}
|
package/lib6/types/number.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright IBM Corp. 2017. 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 util = require("util");
|
|
8
|
-
// tslint:disable:no-any
|
|
9
|
-
/**
|
|
10
|
-
* Number type
|
|
11
|
-
*/
|
|
12
|
-
class NumberType {
|
|
13
|
-
constructor() {
|
|
14
|
-
this.name = 'number';
|
|
15
|
-
}
|
|
16
|
-
isInstance(value) {
|
|
17
|
-
return value == null || (!isNaN(value) && typeof value === 'number');
|
|
18
|
-
}
|
|
19
|
-
isCoercible(value) {
|
|
20
|
-
return value == null || !isNaN(Number(value));
|
|
21
|
-
}
|
|
22
|
-
defaultValue() {
|
|
23
|
-
return 0;
|
|
24
|
-
}
|
|
25
|
-
coerce(value) {
|
|
26
|
-
if (value == null)
|
|
27
|
-
return value;
|
|
28
|
-
const n = Number(value);
|
|
29
|
-
if (isNaN(n)) {
|
|
30
|
-
const msg = util.format('Invalid %s: %j', this.name, value);
|
|
31
|
-
throw new TypeError(msg);
|
|
32
|
-
}
|
|
33
|
-
return n;
|
|
34
|
-
}
|
|
35
|
-
serialize(value) {
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.NumberType = NumberType;
|
|
40
|
-
//# sourceMappingURL=number.js.map
|
package/lib6/types/number.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../src/types/number.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAEhE,6BAA6B;AAG7B,wBAAwB;AAExB;;GAEG;AACH;IAAA;QACW,SAAI,GAAG,QAAQ,CAAC;IA2B3B,CAAC;IAzBC,UAAU,CAAC,KAAU;QACnB,MAAM,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC;IACvE,CAAC;IAED,WAAW,CAAC,KAAU;QACpB,MAAM,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,YAAY;QACV,MAAM,CAAC,CAAC,CAAC;IACX,CAAC;IAED,MAAM,CAAC,KAAU;QACf,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC;YAAC,MAAM,CAAC,KAAK,CAAC;QAChC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACxB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACb,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC5D,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QACD,MAAM,CAAC,CAAC,CAAC;IACX,CAAC;IAED,SAAS,CAAC,KAAgC;QACxC,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;CACF;AA5BD,gCA4BC"}
|