Skip to content

Commit

Permalink
chore: typings for operation hooks in LB4
Browse files Browse the repository at this point in the history
Added typings for supporting operation hooks in LB4.

Signed-off-by: Hage Yaapa <hage.yaapa@in.ibm.com>
  • Loading branch information
Hage Yaapa committed Feb 25, 2020
1 parent 36303b3 commit c098104
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion types/observer-mixin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

import {Callback, PromiseOrVoid} from './common';

export type Listener = (ctx: object, next: (err?: any) => void) => void;
export interface OperationHookContext {
[property: string]: any;
}

export type Listener = (ctx: OperationHookContext, next: (err?: any) => void) => void;

export interface ObserverMixin {
/**
Expand Down
5 changes: 5 additions & 0 deletions types/persisted-model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import {Callback, Options, PromiseOrVoid} from './common';
import {ModelBase, ModelData} from './model';
import {Listener} from './observer-mixin';
import {Filter, Where} from './query';

/**
Expand Down Expand Up @@ -519,6 +520,10 @@ export declare class PersistedModel extends ModelBase {
* @returns {String} The `id` property name
*/
static getIdName(): string;

definePersistedModel<T>(entityClass: T): PersistedModel;

static observe(operation: string, handler: Listener): void;
}

export type PersistedModelClass = typeof PersistedModel;

0 comments on commit c098104

Please sign in to comment.