Skip to content

Commit

Permalink
feat(core): make agent context public readonly (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat authored Jan 25, 2021
1 parent db41f9c commit 802948e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/core/src/__tests__/agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ describe('core agent', () => {
{ foo: 'bar' },
{ agent, authorizedDid: 'did:example:123' },
)

expect(agent.context?.authorizedDid).toEqual('did:example:123')
})

it.todo('createAgent should return instance of Agent')
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class Agent implements IAgent {

private schema: IAgentPluginSchema
private schemaValidation: boolean
private context?: Record<string, any>
public readonly context?: Record<string, any>
private protectedMethods = ['execute', 'availableMethods', 'emit']

private readonly eventBus: EventEmitter = new EventEmitter()
Expand Down

0 comments on commit 802948e

Please sign in to comment.