Comparing version 3.0.0-beta.8 to 3.0.0-beta.9
# Fury Changelog | ||
## 3.0.0-beta.9 (2019-02-26) | ||
### Breaking | ||
- Fury asynchronous APIs will no longer include both an error and a result | ||
value. The APIs will now contain an error if the method could not proceed, or | ||
a result. In the case of the `validate` and `parse` functions, these will | ||
return a parse result with any error annotations upon a validation error and | ||
will no longer include an error in the asynchronous callback. | ||
### Enhancements | ||
- Update minim to [0.23.0](https://github.com/refractproject/minim/releases/tag/v0.23.0). | ||
## 3.0.0-beta.8 (2018-12-21) | ||
@@ -4,0 +18,0 @@ |
@@ -39,3 +39,2 @@ const minimModule = require('minim'); | ||
*/ | ||
// eslint-disable-next-line class-methods-use-this | ||
load(elements) { | ||
@@ -62,10 +61,13 @@ return this.minim.fromRefract(elements); | ||
if (!adapter) { | ||
return this.parse({ source, mediaType, adapterOptions }, (err, result) => { | ||
if (result && result.annotations.length > 0) { | ||
return this.parse({ source, mediaType, adapterOptions }, (err, parseResult) => { | ||
if (err) { | ||
return done(err); | ||
} | ||
if (parseResult.annotations.length > 0) { | ||
const { ParseResult } = this.minim.elements; | ||
const parseResult = new ParseResult(result.annotations); | ||
done(err, parseResult); | ||
} else { | ||
done(err, null); | ||
return done(null, new ParseResult(parseResult.annotations)); | ||
} | ||
return done(null, null); | ||
}); | ||
@@ -80,8 +82,12 @@ } | ||
return adapter.validate(options, (err, elements) => { | ||
if (!elements || elements instanceof this.minim.Element) { | ||
done(err, elements); | ||
} else { | ||
done(err, this.load(elements)); | ||
return adapter.validate(options, (err, parseResult) => { | ||
if (err) { | ||
return done(err); | ||
} | ||
if (parseResult && !(parseResult instanceof this.minim.Element)) { | ||
return done(null, this.load(parseResult)); | ||
} | ||
return done(null, parseResult); | ||
}); | ||
@@ -112,8 +118,12 @@ } | ||
return adapter.parse(options, (err, elements) => { | ||
if (!elements || elements instanceof this.minim.Element) { | ||
done(err, elements); | ||
} else { | ||
done(err, this.load(elements)); | ||
return adapter.parse(options, (err, parseResult) => { | ||
if (err) { | ||
return done(err); | ||
} | ||
if (!(parseResult instanceof this.minim.Element)) { | ||
return done(null, this.load(parseResult)); | ||
} | ||
return done(null, parseResult); | ||
}); | ||
@@ -120,0 +130,0 @@ } catch (err) { |
{ | ||
"name": "fury", | ||
"version": "3.0.0-beta.8", | ||
"version": "3.0.0-beta.9", | ||
"description": "API Description SDK", | ||
@@ -11,3 +11,4 @@ "author": "Apiary.io <support@apiary.io>", | ||
"type": "git", | ||
"url": "https://github.com/apiaryio/api-elements.js.git" | ||
"url": "https://github.com/apiaryio/api-elements.js.git", | ||
"directory": "packages/fury" | ||
}, | ||
@@ -20,4 +21,4 @@ "scripts": { | ||
"dependencies": { | ||
"minim": "^0.22.1", | ||
"minim-parse-result": "^0.10.1" | ||
"minim": "^0.23.1", | ||
"minim-parse-result": "^0.11.0" | ||
}, | ||
@@ -24,0 +25,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
16562
5
129
0
+ Addedminim@0.23.8(transitive)
+ Addedminim-api-description@0.9.1(transitive)
+ Addedminim-parse-result@0.11.1(transitive)
- Removedminim@0.22.1(transitive)
- Removedminim-api-description@0.8.1(transitive)
- Removedminim-parse-result@0.10.1(transitive)
- Removeduptown@1.1.0(transitive)
Updatedminim@^0.23.1
Updatedminim-parse-result@^0.11.0