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

dredd-transactions

Package Overview
Dependencies
Maintainers
4
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dredd-transactions - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

lib/from-api-blueprint-ast/compile.js

30

lib/dredd-transactions.js
// Generated by CoffeeScript 1.10.0
var compile, compileFromApiBlueprintAst, compileFromApiElements, getTransactionName, getTransactionPath, parse;
parse = require('./parse').parse;
parse = require('./parse');
compileFromApiBlueprintAst = require('./compile-from-api-blueprint-ast').compileFromApiBlueprintAst;
compileFromApiBlueprintAst = require('./from-api-blueprint-ast/compile');
compileFromApiElements = require('./compile-from-api-elements').compileFromApiElements;
compileFromApiElements = require('./from-api-elements/compile');
getTransactionName = require('./get-transaction-name');
getTransactionName = require('./transaction-name/get-transaction-name');
getTransactionPath = require('./get-transaction-path');
getTransactionPath = require('./transaction-path/get-transaction-path');
compile = function(input, filename, callback) {
var i, len, ref, result, transaction;
var err, error, i, len, ref, result, transaction;
if (typeof input === 'string') {
return parse(input, function(err, apiElements) {
var error;
var error, i, len, ref, result, transaction;
try {
return callback(null, compileFromApiElements(apiElements, filename));
result = compileFromApiElements(apiElements, filename);
} catch (error) {

@@ -25,5 +25,17 @@ err = error;

}
ref = result.transactions;
for (i = 0, len = ref.length; i < len; i++) {
transaction = ref[i];
transaction['name'] = getTransactionName(transaction);
transaction['path'] = getTransactionPath(transaction);
}
return callback(null, result);
});
} else {
result = compileFromApiBlueprintAst(input, filename);
try {
result = compileFromApiBlueprintAst(input, filename);
} catch (error) {
err = error;
return callback(err);
}
ref = result.transactions;

@@ -30,0 +42,0 @@ for (i = 0, len = ref.length; i < len; i++) {

@@ -7,3 +7,3 @@ // Generated by CoffeeScript 1.10.0

expandUriTemplateWithParameters = function(uriTemplate, parameters) {
var ambigous, e, error, expression, i, j, k, l, len, len1, len2, len3, len4, m, param, parameter, parsed, ref, ref1, ref2, result, text, toExpand, uriParameter, uriParameters;
var ambiguous, e, error, expression, i, j, k, l, len, len1, len2, len3, len4, m, param, parameter, parsed, ref, ref1, ref2, result, text, toExpand, uriParameter, uriParameters;
result = {

@@ -44,12 +44,12 @@ errors: [],

} else {
ambigous = false;
ambiguous = false;
for (l = 0, len3 = uriParameters.length; l < len3; l++) {
uriParameter = uriParameters[l];
if (Object.keys(parameters).indexOf(uriParameter) === -1) {
ambigous = true;
text = ("\nAmbigous URI parameter in template: " + uriTemplate + " ") + "\nParameter not defined in blueprint:" + "'" + uriParameter + "'";
ambiguous = true;
text = ("\nAmbiguous URI parameter in template: " + uriTemplate + " ") + "\nParameter not defined in blueprint:" + "'" + uriParameter + "'";
result['warnings'].push(text);
}
}
if (ambigous === false) {
if (ambiguous === false) {
toExpand = {};

@@ -61,4 +61,4 @@ for (m = 0, len4 = uriParameters.length; m < len4; m++) {

if (param['example'] === void 0 || param['example'] === '') {
ambigous = true;
text = ("\nAmbigous URI parameter in template: " + uriTemplate + " ") + "\nNo example value for required parameter in blueprint:" + "'" + uriParameter + "'";
ambiguous = true;
text = ("\nAmbiguous URI parameter in template: " + uriTemplate + " ") + "\nNo example value for required parameter in blueprint:" + "'" + uriParameter + "'";
result['warnings'].push(text);

@@ -77,3 +77,3 @@ } else {

}
if (ambigous === false) {
if (ambiguous === false) {
result['uri'] = parsed.expand(toExpand);

@@ -80,0 +80,0 @@ }

@@ -21,4 +21,2 @@ // Generated by CoffeeScript 1.10.0

module.exports = {
parse: parse
};
module.exports = parse;
{
"name": "dredd-transactions",
"version": "0.0.1",
"version": "0.0.2",
"description": "Compiles HTTP Transactions (Request-Response pairs) from API description document",
"main": "lib/blueprint-transactions.js",
"main": "lib/dredd-transactions.js",
"scripts": {

@@ -21,5 +21,6 @@ "changelist": "github-changes -o apiaryio -r dredd-transactions --only-pulls --use-commit-body --file CHANGELOG-Generated.md -a",

"clone": "^1.0.2",
"protagonist": "^1.3.0-pre.1",
"sift": "^3.2.1",
"traverse": "^0.6.6",
"uri-template": "^1.0.0",
"protagonist": "1.3.0-pre.1"
"uri-template": "^1.0.0"
},

@@ -35,3 +36,5 @@ "devDependencies": {

"mocha-lcov-reporter": "^1.0.0",
"sinon": "^1.17.3"
"proxyquire": "^1.7.4",
"sinon": "^1.17.3",
"tv4": "^1.2.7"
},

@@ -38,0 +41,0 @@ "keywords": [

@@ -97,8 +97,8 @@ # Dredd Transactions

- request (object) - HTTP Request as described in API description document
- request (object) - HTTP Request as described in API description document.
- method
- uri: `/message` (string) - Informative URI of the Request
- uri: `/message` (string) - Informative URI of the Request.
- headers (object)
- body: `Hello world!\n` (string)
- response (object) - Expected HTTP Response as described in API description document
- response (object) - Expected HTTP Response as described in API description document.
- status: `200` (string)

@@ -112,4 +112,4 @@ - headers (object)

- name: `Hello world! > Retrieve Message` (string) - Transaction Name, non-deterministic breadcrumb location of the HTTP Transaction within the API description document
- origin (object) - Object of references to nodes of [API Elements][api-elements] derived from the original API description document
- name: `Hello world! > Retrieve Message` (string) - Transaction Name, non-deterministic breadcrumb location of the HTTP Transaction within the API description document.
- origin (object) - Object of references to nodes of [API Elements][api-elements] derived from the original API description document.
- filename: `./blueprint.md` (string)

@@ -132,11 +132,26 @@ - apiName: `My Api` (string)

+ origin: `apiDescriptionParser`, `transactionsCompiler` (enum) - Origin of the annotation.
+ code (number) - Parser-specific code of the annotation.
+ message (string) - Textual annotation. This is – in most cases – a human-readable message to be displayed to user.
+ location (array) - Locations of the annotation in the source file. A series of character-blocks, which may be non-continuous. For further details refer to API Elements' [Source Map](source-map) element.
+ (array, fixed) - Continuous characters block. A pair of character index and character count.
+ (number) - Zero-based index of a character in the source document.
+ (number) - Count of characters starting from the character index.
- type (enum[string]) - Type of the annotation. Assigned according to in which part of compilation the error or warning occurred.
- `apiDescriptionParser`
- `parametersValidation`
- `uriTemplateExpansion`
- code (number) - Parser-specific code of the annotation.
- message (string) - Textual annotation. This is – in most cases – a human-readable message to be displayed to user.
- location (array) - Locations of the annotation in the source file. A series of character-blocks, which may be non-continuous. For further details refer to API Elements' [Source Map](source-map) element.
- (array, fixed) - Continuous characters block. A pair of character index and character count.
- (number) - Zero-based index of a character in the source document.
- (number) - Count of characters starting from the character index.
### Deprecated Properties
- origin (object) - Object of references to nodes of [API Elements][api-elements] derived from the original API description document.
- filename: `./blueprint.md` (string)
- apiName: `My Api` (string)
- resourceGroupName: `Greetings` (string)
- resourceName: `Hello, world!` (string)
- actionName: `Retrieve Message` (string)
- exampleName: `First example` (string)
> **Note:** These properties are to be superseded by so-called _Transaction Path_. Feel free to read and comment the proposal in [apiaryio/dredd#227](https://github.com/apiaryio/dredd/issues/227).
[dredd]: https://github.com/apiaryio/dredd

@@ -143,0 +158,0 @@ [mson-spec]: https://github.com/apiaryio/mson

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