Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

daf-core

Package Overview
Dependencies
Maintainers
6
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

daf-core - npm Package Compare versions

Comparing version 7.0.0-beta.46 to 7.0.0-beta.47

7

build/agent.d.ts

@@ -39,2 +39,8 @@ import { IAgent, IPluginMethodMap, IAgentPlugin, TAgent, IAgentPluginSchema } from './types/IAgent';

context?: Record<string, any>;
/**
* Flag that enables schema validation for plugin methods.
*
* @default false
*/
schemaValidation?: boolean;
}

@@ -57,2 +63,3 @@ /**

private schema;
private schemaValidation;
private context?;

@@ -59,0 +66,0 @@ private protectedMethods;

5

build/agent.js

@@ -213,2 +213,3 @@ "use strict";

}
this.schemaValidation = (options === null || options === void 0 ? void 0 : options.schemaValidation) || false;
}

@@ -265,3 +266,3 @@ /**

_args = args || {};
if (this.schema.components.methods[method]) {
if (this.schemaValidation && this.schema.components.methods[method]) {
validator_1.validateArguments(method, _args, this.schema);

@@ -272,3 +273,3 @@ }

result = _a.sent();
if (this.schema.components.methods[method]) {
if (this.schemaValidation && this.schema.components.methods[method]) {
validator_1.validateReturnType(method, result, this.schema);

@@ -275,0 +276,0 @@ }

@@ -6,2 +6,13 @@ # Change Log

# [7.0.0-beta.47](https://github.com/uport-project/daf/compare/v7.0.0-beta.46...v7.0.0-beta.47) (2020-11-23)
### Bug Fixes
* Disable schema validation by default ([#278](https://github.com/uport-project/daf/issues/278)) ([7bb77cd](https://github.com/uport-project/daf/commit/7bb77cde56415e8e909cabc235c62188d8147d0e)), closes [#255](https://github.com/uport-project/daf/issues/255) [#275](https://github.com/uport-project/daf/issues/275)
# [7.0.0-beta.46](https://github.com/uport-project/daf/compare/v7.0.0-beta.45...v7.0.0-beta.46) (2020-11-19)

@@ -8,0 +19,0 @@

4

package.json
{
"name": "daf-core",
"description": "DID Agent Framework Core Logic & Interfaces.",
"version": "7.0.0-beta.46",
"version": "7.0.0-beta.47",
"main": "build/index.js",

@@ -42,3 +42,3 @@ "types": "build/index.d.ts",

"keywords": [],
"gitHead": "b97ff3b0a7c34d49215173e4ec76b2d093892c36"
"gitHead": "2e5911627de039bc54066a9d506afac6eb570d1d"
}

@@ -181,3 +181,2 @@ import { Agent } from '../agent'

onEvent: async () => {
console.log('throwing error in error handler')
throw new Error('barError')

@@ -190,4 +189,4 @@ },

await expect(agent.emit('foo', {})).rejects.toThrowError('ErrorEventHandlerError')
await expect(agent.emit('foo', {})).rejects.toThrow('ErrorEventHandlerError')
})
})

@@ -69,2 +69,9 @@ import { IAgent, IPluginMethodMap, IAgentPlugin, TAgent, IAgentPluginSchema } from './types/IAgent'

context?: Record<string, any>
/**
* Flag that enables schema validation for plugin methods.
*
* @default false
*/
schemaValidation?: boolean
}

@@ -89,2 +96,3 @@

private schema: IAgentPluginSchema
private schemaValidation: boolean
private context?: Record<string, any>

@@ -172,2 +180,4 @@ private protectedMethods = ['execute', 'availableMethods', 'emit']

}
this.schemaValidation = options?.schemaValidation || false
}

@@ -221,7 +231,7 @@

const _args = args || {}
if (this.schema.components.methods[method]) {
if (this.schemaValidation && this.schema.components.methods[method]) {
validateArguments(method, _args, this.schema)
}
const result = await this.methods[method](_args, { ...this.context, agent: this })
if (this.schema.components.methods[method]) {
if (this.schemaValidation && this.schema.components.methods[method]) {
validateReturnType(method, result, this.schema)

@@ -228,0 +238,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc