Skip to content

Commit

Permalink
chore: intersection with ObserverMixin not required
Browse files Browse the repository at this point in the history
Intersection with ObserverMixin not required anymore
Vary callback type
Signed-off-by: Hage Yaapa <hage.yaapa@in.ibm.com>
  • Loading branch information
Hage Yaapa committed Mar 4, 2020
1 parent 5625b0d commit 6ac39b1
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions packages/repository/src/repositories/legacy-juggler-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export namespace juggler {
export import Transaction = legacy.Transaction;
// eslint-disable-next-line no-shadow
export import IsolationLevel = legacy.IsolationLevel;
export import ObserverMixin = legacy.ObserverMixin;
}

function isModelClass(
Expand Down Expand Up @@ -101,8 +100,7 @@ export class DefaultCrudRepository<
ID,
Relations extends object = {}
> implements EntityCrudRepository<T, ID, Relations> {
// Will just need juggler.PersistedModelClass once https://github.com/strongloop/loopback-datasource-juggler/issues/1824 is addressed
modelClass: juggler.PersistedModelClass & juggler.ObserverMixin;
modelClass: juggler.PersistedModelClass;

public readonly inclusionResolvers: Map<
string,
Expand Down Expand Up @@ -135,8 +133,7 @@ export class DefaultCrudRepository<
// Create an internal legacy Model attached to the datasource
private ensurePersistedModel(
entityClass: typeof Model,
// Will just need juggler.PersistedModelClass once https://github.com/strongloop/loopback-datasource-juggler/issues/1824 is addressed
): typeof juggler.PersistedModel & juggler.ObserverMixin {
): typeof juggler.PersistedModel {
const definition = entityClass.definition;
assert(
!!definition,
Expand All @@ -148,8 +145,7 @@ export class DefaultCrudRepository<
const model = dataSource.getModel(definition.name);
if (model) {
// The backing persisted model has been already defined.
// Will just need juggler.PersistedModelClass once https://github.com/strongloop/loopback-datasource-juggler/issues/1824 is addressed
return model as typeof juggler.PersistedModel & juggler.ObserverMixin;
return model as typeof juggler.PersistedModel;
}

return this.definePersistedModel(entityClass);
Expand All @@ -163,8 +159,7 @@ export class DefaultCrudRepository<
*/
protected definePersistedModel(
entityClass: typeof Model,
// Will just need juggler.PersistedModelClass once https://github.com/strongloop/loopback-datasource-juggler/issues/1824 is addressed
): typeof juggler.PersistedModel & juggler.ObserverMixin {
): typeof juggler.PersistedModel {
const dataSource = this.dataSource;
const definition = entityClass.definition;

Expand Down Expand Up @@ -193,10 +188,7 @@ export class DefaultCrudRepository<
}
properties[key] = Object.assign({}, value);
});
const modelClass = dataSource.createModel<
// Will just need juggler.PersistedModelClass once https://github.com/strongloop/loopback-datasource-juggler/issues/1824 is addressed
juggler.PersistedModelClass & juggler.ObserverMixin
>(
const modelClass = dataSource.createModel<juggler.PersistedModelClass>(
definition.name,
properties,
Object.assign(
Expand Down

0 comments on commit 6ac39b1

Please sign in to comment.