Skip to content

Commit

Permalink
fix: remove restriction to Entities from DefaultKeyValueRepository
Browse files Browse the repository at this point in the history
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š <[email protected]>
  • Loading branch information
bajtos committed Mar 30, 2020
1 parent 1daa2b8 commit c30dce3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/repository/src/repositories/kv.repository.bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -22,7 +22,7 @@ if (!(Symbol as any).asyncIterator) {
/**
* An implementation of KeyValueRepository based on loopback-datasource-juggler
*/
export class DefaultKeyValueRepository<T extends Entity>
export class DefaultKeyValueRepository<T extends Model>
implements KeyValueRepository<T> {
/**
* A legacy KeyValueModel class
Expand All @@ -34,7 +34,7 @@ export class DefaultKeyValueRepository<T extends Entity>
* @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
Expand Down

0 comments on commit c30dce3

Please sign in to comment.