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

@asyncapi/parser

Package Overview
Dependencies
Maintainers
3
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asyncapi/parser - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

21

lib/parser.js

@@ -31,10 +31,15 @@ const path = require('path');

/**
* The complete list of parse configuration options used to parse the given data.
* @typedef {Object} ParserOptions
* @property {String} path - Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir.
* @property {Object} parse - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}.
* @property {Object} resolve - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}.
* @property {Boolean} applyTraits - Whether to resolve and apply traits or not. Defaults to true.
*/
/**
* Parses and validate an AsyncAPI document from YAML or JSON.
*
* @param {(String | Object)} asyncapiYAMLorJSON An AsyncAPI document in JSON or YAML format.
* @param {Object} [options] Configuration options.
* @param {String} [options.path] Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir.
* @param {Object} [options.parse] Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}.
* @param {Object} [options.resolve] Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}.
* @param {Object} [options.applyTraits=true] Whether to resolve and apply traits or not.
* @param {ParserOptions} options Configuration options object {@link ParserOptions}
* @returns {Promise<AsyncAPIDocument>} The parsed AsyncAPI document.

@@ -122,3 +127,3 @@ */

* @param {Object} [fetchOptions] Configuration to pass to the {@link https://developer.mozilla.org/en-US/docs/Web/API/Request|fetch} call.
* @param {Object} [options] Configuration to pass to the {@link module:Parser#parse} method.
* @param {ParserOptions} [options] Configuration to pass to the {@link ParserOptions} method.
* @returns {Promise<AsyncAPIDocument>} The parsed AsyncAPI document.

@@ -248,3 +253,3 @@ */

* @param {String} initialFormat information of the document was originally JSON or YAML
* @param {Object} options Configuration options.
* @param {ParserOptions} options Configuration options. {@link ParserOptions}
*/

@@ -280,3 +285,3 @@ async function customChannelsOperations(parsedJSON, asyncapiYAMLorJSON, initialFormat, options) {

* @param {String} initialFormat information of the document was originally JSON or YAML
* @param {Object} options Configuration options.
* @param {ParserOptions} options Configuration options. {@link ParserOptions}
*/

@@ -283,0 +288,0 @@ async function customComponentsMsgOperations(parsedJSON, asyncapiYAMLorJSON, initialFormat, options) {

{
"name": "@asyncapi/parser",
"version": "1.7.0",
"version": "1.8.0",
"description": "JavaScript AsyncAPI parser.",

@@ -17,4 +17,2 @@ "main": "lib/index.js",

"release": "semantic-release",
"get:version": "echo $npm_package_version",
"get:name": "echo $npm_package_name",
"lint": "eslint --max-warnings 0 --config \".eslintrc\" \".\"",

@@ -21,0 +19,0 @@ "test:lib": "nyc --silent --no-clean mocha --exclude \"test/browser_test.js\" --exclude \"test/parseFromUrl_test.js\" --recursive",

@@ -1068,17 +1068,21 @@ /**

/**
* The complete list of parse configuration options used to parse the given data.
* @property path - Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir.
* @property parse - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}.
* @property resolve - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}.
* @property applyTraits - Whether to resolve and apply traits or not. Defaults to true.
*/
type ParserOptions = {
path: string;
parse: any;
resolve: any;
applyTraits: boolean;
};
/**
* Parses and validate an AsyncAPI document from YAML or JSON.
* @param asyncapiYAMLorJSON - An AsyncAPI document in JSON or YAML format.
* @param [options] - Configuration options.
* @param [options.path] - Path to the AsyncAPI document. It will be used to resolve relative references. Defaults to current working dir.
* @param [options.parse] - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}.
* @param [options.resolve] - Options object to pass to {@link https://apidevtools.org/json-schema-ref-parser/docs/options.html|json-schema-ref-parser}.
* @param [options.applyTraits = true] - Whether to resolve and apply traits or not.
* @param options - Configuration options object {@link ParserOptions}
* @returns The parsed AsyncAPI document.
*/
function parse(asyncapiYAMLorJSON: string | any, options?: {
path?: string;
parse?: any;
resolve?: any;
applyTraits?: any;
}): Promise<AsyncAPIDocument>;
function parse(asyncapiYAMLorJSON: string | any, options: ParserOptions): Promise<AsyncAPIDocument>;
/**

@@ -1088,6 +1092,6 @@ * Fetches an AsyncAPI document from the given URL and passes its content to the `parse` method.

* @param [fetchOptions] - Configuration to pass to the {@link https://developer.mozilla.org/en-US/docs/Web/API/Request|fetch} call.
* @param [options] - Configuration to pass to the {@link module:Parser#parse} method.
* @param [options] - Configuration to pass to the {@link ParserOptions} method.
* @returns The parsed AsyncAPI document.
*/
function parseFromUrl(url: string, fetchOptions?: any, options?: any): Promise<AsyncAPIDocument>;
function parseFromUrl(url: string, fetchOptions?: any, options?: ParserOptions): Promise<AsyncAPIDocument>;
/**

@@ -1094,0 +1098,0 @@ * Registers a new schema parser. Schema parsers are in charge of parsing and transforming payloads to AsyncAPI Schema format.

Sorry, the diff of this file is too big to display

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