From c30dce330fd6585ce8b0d33d3d6a5d2fd5fac906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 23 Mar 2020 09:38:40 +0100 Subject: [PATCH] fix: remove restriction to Entities from DefaultKeyValueRepository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit KeyValue repository does not require Entities, it can be used with any model. This was an intentional decision when implementing LB3 key-value APIs, to allow the key value to be provided outside of the data stored, thus enabling use cases like storing arbitrary data (including binary blobs) via the key-value API. Signed-off-by: Miroslav Bajtoš --- .../repository/src/repositories/kv.repository.bridge.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/repository/src/repositories/kv.repository.bridge.ts b/packages/repository/src/repositories/kv.repository.bridge.ts index 2eb2d84aaccd..857b46dea531 100644 --- a/packages/repository/src/repositories/kv.repository.bridge.ts +++ b/packages/repository/src/repositories/kv.repository.bridge.ts @@ -5,7 +5,7 @@ import legacy from 'loopback-datasource-juggler'; import {DataObject, Options} from '../common-types'; -import {Entity} from '../model'; +import {Model} from '../model'; import {KeyValueFilter, KeyValueRepository} from './kv.repository'; import {ensurePromise, juggler} from './legacy-juggler-bridge'; @@ -22,7 +22,7 @@ if (!(Symbol as any).asyncIterator) { /** * An implementation of KeyValueRepository based on loopback-datasource-juggler */ -export class DefaultKeyValueRepository +export class DefaultKeyValueRepository implements KeyValueRepository { /** * A legacy KeyValueModel class @@ -34,7 +34,7 @@ export class DefaultKeyValueRepository * @param ds - Legacy DataSource */ constructor( - private entityClass: typeof Entity & {prototype: T}, + private entityClass: typeof Model & {prototype: T}, ds: juggler.DataSource, ) { // KVModel class is placeholder to receive methods from KeyValueAccessObject