diff --git a/src/models/operation.ts b/src/models/operation.ts index 1bb372296..6a92b9c8a 100644 --- a/src/models/operation.ts +++ b/src/models/operation.ts @@ -1,6 +1,7 @@ import type { BaseModel } from './base'; import type { ChannelsInterface } from './channels'; import type { MessagesInterface } from './messages'; +import type { OperationReplyInterface } from './operation-reply'; import type { OperationTraitsInterface } from './operation-traits'; import type { OperationTraitInterface } from './operation-trait'; import type { ServersInterface } from './servers'; @@ -14,5 +15,6 @@ export interface OperationInterface extends BaseModel, OperationTraitInterface { servers(): ServersInterface; channels(): ChannelsInterface; messages(): MessagesInterface; + reply(): OperationReplyInterface | undefined; traits(): OperationTraitsInterface; } diff --git a/src/models/v2/operation.ts b/src/models/v2/operation.ts index b1193ddef..4fb696d74 100644 --- a/src/models/v2/operation.ts +++ b/src/models/v2/operation.ts @@ -12,6 +12,7 @@ import type { ChannelsInterface } from '../channels'; import type { ChannelInterface } from '../channel'; import type { MessagesInterface } from '../messages'; import type { OperationInterface, OperationAction } from '../operation'; +import type { OperationReplyInterface } from '../operation-reply'; import type { OperationTraitsInterface } from '../operation-traits'; import type { ServersInterface } from '../servers'; import type { ServerInterface } from '../server'; @@ -76,6 +77,10 @@ export class Operation extends OperationTrait implements Ope ); } + reply(): OperationReplyInterface | undefined { + return; + } + traits(): OperationTraitsInterface { return new OperationTraits( (this._json.traits || []).map((trait: any, index: number) => { diff --git a/test/models/v2/operation.spec.ts b/test/models/v2/operation.spec.ts index bed03a14f..ee076aba4 100644 --- a/test/models/v2/operation.spec.ts +++ b/test/models/v2/operation.spec.ts @@ -179,6 +179,14 @@ describe('Operation model', function() { }); }); + describe('.reply()', function() { + it('should return always undefined as it is not a feature part of v2', function() { + const doc = { reply: {} }; + const d = new Operation(doc); + expect(d.reply()).toBeUndefined(); + }); + }); + describe('.traits()', function() { it('should return collection of traits', function() { const doc = { traits: [{ operationId: '...' }] };