diff --git a/README.md b/README.md index d72c6b363..d376e54c2 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ This action generates whatever you want using your AsyncAPI document. It uses [A ### `template` -Template for the generator. Official templates are listed here https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate. You can pass template as npm package, url to git repository, link to tar file or local template. +Template for the generator. Official templates are listed here https://github.com/asyncapi/generator#list-of-official-generator-templates. You can pass template as npm package, url to git repository, link to tar file or local template. -**Default** points to `@asyncapi/markdown-template@0.3.0` template. +**Default** points to `@asyncapi/markdown-template@0.10.0` template. > We recommend to always specify the version of the template to not encounter any issues with the action in case of release of the template that is not compatible with given version of the generator. @@ -28,55 +28,36 @@ Directory where to put the generated files. **Default** points to `output` directory in the working directory. -## Outputs - -### `files` - -List of generated files. - ## Example usage ### Basic In case all defaults are fine for you, just add such step: -``` +```yaml - name: Generating Markdown from my AsyncAPI document - uses: asyncapi/github-action-for-generator@v0.2.0 + uses: asyncapi/github-action-for-generator@v1 ``` ### Using all possible inputs In case you do not want to use defaults, you for example want to use different template: -``` +```yaml - name: Generating HTML from my AsyncAPI document - uses: asyncapi/github-action-for-generator@v0.2.0 + uses: asyncapi/github-action-for-generator@v1 with: - template: '@asyncapi/html-template@0.3.0' #In case of template from npm, because of @ it must be in quotes + template: '@asyncapi/html-template@0.15.4' #In case of template from npm, because of @ it must be in quotes filepath: docs/api/my-asyncapi.yml parameters: baseHref=/test-experiment/ sidebarOrganization=byTags #space separated list of key/values output: generated-html ``` -### Accessing output of generation step - -In case you want to have more steps in your workflow after generation and you need to know what files were exactly generated, you can access this information as shown below: - -``` -- name: Generating Markdown from my AsyncAPI document - id: generation - uses: asyncapi/github-action-for-generator@v0.2.0 -- name: Another step where I want to know what files were generated so I can pass it to another step and process them forward if needed - run: echo '${{steps.generation.outputs.files}}' -``` - ### Example workflow with publishing generated HTML to GitHub Pages In case you want to validate your asyncapi file first, and also send generated HTML to GitHub Pages this is how full workflow could look like: -``` - +```yaml name: AsyncAPI documents processing on: @@ -93,15 +74,15 @@ jobs: #Using another action for AsyncAPI for validation - name: Validating AsyncAPI document - uses: WaleedAshraf/asyncapi-github-action@v0.0.3 + uses: WaleedAshraf/asyncapi-github-action@v1 with: filepath: docs/api/my-asyncapi.yml #In case you do not want to use defaults, you for example want to use different template - name: Generating HTML from my AsyncAPI document - uses: asyncapi/github-action-for-generator@v0.2.0 + uses: asyncapi/github-action-for-generator@v1 with: - template: '@asyncapi/html-template@0.3.0' #In case of template from npm, because of @ it must be in quotes + template: '@asyncapi/html-template@0.9.0' #In case of template from npm, because of @ it must be in quotes filepath: docs/api/my-asyncapi.yml parameters: baseHref=/test-experiment/ sidebarOrganization=byTags #space separated list of key/values output: generated-html @@ -114,3 +95,7 @@ jobs: BRANCH: gh-pages FOLDER: generated-html ``` + +## Troubleshooting + +You can enable more log information in GitHub Action by adding `ACTIONS_STEP_DEBUG` secret to repository where you want to use this action. Set the value of this secret to `true` and you''ll notice more debug logs from this action. \ No newline at end of file diff --git a/action.yml b/action.yml index b7ac5c41e..0ba92b95e 100644 --- a/action.yml +++ b/action.yml @@ -3,7 +3,7 @@ description: 'Use this action to generate docs or code from your AsyncAPI docume inputs: template: description: 'Template for the generator. Official templates are listed here https://github.com/search?q=topic%3Aasyncapi+topic%3Agenerator+topic%3Atemplate. You can pass template as npm package, url to git repository, link to tar file or local template.' - default: '@asyncapi/markdown-template' + default: '@asyncapi/markdown-template@0.10.0' required: false filepath: description: 'Location of the AsyncAPI document.' @@ -16,9 +16,6 @@ inputs: description: 'Directory where to put the generated files.' required: false default: 'output' -outputs: - files: - description: 'List of generated files.' runs: using: 'node12' main: 'dist/index.js' diff --git a/dist/fsevents.node b/dist/fsevents.node index 83af92f7b..8d952b5d0 100755 Binary files a/dist/fsevents.node and b/dist/fsevents.node differ diff --git a/dist/index.js b/dist/index.js index d53a8e74a..a374d66b8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,8819 +1,9319 @@ module.exports = -/******/ (function(modules, runtime) { // webpackBootstrap -/******/ "use strict"; -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ __webpack_require__.ab = __dirname + "/"; -/******/ -/******/ // the startup function -/******/ function startup() { -/******/ // Load entry module and return exports -/******/ return __webpack_require__(526); -/******/ }; -/******/ -/******/ // run startup -/******/ return startup(); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */, -/* 1 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -const path = __webpack_require__(622); -const scan = __webpack_require__(537); -const parse = __webpack_require__(806); -const utils = __webpack_require__(265); -const constants = __webpack_require__(446); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ - const opts = options || {}; - const posix = utils.isWindows(options); - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); +/***/ 67387: +/***/ ((module) => { - const state = regex.state; - delete regex.state; +"use strict"; +module.exports = JSON.parse("{\"_from\":\"markdown-it@^10.0.0\",\"_id\":\"markdown-it@10.0.0\",\"_inBundle\":false,\"_integrity\":\"sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==\",\"_location\":\"/@asyncapi/generator-filters/markdown-it\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"markdown-it@^10.0.0\",\"name\":\"markdown-it\",\"escapedName\":\"markdown-it\",\"rawSpec\":\"^10.0.0\",\"saveSpec\":null,\"fetchSpec\":\"^10.0.0\"},\"_requiredBy\":[\"/@asyncapi/generator-filters\"],\"_resolved\":\"https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz\",\"_shasum\":\"abfc64f141b1722d663402044e43927f1f50a8dc\",\"_spec\":\"markdown-it@^10.0.0\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/@asyncapi/generator-filters\",\"bin\":{\"markdown-it\":\"bin/markdown-it.js\"},\"bugs\":{\"url\":\"https://github.com/markdown-it/markdown-it/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"argparse\":\"^1.0.7\",\"entities\":\"~2.0.0\",\"linkify-it\":\"^2.0.0\",\"mdurl\":\"^1.0.1\",\"uc.micro\":\"^1.0.5\"},\"deprecated\":false,\"description\":\"Markdown-it - modern pluggable markdown parser.\",\"devDependencies\":{\"ansi\":\"^0.3.0\",\"autoprefixer-stylus\":\"^0.14.0\",\"benchmark\":\"~2.1.0\",\"browserify\":\"^16.3.0\",\"chai\":\"^4.2.0\",\"coveralls\":\"^3.0.4\",\"eslint\":\"^6.0.1\",\"express\":\"^4.14.0\",\"highlight.js\":\"^9.2.0\",\"istanbul\":\"^0.4.5\",\"markdown-it-abbr\":\"^1.0.4\",\"markdown-it-container\":\"^2.0.0\",\"markdown-it-deflist\":\"^2.0.0\",\"markdown-it-emoji\":\"^1.1.1\",\"markdown-it-footnote\":\"^3.0.1\",\"markdown-it-for-inline\":\"^0.1.0\",\"markdown-it-ins\":\"^2.0.0\",\"markdown-it-mark\":\"^2.0.0\",\"markdown-it-sub\":\"^1.0.0\",\"markdown-it-sup\":\"^1.0.0\",\"markdown-it-testgen\":\"^0.1.3\",\"mocha\":\"^6.1.4\",\"ndoc\":\"^5.0.0\",\"pug-cli\":\"^1.0.0-alpha6\",\"stylus\":\"^0.54.5\",\"supertest\":\"^4.0.2\",\"terser\":\"^4.1.2\"},\"files\":[\"index.js\",\"bin/\",\"lib/\",\"dist/\"],\"homepage\":\"https://github.com/markdown-it/markdown-it#readme\",\"keywords\":[\"markdown\",\"parser\",\"commonmark\",\"markdown-it\",\"markdown-it-plugin\"],\"license\":\"MIT\",\"main\":\"index.js\",\"name\":\"markdown-it\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/markdown-it/markdown-it.git\"},\"scripts\":{\"test\":\"make test\"},\"version\":\"10.0.0\"}"); - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } +/***/ }), - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; +/***/ 81195: +/***/ ((module) => { - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } +"use strict"; +module.exports = JSON.parse("{\"_from\":\"@asyncapi/generator-filters@^1.1.0\",\"_id\":\"@asyncapi/generator-filters@1.1.0\",\"_inBundle\":false,\"_integrity\":\"sha512-04Z2mMi3iv1jl7RZ1U5DX+Ruet5BOHLzEMSsl0vnYx2UZCM0AIlMvS6ph5JHv2AhBTD65a4Lfnsdr8qz0ybW+g==\",\"_location\":\"/@asyncapi/generator-filters\",\"_phantomChildren\":{\"argparse\":\"1.0.10\",\"entities\":\"2.0.3\",\"linkify-it\":\"2.2.0\",\"mdurl\":\"1.0.1\",\"uc.micro\":\"1.0.6\"},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"@asyncapi/generator-filters@^1.1.0\",\"name\":\"@asyncapi/generator-filters\",\"escapedName\":\"@asyncapi%2fgenerator-filters\",\"scope\":\"@asyncapi\",\"rawSpec\":\"^1.1.0\",\"saveSpec\":null,\"fetchSpec\":\"^1.1.0\"},\"_requiredBy\":[\"/@asyncapi/markdown-template\"],\"_resolved\":\"https://registry.npmjs.org/@asyncapi/generator-filters/-/generator-filters-1.1.0.tgz\",\"_shasum\":\"d6869fc1468a1d4ea3f7f20d463e7283e4aaa13c\",\"_spec\":\"@asyncapi/generator-filters@^1.1.0\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/@asyncapi/markdown-template\",\"author\":{\"name\":\"Lukasz Gornicki\",\"email\":\"lpgornicki@gmail.com\"},\"ava\":{\"files\":[\"./src/*.test.js\"]},\"bugs\":{\"url\":\"https://github.com/asyncapi/generator-filters/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"lodash\":\"^4.17.15\",\"markdown-it\":\"^10.0.0\",\"openapi-sampler\":\"1.0.0-beta.17\"},\"deprecated\":false,\"description\":\"Library with Nunjucks filters for templates using AsyncAPI Generator\",\"devDependencies\":{\"@semantic-release/commit-analyzer\":\"^8.0.1\",\"@semantic-release/github\":\"^7.0.4\",\"@semantic-release/npm\":\"^7.0.3\",\"@semantic-release/release-notes-generator\":\"^9.0.1\",\"ava\":\"^3.7.0\",\"conventional-changelog-conventionalcommits\":\"^4.2.3\",\"eslint\":\"^6.8.0\",\"eslint-plugin-sonarjs\":\"^0.5.0\",\"jsdoc-to-markdown\":\"^5.0.3\",\"semantic-release\":\"^17.0.4\"},\"homepage\":\"https://github.com/asyncapi/generator-filters#readme\",\"keywords\":[\"asyncapi\",\"generator\",\"nunjucks\"],\"license\":\"Apache-2.0\",\"main\":\"src/index.js\",\"name\":\"@asyncapi/generator-filters\",\"publishConfig\":{\"access\":\"public\"},\"release\":{\"branches\":[\"master\"],\"plugins\":[[\"@semantic-release/commit-analyzer\",{\"preset\":\"conventionalcommits\"}],[\"@semantic-release/release-notes-generator\",{\"preset\":\"conventionalcommits\"}],\"@semantic-release/npm\",\"@semantic-release/github\"]},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/asyncapi/generator-filters.git\"},\"scripts\":{\"docs\":\"jsdoc2md src/customFilters.js > docs/api.md\",\"get-version\":\"echo $npm_package_version\",\"lint\":\"eslint --config .eslintrc .\",\"lint-fix\":\"eslint --fix --config .eslintrc .\",\"release\":\"semantic-release\",\"test\":\"ava\"},\"version\":\"1.1.0\"}"); - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } +/***/ }), - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } +/***/ 65035: +/***/ ((module) => { - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; +"use strict"; +module.exports = JSON.parse("{\"_from\":\"@asyncapi/markdown-template@0.10.0\",\"_id\":\"@asyncapi/markdown-template@0.10.0\",\"_inBundle\":false,\"_integrity\":\"sha512-B7DUJ3R3Z0R47g2A4uj+K/xrXSNPhZnGTYMb5xxZCx+qniti2Sad8nWSuCA2xB7O3BCZiotbN9PZGCs/tIz7Rw==\",\"_location\":\"/@asyncapi/markdown-template\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"@asyncapi/markdown-template@0.10.0\",\"name\":\"@asyncapi/markdown-template\",\"escapedName\":\"@asyncapi%2fmarkdown-template\",\"scope\":\"@asyncapi\",\"rawSpec\":\"0.10.0\",\"saveSpec\":null,\"fetchSpec\":\"0.10.0\"},\"_requiredBy\":[\"#USER\"],\"_resolved\":\"https://registry.npmjs.org/@asyncapi/markdown-template/-/markdown-template-0.10.0.tgz\",\"_shasum\":\"7c61f61b01daa68331e695547af6373d67b53baa\",\"_spec\":\"@asyncapi/markdown-template@0.10.0\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator\",\"author\":{\"name\":\"Fran Mendez\",\"email\":\"fmvilas@gmail.com\",\"url\":\"fmvilas.com\"},\"bugs\":{\"url\":\"https://github.com/asyncapi/markdown-template/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"@asyncapi/generator-filters\":\"^1.1.0\"},\"deprecated\":false,\"description\":\"Markdown template for the AsyncAPI generator.\",\"devDependencies\":{\"@semantic-release/commit-analyzer\":\"^8.0.1\",\"@semantic-release/github\":\"^7.0.4\",\"@semantic-release/npm\":\"^7.0.3\",\"@semantic-release/release-notes-generator\":\"^9.0.1\",\"conventional-changelog-conventionalcommits\":\"^4.2.3\",\"semantic-release\":\"^17.0.4\"},\"generator\":{\"generator\":\">=0.50.0 <2.0.0\",\"filters\":[\"@asyncapi/generator-filters\"],\"parameters\":{\"outFilename\":{\"description\":\"The name of the output markdown file\",\"default\":\"asyncapi.md\",\"required\":false}}},\"homepage\":\"https://github.com/asyncapi/markdown-template#readme\",\"keywords\":[\"asyncapi\",\"generator\",\"markdown\",\"template\"],\"license\":\"Apache-2.0\",\"name\":\"@asyncapi/markdown-template\",\"publishConfig\":{\"access\":\"public\"},\"release\":{\"branches\":[\"master\"],\"plugins\":[[\"@semantic-release/commit-analyzer\",{\"preset\":\"conventionalcommits\"}],[\"@semantic-release/release-notes-generator\",{\"preset\":\"conventionalcommits\"}],\"@semantic-release/npm\",\"@semantic-release/github\"]},\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/asyncapi/markdown-template.git\"},\"scripts\":{\"dev\":\"ag test/spec/asyncapi.yml ./ -o test/output --force-write --watch-template\",\"get-version\":\"echo $npm_package_version\",\"release\":\"semantic-release\",\"test\":\"echo \\\"No test specified yet\\\"\"},\"version\":\"0.10.0\"}"); - if (returnState) { - matcher.state = state; - } +/***/ }), - return matcher; -}; +/***/ 30313: +/***/ ((module) => { -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ +"use strict"; +module.exports = JSON.parse("{\"_from\":\"argparse@^1.0.7\",\"_id\":\"argparse@1.0.10\",\"_inBundle\":false,\"_integrity\":\"sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==\",\"_location\":\"/argparse\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"argparse@^1.0.7\",\"name\":\"argparse\",\"escapedName\":\"argparse\",\"rawSpec\":\"^1.0.7\",\"saveSpec\":null,\"fetchSpec\":\"^1.0.7\"},\"_requiredBy\":[\"/@asyncapi/generator-filters/markdown-it\"],\"_resolved\":\"https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz\",\"_shasum\":\"bcd6791ea5ae09725e17e5ad988134cd40b3d911\",\"_spec\":\"argparse@^1.0.7\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/@asyncapi/generator-filters/node_modules/markdown-it\",\"bugs\":{\"url\":\"https://github.com/nodeca/argparse/issues\"},\"bundleDependencies\":false,\"contributors\":[{\"name\":\"Eugene Shkuropat\"},{\"name\":\"Paul Jacobson\"}],\"dependencies\":{\"sprintf-js\":\"~1.0.2\"},\"deprecated\":false,\"description\":\"Very powerful CLI arguments parser. Native port of argparse - python's options parsing library\",\"devDependencies\":{\"eslint\":\"^2.13.1\",\"istanbul\":\"^0.4.5\",\"mocha\":\"^3.1.0\",\"ndoc\":\"^5.0.1\"},\"files\":[\"index.js\",\"lib/\"],\"homepage\":\"https://github.com/nodeca/argparse#readme\",\"keywords\":[\"cli\",\"parser\",\"argparse\",\"option\",\"args\"],\"license\":\"MIT\",\"name\":\"argparse\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/nodeca/argparse.git\"},\"scripts\":{\"test\":\"make test\"},\"version\":\"1.0.10\"}"); -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } +/***/ }), - if (input === '') { - return { isMatch: false, output: '' }; - } +/***/ 50274: +/***/ ((module) => { - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; +"use strict"; +module.exports = JSON.parse("{\"_from\":\"commander@^6.1.0\",\"_id\":\"commander@6.2.0\",\"_inBundle\":false,\"_integrity\":\"sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==\",\"_location\":\"/@asyncapi/generator/commander\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"commander@^6.1.0\",\"name\":\"commander\",\"escapedName\":\"commander\",\"rawSpec\":\"^6.1.0\",\"saveSpec\":null,\"fetchSpec\":\"^6.1.0\"},\"_requiredBy\":[\"/@asyncapi/generator\"],\"_resolved\":\"https://registry.npmjs.org/commander/-/commander-6.2.0.tgz\",\"_shasum\":\"b990bfb8ac030aedc6d11bc04d1488ffef56db75\",\"_spec\":\"commander@^6.1.0\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator\",\"author\":{\"name\":\"TJ Holowaychuk\",\"email\":\"tj@vision-media.ca\"},\"bugs\":{\"url\":\"https://github.com/tj/commander.js/issues\"},\"bundleDependencies\":false,\"dependencies\":{},\"deprecated\":false,\"description\":\"the complete solution for node.js command-line programs\",\"devDependencies\":{\"@types/jest\":\"^26.0.15\",\"@types/node\":\"^14.14.2\",\"@typescript-eslint/eslint-plugin\":\"^4.5.0\",\"eslint\":\"^7.11.0\",\"eslint-config-standard-with-typescript\":\"^19.0.1\",\"eslint-plugin-jest\":\"^24.1.0\",\"jest\":\"^26.6.0\",\"standard\":\"^15.0.0\",\"typescript\":\"^4.0.3\"},\"engines\":{\"node\":\">= 6\"},\"files\":[\"index.js\",\"typings/index.d.ts\"],\"homepage\":\"https://github.com/tj/commander.js#readme\",\"jest\":{\"collectCoverage\":true},\"keywords\":[\"commander\",\"command\",\"option\",\"parser\",\"cli\",\"argument\",\"args\",\"argv\"],\"license\":\"MIT\",\"main\":\"index\",\"name\":\"commander\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/tj/commander.js.git\"},\"scripts\":{\"lint\":\"eslint index.js \\\"tests/**/*.js\\\"\",\"test\":\"jest && npm run test-typings\",\"test-typings\":\"tsc -p tsconfig.json\",\"typescript-lint\":\"eslint typings/*.ts\"},\"typings\":\"typings/index.d.ts\",\"version\":\"6.2.0\"}"); - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } +/***/ }), - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } +/***/ 99589: +/***/ ((module) => { - return { isMatch: Boolean(match), match, output }; -}; +"use strict"; +module.exports = JSON.parse("{\"_from\":\"entities@~2.0.0\",\"_id\":\"entities@2.0.3\",\"_inBundle\":false,\"_integrity\":\"sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ==\",\"_location\":\"/entities\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"entities@~2.0.0\",\"name\":\"entities\",\"escapedName\":\"entities\",\"rawSpec\":\"~2.0.0\",\"saveSpec\":null,\"fetchSpec\":\"~2.0.0\"},\"_requiredBy\":[\"/@asyncapi/generator-filters/markdown-it\"],\"_resolved\":\"https://registry.npmjs.org/entities/-/entities-2.0.3.tgz\",\"_shasum\":\"5c487e5742ab93c15abb5da22759b8590ec03b7f\",\"_spec\":\"entities@~2.0.0\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/@asyncapi/generator-filters/node_modules/markdown-it\",\"author\":{\"name\":\"Felix Boehm\",\"email\":\"me@feedic.com\"},\"bugs\":{\"url\":\"https://github.com/fb55/entities/issues\"},\"bundleDependencies\":false,\"deprecated\":false,\"description\":\"Encode & decode XML and HTML entities with ease\",\"devDependencies\":{\"@types/jest\":\"^25.1.4\",\"@types/node\":\"^14.0.6\",\"@typescript-eslint/eslint-plugin\":\"^2.31.0\",\"@typescript-eslint/parser\":\"^2.31.0\",\"coveralls\":\"*\",\"eslint\":\"^7.0.0\",\"eslint-config-prettier\":\"^6.0.0\",\"jest\":\"^26.0.1\",\"prettier\":\"^2.0.5\",\"ts-jest\":\"^26.1.0\",\"typescript\":\"^3.5.3\"},\"directories\":{\"lib\":\"lib/\"},\"files\":[\"lib/**/*\"],\"homepage\":\"https://github.com/fb55/entities#readme\",\"jest\":{\"preset\":\"ts-jest\",\"testEnvironment\":\"node\"},\"keywords\":[\"entity\",\"decoding\",\"encoding\",\"html\",\"xml\",\"html entities\"],\"license\":\"BSD-2-Clause\",\"main\":\"lib/index.js\",\"name\":\"entities\",\"prettier\":{\"tabWidth\":4},\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/fb55/entities.git\"},\"scripts\":{\"build\":\"tsc\",\"coverage\":\"cat coverage/lcov.info | coveralls\",\"format\":\"prettier --write **/*.{ts,md}\",\"lint\":\"eslint --ext=js,ts src\",\"prepare\":\"npm run build\",\"test\":\"jest --coverage && npm run lint\"},\"sideEffects\":false,\"types\":\"lib/index.d.ts\",\"version\":\"2.0.3\"}"); -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ +/***/ }), -picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(path.basename(input)); -}; +/***/ 99945: +/***/ ((module) => { -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ +"use strict"; +module.exports = JSON.parse("{\"_from\":\"foreach@^2.0.4\",\"_id\":\"foreach@2.0.5\",\"_inBundle\":false,\"_integrity\":\"sha1-C+4AUBiusmDQo6865ljdATbsG5k=\",\"_location\":\"/foreach\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"foreach@^2.0.4\",\"name\":\"foreach\",\"escapedName\":\"foreach\",\"rawSpec\":\"^2.0.4\",\"saveSpec\":null,\"fetchSpec\":\"^2.0.4\"},\"_requiredBy\":[\"/json-pointer\"],\"_resolved\":\"https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz\",\"_shasum\":\"0bee005018aeb260d0a3af3ae658dd0136ec1b99\",\"_spec\":\"foreach@^2.0.4\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/json-pointer\",\"author\":{\"name\":\"Manuel Stofer\",\"email\":\"manuel@takimata.ch\"},\"bugs\":{\"url\":\"https://github.com/manuelstofer/foreach/issues\"},\"bundleDependencies\":false,\"contributors\":[{\"name\":\"Manuel Stofer\"},{\"name\":\"Jordan Harband\",\"url\":\"https://github.com/ljharb\"}],\"dependencies\":{},\"deprecated\":false,\"description\":\"foreach component + npm package\",\"devDependencies\":{\"covert\":\"*\",\"tape\":\"*\"},\"homepage\":\"https://github.com/manuelstofer/foreach#readme\",\"keywords\":[\"shim\",\"Array.prototype.forEach\",\"forEach\",\"Array#forEach\",\"each\"],\"license\":\"MIT\",\"main\":\"index.js\",\"name\":\"foreach\",\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/manuelstofer/foreach.git\"},\"scripts\":{\"coverage\":\"covert test.js\",\"coverage-quiet\":\"covert --quiet test.js\",\"test\":\"node test.js\"},\"testling\":{\"files\":\"test.js\",\"browsers\":[\"iexplore/6.0..latest\",\"firefox/3.0\",\"firefox/15.0..latest\",\"firefox/nightly\",\"chrome/4.0\",\"chrome/22.0..latest\",\"chrome/canary\",\"opera/10.0..latest\",\"opera/next\",\"safari/5.0.5..latest\",\"ipad/6.0..latest\",\"iphone/6.0..latest\",\"android-browser/4.2\"]},\"version\":\"2.0.5\"}"); -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); +/***/ }), -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ +/***/ 46587: +/***/ ((module) => { -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; +"use strict"; +module.exports = JSON.parse("{\"_from\":\"json-pointer@^0.6.0\",\"_id\":\"json-pointer@0.6.1\",\"_inBundle\":false,\"_integrity\":\"sha512-3OvjqKdCBvH41DLpV4iSt6v2XhZXV1bPB4OROuknvUXI7ZQNofieCPkmE26stEJ9zdQuvIxDHCuYhfgxFAAs+Q==\",\"_location\":\"/json-pointer\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"json-pointer@^0.6.0\",\"name\":\"json-pointer\",\"escapedName\":\"json-pointer\",\"rawSpec\":\"^0.6.0\",\"saveSpec\":null,\"fetchSpec\":\"^0.6.0\"},\"_requiredBy\":[\"/openapi-sampler\"],\"_resolved\":\"https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.1.tgz\",\"_shasum\":\"3c6caa6ac139e2599f5a1659d39852154015054d\",\"_spec\":\"json-pointer@^0.6.0\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/openapi-sampler\",\"author\":{\"name\":\"Manuel Stofer\",\"email\":\"manuel@smallpdf.com\"},\"bugs\":{\"url\":\"https://github.com/manuelstofer/json-pointer/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"foreach\":\"^2.0.4\"},\"deprecated\":false,\"description\":\"Some utilities for JSON pointers described by RFC 6901\",\"devDependencies\":{\"chai\":\"^1.9.1\",\"coveralls\":\"^2.11.14\",\"mocha\":\"^1.9.0\",\"nyc\":\"^8.3.1\",\"seamless-immutable\":\"^5.1.1\"},\"homepage\":\"https://github.com/manuelstofer/json-pointer\",\"license\":\"MIT\",\"name\":\"json-pointer\",\"nyc\":{\"exclude\":[\"test\",\"node_modules\"],\"reporter\":[\"lcov\",\"text-summary\"]},\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/manuelstofer/json-pointer.git\"},\"scripts\":{\"test\":\"nyc make test\"},\"version\":\"0.6.1\"}"); -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ +/***/ }), -picomatch.scan = (input, options) => scan(input, options); +/***/ 6016: +/***/ ((module) => { -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ +"use strict"; +module.exports = JSON.parse("{\"_from\":\"linkify-it@^2.0.0\",\"_id\":\"linkify-it@2.2.0\",\"_inBundle\":false,\"_integrity\":\"sha512-GnAl/knGn+i1U/wjBz3akz2stz+HrHLsxMwHQGofCDfPvlf+gDKN58UtfmUquTY4/MXeE2x7k19KQmeoZi94Iw==\",\"_location\":\"/linkify-it\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"linkify-it@^2.0.0\",\"name\":\"linkify-it\",\"escapedName\":\"linkify-it\",\"rawSpec\":\"^2.0.0\",\"saveSpec\":null,\"fetchSpec\":\"^2.0.0\"},\"_requiredBy\":[\"/@asyncapi/generator-filters/markdown-it\"],\"_resolved\":\"https://registry.npmjs.org/linkify-it/-/linkify-it-2.2.0.tgz\",\"_shasum\":\"e3b54697e78bf915c70a38acd78fd09e0058b1cf\",\"_spec\":\"linkify-it@^2.0.0\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/@asyncapi/generator-filters/node_modules/markdown-it\",\"bugs\":{\"url\":\"https://github.com/markdown-it/linkify-it/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"uc.micro\":\"^1.0.1\"},\"deprecated\":false,\"description\":\"Links recognition library with FULL unicode support\",\"devDependencies\":{\"ansi\":\"^0.3.0\",\"autoprefixer-stylus\":\"^0.14.0\",\"benchmark\":\"^2.1.0\",\"browserify\":\"^16.2.3\",\"chai\":\"^4.2.0\",\"coveralls\":\"^3.0.2\",\"eslint\":\"^5.9.0\",\"istanbul\":\"^0.4.5\",\"jade\":\"^1.11.0\",\"mdurl\":\"^1.0.0\",\"mocha\":\"^5.2.0\",\"ndoc\":\"^5.0.1\",\"stylus\":\"~0.54.5\",\"tlds\":\"^1.166.0\"},\"files\":[\"index.js\",\"lib/\"],\"homepage\":\"https://github.com/markdown-it/linkify-it#readme\",\"keywords\":[\"linkify\",\"linkifier\",\"autolink\",\"autolinker\"],\"license\":\"MIT\",\"name\":\"linkify-it\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/markdown-it/linkify-it.git\"},\"scripts\":{\"test\":\"make test\"},\"version\":\"2.2.0\"}"); -picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return parsed.output; - } +/***/ }), - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; +/***/ 77234: +/***/ ((module) => { - let source = `${prepend}(?:${parsed.output})${append}`; - if (parsed && parsed.negated === true) { - source = `^(?!${source}).*$`; - } +"use strict"; +module.exports = JSON.parse("{\"_from\":\"lodash@^4.17.15\",\"_id\":\"lodash@4.17.20\",\"_inBundle\":false,\"_integrity\":\"sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==\",\"_location\":\"/lodash\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"lodash@^4.17.15\",\"name\":\"lodash\",\"escapedName\":\"lodash\",\"rawSpec\":\"^4.17.15\",\"saveSpec\":null,\"fetchSpec\":\"^4.17.15\"},\"_requiredBy\":[\"/@asyncapi/generator-filters\"],\"_resolved\":\"https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz\",\"_shasum\":\"b44a9b6297bcb698f1c51a3545a2b3b368d59c52\",\"_spec\":\"lodash@^4.17.15\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/@asyncapi/generator-filters\",\"author\":{\"name\":\"John-David Dalton\",\"email\":\"john.david.dalton@gmail.com\"},\"bugs\":{\"url\":\"https://github.com/lodash/lodash/issues\"},\"bundleDependencies\":false,\"contributors\":[{\"name\":\"John-David Dalton\",\"email\":\"john.david.dalton@gmail.com\"},{\"name\":\"Mathias Bynens\",\"email\":\"mathias@qiwi.be\"}],\"deprecated\":false,\"description\":\"Lodash modular utilities.\",\"homepage\":\"https://lodash.com/\",\"icon\":\"https://lodash.com/icon.svg\",\"keywords\":[\"modules\",\"stdlib\",\"util\"],\"license\":\"MIT\",\"main\":\"lodash.js\",\"name\":\"lodash\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/lodash/lodash.git\"},\"scripts\":{\"test\":\"echo \\\"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\\\"\"},\"version\":\"4.17.20\"}"); - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = parsed; - } +/***/ }), - return regex; -}; +/***/ 42896: +/***/ ((module) => { -picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } +"use strict"; +module.exports = JSON.parse("{\"_from\":\"mdurl@^1.0.1\",\"_id\":\"mdurl@1.0.1\",\"_inBundle\":false,\"_integrity\":\"sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=\",\"_location\":\"/mdurl\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"mdurl@^1.0.1\",\"name\":\"mdurl\",\"escapedName\":\"mdurl\",\"rawSpec\":\"^1.0.1\",\"saveSpec\":null,\"fetchSpec\":\"^1.0.1\"},\"_requiredBy\":[\"/@asyncapi/generator-filters/markdown-it\"],\"_resolved\":\"https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz\",\"_shasum\":\"fe85b2ec75a59037f2adfec100fd6c601761152e\",\"_spec\":\"mdurl@^1.0.1\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/@asyncapi/generator-filters/node_modules/markdown-it\",\"bugs\":{\"url\":\"https://github.com/markdown-it/mdurl/issues\"},\"bundleDependencies\":false,\"deprecated\":false,\"description\":\"URL utilities for markdown-it\",\"devDependencies\":{\"eslint\":\"0.13.0\",\"eslint-plugin-nodeca\":\"^1.0.0\",\"istanbul\":\"*\",\"mocha\":\"*\"},\"homepage\":\"https://github.com/markdown-it/mdurl#readme\",\"license\":\"MIT\",\"name\":\"mdurl\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/markdown-it/mdurl.git\"},\"scripts\":{\"test\":\"make test\"},\"version\":\"1.0.1\"}"); - const opts = options || {}; - let parsed = { negated: false, fastpaths: true }; - let prefix = ''; - let output; +/***/ }), - if (input.startsWith('./')) { - input = input.slice(2); - prefix = parsed.prefix = './'; - } +/***/ 10525: +/***/ ((module) => { - if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - output = parse.fastpaths(input, options); - } +"use strict"; +module.exports = JSON.parse("{\"_from\":\"openapi-sampler@1.0.0-beta.17\",\"_id\":\"openapi-sampler@1.0.0-beta.17\",\"_inBundle\":false,\"_integrity\":\"sha512-xYGPaPaEQFFAGQVrRpunkb8loNfL1rq4fJ+q7NH+LVBsrHKGUicD2f5Rzw6fWcRwwcOvnKD/aik9guiNWq2kpA==\",\"_location\":\"/openapi-sampler\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"openapi-sampler@1.0.0-beta.17\",\"name\":\"openapi-sampler\",\"escapedName\":\"openapi-sampler\",\"rawSpec\":\"1.0.0-beta.17\",\"saveSpec\":null,\"fetchSpec\":\"1.0.0-beta.17\"},\"_requiredBy\":[\"/@asyncapi/generator-filters\"],\"_resolved\":\"https://registry.npmjs.org/openapi-sampler/-/openapi-sampler-1.0.0-beta.17.tgz\",\"_shasum\":\"45814ed929d8b5af1b71e5d545a0134c70346daa\",\"_spec\":\"openapi-sampler@1.0.0-beta.17\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/@asyncapi/generator-filters\",\"author\":{\"name\":\"Roman Hotsiy\",\"email\":\"gotsijroman@gmail.com\"},\"browserslist\":\"> 0.25%, not dead\",\"bugs\":{\"url\":\"https://github.com/APIs-guru/openapi-sampler/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"json-pointer\":\"^0.6.0\"},\"deprecated\":false,\"description\":\"Tool for generation samples based on OpenAPI payload/response schema\",\"devDependencies\":{\"@babel/core\":\"^7.7.2\",\"@babel/preset-env\":\"^7.7.1\",\"@babel/register\":\"^7.7.0\",\"babel-eslint\":\"^10.0.3\",\"babel-loader\":\"^8.0.6\",\"babel-plugin-istanbul\":\"^5.2.0\",\"babelify\":\"^10.0.0\",\"browserify\":\"^16.5.0\",\"browserify-istanbul\":\"^3.0.1\",\"chai\":\"^4.2.0\",\"core-js\":\"^3.4.1\",\"coveralls\":\"^3.0.7\",\"del\":\"^5.1.0\",\"glob\":\"^7.1.6\",\"gulp\":\"^4.0.2\",\"gulp-eslint\":\"^6.0.0\",\"gulp-filter\":\"^6.0.0\",\"gulp-istanbul\":\"^1.1.3\",\"gulp-livereload\":\"^4.0.2\",\"gulp-load-plugins\":\"^2.0.1\",\"gulp-mocha\":\"^7.0.2\",\"gulp-plumber\":\"^1.2.1\",\"gulp-rename\":\"^1.4.0\",\"gulp-sourcemaps\":\"^2.6.5\",\"gulp-uglify\":\"^3.0.2\",\"json-loader\":\"^0.5.7\",\"karma\":\"^4.4.1\",\"karma-babel-preprocessor\":\"^8.0.1\",\"karma-browserify\":\"^6.1.0\",\"karma-chrome-launcher\":\"^3.1.0\",\"karma-coverage\":\"^2.0.1\",\"karma-firefox-launcher\":\"^1.2.0\",\"karma-mocha\":\"^1.3.0\",\"karma-mocha-reporter\":\"^2.2.5\",\"karma-phantomjs-launcher\":\"^1.0.4\",\"karma-sinon-chai\":\"^2.0.2\",\"lolex\":\"^5.1.1\",\"mocha\":\"^6.2.2\",\"phantomjs-prebuilt\":\"^2.1.16\",\"sinon\":\"^7.5.0\",\"sinon-chai\":\"^3.3.0\",\"vinyl-buffer\":\"^1.0.1\",\"vinyl-source-stream\":\"^2.0.0\"},\"homepage\":\"https://github.com/APIs-guru/openapi-sampler/\",\"keywords\":[\"OpenAPI\",\"Swagger\",\"instantiator\",\"sampler\",\"faker\"],\"license\":\"MIT\",\"main\":\"dist/openapi-sampler.js\",\"module\":\"src/openapi-sampler.js\",\"name\":\"openapi-sampler\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/APIs-guru/openapi-sampler.git\"},\"scripts\":{\"build\":\"gulp build\",\"build-dist\":\"gulp build\",\"coverage\":\"gulp coverage\",\"lint\":\"gulp lint\",\"prepublish\":\"npm run build\",\"test\":\"gulp\",\"test-browser\":\"gulp test-browser\",\"watch\":\"gulp watch\"},\"version\":\"1.0.0-beta.17\"}"); - if (output === undefined) { - parsed = parse(input, options); - parsed.prefix = prefix + (parsed.prefix || ''); - } else { - parsed.output = output; - } +/***/ }), - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; +/***/ 9968: +/***/ ((module) => { -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ +"use strict"; +module.exports = JSON.parse("{\"_from\":\"semver@^7.3.2\",\"_id\":\"semver@7.3.2\",\"_inBundle\":false,\"_integrity\":\"sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==\",\"_location\":\"/@asyncapi/generator/semver\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"semver@^7.3.2\",\"name\":\"semver\",\"escapedName\":\"semver\",\"rawSpec\":\"^7.3.2\",\"saveSpec\":null,\"fetchSpec\":\"^7.3.2\"},\"_requiredBy\":[\"/@asyncapi/generator\"],\"_resolved\":\"https://registry.npmjs.org/semver/-/semver-7.3.2.tgz\",\"_shasum\":\"604962b052b81ed0786aae84389ffba70ffd3938\",\"_spec\":\"semver@^7.3.2\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator\",\"bin\":{\"semver\":\"bin/semver.js\"},\"bugs\":{\"url\":\"https://github.com/npm/node-semver/issues\"},\"bundleDependencies\":false,\"deprecated\":false,\"description\":\"The semantic version parser used by npm.\",\"devDependencies\":{\"tap\":\"^14.10.7\"},\"engines\":{\"node\":\">=10\"},\"files\":[\"bin/**/*.js\",\"range.bnf\",\"classes/**/*.js\",\"functions/**/*.js\",\"internal/**/*.js\",\"ranges/**/*.js\",\"index.js\",\"preload.js\"],\"homepage\":\"https://github.com/npm/node-semver#readme\",\"license\":\"ISC\",\"main\":\"index.js\",\"name\":\"semver\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/npm/node-semver.git\"},\"scripts\":{\"postpublish\":\"git push origin --follow-tags\",\"postversion\":\"npm publish\",\"preversion\":\"npm test\",\"snap\":\"tap\",\"test\":\"tap\"},\"tap\":{\"check-coverage\":true,\"coverage-map\":\"map.js\"},\"version\":\"7.3.2\"}"); -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; +/***/ }), -/** - * Picomatch constants. - * @return {Object} - */ +/***/ 87475: +/***/ ((module) => { -picomatch.constants = constants; +"use strict"; +module.exports = JSON.parse("{\"_from\":\"sprintf-js@~1.0.2\",\"_id\":\"sprintf-js@1.0.3\",\"_inBundle\":false,\"_integrity\":\"sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=\",\"_location\":\"/sprintf-js\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"sprintf-js@~1.0.2\",\"name\":\"sprintf-js\",\"escapedName\":\"sprintf-js\",\"rawSpec\":\"~1.0.2\",\"saveSpec\":null,\"fetchSpec\":\"~1.0.2\"},\"_requiredBy\":[\"/argparse\"],\"_resolved\":\"https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz\",\"_shasum\":\"04e6926f662895354f3dd015203633b857297e2c\",\"_spec\":\"sprintf-js@~1.0.2\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/argparse\",\"author\":{\"name\":\"Alexandru Marasteanu\",\"email\":\"hello@alexei.ro\",\"url\":\"http://alexei.ro/\"},\"bugs\":{\"url\":\"https://github.com/alexei/sprintf.js/issues\"},\"bundleDependencies\":false,\"deprecated\":false,\"description\":\"JavaScript sprintf implementation\",\"devDependencies\":{\"grunt\":\"*\",\"grunt-contrib-uglify\":\"*\",\"grunt-contrib-watch\":\"*\",\"mocha\":\"*\"},\"homepage\":\"https://github.com/alexei/sprintf.js#readme\",\"license\":\"BSD-3-Clause\",\"main\":\"src/sprintf.js\",\"name\":\"sprintf-js\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/alexei/sprintf.js.git\"},\"scripts\":{\"test\":\"mocha test/test.js\"},\"version\":\"1.0.3\"}"); -/** - * Expose "picomatch" - */ +/***/ }), -module.exports = picomatch; +/***/ 19909: +/***/ ((module) => { +"use strict"; +module.exports = JSON.parse("{\"_from\":\"uc.micro@^1.0.5\",\"_id\":\"uc.micro@1.0.6\",\"_inBundle\":false,\"_integrity\":\"sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==\",\"_location\":\"/uc.micro\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"range\",\"registry\":true,\"raw\":\"uc.micro@^1.0.5\",\"name\":\"uc.micro\",\"escapedName\":\"uc.micro\",\"rawSpec\":\"^1.0.5\",\"saveSpec\":null,\"fetchSpec\":\"^1.0.5\"},\"_requiredBy\":[\"/@asyncapi/generator-filters/markdown-it\",\"/linkify-it\"],\"_resolved\":\"https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz\",\"_shasum\":\"9c411a802a409a91fc6cf74081baba34b24499ac\",\"_spec\":\"uc.micro@^1.0.5\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator/node_modules/@asyncapi/generator/node_modules/@asyncapi/generator-filters/node_modules/markdown-it\",\"bugs\":{\"url\":\"https://github.com/markdown-it/uc.micro/issues\"},\"bundleDependencies\":false,\"deprecated\":false,\"description\":\"Micro subset of unicode data files for markdown-it projects.\",\"devDependencies\":{\"mocha\":\"^5.0.0\",\"shelljs\":\"^0.8.1\",\"unicode-11.0.0\":\"^0.7.8\"},\"files\":[\"categories/\",\"properties/\",\"index.js\"],\"homepage\":\"https://github.com/markdown-it/uc.micro#readme\",\"license\":\"MIT\",\"name\":\"uc.micro\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/markdown-it/uc.micro.git\"},\"scripts\":{\"test\":\"mocha\",\"update\":\"node update.js && npm test\"},\"version\":\"1.0.6\"}"); /***/ }), -/* 2 */, -/* 3 */, -/* 4 */ -/***/ (function(module) { -module.exports = require("child_process"); - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ 94532: +/***/ ((module) => { "use strict"; +module.exports = JSON.parse("{\"_from\":\"@asyncapi/generator@1.0.1\",\"_id\":\"@asyncapi/generator@1.0.1\",\"_inBundle\":false,\"_integrity\":\"sha512-vg2TvzQK9tT7gGzqI2W6kPv62rfi3Iht+yW//mYz+eWdHxCestlQD0iyUxFuS7K+jMor2kfvJEFaOzjRr/JSRg==\",\"_location\":\"/@asyncapi/generator\",\"_phantomChildren\":{},\"_requested\":{\"type\":\"version\",\"registry\":true,\"raw\":\"@asyncapi/generator@1.0.1\",\"name\":\"@asyncapi/generator\",\"escapedName\":\"@asyncapi%2fgenerator\",\"scope\":\"@asyncapi\",\"rawSpec\":\"1.0.1\",\"saveSpec\":null,\"fetchSpec\":\"1.0.1\"},\"_requiredBy\":[\"/\"],\"_resolved\":\"https://registry.npmjs.org/@asyncapi/generator/-/generator-1.0.1.tgz\",\"_shasum\":\"c314de4f60efede036c8f9ba118dc0775b7f601c\",\"_spec\":\"@asyncapi/generator@1.0.1\",\"_where\":\"/Users/wookiee/sources/github-action-for-generator\",\"author\":{\"name\":\"Fran Mendez\",\"email\":\"fmvilas@gmail.com\"},\"bin\":{\"asyncapi-generator\":\"cli.js\",\"ag\":\"cli.js\"},\"bugs\":{\"url\":\"https://github.com/asyncapi/generator/issues\"},\"bundleDependencies\":false,\"dependencies\":{\"@asyncapi/avro-schema-parser\":\"^0.2.0\",\"@asyncapi/openapi-schema-parser\":\"^2.0.0\",\"@asyncapi/parser\":\"^1.1.1\",\"@asyncapi/raml-dt-schema-parser\":\"^2.0.0\",\"ajv\":\"^6.10.2\",\"commander\":\"^6.1.0\",\"filenamify\":\"^4.1.0\",\"fs.extra\":\"^1.3.2\",\"jmespath\":\"^0.15.0\",\"js-yaml\":\"^3.13.1\",\"levenshtein-edit-distance\":\"^2.0.5\",\"loglevel\":\"^1.6.8\",\"markdown-it\":\"^8.4.1\",\"minimatch\":\"^3.0.4\",\"node-fetch\":\"^2.6.0\",\"npmi\":\"^4.0.0\",\"nunjucks\":\"^3.2.0\",\"semver\":\"^7.3.2\",\"simple-git\":\"^1.131.0\"},\"deprecated\":false,\"description\":\"The AsyncAPI generator. It can generate documentation, code, anything!\",\"devDependencies\":{\"@semantic-release/commit-analyzer\":\"^8.0.1\",\"@semantic-release/github\":\"^7.0.4\",\"@semantic-release/npm\":\"^7.0.6\",\"@semantic-release/release-notes-generator\":\"^9.0.1\",\"all-contributors-cli\":\"^6.14.2\",\"chokidar\":\"^3.4.0\",\"conventional-changelog-conventionalcommits\":\"^4.4.0\",\"eslint\":\"^6.8.0\",\"eslint-plugin-jest\":\"^23.8.2\",\"eslint-plugin-sonarjs\":\"^0.5.0\",\"jest\":\"^25.5.0\",\"jsdoc-to-markdown\":\"^5.0.0\",\"markdown-toc\":\"^1.2.0\",\"semantic-release\":\"^17.2.2\",\"semantic-release-slack-bot\":\"^1.5.0\"},\"engines\":{\"node\":\">12.16 <15\",\"npm\":\">6.13.7 <7\"},\"homepage\":\"https://github.com/asyncapi/generator\",\"keywords\":[\"asyncapi\",\"documentation\",\"generator\",\"markdown\"],\"license\":\"Apache-2.0\",\"main\":\"./lib/generator.js\",\"name\":\"@asyncapi/generator\",\"preferGlobal\":true,\"publishConfig\":{\"access\":\"public\"},\"release\":{\"branches\":[\"master\"],\"plugins\":[[\"@semantic-release/commit-analyzer\",{\"preset\":\"conventionalcommits\"}],[\"@semantic-release/release-notes-generator\",{\"preset\":\"conventionalcommits\"}],[\"semantic-release-slack-bot\",{\"notifyOnSuccess\":true,\"packageName\":\"https://github.com/asyncapi/generator\",\"markdownReleaseNotes\":true}],\"@semantic-release/npm\",\"@semantic-release/github\"]},\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/asyncapi/generator.git\"},\"scripts\":{\"docker-build\":\"docker build -t asyncapi/generator:latest .\",\"docs\":\"jsdoc2md lib/generator.js > docs/api.md\",\"gen-readme-toc\":\"markdown-toc -i README.md\",\"get-version\":\"echo $npm_package_version\",\"lint\":\"eslint --max-warnings 0 --config .eslintrc .\",\"lint-tpl-validator\":\"eslint --fix --config .eslintrc .github/templates-list-validator\",\"prepublishOnly\":\"npm run docs\",\"release\":\"semantic-release\",\"test\":\"jest --coverage\",\"test:dev\":\"jest --watchAll --coverage\"},\"version\":\"1.0.1\"}"); +/***/ }), -Object.defineProperty(exports, "__esModule", { value: true }); +/***/ 26727: +/***/ ((module) => { -const picomatch = __webpack_require__(827); -const normalizePath = __webpack_require__(861); +"use strict"; +module.exports = JSON.parse("{\"title\":\"AsyncAPI 1.0 schema.\",\"id\":\"http://asyncapi.hitchhq.com/v1/schema.json#\",\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"type\":\"object\",\"required\":[\"asyncapi\",\"info\",\"topics\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"asyncapi\":{\"type\":\"string\",\"enum\":[\"1.0.0\"],\"description\":\"The AsyncAPI specification version of this document.\"},\"info\":{\"$ref\":\"#/definitions/info\"},\"baseTopic\":{\"type\":\"string\",\"pattern\":\"^[^/.]\",\"description\":\"The base topic to the API. Example: 'hitch'.\",\"default\":\"\"},\"servers\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/server\"},\"uniqueItems\":true},\"topics\":{\"$ref\":\"#/definitions/topics\"},\"components\":{\"$ref\":\"#/definitions/components\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"security\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/SecurityRequirement\"}},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"definitions\":{\"Reference\":{\"type\":\"object\",\"required\":[\"$ref\"],\"properties\":{\"$ref\":{\"type\":\"string\",\"format\":\"uri\"}}},\"info\":{\"type\":\"object\",\"description\":\"General information about the API.\",\"required\":[\"version\",\"title\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"A unique and precise title of the API.\"},\"version\":{\"type\":\"string\",\"description\":\"A semantic version number of the API.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the API. Should be different from the title. CommonMark is allowed.\"},\"termsOfService\":{\"type\":\"string\",\"description\":\"A URL to the Terms of Service for the API. MUST be in the format of a URL.\",\"format\":\"uri\"},\"contact\":{\"$ref\":\"#/definitions/contact\"},\"license\":{\"$ref\":\"#/definitions/license\"}}},\"contact\":{\"type\":\"object\",\"description\":\"Contact information for the owners of the API.\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The identifying name of the contact person/organization.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the contact information.\",\"format\":\"uri\"},\"email\":{\"type\":\"string\",\"description\":\"The email address of the contact person/organization.\",\"format\":\"email\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"license\":{\"type\":\"object\",\"required\":[\"name\"],\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The name of the license type. It's encouraged to use an OSI compatible license.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the license.\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"server\":{\"type\":\"object\",\"description\":\"An object representing a Server.\",\"required\":[\"url\",\"scheme\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"url\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"scheme\":{\"type\":\"string\",\"description\":\"The transfer protocol.\",\"enum\":[\"kafka\",\"kafka-secure\",\"amqp\",\"amqps\",\"mqtt\",\"mqtts\",\"secure-mqtt\",\"ws\",\"wss\",\"stomp\",\"stomps\"]},\"schemeVersion\":{\"type\":\"string\"},\"variables\":{\"$ref\":\"#/definitions/serverVariables\"}}},\"serverVariables\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/serverVariable\"}},\"serverVariable\":{\"type\":\"object\",\"description\":\"An object representing a Server Variable for server URL template substitution.\",\"minProperties\":1,\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"enum\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true},\"default\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"}}},\"topics\":{\"type\":\"object\",\"description\":\"Relative paths to the individual topics. They must be relative to the 'baseTopic'.\",\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"},\"^[^.]\":{\"$ref\":\"#/definitions/topicItem\"}},\"additionalProperties\":false},\"components\":{\"type\":\"object\",\"description\":\"An object to hold a set of reusable objects for different aspects of the AsyncAPI Specification.\",\"additionalProperties\":false,\"properties\":{\"schemas\":{\"$ref\":\"#/definitions/schemas\"},\"messages\":{\"$ref\":\"#/definitions/messages\"},\"securitySchemes\":{\"type\":\"object\",\"patternProperties\":{\"^[a-zA-Z0-9\\\\.\\\\-_]+$\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/SecurityScheme\"}]}}}}},\"schemas\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"description\":\"JSON objects describing schemas the API uses.\"},\"messages\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/message\"},\"description\":\"JSON objects describing the messages being consumed and produced by the API.\"},\"schema\":{\"type\":\"object\",\"description\":\"A deterministic version of a JSON Schema object.\",\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"$ref\":{\"type\":\"string\"},\"format\":{\"type\":\"string\"},\"title\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/title\"},\"description\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/description\"},\"default\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/default\"},\"multipleOf\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/multipleOf\"},\"maximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/maximum\"},\"exclusiveMaximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum\"},\"minimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/minimum\"},\"exclusiveMinimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum\"},\"maxLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"pattern\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/pattern\"},\"maxItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"uniqueItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/uniqueItems\"},\"maxProperties\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minProperties\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"required\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/stringArray\"},\"enum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/enum\"},\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"boolean\"}],\"default\":{}},\"type\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/type\"},\"items\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}}],\"default\":{}},\"allOf\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"default\":{}},\"discriminator\":{\"type\":\"string\"},\"readOnly\":{\"type\":\"boolean\",\"default\":false},\"xml\":{\"$ref\":\"#/definitions/xml\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"example\":{}},\"additionalProperties\":false},\"xml\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\"},\"namespace\":{\"type\":\"string\"},\"prefix\":{\"type\":\"string\"},\"attribute\":{\"type\":\"boolean\",\"default\":false},\"wrapped\":{\"type\":\"boolean\",\"default\":false}}},\"externalDocs\":{\"type\":\"object\",\"additionalProperties\":false,\"description\":\"information about external documentation\",\"required\":[\"url\"],\"properties\":{\"description\":{\"type\":\"string\"},\"url\":{\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"topicItem\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"minProperties\":1,\"properties\":{\"$ref\":{\"type\":\"string\"},\"publish\":{\"$ref\":\"#/definitions/message\"},\"subscribe\":{\"$ref\":\"#/definitions/message\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false}}},\"message\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"$ref\":{\"type\":\"string\"},\"headers\":{\"$ref\":\"#/definitions/schema\"},\"payload\":{\"$ref\":\"#/definitions/schema\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"summary\":{\"type\":\"string\",\"description\":\"A brief summary of the message.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the message. CommonMark is allowed.\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"example\":{}}},\"vendorExtension\":{\"description\":\"Any property starting with x- is valid.\",\"additionalProperties\":true,\"additionalItems\":true},\"tag\":{\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\"],\"properties\":{\"name\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"SecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/userPassword\"},{\"$ref\":\"#/definitions/apiKey\"},{\"$ref\":\"#/definitions/X509\"},{\"$ref\":\"#/definitions/symmetricEncryption\"},{\"$ref\":\"#/definitions/asymmetricEncryption\"},{\"$ref\":\"#/definitions/HTTPSecurityScheme\"}]},\"userPassword\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"userPassword\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"apiKey\":{\"type\":\"object\",\"required\":[\"type\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"apiKey\"]},\"in\":{\"type\":\"string\",\"enum\":[\"user\",\"password\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"X509\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"X509\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"symmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"symmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"asymmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"asymmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"HTTPSecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/NonBearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/BearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/APIKeyHTTPSecurityScheme\"}]},\"NonBearerHTTPSecurityScheme\":{\"not\":{\"type\":\"object\",\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]}}},\"type\":\"object\",\"required\":[\"scheme\",\"type\"],\"properties\":{\"scheme\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"BearerHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"scheme\"],\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]},\"bearerFormat\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"APIKeyHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"name\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"httpApiKey\"]},\"name\":{\"type\":\"string\"},\"in\":{\"type\":\"string\",\"enum\":[\"header\",\"query\",\"cookie\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"SecurityRequirement\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"title\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/title\"},\"description\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/description\"},\"default\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/default\"},\"multipleOf\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/multipleOf\"},\"maximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/maximum\"},\"exclusiveMaximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum\"},\"minimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/minimum\"},\"exclusiveMinimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum\"},\"maxLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"pattern\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/pattern\"},\"maxItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"uniqueItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/uniqueItems\"},\"enum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/enum\"}}}"); -/** - * @typedef {(testString: string) => boolean} AnymatchFn - * @typedef {string|RegExp|AnymatchFn} AnymatchPattern - * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher - */ -const BANG = '!'; -const DEFAULT_OPTIONS = {returnIndex: false}; -const arrify = (item) => Array.isArray(item) ? item : [item]; +/***/ }), -/** - * @param {AnymatchPattern} matcher - * @param {object} options - * @returns {AnymatchFn} - */ -const createPattern = (matcher, options) => { - if (typeof matcher === 'function') { - return matcher; - } - if (typeof matcher === 'string') { - const glob = picomatch(matcher, options); - return (string) => matcher === string || glob(string); - } - if (matcher instanceof RegExp) { - return (string) => matcher.test(string); - } - return (string) => false; -}; +/***/ 56409: +/***/ ((module) => { -/** - * @param {Array} patterns - * @param {Array} negPatterns - * @param {String|Array} args - * @param {Boolean} returnIndex - * @returns {boolean|number} - */ -const matchPatterns = (patterns, negPatterns, args, returnIndex) => { - const isList = Array.isArray(args); - const _path = isList ? args[0] : args; - if (!isList && typeof _path !== 'string') { - throw new TypeError('anymatch: second argument must be a string: got ' + - Object.prototype.toString.call(_path)) - } - const path = normalizePath(_path); +"use strict"; +module.exports = JSON.parse("{\"title\":\"AsyncAPI 1.1.0 schema.\",\"id\":\"http://asyncapi.hitchhq.com/v1/schema.json#\",\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"type\":\"object\",\"required\":[\"asyncapi\",\"info\",\"topics\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"asyncapi\":{\"type\":\"string\",\"enum\":[\"1.0.0\",\"1.1.0\"],\"description\":\"The AsyncAPI specification version of this document.\"},\"info\":{\"$ref\":\"#/definitions/info\"},\"baseTopic\":{\"type\":\"string\",\"pattern\":\"^[^/.]\",\"description\":\"The base topic to the API. Example: 'hitch'.\",\"default\":\"\"},\"servers\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/server\"},\"uniqueItems\":true},\"topics\":{\"$ref\":\"#/definitions/topics\"},\"components\":{\"$ref\":\"#/definitions/components\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"security\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/SecurityRequirement\"}},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"definitions\":{\"Reference\":{\"type\":\"object\",\"required\":[\"$ref\"],\"properties\":{\"$ref\":{\"type\":\"string\",\"format\":\"uri\"}}},\"info\":{\"type\":\"object\",\"description\":\"General information about the API.\",\"required\":[\"version\",\"title\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"A unique and precise title of the API.\"},\"version\":{\"type\":\"string\",\"description\":\"A semantic version number of the API.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the API. Should be different from the title. CommonMark is allowed.\"},\"termsOfService\":{\"type\":\"string\",\"description\":\"A URL to the Terms of Service for the API. MUST be in the format of a URL.\",\"format\":\"uri\"},\"contact\":{\"$ref\":\"#/definitions/contact\"},\"license\":{\"$ref\":\"#/definitions/license\"}}},\"contact\":{\"type\":\"object\",\"description\":\"Contact information for the owners of the API.\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The identifying name of the contact person/organization.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the contact information.\",\"format\":\"uri\"},\"email\":{\"type\":\"string\",\"description\":\"The email address of the contact person/organization.\",\"format\":\"email\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"license\":{\"type\":\"object\",\"required\":[\"name\"],\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The name of the license type. It's encouraged to use an OSI compatible license.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the license.\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"server\":{\"type\":\"object\",\"description\":\"An object representing a Server.\",\"required\":[\"url\",\"scheme\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"url\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"scheme\":{\"type\":\"string\",\"description\":\"The transfer protocol.\",\"enum\":[\"kafka\",\"kafka-secure\",\"amqp\",\"amqps\",\"mqtt\",\"mqtts\",\"secure-mqtt\",\"ws\",\"wss\",\"stomp\",\"stomps\",\"jms\"]},\"schemeVersion\":{\"type\":\"string\"},\"variables\":{\"$ref\":\"#/definitions/serverVariables\"}}},\"serverVariables\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/serverVariable\"}},\"serverVariable\":{\"type\":\"object\",\"description\":\"An object representing a Server Variable for server URL template substitution.\",\"minProperties\":1,\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"enum\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true},\"default\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"}}},\"topics\":{\"type\":\"object\",\"description\":\"Relative paths to the individual topics. They must be relative to the 'baseTopic'.\",\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"},\"^[^.]\":{\"$ref\":\"#/definitions/topicItem\"}},\"additionalProperties\":false},\"components\":{\"type\":\"object\",\"description\":\"An object to hold a set of reusable objects for different aspects of the AsyncAPI Specification.\",\"additionalProperties\":false,\"properties\":{\"schemas\":{\"$ref\":\"#/definitions/schemas\"},\"messages\":{\"$ref\":\"#/definitions/messages\"},\"securitySchemes\":{\"type\":\"object\",\"patternProperties\":{\"^[a-zA-Z0-9\\\\.\\\\-_]+$\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/SecurityScheme\"}]}}}}},\"schemas\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"description\":\"JSON objects describing schemas the API uses.\"},\"messages\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/message\"},\"description\":\"JSON objects describing the messages being consumed and produced by the API.\"},\"schema\":{\"type\":\"object\",\"description\":\"A deterministic version of a JSON Schema object.\",\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"$ref\":{\"type\":\"string\"},\"format\":{\"type\":\"string\"},\"title\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/title\"},\"description\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/description\"},\"default\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/default\"},\"multipleOf\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/multipleOf\"},\"maximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/maximum\"},\"exclusiveMaximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum\"},\"minimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/minimum\"},\"exclusiveMinimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum\"},\"maxLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"pattern\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/pattern\"},\"maxItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"uniqueItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/uniqueItems\"},\"maxProperties\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minProperties\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"required\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/stringArray\"},\"enum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/enum\"},\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"boolean\"}],\"default\":{}},\"type\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/type\"},\"items\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}}],\"default\":{}},\"allOf\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"oneOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"anyOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"not\":{\"$ref\":\"#/definitions/schema\"},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"default\":{}},\"discriminator\":{\"type\":\"string\"},\"readOnly\":{\"type\":\"boolean\",\"default\":false},\"xml\":{\"$ref\":\"#/definitions/xml\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"example\":{}},\"additionalProperties\":false},\"xml\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\"},\"namespace\":{\"type\":\"string\"},\"prefix\":{\"type\":\"string\"},\"attribute\":{\"type\":\"boolean\",\"default\":false},\"wrapped\":{\"type\":\"boolean\",\"default\":false}}},\"externalDocs\":{\"type\":\"object\",\"additionalProperties\":false,\"description\":\"information about external documentation\",\"required\":[\"url\"],\"properties\":{\"description\":{\"type\":\"string\"},\"url\":{\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"topicItem\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"minProperties\":1,\"properties\":{\"$ref\":{\"type\":\"string\"},\"parameters\":{\"type\":\"array\",\"uniqueItems\":true,\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/parameter\"}},\"publish\":{\"$ref\":\"#/definitions/operation\"},\"subscribe\":{\"$ref\":\"#/definitions/operation\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false}}},\"parameter\":{\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"description\":{\"type\":\"string\",\"description\":\"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"},\"name\":{\"type\":\"string\",\"description\":\"The name of the parameter.\"},\"schema\":{\"$ref\":\"#/definitions/schema\"}}},\"operation\":{\"oneOf\":[{\"$ref\":\"#/definitions/message\"},{\"type\":\"object\",\"required\":[\"oneOf\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"oneOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/message\"}}}}]},\"message\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"$ref\":{\"type\":\"string\"},\"headers\":{\"$ref\":\"#/definitions/schema\"},\"payload\":{\"$ref\":\"#/definitions/schema\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"summary\":{\"type\":\"string\",\"description\":\"A brief summary of the message.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the message. CommonMark is allowed.\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"example\":{}}},\"vendorExtension\":{\"description\":\"Any property starting with x- is valid.\",\"additionalProperties\":true,\"additionalItems\":true},\"tag\":{\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\"],\"properties\":{\"name\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"SecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/userPassword\"},{\"$ref\":\"#/definitions/apiKey\"},{\"$ref\":\"#/definitions/X509\"},{\"$ref\":\"#/definitions/symmetricEncryption\"},{\"$ref\":\"#/definitions/asymmetricEncryption\"},{\"$ref\":\"#/definitions/HTTPSecurityScheme\"}]},\"userPassword\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"userPassword\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"apiKey\":{\"type\":\"object\",\"required\":[\"type\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"apiKey\"]},\"in\":{\"type\":\"string\",\"enum\":[\"user\",\"password\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"X509\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"X509\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"symmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"symmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"asymmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"asymmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"HTTPSecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/NonBearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/BearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/APIKeyHTTPSecurityScheme\"}]},\"NonBearerHTTPSecurityScheme\":{\"not\":{\"type\":\"object\",\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]}}},\"type\":\"object\",\"required\":[\"scheme\",\"type\"],\"properties\":{\"scheme\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"BearerHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"scheme\"],\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]},\"bearerFormat\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"APIKeyHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"name\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"httpApiKey\"]},\"name\":{\"type\":\"string\"},\"in\":{\"type\":\"string\",\"enum\":[\"header\",\"query\",\"cookie\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"SecurityRequirement\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"title\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/title\"},\"description\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/description\"},\"default\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/default\"},\"multipleOf\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/multipleOf\"},\"maximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/maximum\"},\"exclusiveMaximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum\"},\"minimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/minimum\"},\"exclusiveMinimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum\"},\"maxLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"pattern\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/pattern\"},\"maxItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"uniqueItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/uniqueItems\"},\"enum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/enum\"}}}"); - for (let index = 0; index < negPatterns.length; index++) { - const nglob = negPatterns[index]; - if (nglob(path)) { - return returnIndex ? -1 : false; - } - } +/***/ }), - const applied = isList && [path].concat(args.slice(1)); - for (let index = 0; index < patterns.length; index++) { - const pattern = patterns[index]; - if (isList ? pattern(...applied) : pattern(path)) { - return returnIndex ? index : true; - } - } +/***/ 14679: +/***/ ((module) => { - return returnIndex ? -1 : false; -}; +"use strict"; +module.exports = JSON.parse("{\"title\":\"AsyncAPI 1.2.0 schema.\",\"id\":\"http://asyncapi.hitchhq.com/v1/schema.json#\",\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"type\":\"object\",\"required\":[\"asyncapi\",\"info\"],\"oneOf\":[{\"required\":[\"topics\"]},{\"required\":[\"stream\"]},{\"required\":[\"events\"]}],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"asyncapi\":{\"type\":\"string\",\"enum\":[\"1.0.0\",\"1.1.0\",\"1.2.0\"],\"description\":\"The AsyncAPI specification version of this document.\"},\"info\":{\"$ref\":\"#/definitions/info\"},\"baseTopic\":{\"type\":\"string\",\"pattern\":\"^[^/.]\",\"description\":\"The base topic to the API. Example: 'hitch'.\",\"default\":\"\"},\"servers\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/server\"},\"uniqueItems\":true},\"topics\":{\"$ref\":\"#/definitions/topics\"},\"stream\":{\"$ref\":\"#/definitions/stream\",\"description\":\"The list of messages a consumer can read or write from/to a streaming API.\"},\"events\":{\"$ref\":\"#/definitions/events\",\"description\":\"The list of messages an events API sends and/or receives.\"},\"components\":{\"$ref\":\"#/definitions/components\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"security\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/SecurityRequirement\"}},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"definitions\":{\"Reference\":{\"type\":\"object\",\"required\":[\"$ref\"],\"properties\":{\"$ref\":{\"type\":\"string\",\"format\":\"uri\"}}},\"info\":{\"type\":\"object\",\"description\":\"General information about the API.\",\"required\":[\"version\",\"title\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"A unique and precise title of the API.\"},\"version\":{\"type\":\"string\",\"description\":\"A semantic version number of the API.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the API. Should be different from the title. CommonMark is allowed.\"},\"termsOfService\":{\"type\":\"string\",\"description\":\"A URL to the Terms of Service for the API. MUST be in the format of a URL.\",\"format\":\"uri\"},\"contact\":{\"$ref\":\"#/definitions/contact\"},\"license\":{\"$ref\":\"#/definitions/license\"}}},\"contact\":{\"type\":\"object\",\"description\":\"Contact information for the owners of the API.\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The identifying name of the contact person/organization.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the contact information.\",\"format\":\"uri\"},\"email\":{\"type\":\"string\",\"description\":\"The email address of the contact person/organization.\",\"format\":\"email\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"license\":{\"type\":\"object\",\"required\":[\"name\"],\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The name of the license type. It's encouraged to use an OSI compatible license.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the license.\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"server\":{\"type\":\"object\",\"description\":\"An object representing a Server.\",\"required\":[\"url\",\"scheme\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"url\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"scheme\":{\"type\":\"string\",\"description\":\"The transfer protocol.\",\"enum\":[\"kafka\",\"kafka-secure\",\"amqp\",\"amqps\",\"mqtt\",\"mqtts\",\"secure-mqtt\",\"ws\",\"wss\",\"stomp\",\"stomps\",\"jms\",\"http\",\"https\"]},\"schemeVersion\":{\"type\":\"string\"},\"variables\":{\"$ref\":\"#/definitions/serverVariables\"}}},\"serverVariables\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/serverVariable\"}},\"serverVariable\":{\"type\":\"object\",\"description\":\"An object representing a Server Variable for server URL template substitution.\",\"minProperties\":1,\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"enum\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true},\"default\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"}}},\"topics\":{\"type\":\"object\",\"description\":\"Relative paths to the individual topics. They must be relative to the 'baseTopic'.\",\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"},\"^[^.]\":{\"$ref\":\"#/definitions/topicItem\"}},\"additionalProperties\":false},\"components\":{\"type\":\"object\",\"description\":\"An object to hold a set of reusable objects for different aspects of the AsyncAPI Specification.\",\"additionalProperties\":false,\"properties\":{\"schemas\":{\"$ref\":\"#/definitions/schemas\"},\"messages\":{\"$ref\":\"#/definitions/messages\"},\"securitySchemes\":{\"type\":\"object\",\"patternProperties\":{\"^[a-zA-Z0-9\\\\.\\\\-_]+$\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/SecurityScheme\"}]}}},\"parameters\":{\"$ref\":\"#/definitions/parameters\"}}},\"schemas\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"description\":\"JSON objects describing schemas the API uses.\"},\"messages\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/message\"},\"description\":\"JSON objects describing the messages being consumed and produced by the API.\"},\"parameters\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/parameter\"},\"description\":\"JSON objects describing re-usable topic parameters.\"},\"schema\":{\"type\":\"object\",\"description\":\"A deterministic version of a JSON Schema object.\",\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"$ref\":{\"type\":\"string\"},\"format\":{\"type\":\"string\"},\"title\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/title\"},\"description\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/description\"},\"default\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/default\"},\"multipleOf\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/multipleOf\"},\"maximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/maximum\"},\"exclusiveMaximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum\"},\"minimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/minimum\"},\"exclusiveMinimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum\"},\"maxLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"pattern\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/pattern\"},\"maxItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"uniqueItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/uniqueItems\"},\"maxProperties\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minProperties\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"required\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/stringArray\"},\"enum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/enum\"},\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"boolean\"}],\"default\":{}},\"type\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/type\"},\"items\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}}],\"default\":{}},\"allOf\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"oneOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"anyOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"not\":{\"$ref\":\"#/definitions/schema\"},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"default\":{}},\"discriminator\":{\"type\":\"string\"},\"readOnly\":{\"type\":\"boolean\",\"default\":false},\"xml\":{\"$ref\":\"#/definitions/xml\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"example\":{}},\"additionalProperties\":false},\"xml\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\"},\"namespace\":{\"type\":\"string\"},\"prefix\":{\"type\":\"string\"},\"attribute\":{\"type\":\"boolean\",\"default\":false},\"wrapped\":{\"type\":\"boolean\",\"default\":false}}},\"externalDocs\":{\"type\":\"object\",\"additionalProperties\":false,\"description\":\"information about external documentation\",\"required\":[\"url\"],\"properties\":{\"description\":{\"type\":\"string\"},\"url\":{\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"topicItem\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"minProperties\":1,\"properties\":{\"$ref\":{\"type\":\"string\"},\"parameters\":{\"type\":\"array\",\"uniqueItems\":true,\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/parameter\"}},\"publish\":{\"$ref\":\"#/definitions/operation\"},\"subscribe\":{\"$ref\":\"#/definitions/operation\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false}}},\"parameter\":{\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"description\":{\"type\":\"string\",\"description\":\"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"},\"name\":{\"type\":\"string\",\"description\":\"The name of the parameter.\"},\"schema\":{\"$ref\":\"#/definitions/schema\"},\"$ref\":{\"type\":\"string\"}}},\"operation\":{\"oneOf\":[{\"$ref\":\"#/definitions/message\"},{\"type\":\"object\",\"required\":[\"oneOf\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"oneOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/message\"}}}}]},\"stream\":{\"title\":\"Stream Object\",\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"minProperties\":1,\"properties\":{\"framing\":{\"title\":\"Stream Framing Object\",\"type\":\"object\",\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"minProperties\":1,\"oneOf\":[{\"additionalProperties\":false,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"chunked\"]},\"delimiter\":{\"type\":\"string\",\"enum\":[\"\\\\r\\\\n\",\"\\\\n\"],\"default\":\"\\\\r\\\\n\"}}},{\"additionalProperties\":false,\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"sse\"]},\"delimiter\":{\"type\":\"string\",\"enum\":[\"\\\\n\\\\n\"],\"default\":\"\\\\n\\\\n\"}}}]},\"read\":{\"title\":\"Stream Read Object\",\"type\":\"array\",\"uniqueItems\":true,\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/message\"}},\"write\":{\"title\":\"Stream Write Object\",\"type\":\"array\",\"uniqueItems\":true,\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/message\"}}}},\"events\":{\"title\":\"Events Object\",\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"minProperties\":1,\"anyOf\":[{\"required\":[\"receive\"]},{\"required\":[\"send\"]}],\"properties\":{\"receive\":{\"title\":\"Events Receive Object\",\"type\":\"array\",\"uniqueItems\":true,\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/message\"}},\"send\":{\"title\":\"Events Send Object\",\"type\":\"array\",\"uniqueItems\":true,\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/message\"}}}},\"message\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}},\"properties\":{\"$ref\":{\"type\":\"string\"},\"headers\":{\"$ref\":\"#/definitions/schema\"},\"payload\":{\"$ref\":\"#/definitions/schema\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"summary\":{\"type\":\"string\",\"description\":\"A brief summary of the message.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the message. CommonMark is allowed.\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"example\":{}}},\"vendorExtension\":{\"description\":\"Any property starting with x- is valid.\",\"additionalProperties\":true,\"additionalItems\":true},\"tag\":{\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\"],\"properties\":{\"name\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"patternProperties\":{\"^x-\":{\"$ref\":\"#/definitions/vendorExtension\"}}},\"SecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/userPassword\"},{\"$ref\":\"#/definitions/apiKey\"},{\"$ref\":\"#/definitions/X509\"},{\"$ref\":\"#/definitions/symmetricEncryption\"},{\"$ref\":\"#/definitions/asymmetricEncryption\"},{\"$ref\":\"#/definitions/HTTPSecurityScheme\"}]},\"userPassword\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"userPassword\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"apiKey\":{\"type\":\"object\",\"required\":[\"type\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"apiKey\"]},\"in\":{\"type\":\"string\",\"enum\":[\"user\",\"password\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"X509\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"X509\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"symmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"symmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"asymmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"asymmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"HTTPSecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/NonBearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/BearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/APIKeyHTTPSecurityScheme\"}]},\"NonBearerHTTPSecurityScheme\":{\"not\":{\"type\":\"object\",\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]}}},\"type\":\"object\",\"required\":[\"scheme\",\"type\"],\"properties\":{\"scheme\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"BearerHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"scheme\"],\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]},\"bearerFormat\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"APIKeyHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"name\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"httpApiKey\"]},\"name\":{\"type\":\"string\"},\"in\":{\"type\":\"string\",\"enum\":[\"header\",\"query\",\"cookie\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-\":{}},\"additionalProperties\":false},\"SecurityRequirement\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"title\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/title\"},\"description\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/description\"},\"default\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/default\"},\"multipleOf\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/multipleOf\"},\"maximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/maximum\"},\"exclusiveMaximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum\"},\"minimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/minimum\"},\"exclusiveMinimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum\"},\"maxLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"pattern\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/pattern\"},\"maxItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"uniqueItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/uniqueItems\"},\"enum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/enum\"}}}"); -/** - * @param {AnymatchMatcher} matchers - * @param {Array|string} testString - * @param {object} options - * @returns {boolean|number|Function} - */ -const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => { - if (matchers == null) { - throw new TypeError('anymatch: specify first argument'); - } - const opts = typeof options === 'boolean' ? {returnIndex: options} : options; - const returnIndex = opts.returnIndex || false; +/***/ }), - // Early cache for matchers. - const mtchers = arrify(matchers); - const negatedGlobs = mtchers - .filter(item => typeof item === 'string' && item.charAt(0) === BANG) - .map(item => item.slice(1)) - .map(item => picomatch(item, opts)); - const patterns = mtchers.map(matcher => createPattern(matcher, opts)); +/***/ 34146: +/***/ ((module) => { - if (testString == null) { - return (testString, ri = false) => { - const returnIndex = typeof ri === 'boolean' ? ri : false; - return matchPatterns(patterns, negatedGlobs, testString, returnIndex); - } - } +"use strict"; +module.exports = JSON.parse("{\"title\":\"AsyncAPI 2.0.0-rc1 schema.\",\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"required\":[\"asyncapi\",\"id\",\"info\",\"channels\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"asyncapi\":{\"type\":\"string\",\"enum\":[\"2.0.0-rc1\"],\"description\":\"The AsyncAPI specification version of this document.\"},\"id\":{\"type\":\"string\",\"description\":\"A unique id representing the application.\",\"format\":\"uri-reference\"},\"info\":{\"$ref\":\"#/definitions/info\"},\"servers\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/server\"},\"uniqueItems\":true},\"defaultContentType\":{\"type\":\"string\"},\"channels\":{\"$ref\":\"#/definitions/channels\"},\"components\":{\"$ref\":\"#/definitions/components\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"definitions\":{\"Reference\":{\"type\":\"object\",\"required\":[\"$ref\"],\"properties\":{\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"}}},\"ReferenceObject\":{\"type\":\"string\",\"format\":\"uri\"},\"info\":{\"type\":\"object\",\"description\":\"General information about the API.\",\"required\":[\"version\",\"title\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"A unique and precise title of the API.\"},\"version\":{\"type\":\"string\",\"description\":\"A semantic version number of the API.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the API. Should be different from the title. CommonMark is allowed.\"},\"termsOfService\":{\"type\":\"string\",\"description\":\"A URL to the Terms of Service for the API. MUST be in the format of a URL.\",\"format\":\"uri\"},\"contact\":{\"$ref\":\"#/definitions/contact\"},\"license\":{\"$ref\":\"#/definitions/license\"}}},\"contact\":{\"type\":\"object\",\"description\":\"Contact information for the owners of the API.\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The identifying name of the contact person/organization.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the contact information.\",\"format\":\"uri\"},\"email\":{\"type\":\"string\",\"description\":\"The email address of the contact person/organization.\",\"format\":\"email\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"license\":{\"type\":\"object\",\"required\":[\"name\"],\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The name of the license type. It's encouraged to use an OSI compatible license.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the license.\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"server\":{\"type\":\"object\",\"description\":\"An object representing a Server.\",\"required\":[\"url\",\"protocol\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"url\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"protocol\":{\"type\":\"string\",\"description\":\"The transfer protocol.\"},\"protocolVersion\":{\"type\":\"string\"},\"variables\":{\"$ref\":\"#/definitions/serverVariables\"},\"baseChannel\":{\"type\":\"string\",\"x-format\":\"uri-path\"},\"security\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/SecurityRequirement\"}}}},\"serverVariables\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/serverVariable\"}},\"serverVariable\":{\"type\":\"object\",\"description\":\"An object representing a Server Variable for server URL template substitution.\",\"minProperties\":1,\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"enum\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true},\"default\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"examples\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}}},\"channels\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\",\"format\":\"uri-template\",\"minLength\":1},\"additionalProperties\":{\"$ref\":\"#/definitions/channelItem\"}},\"components\":{\"type\":\"object\",\"description\":\"An object to hold a set of reusable objects for different aspects of the AsyncAPI Specification.\",\"additionalProperties\":false,\"properties\":{\"schemas\":{\"$ref\":\"#/definitions/schemas\"},\"messages\":{\"$ref\":\"#/definitions/messages\"},\"securitySchemes\":{\"type\":\"object\",\"patternProperties\":{\"^[\\\\w\\\\d\\\\.\\\\-_]+$\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/SecurityScheme\"}]}}},\"parameters\":{\"$ref\":\"#/definitions/parameters\"},\"correlationIds\":{\"type\":\"object\",\"patternProperties\":{\"^[\\\\w\\\\d\\\\.\\\\-_]+$\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/correlationId\"}]}}},\"traits\":{\"$ref\":\"#/definitions/traits\"}}},\"schemas\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"description\":\"JSON objects describing schemas the API uses.\"},\"messages\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/message\"},\"description\":\"JSON objects describing the messages being consumed and produced by the API.\"},\"parameters\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/parameter\"},\"description\":\"JSON objects describing re-usable channel parameters.\"},\"schema\":{\"type\":\"object\",\"description\":\"A deterministic version of a JSON Schema object.\",\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"},\"format\":{\"type\":\"string\"},\"title\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/title\"},\"description\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/description\"},\"default\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/default\"},\"multipleOf\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/multipleOf\"},\"maximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/maximum\"},\"exclusiveMaximum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum\"},\"minimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/minimum\"},\"exclusiveMinimum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum\"},\"maxLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minLength\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"pattern\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/pattern\"},\"maxItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"uniqueItems\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/uniqueItems\"},\"maxProperties\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveInteger\"},\"minProperties\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0\"},\"required\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/definitions/stringArray\"},\"enum\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/enum\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"boolean\"}],\"default\":{}},\"type\":{\"$ref\":\"http://json-schema.org/draft-04/schema#/properties/type\"},\"items\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}}],\"default\":{}},\"allOf\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"oneOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"anyOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"not\":{\"$ref\":\"#/definitions/schema\"},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"default\":{}},\"discriminator\":{\"type\":\"string\"},\"readOnly\":{\"type\":\"boolean\",\"default\":false},\"xml\":{\"$ref\":\"#/definitions/xml\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"example\":{},\"examples\":{\"type\":\"array\",\"items\":{}}},\"additionalProperties\":false},\"xml\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\"},\"namespace\":{\"type\":\"string\"},\"prefix\":{\"type\":\"string\"},\"attribute\":{\"type\":\"boolean\",\"default\":false},\"wrapped\":{\"type\":\"boolean\",\"default\":false}}},\"externalDocs\":{\"type\":\"object\",\"additionalProperties\":false,\"description\":\"information about external documentation\",\"required\":[\"url\"],\"properties\":{\"description\":{\"type\":\"string\"},\"url\":{\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"channelItem\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"minProperties\":1,\"properties\":{\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"},\"parameters\":{\"type\":\"array\",\"uniqueItems\":true,\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/parameter\"}},\"publish\":{\"$ref\":\"#/definitions/operation\"},\"subscribe\":{\"$ref\":\"#/definitions/operation\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"protocolInfo\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}}}},\"parameter\":{\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"description\":{\"type\":\"string\",\"description\":\"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"},\"name\":{\"type\":\"string\",\"description\":\"The name of the parameter.\"},\"schema\":{\"$ref\":\"#/definitions/schema\"},\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"}}},\"operation\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"traits\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/operationTrait\"},{\"type\":\"array\",\"items\":[{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/operationTrait\"}]},{\"type\":\"object\",\"additionalItems\":true}]}]}},\"summary\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"operationId\":{\"type\":\"string\"},\"protocolInfo\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"message\":{\"oneOf\":[{\"$ref\":\"#/definitions/message\"},{\"type\":\"object\",\"required\":[\"oneOf\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"oneOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/message\"}}}}]}}},\"message\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"schemaFormat\":{\"type\":\"string\"},\"contentType\":{\"type\":\"string\"},\"headers\":{\"type\":\"object\",\"additionalProperties\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/schema\"}]}},\"payload\":{},\"correlationId\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/correlationId\"}]},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"summary\":{\"type\":\"string\",\"description\":\"A brief summary of the message.\"},\"name\":{\"type\":\"string\",\"description\":\"Name of the message.\"},\"title\":{\"type\":\"string\",\"description\":\"A human-friendly title for the message.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the message. CommonMark is allowed.\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"examples\":{\"type\":\"array\",\"items\":{\"type\":\"object\"}},\"protocolInfo\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}},\"traits\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/messageTrait\"},{\"type\":\"array\",\"items\":[{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/messageTrait\"}]},{\"type\":\"object\",\"additionalItems\":true}]}]}}}},\"correlationId\":{\"type\":\"object\",\"required\":[\"location\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"description\":{\"type\":\"string\",\"description\":\"A optional description of the correlation ID. GitHub Flavored Markdown is allowed.\"},\"location\":{\"type\":\"string\",\"description\":\"A runtime expression that specifies the location of the correlation ID\",\"pattern\":\"^\\\\$message\\\\.(header|payload)#(/\\\\w+)+\"}}},\"specificationExtension\":{\"description\":\"Any property starting with x- is valid.\",\"additionalProperties\":true,\"additionalItems\":true},\"tag\":{\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\"],\"properties\":{\"name\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"traits\":{\"type\":\"object\",\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/definitions/operationTrait\"},{\"$ref\":\"#/definitions/messageTrait\"}]}},\"operationTrait\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"summary\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"operationId\":{\"type\":\"string\"},\"protocolInfo\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}}}},\"messageTrait\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"schemaFormat\":{\"type\":\"string\"},\"contentType\":{\"type\":\"string\"},\"headers\":{\"type\":\"object\",\"additionalProperties\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/schema\"}]}},\"correlationId\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/correlationId\"}]},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"summary\":{\"type\":\"string\",\"description\":\"A brief summary of the message.\"},\"name\":{\"type\":\"string\",\"description\":\"Name of the message.\"},\"title\":{\"type\":\"string\",\"description\":\"A human-friendly title for the message.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the message. CommonMark is allowed.\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"examples\":{\"type\":\"array\",\"items\":{\"type\":\"object\"}},\"protocolInfo\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"object\"}}}},\"SecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/userPassword\"},{\"$ref\":\"#/definitions/apiKey\"},{\"$ref\":\"#/definitions/X509\"},{\"$ref\":\"#/definitions/symmetricEncryption\"},{\"$ref\":\"#/definitions/asymmetricEncryption\"},{\"$ref\":\"#/definitions/HTTPSecurityScheme\"},{\"$ref\":\"#/definitions/oauth2Flows\"},{\"$ref\":\"#/definitions/openIdConnect\"}]},\"userPassword\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"userPassword\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"apiKey\":{\"type\":\"object\",\"required\":[\"type\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"apiKey\"]},\"in\":{\"type\":\"string\",\"enum\":[\"user\",\"password\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"X509\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"X509\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"symmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"symmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"asymmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"asymmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"HTTPSecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/NonBearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/BearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/APIKeyHTTPSecurityScheme\"}]},\"NonBearerHTTPSecurityScheme\":{\"not\":{\"type\":\"object\",\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]}}},\"type\":\"object\",\"required\":[\"scheme\",\"type\"],\"properties\":{\"scheme\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"BearerHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"scheme\"],\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]},\"bearerFormat\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"APIKeyHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"name\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"httpApiKey\"]},\"name\":{\"type\":\"string\"},\"in\":{\"type\":\"string\",\"enum\":[\"header\",\"query\",\"cookie\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"oauth2Flows\":{\"type\":\"object\",\"required\":[\"type\",\"flows\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"oauth2\"]},\"description\":{\"type\":\"string\"},\"flows\":{\"type\":\"object\",\"properties\":{\"implicit\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"authorizationUrl\",\"scopes\"]},{\"not\":{\"required\":[\"tokenUrl\"]}}]},\"password\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"tokenUrl\",\"scopes\"]},{\"not\":{\"required\":[\"authorizationUrl\"]}}]},\"clientCredentials\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"tokenUrl\",\"scopes\"]},{\"not\":{\"required\":[\"authorizationUrl\"]}}]},\"authorizationCode\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"authorizationUrl\",\"tokenUrl\",\"scopes\"]}]}},\"additionalProperties\":false,\"minProperties\":1}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"oauth2Flow\":{\"type\":\"object\",\"properties\":{\"authorizationUrl\":{\"type\":\"string\",\"format\":\"uri\"},\"tokenUrl\":{\"type\":\"string\",\"format\":\"uri\"},\"refreshUrl\":{\"type\":\"string\",\"format\":\"uri\"},\"scopes\":{\"$ref\":\"#/definitions/oauth2Scopes\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"oauth2Scopes\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"string\"}},\"openIdConnect\":{\"type\":\"object\",\"required\":[\"type\",\"openIdConnectUrl\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"openIdConnect\"]},\"description\":{\"type\":\"string\"},\"openIdConnectUrl\":{\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"SecurityRequirement\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true}}}}"); - return matchPatterns(patterns, negatedGlobs, testString, returnIndex); -}; +/***/ }), -anymatch.default = anymatch; -module.exports = anymatch; +/***/ 49121: +/***/ ((module) => { +"use strict"; +module.exports = JSON.parse("{\"title\":\"AsyncAPI 2.0.0-rc2 schema.\",\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"required\":[\"asyncapi\",\"info\",\"channels\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"asyncapi\":{\"type\":\"string\",\"enum\":[\"2.0.0-rc2\"],\"description\":\"The AsyncAPI specification version of this document.\"},\"id\":{\"type\":\"string\",\"description\":\"A unique id representing the application.\",\"format\":\"uri\"},\"info\":{\"$ref\":\"#/definitions/info\"},\"servers\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/server\"}},\"defaultContentType\":{\"type\":\"string\"},\"channels\":{\"$ref\":\"#/definitions/channels\"},\"components\":{\"$ref\":\"#/definitions/components\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"definitions\":{\"Reference\":{\"type\":\"object\",\"required\":[\"$ref\"],\"properties\":{\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"}}},\"ReferenceObject\":{\"type\":\"string\",\"format\":\"uri-reference\"},\"info\":{\"type\":\"object\",\"description\":\"General information about the API.\",\"required\":[\"version\",\"title\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"A unique and precise title of the API.\"},\"version\":{\"type\":\"string\",\"description\":\"A semantic version number of the API.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the API. Should be different from the title. CommonMark is allowed.\"},\"termsOfService\":{\"type\":\"string\",\"description\":\"A URL to the Terms of Service for the API. MUST be in the format of a URL.\",\"format\":\"uri\"},\"contact\":{\"$ref\":\"#/definitions/contact\"},\"license\":{\"$ref\":\"#/definitions/license\"}}},\"contact\":{\"type\":\"object\",\"description\":\"Contact information for the owners of the API.\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The identifying name of the contact person/organization.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the contact information.\",\"format\":\"uri\"},\"email\":{\"type\":\"string\",\"description\":\"The email address of the contact person/organization.\",\"format\":\"email\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"license\":{\"type\":\"object\",\"required\":[\"name\"],\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The name of the license type. It's encouraged to use an OSI compatible license.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the license.\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"server\":{\"type\":\"object\",\"description\":\"An object representing a Server.\",\"required\":[\"url\",\"protocol\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"url\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"protocol\":{\"type\":\"string\",\"description\":\"The transfer protocol.\"},\"protocolVersion\":{\"type\":\"string\"},\"variables\":{\"$ref\":\"#/definitions/serverVariables\"},\"security\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/SecurityRequirement\"}},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"}}},\"serverVariables\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/serverVariable\"}},\"serverVariable\":{\"type\":\"object\",\"description\":\"An object representing a Server Variable for server URL template substitution.\",\"minProperties\":1,\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"enum\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true},\"default\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"examples\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}}},\"channels\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\",\"format\":\"uri-template\",\"minLength\":1},\"additionalProperties\":{\"$ref\":\"#/definitions/channelItem\"}},\"components\":{\"type\":\"object\",\"description\":\"An object to hold a set of reusable objects for different aspects of the AsyncAPI Specification.\",\"additionalProperties\":false,\"properties\":{\"schemas\":{\"$ref\":\"#/definitions/schemas\"},\"messages\":{\"$ref\":\"#/definitions/messages\"},\"securitySchemes\":{\"type\":\"object\",\"patternProperties\":{\"^[\\\\w\\\\d\\\\.\\\\-_]+$\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/SecurityScheme\"}]}}},\"parameters\":{\"$ref\":\"#/definitions/parameters\"},\"correlationIds\":{\"type\":\"object\",\"patternProperties\":{\"^[\\\\w\\\\d\\\\.\\\\-_]+$\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/correlationId\"}]}}},\"operationTraits\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/operationTrait\"}},\"messageTraits\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/messageTrait\"}},\"serverBindings\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/bindingsObject\"}},\"channelBindings\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/bindingsObject\"}},\"operationBindings\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/bindingsObject\"}},\"messageBindings\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/bindingsObject\"}}}},\"schemas\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"description\":\"JSON objects describing schemas the API uses.\"},\"messages\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/message\"},\"description\":\"JSON objects describing the messages being consumed and produced by the API.\"},\"parameters\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/parameter\"},\"description\":\"JSON objects describing re-usable channel parameters.\"},\"schema\":{\"allOf\":[{\"$ref\":\"http://json-schema.org/draft-07/schema#\"},{\"type\":\"object\",\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"items\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}}],\"default\":{}},\"allOf\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"oneOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"anyOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"not\":{\"$ref\":\"#/definitions/schema\"},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"default\":{}},\"patternProperties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"default\":{}},\"propertyNames\":{\"$ref\":\"#/definitions/schema\"},\"contains\":{\"$ref\":\"#/definitions/schema\"},\"discriminator\":{\"type\":\"string\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false}}}]},\"externalDocs\":{\"type\":\"object\",\"additionalProperties\":false,\"description\":\"information about external documentation\",\"required\":[\"url\"],\"properties\":{\"description\":{\"type\":\"string\"},\"url\":{\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"channelItem\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"minProperties\":1,\"properties\":{\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"},\"parameters\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/parameter\"}},\"description\":{\"type\":\"string\",\"description\":\"A description of the channel.\"},\"publish\":{\"$ref\":\"#/definitions/operation\"},\"subscribe\":{\"$ref\":\"#/definitions/operation\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"}}},\"parameter\":{\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"description\":{\"type\":\"string\",\"description\":\"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"},\"schema\":{\"$ref\":\"#/definitions/schema\"},\"location\":{\"type\":\"string\",\"description\":\"A runtime expression that specifies the location of the parameter value\",\"pattern\":\"^\\\\$message\\\\.(header|payload)\\\\#(\\\\/(([^\\\\/~])|(~[01]))*)*\"},\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"}}},\"operation\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"traits\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/operationTrait\"},{\"type\":\"array\",\"items\":[{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/operationTrait\"}]},{\"type\":\"object\",\"additionalItems\":true}]}]}},\"summary\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"operationId\":{\"type\":\"string\"},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"},\"message\":{\"$ref\":\"#/definitions/message\"}}},\"message\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"oneOf\":[{\"type\":\"object\",\"required\":[\"oneOf\"],\"additionalProperties\":false,\"properties\":{\"oneOf\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/message\"}}}},{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"schemaFormat\":{\"type\":\"string\"},\"contentType\":{\"type\":\"string\"},\"headers\":{\"$ref\":\"#/definitions/schema\"},\"payload\":{},\"correlationId\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/correlationId\"}]},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"summary\":{\"type\":\"string\",\"description\":\"A brief summary of the message.\"},\"name\":{\"type\":\"string\",\"description\":\"Name of the message.\"},\"title\":{\"type\":\"string\",\"description\":\"A human-friendly title for the message.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the message. CommonMark is allowed.\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"examples\":{\"type\":\"array\",\"items\":{\"type\":\"object\"}},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"},\"traits\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/messageTrait\"},{\"type\":\"array\",\"items\":[{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/messageTrait\"}]},{\"type\":\"object\",\"additionalItems\":true}]}]}}}}]}]},\"bindingsObject\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"http\":{},\"ws\":{},\"amqp\":{},\"amqp1\":{},\"mqtt\":{},\"mqtt5\":{},\"kafka\":{},\"nats\":{},\"jms\":{},\"sns\":{},\"sqs\":{},\"stomp\":{},\"redis\":{}}},\"correlationId\":{\"type\":\"object\",\"required\":[\"location\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"description\":{\"type\":\"string\",\"description\":\"A optional description of the correlation ID. GitHub Flavored Markdown is allowed.\"},\"location\":{\"type\":\"string\",\"description\":\"A runtime expression that specifies the location of the correlation ID\",\"pattern\":\"^\\\\$message\\\\.(header|payload)\\\\#(\\\\/(([^\\\\/~])|(~[01]))*)*\"}}},\"specificationExtension\":{\"description\":\"Any property starting with x- is valid.\",\"additionalProperties\":true,\"additionalItems\":true},\"tag\":{\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\"],\"properties\":{\"name\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"operationTrait\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"summary\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"operationId\":{\"type\":\"string\"},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"}}},\"messageTrait\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"schemaFormat\":{\"type\":\"string\"},\"contentType\":{\"type\":\"string\"},\"headers\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/schema\"}]},\"correlationId\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/correlationId\"}]},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"summary\":{\"type\":\"string\",\"description\":\"A brief summary of the message.\"},\"name\":{\"type\":\"string\",\"description\":\"Name of the message.\"},\"title\":{\"type\":\"string\",\"description\":\"A human-friendly title for the message.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the message. CommonMark is allowed.\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"examples\":{\"type\":\"array\",\"items\":{\"type\":\"object\"}},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"}}},\"SecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/userPassword\"},{\"$ref\":\"#/definitions/apiKey\"},{\"$ref\":\"#/definitions/X509\"},{\"$ref\":\"#/definitions/symmetricEncryption\"},{\"$ref\":\"#/definitions/asymmetricEncryption\"},{\"$ref\":\"#/definitions/HTTPSecurityScheme\"},{\"$ref\":\"#/definitions/oauth2Flows\"},{\"$ref\":\"#/definitions/openIdConnect\"}]},\"userPassword\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"userPassword\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"apiKey\":{\"type\":\"object\",\"required\":[\"type\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"apiKey\"]},\"in\":{\"type\":\"string\",\"enum\":[\"user\",\"password\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"X509\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"X509\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"symmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"symmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"asymmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"asymmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"HTTPSecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/NonBearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/BearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/APIKeyHTTPSecurityScheme\"}]},\"NonBearerHTTPSecurityScheme\":{\"not\":{\"type\":\"object\",\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]}}},\"type\":\"object\",\"required\":[\"scheme\",\"type\"],\"properties\":{\"scheme\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"BearerHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"scheme\"],\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]},\"bearerFormat\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"APIKeyHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"name\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"httpApiKey\"]},\"name\":{\"type\":\"string\"},\"in\":{\"type\":\"string\",\"enum\":[\"header\",\"query\",\"cookie\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"oauth2Flows\":{\"type\":\"object\",\"required\":[\"type\",\"flows\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"oauth2\"]},\"description\":{\"type\":\"string\"},\"flows\":{\"type\":\"object\",\"properties\":{\"implicit\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"authorizationUrl\",\"scopes\"]},{\"not\":{\"required\":[\"tokenUrl\"]}}]},\"password\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"tokenUrl\",\"scopes\"]},{\"not\":{\"required\":[\"authorizationUrl\"]}}]},\"clientCredentials\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"tokenUrl\",\"scopes\"]},{\"not\":{\"required\":[\"authorizationUrl\"]}}]},\"authorizationCode\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"authorizationUrl\",\"tokenUrl\",\"scopes\"]}]}},\"additionalProperties\":false,\"minProperties\":1}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"oauth2Flow\":{\"type\":\"object\",\"properties\":{\"authorizationUrl\":{\"type\":\"string\",\"format\":\"uri\"},\"tokenUrl\":{\"type\":\"string\",\"format\":\"uri\"},\"refreshUrl\":{\"type\":\"string\",\"format\":\"uri\"},\"scopes\":{\"$ref\":\"#/definitions/oauth2Scopes\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"oauth2Scopes\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"string\"}},\"openIdConnect\":{\"type\":\"object\",\"required\":[\"type\",\"openIdConnectUrl\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"openIdConnect\"]},\"description\":{\"type\":\"string\"},\"openIdConnectUrl\":{\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"SecurityRequirement\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true}}}}"); /***/ }), -/* 6 */ -/***/ (function(module) { + +/***/ 88547: +/***/ ((module) => { "use strict"; +module.exports = JSON.parse("{\"title\":\"AsyncAPI 2.0.0 schema.\",\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"required\":[\"asyncapi\",\"info\",\"channels\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"asyncapi\":{\"type\":\"string\",\"enum\":[\"2.0.0\"],\"description\":\"The AsyncAPI specification version of this document.\"},\"id\":{\"type\":\"string\",\"description\":\"A unique id representing the application.\",\"format\":\"uri\"},\"info\":{\"$ref\":\"#/definitions/info\"},\"servers\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/server\"}},\"defaultContentType\":{\"type\":\"string\"},\"channels\":{\"$ref\":\"#/definitions/channels\"},\"components\":{\"$ref\":\"#/definitions/components\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"definitions\":{\"Reference\":{\"type\":\"object\",\"required\":[\"$ref\"],\"properties\":{\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"}}},\"ReferenceObject\":{\"type\":\"string\",\"format\":\"uri-reference\"},\"info\":{\"type\":\"object\",\"description\":\"General information about the API.\",\"required\":[\"version\",\"title\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"title\":{\"type\":\"string\",\"description\":\"A unique and precise title of the API.\"},\"version\":{\"type\":\"string\",\"description\":\"A semantic version number of the API.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the API. Should be different from the title. CommonMark is allowed.\"},\"termsOfService\":{\"type\":\"string\",\"description\":\"A URL to the Terms of Service for the API. MUST be in the format of a URL.\",\"format\":\"uri\"},\"contact\":{\"$ref\":\"#/definitions/contact\"},\"license\":{\"$ref\":\"#/definitions/license\"}}},\"contact\":{\"type\":\"object\",\"description\":\"Contact information for the owners of the API.\",\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The identifying name of the contact person/organization.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the contact information.\",\"format\":\"uri\"},\"email\":{\"type\":\"string\",\"description\":\"The email address of the contact person/organization.\",\"format\":\"email\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"license\":{\"type\":\"object\",\"required\":[\"name\"],\"additionalProperties\":false,\"properties\":{\"name\":{\"type\":\"string\",\"description\":\"The name of the license type. It's encouraged to use an OSI compatible license.\"},\"url\":{\"type\":\"string\",\"description\":\"The URL pointing to the license.\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"server\":{\"type\":\"object\",\"description\":\"An object representing a Server.\",\"required\":[\"url\",\"protocol\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"url\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"protocol\":{\"type\":\"string\",\"description\":\"The transfer protocol.\"},\"protocolVersion\":{\"type\":\"string\"},\"variables\":{\"$ref\":\"#/definitions/serverVariables\"},\"security\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/SecurityRequirement\"}},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"}}},\"serverVariables\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/serverVariable\"}},\"serverVariable\":{\"type\":\"object\",\"description\":\"An object representing a Server Variable for server URL template substitution.\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"enum\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true},\"default\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"examples\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}}},\"channels\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\",\"format\":\"uri-template\",\"minLength\":1},\"additionalProperties\":{\"$ref\":\"#/definitions/channelItem\"}},\"components\":{\"type\":\"object\",\"description\":\"An object to hold a set of reusable objects for different aspects of the AsyncAPI Specification.\",\"additionalProperties\":false,\"properties\":{\"schemas\":{\"$ref\":\"#/definitions/schemas\"},\"messages\":{\"$ref\":\"#/definitions/messages\"},\"securitySchemes\":{\"type\":\"object\",\"patternProperties\":{\"^[\\\\w\\\\d\\\\.\\\\-_]+$\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/SecurityScheme\"}]}}},\"parameters\":{\"$ref\":\"#/definitions/parameters\"},\"correlationIds\":{\"type\":\"object\",\"patternProperties\":{\"^[\\\\w\\\\d\\\\.\\\\-_]+$\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/correlationId\"}]}}},\"operationTraits\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/operationTrait\"}},\"messageTraits\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/messageTrait\"}},\"serverBindings\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/bindingsObject\"}},\"channelBindings\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/bindingsObject\"}},\"operationBindings\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/bindingsObject\"}},\"messageBindings\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/bindingsObject\"}}}},\"schemas\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"description\":\"JSON objects describing schemas the API uses.\"},\"messages\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/message\"},\"description\":\"JSON objects describing the messages being consumed and produced by the API.\"},\"parameters\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/parameter\"},\"description\":\"JSON objects describing re-usable channel parameters.\"},\"schema\":{\"allOf\":[{\"$ref\":\"http://json-schema.org/draft-07/schema#\"},{\"type\":\"object\",\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"additionalProperties\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"boolean\"}],\"default\":{}},\"items\":{\"anyOf\":[{\"$ref\":\"#/definitions/schema\"},{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}}],\"default\":{}},\"allOf\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"oneOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"anyOf\":{\"type\":\"array\",\"minItems\":2,\"items\":{\"$ref\":\"#/definitions/schema\"}},\"not\":{\"$ref\":\"#/definitions/schema\"},\"properties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"default\":{}},\"patternProperties\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/schema\"},\"default\":{}},\"propertyNames\":{\"$ref\":\"#/definitions/schema\"},\"contains\":{\"$ref\":\"#/definitions/schema\"},\"discriminator\":{\"type\":\"string\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false}}}]},\"externalDocs\":{\"type\":\"object\",\"additionalProperties\":false,\"description\":\"information about external documentation\",\"required\":[\"url\"],\"properties\":{\"description\":{\"type\":\"string\"},\"url\":{\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"channelItem\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"},\"parameters\":{\"type\":\"object\",\"additionalProperties\":{\"$ref\":\"#/definitions/parameter\"}},\"description\":{\"type\":\"string\",\"description\":\"A description of the channel.\"},\"publish\":{\"$ref\":\"#/definitions/operation\"},\"subscribe\":{\"$ref\":\"#/definitions/operation\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"}}},\"parameter\":{\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"description\":{\"type\":\"string\",\"description\":\"A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.\"},\"schema\":{\"$ref\":\"#/definitions/schema\"},\"location\":{\"type\":\"string\",\"description\":\"A runtime expression that specifies the location of the parameter value\",\"pattern\":\"^\\\\$message\\\\.(header|payload)\\\\#(\\\\/(([^\\\\/~])|(~[01]))*)*\"},\"$ref\":{\"$ref\":\"#/definitions/ReferenceObject\"}}},\"operation\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"traits\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/operationTrait\"},{\"type\":\"array\",\"items\":[{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/operationTrait\"}]},{\"type\":\"object\",\"additionalItems\":true}]}]}},\"summary\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"operationId\":{\"type\":\"string\"},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"},\"message\":{\"$ref\":\"#/definitions/message\"}}},\"message\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"oneOf\":[{\"type\":\"object\",\"required\":[\"oneOf\"],\"additionalProperties\":false,\"properties\":{\"oneOf\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/message\"}}}},{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"schemaFormat\":{\"type\":\"string\"},\"contentType\":{\"type\":\"string\"},\"headers\":{\"allOf\":[{\"$ref\":\"#/definitions/schema\"},{\"properties\":{\"type\":{\"const\":\"object\"}}}]},\"payload\":{},\"correlationId\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/correlationId\"}]},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"summary\":{\"type\":\"string\",\"description\":\"A brief summary of the message.\"},\"name\":{\"type\":\"string\",\"description\":\"Name of the message.\"},\"title\":{\"type\":\"string\",\"description\":\"A human-friendly title for the message.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the message. CommonMark is allowed.\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"examples\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"additionalProperties\":false,\"properties\":{\"headers\":{\"type\":\"object\"},\"payload\":{}}}},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"},\"traits\":{\"type\":\"array\",\"items\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/messageTrait\"},{\"type\":\"array\",\"items\":[{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/messageTrait\"}]},{\"type\":\"object\",\"additionalItems\":true}]}]}}}}]}]},\"bindingsObject\":{\"type\":\"object\",\"additionalProperties\":true,\"properties\":{\"http\":{},\"ws\":{},\"amqp\":{},\"amqp1\":{},\"mqtt\":{},\"mqtt5\":{},\"kafka\":{},\"nats\":{},\"jms\":{},\"sns\":{},\"sqs\":{},\"stomp\":{},\"redis\":{}}},\"correlationId\":{\"type\":\"object\",\"required\":[\"location\"],\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"description\":{\"type\":\"string\",\"description\":\"A optional description of the correlation ID. GitHub Flavored Markdown is allowed.\"},\"location\":{\"type\":\"string\",\"description\":\"A runtime expression that specifies the location of the correlation ID\",\"pattern\":\"^\\\\$message\\\\.(header|payload)\\\\#(\\\\/(([^\\\\/~])|(~[01]))*)*\"}}},\"specificationExtension\":{\"description\":\"Any property starting with x- is valid.\",\"additionalProperties\":true,\"additionalItems\":true},\"tag\":{\"type\":\"object\",\"additionalProperties\":false,\"required\":[\"name\"],\"properties\":{\"name\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"operationTrait\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"summary\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"operationId\":{\"type\":\"string\"},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"}}},\"messageTrait\":{\"type\":\"object\",\"additionalProperties\":false,\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"properties\":{\"schemaFormat\":{\"type\":\"string\"},\"contentType\":{\"type\":\"string\"},\"headers\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/schema\"}]},\"correlationId\":{\"oneOf\":[{\"$ref\":\"#/definitions/Reference\"},{\"$ref\":\"#/definitions/correlationId\"}]},\"tags\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/definitions/tag\"},\"uniqueItems\":true},\"summary\":{\"type\":\"string\",\"description\":\"A brief summary of the message.\"},\"name\":{\"type\":\"string\",\"description\":\"Name of the message.\"},\"title\":{\"type\":\"string\",\"description\":\"A human-friendly title for the message.\"},\"description\":{\"type\":\"string\",\"description\":\"A longer description of the message. CommonMark is allowed.\"},\"externalDocs\":{\"$ref\":\"#/definitions/externalDocs\"},\"deprecated\":{\"type\":\"boolean\",\"default\":false},\"examples\":{\"type\":\"array\",\"items\":{\"type\":\"object\"}},\"bindings\":{\"$ref\":\"#/definitions/bindingsObject\"}}},\"SecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/userPassword\"},{\"$ref\":\"#/definitions/apiKey\"},{\"$ref\":\"#/definitions/X509\"},{\"$ref\":\"#/definitions/symmetricEncryption\"},{\"$ref\":\"#/definitions/asymmetricEncryption\"},{\"$ref\":\"#/definitions/HTTPSecurityScheme\"},{\"$ref\":\"#/definitions/oauth2Flows\"},{\"$ref\":\"#/definitions/openIdConnect\"}]},\"userPassword\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"userPassword\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"apiKey\":{\"type\":\"object\",\"required\":[\"type\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"apiKey\"]},\"in\":{\"type\":\"string\",\"enum\":[\"user\",\"password\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"X509\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"X509\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"symmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"symmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"asymmetricEncryption\":{\"type\":\"object\",\"required\":[\"type\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"asymmetricEncryption\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"HTTPSecurityScheme\":{\"oneOf\":[{\"$ref\":\"#/definitions/NonBearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/BearerHTTPSecurityScheme\"},{\"$ref\":\"#/definitions/APIKeyHTTPSecurityScheme\"}]},\"NonBearerHTTPSecurityScheme\":{\"not\":{\"type\":\"object\",\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]}}},\"type\":\"object\",\"required\":[\"scheme\",\"type\"],\"properties\":{\"scheme\":{\"type\":\"string\"},\"description\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"BearerHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"scheme\"],\"properties\":{\"scheme\":{\"type\":\"string\",\"enum\":[\"bearer\"]},\"bearerFormat\":{\"type\":\"string\"},\"type\":{\"type\":\"string\",\"enum\":[\"http\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"APIKeyHTTPSecurityScheme\":{\"type\":\"object\",\"required\":[\"type\",\"name\",\"in\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"httpApiKey\"]},\"name\":{\"type\":\"string\"},\"in\":{\"type\":\"string\",\"enum\":[\"header\",\"query\",\"cookie\"]},\"description\":{\"type\":\"string\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"oauth2Flows\":{\"type\":\"object\",\"required\":[\"type\",\"flows\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"oauth2\"]},\"description\":{\"type\":\"string\"},\"flows\":{\"type\":\"object\",\"properties\":{\"implicit\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"authorizationUrl\",\"scopes\"]},{\"not\":{\"required\":[\"tokenUrl\"]}}]},\"password\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"tokenUrl\",\"scopes\"]},{\"not\":{\"required\":[\"authorizationUrl\"]}}]},\"clientCredentials\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"tokenUrl\",\"scopes\"]},{\"not\":{\"required\":[\"authorizationUrl\"]}}]},\"authorizationCode\":{\"allOf\":[{\"$ref\":\"#/definitions/oauth2Flow\"},{\"required\":[\"authorizationUrl\",\"tokenUrl\",\"scopes\"]}]}},\"additionalProperties\":false}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}}},\"oauth2Flow\":{\"type\":\"object\",\"properties\":{\"authorizationUrl\":{\"type\":\"string\",\"format\":\"uri\"},\"tokenUrl\":{\"type\":\"string\",\"format\":\"uri\"},\"refreshUrl\":{\"type\":\"string\",\"format\":\"uri\"},\"scopes\":{\"$ref\":\"#/definitions/oauth2Scopes\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"oauth2Scopes\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"string\"}},\"openIdConnect\":{\"type\":\"object\",\"required\":[\"type\",\"openIdConnectUrl\"],\"properties\":{\"type\":{\"type\":\"string\",\"enum\":[\"openIdConnect\"]},\"description\":{\"type\":\"string\"},\"openIdConnectUrl\":{\"type\":\"string\",\"format\":\"uri\"}},\"patternProperties\":{\"^x-[\\\\w\\\\d\\\\.\\\\-\\\\_]+$\":{\"$ref\":\"#/definitions/specificationExtension\"}},\"additionalProperties\":false},\"SecurityRequirement\":{\"type\":\"object\",\"additionalProperties\":{\"type\":\"array\",\"items\":{\"type\":\"string\"},\"uniqueItems\":true}}}}"); +/***/ }), -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; -var toStr = Object.prototype.toString; +/***/ 94822: +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var isStandardArguments = function isArguments(value) { - if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) { - return false; - } - return toStr.call(value) === '[object Arguments]'; -}; +const core = __webpack_require__(42186); +const Generator = __webpack_require__(56814); +const path = __webpack_require__(85622); +const fs = __webpack_require__(35747); +const { paramParser, createOutputDir } = __webpack_require__(50918); -var isLegacyArguments = function isArguments(value) { - if (isStandardArguments(value)) { - return true; - } - return value !== null && - typeof value === 'object' && - typeof value.length === 'number' && - value.length >= 0 && - toStr.call(value) !== '[object Array]' && - toStr.call(value.callee) === '[object Function]'; -}; +const DEFAULT_TEMPLATE = '@asyncapi/markdown-template@0.10.0'; +const DEFAULT_FILEPATH = 'asyncapi.yml'; +const DEFAULT_OUTPUT = 'output'; -var supportsStandardArguments = (function () { - return isStandardArguments(arguments); -}()); +async function run() { + try { + const template = core.getInput('template') || DEFAULT_TEMPLATE; + const filepath = core.getInput('filepath') || DEFAULT_FILEPATH; + const parameters = paramParser(core.getInput('parameters')); + const output = core.getInput('output') || DEFAULT_OUTPUT; + const workdir = process.env.GITHUB_WORKSPACE || __dirname; + const absoluteOutputPath = path.resolve(workdir, output); + const pathToAsyncapiFile = path.resolve(workdir, filepath); + + //Below additional log information is visible only if you add ACTIONS_STEP_DEBUG secret to your repository where you run your action. + //The value of this secret must be "true" + core.debug(`Template: ${template}`); + core.debug(`Filepath: ${filepath}`); + core.debug(`Parameters: ${JSON.stringify(parameters)}`); + core.debug(`Output: ${output}`); + core.debug(`Workdir: ${workdir}`); + core.debug(`Workdir contents: ${fs.readdirSync(workdir)}`); + core.debug(`AbsoluteOutputPath: ${absoluteOutputPath}`); + core.debug(`PathToAsyncapiFile: ${pathToAsyncapiFile}`); -isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests + createOutputDir(absoluteOutputPath); -module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; + const generator = new Generator(template, absoluteOutputPath, { + templateParams: parameters, + forceWrite: true + }); + await generator.generateFromFile(pathToAsyncapiFile); + } catch (e) { + core.setFailed(e.message); + } +} + +run(); /***/ }), -/* 7 */, -/* 8 */, -/* 9 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - +/***/ 50918: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var loader = __webpack_require__(457); -var dumper = __webpack_require__(685); +const fs = __webpack_require__(35747); +const paramParser = function(input) { + const params = {}; + + if (!input) return params; + if (!input.includes('=')) throw new Error(`Invalid param ${input}. It must be in the format of name=value.`); + + input.split(' ').forEach(el => { + const chunks = el.split('='); + const paramName = chunks[0]; + const paramValue = chunks[1]; + params[paramName] = paramValue; + }); + + return params; +}; -function deprecated(name) { - return function () { - throw new Error('Function ' + name + ' is deprecated and cannot be used.'); - }; -} +const createOutputDir = function(dir) { + if (typeof dir === 'string' && !fs.existsSync(dir)) { + fs.mkdirSync(dir); + } + return dir; +}; + +module.exports = { + paramParser, + createOutputDir +}; -module.exports.Type = __webpack_require__(945); -module.exports.Schema = __webpack_require__(43); -module.exports.FAILSAFE_SCHEMA = __webpack_require__(581); -module.exports.JSON_SCHEMA = __webpack_require__(23); -module.exports.CORE_SCHEMA = __webpack_require__(611); -module.exports.DEFAULT_SAFE_SCHEMA = __webpack_require__(570); -module.exports.DEFAULT_FULL_SCHEMA = __webpack_require__(910); -module.exports.load = loader.load; -module.exports.loadAll = loader.loadAll; -module.exports.safeLoad = loader.safeLoad; -module.exports.safeLoadAll = loader.safeLoadAll; -module.exports.dump = dumper.dump; -module.exports.safeDump = dumper.safeDump; -module.exports.YAMLException = __webpack_require__(556); +/***/ }), -// Deprecated schema names from JS-YAML 2.0.x -module.exports.MINIMAL_SCHEMA = __webpack_require__(581); -module.exports.SAFE_SCHEMA = __webpack_require__(570); -module.exports.DEFAULT_SCHEMA = __webpack_require__(910); +/***/ 87351: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -// Deprecated functions from JS-YAML 1.x.x -module.exports.scan = deprecated('scan'); -module.exports.parse = deprecated('parse'); -module.exports.compose = deprecated('compose'); -module.exports.addConstructor = deprecated('addConstructor'); +"use strict"; - -/***/ }), -/* 10 */ -/***/ (function(module) { - -"use strict"; - -module.exports = function generate_custom(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $rule = this, - $definition = 'definition' + $lvl, - $rDef = $rule.definition, - $closingBraces = ''; - var $compile, $inline, $macro, $ruleValidate, $validateCode; - if ($isData && $rDef.$data) { - $validateCode = 'keywordValidate' + $lvl; - var $validateSchema = $rDef.validateSchema; - out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; - } else { - $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); - if (!$ruleValidate) return; - $schemaValue = 'validate.schema' + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; - } - var $ruleErrs = $validateCode + '.errors', - $i = 'i' + $lvl, - $ruleErr = 'ruleErr' + $lvl, - $asyncKeyword = $rDef.async; - if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); - if (!($inline || $macro)) { - out += '' + ($ruleErrs) + ' = null;'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($isData && $rDef.$data) { - $closingBraces += '}'; - out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; - if ($validateSchema) { - $closingBraces += '}'; - out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; - } - } - if ($inline) { - if ($rDef.statements) { - out += ' ' + ($ruleValidate.validate) + ' '; - } else { - out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; - } - } else if ($macro) { - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - $it.schema = $ruleValidate.validate; - $it.schemaPath = ''; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($code); - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - out += ' ' + ($validateCode) + '.call( '; - if (it.opts.passContext) { - out += 'this'; - } else { - out += 'self'; - } - if ($compile || $rDef.schema === false) { - out += ' , ' + ($data) + ' '; - } else { - out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; - } - out += ' , (dataPath || \'\')'; - if (it.errorPath != '""') { - out += ' + ' + (it.errorPath); - } - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; - var def_callRuleValidate = out; - out = $$outStack.pop(); - if ($rDef.errors === false) { - out += ' ' + ($valid) + ' = '; - if ($asyncKeyword) { - out += 'await '; - } - out += '' + (def_callRuleValidate) + '; '; - } else { - if ($asyncKeyword) { - $ruleErrs = 'customErrors' + $lvl; - out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; - } else { - out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; - } - } - } - if ($rDef.modifying) { - out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; - } - out += '' + ($closingBraces); - if ($rDef.valid) { - if ($breakOnError) { - out += ' if (true) { '; - } - } else { - out += ' if ( '; - if ($rDef.valid === undefined) { - out += ' !'; - if ($macro) { - out += '' + ($nextValid); - } else { - out += '' + ($valid); - } - } else { - out += ' ' + (!$rDef.valid) + ' '; - } - out += ') { '; - $errorKeyword = $rule.keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - var def_customError = out; - out = $$outStack.pop(); - if ($inline) { - if ($rDef.errors) { - if ($rDef.errors != 'full') { - out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + ' 0) { + cmdStr += ' '; + let first = true; + for (const key in this.properties) { + if (this.properties.hasOwnProperty(key)) { + const val = this.properties[key]; + if (val) { + if (first) { + first = false; + } + else { + cmdStr += ','; + } + cmdStr += `${key}=${escapeProperty(val)}`; + } + } + } + } + cmdStr += `${CMD_STRING}${escapeData(this.message)}`; + return cmdStr; } - } - return out; } - +function escapeData(s) { + return utils_1.toCommandValue(s) + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A'); +} +function escapeProperty(s) { + return utils_1.toCommandValue(s) + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A') + .replace(/:/g, '%3A') + .replace(/,/g, '%2C'); +} +//# sourceMappingURL=command.js.map /***/ }), -/* 11 */, -/* 12 */, -/* 13 */, -/* 14 */, -/* 15 */, -/* 16 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; -/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */ +/***/ 42186: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { -const jsonParser = __webpack_require__(882); -const yamlParser = __webpack_require__(996); -const textParser = __webpack_require__(97); -const binaryParser = __webpack_require__(133); -const fileResolver = __webpack_require__(524); -const httpResolver = __webpack_require__(335); - -module.exports = $RefParserOptions; +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const command_1 = __webpack_require__(87351); +const file_command_1 = __webpack_require__(717); +const utils_1 = __webpack_require__(5278); +const os = __importStar(__webpack_require__(12087)); +const path = __importStar(__webpack_require__(85622)); /** - * Options that determine how JSON schemas are parsed, resolved, and dereferenced. - * - * @param {object|$RefParserOptions} [options] - Overridden options - * @constructor + * The code to exit an action */ -function $RefParserOptions (options) { - merge(this, $RefParserOptions.defaults); - merge(this, options); -} - -$RefParserOptions.defaults = { - /** - * Determines how different types of files will be parsed. - * - * You can add additional parsers of your own, replace an existing one with - * your own implemenation, or disable any parser by setting it to false. - */ - parse: { - json: jsonParser, - yaml: yamlParser, - text: textParser, - binary: binaryParser, - }, - - /** - * Determines how JSON References will be resolved. - * - * You can add additional resolvers of your own, replace an existing one with - * your own implemenation, or disable any resolver by setting it to false. - */ - resolve: { - file: fileResolver, - http: httpResolver, - +var ExitCode; +(function (ExitCode) { /** - * Determines whether external $ref pointers will be resolved. - * If this option is disabled, then none of above resolvers will be called. - * Instead, external $ref pointers will simply be ignored. - * - * @type {boolean} + * A code indicating that the action was successful */ - external: true, - }, - - /** - * Determines the types of JSON references that are allowed. - */ - dereference: { + ExitCode[ExitCode["Success"] = 0] = "Success"; /** - * Dereference circular (recursive) JSON references? - * If false, then a {@link ReferenceError} will be thrown if a circular reference is found. - * If "ignore", then circular references will not be dereferenced. - * - * @type {boolean|string} + * A code indicating that the action was a failure */ - circular: true - }, -}; - + ExitCode[ExitCode["Failure"] = 1] = "Failure"; +})(ExitCode = exports.ExitCode || (exports.ExitCode = {})); +//----------------------------------------------------------------------- +// Variables +//----------------------------------------------------------------------- /** - * Merges the properties of the source object into the target object. - * - * @param {object} target - The object that we're populating - * @param {?object} source - The options that are being merged - * @returns {object} + * Sets env variable for this action and future actions in the job + * @param name the name of the variable to set + * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify */ -function merge (target, source) { - if (isMergeable(source)) { - let keys = Object.keys(source); - for (let i = 0; i < keys.length; i++) { - let key = keys[i]; - let sourceSetting = source[key]; - let targetSetting = target[key]; - - if (isMergeable(sourceSetting)) { - // It's a nested object, so merge it recursively - target[key] = merge(targetSetting || {}, sourceSetting); - } - else if (sourceSetting !== undefined) { - // It's a scalar value, function, or array. No merging necessary. Just overwrite the target value. - target[key] = sourceSetting; - } +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function exportVariable(name, val) { + const convertedVal = utils_1.toCommandValue(val); + process.env[name] = convertedVal; + const filePath = process.env['GITHUB_ENV'] || ''; + if (filePath) { + const delimiter = '_GitHubActionsFileCommandDelimeter_'; + const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`; + file_command_1.issueCommand('ENV', commandValue); + } + else { + command_1.issueCommand('set-env', { name }, convertedVal); } - } - return target; } - +exports.exportVariable = exportVariable; /** - * Determines whether the given value can be merged, - * or if it is a scalar value that should just override the target value. - * - * @param {*} val - * @returns {Boolean} + * Registers a secret which will get masked from logs + * @param secret value of the secret */ -function isMergeable (val) { - return val && - (typeof val === "object") && - !Array.isArray(val) && - !(val instanceof RegExp) && - !(val instanceof Date); +function setSecret(secret) { + command_1.issueCommand('add-mask', {}, secret); } - - -/***/ }), -/* 17 */, -/* 18 */ -/***/ (function() { - -eval("require")("encoding"); - - -/***/ }), -/* 19 */, -/* 20 */, -/* 21 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const newline = /\r?\n/; -const onoCall = /\bono[ @]/; +exports.setSecret = setSecret; /** - * Is the property lazily computed? + * Prepends inputPath to the PATH (for this action and future actions) + * @param inputPath */ -function isLazyStack(stackProp) { - return Boolean(stackProp && - stackProp.configurable && - typeof stackProp.get === "function"); +function addPath(inputPath) { + const filePath = process.env['GITHUB_PATH'] || ''; + if (filePath) { + file_command_1.issueCommand('PATH', inputPath); + } + else { + command_1.issueCommand('add-path', {}, inputPath); + } + process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`; } -exports.isLazyStack = isLazyStack; +exports.addPath = addPath; /** - * Is the stack property writable? + * Gets the value of an input. The value is also trimmed. + * + * @param name name of the input to get + * @param options optional. See InputOptions. + * @returns string */ -function isWritableStack(stackProp) { - return Boolean( - // If there is no stack property, then it's writable, since assigning it will create it - !stackProp || - stackProp.writable || - typeof stackProp.set === "function"); +function getInput(name, options) { + const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || ''; + if (options && options.required && !val) { + throw new Error(`Input required and not supplied: ${name}`); + } + return val.trim(); } -exports.isWritableStack = isWritableStack; +exports.getInput = getInput; /** - * Appends the original `Error.stack` property to the new Error's stack. + * Sets the value of an output. + * + * @param name name of the output to set + * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ -function joinStacks(newError, originalError) { - let newStack = popStack(newError.stack); - let originalStack = originalError ? originalError.stack : undefined; - if (newStack && originalStack) { - return newStack + "\n\n" + originalStack; - } - else { - return newStack || originalStack; - } +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function setOutput(name, value) { + command_1.issueCommand('set-output', { name }, value); } -exports.joinStacks = joinStacks; +exports.setOutput = setOutput; /** - * Calls `joinStacks` lazily, when the `Error.stack` property is accessed. + * Enables or disables the echoing of commands into stdout for the rest of the step. + * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set. + * */ -function lazyJoinStacks(lazyStack, newError, originalError) { - if (originalError) { - Object.defineProperty(newError, "stack", { - get: () => { - let newStack = lazyStack.get.apply(newError); - return joinStacks({ stack: newStack }, originalError); - }, - enumerable: false, - configurable: true - }); - } - else { - lazyPopStack(newError, lazyStack); - } +function setCommandEcho(enabled) { + command_1.issue('echo', enabled ? 'on' : 'off'); } -exports.lazyJoinStacks = lazyJoinStacks; +exports.setCommandEcho = setCommandEcho; +//----------------------------------------------------------------------- +// Results +//----------------------------------------------------------------------- /** - * Removes Ono from the stack, so that the stack starts at the original error location + * Sets the action status to failed. + * When the action exits it will be with an exit code of 1 + * @param message add error issue message */ -function popStack(stack) { - if (stack) { - let lines = stack.split(newline); - // Find the Ono call(s) in the stack, and remove them - let onoStart; - for (let i = 0; i < lines.length; i++) { - let line = lines[i]; - if (onoCall.test(line)) { - if (onoStart === undefined) { - // We found the first Ono call in the stack trace. - // There may be other subsequent Ono calls as well. - onoStart = i; - } - } - else if (onoStart !== undefined) { - // We found the first non-Ono call after one or more Ono calls. - // So remove the Ono call lines from the stack trace - lines.splice(onoStart, i - onoStart); - break; - } +function setFailed(message) { + process.exitCode = ExitCode.Failure; + error(message); +} +exports.setFailed = setFailed; +//----------------------------------------------------------------------- +// Logging Commands +//----------------------------------------------------------------------- +/** + * Gets whether Actions Step Debug is on or not + */ +function isDebug() { + return process.env['RUNNER_DEBUG'] === '1'; +} +exports.isDebug = isDebug; +/** + * Writes debug message to user log + * @param message debug message + */ +function debug(message) { + command_1.issueCommand('debug', {}, message); +} +exports.debug = debug; +/** + * Adds an error issue + * @param message error issue message. Errors will be converted to string via toString() + */ +function error(message) { + command_1.issue('error', message instanceof Error ? message.toString() : message); +} +exports.error = error; +/** + * Adds an warning issue + * @param message warning issue message. Errors will be converted to string via toString() + */ +function warning(message) { + command_1.issue('warning', message instanceof Error ? message.toString() : message); +} +exports.warning = warning; +/** + * Writes info to log with console.log. + * @param message info message + */ +function info(message) { + process.stdout.write(message + os.EOL); +} +exports.info = info; +/** + * Begin an output group. + * + * Output until the next `groupEnd` will be foldable in this group + * + * @param name The name of the output group + */ +function startGroup(name) { + command_1.issue('group', name); +} +exports.startGroup = startGroup; +/** + * End an output group. + */ +function endGroup() { + command_1.issue('endgroup'); +} +exports.endGroup = endGroup; +/** + * Wrap an asynchronous function call in a group. + * + * Returns the same type as the function itself. + * + * @param name The name of the group + * @param fn The function to wrap in the group + */ +function group(name, fn) { + return __awaiter(this, void 0, void 0, function* () { + startGroup(name); + let result; + try { + result = yield fn(); } - if (lines.length > 0) { - return lines.join("\n"); + finally { + endGroup(); } - } - // If we get here, then the stack doesn't contain a call to `ono`. - // This may be due to minification or some optimization of the JS engine. - // So just return the stack as-is. - return stack; + return result; + }); } +exports.group = group; +//----------------------------------------------------------------------- +// Wrapper action state +//----------------------------------------------------------------------- /** - * Calls `popStack` lazily, when the `Error.stack` property is accessed. + * Saves state for current action, the state can only be retrieved by this action's post job execution. + * + * @param name name of the state to store + * @param value value to store. Non-string values will be converted to a string via JSON.stringify */ -function lazyPopStack(error, lazyStack) { - Object.defineProperty(error, "stack", { - get: () => popStack(lazyStack.get.apply(error)), - enumerable: false, - configurable: true - }); +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function saveState(name, value) { + command_1.issueCommand('save-state', { name }, value); } -//# sourceMappingURL=stack.js.map +exports.saveState = saveState; +/** + * Gets the value of an state set by this action's main execution. + * + * @param name name of the state to get + * @returns string + */ +function getState(name) { + return process.env[`STATE_${name}`] || ''; +} +exports.getState = getState; +//# sourceMappingURL=core.js.map /***/ }), -/* 22 */, -/* 23 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; -// Standard YAML's JSON schema. -// http://www.yaml.org/spec/1.2/spec.html#id2803231 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, this schema is not such strict as defined in the YAML specification. -// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. - +/***/ 717: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +"use strict"; +// For internal use, subject to change. +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +const fs = __importStar(__webpack_require__(35747)); +const os = __importStar(__webpack_require__(12087)); +const utils_1 = __webpack_require__(5278); +function issueCommand(command, message) { + const filePath = process.env[`GITHUB_${command}`]; + if (!filePath) { + throw new Error(`Unable to find environment variable for file command ${command}`); + } + if (!fs.existsSync(filePath)) { + throw new Error(`Missing file at path: ${filePath}`); + } + fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, { + encoding: 'utf8' + }); +} +exports.issueCommand = issueCommand; +//# sourceMappingURL=file-command.js.map -var Schema = __webpack_require__(43); +/***/ }), +/***/ 5278: +/***/ ((__unused_webpack_module, exports) => { -module.exports = new Schema({ - include: [ - __webpack_require__(581) - ], - implicit: [ - __webpack_require__(809), - __webpack_require__(228), - __webpack_require__(44), - __webpack_require__(312) - ] -}); +"use strict"; +// We use any as a valid input type +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +/** + * Sanitizes an input into a string so it can be passed into issueCommand safely + * @param input input to sanitize into a string + */ +function toCommandValue(input) { + if (input === null || input === undefined) { + return ''; + } + else if (typeof input === 'string' || input instanceof String) { + return input; + } + return JSON.stringify(input); +} +exports.toCommandValue = toCommandValue; +//# sourceMappingURL=utils.js.map /***/ }), -/* 24 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + +/***/ 53113: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -const { ono } = __webpack_require__(114); -const $Ref = __webpack_require__(289); -const url = __webpack_require__(639); +const $Ref = __webpack_require__(59825); +const Pointer = __webpack_require__(26040); +const url = __webpack_require__(81279); -module.exports = $Refs; +module.exports = bundle; /** - * This class is a map of JSON references and their resolved values. + * Bundles all external JSON references into the main JSON schema, thus resulting in a schema that + * only has *internal* references, not any *external* references. + * This method mutates the JSON schema object, adding new references and re-mapping existing ones. + * + * @param {$RefParser} parser + * @param {$RefParserOptions} options */ -function $Refs () { - /** - * Indicates whether the schema contains any circular references. - * - * @type {boolean} - */ - this.circular = false; +function bundle (parser, options) { + // console.log('Bundling $ref pointers in %s', parser.$refs._root$Ref.path); - /** - * A map of paths/urls to {@link $Ref} objects - * - * @type {object} - * @protected - */ - this._$refs = {}; + // Build an inventory of all $ref pointers in the JSON Schema + let inventory = []; + crawl(parser, "schema", parser.$refs._root$Ref.path + "#", "#", 0, inventory, parser.$refs, options); - /** - * The {@link $Ref} object that is the root of the JSON schema. - * - * @type {$Ref} - * @protected - */ - this._root$Ref = null; + // Remap all $ref pointers + remap(inventory); } /** - * Returns the paths of all the files/URLs that are referenced by the JSON schema, - * including the schema itself. + * Recursively crawls the given value, and inventories all JSON references. * - * @param {...string|string[]} [types] - Only return paths of the given types ("file", "http", etc.) - * @returns {string[]} + * @param {object} parent - The object containing the value to crawl. If the value is not an object or array, it will be ignored. + * @param {string} key - The property key of `parent` to be crawled + * @param {string} path - The full path of the property being crawled, possibly with a JSON Pointer in the hash + * @param {string} pathFromRoot - The path of the property being crawled, from the schema root + * @param {object[]} inventory - An array of already-inventoried $ref pointers + * @param {$Refs} $refs + * @param {$RefParserOptions} options */ -$Refs.prototype.paths = function (types) { - let paths = getPaths(this._$refs, arguments); - return paths.map((path) => { - return path.decoded; - }); -}; +function crawl (parent, key, path, pathFromRoot, indirections, inventory, $refs, options) { + let obj = key === null ? parent : parent[key]; -/** - * Returns the map of JSON references and their resolved values. - * - * @param {...string|string[]} [types] - Only return references of the given types ("file", "http", etc.) - * @returns {object} - */ -$Refs.prototype.values = function (types) { - let $refs = this._$refs; - let paths = getPaths($refs, arguments); - return paths.reduce((obj, path) => { - obj[path.decoded] = $refs[path.encoded].value; - return obj; - }, {}); -}; + if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj)) { + if ($Ref.isAllowed$Ref(obj)) { + inventory$Ref(parent, key, path, pathFromRoot, indirections, inventory, $refs, options); + } + else { + // Crawl the object in a specific order that's optimized for bundling. + // This is important because it determines how `pathFromRoot` gets built, + // which later determines which keys get dereferenced and which ones get remapped + let keys = Object.keys(obj) + .sort((a, b) => { + // Most people will expect references to be bundled into the the "definitions" property, + // so we always crawl that property first, if it exists. + if (a === "definitions") { + return -1; + } + else if (b === "definitions") { + return 1; + } + else { + // Otherwise, crawl the keys based on their length. + // This produces the shortest possible bundled references + return a.length - b.length; + } + }); -/** - * Returns a POJO (plain old JavaScript object) for serialization as JSON. - * - * @returns {object} - */ -$Refs.prototype.toJSON = $Refs.prototype.values; + // eslint-disable-next-line no-shadow + for (let key of keys) { + let keyPath = Pointer.join(path, key); + let keyPathFromRoot = Pointer.join(pathFromRoot, key); + let value = obj[key]; -/** - * Determines whether the given JSON reference exists. - * - * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash - * @param {$RefParserOptions} [options] - * @returns {boolean} - */ -$Refs.prototype.exists = function (path, options) { - try { - this._resolve(path, options); - return true; - } - catch (e) { - return false; + if ($Ref.isAllowed$Ref(value)) { + inventory$Ref(obj, key, path, keyPathFromRoot, indirections, inventory, $refs, options); + } + else { + crawl(obj, key, keyPath, keyPathFromRoot, indirections, inventory, $refs, options); + } + } + } } -}; +} /** - * Resolves the given JSON reference and returns the resolved value. + * Inventories the given JSON Reference (i.e. records detailed information about it so we can + * optimize all $refs in the schema), and then crawls the resolved value. * - * @param {string} path - The path being resolved, with a JSON pointer in the hash - * @param {$RefParserOptions} [options] - * @returns {*} - Returns the resolved value + * @param {object} $refParent - The object that contains a JSON Reference as one of its keys + * @param {string} $refKey - The key in `$refParent` that is a JSON Reference + * @param {string} path - The full path of the JSON Reference at `$refKey`, possibly with a JSON Pointer in the hash + * @param {string} pathFromRoot - The path of the JSON Reference at `$refKey`, from the schema root + * @param {object[]} inventory - An array of already-inventoried $ref pointers + * @param {$Refs} $refs + * @param {$RefParserOptions} options */ -$Refs.prototype.get = function (path, options) { - return this._resolve(path, options).value; -}; +function inventory$Ref ($refParent, $refKey, path, pathFromRoot, indirections, inventory, $refs, options) { + let $ref = $refKey === null ? $refParent : $refParent[$refKey]; + let $refPath = url.resolve(path, $ref.$ref); + let pointer = $refs._resolve($refPath, pathFromRoot, options); + if (pointer === null) { + return; + } -/** - * Sets the value of a nested property within this {@link $Ref#value}. - * If the property, or any of its parents don't exist, they will be created. - * - * @param {string} path - The path of the property to set, optionally with a JSON pointer in the hash - * @param {*} value - The value to assign - */ -$Refs.prototype.set = function (path, value) { - let absPath = url.resolve(this._root$Ref.path, path); - let withoutHash = url.stripHash(absPath); - let $ref = this._$refs[withoutHash]; + let depth = Pointer.parse(pathFromRoot).length; + let file = url.stripHash(pointer.path); + let hash = url.getHash(pointer.path); + let external = file !== $refs._root$Ref.path; + let extended = $Ref.isExtended$Ref($ref); + indirections += pointer.indirections; - if (!$ref) { - throw ono(`Error resolving $ref pointer "${path}". \n"${withoutHash}" not found.`); + let existingEntry = findInInventory(inventory, $refParent, $refKey); + if (existingEntry) { + // This $Ref has already been inventoried, so we don't need to process it again + if (depth < existingEntry.depth || indirections < existingEntry.indirections) { + removeFromInventory(inventory, existingEntry); + } + else { + return; + } } - $ref.set(absPath, value); -}; + inventory.push({ + $ref, // The JSON Reference (e.g. {$ref: string}) + parent: $refParent, // The object that contains this $ref pointer + key: $refKey, // The key in `parent` that is the $ref pointer + pathFromRoot, // The path to the $ref pointer, from the JSON Schema root + depth, // How far from the JSON Schema root is this $ref pointer? + file, // The file that the $ref pointer resolves to + hash, // The hash within `file` that the $ref pointer resolves to + value: pointer.value, // The resolved value of the $ref pointer + circular: pointer.circular, // Is this $ref pointer DIRECTLY circular? (i.e. it references itself) + extended, // Does this $ref extend its resolved value? (i.e. it has extra properties, in addition to "$ref") + external, // Does this $ref pointer point to a file other than the main JSON Schema file? + indirections, // The number of indirect references that were traversed to resolve the value + }); + + // Recursively crawl the resolved value + if (!existingEntry) { + crawl(pointer.value, null, pointer.path, pathFromRoot, indirections + 1, inventory, $refs, options); + } +} /** - * Creates a new {@link $Ref} object and adds it to this {@link $Refs} object. + * Re-maps every $ref pointer, so that they're all relative to the root of the JSON Schema. + * Each referenced value is dereferenced EXACTLY ONCE. All subsequent references to the same + * value are re-mapped to point to the first reference. * - * @param {string} path - The file path or URL of the referenced file + * @example: + * { + * first: { $ref: somefile.json#/some/part }, + * second: { $ref: somefile.json#/another/part }, + * third: { $ref: somefile.json }, + * fourth: { $ref: somefile.json#/some/part/sub/part } + * } + * + * In this example, there are four references to the same file, but since the third reference points + * to the ENTIRE file, that's the only one we need to dereference. The other three can just be + * remapped to point inside the third one. + * + * On the other hand, if the third reference DIDN'T exist, then the first and second would both need + * to be dereferenced, since they point to different parts of the file. The fourth reference does NOT + * need to be dereferenced, because it can be remapped to point inside the first one. + * + * @param {object[]} inventory */ -$Refs.prototype._add = function (path) { - let withoutHash = url.stripHash(path); +function remap (inventory) { + // Group & sort all the $ref pointers, so they're in the order that we need to dereference/remap them + inventory.sort((a, b) => { + if (a.file !== b.file) { + // Group all the $refs that point to the same file + return a.file < b.file ? -1 : +1; + } + else if (a.hash !== b.hash) { + // Group all the $refs that point to the same part of the file + return a.hash < b.hash ? -1 : +1; + } + else if (a.circular !== b.circular) { + // If the $ref points to itself, then sort it higher than other $refs that point to this $ref + return a.circular ? -1 : +1; + } + else if (a.extended !== b.extended) { + // If the $ref extends the resolved value, then sort it lower than other $refs that don't extend the value + return a.extended ? +1 : -1; + } + else if (a.indirections !== b.indirections) { + // Sort direct references higher than indirect references + return a.indirections - b.indirections; + } + else if (a.depth !== b.depth) { + // Sort $refs by how close they are to the JSON Schema root + return a.depth - b.depth; + } + else { + // Determine how far each $ref is from the "definitions" property. + // Most people will expect references to be bundled into the the "definitions" property if possible. + let aDefinitionsIndex = a.pathFromRoot.lastIndexOf("/definitions"); + let bDefinitionsIndex = b.pathFromRoot.lastIndexOf("/definitions"); - let $ref = new $Ref(); - $ref.path = withoutHash; - $ref.$refs = this; + if (aDefinitionsIndex !== bDefinitionsIndex) { + // Give higher priority to the $ref that's closer to the "definitions" property + return bDefinitionsIndex - aDefinitionsIndex; + } + else { + // All else is equal, so use the shorter path, which will produce the shortest possible reference + return a.pathFromRoot.length - b.pathFromRoot.length; + } + } + }); - this._$refs[withoutHash] = $ref; - this._root$Ref = this._root$Ref || $ref; + let file, hash, pathFromRoot; + for (let entry of inventory) { + // console.log('Re-mapping $ref pointer "%s" at %s', entry.$ref.$ref, entry.pathFromRoot); - return $ref; -}; + if (!entry.external) { + // This $ref already resolves to the main JSON Schema file + entry.$ref.$ref = entry.hash; + } + else if (entry.file === file && entry.hash === hash) { + // This $ref points to the same value as the prevous $ref, so remap it to the same path + entry.$ref.$ref = pathFromRoot; + } + else if (entry.file === file && entry.hash.indexOf(hash + "/") === 0) { + // This $ref points to a sub-value of the prevous $ref, so remap it beneath that path + entry.$ref.$ref = Pointer.join(pathFromRoot, Pointer.parse(entry.hash.replace(hash, "#"))); + } + else { + // We've moved to a new file or new hash + file = entry.file; + hash = entry.hash; + pathFromRoot = entry.pathFromRoot; + + // This is the first $ref to point to this value, so dereference the value. + // Any other $refs that point to the same value will point to this $ref instead + entry.$ref = entry.parent[entry.key] = $Ref.dereference(entry.$ref, entry.value); + + if (entry.circular) { + // This $ref points to itself + entry.$ref.$ref = entry.pathFromRoot; + } + } + + // console.log(' new value: %s', (entry.$ref && entry.$ref.$ref) ? entry.$ref.$ref : '[object Object]'); + } +} /** - * Resolves the given JSON reference. - * - * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash - * @param {$RefParserOptions} [options] - * @returns {Pointer} - * @protected + * TODO */ -$Refs.prototype._resolve = function (path, options) { - let absPath = url.resolve(this._root$Ref.path, path); - let withoutHash = url.stripHash(absPath); - let $ref = this._$refs[withoutHash]; - - if (!$ref) { - throw ono(`Error resolving $ref pointer "${path}". \n"${withoutHash}" not found.`); +function findInInventory (inventory, $refParent, $refKey) { + for (let i = 0; i < inventory.length; i++) { + let existingEntry = inventory[i]; + if (existingEntry.parent === $refParent && existingEntry.key === $refKey) { + return existingEntry; + } } +} - return $ref.resolve(absPath, options, path); -}; +function removeFromInventory (inventory, entry) { + let index = inventory.indexOf(entry); + inventory.splice(index, 1); +} + + +/***/ }), + +/***/ 82461: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const $Ref = __webpack_require__(59825); +const Pointer = __webpack_require__(26040); +const { ono } = __webpack_require__(33436); +const url = __webpack_require__(81279); + +module.exports = dereference; /** - * Returns the specified {@link $Ref} object, or undefined. + * Crawls the JSON schema, finds all JSON references, and dereferences them. + * This method mutates the JSON schema object, replacing JSON references with their resolved value. * - * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash - * @returns {$Ref|undefined} - * @protected + * @param {$RefParser} parser + * @param {$RefParserOptions} options */ -$Refs.prototype._get$Ref = function (path) { - path = url.resolve(this._root$Ref.path, path); - let withoutHash = url.stripHash(path); - return this._$refs[withoutHash]; -}; +function dereference (parser, options) { + // console.log('Dereferencing $ref pointers in %s', parser.$refs._root$Ref.path); + let dereferenced = crawl(parser.schema, parser.$refs._root$Ref.path, "#", [], parser.$refs, options); + parser.$refs.circular = dereferenced.circular; + parser.schema = dereferenced.value; +} /** - * Returns the encoded and decoded paths keys of the given object. + * Recursively crawls the given value, and dereferences any JSON references. * - * @param {object} $refs - The object whose keys are URL-encoded paths - * @param {...string|string[]} [types] - Only return paths of the given types ("file", "http", etc.) - * @returns {object[]} + * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored. + * @param {string} path - The full path of `obj`, possibly with a JSON Pointer in the hash + * @param {string} pathFromRoot - The path of `obj` from the schema root + * @param {object[]} parents - An array of the parent objects that have already been dereferenced + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * @returns {{value: object, circular: boolean}} */ -function getPaths ($refs, types) { - let paths = Object.keys($refs); +function crawl (obj, path, pathFromRoot, parents, $refs, options) { + let dereferenced; + let result = { + value: obj, + circular: false + }; - // Filter the paths by type - types = Array.isArray(types[0]) ? types[0] : Array.prototype.slice.call(types); - if (types.length > 0 && types[0]) { - paths = paths.filter((key) => { - return types.indexOf($refs[key].pathType) !== -1; - }); - } + if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj)) { + parents.push(obj); - // Decode local filesystem paths - return paths.map((path) => { - return { - encoded: path, - decoded: $refs[path].pathType === "file" ? url.toFileSystemPath(path, true) : path - }; - }); -} + if ($Ref.isAllowed$Ref(obj, options)) { + dereferenced = dereference$Ref(obj, path, pathFromRoot, parents, $refs, options); + result.circular = dereferenced.circular; + result.value = dereferenced.value; + } + else { + for (let key of Object.keys(obj)) { + let keyPath = Pointer.join(path, key); + let keyPathFromRoot = Pointer.join(pathFromRoot, key); + let value = obj[key]; + let circular = false; + if ($Ref.isAllowed$Ref(value, options)) { + dereferenced = dereference$Ref(value, keyPath, keyPathFromRoot, parents, $refs, options); + circular = dereferenced.circular; + // Avoid pointless mutations; breaks frozen objects to no profit + if (obj[key] !== dereferenced.value) { + obj[key] = dereferenced.value; + } + } + else { + if (parents.indexOf(value) === -1) { + dereferenced = crawl(value, keyPath, keyPathFromRoot, parents, $refs, options); + circular = dereferenced.circular; + // Avoid pointless mutations; breaks frozen objects to no profit + if (obj[key] !== dereferenced.value) { + obj[key] = dereferenced.value; + } + } + else { + circular = foundCircularReference(keyPath, $refs, options); + } + } -/***/ }), -/* 25 */ -/***/ (function(module) { + // Set the "isCircular" flag if this or any other property is circular + result.circular = result.circular || circular; + } + } + parents.pop(); + } -module.exports = function deferred () { - var d = {}; - d.promise = new Promise(function (resolve, reject) { - d.resolve = resolve; - d.reject = reject - }); + return result; +} - return d; -}; +/** + * Dereferences the given JSON Reference, and then crawls the resulting value. + * + * @param {{$ref: string}} $ref - The JSON Reference to resolve + * @param {string} path - The full path of `$ref`, possibly with a JSON Pointer in the hash + * @param {string} pathFromRoot - The path of `$ref` from the schema root + * @param {object[]} parents - An array of the parent objects that have already been dereferenced + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * @returns {{value: object, circular: boolean}} + */ +function dereference$Ref ($ref, path, pathFromRoot, parents, $refs, options) { + // console.log('Dereferencing $ref pointer "%s" at %s', $ref.$ref, path); + let $refPath = url.resolve(path, $ref.$ref); + let pointer = $refs._resolve($refPath, path, options); -/***/ }), -/* 26 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + if (pointer === null) { + return { + circular: false, + value: null, + }; + } -const Base = __webpack_require__(31); + // Check for circular references + let directCircular = pointer.circular; + let circular = directCircular || parents.indexOf(pointer.value) !== -1; + circular && foundCircularReference(path, $refs, options); -/** - * Implements functions to deal with a ServerSecurityRequirement object. - * @class - * @extends Base - * @returns {ServerSecurityRequirement} - */ -class ServerSecurityRequirement extends Base { -} + // Dereference the JSON reference + let dereferencedValue = $Ref.dereference($ref, pointer.value); -module.exports = ServerSecurityRequirement; + // Crawl the dereferenced value (unless it's circular) + if (!circular) { + // Determine if the dereferenced value is circular + let dereferenced = crawl(dereferencedValue, pointer.path, pathFromRoot, parents, $refs, options); + circular = dereferenced.circular; + dereferencedValue = dereferenced.value; + } + if (circular && !directCircular && options.dereference.circular === "ignore") { + // The user has chosen to "ignore" circular references, so don't change the value + dereferencedValue = $ref; + } -/***/ }), -/* 27 */, -/* 28 */ -/***/ (function(module) { + if (directCircular) { + // The pointer is a DIRECT circular reference (i.e. it references itself). + // So replace the $ref path with the absolute path from the JSON Schema root + dereferencedValue.$ref = pathFromRoot; + } -"use strict"; + return { + circular, + value: dereferencedValue + }; +} -module.exports = function generate_comment(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $comment = it.util.toQuotedString($schema); - if (it.opts.$comment === true) { - out += ' console.log(' + ($comment) + ');'; - } else if (typeof it.opts.$comment == 'function') { - out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);'; +/** + * Called when a circular reference is found. + * It sets the {@link $Refs#circular} flag, and throws an error if options.dereference.circular is false. + * + * @param {string} keyPath - The JSON Reference path of the circular reference + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * @returns {boolean} - always returns true, to indicate that a circular reference was found + */ +function foundCircularReference (keyPath, $refs, options) { + $refs.circular = true; + if (!options.dereference.circular) { + throw ono.reference(`Circular $ref pointer found at ${keyPath}`); } - return out; + return true; } /***/ }), -/* 29 */, -/* 30 */ -/***/ (function(module) { -"use strict"; +/***/ 85862: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate_required(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $vSchema = 'schema' + $lvl; - if (!$isData) { - if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) { - var $required = []; - var arr1 = $schema; - if (arr1) { - var $property, i1 = -1, - l1 = arr1.length - 1; - while (i1 < l1) { - $property = arr1[i1 += 1]; - var $propertySch = it.schema.properties[$property]; - if (!($propertySch && it.util.schemaHasRules($propertySch, it.RULES.all))) { - $required[$required.length] = $property; - } - } - } - } else { - var $required = $schema; - } - } - if ($isData || $required.length) { - var $currentErrorPath = it.errorPath, - $loopRequired = $isData || $required.length >= it.opts.loopRequired, - $ownProperties = it.opts.ownProperties; - if ($breakOnError) { - out += ' var missing' + ($lvl) + '; '; - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - out += ' var ' + ($valid) + ' = true; '; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += '; if (!' + ($valid) + ') break; } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } else { - out += ' if ( '; - var arr2 = $required; - if (arr2) { - var $propertyKey, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $propertyKey = arr2[$i += 1]; - if ($i) { - out += ' || '; - } - var $prop = it.util.getProperty($propertyKey), - $useData = $data + $prop; - out += ' ( ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; - } - } - out += ') { '; - var $propertyPath = 'missing' + $lvl, - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } - } else { - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - if ($isData) { - out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { '; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } '; - if ($isData) { - out += ' } '; - } - } else { - var arr3 = $required; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $prop = it.util.getProperty($propertyKey), - $missingProperty = it.util.escapeQuotes($propertyKey), - $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; - } - } - } - } - it.errorPath = $currentErrorPath; - } else if ($breakOnError) { - out += ' if (true) {'; - } - return out; -} +"use strict"; +/* eslint-disable no-unused-vars */ -/***/ }), -/* 31 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +const $Refs = __webpack_require__(40957); +const _parse = __webpack_require__(52430); +const normalizeArgs = __webpack_require__(64608); +const resolveExternal = __webpack_require__(45330); +const _bundle = __webpack_require__(53113); +const _dereference = __webpack_require__(82461); +const url = __webpack_require__(81279); +const { JSONParserError, InvalidPointerError, MissingPointerError, ResolverError, ParserError, UnmatchedParserError, UnmatchedResolverError, isHandledError, JSONParserErrorGroup } = __webpack_require__(1695); +const maybe = __webpack_require__(59581); +const { ono } = __webpack_require__(33436); -const ParserError = __webpack_require__(59); +module.exports = $RefParser; +module.exports.default = $RefParser; +module.exports.JSONParserError = JSONParserError; +module.exports.InvalidPointerError = InvalidPointerError; +module.exports.MissingPointerError = MissingPointerError; +module.exports.ResolverError = ResolverError; +module.exports.ParserError = ParserError; +module.exports.UnmatchedParserError = UnmatchedParserError; +module.exports.UnmatchedResolverError = UnmatchedResolverError; /** - * Implements common functionality for all the models. - * @class - * @returns {Base} + * This class parses a JSON schema, builds a map of its JSON references and their resolved values, + * and provides methods for traversing, manipulating, and dereferencing those references. + * + * @constructor */ -class Base { - constructor (json) { - if (!json) throw new ParserError(`Invalid JSON to instantiate the ${this.constructor.name} object.`); - this._json = json; - } +function $RefParser () { + /** + * The parsed (and possibly dereferenced) JSON schema object + * + * @type {object} + * @readonly + */ + this.schema = null; /** - * @returns {Any} + * The resolved JSON references + * + * @type {$Refs} + * @readonly */ - json(key) { - if (key === undefined) return this._json; - if (!this._json) return; - return this._json[key]; - } + this.$refs = new $Refs(); } -module.exports = Base; - - -/***/ }), -/* 32 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/** + * Parses the given JSON schema. + * This method does not resolve any JSON references. + * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object. + * + * @param {string} [path] - The file path or URL of the JSON schema + * @param {object} [schema] - A JSON schema object. This object will be used instead of reading from `path`. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed + * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object. + * @returns {Promise} - The returned promise resolves with the parsed JSON schema object. + */ +$RefParser.parse = function parse (path, schema, options, callback) { + let Class = this; // eslint-disable-line consistent-this + let instance = new Class(); + return instance.parse.apply(instance, arguments); +}; -"use strict"; +/** + * Parses the given JSON schema. + * This method does not resolve any JSON references. + * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object. + * + * @param {string} [path] - The file path or URL of the JSON schema + * @param {object} [schema] - A JSON schema object. This object will be used instead of reading from `path`. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed + * @param {function} [callback] - An error-first callback. The second parameter is the parsed JSON schema object. + * @returns {Promise} - The returned promise resolves with the parsed JSON schema object. + */ +$RefParser.prototype.parse = async function parse (path, schema, options, callback) { + let args = normalizeArgs(arguments); + let promise; + if (!args.path && !args.schema) { + let err = ono(`Expected a file path, URL, or object. Got ${args.path || args.schema}`); + return maybe(args.callback, Promise.reject(err)); + } -const fs = __webpack_require__(747); -const sysPath = __webpack_require__(622); -const { promisify } = __webpack_require__(669); - -let fsevents; -try { - fsevents = __webpack_require__(399); -} catch (error) { - if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error); -} + // Reset everything + this.schema = null; + this.$refs = new $Refs(); -if (fsevents) { - // TODO: real check - const mtch = process.version.match(/v(\d+)\.(\d+)/); - if (mtch && mtch[1] && mtch[2]) { - const maj = Number.parseInt(mtch[1], 10); - const min = Number.parseInt(mtch[2], 10); - if (maj === 8 && min < 16) { - fsevents = undefined; - } + // If the path is a filesystem path, then convert it to a URL. + // NOTE: According to the JSON Reference spec, these should already be URLs, + // but, in practice, many people use local filesystem paths instead. + // So we're being generous here and doing the conversion automatically. + // This is not intended to be a 100% bulletproof solution. + // If it doesn't work for your use-case, then use a URL instead. + let pathType = "http"; + if (url.isFileSystemPath(args.path)) { + args.path = url.fromFileSystemPath(args.path); + pathType = "file"; } -} -const { - EV_ADD, - EV_CHANGE, - EV_ADD_DIR, - EV_UNLINK, - EV_ERROR, - STR_DATA, - STR_END, - FSEVENT_CREATED, - FSEVENT_MODIFIED, - FSEVENT_DELETED, - FSEVENT_MOVED, - // FSEVENT_CLONED, - FSEVENT_UNKNOWN, - FSEVENT_TYPE_DIRECTORY, - FSEVENT_TYPE_SYMLINK, + // Resolve the absolute path of the schema + args.path = url.resolve(url.cwd(), args.path); - ROOT_GLOBSTAR, - DIR_SUFFIX, - DOT_SLASH, - FUNCTION_TYPE, - EMPTY_FN, - IDENTITY_FN -} = __webpack_require__(677); -const FS_MODE_READ = 'r'; + if (args.schema && typeof args.schema === "object") { + // A schema object was passed-in. + // So immediately add a new $Ref with the schema object as its value + let $ref = this.$refs._add(args.path); + $ref.value = args.schema; + $ref.pathType = pathType; + promise = Promise.resolve(args.schema); + } + else { + // Parse the schema file/url + promise = _parse(args.path, this.$refs, args.options); + } -const Depth = (value) => isNaN(value) ? {} : {depth: value}; + let me = this; + try { + let result = await promise; -const stat = promisify(fs.stat); -const open = promisify(fs.open); -const close = promisify(fs.close); -const lstat = promisify(fs.lstat); -const realpath = promisify(fs.realpath); + if (result !== null && typeof result === "object" && !Buffer.isBuffer(result)) { + me.schema = result; + return maybe(args.callback, Promise.resolve(me.schema)); + } + else if (args.options.continueOnError) { + me.schema = null; // it's already set to null at line 79, but let's set it again for the sake of readability + return maybe(args.callback, Promise.resolve(me.schema)); + } + else { + throw ono.syntax(`"${me.$refs._root$Ref.path || result}" is not a valid JSON Schema`); + } + } + catch (err) { + if (!args.options.continueOnError || !isHandledError(err)) { + return maybe(args.callback, Promise.reject(err)); + } -const statMethods = { stat, lstat }; + if (this.$refs._$refs[url.stripHash(args.path)]) { + this.$refs._$refs[url.stripHash(args.path)].addError(err); + } -/** - * @typedef {String} Path - */ + return maybe(args.callback, Promise.resolve(null)); + } +}; /** - * @typedef {Object} FsEventsWatchContainer - * @property {Set} listeners - * @property {Function} rawEmitter - * @property {{stop: Function}} watcher + * Parses the given JSON schema and resolves any JSON references, including references in + * externally-referenced files. + * + * @param {string} [path] - The file path or URL of the JSON schema + * @param {object} [schema] - A JSON schema object. This object will be used instead of reading from `path`. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved + * @param {function} [callback] + * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references + * + * @returns {Promise} + * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references */ +$RefParser.resolve = function resolve (path, schema, options, callback) { + let Class = this; // eslint-disable-line consistent-this + let instance = new Class(); + return instance.resolve.apply(instance, arguments); +}; -// fsevents instance helper functions /** - * Object to hold per-process fsevents instances (may be shared across chokidar FSWatcher instances) - * @type {Map} + * Parses the given JSON schema and resolves any JSON references, including references in + * externally-referenced files. + * + * @param {string} [path] - The file path or URL of the JSON schema + * @param {object} [schema] - A JSON schema object. This object will be used instead of reading from `path`. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed and resolved + * @param {function} [callback] + * - An error-first callback. The second parameter is a {@link $Refs} object containing the resolved JSON references + * + * @returns {Promise} + * The returned promise resolves with a {@link $Refs} object containing the resolved JSON references */ -const FSEventsWatchers = new Map(); - -// Threshold of duplicate path prefixes at which to start -// consolidating going forward -const consolidateThreshhold = 10; +$RefParser.prototype.resolve = async function resolve (path, schema, options, callback) { + let me = this; + let args = normalizeArgs(arguments); -const wrongEventFlags = new Set([ - 69888, 70400, 71424, 72704, 73472, 131328, 131840, 262912 -]); + try { + await this.parse(args.path, args.schema, args.options); + await resolveExternal(me, args.options); + finalize(me); + return maybe(args.callback, Promise.resolve(me.$refs)); + } + catch (err) { + return maybe(args.callback, Promise.reject(err)); + } +}; /** - * Instantiates the fsevents interface - * @param {Path} path path to be watched - * @param {Function} callback called when fsevents is bound and ready - * @returns {{stop: Function}} new fsevents instance + * Parses the given JSON schema, resolves any JSON references, and bundles all external references + * into the main JSON schema. This produces a JSON schema that only has *internal* references, + * not any *external* references. + * + * @param {string} [path] - The file path or URL of the JSON schema + * @param {object} [schema] - A JSON schema object. This object will be used instead of reading from `path`. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced + * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object + * @returns {Promise} - The returned promise resolves with the bundled JSON schema object. */ -const createFSEventsInstance = (path, callback) => { - const stop = fsevents.watch(path, callback); - return {stop}; +$RefParser.bundle = function bundle (path, schema, options, callback) { + let Class = this; // eslint-disable-line consistent-this + let instance = new Class(); + return instance.bundle.apply(instance, arguments); }; /** - * Instantiates the fsevents interface or binds listeners to an existing one covering - * the same file tree. - * @param {Path} path - to be watched - * @param {Path} realPath - real path for symlinks - * @param {Function} listener - called when fsevents emits events - * @param {Function} rawEmitter - passes data to listeners of the 'raw' event - * @returns {Function} closer + * Parses the given JSON schema, resolves any JSON references, and bundles all external references + * into the main JSON schema. This produces a JSON schema that only has *internal* references, + * not any *external* references. + * + * @param {string} [path] - The file path or URL of the JSON schema + * @param {object} [schema] - A JSON schema object. This object will be used instead of reading from `path`. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced + * @param {function} [callback] - An error-first callback. The second parameter is the bundled JSON schema object + * @returns {Promise} - The returned promise resolves with the bundled JSON schema object. */ -function setFSEventsListener(path, realPath, listener, rawEmitter, fsw) { - let watchPath = sysPath.extname(path) ? sysPath.dirname(path) : path; - const parentPath = sysPath.dirname(watchPath); - let cont = FSEventsWatchers.get(watchPath); +$RefParser.prototype.bundle = async function bundle (path, schema, options, callback) { + let me = this; + let args = normalizeArgs(arguments); - // If we've accumulated a substantial number of paths that - // could have been consolidated by watching one directory - // above the current one, create a watcher on the parent - // path instead, so that we do consolidate going forward. - if (couldConsolidate(parentPath)) { - watchPath = parentPath; + try { + await this.resolve(args.path, args.schema, args.options); + _bundle(me, args.options); + finalize(me); + return maybe(args.callback, Promise.resolve(me.schema)); } + catch (err) { + return maybe(args.callback, Promise.reject(err)); + } +}; - const resolvedPath = sysPath.resolve(path); - const hasSymlink = resolvedPath !== realPath; +/** + * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema. + * That is, all JSON references are replaced with their resolved values. + * + * @param {string} [path] - The file path or URL of the JSON schema + * @param {object} [schema] - A JSON schema object. This object will be used instead of reading from `path`. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced + * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object + * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object. + */ +$RefParser.dereference = function dereference (path, schema, options, callback) { + let Class = this; // eslint-disable-line consistent-this + let instance = new Class(); + return instance.dereference.apply(instance, arguments); +}; - const filteredListener = (fullPath, flags, info) => { - if (hasSymlink) fullPath = fullPath.replace(realPath, resolvedPath); - if ( - fullPath === resolvedPath || - !fullPath.indexOf(resolvedPath + sysPath.sep) - ) listener(fullPath, flags, info); - }; +/** + * Parses the given JSON schema, resolves any JSON references, and dereferences the JSON schema. + * That is, all JSON references are replaced with their resolved values. + * + * @param {string} [path] - The file path or URL of the JSON schema + * @param {object} [schema] - A JSON schema object. This object will be used instead of reading from `path`. + * @param {$RefParserOptions} [options] - Options that determine how the schema is parsed, resolved, and dereferenced + * @param {function} [callback] - An error-first callback. The second parameter is the dereferenced JSON schema object + * @returns {Promise} - The returned promise resolves with the dereferenced JSON schema object. + */ +$RefParser.prototype.dereference = async function dereference (path, schema, options, callback) { + let me = this; + let args = normalizeArgs(arguments); - // check if there is already a watcher on a parent path - // modifies `watchPath` to the parent path when it finds a match - let watchedParent = false; - for (const watchedPath of FSEventsWatchers.keys()) { - if (realPath.indexOf(sysPath.resolve(watchedPath) + sysPath.sep) === 0) { - watchPath = watchedPath; - cont = FSEventsWatchers.get(watchPath); - watchedParent = true; - break; - } + try { + await this.resolve(args.path, args.schema, args.options); + _dereference(me, args.options); + finalize(me); + return maybe(args.callback, Promise.resolve(me.schema)); } + catch (err) { + return maybe(args.callback, Promise.reject(err)); + } +}; - if (cont || watchedParent) { - cont.listeners.add(filteredListener); - } else { - cont = { - listeners: new Set([filteredListener]), - rawEmitter, - watcher: createFSEventsInstance(watchPath, (fullPath, flags) => { - if (fsw.closed) return; - const info = fsevents.getInfo(fullPath, flags); - cont.listeners.forEach(list => { - list(fullPath, flags, info); - }); - - cont.rawEmitter(info.event, fullPath, info); - }) - }; - FSEventsWatchers.set(watchPath, cont); +function finalize (parser) { + const errors = JSONParserErrorGroup.getParserErrors(parser); + if (errors.length > 0) { + throw new JSONParserErrorGroup(parser); } +} - // removes this instance's listeners and closes the underlying fsevents - // instance if there are no more listeners left - return () => { - const lst = cont.listeners; - lst.delete(filteredListener); - if (!lst.size) { - FSEventsWatchers.delete(watchPath); - if (cont.watcher) return cont.watcher.stop().then(() => { - cont.rawEmitter = cont.watcher = undefined; - Object.freeze(cont); - }); - } - }; -} +/***/ }), -// Decide whether or not we should start a new higher-level -// parent watcher -const couldConsolidate = (path) => { - let count = 0; - for (const watchPath of FSEventsWatchers.keys()) { - if (watchPath.indexOf(path) === 0) { - count++; - if (count >= consolidateThreshhold) { - return true; - } - } - } +/***/ 64608: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return false; -}; +"use strict"; -// returns boolean indicating whether fsevents can be used -const canUse = () => fsevents && FSEventsWatchers.size < 128; -// determines subdirectory traversal levels from root to path -const calcDepth = (path, root) => { - let i = 0; - while (!path.indexOf(root) && (path = sysPath.dirname(path)) !== root) i++; - return i; -}; +const Options = __webpack_require__(36608); -/** - * @mixin - */ -class FsEventsHandler { +module.exports = normalizeArgs; /** - * @param {import('../index').FSWatcher} fsw + * Normalizes the given arguments, accounting for optional args. + * + * @param {Arguments} args + * @returns {object} */ -constructor(fsw) { - this.fsw = fsw; -} -checkIgnored(path, stats) { - const ipaths = this.fsw._ignoredPaths; - if (this.fsw._isIgnored(path, stats)) { - ipaths.add(path); - if (stats && stats.isDirectory()) { - ipaths.add(path + ROOT_GLOBSTAR); - } - return true; - } - - ipaths.delete(path); - ipaths.delete(path + ROOT_GLOBSTAR); -} - -addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) { - const event = watchedDir.has(item) ? EV_CHANGE : EV_ADD; - this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts); -} +function normalizeArgs (args) { + let path, schema, options, callback; + args = Array.prototype.slice.call(args); -async checkFd(path, fullPath, realPath, parent, watchedDir, item, info, opts) { - try { - const fd = await open(path, FS_MODE_READ); - if (this.fsw.closed) return; - await close(fd); - if (this.fsw.closed) return; - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } catch (error) { - if (error.code === 'EACCES') { - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } else { - this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); - } + if (typeof args[args.length - 1] === "function") { + // The last parameter is a callback function + callback = args.pop(); } -} - -handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts) { - if (this.fsw.closed || this.checkIgnored(path)) return; - if (event === EV_UNLINK) { - // suppress unlink events on never before seen files - if (info.type === FSEVENT_TYPE_DIRECTORY || watchedDir.has(item)) { - this.fsw._remove(parent, item); + if (typeof args[0] === "string") { + // The first parameter is the path + path = args[0]; + if (typeof args[2] === "object") { + // The second parameter is the schema, and the third parameter is the options + schema = args[1]; + options = args[2]; } - } else { - if (event === EV_ADD) { - // track new directories - if (info.type === FSEVENT_TYPE_DIRECTORY) this.fsw._getWatchedDir(path); - - if (info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) { - // push symlinks back to the top of the stack to get handled - const curDepth = opts.depth === undefined ? - undefined : calcDepth(fullPath, realPath) + 1; - return this._addToFsEvents(path, false, true, curDepth); - } - - // track new paths - // (other than symlinks being followed, which will be tracked soon) - this.fsw._getWatchedDir(parent).add(item); + else { + // The second parameter is the options + schema = undefined; + options = args[1]; } - /** - * @type {'add'|'addDir'|'unlink'|'unlinkDir'} - */ - const eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event; - this.fsw._emit(eventName, path); - if (eventName === EV_ADD_DIR) this._addToFsEvents(path, false, true); } -} + else { + // The first parameter is the schema + path = ""; + schema = args[0]; + options = args[1]; + } -/** - * Handle symlinks encountered during directory scan - * @param {String} watchPath - file/dir path to be watched with fsevents - * @param {String} realPath - real path (in case of symlinks) - * @param {Function} transform - path transformer - * @param {Function} globFilter - path filter in case a glob pattern was provided - * @returns {Function} closer for the watcher instance -*/ -_watchWithFsEvents(watchPath, realPath, transform, globFilter) { - if (this.fsw.closed) return; - if (this.fsw._isIgnored(watchPath)) return; - const opts = this.fsw.options; - const watchCallback = async (fullPath, flags, info) => { - if (this.fsw.closed) return; - if ( - opts.depth !== undefined && - calcDepth(fullPath, realPath) > opts.depth - ) return; - const path = transform(sysPath.join( - watchPath, sysPath.relative(watchPath, fullPath) - )); - if (globFilter && !globFilter(path)) return; - // ensure directories are tracked - const parent = sysPath.dirname(path); - const item = sysPath.basename(path); - const watchedDir = this.fsw._getWatchedDir( - info.type === FSEVENT_TYPE_DIRECTORY ? path : parent - ); + if (!(options instanceof Options)) { + options = new Options(options); + } - // correct for wrong events emitted - if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) { - if (typeof opts.ignored === FUNCTION_TYPE) { - let stats; - try { - stats = await stat(path); - } catch (error) {} - if (this.fsw.closed) return; - if (this.checkIgnored(path, stats)) return; - if (stats) { - this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } else { - this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } else { - this.checkFd(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } else { - switch (info.event) { - case FSEVENT_CREATED: - case FSEVENT_MODIFIED: - return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); - case FSEVENT_DELETED: - case FSEVENT_MOVED: - return this.checkFd(path, fullPath, realPath, parent, watchedDir, item, info, opts); - } - } + return { + path, + schema, + options, + callback }; +} - const closer = setFSEventsListener( - watchPath, - realPath, - watchCallback, - this.fsw._emitRaw, - this.fsw - ); - this.fsw._emitReady(); - return closer; -} +/***/ }), -/** - * Handle symlinks encountered during directory scan - * @param {String} linkPath path to symlink - * @param {String} fullPath absolute path to the symlink - * @param {Function} transform pre-existing path transformer - * @param {Number} curDepth level of subdirectories traversed to where symlink is - * @returns {Promise} - */ -async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) { - // don't follow the same symlink more than once - if (this.fsw.closed || this.fsw._symlinkPaths.has(fullPath)) return; +/***/ 36608: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - this.fsw._symlinkPaths.set(fullPath, true); - this.fsw._incrReadyCount(); +"use strict"; +/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */ - try { - const linkTarget = await realpath(linkPath); - if (this.fsw.closed) return; - if (this.fsw._isIgnored(linkTarget)) { - return this.fsw._emitReady(); - } - this.fsw._incrReadyCount(); +const jsonParser = __webpack_require__(74683); +const yamlParser = __webpack_require__(40525); +const textParser = __webpack_require__(80164); +const binaryParser = __webpack_require__(67922); +const fileResolver = __webpack_require__(36859); +const httpResolver = __webpack_require__(34147); - // add the linkTarget for watching with a wrapper for transform - // that causes emitted paths to incorporate the link's path - this._addToFsEvents(linkTarget || linkPath, (path) => { - let aliasedPath = linkPath; - if (linkTarget && linkTarget !== DOT_SLASH) { - aliasedPath = path.replace(linkTarget, linkPath); - } else if (path !== DOT_SLASH) { - aliasedPath = sysPath.join(linkPath, path); - } - return transform(aliasedPath); - }, false, curDepth); - } catch(error) { - if (this.fsw._handleError(error)) { - return this.fsw._emitReady(); - } - } -} +module.exports = $RefParserOptions; /** + * Options that determine how JSON schemas are parsed, resolved, and dereferenced. * - * @param {Path} newPath - * @param {fs.Stats} stats + * @param {object|$RefParserOptions} [options] - Overridden options + * @constructor */ -emitAdd(newPath, stats, processPath, opts, forceAdd) { - const pp = processPath(newPath); - const isDir = stats.isDirectory(); - const dirObj = this.fsw._getWatchedDir(sysPath.dirname(pp)); - const base = sysPath.basename(pp); - - // ensure empty dirs get tracked - if (isDir) this.fsw._getWatchedDir(pp); - if (dirObj.has(base)) return; - dirObj.add(base); - - if (!opts.ignoreInitial || forceAdd === true) { - this.fsw._emit(isDir ? EV_ADD_DIR : EV_ADD, pp, stats); - } -} - -initWatch(realPath, path, wh, processPath) { - if (this.fsw.closed) return; - const closer = this._watchWithFsEvents( - wh.watchPath, - sysPath.resolve(realPath || wh.watchPath), - processPath, - wh.globFilter - ); - this.fsw._addPathCloser(path, closer); +function $RefParserOptions (options) { + merge(this, $RefParserOptions.defaults); + merge(this, options); } -/** - * Handle added path with fsevents - * @param {String} path file/dir path or glob pattern - * @param {Function|Boolean=} transform converts working path to what the user expects - * @param {Boolean=} forceAdd ensure add is emitted - * @param {Number=} priorDepth Level of subdirectories already traversed. - * @returns {Promise} - */ -async _addToFsEvents(path, transform, forceAdd, priorDepth) { - if (this.fsw.closed) { - return; - } - const opts = this.fsw.options; - const processPath = typeof transform === FUNCTION_TYPE ? transform : IDENTITY_FN; - - const wh = this.fsw._getWatchHelpers(path); - - // evaluate what is at the path we're being asked to watch - try { - const stats = await statMethods[wh.statMethod](wh.watchPath); - if (this.fsw.closed) return; - if (this.fsw._isIgnored(wh.watchPath, stats)) { - throw null; - } - if (stats.isDirectory()) { - // emit addDir unless this is a glob parent - if (!wh.globFilter) this.emitAdd(processPath(path), stats, processPath, opts, forceAdd); +$RefParserOptions.defaults = { + /** + * Determines how different types of files will be parsed. + * + * You can add additional parsers of your own, replace an existing one with + * your own implementation, or disable any parser by setting it to false. + */ + parse: { + json: jsonParser, + yaml: yamlParser, + text: textParser, + binary: binaryParser, + }, - // don't recurse further if it would exceed depth setting - if (priorDepth && priorDepth > opts.depth) return; + /** + * Determines how JSON References will be resolved. + * + * You can add additional resolvers of your own, replace an existing one with + * your own implementation, or disable any resolver by setting it to false. + */ + resolve: { + file: fileResolver, + http: httpResolver, - // scan the contents of the dir - this.fsw._readdirp(wh.watchPath, { - fileFilter: entry => wh.filterPath(entry), - directoryFilter: entry => wh.filterDir(entry), - ...Depth(opts.depth - (priorDepth || 0)) - }).on(STR_DATA, (entry) => { - // need to check filterPath on dirs b/c filterDir is less restrictive - if (this.fsw.closed) { - return; - } - if (entry.stats.isDirectory() && !wh.filterPath(entry)) return; + /** + * Determines whether external $ref pointers will be resolved. + * If this option is disabled, then none of above resolvers will be called. + * Instead, external $ref pointers will simply be ignored. + * + * @type {boolean} + */ + external: true, + }, - const joinedPath = sysPath.join(wh.watchPath, entry.path); - const {fullPath} = entry; + /** + * By default, JSON Schema $Ref Parser throws the first error it encounters. Setting `continueOnError` to `true` + * causes it to keep processing as much as possible and then throw a single error that contains all errors + * that were encountered. + */ + continueOnError: false, - if (wh.followSymlinks && entry.stats.isSymbolicLink()) { - // preserve the current depth here since it can't be derived from - // real paths past the symlink - const curDepth = opts.depth === undefined ? - undefined : calcDepth(joinedPath, sysPath.resolve(wh.watchPath)) + 1; + /** + * Determines the types of JSON references that are allowed. + */ + dereference: { + /** + * Dereference circular (recursive) JSON references? + * If false, then a {@link ReferenceError} will be thrown if a circular reference is found. + * If "ignore", then circular references will not be dereferenced. + * + * @type {boolean|string} + */ + circular: true + }, +}; - this._handleFsEventsSymlink(joinedPath, fullPath, processPath, curDepth); - } else { - this.emitAdd(joinedPath, entry.stats, processPath, opts, forceAdd); - } - }).on(EV_ERROR, EMPTY_FN).on(STR_END, () => { - this.fsw._emitReady(); - }); - } else { - this.emitAdd(wh.watchPath, stats, processPath, opts, forceAdd); - this.fsw._emitReady(); - } - } catch (error) { - if (!error || this.fsw._handleError(error)) { - // TODO: Strange thing: "should not choke on an ignored watch path" will be failed without 2 ready calls -__- - this.fsw._emitReady(); - this.fsw._emitReady(); - } - } +/** + * Merges the properties of the source object into the target object. + * + * @param {object} target - The object that we're populating + * @param {?object} source - The options that are being merged + * @returns {object} + */ +function merge (target, source) { + if (isMergeable(source)) { + let keys = Object.keys(source); + for (let i = 0; i < keys.length; i++) { + let key = keys[i]; + let sourceSetting = source[key]; + let targetSetting = target[key]; - if (opts.persistent && forceAdd !== true) { - if (typeof transform === FUNCTION_TYPE) { - // realpath has already been resolved - this.initWatch(undefined, path, wh, processPath); - } else { - let realPath; - try { - realPath = await realpath(wh.watchPath); - } catch (e) {} - this.initWatch(realPath, path, wh, processPath); + if (isMergeable(sourceSetting)) { + // It's a nested object, so merge it recursively + target[key] = merge(targetSetting || {}, sourceSetting); + } + else if (sourceSetting !== undefined) { + // It's a scalar value, function, or array. No merging necessary. Just overwrite the target value. + target[key] = sourceSetting; + } } } + return target; } +/** + * Determines whether the given value can be merged, + * or if it is a scalar value that should just override the target value. + * + * @param {*} val + * @returns {Boolean} + */ +function isMergeable (val) { + return val && + (typeof val === "object") && + !Array.isArray(val) && + !(val instanceof RegExp) && + !(val instanceof Date); } -module.exports = FsEventsHandler; -module.exports.canUse = canUse; - /***/ }), -/* 33 */, -/* 34 */, -/* 35 */ -/***/ (function(module) { - -"use strict"; -module.exports = function generate_allOf(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $allSchemasEmpty = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($breakOnError) { - if ($allSchemasEmpty) { - out += ' if (true) { '; - } else { - out += ' ' + ($closingBraces.slice(0, -1)) + ' '; - } - } - out = it.util.cleanUpCode(out); - return out; -} - - -/***/ }), -/* 36 */, -/* 37 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 52430: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* eslint-disable no-console */ - - -function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } -var fs = __webpack_require__(747); -var path = __webpack_require__(622); +const { ono } = __webpack_require__(33436); +const url = __webpack_require__(81279); +const plugins = __webpack_require__(14601); +const { ResolverError, ParserError, UnmatchedParserError, UnmatchedResolverError, isHandledError } = __webpack_require__(1695); -var Loader = __webpack_require__(857); +module.exports = parse; -var _require = __webpack_require__(818), - PrecompiledLoader = _require.PrecompiledLoader; +/** + * Reads and parses the specified file path or URL. + * + * @param {string} path - This path MUST already be resolved, since `read` doesn't know the resolution context + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves with the parsed file contents, NOT the raw (Buffer) contents. + */ +async function parse (path, $refs, options) { + // Remove the URL fragment, if any + path = url.stripHash(path); -var chokidar; + // Add a new $Ref for this file, even though we don't have the value yet. + // This ensures that we don't simultaneously read & parse the same file multiple times + let $ref = $refs._add(path); -var FileSystemLoader = /*#__PURE__*/function (_Loader) { - _inheritsLoose(FileSystemLoader, _Loader); + // This "file object" will be passed to all resolvers and parsers. + let file = { + url: path, + extension: url.getExtension(path), + }; - function FileSystemLoader(searchPaths, opts) { - var _this; + // Read the file and then parse the data + try { + const resolver = await readFile(file, options, $refs); + $ref.pathType = resolver.plugin.name; + file.data = resolver.result; - _this = _Loader.call(this) || this; + const parser = await parseFile(file, options, $refs); + $ref.value = parser.result; - if (typeof opts === 'boolean') { - console.log('[nunjucks] Warning: you passed a boolean as the second ' + 'argument to FileSystemLoader, but it now takes an options ' + 'object. See http://mozilla.github.io/nunjucks/api.html#filesystemloader'); + return parser.result; + } + catch (err) { + if (isHandledError(err)) { + $ref.value = err; } - opts = opts || {}; - _this.pathsToNames = {}; - _this.noCache = !!opts.noCache; - - if (searchPaths) { - searchPaths = Array.isArray(searchPaths) ? searchPaths : [searchPaths]; // For windows, convert to forward slashes - - _this.searchPaths = searchPaths.map(path.normalize); - } else { - _this.searchPaths = ['.']; - } + throw err; + } +} - if (opts.watch) { - // Watch all the templates in the paths and fire an event when - // they change - try { - chokidar = __webpack_require__(101); // eslint-disable-line global-require - } catch (e) { - throw new Error('watch requires chokidar to be installed'); - } +/** + * Reads the given file, using the configured resolver plugins + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves with the raw file contents and the resolver that was used. + */ +function readFile (file, options, $refs) { + return new Promise(((resolve, reject) => { + // console.log('Reading %s', file.url); - var paths = _this.searchPaths.filter(fs.existsSync); + // Find the resolvers that can read this file + let resolvers = plugins.all(options.resolve); + resolvers = plugins.filter(resolvers, "canRead", file); - var watcher = chokidar.watch(paths); - watcher.on('all', function (event, fullname) { - fullname = path.resolve(fullname); + // Run the resolvers, in order, until one of them succeeds + plugins.sort(resolvers); + plugins.run(resolvers, "read", file, $refs) + .then(resolve, onError); - if (event === 'change' && fullname in _this.pathsToNames) { - _this.emit('update', _this.pathsToNames[fullname], fullname); - } - }); - watcher.on('error', function (error) { - console.log('Watcher error: ' + error); - }); + function onError (err) { + if (!err && options.continueOnError) { + // No resolver could be matched + reject(new UnmatchedResolverError(file.url)); + } + else if (!err || !("error" in err)) { + // Throw a generic, friendly error. + reject(ono.syntax(`Unable to resolve $ref pointer "${file.url}"`)); + } + // Throw the original error, if it's one of our own (user-friendly) errors. + else if (err.error instanceof ResolverError) { + reject(err.error); + } + else { + reject(new ResolverError(err, file.url)); + } } + })); +} - return _this; - } - - var _proto = FileSystemLoader.prototype; +/** + * Parses the given file's contents, using the configured parser plugins. + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves with the parsed file contents and the parser that was used. + */ +function parseFile (file, options, $refs) { + return new Promise(((resolve, reject) => { + // console.log('Parsing %s', file.url); - _proto.getSource = function getSource(name) { - var fullpath = null; - var paths = this.searchPaths; + // Find the parsers that can read this file type. + // If none of the parsers are an exact match for this file, then we'll try ALL of them. + // This handles situations where the file IS a supported type, just with an unknown extension. + let allParsers = plugins.all(options.parse); + let filteredParsers = plugins.filter(allParsers, "canParse", file); + let parsers = filteredParsers.length > 0 ? filteredParsers : allParsers; - for (var i = 0; i < paths.length; i++) { - var basePath = path.resolve(paths[i]); - var p = path.resolve(paths[i], name); // Only allow the current directory and anything - // underneath it to be searched + // Run the parsers, in order, until one of them succeeds + plugins.sort(parsers); + plugins.run(parsers, "parse", file, $refs) + .then(onParsed, onError); - if (p.indexOf(basePath) === 0 && fs.existsSync(p)) { - fullpath = p; - break; + function onParsed (parser) { + if (!parser.plugin.allowEmpty && isEmpty(parser.result)) { + reject(ono.syntax(`Error parsing "${file.url}" as ${parser.plugin.name}. \nParsed value is empty`)); + } + else { + resolve(parser); } } - if (!fullpath) { - return null; + function onError (err) { + if (!err && options.continueOnError) { + // No resolver could be matched + reject(new UnmatchedParserError(file.url)); + } + else if (!err || !("error" in err)) { + reject(ono.syntax(`Unable to parse ${file.url}`)); + } + else if (err.error instanceof ParserError) { + reject(err.error); + } + else { + reject(new ParserError(err.error.message, file.url)); + } } + })); +} - this.pathsToNames[fullpath] = name; - var source = { - src: fs.readFileSync(fullpath, 'utf-8'), - path: fullpath, - noCache: this.noCache - }; - this.emit('load', name, source); - return source; - }; +/** + * Determines whether the parsed value is "empty". + * + * @param {*} value + * @returns {boolean} + */ +function isEmpty (value) { + return value === undefined || + (typeof value === "object" && Object.keys(value).length === 0) || + (typeof value === "string" && value.trim().length === 0) || + (Buffer.isBuffer(value) && value.length === 0); +} - return FileSystemLoader; -}(Loader); -var NodeResolveLoader = /*#__PURE__*/function (_Loader2) { - _inheritsLoose(NodeResolveLoader, _Loader2); +/***/ }), - function NodeResolveLoader(opts) { - var _this2; +/***/ 67922: +/***/ ((module) => { - _this2 = _Loader2.call(this) || this; - opts = opts || {}; - _this2.pathsToNames = {}; - _this2.noCache = !!opts.noCache; +"use strict"; - if (opts.watch) { - try { - chokidar = __webpack_require__(101); // eslint-disable-line global-require - } catch (e) { - throw new Error('watch requires chokidar to be installed'); - } - _this2.watcher = chokidar.watch(); +let BINARY_REGEXP = /\.(jpeg|jpg|gif|png|bmp|ico)$/i; - _this2.watcher.on('change', function (fullname) { - _this2.emit('update', _this2.pathsToNames[fullname], fullname); - }); +module.exports = { + /** + * The order that this parser will run, in relation to other parsers. + * + * @type {number} + */ + order: 400, - _this2.watcher.on('error', function (error) { - console.log('Watcher error: ' + error); - }); + /** + * Whether to allow "empty" files (zero bytes). + * + * @type {boolean} + */ + allowEmpty: true, - _this2.on('load', function (name, source) { - _this2.watcher.add(source.path); - }); - } + /** + * Determines whether this parser can parse a given file reference. + * Parsers that return true will be tried, in order, until one successfully parses the file. + * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case + * every parser will be tried. + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver + * @returns {boolean} + */ + canParse (file) { + // Use this parser if the file is a Buffer, and has a known binary extension + return Buffer.isBuffer(file.data) && BINARY_REGEXP.test(file.url); + }, - return _this2; + /** + * Parses the given data as a Buffer (byte array). + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver + * @returns {Buffer} + */ + parse (file) { + if (Buffer.isBuffer(file.data)) { + return file.data; + } + else { + // This will reject if data is anything other than a string or typed array + return Buffer.from(file.data); + } } +}; - var _proto2 = NodeResolveLoader.prototype; - _proto2.getSource = function getSource(name) { - // Don't allow file-system traversal - if (/^\.?\.?(\/|\\)/.test(name)) { - return null; - } +/***/ }), - if (/^[A-Z]:/.test(name)) { - return null; - } +/***/ 74683: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var fullpath; +"use strict"; - try { - fullpath = require.resolve(name); - } catch (e) { - return null; - } - this.pathsToNames[fullpath] = name; - var source = { - src: fs.readFileSync(fullpath, 'utf-8'), - path: fullpath, - noCache: this.noCache - }; - this.emit('load', name, source); - return source; - }; - - return NodeResolveLoader; -}(Loader); +const { ParserError } = __webpack_require__(1695); module.exports = { - FileSystemLoader: FileSystemLoader, - PrecompiledLoader: PrecompiledLoader, - NodeResolveLoader: NodeResolveLoader -}; - -/***/ }), -/* 38 */, -/* 39 */ -/***/ (function(module) { + /** + * The order that this parser will run, in relation to other parsers. + * + * @type {number} + */ + order: 100, + /** + * Whether to allow "empty" files. This includes zero-byte files, as well as empty JSON objects. + * + * @type {boolean} + */ + allowEmpty: true, -module.exports = PullSummary; + /** + * Determines whether this parser can parse a given file reference. + * Parsers that match will be tried, in order, until one successfully parses the file. + * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case + * every parser will be tried. + * + * @type {RegExp|string|string[]|function} + */ + canParse: ".json", -/** - * The PullSummary is returned as a response to getting `git().pull()` - * - * @constructor - */ -function PullSummary () { - this.files = []; - this.insertions = {}; - this.deletions = {}; + /** + * Parses the given file as JSON + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver + * @returns {Promise} + */ + async parse (file) { // eslint-disable-line require-await + let data = file.data; + if (Buffer.isBuffer(data)) { + data = data.toString(); + } - this.summary = { - changes: 0, - insertions: 0, - deletions: 0 - }; + if (typeof data === "string") { + if (data.trim().length === 0) { + return; // This mirrors the YAML behavior + } + else { + try { + return JSON.parse(data); + } + catch (e) { + throw new ParserError(e.message, file.url); + } + } + } + else { + // data is already a JavaScript value (object, array, number, null, NaN, etc.) + return data; + } + } +}; - this.created = []; - this.deleted = []; -} -/** - * Array of files that were created - * @type {string[]} - */ -PullSummary.prototype.created = null; +/***/ }), -/** - * Array of files that were deleted - * @type {string[]} - */ -PullSummary.prototype.deleted = null; +/***/ 80164: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/** - * The array of file paths/names that have been modified in any part of the pulled content - * @type {string[]} - */ -PullSummary.prototype.files = null; +"use strict"; -/** - * A map of file path to number to show the number of insertions per file. - * @type {Object} - */ -PullSummary.prototype.insertions = null; -/** - * A map of file path to number to show the number of deletions per file. - * @type {Object} - */ -PullSummary.prototype.deletions = null; +const { ParserError } = __webpack_require__(1695); -/** - * Overall summary of changes/insertions/deletions and the number associated with each - * across all content that was pulled. - * @type {Object} - */ -PullSummary.prototype.summary = null; +let TEXT_REGEXP = /\.(txt|htm|html|md|xml|js|min|map|css|scss|less|svg)$/i; -PullSummary.FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/; -PullSummary.SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/; -PullSummary.ACTION_REGEX = /(create|delete) mode \d+ (.+)/; +module.exports = { + /** + * The order that this parser will run, in relation to other parsers. + * + * @type {number} + */ + order: 300, -PullSummary.parse = function (text) { - var pullSummary = new PullSummary; - var lines = text.split('\n'); + /** + * Whether to allow "empty" files (zero bytes). + * + * @type {boolean} + */ + allowEmpty: true, - while (lines.length) { - var line = lines.shift().trim(); - if (!line) { - continue; - } + /** + * The encoding that the text is expected to be in. + * + * @type {string} + */ + encoding: "utf8", - update(pullSummary, line) || summary(pullSummary, line) || action(pullSummary, line); - } + /** + * Determines whether this parser can parse a given file reference. + * Parsers that return true will be tried, in order, until one successfully parses the file. + * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case + * every parser will be tried. + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver + * @returns {boolean} + */ + canParse (file) { + // Use this parser if the file is a string or Buffer, and has a known text-based extension + return (typeof file.data === "string" || Buffer.isBuffer(file.data)) && TEXT_REGEXP.test(file.url); + }, - return pullSummary; + /** + * Parses the given file as text + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver + * @returns {string} + */ + parse (file) { + if (typeof file.data === "string") { + return file.data; + } + else if (Buffer.isBuffer(file.data)) { + return file.data.toString(this.encoding); + } + else { + throw new ParserError("data is not text", file.url); + } + } }; -function update (pullSummary, line) { - - var update = PullSummary.FILE_UPDATE_REGEX.exec(line); - if (!update) { - return false; - } - - pullSummary.files.push(update[1]); - - var insertions = update[2].length; - if (insertions) { - pullSummary.insertions[update[1]] = insertions; - } - - var deletions = update[3].length; - if (deletions) { - pullSummary.deletions[update[1]] = deletions; - } - - return true; -} -function summary (pullSummary, line) { - if (!pullSummary.files.length) { - return false; - } +/***/ }), - var update = PullSummary.SUMMARY_REGEX.exec(line); - if (!update || (update[3] === undefined && update[5] === undefined)) { - return false; - } +/***/ 40525: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - pullSummary.summary.changes = +update[1] || 0; - pullSummary.summary.insertions = +update[3] || 0; - pullSummary.summary.deletions = +update[5] || 0; +"use strict"; - return true; -} -function action (pullSummary, line) { +const { ParserError } = __webpack_require__(1695); +const yaml = __webpack_require__(21917); - var match = PullSummary.ACTION_REGEX.exec(line); - if (!match) { - return false; - } +module.exports = { + /** + * The order that this parser will run, in relation to other parsers. + * + * @type {number} + */ + order: 200, - var file = match[2]; + /** + * Whether to allow "empty" files. This includes zero-byte files, as well as empty JSON objects. + * + * @type {boolean} + */ + allowEmpty: true, - if (pullSummary.files.indexOf(file) < 0) { - pullSummary.files.push(file); - } + /** + * Determines whether this parser can parse a given file reference. + * Parsers that match will be tried, in order, until one successfully parses the file. + * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case + * every parser will be tried. + * + * @type {RegExp|string[]|function} + */ + canParse: [".yaml", ".yml", ".json"], // JSON is valid YAML - var container = (match[1] === 'create') ? pullSummary.created : pullSummary.deleted; - container.push(file); + /** + * Parses the given file as YAML + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver + * @returns {Promise} + */ + async parse (file) { // eslint-disable-line require-await + let data = file.data; + if (Buffer.isBuffer(data)) { + data = data.toString(); + } - return true; -} + if (typeof data === "string") { + try { + return yaml.safeLoad(data); + } + catch (e) { + throw new ParserError(e.message, file.url); + } + } + else { + // data is already a JavaScript value (object, array, number, null, NaN, etc.) + return data; + } + } +}; /***/ }), -/* 40 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + +/***/ 26040: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; -var customRuleCode = __webpack_require__(203); +module.exports = Pointer; -module.exports = { - add: addKeyword, - get: getKeyword, - remove: removeKeyword -}; +const $Ref = __webpack_require__(59825); +const url = __webpack_require__(81279); +const { JSONParserError, InvalidPointerError, MissingPointerError, isHandledError } = __webpack_require__(1695); +const slashes = /\//g; +const tildes = /~/g; +const escapedSlash = /~1/g; +const escapedTilde = /~0/g; /** - * Define custom keyword - * @this Ajv - * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). - * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. - * @return {Ajv} this for method chaining + * This class represents a single JSON pointer and its resolved value. + * + * @param {$Ref} $ref + * @param {string} path + * @param {string} [friendlyPath] - The original user-specified path (used for error messages) + * @constructor */ -function addKeyword(keyword, definition) { - /* jshint validthis: true */ - /* eslint no-shadow: 0 */ - var RULES = this.RULES; - - if (RULES.keywords[keyword]) - throw new Error('Keyword ' + keyword + ' is already defined'); +function Pointer ($ref, path, friendlyPath) { + /** + * The {@link $Ref} object that contains this {@link Pointer} object. + * @type {$Ref} + */ + this.$ref = $ref; - if (!IDENTIFIER.test(keyword)) - throw new Error('Keyword ' + keyword + ' is not a valid identifier'); + /** + * The file path or URL, containing the JSON pointer in the hash. + * This path is relative to the path of the main JSON schema file. + * @type {string} + */ + this.path = path; - if (definition) { - if (definition.macro && definition.valid !== undefined) - throw new Error('"valid" option cannot be used with macro keywords'); + /** + * The original path or URL, used for error messages. + * @type {string} + */ + this.originalPath = friendlyPath || path; - var dataType = definition.type; - if (Array.isArray(dataType)) { - var i, len = dataType.length; - for (i=0; i ["definitions", "person", "name"]) + * + * The pointer is parsed according to RFC 6901 + * {@link https://tools.ietf.org/html/rfc6901#section-3} + * + * @param {string} path + * @param {string} [originalPath] + * @returns {string[]} + */ +Pointer.parse = function (path, originalPath) { + // Get the JSON pointer from the path's hash + let pointer = url.getHash(path).substr(1); -/*eslint-disable max-len*/ + // If there's no pointer, then there are no tokens, + // so return an empty array + if (!pointer) { + return []; + } -var common = __webpack_require__(740); -var YAMLException = __webpack_require__(556); -var Type = __webpack_require__(945); + // Split into an array + pointer = pointer.split("/"); + // Decode each part, according to RFC 6901 + for (let i = 0; i < pointer.length; i++) { + pointer[i] = decodeURIComponent(pointer[i].replace(escapedSlash, "/").replace(escapedTilde, "~")); + } -function compileList(schema, name, result) { - var exclude = []; + if (pointer[0] !== "") { + throw new InvalidPointerError(pointer, originalPath === undefined ? path : originalPath); + } - schema.include.forEach(function (includedSchema) { - result = compileList(includedSchema, name, result); - }); + return pointer.slice(1); +}; - schema[name].forEach(function (currentType) { - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { - exclude.push(previousIndex); - } - }); - - result.push(currentType); - }); - - return result.filter(function (type, index) { - return exclude.indexOf(index) === -1; - }); -} - - -function compileMap(/* lists... */) { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {} - }, index, length; - - function collectType(type) { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; +/** + * Creates a JSON pointer path, by joining one or more tokens to a base path. + * + * @param {string} base - The base path (e.g. "schema.json#/definitions/person") + * @param {string|string[]} tokens - The token(s) to append (e.g. ["name", "first"]) + * @returns {string} + */ +Pointer.join = function (base, tokens) { + // Ensure that the base path contains a hash + if (base.indexOf("#") === -1) { + base += "#"; } - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); + // Append each token to the base path + tokens = Array.isArray(tokens) ? tokens : [tokens]; + for (let i = 0; i < tokens.length; i++) { + let token = tokens[i]; + // Encode the token, according to RFC 6901 + base += "/" + encodeURIComponent(token.replace(tildes, "~0").replace(slashes, "~1")); } - return result; -} - - -function Schema(definition) { - this.include = definition.include || []; - this.implicit = definition.implicit || []; - this.explicit = definition.explicit || []; - - this.implicit.forEach(function (type) { - if (type.loadKind && type.loadKind !== 'scalar') { - throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); - } - }); - - this.compiledImplicit = compileList(this, 'implicit', []); - this.compiledExplicit = compileList(this, 'explicit', []); - this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); -} + return base; +}; -Schema.DEFAULT = null; - +/** + * If the given pointer's {@link Pointer#value} is a JSON reference, + * then the reference is resolved and {@link Pointer#value} is replaced with the resolved value. + * In addition, {@link Pointer#path} and {@link Pointer#$ref} are updated to reflect the + * resolution path of the new value. + * + * @param {Pointer} pointer + * @param {$RefParserOptions} options + * @returns {boolean} - Returns `true` if the resolution path changed + */ +function resolveIf$Ref (pointer, options) { + // Is the value a JSON reference? (and allowed?) -Schema.create = function createSchema() { - var schemas, types; + if ($Ref.isAllowed$Ref(pointer.value, options)) { + let $refPath = url.resolve(pointer.path, pointer.value.$ref); - switch (arguments.length) { - case 1: - schemas = Schema.DEFAULT; - types = arguments[0]; - break; + if ($refPath === pointer.path) { + // The value is a reference to itself, so there's nothing to do. + pointer.circular = true; + } + else { + let resolved = pointer.$ref.$refs._resolve($refPath, pointer.path, options); + pointer.indirections += resolved.indirections + 1; - case 2: - schemas = arguments[0]; - types = arguments[1]; - break; + if ($Ref.isExtended$Ref(pointer.value)) { + // This JSON reference "extends" the resolved value, rather than simply pointing to it. + // So the resolved path does NOT change. Just the value does. + pointer.value = $Ref.dereference(pointer.value, resolved.value); + return false; + } + else { + // Resolve the reference + pointer.$ref = resolved.$ref; + pointer.path = resolved.path; + pointer.value = resolved.value; + } - default: - throw new YAMLException('Wrong number of arguments for Schema.create function'); + return true; + } } +} - schemas = common.toArray(schemas); - types = common.toArray(types); - - if (!schemas.every(function (schema) { return schema instanceof Schema; })) { - throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); +/** + * Sets the specified token value of the {@link Pointer#value}. + * + * The token is evaluated according to RFC 6901. + * {@link https://tools.ietf.org/html/rfc6901#section-4} + * + * @param {Pointer} pointer - The JSON Pointer whose value will be modified + * @param {string} token - A JSON Pointer token that indicates how to modify `obj` + * @param {*} value - The value to assign + * @returns {*} - Returns the assigned value + */ +function setValue (pointer, token, value) { + if (pointer.value && typeof pointer.value === "object") { + if (token === "-" && Array.isArray(pointer.value)) { + pointer.value.push(value); + } + else { + pointer.value[token] = value; + } } - - if (!types.every(function (type) { return type instanceof Type; })) { - throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); + else { + throw new JSONParserError(`Error assigning $ref pointer "${pointer.path}". \nCannot set "${token}" of a non-object.`); } + return value; +} - return new Schema({ - include: schemas, - explicit: types - }); -}; +function unwrapOrThrow (value) { + if (isHandledError(value)) { + throw value; + } -module.exports = Schema; + return value; +} /***/ }), -/* 44 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + +/***/ 59825: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var common = __webpack_require__(740); -var Type = __webpack_require__(945); +module.exports = $Ref; -function isHexCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) || - ((0x41/* A */ <= c) && (c <= 0x46/* F */)) || - ((0x61/* a */ <= c) && (c <= 0x66/* f */)); -} +const Pointer = __webpack_require__(26040); +const { InvalidPointerError, isHandledError, normalizeError } = __webpack_require__(1695); +const { safePointerToPath, stripHash, getHash } = __webpack_require__(81279); -function isOctCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */)); -} +/** + * This class represents a single JSON reference and its resolved value. + * + * @constructor + */ +function $Ref () { + /** + * The file path or URL of the referenced file. + * This path is relative to the path of the main JSON schema file. + * + * This path does NOT contain document fragments (JSON pointers). It always references an ENTIRE file. + * Use methods such as {@link $Ref#get}, {@link $Ref#resolve}, and {@link $Ref#exists} to get + * specific JSON pointers within the file. + * + * @type {string} + */ + this.path = undefined; -function isDecCode(c) { - return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)); -} + /** + * The resolved value of the JSON reference. + * Can be any JSON type, not just objects. Unknown file types are represented as Buffers (byte arrays). + * @type {?*} + */ + this.value = undefined; -function resolveYamlInteger(data) { - if (data === null) return false; + /** + * The {@link $Refs} object that contains this {@link $Ref} object. + * @type {$Refs} + */ + this.$refs = undefined; - var max = data.length, - index = 0, - hasDigits = false, - ch; + /** + * Indicates the type of {@link $Ref#path} (e.g. "file", "http", etc.) + * @type {?string} + */ + this.pathType = undefined; - if (!max) return false; + /** + * List of all errors. Undefined if no errors. + * @type {Array} + */ + this.errors = undefined; +} - ch = data[index]; +/** + * Pushes an error to errors array. + * + * @param {Array} error - The error to be pushed + * @returns {void} + */ +$Ref.prototype.addError = function (err) { + if (this.errors === undefined) { + this.errors = []; + } - // sign - if (ch === '-' || ch === '+') { - ch = data[++index]; + // the path has been almost certainly set at this point, + // but just in case something went wrong, let's inject path if necessary + if (Array.isArray(err.errors)) { + this.errors.push(...err.errors.map(normalizeError)); } + else { + this.errors.push(normalizeError(err)); + } +}; - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; - // base 2, base 8, base 16 +/** + * Determines whether the given JSON reference exists within this {@link $Ref#value}. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @param {$RefParserOptions} options + * @returns {boolean} + */ +$Ref.prototype.exists = function (path, options) { + try { + this.resolve(path, options); + return true; + } + catch (e) { + return false; + } +}; - if (ch === 'b') { - // base 2 - index++; +/** + * Resolves the given JSON reference within this {@link $Ref#value} and returns the resolved value. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @param {$RefParserOptions} options + * @returns {*} - Returns the resolved value + */ +$Ref.prototype.get = function (path, options) { + return this.resolve(path, options).value; +}; - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; +/** + * Resolves the given JSON reference within this {@link $Ref#value}. + * + * @param {string} path - The full path being resolved, optionally with a JSON pointer in the hash + * @param {$RefParserOptions} options + * @param {string} friendlyPath - The original user-specified path (used for error messages) +* @param {string} pathFromRoot - The path of `obj` from the schema root + * @returns {Pointer} + */ +$Ref.prototype.resolve = function (path, options, friendlyPath, pathFromRoot) { + let pointer = new Pointer(this, path, friendlyPath); + try { + return pointer.resolve(this.value, options, pathFromRoot); + } + catch (err) { + if (!options || !options.continueOnError || !isHandledError(err)) { + throw err; } - - if (ch === 'x') { - // base 16 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - return hasDigits && ch !== '_'; + if (err.path === null) { + err.path = safePointerToPath(getHash(pathFromRoot)); } - // base 8 - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; + if (err instanceof InvalidPointerError) { + // this is a special case - InvalidPointerError is thrown when dereferencing external file, + // but the issue is caused by the source file that referenced the file that undergoes dereferencing + err.source = stripHash(pathFromRoot); } - return hasDigits && ch !== '_'; + + this.addError(err); + return null; } +}; - // base 10 (except 0) or base 60 +/** + * Sets the value of a nested property within this {@link $Ref#value}. + * If the property, or any of its parents don't exist, they will be created. + * + * @param {string} path - The full path of the property to set, optionally with a JSON pointer in the hash + * @param {*} value - The value to assign + */ +$Ref.prototype.set = function (path, value) { + let pointer = new Pointer(this, path); + this.value = pointer.set(this.value, value); +}; - // value should not start with `_`; - if (ch === '_') return false; +/** + * Determines whether the given value is a JSON reference. + * + * @param {*} value - The value to inspect + * @returns {boolean} + */ +$Ref.is$Ref = function (value) { + return value && typeof value === "object" && typeof value.$ref === "string" && value.$ref.length > 0; +}; - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch === ':') break; - if (!isDecCode(data.charCodeAt(index))) { - return false; +/** + * Determines whether the given value is an external JSON reference. + * + * @param {*} value - The value to inspect + * @returns {boolean} + */ +$Ref.isExternal$Ref = function (value) { + return $Ref.is$Ref(value) && value.$ref[0] !== "#"; +}; + +/** + * Determines whether the given value is a JSON reference, and whether it is allowed by the options. + * For example, if it references an external file, then options.resolve.external must be true. + * + * @param {*} value - The value to inspect + * @param {$RefParserOptions} options + * @returns {boolean} + */ +$Ref.isAllowed$Ref = function (value, options) { + if ($Ref.is$Ref(value)) { + if (value.$ref.substr(0, 2) === "#/" || value.$ref === "#") { + // It's a JSON Pointer reference, which is always allowed + return true; + } + else if (value.$ref[0] !== "#" && (!options || options.resolve.external)) { + // It's an external reference, which is allowed by the options + return true; } - hasDigits = true; } +}; - // Should have digits and should not end with `_` - if (!hasDigits || ch === '_') return false; - - // if !base60 - done; - if (ch !== ':') return true; +/** + * Determines whether the given value is a JSON reference that "extends" its resolved value. + * That is, it has extra properties (in addition to "$ref"), so rather than simply pointing to + * an existing value, this $ref actually creates a NEW value that is a shallow copy of the resolved + * value, plus the extra properties. + * + * @example: + * { + * person: { + * properties: { + * firstName: { type: string } + * lastName: { type: string } + * } + * } + * employee: { + * properties: { + * $ref: #/person/properties + * salary: { type: number } + * } + * } + * } + * + * In this example, "employee" is an extended $ref, since it extends "person" with an additional + * property (salary). The result is a NEW value that looks like this: + * + * { + * properties: { + * firstName: { type: string } + * lastName: { type: string } + * salary: { type: number } + * } + * } + * + * @param {*} value - The value to inspect + * @returns {boolean} + */ +$Ref.isExtended$Ref = function (value) { + return $Ref.is$Ref(value) && Object.keys(value).length > 1; +}; - // base60 almost not used, no needs to optimize - return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); -} +/** + * Returns the resolved value of a JSON Reference. + * If necessary, the resolved value is merged with the JSON Reference to create a new object + * + * @example: + * { + * person: { + * properties: { + * firstName: { type: string } + * lastName: { type: string } + * } + * } + * employee: { + * properties: { + * $ref: #/person/properties + * salary: { type: number } + * } + * } + * } + * + * When "person" and "employee" are merged, you end up with the following object: + * + * { + * properties: { + * firstName: { type: string } + * lastName: { type: string } + * salary: { type: number } + * } + * } + * + * @param {object} $ref - The JSON reference object (the one with the "$ref" property) + * @param {*} resolvedValue - The resolved value, which can be any type + * @returns {*} - Returns the dereferenced value + */ +$Ref.dereference = function ($ref, resolvedValue) { + if (resolvedValue && typeof resolvedValue === "object" && $Ref.isExtended$Ref($ref)) { + let merged = {}; + for (let key of Object.keys($ref)) { + if (key !== "$ref") { + merged[key] = $ref[key]; + } + } -function constructYamlInteger(data) { - var value = data, sign = 1, ch, base, digits = []; + for (let key of Object.keys(resolvedValue)) { + if (!(key in merged)) { + merged[key] = resolvedValue[key]; + } + } - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); + return merged; + } + else { + // Completely replace the original reference with the resolved value + return resolvedValue; } +}; - ch = value[0]; - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; - } +/***/ }), - if (value === '0') return 0; +/***/ 40957: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value, 16); - return sign * parseInt(value, 8); - } +"use strict"; - if (value.indexOf(':') !== -1) { - value.split(':').forEach(function (v) { - digits.unshift(parseInt(v, 10)); - }); - value = 0; - base = 1; +const { ono } = __webpack_require__(33436); +const $Ref = __webpack_require__(59825); +const url = __webpack_require__(81279); - digits.forEach(function (d) { - value += (d * base); - base *= 60; - }); +module.exports = $Refs; - return sign * value; +/** + * This class is a map of JSON references and their resolved values. + */ +function $Refs () { + /** + * Indicates whether the schema contains any circular references. + * + * @type {boolean} + */ + this.circular = false; - } + /** + * A map of paths/urls to {@link $Ref} objects + * + * @type {object} + * @protected + */ + this._$refs = {}; - return sign * parseInt(value, 10); + /** + * The {@link $Ref} object that is the root of the JSON schema. + * + * @type {$Ref} + * @protected + */ + this._root$Ref = null; } -function isInteger(object) { - return (Object.prototype.toString.call(object)) === '[object Number]' && - (object % 1 === 0 && !common.isNegativeZero(object)); -} - -module.exports = new Type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); }, - octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); }, - decimal: function (obj) { return obj.toString(10); }, - /* eslint-disable max-len */ - hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [ 2, 'bin' ], - octal: [ 8, 'oct' ], - decimal: [ 10, 'dec' ], - hexadecimal: [ 16, 'hex' ] - } -}); - - -/***/ }), -/* 45 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; -var customRuleCode = __webpack_require__(314); -var definitionSchema = __webpack_require__(952); - -module.exports = { - add: addKeyword, - get: getKeyword, - remove: removeKeyword, - validate: validateKeyword +/** + * Returns the paths of all the files/URLs that are referenced by the JSON schema, + * including the schema itself. + * + * @param {...string|string[]} [types] - Only return paths of the given types ("file", "http", etc.) + * @returns {string[]} + */ +$Refs.prototype.paths = function (types) { // eslint-disable-line no-unused-vars + let paths = getPaths(this._$refs, arguments); + return paths.map((path) => { + return path.decoded; + }); }; +/** + * Returns the map of JSON references and their resolved values. + * + * @param {...string|string[]} [types] - Only return references of the given types ("file", "http", etc.) + * @returns {object} + */ +$Refs.prototype.values = function (types) { // eslint-disable-line no-unused-vars + let $refs = this._$refs; + let paths = getPaths($refs, arguments); + return paths.reduce((obj, path) => { + obj[path.decoded] = $refs[path.encoded].value; + return obj; + }, {}); +}; /** - * Define custom keyword - * @this Ajv - * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). - * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. - * @return {Ajv} this for method chaining + * Returns a POJO (plain old JavaScript object) for serialization as JSON. + * + * @returns {object} */ -function addKeyword(keyword, definition) { - /* jshint validthis: true */ - /* eslint no-shadow: 0 */ - var RULES = this.RULES; - if (RULES.keywords[keyword]) - throw new Error('Keyword ' + keyword + ' is already defined'); +$Refs.prototype.toJSON = $Refs.prototype.values; - if (!IDENTIFIER.test(keyword)) - throw new Error('Keyword ' + keyword + ' is not a valid identifier'); +/** + * Determines whether the given JSON reference exists. + * + * @param {string} path - The path being resolved, optionally with a JSON pointer in the hash + * @param {$RefParserOptions} [options] + * @returns {boolean} + */ +$Refs.prototype.exists = function (path, options) { + try { + this._resolve(path, "", options); + return true; + } + catch (e) { + return false; + } +}; - if (definition) { - this.validateKeyword(definition, true); +/** + * Resolves the given JSON reference and returns the resolved value. + * + * @param {string} path - The path being resolved, with a JSON pointer in the hash + * @param {$RefParserOptions} [options] + * @returns {*} - Returns the resolved value + */ +$Refs.prototype.get = function (path, options) { + return this._resolve(path, "", options).value; +}; - var dataType = definition.type; - if (Array.isArray(dataType)) { - for (var i=0; i 0 && types[0]) { + paths = paths.filter((key) => { + return types.indexOf($refs[key].pathType) !== -1; + }); + } + + // Decode local filesystem paths + return paths.map((path) => { + return { + encoded: path, + decoded: $refs[path].pathType === "file" ? url.toFileSystemPath(path, true) : path + }; + }); } /***/ }), -/* 46 */, -/* 47 */, -/* 48 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + +/***/ 45330: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var fs = __webpack_require__(747) -var path = __webpack_require__(622) -var which = __webpack_require__(142) +const $Ref = __webpack_require__(59825); +const Pointer = __webpack_require__(26040); +const parse = __webpack_require__(52430); +const url = __webpack_require__(81279); +const { isHandledError } = __webpack_require__(1695); -var GLOBAL_NPM_BIN -var GLOBAL_NPM_PATH +module.exports = resolveExternal; -var throwNotFoundError = function throwNotFoundError () { - var err = new Error("Cannot find module 'npm'") - err.code = 'MODULE_NOT_FOUND' - throw err -} +/** + * Crawls the JSON schema, finds all external JSON references, and resolves their values. + * This method does not mutate the JSON schema. The resolved values are added to {@link $RefParser#$refs}. + * + * NOTE: We only care about EXTERNAL references here. INTERNAL references are only relevant when dereferencing. + * + * @param {$RefParser} parser + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves once all JSON references in the schema have been resolved, + * including nested references that are contained in externally-referenced files. + */ +function resolveExternal (parser, options) { + if (!options.resolve.external) { + // Nothing to resolve, so exit early + return Promise.resolve(); + } -try { - GLOBAL_NPM_BIN = process.env.GLOBAL_NPM_BIN || fs.realpathSync(which.sync('npm')) -} catch (e) { - throwNotFoundError() + try { + // console.log('Resolving $ref pointers in %s', parser.$refs._root$Ref.path); + let promises = crawl(parser.schema, parser.$refs._root$Ref.path + "#", parser.$refs, options); + return Promise.all(promises); + } + catch (e) { + return Promise.reject(e); + } } -GLOBAL_NPM_PATH = process.env.GLOBAL_NPM_PATH || path.join( - GLOBAL_NPM_BIN, - process.platform === 'win32' ? '../node_modules/npm' : '../..' -) +/** + * Recursively crawls the given value, and resolves any external JSON references. + * + * @param {*} obj - The value to crawl. If it's not an object or array, it will be ignored. + * @param {string} path - The full path of `obj`, possibly with a JSON Pointer in the hash + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * + * @returns {Promise[]} + * Returns an array of promises. There will be one promise for each JSON reference in `obj`. + * If `obj` does not contain any JSON references, then the array will be empty. + * If any of the JSON references point to files that contain additional JSON references, + * then the corresponding promise will internally reference an array of promises. + */ +function crawl (obj, path, $refs, options) { + let promises = []; -module.exports = (function () { - try { - var npm = require(GLOBAL_NPM_PATH) - if (npm && Object.keys(npm).length > 0) { - return require(GLOBAL_NPM_PATH) - } else { - throwNotFoundError() + if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj)) { + if ($Ref.isExternal$Ref(obj)) { + promises.push(resolve$Ref(obj, path, $refs, options)); } - } catch (e) { - if (e.code !== 'MODULE_NOT_FOUND') { - throw e + else { + for (let key of Object.keys(obj)) { + let keyPath = Pointer.join(path, key); + let value = obj[key]; + + if ($Ref.isExternal$Ref(value)) { + promises.push(resolve$Ref(value, keyPath, $refs, options)); + } + else { + promises = promises.concat(crawl(value, keyPath, $refs, options)); + } + } } - throwNotFoundError() } -})() -module.exports.GLOBAL_NPM_PATH = GLOBAL_NPM_PATH -module.exports.GLOBAL_NPM_BIN = GLOBAL_NPM_BIN + return promises; +} +/** + * Resolves the given JSON Reference, and then crawls the resulting value. + * + * @param {{$ref: string}} $ref - The JSON Reference to resolve + * @param {string} path - The full path of `$ref`, possibly with a JSON Pointer in the hash + * @param {$Refs} $refs + * @param {$RefParserOptions} options + * + * @returns {Promise} + * The promise resolves once all JSON references in the object have been resolved, + * including nested references that are contained in externally-referenced files. + */ +async function resolve$Ref ($ref, path, $refs, options) { + // console.log('Resolving $ref pointer "%s" at %s', $ref.$ref, path); -/***/ }), -/* 49 */, -/* 50 */, -/* 51 */, -/* 52 */, -/* 53 */, -/* 54 */, -/* 55 */, -/* 56 */, -/* 57 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + let resolvedPath = url.resolve(path, $ref.$ref); + let withoutHash = url.stripHash(resolvedPath); + // Do we already have this $ref? + $ref = $refs._$refs[withoutHash]; + if ($ref) { + // We've already parsed this $ref, so use the existing value + return Promise.resolve($ref.value); + } -if (typeof Promise === 'undefined') { - throw new ReferenceError("Promise wrappers must be enabled to use the promise API"); -} + // Parse the $referenced file/url + try { + const result = await parse(resolvedPath, $refs, options); -function isAsyncCall (fn) { - return /^[^)]+then\s*\)/.test(fn) || /\._run\(/.test(fn); -} + // Crawl the parsed value + // console.log('Resolving $ref pointers in %s', withoutHash); + let promises = crawl(result, withoutHash + "#", $refs, options); -module.exports = function (baseDir) { + return Promise.all(promises); + } + catch (err) { + if (!options.continueOnError || !isHandledError(err)) { + throw err; + } - var Git = __webpack_require__(478); - var gitFactory = __webpack_require__(964); - var git; + if ($refs._$refs[withoutHash]) { + err.source = url.stripHash(path); + err.path = url.safePointerToPath(url.getHash(path)); + } + return []; + } +} - var chain = Promise.resolve(); - try { - git = gitFactory(baseDir); - } - catch (e) { - chain = Promise.reject(e); - } +/***/ }), - return Object.keys(Git.prototype).reduce(function (promiseApi, fn) { - if (/^_|then/.test(fn)) { - return promiseApi; - } +/***/ 36859: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (isAsyncCall(Git.prototype[fn])) { - promiseApi[fn] = git ? asyncWrapper(fn, git) : function () { - return chain; - }; - } +"use strict"; - else { - promiseApi[fn] = git ? syncWrapper(fn, git, promiseApi) : function () { - return promiseApi; - }; - } +const fs = __webpack_require__(35747); +const { ono } = __webpack_require__(33436); +const url = __webpack_require__(81279); +const { ResolverError } = __webpack_require__(1695); - return promiseApi; +module.exports = { + /** + * The order that this resolver will run, in relation to other resolvers. + * + * @type {number} + */ + order: 100, - }, {}); + /** + * Determines whether this resolver can read a given file reference. + * Resolvers that return true will be tried, in order, until one successfully resolves the file. + * Resolvers that return false will not be given a chance to resolve the file. + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @returns {boolean} + */ + canRead (file) { + return url.isFileSystemPath(file.url); + }, - function asyncWrapper (fn, git) { - return function () { - var args = [].slice.call(arguments); + /** + * Reads the given file and returns its raw contents as a Buffer. + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @returns {Promise} + */ + read (file) { + return new Promise(((resolve, reject) => { + let path; + try { + path = url.toFileSystemPath(file.url); + } + catch (err) { + reject(new ResolverError(ono.uri(err, `Malformed URI: ${file.url}`), file.url)); + } - if (typeof args[args.length] === 'function') { - throw new TypeError( - "Promise interface requires that handlers are not supplied inline, " + - "trailing function not allowed in call to " + fn); - } + // console.log('Opening file: %s', path); - return chain.then(function () { - return new Promise(function (resolve, reject) { - args.push(function (err, result) { - if (err) { - return reject(toError(err)); - } + try { + fs.readFile(path, (err, data) => { + if (err) { + reject(new ResolverError(ono(err, `Error opening file "${path}"`), path)); + } + else { + resolve(data); + } + }); + } + catch (err) { + reject(new ResolverError(ono(err, `Error opening file "${path}"`), path)); + } + })); + } +}; - resolve(result); - }); - git[fn].apply(git, args); - }); - }); - }; - } +/***/ }), - function syncWrapper (fn, git, api) { - return function () { - git[fn].apply(git, arguments); +/***/ 34147: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return api; - }; - } +"use strict"; -}; -function toError (error) { +const http = __webpack_require__(98605); +const https = __webpack_require__(57211); +const { ono } = __webpack_require__(33436); +const url = __webpack_require__(81279); +const { ResolverError } = __webpack_require__(1695); - if (error instanceof Error) { - return error; - } +module.exports = { + /** + * The order that this resolver will run, in relation to other resolvers. + * + * @type {number} + */ + order: 200, - if (typeof error === 'string') { - return new Error(error); - } + /** + * HTTP headers to send when downloading files. + * + * @example: + * { + * "User-Agent": "JSON Schema $Ref Parser", + * Accept: "application/json" + * } + * + * @type {object} + */ + headers: null, - return Object.create(new Error(error), { - git: { value: error }, - }); -} + /** + * HTTP request timeout (in milliseconds). + * + * @type {number} + */ + timeout: 5000, // 5 seconds + /** + * The maximum number of HTTP redirects to follow. + * To disable automatic following of redirects, set this to zero. + * + * @type {number} + */ + redirects: 5, -/***/ }), -/* 58 */, -/* 59 */ -/***/ (function(module) { + /** + * The `withCredentials` option of XMLHttpRequest. + * Set this to `true` if you're downloading files from a CORS-enabled server that requires authentication + * + * @type {boolean} + */ + withCredentials: false, -class ParserError extends Error { - constructor(e, json, errors) { - super(e); + /** + * Determines whether this resolver can read a given file reference. + * Resolvers that return true will be tried in order, until one successfully resolves the file. + * Resolvers that return false will not be given a chance to resolve the file. + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @returns {boolean} + */ + canRead (file) { + return url.isHttp(file.url); + }, - let msg; + /** + * Reads the given URL and returns its raw contents as a Buffer. + * + * @param {object} file - An object containing information about the referenced file + * @param {string} file.url - The full URL of the referenced file + * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) + * @returns {Promise} + */ + read (file) { + let u = url.parse(file.url); - if (typeof e === 'string') { - msg = e; - } - if (typeof e.message === 'string') { - msg = e.message; + if (process.browser && !u.protocol) { + // Use the protocol of the current page + u.protocol = url.parse(location.href).protocol; } - if (json) { - this.parsedJSON = json; - } + return download(u, this); + } +}; - if (errors) { - this.errors = errors; - } +/** + * Downloads the given file. + * + * @param {Url|string} u - The url to download (can be a parsed {@link Url} object) + * @param {object} httpOptions - The `options.resolve.http` object + * @param {number} [redirects] - The redirect URLs that have already been followed + * + * @returns {Promise} + * The promise resolves with the raw downloaded data, or rejects if there is an HTTP error. + */ +function download (u, httpOptions, redirects) { + return new Promise(((resolve, reject) => { + u = url.parse(u); + redirects = redirects || []; + redirects.push(u.href); - this.message = msg; - } + get(u, httpOptions) + .then((res) => { + if (res.statusCode >= 400) { + throw ono({ status: res.statusCode }, `HTTP ERROR ${res.statusCode}`); + } + else if (res.statusCode >= 300) { + if (redirects.length > httpOptions.redirects) { + reject(new ResolverError(ono({ status: res.statusCode }, + `Error downloading ${redirects[0]}. \nToo many redirects: \n ${redirects.join(" \n ")}`))); + } + else if (!res.headers.location) { + throw ono({ status: res.statusCode }, `HTTP ${res.statusCode} redirect with no location header`); + } + else { + // console.log('HTTP %d redirect %s -> %s', res.statusCode, u.href, res.headers.location); + let redirectTo = url.resolve(u, res.headers.location); + download(redirectTo, httpOptions, redirects).then(resolve, reject); + } + } + else { + resolve(res.body || Buffer.alloc(0)); + } + }) + .catch((err) => { + reject(new ResolverError(ono(err, `Error downloading ${u.href}`), u.href)); + }); + })); } -module.exports = ParserError; +/** + * Sends an HTTP GET request. + * + * @param {Url} u - A parsed {@link Url} object + * @param {object} httpOptions - The `options.resolve.http` object + * + * @returns {Promise} + * The promise resolves with the HTTP Response object. + */ +function get (u, httpOptions) { + return new Promise(((resolve, reject) => { + // console.log('GET', u.href); + let protocol = u.protocol === "https:" ? https : http; + let req = protocol.get({ + hostname: u.hostname, + port: u.port, + path: u.path, + auth: u.auth, + protocol: u.protocol, + headers: httpOptions.headers || {}, + withCredentials: httpOptions.withCredentials + }); -/***/ }), -/* 60 */, -/* 61 */, -/* 62 */, -/* 63 */, -/* 64 */, -/* 65 */, -/* 66 */, -/* 67 */, -/* 68 */, -/* 69 */, -/* 70 */ -/***/ (function(module) { + if (typeof req.setTimeout === "function") { + req.setTimeout(httpOptions.timeout); + } -module.exports = InvalidInputError + req.on("timeout", () => { + req.abort(); + }); -function InvalidInputError (message) { - this.name = 'InvalidInputError' - this.message = message -} + req.on("error", reject); -InvalidInputError.prototype = new Error() + req.once("response", (res) => { + res.body = Buffer.alloc(0); + res.on("data", (data) => { + res.body = Buffer.concat([res.body, Buffer.from(data)]); + }); -/***/ }), -/* 71 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + res.on("error", reject); -"use strict"; + res.on("end", () => { + resolve(res); + }); + }); + })); +} -const $Ref = __webpack_require__(289); -const Pointer = __webpack_require__(709); -const url = __webpack_require__(639); +/***/ }), -module.exports = bundle; +/***/ 1695: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/** - * Bundles all external JSON references into the main JSON schema, thus resulting in a schema that - * only has *internal* references, not any *external* references. - * This method mutates the JSON schema object, adding new references and re-mapping existing ones. - * - * @param {$RefParser} parser - * @param {$RefParserOptions} options - */ -function bundle (parser, options) { - // console.log('Bundling $ref pointers in %s', parser.$refs._root$Ref.path); +"use strict"; - // Build an inventory of all $ref pointers in the JSON Schema - let inventory = []; - crawl(parser, "schema", parser.$refs._root$Ref.path + "#", "#", 0, inventory, parser.$refs, options); - // Remap all $ref pointers - remap(inventory); -} +const { Ono } = __webpack_require__(33436); -/** - * Recursively crawls the given value, and inventories all JSON references. - * - * @param {object} parent - The object containing the value to crawl. If the value is not an object or array, it will be ignored. - * @param {string} key - The property key of `parent` to be crawled - * @param {string} path - The full path of the property being crawled, possibly with a JSON Pointer in the hash - * @param {string} pathFromRoot - The path of the property being crawled, from the schema root - * @param {object[]} inventory - An array of already-inventoried $ref pointers - * @param {$Refs} $refs - * @param {$RefParserOptions} options - */ -function crawl (parent, key, path, pathFromRoot, indirections, inventory, $refs, options) { - let obj = key === null ? parent : parent[key]; +const { stripHash, toFileSystemPath } = __webpack_require__(81279); - if (obj && typeof obj === "object") { - if ($Ref.isAllowed$Ref(obj)) { - inventory$Ref(parent, key, path, pathFromRoot, indirections, inventory, $refs, options); - } - else { - // Crawl the object in a specific order that's optimized for bundling. - // This is important because it determines how `pathFromRoot` gets built, - // which later determines which keys get dereferenced and which ones get remapped - let keys = Object.keys(obj) - .sort((a, b) => { - // Most people will expect references to be bundled into the the "definitions" property, - // so we always crawl that property first, if it exists. - if (a === "definitions") { - return -1; - } - else if (b === "definitions") { - return 1; - } - else { - // Otherwise, crawl the keys based on their length. - // This produces the shortest possible bundled references - return a.length - b.length; - } - }); +const JSONParserError = exports.JSONParserError = class JSONParserError extends Error { + constructor (message, source) { + super(); - // eslint-disable-next-line no-shadow - for (let key of keys) { - let keyPath = Pointer.join(path, key); - let keyPathFromRoot = Pointer.join(pathFromRoot, key); - let value = obj[key]; + this.code = "EUNKNOWN"; + this.message = message; + this.source = source; + this.path = null; - if ($Ref.isAllowed$Ref(value)) { - inventory$Ref(obj, key, path, keyPathFromRoot, indirections, inventory, $refs, options); - } - else { - crawl(obj, key, keyPath, keyPathFromRoot, indirections, inventory, $refs, options); - } - } - } + Ono.extend(this); } -} +}; -/** - * Inventories the given JSON Reference (i.e. records detailed information about it so we can - * optimize all $refs in the schema), and then crawls the resolved value. - * - * @param {object} $refParent - The object that contains a JSON Reference as one of its keys - * @param {string} $refKey - The key in `$refParent` that is a JSON Reference - * @param {string} path - The full path of the JSON Reference at `$refKey`, possibly with a JSON Pointer in the hash - * @param {string} pathFromRoot - The path of the JSON Reference at `$refKey`, from the schema root - * @param {object[]} inventory - An array of already-inventoried $ref pointers - * @param {$Refs} $refs - * @param {$RefParserOptions} options - */ -function inventory$Ref ($refParent, $refKey, path, pathFromRoot, indirections, inventory, $refs, options) { - let $ref = $refKey === null ? $refParent : $refParent[$refKey]; - let $refPath = url.resolve(path, $ref.$ref); - let pointer = $refs._resolve($refPath, options); - let depth = Pointer.parse(pathFromRoot).length; - let file = url.stripHash(pointer.path); - let hash = url.getHash(pointer.path); - let external = file !== $refs._root$Ref.path; - let extended = $Ref.isExtended$Ref($ref); - indirections += pointer.indirections; +setErrorName(JSONParserError); - let existingEntry = findInInventory(inventory, $refParent, $refKey); - if (existingEntry) { - // This $Ref has already been inventoried, so we don't need to process it again - if (depth < existingEntry.depth || indirections < existingEntry.indirections) { - removeFromInventory(inventory, existingEntry); - } - else { - return; - } - } +const JSONParserErrorGroup = exports.JSONParserErrorGroup = class JSONParserErrorGroup extends Error { + constructor (parser) { + super(); - inventory.push({ - $ref, // The JSON Reference (e.g. {$ref: string}) - parent: $refParent, // The object that contains this $ref pointer - key: $refKey, // The key in `parent` that is the $ref pointer - pathFromRoot, // The path to the $ref pointer, from the JSON Schema root - depth, // How far from the JSON Schema root is this $ref pointer? - file, // The file that the $ref pointer resolves to - hash, // The hash within `file` that the $ref pointer resolves to - value: pointer.value, // The resolved value of the $ref pointer - circular: pointer.circular, // Is this $ref pointer DIRECTLY circular? (i.e. it references itself) - extended, // Does this $ref extend its resolved value? (i.e. it has extra properties, in addition to "$ref") - external, // Does this $ref pointer point to a file other than the main JSON Schema file? - indirections, // The number of indirect references that were traversed to resolve the value - }); + this.files = parser; + this.message = `${this.errors.length} error${this.errors.length > 1 ? "s" : ""} occurred while reading '${toFileSystemPath(parser.$refs._root$Ref.path)}'`; - // Recursively crawl the resolved value - crawl(pointer.value, null, pointer.path, pathFromRoot, indirections + 1, inventory, $refs, options); -} + Ono.extend(this); + } -/** - * Re-maps every $ref pointer, so that they're all relative to the root of the JSON Schema. - * Each referenced value is dereferenced EXACTLY ONCE. All subsequent references to the same - * value are re-mapped to point to the first reference. - * - * @example: - * { - * first: { $ref: somefile.json#/some/part }, - * second: { $ref: somefile.json#/another/part }, - * third: { $ref: somefile.json }, - * fourth: { $ref: somefile.json#/some/part/sub/part } - * } - * - * In this example, there are four references to the same file, but since the third reference points - * to the ENTIRE file, that's the only one we need to dereference. The other three can just be - * remapped to point inside the third one. - * - * On the other hand, if the third reference DIDN'T exist, then the first and second would both need - * to be dereferenced, since they point to different parts of the file. The fourth reference does NOT - * need to be dereferenced, because it can be remapped to point inside the first one. - * - * @param {object[]} inventory - */ -function remap (inventory) { - // Group & sort all the $ref pointers, so they're in the order that we need to dereference/remap them - inventory.sort((a, b) => { - if (a.file !== b.file) { - // Group all the $refs that point to the same file - return a.file < b.file ? -1 : +1; - } - else if (a.hash !== b.hash) { - // Group all the $refs that point to the same part of the file - return a.hash < b.hash ? -1 : +1; - } - else if (a.circular !== b.circular) { - // If the $ref points to itself, then sort it higher than other $refs that point to this $ref - return a.circular ? -1 : +1; - } - else if (a.extended !== b.extended) { - // If the $ref extends the resolved value, then sort it lower than other $refs that don't extend the value - return a.extended ? +1 : -1; - } - else if (a.indirections !== b.indirections) { - // Sort direct references higher than indirect references - return a.indirections - b.indirections; - } - else if (a.depth !== b.depth) { - // Sort $refs by how close they are to the JSON Schema root - return a.depth - b.depth; - } - else { - // Determine how far each $ref is from the "definitions" property. - // Most people will expect references to be bundled into the the "definitions" property if possible. - let aDefinitionsIndex = a.pathFromRoot.lastIndexOf("/definitions"); - let bDefinitionsIndex = b.pathFromRoot.lastIndexOf("/definitions"); + static getParserErrors (parser) { + const errors = []; - if (aDefinitionsIndex !== bDefinitionsIndex) { - // Give higher priority to the $ref that's closer to the "definitions" property - return bDefinitionsIndex - aDefinitionsIndex; - } - else { - // All else is equal, so use the shorter path, which will produce the shortest possible reference - return a.pathFromRoot.length - b.pathFromRoot.length; + for (const $ref of Object.values(parser.$refs._$refs)) { + if ($ref.errors) { + errors.push(...$ref.errors); } } - }); - - let file, hash, pathFromRoot; - for (let entry of inventory) { - // console.log('Re-mapping $ref pointer "%s" at %s', entry.$ref.$ref, entry.pathFromRoot); - if (!entry.external) { - // This $ref already resolves to the main JSON Schema file - entry.$ref.$ref = entry.hash; - } - else if (entry.file === file && entry.hash === hash) { - // This $ref points to the same value as the prevous $ref, so remap it to the same path - entry.$ref.$ref = pathFromRoot; - } - else if (entry.file === file && entry.hash.indexOf(hash + "/") === 0) { - // This $ref points to a sub-value of the prevous $ref, so remap it beneath that path - entry.$ref.$ref = Pointer.join(pathFromRoot, Pointer.parse(entry.hash.replace(hash, "#"))); - } - else { - // We've moved to a new file or new hash - file = entry.file; - hash = entry.hash; - pathFromRoot = entry.pathFromRoot; + return errors; + } - // This is the first $ref to point to this value, so dereference the value. - // Any other $refs that point to the same value will point to this $ref instead - entry.$ref = entry.parent[entry.key] = $Ref.dereference(entry.$ref, entry.value); + get errors () { + return JSONParserErrorGroup.getParserErrors(this.files); + } +}; - if (entry.circular) { - // This $ref points to itself - entry.$ref.$ref = entry.pathFromRoot; - } - } +setErrorName(JSONParserErrorGroup); - // console.log(' new value: %s', (entry.$ref && entry.$ref.$ref) ? entry.$ref.$ref : '[object Object]'); - } -} +const ParserError = exports.ParserError = class ParserError extends JSONParserError { + constructor (message, source) { + super(`Error parsing ${source}: ${message}`, source); -/** - * TODO - */ -function findInInventory (inventory, $refParent, $refKey) { - for (let i = 0; i < inventory.length; i++) { - let existingEntry = inventory[i]; - if (existingEntry.parent === $refParent && existingEntry.key === $refKey) { - return existingEntry; - } + this.code = "EPARSER"; } -} +}; -function removeFromInventory (inventory, entry) { - let index = inventory.indexOf(entry); - inventory.splice(index, 1); -} +setErrorName(ParserError); +const UnmatchedParserError = exports.UnmatchedParserError = class UnmatchedParserError extends JSONParserError { + constructor (source) { + super(`Could not find parser for "${source}"`, source); -/***/ }), -/* 72 */, -/* 73 */, -/* 74 */ -/***/ (function(module) { + this.code = "EUNMATCHEDPARSER"; + } +}; -module.exports = {"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#","description":"Meta-schema for $data reference (JSON-schema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}; +setErrorName(UnmatchedParserError); -/***/ }), -/* 75 */, -/* 76 */ -/***/ (function(module) { +const ResolverError = exports.ResolverError = class ResolverError extends JSONParserError { + constructor (ex, source) { + super(ex.message || `Error reading file "${source}"`, source); -"use strict"; + this.code = "ERESOLVER"; -module.exports = function generate_anyOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $noEmptySchema = $schema.every(function($sch) { - return it.util.schemaHasRules($sch, it.RULES.all); - }); - if ($noEmptySchema) { - var $currentBaseId = $it.baseId; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; - $closingBraces += '}'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should match some schema in anyOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - out = it.util.cleanUpCode(out); - } else { - if ($breakOnError) { - out += ' if (true) { '; + if ("code" in ex) { + this.ioErrorCode = String(ex.code); } } - return out; -} +}; +setErrorName(ResolverError); -/***/ }), -/* 77 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +const UnmatchedResolverError = exports.UnmatchedResolverError = class UnmatchedResolverError extends JSONParserError { + constructor (source) { + super(`Could not find resolver for "${source}"`, source); -"use strict"; + this.code = "EUNMATCHEDRESOLVER"; + } +}; +setErrorName(UnmatchedResolverError); -var resolve = __webpack_require__(545); +const MissingPointerError = exports.MissingPointerError = class MissingPointerError extends JSONParserError { + constructor (token, path) { + super(`Token "${token}" does not exist.`, stripHash(path)); -module.exports = { - Validation: errorSubclass(ValidationError), - MissingRef: errorSubclass(MissingRefError) + this.code = "EMISSINGPOINTER"; + } }; +setErrorName(MissingPointerError); -function ValidationError(errors) { - this.message = 'validation failed'; - this.errors = errors; - this.ajv = this.validation = true; -} - +const InvalidPointerError = exports.InvalidPointerError = class InvalidPointerError extends JSONParserError { + constructor (pointer, path) { + super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, stripHash(path)); -MissingRefError.message = function (baseId, ref) { - return 'can\'t resolve reference ' + ref + ' from id ' + baseId; + this.code = "EINVALIDPOINTER"; + } }; +setErrorName(InvalidPointerError); -function MissingRefError(baseId, ref, message) { - this.message = message || MissingRefError.message(baseId, ref); - this.missingRef = resolve.url(baseId, ref); - this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef)); +function setErrorName (err) { + Object.defineProperty(err.prototype, "name", { + value: err.name, + enumerable: true, + }); } +exports.isHandledError = function (err) { + return err instanceof JSONParserError || err instanceof JSONParserErrorGroup; +}; -function errorSubclass(Subclass) { - Subclass.prototype = Object.create(Error.prototype); - Subclass.prototype.constructor = Subclass; - return Subclass; -} +exports.normalizeError = function (err) { + if (err.path === null) { + err.path = []; + } + + return err; +}; /***/ }), -/* 78 */, -/* 79 */, -/* 80 */, -/* 81 */ -/***/ (function(module, exports, __webpack_require__) { -/** - * Module dependencies. - */ +/***/ 14601: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; -const tty = __webpack_require__(993); -const util = __webpack_require__(669); /** - * This is the Node.js implementation of `debug()`. + * Returns the given plugins as an array, rather than an object map. + * All other methods in this module expect an array of plugins rather than an object map. + * + * @param {object} plugins - A map of plugin objects + * @return {object[]} */ - -exports.init = init; -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; +exports.all = function (plugins) { + return Object.keys(plugins) + .filter((key) => { + return typeof plugins[key] === "object"; + }) + .map((key) => { + plugins[key].name = key; + return plugins[key]; + }); +}; /** - * Colors. + * Filters the given plugins, returning only the ones return `true` for the given method. + * + * @param {object[]} plugins - An array of plugin objects + * @param {string} method - The name of the filter method to invoke for each plugin + * @param {object} file - A file info object, which will be passed to each method + * @return {object[]} */ +exports.filter = function (plugins, method, file) { + return plugins + .filter((plugin) => { + return !!getResult(plugin, method, file); + }); +}; -exports.colors = [6, 2, 3, 4, 5, 1]; - -try { - // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) - // eslint-disable-next-line import/no-extraneous-dependencies - const supportsColor = __webpack_require__(106); +/** + * Sorts the given plugins, in place, by their `order` property. + * + * @param {object[]} plugins - An array of plugin objects + * @returns {object[]} + */ +exports.sort = function (plugins) { + for (let plugin of plugins) { + plugin.order = plugin.order || Number.MAX_SAFE_INTEGER; + } - if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { - exports.colors = [ - 20, - 21, - 26, - 27, - 32, - 33, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 56, - 57, - 62, - 63, - 68, - 69, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 92, - 93, - 98, - 99, - 112, - 113, - 128, - 129, - 134, - 135, - 148, - 149, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 168, - 169, - 170, - 171, - 172, - 173, - 178, - 179, - 184, - 185, - 196, - 197, - 198, - 199, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - 208, - 209, - 214, - 215, - 220, - 221 - ]; - } -} catch (error) { - // Swallow - we only care if `supports-color` is available; it doesn't have to be. -} + return plugins.sort((a, b) => { return a.order - b.order; }); +}; /** - * Build up the default `inspectOpts` object from the environment variables. + * Runs the specified method of the given plugins, in order, until one of them returns a successful result. + * Each method can return a synchronous value, a Promise, or call an error-first callback. + * If the promise resolves successfully, or the callback is called without an error, then the result + * is immediately returned and no further plugins are called. + * If the promise rejects, or the callback is called with an error, then the next plugin is called. + * If ALL plugins fail, then the last error is thrown. * - * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + * @param {object[]} plugins - An array of plugin objects + * @param {string} method - The name of the method to invoke for each plugin + * @param {object} file - A file info object, which will be passed to each method + * @returns {Promise} */ +exports.run = function (plugins, method, file, $refs) { + let plugin, lastError, index = 0; -exports.inspectOpts = Object.keys(process.env).filter(key => { - return /^debug_/i.test(key); -}).reduce((obj, key) => { - // Camel-case - const prop = key - .substring(6) - .toLowerCase() - .replace(/_([a-z])/g, (_, k) => { - return k.toUpperCase(); - }); + return new Promise(((resolve, reject) => { + runNextPlugin(); - // Coerce string value into JS value - let val = process.env[key]; - if (/^(yes|on|true|enabled)$/i.test(val)) { - val = true; - } else if (/^(no|off|false|disabled)$/i.test(val)) { - val = false; - } else if (val === 'null') { - val = null; - } else { - val = Number(val); - } + function runNextPlugin () { + plugin = plugins[index++]; + if (!plugin) { + // There are no more functions, so re-throw the last error + return reject(lastError); + } - obj[prop] = val; - return obj; -}, {}); + try { + // console.log(' %s', plugin.name); + let result = getResult(plugin, method, file, callback, $refs); + if (result && typeof result.then === "function") { + // A promise was returned + result.then(onSuccess, onError); + } + else if (result !== undefined) { + // A synchronous result was returned + onSuccess(result); + } + else if (index === plugins.length) { + throw new Error("No promise has been returned or callback has been called."); + } + } + catch (e) { + onError(e); + } + } -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ + function callback (err, result) { + if (err) { + onError(err); + } + else { + onSuccess(result); + } + } -function useColors() { - return 'colors' in exports.inspectOpts ? - Boolean(exports.inspectOpts.colors) : - tty.isatty(process.stderr.fd); -} + function onSuccess (result) { + // console.log(' success'); + resolve({ + plugin, + result + }); + } + + function onError (error) { + // console.log(' %s', err.message || err); + lastError = { + plugin, + error, + }; + runNextPlugin(); + } + })); +}; /** - * Adds ANSI color escape codes if enabled. + * Returns the value of the given property. + * If the property is a function, then the result of the function is returned. + * If the value is a RegExp, then it will be tested against the file URL. + * If the value is an aray, then it will be compared against the file extension. * - * @api public + * @param {object} obj - The object whose property/method is called + * @param {string} prop - The name of the property/method to invoke + * @param {object} file - A file info object, which will be passed to the method + * @param {function} [callback] - A callback function, which will be passed to the method + * @returns {*} */ +function getResult (obj, prop, file, callback, $refs) { + let value = obj[prop]; -function formatArgs(args) { - const {namespace: name, useColors} = this; + if (typeof value === "function") { + return value.apply(obj, [file, callback, $refs]); + } - if (useColors) { - const c = this.color; - const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); - const prefix = ` ${colorCode};1m${name} \u001B[0m`; + if (!callback) { + // The synchronous plugin functions (canParse and canRead) + // allow a "shorthand" syntax, where the user can match + // files by RegExp or by file extension. + if (value instanceof RegExp) { + return value.test(file.url); + } + else if (typeof value === "string") { + return value === file.extension; + } + else if (Array.isArray(value)) { + return value.indexOf(file.extension) !== -1; + } + } - args[0] = prefix + args[0].split('\n').join('\n' + prefix); - args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); - } else { - args[0] = getDate() + name + ' ' + args[0]; - } + return value; } -function getDate() { - if (exports.inspectOpts.hideDate) { - return ''; - } - return new Date().toISOString() + ' '; -} + +/***/ }), + +/***/ 81279: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +let isWindows = /^win/.test(process.platform), + forwardSlashPattern = /\//g, + protocolPattern = /^(\w{2,}):\/\//i, + url = module.exports, + jsonPointerSlash = /~1/g, + jsonPointerTilde = /~0/g; + +// RegExp patterns to URL-encode special characters in local filesystem paths +let urlEncodePatterns = [ + /\?/g, "%3F", + /\#/g, "%23", +]; + +// RegExp patterns to URL-decode special characters for local filesystem paths +let urlDecodePatterns = [ + /\%23/g, "#", + /\%24/g, "$", + /\%26/g, "&", + /\%2C/g, ",", + /\%40/g, "@" +]; + +exports.parse = __webpack_require__(78835).parse; +exports.resolve = __webpack_require__(78835).resolve; /** - * Invokes `util.format()` with the specified arguments and writes to stderr. + * Returns the current working directory (in Node) or the current page URL (in browsers). + * + * @returns {string} */ +exports.cwd = function cwd () { + if (process.browser) { + return location.href; + } -function log(...args) { - return process.stderr.write(util.format(...args) + '\n'); -} + let path = process.cwd(); + + let lastChar = path.slice(-1); + if (lastChar === "/" || lastChar === "\\") { + return path; + } + else { + return path + "/"; + } +}; /** - * Save `namespaces`. + * Returns the protocol of the given URL, or `undefined` if it has no protocol. * - * @param {String} namespaces - * @api private + * @param {string} path + * @returns {?string} */ -function save(namespaces) { - if (namespaces) { - process.env.DEBUG = namespaces; - } else { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } -} +exports.getProtocol = function getProtocol (path) { + let match = protocolPattern.exec(path); + if (match) { + return match[1].toLowerCase(); + } +}; /** - * Load `namespaces`. + * Returns the lowercased file extension of the given URL, + * or an empty string if it has no extension. * - * @return {String} returns the previously persisted debug modes - * @api private + * @param {string} path + * @returns {string} */ - -function load() { - return process.env.DEBUG; -} +exports.getExtension = function getExtension (path) { + let lastDot = path.lastIndexOf("."); + if (lastDot >= 0) { + return path.substr(lastDot).toLowerCase(); + } + return ""; +}; /** - * Init logic for `debug` instances. + * Returns the hash (URL fragment), of the given path. + * If there is no hash, then the root hash ("#") is returned. * - * Create a new `inspectOpts` object in case `useColors` is set - * differently for a particular `debug` instance. + * @param {string} path + * @returns {string} */ - -function init(debug) { - debug.inspectOpts = {}; - - const keys = Object.keys(exports.inspectOpts); - for (let i = 0; i < keys.length; i++) { - debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; - } -} - -module.exports = __webpack_require__(649)(exports); - -const {formatters} = module.exports; +exports.getHash = function getHash (path) { + let hashIndex = path.indexOf("#"); + if (hashIndex >= 0) { + return path.substr(hashIndex); + } + return "#"; +}; /** - * Map %o to `util.inspect()`, all on a single line. + * Removes the hash (URL fragment), if any, from the given path. + * + * @param {string} path + * @returns {string} */ +exports.stripHash = function stripHash (path) { + let hashIndex = path.indexOf("#"); + if (hashIndex >= 0) { + path = path.substr(0, hashIndex); + } + return path; +}; -formatters.o = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts) - .replace(/\s*\n\s*/g, ' '); +/** + * Determines whether the given path is an HTTP(S) URL. + * + * @param {string} path + * @returns {boolean} + */ +exports.isHttp = function isHttp (path) { + let protocol = url.getProtocol(path); + if (protocol === "http" || protocol === "https") { + return true; + } + else if (protocol === undefined) { + // There is no protocol. If we're running in a browser, then assume it's HTTP. + return process.browser; + } + else { + // It's some other protocol, such as "ftp://", "mongodb://", etc. + return false; + } }; /** - * Map %O to `util.inspect()`, allowing multiple lines if needed. + * Determines whether the given path is a filesystem path. + * This includes "file://" URLs. + * + * @param {string} path + * @returns {boolean} */ +exports.isFileSystemPath = function isFileSystemPath (path) { + if (process.browser) { + // We're running in a browser, so assume that all paths are URLs. + // This way, even relative paths will be treated as URLs rather than as filesystem paths + return false; + } -formatters.O = function (v) { - this.inspectOpts.colors = this.useColors; - return util.inspect(v, this.inspectOpts); + let protocol = url.getProtocol(path); + return protocol === undefined || protocol === "file"; }; +/** + * Converts a filesystem path to a properly-encoded URL. + * + * This is intended to handle situations where JSON Schema $Ref Parser is called + * with a filesystem path that contains characters which are not allowed in URLs. + * + * @example + * The following filesystem paths would be converted to the following URLs: + * + * <"!@#$%^&*+=?'>.json ==> %3C%22!@%23$%25%5E&*+=%3F\'%3E.json + * C:\\My Documents\\File (1).json ==> C:/My%20Documents/File%20(1).json + * file://Project #42/file.json ==> file://Project%20%2342/file.json + * + * @param {string} path + * @returns {string} + */ +exports.fromFileSystemPath = function fromFileSystemPath (path) { + // Step 1: On Windows, replace backslashes with forward slashes, + // rather than encoding them as "%5C" + if (isWindows) { + path = path.replace(/\\/g, "/"); + } -/***/ }), -/* 82 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + // Step 2: `encodeURI` will take care of MOST characters + path = encodeURI(path); -"use strict"; + // Step 3: Manually encode characters that are not encoded by `encodeURI`. + // This includes characters such as "#" and "?", which have special meaning in URLs, + // but are just normal characters in a filesystem path. + for (let i = 0; i < urlEncodePatterns.length; i += 2) { + path = path.replace(urlEncodePatterns[i], urlEncodePatterns[i + 1]); + } + return path; +}; -var Type = __webpack_require__(945); +/** + * Converts a URL to a local filesystem path. + * + * @param {string} path + * @param {boolean} [keepFileProtocol] - If true, then "file://" will NOT be stripped + * @returns {string} + */ +exports.toFileSystemPath = function toFileSystemPath (path, keepFileProtocol) { + // Step 1: `decodeURI` will decode characters such as Cyrillic characters, spaces, etc. + path = decodeURI(path); -var YAML_DATE_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9])' + // [2] month - '-([0-9][0-9])$'); // [3] day + // Step 2: Manually decode characters that are not decoded by `decodeURI`. + // This includes characters such as "#" and "?", which have special meaning in URLs, + // but are just normal characters in a filesystem path. + for (let i = 0; i < urlDecodePatterns.length; i += 2) { + path = path.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]); + } -var YAML_TIMESTAMP_REGEXP = new RegExp( - '^([0-9][0-9][0-9][0-9])' + // [1] year - '-([0-9][0-9]?)' + // [2] month - '-([0-9][0-9]?)' + // [3] day - '(?:[Tt]|[ \\t]+)' + // ... - '([0-9][0-9]?)' + // [4] hour - ':([0-9][0-9])' + // [5] minute - ':([0-9][0-9])' + // [6] second - '(?:\\.([0-9]*))?' + // [7] fraction - '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour - '(?::([0-9][0-9]))?))?$'); // [11] tz_minute - -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; -} - -function constructYamlTimestamp(data) { - var match, year, month, day, hour, minute, second, fraction = 0, - delta = null, tz_hour, tz_minute, date; - - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - - if (match === null) throw new Error('Date resolve error'); - - // match: [1] year [2] month [3] day + // Step 3: If it's a "file://" URL, then format it consistently + // or convert it to a local filesystem path + let isFileUrl = path.substr(0, 7).toLowerCase() === "file://"; + if (isFileUrl) { + // Strip-off the protocol, and the initial "/", if there is one + path = path[7] === "/" ? path.substr(8) : path.substr(7); - year = +(match[1]); - month = +(match[2]) - 1; // JS month starts with 0 - day = +(match[3]); + // insert a colon (":") after the drive letter on Windows + if (isWindows && path[1] === "/") { + path = path[0] + ":" + path.substr(1); + } - if (!match[4]) { // no hour - return new Date(Date.UTC(year, month, day)); + if (keepFileProtocol) { + // Return the consistently-formatted "file://" URL + path = "file:///" + path; + } + else { + // Convert the "file://" URL to a local filesystem path. + // On Windows, it will start with something like "C:/". + // On Posix, it will start with "/" + isFileUrl = false; + path = isWindows ? path : "/" + path; + } } - // match: [4] hour [5] minute [6] second [7] fraction - - hour = +(match[4]); - minute = +(match[5]); - second = +(match[6]); + // Step 4: Normalize Windows paths (unless it's a "file://" URL) + if (isWindows && !isFileUrl) { + // Replace forward slashes with backslashes + path = path.replace(forwardSlashPattern, "\\"); - if (match[7]) { - fraction = match[7].slice(0, 3); - while (fraction.length < 3) { // milli-seconds - fraction += '0'; + // Capitalize the drive letter + if (path.substr(1, 2) === ":\\") { + path = path[0].toUpperCase() + path.substr(1); } - fraction = +fraction; } - // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute + return path; +}; - if (match[9]) { - tz_hour = +(match[10]); - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - if (match[9] === '-') delta = -delta; +/** + * Converts a $ref pointer to a valid JSON Path. + * + * @param {string} pointer + * @returns {Array} + */ +exports.safePointerToPath = function safePointerToPath (pointer) { + if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") { + return []; } - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); + return pointer + .slice(2) + .split("/") + .map((value) => { + return decodeURIComponent(value) + .replace(jsonPointerSlash, "/") + .replace(jsonPointerTilde, "~"); + }); +}; - if (delta) date.setTime(date.getTime() - delta); - return date; -} +/***/ }), -function representYamlTimestamp(object /*, style*/) { - return object.toISOString(); -} +/***/ 89067: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = new Type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); +const { avroToJsonSchema } = __webpack_require__(71228); +module.exports.parse = async ({ message, defaultSchemaFormat }) => { + const transformed = await avroToJsonSchema(message.payload); -/***/ }), -/* 83 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + message['x-parser-original-schema-format'] = message.schemaFormat || defaultSchemaFormat; + message['x-parser-original-payload'] = message.payload; + message.payload = transformed; + delete message.schemaFormat; +}; -"use strict"; +module.exports.getMimeTypes = () => { + return [ + 'application/vnd.apache.avro;version=1.9.0', + 'application/vnd.apache.avro+json;version=1.9.0', + 'application/vnd.apache.avro+yaml;version=1.9.0', + 'application/vnd.apache.avro;version=1.8.2', + 'application/vnd.apache.avro+json;version=1.8.2', + 'application/vnd.apache.avro+yaml;version=1.8.2' + ]; +}; -const path = __webpack_require__(622); -const trimRepeated = __webpack_require__(165); -const filenameReservedRegex = __webpack_require__(634); -const stripOuter = __webpack_require__(448); -// Doesn't make sense to have longer filenames -const MAX_FILENAME_LENGTH = 100; +/***/ }), -const reControlChars = /[\u0000-\u001f\u0080-\u009f]/g; // eslint-disable-line no-control-regex -const reRelativePath = /^\.+/; +/***/ 71228: +/***/ ((module) => { + +const BYTES_PATTERN = '^[\u0000-\u00ff]*$'; +const INT_MIN = Math.pow(-2, 31); +const INT_MAX = Math.pow(2, 31) - 1; +const LONG_MIN = Math.pow(-2, 63); +const LONG_MAX = Math.pow(2, 63) - 1; + +const typeMappings = { + null: 'null', + boolean: 'boolean', + int: 'integer', + long: 'integer', + float: 'number', + double: 'number', + bytes: 'string', + string: 'string', + fixed: 'string', + map: 'object', + array: 'array', + enum: 'string', + record: 'object', + uuid: 'string', +}; -const filenamify = (string, options = {}) => { - if (typeof string !== 'string') { - throw new TypeError('Expected a string'); - } +module.exports.avroToJsonSchema = async function avroToJsonSchema(avroDefinition) { + const jsonSchema = {}; + const isUnion = Array.isArray(avroDefinition); - const replacement = options.replacement === undefined ? '!' : options.replacement; + if (isUnion) { + jsonSchema.oneOf = []; + for (const avroDef of avroDefinition) { + const def = await avroToJsonSchema(avroDef); + jsonSchema.oneOf.push(def); + } - if (filenameReservedRegex().test(replacement) && reControlChars.test(replacement)) { - throw new Error('Replacement string cannot contain reserved filename characters'); - } + return jsonSchema; + } + + // Avro definition can be a string (e.g. "int") + // or an object like { type: "int" } + const type = avroDefinition.type || avroDefinition; + jsonSchema.type = typeMappings[type]; + + switch (type) { + case 'int': + jsonSchema.minimum = INT_MIN; + jsonSchema.maximum = INT_MAX; + break; + case 'long': + jsonSchema.minimum = LONG_MIN; + jsonSchema.maximum = LONG_MAX; + break; + case 'bytes': + jsonSchema.pattern = BYTES_PATTERN; + break; + case 'fixed': + jsonSchema.pattern = BYTES_PATTERN; + jsonSchema.minLength = avroDefinition.size; + jsonSchema.maxLength = avroDefinition.size; + break; + case 'map': + jsonSchema.additionalProperties = await avroToJsonSchema(avroDefinition.values); + break; + case 'array': + jsonSchema.items = await avroToJsonSchema(avroDefinition.items); + break; + case 'enum': + jsonSchema.enum = avroDefinition.symbols; + break; + case 'record': + const propsMap = new Map(); + for (const field of avroDefinition.fields) { + const def = await avroToJsonSchema(field.type); + if (field.doc) def.description = field.doc; + if (field.default) def.default = field.default; + propsMap.set(field.name, def); + } + jsonSchema.properties = Object.fromEntries(propsMap.entries()); + break; + } + + if (avroDefinition.doc) jsonSchema.description = avroDefinition.doc; + if (avroDefinition.default !== undefined) jsonSchema.default = avroDefinition.default; + + return jsonSchema; +}; - string = string.replace(filenameReservedRegex(), replacement); - string = string.replace(reControlChars, replacement); - string = string.replace(reRelativePath, replacement); - if (replacement.length > 0) { - string = trimRepeated(string, replacement); - string = string.length > 1 ? stripOuter(string, replacement) : string; - } +/***/ }), - string = filenameReservedRegex.windowsNames().test(string) ? string + replacement : string; - string = string.slice(0, typeof options.maxLength === 'number' ? options.maxLength : MAX_FILENAME_LENGTH); +/***/ 80851: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return string; -}; +const path = __webpack_require__(85622); +const fs = __webpack_require__(35747); +const xfs = __webpack_require__(52088); +const { isLocalTemplate } = __webpack_require__(65015); -filenamify.path = (filePath, options) => { - filePath = path.resolve(filePath); - return path.join(path.dirname(filePath), filenamify(path.basename(filePath), options)); +/** + * Registers all template filters. + * @param {Object} nunjucks Nunjucks environment. + * @param {Object} templateConfig Template configuration. + * @param {String} templateDir Directory where template is located. + * @param {String} filtersDir Directory where local filters are located. + */ +module.exports.registerFilters = async (nunjucks, templateConfig, templateDir, filtersDir) => { + await registerLocalFilters(nunjucks, templateDir, filtersDir); + await registerConfigFilters(nunjucks, templateDir, templateConfig); }; -module.exports = filenamify; +/** + * Registers the local template filters. + * @private + * @param {Object} nunjucks Nunjucks environment. + * @param {String} templateDir Directory where template is located. + * @param {String} filtersDir Directory where local filters are located. + */ +function registerLocalFilters(nunjucks, templateDir, filtersDir) { + return new Promise((resolve, reject) => { + const localFilters = path.resolve(templateDir, filtersDir); + if (!fs.existsSync(localFilters)) return resolve(); -/***/ }), -/* 84 */, -/* 85 */ -/***/ (function(module) { + const walker = xfs.walk(localFilters, { + followLinks: false + }); -"use strict"; + walker.on('file', async (root, stats, next) => { + try { + const filePath = path.resolve(templateDir, path.resolve(root, stats.name)); + // If it's a module constructor, inject dependencies to ensure consistent usage in remote templates in other projects or plain directories. + delete require.cache[require.resolve(filePath)]; + const mod = require(filePath); -module.exports = function generate__limitItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $op = $keyword == 'maxItems' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxItems') { - out += 'more'; - } else { - out += 'fewer'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); + addFilters(nunjucks, mod); + + next(); + } catch (e) { + reject(e); } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - - -/***/ }), -/* 86 */ -/***/ (function(module) { + }); -"use strict"; + walker.on('errors', (root, nodeStatsArray) => { + reject(nodeStatsArray); + }); -module.exports = function generate_const(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!$isData) { - out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to constant\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; - } - return out; + walker.on('end', async () => { + resolve(); + }); + }); } +/** +* Registers the additionally configured filters. +* @private +* @param {Object} nunjucks Nunjucks environment. +* @param {String} templateDir Directory where template is located. +* @param {Object} templateConfig Template configuration. +*/ +async function registerConfigFilters(nunjucks, templateDir, templateConfig) { + const confFilters = templateConfig.filters; + const DEFAULT_MODULES_DIR = 'node_modules'; + if (!Array.isArray(confFilters)) return; -/***/ }), -/* 87 */ -/***/ (function(module) { - -module.exports = require("os"); - -/***/ }), -/* 88 */, -/* 89 */, -/* 90 */, -/* 91 */, -/* 92 */, -/* 93 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -var Stream = __webpack_require__(413).Stream + const promises = confFilters.map(async el => { + const modulePath = await isLocalTemplate(templateDir) ? path.resolve(templateDir, DEFAULT_MODULES_DIR, el) : el; + const mod = require(modulePath); -module.exports = legacy + addFilters(nunjucks, mod); + }); -function legacy (fs) { - return { - ReadStream: ReadStream, - WriteStream: WriteStream - } + await Promise.all(promises); +} - function ReadStream (path, options) { - if (!(this instanceof ReadStream)) return new ReadStream(path, options); +/** + * Add filter functions to Nunjucks environment. Only owned functions from the module are added. + * @private + * @param {Object} nunjucks Nunjucks environment. + * @param {Object} filters Module with functions. + */ +function addFilters(nunjucks, filters) { + Object.getOwnPropertyNames(filters).forEach((key) => { + const value = filters[key]; + if (!(value instanceof Function)) return; - Stream.call(this); + nunjucks.addFilter(key, value); + }); +} - var self = this; - this.path = path; - this.fd = null; - this.readable = true; - this.paused = false; +/***/ }), - this.flags = 'r'; - this.mode = 438; /*=0666*/ - this.bufferSize = 64 * 1024; +/***/ 56814: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +function __ncc_wildcard$0 (arg) { + if (arg === "@asyncapi/generator-filters/node_modules/markdown-it") return __webpack_require__(67387); + else if (arg === "@asyncapi/generator-filters") return __webpack_require__(81195); + else if (arg === "@asyncapi/markdown-template") return __webpack_require__(65035); + else if (arg === "argparse") return __webpack_require__(30313); + else if (arg === "commander") return __webpack_require__(50274); + else if (arg === "entities") return __webpack_require__(99589); + else if (arg === "foreach") return __webpack_require__(99945); + else if (arg === "json-pointer") return __webpack_require__(46587); + else if (arg === "linkify-it") return __webpack_require__(6016); + else if (arg === "lodash") return __webpack_require__(77234); + else if (arg === "mdurl") return __webpack_require__(42896); + else if (arg === "openapi-sampler") return __webpack_require__(10525); + else if (arg === "semver") return __webpack_require__(9968); + else if (arg === "sprintf-js") return __webpack_require__(87475); + else if (arg === "uc.micro") return __webpack_require__(19909); +} +const path = __webpack_require__(85622); +const fs = __webpack_require__(35747); +const xfs = __webpack_require__(52088); +const minimatch = __webpack_require__(83973); +const parser = __webpack_require__(44479); +const { parse, AsyncAPIDocument } = parser; +const ramlDtParser = __webpack_require__(54443); +const openapiSchemaParser = __webpack_require__(3149); +const avroSchemaParser = __webpack_require__(89067); +const Nunjucks = __webpack_require__(17006); +const jmespath = __webpack_require__(87783); +const filenamify = __webpack_require__(16094); +const git = __webpack_require__(18577); +const npmi = __webpack_require__(69039); +const log = __webpack_require__(78063); +const { validateTemplateConfig } = __webpack_require__(45881); +const { + convertMapToObject, + isFileSystemPath, + beautifyNpmiResult, + isLocalTemplate, + getLocalTemplateDetails, + readFile, + readDir, + writeFile, + copyFile, + exists, + fetchSpec, + getInvalidOptions +} = __webpack_require__(65015); +const { registerFilters } = __webpack_require__(80851); +const { registerHooks } = __webpack_require__(27014); - options = options || {}; +parser.registerSchemaParser(openapiSchemaParser); +parser.registerSchemaParser(ramlDtParser); +parser.registerSchemaParser(avroSchemaParser); - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } +const FILTERS_DIRNAME = 'filters'; +const HOOKS_DIRNAME = 'hooks'; +const CONFIG_FILENAME = 'package.json'; +const PACKAGE_JSON_FILENAME = 'package.json'; +const GIT_IGNORE_FILENAME = '{.gitignore}'; +const NPM_IGNORE_FILENAME = '{.npmignore}'; +const ROOT_DIR = path.resolve(__dirname, '..'); +const DEFAULT_TEMPLATES_DIR = path.resolve(ROOT_DIR, 'node_modules'); +const TEMPLATE_CONTENT_DIRNAME = 'template'; +const GENERATOR_OPTIONS = ['debug', 'disabledHooks', 'entrypoint', 'forceWrite', 'install', 'noOverwriteGlobs', 'output', 'templateParams']; - if (this.encoding) this.setEncoding(this.encoding); +const shouldIgnoreFile = filePath => + filePath.startsWith(`.git${path.sep}`); - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.end === undefined) { - this.end = Infinity; - } else if ('number' !== typeof this.end) { - throw TypeError('end must be a Number'); - } +const shouldIgnoreDir = dirPath => + dirPath === '.git' + || dirPath.startsWith(`.git${path.sep}`); - if (this.start > this.end) { - throw new Error('start must be <= end'); - } +class Generator { + /** + * Instantiates a new Generator object. + * + * @example + * const path = require('path'); + * const generator = new Generator('@asyncapi/html-template', path.resolve(__dirname, 'example')); + * + * @example Passing custom params to the template + * const path = require('path'); + * const generator = new Generator('@asyncapi/html-template', path.resolve(__dirname, 'example'), { + * templateParams: { + * sidebarOrganization: 'byTags' + * } + * }); + * + * @param {String} templateName Name of the template to generate. + * @param {String} targetDir Path to the directory where the files will be generated. + * @param {Object} options + * @param {String} [options.templateParams] Optional parameters to pass to the template. Each template define their own params. + * @param {String} [options.entrypoint] Name of the file to use as the entry point for the rendering process. Use in case you want to use only a specific template file. Note: this potentially avoids rendering every file in the template. + * @param {String[]} [options.noOverwriteGlobs] List of globs to skip when regenerating the template. + * @param {Object} [options.disabledHooks] Object with hooks to disable. The key is a hook type. If key has "true" value, then the generator skips all hooks from the given type. If the value associated with a key is a string with the name of a single hook, then the generator skips only this single hook name. If the value associated with a key is an array of strings, then the generator skips only hooks from the array. + * @param {String} [options.output='fs'] Type of output. Can be either 'fs' (default) or 'string'. Only available when entrypoint is set. + * @param {Boolean} [options.forceWrite=false] Force writing of the generated files to given directory even if it is a git repo with unstaged files or not empty dir. Default is set to false. + * @param {Boolean} [options.install=false] Install the template and its dependencies, even when the template has already been installed. + * @param {Boolean} [options.debug=false] Enable more specific errors in the console. At the moment it only shows specific errors about filters. Keep in mind that as a result errors about template are less descriptive. + */ + constructor(templateName, targetDir, { templateParams = {}, entrypoint, noOverwriteGlobs, disabledHooks, output = 'fs', forceWrite = false, install = false, debug = false } = {}) { + const invalidOptions = getInvalidOptions(GENERATOR_OPTIONS, arguments[arguments.length - 1] || []); + if (invalidOptions.length) throw new Error(`These options are not supported by the generator: ${invalidOptions.join(', ')}`); + if (!templateName) throw new Error('No template name has been specified.'); + if (!entrypoint && !targetDir) throw new Error('No target directory has been specified.'); + if (!['fs', 'string'].includes(output)) throw new Error(`Invalid output type ${output}. Valid values are 'fs' and 'string'.`); - this.pos = this.start; - } + /** @type {String} Name of the template to generate. */ + this.templateName = templateName; + /** @type {String} Path to the directory where the files will be generated. */ + this.targetDir = targetDir; + /** @type {String} Name of the file to use as the entry point for the rendering process. Use in case you want to use only a specific template file. Note: this potentially avoids rendering every file in the template. */ + this.entrypoint = entrypoint; + /** @type {String[]} List of globs to skip when regenerating the template. */ + this.noOverwriteGlobs = noOverwriteGlobs || []; + /** @type {Object} Object with hooks to disable. The key is a hook type. If key has "true" value, then the generator skips all hooks from the given type. If the value associated with a key is a string with the name of a single hook, then the generator skips only this single hook name. If the value associated with a key is an array of strings, then the generator skips only hooks from the array. */ + this.disabledHooks = disabledHooks || {}; + /** @type {String} Type of output. Can be either 'fs' (default) or 'string'. Only available when entrypoint is set. */ + this.output = output; + /** @type {Boolean} Force writing of the generated files to given directory even if it is a git repo with unstaged files or not empty dir. Default is set to false. */ + this.forceWrite = forceWrite; + /** @type {Boolean} Enable more specific errors in the console. At the moment it only shows specific errors about filters. Keep in mind that as a result errors about template are less descriptive. */ + this.debug = debug; + /** @type {Boolean} Install the template and its dependencies, even when the template has already been installed. */ + this.install = install; + /** @type {Object} The template configuration. */ + this.templateConfig = {}; + /** @type {Object} Hooks object with hooks functions grouped by the hook type. */ + this.hooks = {}; - if (this.fd !== null) { - process.nextTick(function() { - self._read(); + // Load template configuration + /** @type {Object} The template parameters. The structure for this object is based on each individual template. */ + this.templateParams = {}; + Object.keys(templateParams).forEach(key => { + const self = this; + Object.defineProperty(this.templateParams, key, { + enumerable: true, + get() { + if (!self.templateConfig.parameters || !self.templateConfig.parameters[key]) { + throw new Error(`Template parameter "${key}" has not been defined in the package.json file under generator property. Please make sure it's listed there before you use it in your template.`); + } + return templateParams[key]; + } }); - return; - } + }); + } - fs.open(this.path, this.flags, this.mode, function (err, fd) { - if (err) { - self.emit('error', err); - self.readable = false; + /** + * Generates files from a given template and an AsyncAPIDocument object. + * + * @example + * generator + * .generate(myAsyncAPIdocument) + * .then(() => { + * console.log('Done!'); + * }) + * .catch(console.error); + * + * @example Using async/await + * try { + * await generator.generate(myAsyncAPIdocument); + * console.log('Done!'); + * } catch (e) { + * console.error(e); + * } + * + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPIDocument object to use as source. + * @return {Promise} + */ + async generate(asyncapiDocument) { + if (!(asyncapiDocument instanceof AsyncAPIDocument)) throw new Error('Parameter "asyncapiDocument" must be an AsyncAPIDocument object.'); + + if (this.output === 'fs') { + xfs.mkdirpSync(this.targetDir); + if (!this.forceWrite) await this.verifyTargetDir(this.targetDir); + } else if (this.output === 'string' && this.entrypoint === undefined) { + throw new Error('Parameter entrypoint is required when using output = "string"'); + } + + if (this.debug) log.setLevel('debug'); + + const { name: templatePkgName, path: templatePkgPath } = await this.installTemplate(this.install); + this.templateDir = templatePkgPath; + this.templateName = templatePkgName; + this.templateContentDir = path.resolve(this.templateDir, TEMPLATE_CONTENT_DIRNAME); + this.configNunjucks(); + await this.loadTemplateConfig(); + validateTemplateConfig(this.templateConfig, this.templateParams, asyncapiDocument); + await registerHooks(this.hooks, this.templateConfig, this.templateDir, HOOKS_DIRNAME); + await registerFilters(this.nunjucks, this.templateConfig, this.templateDir, FILTERS_DIRNAME); + await this.launchHook('generate:before'); + + if (this.entrypoint) { + const entrypointPath = path.resolve(this.templateContentDir, this.entrypoint); + if (!(await exists(entrypointPath))) throw new Error(`Template entrypoint "${entrypointPath}" couldn't be found.`); + if (this.output === 'fs') { + await this.generateFile(asyncapiDocument, path.basename(entrypointPath), path.dirname(entrypointPath)); + await this.launchHook('generate:after'); return; + } else if (this.output === 'string') { + return this.renderString(asyncapiDocument, await readFile(entrypointPath, { encoding: 'utf8' }), entrypointPath); } - - self.fd = fd; - self.emit('open', fd); - self._read(); - }) + } + await this.generateDirectoryStructure(asyncapiDocument); + await this.launchHook('generate:after'); } - function WriteStream (path, options) { - if (!(this instanceof WriteStream)) return new WriteStream(path, options); - - Stream.call(this); - - this.path = path; - this.fd = null; - this.writable = true; + /** + * Generates files from a given template and AsyncAPI string. + * + * @example + * const asyncapiString = ` + * asyncapi: '2.0.0' + * info: + * title: Example + * version: 1.0.0 + * ... + * `; + * generator + * .generateFromString(asyncapiString) + * .then(() => { + * console.log('Done!'); + * }) + * .catch(console.error); + * + * @example Using async/await + * const asyncapiString = ` + * asyncapi: '2.0.0' + * info: + * title: Example + * version: 1.0.0 + * ... + * `; + * + * try { + * await generator.generateFromString(asyncapiString); + * console.log('Done!'); + * } catch (e) { + * console.error(e); + * } + * + * @param {String} asyncapiString AsyncAPI string to use as source. + * @param {Object} [parserOptions={}] AsyncAPI parser options. Check out {@link https://www.github.com/asyncapi/parser-js|@asyncapi/parser} for more information. + * @return {Promise} + */ + async generateFromString(asyncapiString, parserOptions = {}) { + if (!asyncapiString || typeof asyncapiString !== 'string') throw new Error('Parameter "asyncapiString" must be a non-empty string.'); - this.flags = 'w'; - this.encoding = 'binary'; - this.mode = 438; /*=0666*/ - this.bytesWritten = 0; + /** @type {String} AsyncAPI string to use as a source. */ + this.originalAsyncAPI = asyncapiString; - options = options || {}; + /** @type {AsyncAPIDocument} Parsed AsyncAPI schema. See {@link https://github.com/asyncapi/parser-js/blob/master/API.md#module_@asyncapi/parser+AsyncAPIDocument|AsyncAPIDocument} for details on object structure. */ + this.asyncapi = await parse(asyncapiString, parserOptions); + return this.generate(this.asyncapi); + } - // Mixin options into this - var keys = Object.keys(options); - for (var index = 0, length = keys.length; index < length; index++) { - var key = keys[index]; - this[key] = options[key]; - } - - if (this.start !== undefined) { - if ('number' !== typeof this.start) { - throw TypeError('start must be a Number'); - } - if (this.start < 0) { - throw new Error('start must be >= zero'); - } + /** + * Generates files from a given template and AsyncAPI file stored on external server. + * + * @example + * generator + * .generateFromURL('https://example.com/asyncapi.yaml') + * .then(() => { + * console.log('Done!'); + * }) + * .catch(console.error); + * + * @example Using async/await + * try { + * await generator.generateFromURL('https://example.com/asyncapi.yaml'); + * console.log('Done!'); + * } catch (e) { + * console.error(e); + * } + * + * @param {String} asyncapiURL Link to AsyncAPI file + * @return {Promise} + */ + async generateFromURL(asyncapiURL) { + const doc = await fetchSpec(asyncapiURL); - this.pos = this.start; - } + return this.generateFromString(doc); + } - this.busy = false; - this._queue = []; + /** + * Generates files from a given template and AsyncAPI file. + * + * @example + * generator + * .generateFromFile('asyncapi.yaml') + * .then(() => { + * console.log('Done!'); + * }) + * .catch(console.error); + * + * @example Using async/await + * try { + * await generator.generateFromFile('asyncapi.yaml'); + * console.log('Done!'); + * } catch (e) { + * console.error(e); + * } + * + * @param {String} asyncapiFile AsyncAPI file to use as source. + * @return {Promise} + */ + async generateFromFile(asyncapiFile) { + const doc = await readFile(asyncapiFile, { encoding: 'utf8' }); + return this.generateFromString(doc, { path: asyncapiFile }); + } - if (this.fd === null) { - this._open = fs.open; - this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); - this.flush(); - } + /** + * Returns the content of a given template file. + * + * @example + * const Generator = require('asyncapi-generator'); + * const content = await Generator.getTemplateFile('@asyncapi/html-template', 'partials/content.html'); + * + * @example Using a custom `templatesDir` + * const Generator = require('asyncapi-generator'); + * const content = await Generator.getTemplateFile('@asyncapi/html-template', 'partials/content.html', '~/my-templates'); + * + * @static + * @param {String} templateName Name of the template to generate. + * @param {String} filePath Path to the file to render. Relative to the template directory. + * @param {String} [templatesDir=DEFAULT_TEMPLATES_DIR] Path to the directory where the templates are installed. + * @return {Promise} + */ + static async getTemplateFile(templateName, filePath, templatesDir = DEFAULT_TEMPLATES_DIR) { + return await readFile(path.resolve(templatesDir, templateName, filePath), 'utf8'); } -} + /** + * Downloads and installs a template and its dependencies. + * + * @param {Boolean} [force=false] Whether to force installation (and skip cache) or not. + */ + installTemplate(force = false) { + return new Promise(async (resolve, reject) => { + if (!force) { + try { + let installedPkg; -/***/ }), -/* 94 */ -/***/ (function(module) { + if (isFileSystemPath(this.templateName)) { + const pkg = require(path.resolve(this.templateName, PACKAGE_JSON_FILENAME)); + installedPkg = __ncc_wildcard$0(pkg.name); + } else { // Template is not a filesystem path... + const templatePath = path.resolve(DEFAULT_TEMPLATES_DIR, this.templateName); + if (await isLocalTemplate(templatePath)) { + // This "if" is covering the following workflow: + // ag asyncapi.yaml ../html-template + // The previous command installs a template called @asyncapi/html-template + // And now we run the command again but with the resolved name: + // ag asyncapi.yaml @asyncapi/html-template + // The template name doesn't look like a file system path but we find + // that the package is already installed and it's a symbolic link. + const { resolvedLink } = await getLocalTemplateDetails(templatePath); + log.debug(`This template has already been installed and it's pointing to your filesystem at ${resolvedLink}.`); + } + installedPkg = require(path.resolve(templatePath, PACKAGE_JSON_FILENAME)); + } + return resolve({ + name: installedPkg.name, + version: installedPkg.version, + path: path.resolve(DEFAULT_TEMPLATES_DIR, installedPkg.name), + }); + } catch (e) { + // We did our best. Proceed with installation... + } + } -module.exports = BranchSummary; + // NOTE: npmi creates symbolic links inside DEFAULT_TEMPLATES_DIR + // (node_modules) for local packages, i.e., those located in the file system. + npmi({ + name: this.templateName, + install: force, + path: ROOT_DIR, + pkgName: 'dummy value so it does not force installation always', + npmLoad: { + loglevel: 'http', + save: false, + audit: false, + progress: false, + only: 'prod' + }, + }, (err, result) => { + if (err) return reject(err); + resolve(beautifyNpmiResult(result)); + }); + }); + } -function BranchSummary () { - this.detached = false; - this.current = ''; - this.all = []; - this.branches = {}; -} + /** + * Returns all the parameters on the AsyncAPI document. + * + * @private + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPI document to use as the source. + */ + getAllParameters(asyncapiDocument) { + const parameters = new Map(); -BranchSummary.prototype.push = function (current, detached, name, commit, label) { - if (current) { - this.detached = detached; - this.current = name; - } - this.all.push(name); - this.branches[name] = { - current: current, - name: name, - commit: commit, - label: label - }; -}; + if (asyncapiDocument.hasChannels()) { + asyncapiDocument.channelNames().forEach(channelName => { + const channel = asyncapiDocument.channel(channelName); + for (const [key, value] of Object.entries(channel.parameters())) { + parameters.set(key, value); + } + }); + } -BranchSummary.detachedRegex = /^(\*?\s+)\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/; -BranchSummary.branchRegex = /^(\*?\s+)(\S+)\s+([a-z0-9]+)\s(.*)$/; + if (asyncapiDocument.hasComponents()) { + for (const [key, value] of Object.entries(asyncapiDocument.components().parameters())) { + parameters.set(key, value); + } + } -BranchSummary.parse = function (commit) { - var branchSummary = new BranchSummary(); + return parameters; + } - commit.split('\n') - .forEach(function (line) { - var detached = true; - var branch = BranchSummary.detachedRegex.exec(line); - if (!branch) { - detached = false; - branch = BranchSummary.branchRegex.exec(line); - } + /** + * Generates the directory structure. + * + * @private + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPI document to use as the source. + * @return {Promise} + */ + generateDirectoryStructure(asyncapiDocument) { + const objectMap = {}; + asyncapiDocument.allSchemas().forEach((schema, schemaId) => { if (schema.type() === 'object') objectMap[schemaId] = schema; }); - if (branch) { - branchSummary.push( - branch[1].charAt(0) === '*', - detached, - branch[2], - branch[3], - branch[4] - ); - } + return new Promise((resolve, reject) => { + xfs.mkdirpSync(this.targetDir); + + const walker = xfs.walk(this.templateContentDir, { + followLinks: false }); - return branchSummary; -}; + walker.on('file', async (root, stats, next) => { + try { + await this.filesGenerationHandler(asyncapiDocument, objectMap, root, stats, next); + } catch (e) { + reject(e); + } + }); + walker.on('directory', async (root, stats, next) => { + try { + this.ignoredDirHandler(root, stats, next); + } catch (e) { + reject(e); + } + }); -/***/ }), -/* 95 */, -/* 96 */, -/* 97 */ -/***/ (function(module) { + walker.on('errors', (root, nodeStatsArray) => { + reject(nodeStatsArray); + }); -"use strict"; + walker.on('end', async () => { + resolve(); + }); + }); + } + /** + * Makes sure that during directory structure generation ignored dirs are not modified + * @private + * + * @param {String} root Dir name. + * @param {String} stats Information about the file. + * @param {Function} next Callback function + */ + ignoredDirHandler(root, stats, next) { + const relativeDir = path.relative(this.templateContentDir, path.resolve(root, stats.name)); + const dirPath = path.resolve(this.targetDir, relativeDir); + if (!shouldIgnoreDir(relativeDir)) { + xfs.mkdirpSync(dirPath); + } + next(); + } -let TEXT_REGEXP = /\.(txt|htm|html|md|xml|js|min|map|css|scss|less|svg)$/i; + /** + * Makes sure that during directory structure generation ignored dirs are not modified + * @private + * + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPI document to use as the source. + * @param {String} objectMap Map of schemas of type object + * @param {String} root Dir name. + * @param {String} stats Information about the file. + * @param {Function} next Callback function + */ + async filesGenerationHandler(asyncapiDocument, objectMap, root, stats, next) { + const fileNamesForSeparation = { + channel: asyncapiDocument.channels(), + message: convertMapToObject(asyncapiDocument.allMessages()), + securityScheme: asyncapiDocument.components() ? asyncapiDocument.components().securitySchemes() : {}, + schema: asyncapiDocument.components() ? asyncapiDocument.components().schemas() : {}, + objectSchema: objectMap, + parameter: convertMapToObject(this.getAllParameters(asyncapiDocument)), + everySchema: convertMapToObject(asyncapiDocument.allSchemas()), + }; + + // Check if the filename dictates it should be separated + let wasSeparated = false; + for (const prop in fileNamesForSeparation) { + if (Object.prototype.hasOwnProperty.call(fileNamesForSeparation, prop) && stats.name.includes(`$$${prop}$$`)) { + await this.generateSeparateFiles(asyncapiDocument, fileNamesForSeparation[prop], prop, stats.name, root); + const templateFilePath = path.relative(this.templateContentDir, path.resolve(root, stats.name)); + fs.unlink(path.resolve(this.targetDir, templateFilePath), next); + wasSeparated = true; + //The filename can only contain 1 specifier (message, scheme etc) + break; + } + } + // If it was not separated process normally + if (!wasSeparated) { + await this.generateFile(asyncapiDocument, stats.name, root); + next(); + } + } -module.exports = { /** - * The order that this parser will run, in relation to other parsers. + * Generates all the files for each in array * - * @type {number} + * @private + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPI document to use as the source. + * @param {Array} array The components/channels to generate the separeted files for. + * @param {String} template The template filename to replace. + * @param {String} fileName Name of the file to generate for each security schema. + * @param {String} baseDir Base directory of the given file name. + * @returns {Promise} */ - order: 300, + generateSeparateFiles(asyncapiDocument, array, template, fileName, baseDir) { + const promises = []; + + Object.keys(array).forEach((name) => { + const component = array[name]; + promises.push(this.generateSeparateFile(asyncapiDocument, name, component, template, fileName, baseDir)); + }); + + return Promise.all(promises); + } /** - * Whether to allow "empty" files (zero bytes). + * Generates a file for a component/channel * - * @type {boolean} + * @private + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPI document to use as the source. + * @param {String} name The name of the component (filename to use) + * @param {Object} component The component/channel object used to generate the file. + * @param {String} template The template filename to replace. + * @param {String} fileName Name of the file to generate for each security schema. + * @param {String} baseDir Base directory of the given file name. + * @returns {Promise} */ - allowEmpty: true, + async generateSeparateFile(asyncapiDocument, name, component, template, fileName, baseDir) { + const relativeBaseDir = path.relative(this.templateContentDir, baseDir); + + const setFileTemplateNameHookName = 'setFileTemplateName'; + let filename = name; + if (this.isHookAvailable(setFileTemplateNameHookName)) { + const filenamesFromHooks = await this.launchHook(setFileTemplateNameHookName, {originalFilename: filename}); + //Use the result of the first hook + filename = filenamesFromHooks[0]; + } else { + filename = filenamify(filename, { replacement: '-', maxLength: 255 }); + } + const newFileName = fileName.replace(`\$\$${template}\$\$`, filename); + const targetFile = path.resolve(this.targetDir, relativeBaseDir, newFileName); + const relativeTargetFile = path.relative(this.targetDir, targetFile); + const shouldOverwriteFile = await this.shouldOverwriteFile(relativeTargetFile); + if (!shouldOverwriteFile) return; + //Ensure the same object are parsed to the renderFile method as before. + const temp = {}; + const key = template === 'everySchema' || template === 'objectSchema' ? 'schema' : template; + temp[`${key}Name`] = name; + temp[key] = component; + const content = await this.renderFile(asyncapiDocument, path.resolve(baseDir, fileName), temp); + + await writeFile(targetFile, content, 'utf8'); + } /** - * The encoding that the text is expected to be in. + * Generates a file. * - * @type {string} + * @private + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPI document to use as the source. + * @param {String} fileName Name of the file to generate for each channel. + * @param {String} baseDir Base directory of the given file name. + * @return {Promise} */ - encoding: "utf8", + async generateFile(asyncapiDocument, fileName, baseDir) { + const sourceFile = path.resolve(baseDir, fileName); + const relativeSourceFile = path.relative(this.templateContentDir, sourceFile); + const targetFile = path.resolve(this.targetDir, this.maybeRenameSourceFile(relativeSourceFile)); + const relativeTargetFile = path.relative(this.targetDir, targetFile); + + if (shouldIgnoreFile(relativeSourceFile)) return; + + const shouldOverwriteFile = await this.shouldOverwriteFile(relativeTargetFile); + if (!shouldOverwriteFile) return; + + if (this.templateConfig.conditionalFiles && this.templateConfig.conditionalFiles[relativeSourceFile]) { + const server = this.templateParams.server && asyncapiDocument.server(this.templateParams.server); + const source = jmespath.search({ + ...asyncapiDocument.json(), + ...{ + server: server ? server.json() : undefined, + }, + }, this.templateConfig.conditionalFiles[relativeSourceFile].subject); + + if (!source) return log.debug(`${relativeSourceFile} was not generated because ${this.templateConfig.conditionalFiles[relativeSourceFile].subject} specified in template configuration in conditionalFiles was not found in provided AsyncAPI specification file`); + + if (source) { + const validate = this.templateConfig.conditionalFiles[relativeSourceFile].validate; + const valid = validate(source); + if (!valid) return log.debug(`${relativeSourceFile} was not generated because condition specified for this file in template configuration in conditionalFiles matched`); + } + } + if (this.isNonRenderableFile(relativeSourceFile)) return await copyFile(sourceFile, targetFile); + + const parsedContent = await this.renderFile(asyncapiDocument, sourceFile); + const stats = fs.statSync(sourceFile); + await writeFile(targetFile, parsedContent, { encoding: 'utf8', mode: stats.mode }); + } /** - * Determines whether this parser can parse a given file reference. - * Parsers that return true will be tried, in order, until one successfully parses the file. - * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case - * every parser will be tried. + * It may rename the source file name in cases where special names are not supported, like .gitignore or .npmignore. * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {boolean} + * Since we're using npm to install templates, these files are never downloaded (that's npm behavior we can't change). + * @private + * @param {String} sourceFile Path to the source file + * @returns {String} New path name */ - canParse (file) { - // Use this parser if the file is a string or Buffer, and has a known text-based extension - return (typeof file.data === "string" || Buffer.isBuffer(file.data)) && TEXT_REGEXP.test(file.url); - }, + maybeRenameSourceFile(sourceFile) { + switch (path.basename(sourceFile)) { + case GIT_IGNORE_FILENAME: + return path.join(path.dirname(sourceFile), '.gitignore'); + case NPM_IGNORE_FILENAME: + return path.join(path.dirname(sourceFile), '.npmignore'); + default: + return sourceFile; + } + } /** - * Parses the given file as text + * Renders a template string and outputs it. * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {Promise} + * @private + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPI document to pass to the template. + * @param {String} templateString String containing the template. + * @param {String} filePath Path to the file being rendered. + * @param {Object} [extraTemplateData] Extra data to pass to the template. + * @return {Promise} */ - parse (file) { - if (typeof file.data === "string") { - return file.data; - } - else if (Buffer.isBuffer(file.data)) { - return file.data.toString(this.encoding); - } - else { - throw new Error("data is not text"); - } + renderString(asyncapiDocument, templateString, filePath, extraTemplateData = {}) { + return new Promise((resolve, reject) => { + this.nunjucks.renderString(templateString, { + asyncapi: asyncapiDocument, + params: this.templateParams, + originalAsyncAPI: this.originalAsyncAPI, + ...extraTemplateData + }, { path: filePath }, (err, result) => { + if (err) return reject(err); + resolve(result); + }); + }); } -}; + /** + * Renders the content of a file and outputs it. + * + * @private + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPI document to pass to the template. + * @param {String} filePath Path to the file you want to render. + * @param {Object} [extraTemplateData] Extra data to pass to the template. + * @return {Promise} + */ + async renderFile(asyncapiDocument, filePath, extraTemplateData = {}) { + const content = await readFile(filePath, 'utf8'); + return this.renderString(asyncapiDocument, content, filePath, extraTemplateData); + } -/***/ }), -/* 98 */, -/* 99 */, -/* 100 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + /** + * Checks if a given file name matches the list of non-renderable files. + * + * @private + * @param {string} fileName Name of the file to check against a list of glob patterns. + * @return {boolean} + */ + isNonRenderableFile(fileName) { + if (!Array.isArray(this.templateConfig.nonRenderableFiles)) return false; -"use strict"; + return this.templateConfig.nonRenderableFiles.some(globExp => minimatch(fileName, globExp)); + } + /** + * Checks if a given file should be overwritten. + * + * @private + * @param {string} filePath Path to the file to check against a list of glob patterns. + * @return {boolean} + */ + async shouldOverwriteFile(filePath) { + if (!Array.isArray(this.noOverwriteGlobs)) return true; + const fileExists = await exists(path.resolve(this.targetDir, filePath)); + if (!fileExists) return true; -var Type = __webpack_require__(945); + return !this.noOverwriteGlobs.some(globExp => minimatch(filePath, globExp)); + } -var _hasOwnProperty = Object.prototype.hasOwnProperty; + /** + * Configures Nunjucks templating system + * @private + */ + configNunjucks() { + const config = {}; + if (this.debug) config.dev = true; -function resolveYamlSet(data) { - if (data === null) return true; + this.nunjucks = new Nunjucks.Environment(new Nunjucks.FileSystemLoader(this.templateDir), config); + } - var key, object = data; + /** + * Loads the template configuration. + * @private + */ + async loadTemplateConfig() { + try { + const configPath = path.resolve(this.templateDir, CONFIG_FILENAME); + if (!fs.existsSync(configPath)) { + this.templateConfig = {}; + return; + } - for (key in object) { - if (_hasOwnProperty.call(object, key)) { - if (object[key] !== null) return false; + const json = await readFile(configPath, { encoding: 'utf8' }); + const generatorProp = JSON.parse(json).generator; + this.templateConfig = generatorProp || {}; + } catch (e) { + this.templateConfig = {}; } + await this.loadDefaultValues(); } - return true; -} + /** + * Loads default values of parameters from template config. If value was already set as parameter it will not be + * overriden. + * @private + */ + async loadDefaultValues() { + const parameters = this.templateConfig.parameters; + const defaultValues = Object.keys(parameters || {}).filter(key => parameters[key].default); -function constructYamlSet(data) { - return data !== null ? data : {}; -} + defaultValues.filter(dv => this.templateParams[dv] === undefined).forEach(dv => + Object.defineProperty(this.templateParams, dv, { + enumerable: true, + get() { + return parameters[dv].default; + } + }) + ); + } -module.exports = new Type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); + /** + * Launches all the hooks registered at a given hook point/name. + * + * @param {string} hookName + * @param {*} hookArguments + * @private + */ + async launchHook(hookName, hookArguments) { + let disabledHooks = this.disabledHooks[hookName] || []; + if (disabledHooks === true) return; + if (typeof disabledHooks === 'string') disabledHooks = [disabledHooks]; + + const hooks = this.hooks[hookName]; + if (!Array.isArray(hooks)) return; + const promises = hooks.map(async (hook) => { + if (typeof hook !== 'function') return; + if (disabledHooks.includes(hook.name)) return; + return await hook(this, hookArguments); + }).filter(Boolean); + return Promise.all(promises); + } -/***/ }), -/* 101 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { + /** + * Check if any hooks are available + * + * @param {string} hookName + * @private + */ + isHookAvailable(hookName) { + const hooks = this.hooks[hookName]; -"use strict"; + if (this.disabledHooks[hookName] === true + || !Array.isArray(hooks) + || hooks.length === 0) return false; + let disabledHooks = this.disabledHooks[hookName] || []; + if (typeof disabledHooks === 'string') disabledHooks = [disabledHooks]; -const { EventEmitter } = __webpack_require__(614); -const fs = __webpack_require__(747); -const sysPath = __webpack_require__(622); -const { promisify } = __webpack_require__(669); -const readdirp = __webpack_require__(365); -const anymatch = __webpack_require__(5).default; -const globParent = __webpack_require__(763); -const isGlob = __webpack_require__(486); -const braces = __webpack_require__(783); -const normalizePath = __webpack_require__(861); + return !!hooks.filter(h => !disabledHooks.includes(h.name)).length; + } -const NodeFsHandler = __webpack_require__(520); -const FsEventsHandler = __webpack_require__(32); -const { - EV_ALL, - EV_READY, - EV_ADD, - EV_CHANGE, - EV_UNLINK, - EV_ADD_DIR, - EV_UNLINK_DIR, - EV_RAW, - EV_ERROR, + /** + * Check if given directory is a git repo with unstaged changes and is not in .gitignore or is not empty + * @private + * @param {String} dir Directory that needs to be tested for a given condition. + */ + async verifyTargetDir(dir) { + const isGitRepo = await git(dir).checkIsRepo(); - STR_CLOSE, - STR_END, + if (isGitRepo) { + //Need to figure out root of the repository to properly verify .gitignore + const root = await git(dir).revparse(['--show-toplevel']); + const gitInfo = git(root); - BACK_SLASH_RE, - DOUBLE_SLASH_RE, - SLASH_OR_BACK_SLASH_RE, - DOT_RE, - REPLACER_RE, + //Skipping verification if workDir inside repo is declared in .gitignore + const workDir = path.relative(root, dir); + if (workDir) { + const checkGitIgnore = await gitInfo.checkIgnore(workDir); + if (checkGitIgnore.length !== 0) return; + } - SLASH, - BRACE_START, - BANG, - ONE_DOT, - TWO_DOTS, - GLOBSTAR, - SLASH_GLOBSTAR, - ANYMATCH_OPTS, - STRING_TYPE, - FUNCTION_TYPE, - EMPTY_STR, - EMPTY_FN, + const gitStatus = await gitInfo.status(); + //New files are not tracked and not visible as modified + const hasUntrackedUnstagedFiles = gitStatus.not_added.length !== 0; - isWindows, - isMacos -} = __webpack_require__(677); + const stagedFiles = gitStatus.staged; + const modifiedFiles = gitStatus.modified; + const hasModifiedUstagedFiles = (modifiedFiles.filter(e => stagedFiles.indexOf(e) === -1)).length !== 0; + + if (hasModifiedUstagedFiles || hasUntrackedUnstagedFiles) throw new Error(`"${this.targetDir}" is in a git repository with unstaged changes. Please commit your changes before proceeding or add proper directory to .gitignore file. You can also use the --force-write flag to skip this rule (not recommended).`); + } else { + const isDirEmpty = (await readDir(dir)).length === 0; + + if (!isDirEmpty) throw new Error(`"${this.targetDir}" is not an empty directory. You might override your work. To skip this rule, please make your code a git repository or use the --force-write flag (not recommended).`); + } + } +} + +Generator.DEFAULT_TEMPLATES_DIR = DEFAULT_TEMPLATES_DIR; + +module.exports = Generator; -const stat = promisify(fs.stat); -const readdir = promisify(fs.readdir); + +/***/ }), + +/***/ 27014: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const path = __webpack_require__(85622); +const xfs = __webpack_require__(52088); +const { isLocalTemplate, exists } = __webpack_require__(65015); /** - * @typedef {String} Path - * @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName - * @typedef {'readdir'|'watch'|'add'|'remove'|'change'} ThrottleType + * Registers all template hooks. + * @param {Object} hooks Object that stores information about all available hook functions grouped by the type of the hook. + * @param {Object} templateConfig Template configuration. + * @param {String} templateDir Directory where template is located. + * @param {String} hooksDir Directory where local hooks are located. */ +module.exports.registerHooks = async (hooks, templateConfig, templateDir, hooksDir) => { + await registerLocalHooks(hooks, templateDir, hooksDir); -/** - * - * @typedef {Object} WatchHelpers - * @property {Boolean} followSymlinks - * @property {'stat'|'lstat'} statMethod - * @property {Path} path - * @property {Path} watchPath - * @property {Function} entryPath - * @property {Boolean} hasGlob - * @property {Object} globFilter - * @property {Function} filterPath - * @property {Function} filterDir + if (templateConfig && Object.keys(templateConfig).length > 0) await registerConfigHooks(hooks, templateDir, templateConfig); + + return hooks; +}; + +/** + * Loads the local template hooks from default location. + * @private + * @param {Object} hooks Object that stores information about all available hook functions grouped by the type of the hook. + * @param {String} templateDir Directory where template is located. + * @param {String} hooksDir Directory where local hooks are located. */ +async function registerLocalHooks(hooks, templateDir, hooksDir) { + return new Promise(async (resolve, reject) => { + const localHooks = path.resolve(templateDir, hooksDir); -const arrify = (value = []) => Array.isArray(value) ? value : [value]; -const flatten = (list, result = []) => { - list.forEach(item => { - if (Array.isArray(item)) { - flatten(item, result); - } else { - result.push(item); - } + if (!await exists(localHooks)) return resolve(hooks); + + const walker = xfs.walk(localHooks, { + followLinks: false + }); + + walker.on('file', async (root, stats, next) => { + try { + const filePath = path.resolve(templateDir, path.resolve(root, stats.name)); + delete require.cache[require.resolve(filePath)]; + const mod = require(filePath); + + addHook(hooks, mod); + + next(); + } catch (e) { + reject(e); + } + }); + + walker.on('errors', (root, nodeStatsArray) => { + reject(nodeStatsArray); + }); + + walker.on('end', async () => { + resolve(hooks); + }); }); - return result; -}; +} -const unifyPaths = (paths_) => { - /** - * @type {Array} - */ - const paths = flatten(arrify(paths_)); - if (!paths.every(p => typeof p === STRING_TYPE)) { - throw new TypeError(`Non-string provided as watch path: ${paths}`); - } - return paths.map(normalizePathToUnix); -}; +/** + * Loads the template hooks provided in template config. + * @private + * + * @param {Object} hooks Object that stores information about all available hook functions grouped by the type of the hook. + * @param {String} templateDir Directory where template is located. + * @param {String} templateConfig Template configuration. + */ +async function registerConfigHooks(hooks, templateDir, templateConfig) { + const configHooks = templateConfig.hooks; + const DEFAULT_MODULES_DIR = 'node_modules'; -const toUnix = (string) => { - let str = string.replace(BACK_SLASH_RE, SLASH); - while (str.match(DOUBLE_SLASH_RE)) { - str = str.replace(DOUBLE_SLASH_RE, SLASH); - } - return str; -}; + if (typeof configHooks !== 'object' || !Object.keys(configHooks).length > 0) return; -// Our version of upath.normalize -// TODO: this is not equal to path-normalize module - investigate why -const normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path))); + const promises = Object.keys(configHooks).map(async hooksModuleName => { + const modulePath = await isLocalTemplate(templateDir) ? path.resolve(templateDir, DEFAULT_MODULES_DIR, hooksModuleName) : hooksModuleName; + const mod = require(modulePath); + const configHooksArray = [].concat(configHooks[hooksModuleName]); -const normalizeIgnored = (cwd = EMPTY_STR) => (path) => { - if (typeof path !== STRING_TYPE) return path; - return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path)); -}; + addHook(hooks, mod, configHooksArray); + }); + await Promise.all(promises); + return hooks; +} -const getAbsolutePath = (path, cwd) => { - if (sysPath.isAbsolute(path)) { - return path; - } - if (path.startsWith(BANG)) { - return BANG + sysPath.join(cwd, path.slice(1)); +/** + * Add hook from given module to list of available hooks + * @private + * @param {Object} hooks Object that stores information about all available hook functions grouped by the type of the hook. + * @param {Object} mod Single module with object of hook functions grouped by the type of the hook + * @param {Array} config List of hooks configured in template configuration + */ +function addHook(hooks, mod, config) { + Object.keys(mod).forEach(hookType => { + const moduleHooksArray = [].concat(mod[hookType]); + + moduleHooksArray.forEach(hook => { + if (config && !config.includes(hook.name)) return; + + hooks[hookType] = hooks[hookType] || []; + hooks[hookType].push(hook); + }); + }); + return hooks; +} + + +/***/ }), + +/***/ 45881: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const semver = __webpack_require__(57489); +const Ajv = __webpack_require__(64941); +const { getGeneratorVersion } = __webpack_require__(65015); +const levenshtein = __webpack_require__(30592); + +const ajv = new Ajv({ allErrors: true }); + +/** + * Validates the template configuration. + * + * @param {Object} templateConfig Template configuration. + * @param {Object} templateParams Params specified when running generator. + * @param {AsyncAPIDocument} asyncapiDocument AsyncAPIDocument object to use as source. + * @return {Boolean} + */ +module.exports.validateTemplateConfig = (templateConfig, templateParams, asyncapiDocument) => { + const { parameters, supportedProtocols, conditionalFiles, generator } = templateConfig; + + validateConditionalFiles(conditionalFiles); + isTemplateCompatible(generator); + + isRequiredParamProvided(parameters, templateParams); + + if (asyncapiDocument) { + const server = asyncapiDocument.server(templateParams.server); + isServerProvidedInDocument(server, templateParams.server); + isServerProtocolSupported(server, supportedProtocols, templateParams.server); } - return sysPath.join(cwd, path); + + isProvidedParameterSupported(parameters, templateParams); + + return true; }; -const undef = (opts, key) => opts[key] === undefined; +/** + * Checks if template is compatible with the version of the generator that is used + * @private + * @param {String} generator Information about supported generator version that is part of the template configuration + */ +function isTemplateCompatible(generator) { + const generatorVersion = getGeneratorVersion(); + if (typeof generator === 'string' && !semver.satisfies(generatorVersion, generator, {includePrerelease: true})) { + throw new Error(`This template is not compatible with the current version of the generator (${generatorVersion}). This template is compatible with the following version range: ${generator}.`); + } +} /** - * Directory entry. - * @property {Path} path - * @property {Set} items + * Checks if parameters described in template configuration as required are passed to the generator + * @private + * @param {Object} configParams Parameters specified in template configuration + * @param {Object} templateParams All parameters provided to generator */ -class DirEntry { - /** - * @param {Path} dir - * @param {Function} removeWatcher - */ - constructor(dir, removeWatcher) { - this.path = dir; - this._removeWatcher = removeWatcher; - /** @type {Set} */ - this.items = new Set(); +function isRequiredParamProvided(configParams, templateParams) { + const missingParams = Object.keys(configParams || {}) + .filter(key => configParams[key].required && !templateParams[key]); + + if (missingParams.length) { + throw new Error(`This template requires the following missing params: ${missingParams}.`); } +} - add(item) { - const {items} = this; - if (!items) return; - if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item); - } +/** + * Provides a hint for a user about correct parameter name. + * @private + * @param {Object} wrongParam Incorrectly written parameter + * @param {Object} configParams Parameters specified in template configuration + */ +function getParamSuggestion(wrongParam, configParams) { + const sortInt = (a, b) => { + return a[0] - b[0]; + }; + const arr = Object.keys(configParams).map(param => [levenshtein(wrongParam, param), param]); - async remove(item) { - const {items} = this; - if (!items) return; - items.delete(item); + return arr.sort(sortInt)[0][1]; +} - if (!items.size) { - const dir = this.path; - try { - await readdir(dir); - } catch (err) { - this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir)); - } - } - } +/** + * Checks if parameters provided to generator is supported by the template + * @private + * @param {Object} configParams Parameters specified in template configuration + * @param {Object} templateParams All parameters provided to generator + */ +function isProvidedParameterSupported(configParams, templateParams) { + const wrongParams = Object.keys(templateParams || {}).filter(key => !configParams || !configParams[key]); + + if (!wrongParams.length) return; + if (!configParams) throw new Error('This template doesn\'t have any params.'); - has(item) { - const {items} = this; - if (!items) return; - return items.has(item); - } + let suggestionsString = ''; + + wrongParams.forEach(wp => { + suggestionsString += `\nDid you mean "${getParamSuggestion(wp,configParams)}" instead of "${wp}"?`; + }); - /** - * @returns {Array} - */ - getChildren() { - const {items} = this; - if (!items) return; - return [...items.values()]; + throw new Error(`This template doesn't have the following params: ${wrongParams}.${suggestionsString}`); +} + +/** + * Checks if given AsyncAPI document has servers with protocol that is supported by the template + * @private + * @param {Object} server Server object from AsyncAPI file + * @param {String[]} supportedProtocols Supported protocols specified in template configuration + * @param {String} paramsServerName Name of the server specified as a param for the generator + */ +function isServerProtocolSupported(server, supportedProtocols, paramsServerName) { + if (server && Array.isArray(supportedProtocols) && !supportedProtocols.includes(server.protocol())) { + throw new Error(`Server "${paramsServerName}" uses the ${server.protocol()} protocol but this template only supports the following ones: ${supportedProtocols}.`); } +} - dispose() { - this.items.clear(); - delete this.path; - delete this._removeWatcher; - delete this.items; - Object.freeze(this); - } +/** + * Checks if given AsyncAPI document has servers with protocol that is supported by the template + * @private + * @param {Object} server Server object from AsyncAPI file + * @param {String} paramsServerName Name of the server specified as a param for the generator + */ +function isServerProvidedInDocument(server, paramsServerName) { + if (typeof paramsServerName === 'string' && !server) throw new Error(`Couldn't find server with name ${paramsServerName}.`); } -const STAT_METHOD_F = 'stat'; -const STAT_METHOD_L = 'lstat'; -class WatchHelper { - constructor(path, watchPath, follow, fsw) { - this.fsw = fsw; - this.path = path = path.replace(REPLACER_RE, EMPTY_STR); - this.watchPath = watchPath; - this.fullWatchPath = sysPath.resolve(watchPath); - this.hasGlob = watchPath !== path; - /** @type {object|boolean} */ - if (path === EMPTY_STR) this.hasGlob = false; - this.globSymlink = this.hasGlob && follow ? undefined : false; - this.globFilter = this.hasGlob ? anymatch(path, undefined, ANYMATCH_OPTS) : false; - this.dirParts = this.getDirParts(path); - this.dirParts.forEach((parts) => { - if (parts.length > 1) parts.pop(); +/** + * Checks if conditional files are specified properly in the template + * @private + * @param {Object} conditionalFiles conditions specified in the template config + */ +function validateConditionalFiles(conditionalFiles) { + if (typeof conditionalFiles === 'object') { + const fileNames = Object.keys(conditionalFiles); + + fileNames.forEach(fileName => { + const def = conditionalFiles[fileName]; + if (typeof def.subject !== 'string') throw new Error(`Invalid conditional file subject for ${fileName}: ${def.subject}.`); + if (typeof def.validation !== 'object') throw new Error(`Invalid conditional file validation object for ${fileName}: ${def.validation}.`); + conditionalFiles[fileName].validate = ajv.compile(conditionalFiles[fileName].validation); }); - this.followSymlinks = follow; - this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L; } +} - checkGlobSymlink(entry) { - // only need to resolve once - // first entry should always have entry.parentDir === EMPTY_STR - if (this.globSymlink === undefined) { - this.globSymlink = entry.fullParentDir === this.fullWatchPath ? - false : {realPath: entry.fullParentDir, linkPath: this.fullWatchPath}; - } +/***/ }), - if (this.globSymlink) { - return entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath); - } +/***/ 65015: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return entry.fullPath; - } +const fs = __webpack_require__(35747); +const util = __webpack_require__(31669); +const path = __webpack_require__(85622); +const fetch = __webpack_require__(80467); +const url = __webpack_require__(78835); +const packageJson = __webpack_require__(94532); - entryPath(entry) { - return sysPath.join(this.watchPath, - sysPath.relative(this.watchPath, this.checkGlobSymlink(entry)) - ); - } +const utils = module.exports; - filterPath(entry) { - const {stats} = entry; - if (stats && stats.isSymbolicLink()) return this.filterDir(entry); - const resolvedPath = this.entryPath(entry); - const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ? - this.globFilter(resolvedPath) : true; - return matchesGlob && - this.fsw._isntIgnored(resolvedPath, stats) && - this.fsw._hasReadPermissions(stats); - } +utils.lstat = util.promisify(fs.lstat); +utils.readlink = util.promisify(fs.readlink); +utils.readFile = util.promisify(fs.readFile); +utils.writeFile = util.promisify(fs.writeFile); +utils.copyFile = util.promisify(fs.copyFile); +utils.exists = util.promisify(fs.exists); +utils.readDir = util.promisify(fs.readdir); - getDirParts(path) { - if (!this.hasGlob) return []; - const parts = []; - const expandedPath = path.includes(BRACE_START) ? braces.expand(path) : [path]; - expandedPath.forEach((path) => { - parts.push(sysPath.relative(this.watchPath, path).split(SLASH_OR_BACK_SLASH_RE)); - }); - return parts; - } +/** + * Checks if a string is a filesystem path. + * @private + * @param {String} string The string to check. + * @returns {Boolean} Whether the string is a filesystem path or not. + */ +utils.isFileSystemPath = (string) => { + return path.isAbsolute(string) + || string.startsWith(`.${path.sep}`) + || string.startsWith(`..${path.sep}`) + || string.startsWith('~'); +}; - filterDir(entry) { - if (this.hasGlob) { - const entryParts = this.getDirParts(this.checkGlobSymlink(entry)); - let globstar = false; - this.unmatchedGlob = !this.dirParts.some((parts) => { - return parts.every((part, i) => { - if (part === GLOBSTAR) globstar = true; - return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS); - }); - }); - } - return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats); +/** + * Takes the result of calling the npmi module and returns it in a more consumable form. + * @private + * @param {Array} result The result of calling npmi. + * @returns {Object} + */ +utils.beautifyNpmiResult = (result) => { + const [nameWithVersion, pkgPath] = result[result.length-1]; + const nameWithVersionArray = nameWithVersion.split('@'); + const version = nameWithVersionArray[nameWithVersionArray.length - 1]; + const name = nameWithVersionArray.splice(0, nameWithVersionArray.length - 1).join('@'); + + return { + name, + path: pkgPath, + version, + }; +}; + +/** + * Converts a Map into an object. + * @private + * @param {Map} map The map to transform. + * @returns {Object} + */ +utils.convertMapToObject = (map) => { + const tempObject = {}; + for (const [key, value] of map.entries()) { + tempObject[key] = value; } -} + return tempObject; +}; /** - * Watches files & directories for changes. Emitted events: - * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error` - * - * new FSWatcher() - * .add(directories) - * .on('add', path => log('File', path, 'was added')) + * Checks if template is local or not (i.e., it's remote). + * @private + * @param {String} templatePath The path to the template. + * @returns {Promise} */ -class FSWatcher extends EventEmitter { -// Not indenting methods for history sake; for now. -constructor(_opts) { - super(); +utils.isLocalTemplate = async (templatePath) => { + const stats = await utils.lstat(templatePath); + return stats.isSymbolicLink(); +}; - const opts = {}; - if (_opts) Object.assign(opts, _opts); // for frozen objects +/** + * Gets the details (link and resolved link) of a local template. + * @private + * @param {String} templatePath The path to the template. + * @returns {Promise} + */ +utils.getLocalTemplateDetails = async (templatePath) => { + const linkTarget = await utils.readlink(templatePath); + return { + link: linkTarget, + resolvedLink: path.resolve(path.dirname(templatePath), linkTarget), + }; +}; - /** @type {Map} */ - this._watched = new Map(); - /** @type {Map} */ - this._closers = new Map(); - /** @type {Set} */ - this._ignoredPaths = new Set(); +/** + * Fetches an AsyncAPI document from the given URL and return its content as string + * + * @param {String} link URL where the AsyncAPI document is located. + * @returns Promise} Content of fetched file. + */ +utils.fetchSpec = (link) => { + return new Promise((resolve, reject) => { + fetch(link) + .then(res => resolve(res.text())) + .catch(reject); + }); +}; - /** @type {Map} */ - this._throttled = new Map(); +/** + * Checks if given string is URL and if not, we assume it is file path + * + * @param {String} str Information representing file path or url + * @returns {Boolean} + */ +utils.isFilePath = (str) => { + return !url.parse(str).hostname; +}; - /** @type {Map} */ - this._symlinkPaths = new Map(); +/** + * Get version of the generator + * + * @returns {String} + */ +utils.getGeneratorVersion = () => { + return packageJson.version; +}; - this._streams = new Set(); - this.closed = false; +/** + * Filters out the Generator invalid options given + * + * @param {Array} + * @returns {Array} + */ +utils.getInvalidOptions = (generatorOptions, options) => { + if (typeof options !== 'object') return []; + return Object.keys(options).filter(param => !generatorOptions.includes(param)); +}; - // Set up default options. - if (undef(opts, 'persistent')) opts.persistent = true; - if (undef(opts, 'ignoreInitial')) opts.ignoreInitial = false; - if (undef(opts, 'ignorePermissionErrors')) opts.ignorePermissionErrors = false; - if (undef(opts, 'interval')) opts.interval = 100; - if (undef(opts, 'binaryInterval')) opts.binaryInterval = 300; - if (undef(opts, 'disableGlobbing')) opts.disableGlobbing = false; - opts.enableBinaryInterval = opts.binaryInterval !== opts.interval; - // Enable fsevents on OS X when polling isn't explicitly enabled. - if (undef(opts, 'useFsEvents')) opts.useFsEvents = !opts.usePolling; +/***/ }), - // If we can't use fsevents, ensure the options reflect it's disabled. - const canUseFsEvents = FsEventsHandler.canUse(); - if (!canUseFsEvents) opts.useFsEvents = false; +/***/ 2400: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // Use polling on Mac if not using fsevents. - // Other platforms use non-polling fs_watch. - if (undef(opts, 'usePolling') && !opts.useFsEvents) { - opts.usePolling = isMacos; +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY } + constructor (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } - // Global override (useful for end-developers that need to force polling for all - // instances of chokidar, regardless of usage/dependency depth) - const envPoll = process.env.CHOKIDAR_USEPOLLING; - if (envPoll !== undefined) { - const envLower = envPoll.toLowerCase(); + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } - if (envLower === 'false' || envLower === '0') { - opts.usePolling = false; - } else if (envLower === 'true' || envLower === '1') { - opts.usePolling = true; + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' } else { - opts.usePolling = !!envLower; + this.value = this.operator + this.semver.version } - } - const envInterval = process.env.CHOKIDAR_INTERVAL; - if (envInterval) { - opts.interval = Number.parseInt(envInterval, 10); - } - // Editor atomic write normalization enabled by default with fs.watch - if (undef(opts, 'atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents; - if (opts.atomic) this._pendingUnlinks = new Map(); + debug('comp', this) + } - if (undef(opts, 'followSymlinks')) opts.followSymlinks = true; + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) - if (undef(opts, 'awaitWriteFinish')) opts.awaitWriteFinish = false; - if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {}; - const awf = opts.awaitWriteFinish; - if (awf) { - if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000; - if (!awf.pollInterval) awf.pollInterval = 100; - this._pendingWrites = new Map(); - } - if (opts.ignored) opts.ignored = arrify(opts.ignored); + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } - let readyCalls = 0; - this._emitReady = () => { - readyCalls++; - if (readyCalls >= this._readyCount) { - this._emitReady = EMPTY_FN; - this._readyEmitted = true; - // use process.nextTick to allow time for listener to be bound - process.nextTick(() => this.emit(EV_READY)); + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' } - }; - this._emitRaw = (...args) => this.emit(EV_RAW, ...args); - this._readyEmitted = false; - this.options = opts; - // Initialize with proper watcher. - if (opts.useFsEvents) { - this._fsEventsHandler = new FsEventsHandler(this); - } else { - this._nodeFsHandler = new NodeFsHandler(this); + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } } - // You’re frozen when your heart’s not open. - Object.freeze(opts); -} + toString () { + return this.value + } -// Public methods + test (version) { + debug('Comparator.test', version, this.options.loose) -/** - * Adds paths to be watched on an existing FSWatcher instance - * @param {Path|Array} paths_ - * @param {String=} _origAdd private; for handling non-existent paths to be watched - * @param {Boolean=} _internal private; indicates a non-user add - * @returns {FSWatcher} for chaining - */ -add(paths_, _origAdd, _internal) { - const {cwd, disableGlobbing} = this.options; - this.closed = false; - let paths = unifyPaths(paths_); - if (cwd) { - paths = paths.map((path) => { - const absPath = getAbsolutePath(path, cwd); + if (this.semver === ANY || version === ANY) { + return true + } - // Check `path` instead of `absPath` because the cwd portion can't be a glob - if (disableGlobbing || !isGlob(path)) { - return absPath; + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false } - return normalizePath(absPath); - }); + } + + return cmp(version, this.operator, this.semver, this.options) } - // set aside negated glob strings - paths = paths.filter((path) => { - if (path.startsWith(BANG)) { - this._ignoredPaths.add(path.slice(1)); - return false; + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') } - // if a path is being added that was previously ignored, stop ignoring it - this._ignoredPaths.delete(path); - this._ignoredPaths.delete(path + SLASH_GLOBSTAR); + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = undefined; + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) + } - return true; - }); + const sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + const sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + const sameSemVer = this.semver.version === comp.semver.version + const differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + const oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<') + const oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>') - if (this.options.useFsEvents && this._fsEventsHandler) { - if (!this._readyCount) this._readyCount = paths.length; - if (this.options.persistent) this._readyCount *= 2; - paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path)); - } else { - if (!this._readyCount) this._readyCount = 0; - this._readyCount += paths.length; - Promise.all( - paths.map(async path => { - const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd); - if (res) this._emitReady(); - return res; - }) - ).then(results => { - if (this.closed) return; - results.filter(item => item).forEach(item => { - this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item)); - }); - }); + return ( + sameDirectionIncreasing || + sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || + oppositeDirectionsGreaterThan + ) } +} - return this; -} - -/** - * Close watchers or start ignoring events from specified paths. - * @param {Path|Array} paths_ - string or array of strings, file/directory paths and/or globs - * @returns {FSWatcher} for chaining -*/ -unwatch(paths_) { - if (this.closed) return this; - const paths = unifyPaths(paths_); - const {cwd} = this.options; - - paths.forEach((path) => { - // convert to absolute path unless relative path already matches - if (!sysPath.isAbsolute(path) && !this._closers.has(path)) { - if (cwd) path = sysPath.join(cwd, path); - path = sysPath.resolve(path); - } +module.exports = Comparator - this._closePath(path); +const {re, t} = __webpack_require__(97559) +const cmp = __webpack_require__(27323) +const debug = __webpack_require__(4709) +const SemVer = __webpack_require__(2975) +const Range = __webpack_require__(17151) - this._ignoredPaths.add(path); - if (this._watched.has(path)) { - this._ignoredPaths.add(path + SLASH_GLOBSTAR); - } - // reset the cached userIgnored anymatch fn - // to make ignoredPaths changes effective - this._userIgnored = undefined; - }); +/***/ }), - return this; -} +/***/ 17151: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/** - * Close watchers and remove all listeners from watched paths. - * @returns {Promise}. -*/ -close() { - if (this.closed) return this; - this.closed = true; +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } - // Memory management. - this.removeAllListeners(); - const closers = []; - this._closers.forEach(closerList => closerList.forEach(closer => { - const promise = closer(); - if (promise instanceof Promise) closers.push(promise); - })); - this._streams.forEach(stream => stream.destroy()); - this._userIgnored = undefined; - this._readyCount = 0; - this._readyEmitted = false; - this._watched.forEach(dirent => dirent.dispose()); - ['closers', 'watched', 'streams', 'symlinkPaths', 'throttled'].forEach(key => { - this[`_${key}`].clear(); - }); - return closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve(); -} + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } + } -/** - * Expose list of watched paths - * @returns {Object} for chaining -*/ -getWatched() { - const watchList = {}; - this._watched.forEach((entry, dir) => { - const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir; - watchList[key || ONE_DOT] = entry.getChildren().sort(); - }); - return watchList; -} + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.format() + return this + } -emitWithAll(event, args) { - this.emit(...args); - if (event !== EV_ERROR) this.emit(EV_ALL, ...args); -} + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease -// Common helpers -// -------------- + // First, split based on boolean or || + this.raw = range + this.set = range + .split(/\s*\|\|\s*/) + // map the range to a 2d array of comparators + .map(range => this.parseRange(range.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) -/** - * Normalize and emit events. - * Calling _emit DOES NOT MEAN emit() would be called! - * @param {EventName} event Type of event - * @param {Path} path File or directory path - * @param {*=} val1 arguments to be passed with event - * @param {*=} val2 - * @param {*=} val3 - * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag - */ -async _emit(event, path, val1, val2, val3) { - if (this.closed) return; + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${range}`) + } - const opts = this.options; - if (isWindows) path = sysPath.normalize(path); - if (opts.cwd) path = sysPath.relative(opts.cwd, path); - /** @type Array */ - const args = [event, path]; - if (val3 !== undefined) args.push(val1, val2, val3); - else if (val2 !== undefined) args.push(val1, val2); - else if (val1 !== undefined) args.push(val1); + this.format() + } - const awf = opts.awaitWriteFinish; - let pw; - if (awf && (pw = this._pendingWrites.get(path))) { - pw.lastChange = new Date(); - return this; + format () { + this.range = this.set + .map((comps) => { + return comps.join(' ').trim() + }) + .join('||') + .trim() + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + const loose = this.options.loose + range = range.trim() + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, re[t.COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + return range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + .map(comp => replaceGTE0(comp, this.options)) + // in loose mode, throw out any that are not valid comparators + .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) + .map(comp => new Comparator(comp, this.options)) + } + + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) } - if (opts.atomic) { - if (event === EV_UNLINK) { - this._pendingUnlinks.set(path, args); - setTimeout(() => { - this._pendingUnlinks.forEach((entry, path) => { - this.emit(...entry); - this.emit(EV_ALL, ...entry); - this._pendingUnlinks.delete(path); - }); - }, typeof opts.atomic === 'number' ? opts.atomic : 100); - return this; - } - if (event === EV_ADD && this._pendingUnlinks.has(path)) { - event = args[0] = EV_CHANGE; - this._pendingUnlinks.delete(path); + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false } - } - if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) { - const awfEmit = (err, stats) => { - if (err) { - event = args[0] = EV_ERROR; - args[1] = err; - this.emitWithAll(event, args); - } else if (stats) { - // if stats doesn't exist the file must have been deleted - if (args.length > 2) { - args[2] = stats; - } else { - args.push(stats); - } - this.emitWithAll(event, args); + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false } - }; + } - this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit); - return this; + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false } +} +module.exports = Range - if (event === EV_CHANGE) { - const isThrottled = !this._throttle(EV_CHANGE, path, 50); - if (isThrottled) return this; - } +const Comparator = __webpack_require__(2400) +const debug = __webpack_require__(4709) +const SemVer = __webpack_require__(2975) +const { + re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace +} = __webpack_require__(97559) + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) - if (opts.alwaysStat && val1 === undefined && - (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE) - ) { - const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path; - try { - const stats = await stat(fullPath); - // Suppress event when fs_stat fails, to avoid sending undefined 'stat' - if (!stats) return; - args.push(stats); - this.emitWithAll(event, args); - } catch (err) {} - } else { - this.emitWithAll(event, args); + testComparator = remainingComparators.pop() } - return this; + return result } -/** - * Common handler for errors - * @param {Error} error - * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag - */ -_handleError(error) { - const code = error && error.code; - if (error && code !== 'ENOENT' && code !== 'ENOTDIR' && - (!this.options.ignorePermissionErrors || (code !== 'EPERM' && code !== 'EACCES')) - ) { - this.emit(EV_ERROR, error); - } - return error || this.closed; +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp } -/** - * Helper utility for throttling - * @param {ThrottleType} actionType type being throttled - * @param {Path} path being acted upon - * @param {Number} timeout duration of time to suppress duplicate actions - * @returns {Object|false} tracking object or false if action should be suppressed - */ -_throttle(actionType, path, timeout) { - if (!this._throttled.has(actionType)) { - this._throttled.set(actionType, new Map()); - } +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' - /** @type {Map} */ - const action = this._throttled.get(actionType); - /** @type {Object} */ - const actionPath = action.get(path); +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +const replaceTildes = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceTilde(comp, options) + }).join(' ') - if (actionPath) { - actionPath.count++; - return false; - } +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret - let timeoutObject; - const clear = () => { - const item = action.get(path); - const count = item ? item.count : 0; - action.delete(path); - clearTimeout(timeoutObject); - if (item) clearTimeout(item.timeoutObject); - return count; - }; - timeoutObject = setTimeout(clear, timeout); - const thr = {timeoutObject, clear, count: 0}; - action.set(path, thr); - return thr; -} + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0` + } -_incrReadyCount() { - return this._readyCount++; + debug('tilde return', ret) + return ret + }) } -/** - * Awaits write operation to finish. - * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback. - * @param {Path} path being acted upon - * @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished - * @param {EventName} event - * @param {Function} awfEmit Callback to be called when ready for event to be emitted. - */ -_awaitWriteFinish(path, threshold, event, awfEmit) { - let timeoutHandler; - - let fullPath = path; - if (this.options.cwd && !sysPath.isAbsolute(path)) { - fullPath = sysPath.join(this.options.cwd, path); - } +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +const replaceCarets = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceCaret(comp, options) + }).join(' ') - const now = new Date(); +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + const z = options.includePrerelease ? '-0' : '' + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret - const awaitWriteFinish = (prevStat) => { - fs.stat(fullPath, (err, curStat) => { - if (err || !this._pendingWrites.has(path)) { - if (err && err.code !== 'ENOENT') awfEmit(err); - return; + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` } - - const now = Number(new Date()); - - if (prevStat && curStat.size !== prevStat.size) { - this._pendingWrites.get(path).lastChange = now; + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0` } - const pw = this._pendingWrites.get(path); - const df = now - pw.lastChange; - - if (df >= threshold) { - this._pendingWrites.delete(path); - awfEmit(undefined, curStat); + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0` + } } else { - timeoutHandler = setTimeout( - awaitWriteFinish, - this.options.awaitWriteFinish.pollInterval, - curStat - ); + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0` } - }); - }; + } - if (!this._pendingWrites.has(path)) { - this._pendingWrites.set(path, { - lastChange: now, - cancelWait: () => { - this._pendingWrites.delete(path); - clearTimeout(timeoutHandler); - return event; - } - }); - timeoutHandler = setTimeout( - awaitWriteFinish, - this.options.awaitWriteFinish.pollInterval - ); - } + debug('caret return', ret) + return ret + }) } -_getGlobIgnored() { - return [...this._ignoredPaths.values()]; +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map((comp) => { + return replaceXRange(comp, options) + }).join(' ') } -/** - * Determines whether user has asked to ignore this path. - * @param {Path} path filepath or dir - * @param {fs.Stats=} stats result of fs.stat - * @returns {Boolean} - */ -_isIgnored(path, stats) { - if (this.options.atomic && DOT_RE.test(path)) return true; - if (!this._userIgnored) { - const {cwd} = this.options; - const ign = this.options.ignored; +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp - const ignored = ign && ign.map(normalizeIgnored(cwd)); - const paths = arrify(ignored) - .filter((path) => typeof path === STRING_TYPE && !isGlob(path)) - .map((path) => path + SLASH_GLOBSTAR); - const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths); - this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS); - } + if (gtlt === '=' && anyX) { + gtlt = '' + } - return this._userIgnored([path, stats]); -} + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' -_isntIgnored(path, stat) { - return !this._isIgnored(path, stat); -} + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 -/** - * Provides a set of common helpers and properties relating to symlink and glob handling. - * @param {Path} path file, directory, or glob pattern being watched - * @param {Number=} depth at any depth > 0, this isn't a glob - * @returns {WatchHelper} object containing helpers for this path - */ -_getWatchHelpers(path, depth) { - const watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path); - const follow = this.options.followSymlinks; + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } - return new WatchHelper(path, watchPath, follow, this); + if (gtlt === '<') + pr = '-0' + + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0` + } + + debug('xRange return', ret) + + return ret + }) } -// Directory helpers -// ----------------- +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[t.STAR], '') +} -/** - * Provides directory tracking objects - * @param {String} directory path of the directory - * @returns {DirEntry} the directory's tracking object - */ -_getWatchedDir(directory) { - if (!this._boundRemove) this._boundRemove = this._remove.bind(this); - const dir = sysPath.resolve(directory); - if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove)); - return this._watched.get(dir); +const replaceGTE0 = (comp, options) => { + debug('replaceGTE0', comp, options) + return comp.trim() + .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') } -// File helpers -// ------------ +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` + } else if (fpr) { + from = `>=${from}` + } else { + from = `>=${from}${incPr ? '-0' : ''}` + } -/** - * Check for read permissions. - * Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405 - * @param {fs.Stats} stats - object, result of fs_stat - * @returns {Boolean} indicates whether the file can be read -*/ -_hasReadPermissions(stats) { - if (this.options.ignorePermissionErrors) return true; + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0` + } else { + to = `<=${to}` + } - // stats.mode may be bigint - const md = stats && Number.parseInt(stats.mode, 10); - const st = md & 0o777; - const it = Number.parseInt(st.toString(8)[0], 10); - return Boolean(4 & it); + return (`${from} ${to}`).trim() } -/** - * Handles emitting unlink events for - * files and directories, and via recursion, for - * files and directories within directories that are unlinked - * @param {String} directory within which the following item is located - * @param {String} item base path of item/directory - * @returns {void} -*/ -_remove(directory, item) { - // if what is being deleted is a directory, get that directory's paths - // for recursive deleting and cleaning of watched object - // if it is not a directory, nestedDirectoryChildren will be empty array - const path = sysPath.join(directory, item); - const fullPath = sysPath.resolve(path); - const isDirectory = this._watched.has(path) || this._watched.has(fullPath); +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } - // prevent duplicate handling in case of arriving here nearly simultaneously - // via multiple paths (such as _handleFile and _handleDir) - if (!this._throttle('remove', path, 100)) return; + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue + } - // if the only watched file is removed, watch for its return - if (!isDirectory && !this.options.useFsEvents && this._watched.size === 1) { - this.add(directory, item, true); + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false } - // This will create a new entry in the watched object in either case - // so we got to do the directory check beforehand - const wp = this._getWatchedDir(path); - const nestedDirectoryChildren = wp.getChildren(); + return true +} - // Recursively remove children directories / files. - nestedDirectoryChildren.forEach(nested => this._remove(path, nested)); - // Check if item was on the watched list and remove it - const parent = this._getWatchedDir(directory); - const wasTracked = parent.has(item); - parent.remove(item); +/***/ }), - // If we wait for this file to be fully written, cancel the wait. - let relPath = path; - if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path); - if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) { - const event = this._pendingWrites.get(relPath).cancelWait(); - if (event === EV_ADD) return; - } +/***/ 2975: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // The Entry will either be a directory that just got removed - // or a bogus entry to a file, in either case we have to remove it - this._watched.delete(path); - this._watched.delete(fullPath); - const eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK; - if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path); +const debug = __webpack_require__(4709) +const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(14762) +const { re, t } = __webpack_require__(97559) - // Avoid conflicts if we later create another file with the same name - if (!this.options.useFsEvents) { - this._closePath(path); - } -} +const { compareIdentifiers } = __webpack_require__(34170) +class SemVer { + constructor (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid Version: ${version}`) + } -/** - * - * @param {Path} path - */ -_closePath(path) { - const closers = this._closers.get(path); - if (!closers) return; - closers.forEach(closer => closer()); - this._closers.delete(path); - const dir = sysPath.dirname(path); - this._getWatchedDir(dir).remove(sysPath.basename(path)); -} + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) + } -/** - * - * @param {Path} path - * @param {Function} closer - */ -_addPathCloser(path, closer) { - if (!closer) return; - let list = this._closers.get(path); - if (!list) { - list = []; - this._closers.set(path, list); - } - list.push(closer); -} + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease -_readdirp(root, opts) { - if (this.closed) return; - const options = {type: EV_ALL, alwaysStat: true, lstat: true, ...opts}; - let stream = readdirp(root, options); - this._streams.add(stream); - stream.once(STR_CLOSE, () => { - stream = undefined; - }); - stream.once(STR_END, () => { - if (stream) { - this._streams.delete(stream); - stream = undefined; - } - }); - return stream; -} + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) -} + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } -// Export FSWatcher class -exports.FSWatcher = FSWatcher; + this.raw = version -/** - * Instantiates watcher with paths to be tracked. - * @param {String|Array} paths file/directory paths and/or globs - * @param {Object=} options chokidar opts - * @returns an instance of FSWatcher for chaining. - */ -const watch = (paths, options) => { - const watcher = new FSWatcher(options); - watcher.add(paths); - return watcher; -}; + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] -exports.watch = watch; + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } -/***/ }), -/* 102 */ -/***/ (function(module) { + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } -"use strict"; + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + this.build = m[5] ? m[5].split('.') : [] + this.format() + } -function FetchSummary (raw) { - this.raw = raw; + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` + } + return this.version + } - this.remote = null; - this.branches = []; - this.tags = []; -} + toString () { + return this.version + } -FetchSummary.parsers = [ - [ - /From (.+)$/, function (fetchSummary, matches) { - fetchSummary.remote = matches[0]; - } - ], - [ - /\* \[new branch\]\s+(\S+)\s*\-> (.+)$/, function (fetchSummary, matches) { - fetchSummary.branches.push({ - name: matches[0], - tracking: matches[1] - }); - } - ], - [ - /\* \[new tag\]\s+(\S+)\s*\-> (.+)$/, function (fetchSummary, matches) { - fetchSummary.tags.push({ - name: matches[0], - tracking: matches[1] - }); + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 } - ] -]; + other = new SemVer(other, this.options) + } -FetchSummary.parse = function (data) { - var fetchSummary = new FetchSummary(data); + if (other.version === this.version) { + return 0 + } - String(data) - .trim() - .split('\n') - .forEach(function (line) { - var original = line.trim(); - FetchSummary.parsers.some(function (parser) { - var parsed = parser[0].exec(original); - if (parsed) { - parser[1](fetchSummary, parsed.slice(1)); - return true; - } - }); - }); + return this.compareMain(other) || this.comparePre(other) + } - return fetchSummary; -}; + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } -module.exports = FetchSummary; + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } -/***/ }), -/* 103 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } -var fs = __webpack_require__(747); + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } -var me = module.exports; + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } -me.spaces = 2; + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } -me.readFile = function(file, callback) { - fs.readFile(file, 'utf8', function(err, data) { - if (err) return callback(err, null); - - try { - var obj = JSON.parse(data); - callback(null, obj); - } catch (err2) { - callback(err2, null); - } - }) -} + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break -me.readFileSync = function(file) { - return JSON.parse(fs.readFileSync(file, 'utf8')); -} + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] + } + } else { + this.prerelease = [identifier, 0] + } + } + break -me.writeFile = function(file, obj, callback) { - var str = ''; - try { - str = JSON.stringify(obj, null, module.exports.spaces); - } catch (err) { - callback(err, null); + default: + throw new Error(`invalid increment argument: ${release}`) + } + this.format() + this.raw = this.version + return this } - fs.writeFile(file, str, callback); } -me.writeFileSync = function(file, obj) { - var str = JSON.stringify(obj, null, module.exports.spaces); - return fs.writeFileSync(file, str); //not sure if fs.writeFileSync returns anything, but just in case -} +module.exports = SemVer + /***/ }), -/* 104 */, -/* 105 */, -/* 106 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; +/***/ 52966: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -const os = __webpack_require__(87); -const hasFlag = __webpack_require__(364); +const parse = __webpack_require__(74067) +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean -const env = process.env; -let forceColor; -if (hasFlag('no-color') || - hasFlag('no-colors') || - hasFlag('color=false')) { - forceColor = false; -} else if (hasFlag('color') || - hasFlag('colors') || - hasFlag('color=true') || - hasFlag('color=always')) { - forceColor = true; -} -if ('FORCE_COLOR' in env) { - forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; -} +/***/ }), -function translateLevel(level) { - if (level === 0) { - return false; - } +/***/ 27323: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return { - level, - hasBasic: true, - has256: level >= 2, - has16m: level >= 3 - }; -} +const eq = __webpack_require__(78230) +const neq = __webpack_require__(18407) +const gt = __webpack_require__(39778) +const gte = __webpack_require__(56172) +const lt = __webpack_require__(24605) +const lte = __webpack_require__(80885) -function supportsColor(stream) { - if (forceColor === false) { - return 0; - } +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b - if (hasFlag('color=16m') || - hasFlag('color=full') || - hasFlag('color=truecolor')) { - return 3; - } + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b - if (hasFlag('color=256')) { - return 2; - } + case '': + case '=': + case '==': + return eq(a, b, loose) - if (stream && !stream.isTTY && forceColor !== true) { - return 0; - } + case '!=': + return neq(a, b, loose) - const min = forceColor ? 1 : 0; + case '>': + return gt(a, b, loose) - if (process.platform === 'win32') { - // Node.js 7.5.0 is the first version of Node.js to include a patch to - // libuv that enables 256 color output on Windows. Anything earlier and it - // won't work. However, here we target Node.js 8 at minimum as it is an LTS - // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows - // release that supports 256 colors. Windows 10 build 14931 is the first release - // that supports 16m/TrueColor. - const osRelease = os.release().split('.'); - if ( - Number(process.versions.node.split('.')[0]) >= 8 && - Number(osRelease[0]) >= 10 && - Number(osRelease[2]) >= 10586 - ) { - return Number(osRelease[2]) >= 14931 ? 3 : 2; - } + case '>=': + return gte(a, b, loose) - return 1; - } + case '<': + return lt(a, b, loose) - if ('CI' in env) { - if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { - return 1; - } + case '<=': + return lte(a, b, loose) - return min; - } + default: + throw new TypeError(`Invalid operator: ${op}`) + } +} +module.exports = cmp - if ('TEAMCITY_VERSION' in env) { - return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; - } - if (env.COLORTERM === 'truecolor') { - return 3; - } +/***/ }), - if ('TERM_PROGRAM' in env) { - const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); +/***/ 43236: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - switch (env.TERM_PROGRAM) { - case 'iTerm.app': - return version >= 3 ? 3 : 2; - case 'Apple_Terminal': - return 2; - // No default - } - } +const SemVer = __webpack_require__(2975) +const parse = __webpack_require__(74067) +const {re, t} = __webpack_require__(97559) - if (/-256(color)?$/i.test(env.TERM)) { - return 2; - } +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } - if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { - return 1; - } + if (typeof version === 'number') { + version = String(version) + } - if ('COLORTERM' in env) { - return 1; - } + if (typeof version !== 'string') { + return null + } - if (env.TERM === 'dumb') { - return min; - } + options = options || {} - return min; + let match = null + if (!options.rtl) { + match = version.match(re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + let next + while ((next = re[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + re[t.COERCERTL].lastIndex = -1 + } + + if (match === null) + return null + + return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) } +module.exports = coerce -function getSupportLevel(stream) { - const level = supportsColor(stream); - return translateLevel(level); + +/***/ }), + +/***/ 48966: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(2975) +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) } +module.exports = compareBuild -module.exports = { - supportsColor: getSupportLevel, - stdout: getSupportLevel(process.stdout), - stderr: getSupportLevel(process.stderr) -}; + +/***/ }), + +/***/ 86840: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(17188) +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose /***/ }), -/* 107 */ -/***/ (function(module) { -"use strict"; +/***/ 17188: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate_allOf(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $allSchemasEmpty = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; +const SemVer = __webpack_require__(2975) +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare + + +/***/ }), + +/***/ 16860: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(74067) +const eq = __webpack_require__(78230) + +const diff = (version1, version2) => { + if (eq(version1, version2)) { + return null + } else { + const v1 = parse(version1) + const v2 = parse(version2) + const hasPre = v1.prerelease.length || v2.prerelease.length + const prefix = hasPre ? 'pre' : '' + const defaultResult = hasPre ? 'prerelease' : '' + for (const key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key } } } + return defaultResult // may be undefined } - if ($breakOnError) { - if ($allSchemasEmpty) { - out += ' if (true) { '; - } else { - out += ' ' + ($closingBraces.slice(0, -1)) + ' '; - } - } - out = it.util.cleanUpCode(out); - return out; } +module.exports = diff /***/ }), -/* 108 */, -/* 109 */, -/* 110 */, -/* 111 */, -/* 112 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -(function () { - "use strict"; +/***/ 78230: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var fs = __webpack_require__(747) - ; +const compare = __webpack_require__(17188) +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq - function noop() {} - function copy(src, dst, opts, cb) { - if ('function' === typeof opts) { - cb = opts; - opts = null; - } - opts = opts || {}; +/***/ }), - function copyHelper(err) { - var is - , os - ; +/***/ 39778: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (!err && !(opts.replace || opts.overwrite)) { - return cb(new Error("File " + dst + " exists.")); - } +const compare = __webpack_require__(17188) +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt - fs.stat(src, function (err, stat) { - if (err) { - return cb(err); - } - is = fs.createReadStream(src); - os = fs.createWriteStream(dst); +/***/ }), - is.pipe(os); - os.on('close', function (err) { - if (err) { - return cb(err); - } +/***/ 56172: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - fs.utimes(dst, stat.atime, stat.mtime, cb); - }); - }); - } +const compare = __webpack_require__(17188) +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte - cb = cb || noop; - fs.stat(dst, copyHelper); + +/***/ }), + +/***/ 29124: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(2975) + +const inc = (version, release, options, identifier) => { + if (typeof (options) === 'string') { + identifier = options + options = undefined } - module.exports = copy; -}()); + try { + return new SemVer(version, options).inc(release, identifier).version + } catch (er) { + return null + } +} +module.exports = inc /***/ }), -/* 113 */, -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; +/***/ 24605: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compare = __webpack_require__(17188) +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt -Object.defineProperty(exports, "__esModule", { value: true }); -const singleton_1 = __webpack_require__(951); -exports.ono = singleton_1.ono; -var constructor_1 = __webpack_require__(181); -exports.Ono = constructor_1.Ono; -// tslint:disable-next-line: no-default-export -exports.default = singleton_1.ono; -// CommonJS default export hack -if ( true && typeof module.exports === "object") { - module.exports = Object.assign(module.exports.default, module.exports); // tslint:disable-line: no-unsafe-any -} -//# sourceMappingURL=index.js.map /***/ }), -/* 115 */ -/***/ (function(module) { -"use strict"; +/***/ 80885: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate_anyOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $noEmptySchema = $schema.every(function($sch) { - return it.util.schemaHasRules($sch, it.RULES.all); - }); - if ($noEmptySchema) { - var $currentBaseId = $it.baseId; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; - $closingBraces += '}'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should match some schema in anyOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - out = it.util.cleanUpCode(out); - } else { - if ($breakOnError) { - out += ' if (true) { '; - } - } - return out; -} +const compare = __webpack_require__(17188) +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte /***/ }), -/* 116 */, -/* 117 */, -/* 118 */ -/***/ (function(module) { -"use strict"; +/***/ 96452: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate_items(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId; - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if (Array.isArray($schema)) { - var $additionalItems = it.schema.additionalItems; - if ($additionalItems === false) { - out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - $closingBraces += '}'; - out += ' else { '; - } - } - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; - var $passData = $data + '[' + $i + ']'; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); - $it.dataPathArr[$dataNxt] = $i; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if (typeof $additionalItems == 'object' && it.util.schemaHasRules($additionalItems, it.RULES.all)) { - $it.schema = $additionalItems; - $it.schemaPath = it.schemaPath + '.additionalItems'; - $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } else if (it.util.schemaHasRules($schema, it.RULES.all)) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' }'; - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - out = it.util.cleanUpCode(out); - return out; -} +const SemVer = __webpack_require__(2975) +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major /***/ }), -/* 119 */, -/* 120 */, -/* 121 */, -/* 122 */, -/* 123 */, -/* 124 */, -/* 125 */ -/***/ (function(module) { -"use strict"; +/***/ 77016: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +const SemVer = __webpack_require__(2975) +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor -function _cycler(items) { - var index = -1; - return { - current: null, - reset: function reset() { - index = -1; - this.current = null; - }, - next: function next() { - index++; - if (index >= items.length) { - index = 0; - } +/***/ }), - this.current = items[index]; - return this.current; - } - }; -} +/***/ 18407: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -function _joiner(sep) { - sep = sep || ','; - var first = true; - return function () { - var val = first ? '' : sep; - first = false; - return val; - }; -} // Making this a function instead so it returns a new object -// each time it's called. That way, if something like an environment -// uses it, they will each have their own copy. +const compare = __webpack_require__(17188) +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq -function globals() { - return { - range: function range(start, stop, step) { - if (typeof stop === 'undefined') { - stop = start; - start = 0; - step = 1; - } else if (!step) { - step = 1; - } +/***/ }), - var arr = []; +/***/ 74067: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (step > 0) { - for (var i = start; i < stop; i += step) { - arr.push(i); - } - } else { - for (var _i = start; _i > stop; _i += step) { - // eslint-disable-line for-direction - arr.push(_i); - } - } +const {MAX_LENGTH} = __webpack_require__(14762) +const { re, t } = __webpack_require__(97559) +const SemVer = __webpack_require__(2975) - return arr; - }, - cycler: function cycler() { - return _cycler(Array.prototype.slice.call(arguments)); - }, - joiner: function joiner(sep) { - return _joiner(sep); +const parse = (version, options) => { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false } - }; + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + const r = options.loose ? re[t.LOOSE] : re[t.FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } } -module.exports = globals; +module.exports = parse + /***/ }), -/* 126 */, -/* 127 */, -/* 128 */, -/* 129 */ -/***/ (function(module) { +/***/ 82172: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = DiffSummary; +const SemVer = __webpack_require__(2975) +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch -/** - * The DiffSummary is returned as a response to getting `git().status()` - * - * @constructor - */ -function DiffSummary () { - this.files = []; - this.insertions = 0; - this.deletions = 0; - this.changed = 0; + +/***/ }), + +/***/ 74711: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const parse = __webpack_require__(74067) +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null } +module.exports = prerelease -/** - * Number of lines added - * @type {number} - */ -DiffSummary.prototype.insertions = 0; -/** - * Number of lines deleted - * @type {number} - */ -DiffSummary.prototype.deletions = 0; +/***/ }), -/** - * Number of files changed - * @type {number} - */ -DiffSummary.prototype.changed = 0; +/***/ 30949: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -DiffSummary.parse = function (text) { - var line, handler; +const compare = __webpack_require__(17188) +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare - var lines = text.trim().split('\n'); - var status = new DiffSummary(); - var summary = lines.pop(); - if (summary) { - summary.trim().split(', ').forEach(function (text) { - var summary = /(\d+)\s([a-z]+)/.exec(text); - if (!summary) { - return; - } +/***/ }), - if (/files?/.test(summary[2])) { - status.changed = parseInt(summary[1], 10); - } - else { - status[summary[2].replace(/s$/, '') + 's'] = parseInt(summary[1], 10); - } - }); - } +/***/ 71435: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - while (line = lines.shift()) { - textFileChange(line, status.files) || binaryFileChange(line, status.files); - } +const compareBuild = __webpack_require__(48966) +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort - return status; -}; -function textFileChange (line, files) { - line = line.trim().match(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/); +/***/ }), - if (line) { - var alterations = (line[3] || '').trim(); - files.push({ - file: line[1].trim(), - changes: parseInt(line[2], 10), - insertions: alterations.replace(/-/g, '').length, - deletions: alterations.replace(/\+/g, '').length, - binary: false - }); +/***/ 62634: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return true; - } +const Range = __webpack_require__(17151) +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) } +module.exports = satisfies -function binaryFileChange (line, files) { - line = line.match(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)$/); - if (line) { - files.push({ - file: line[1].trim(), - before: +line[2], - after: +line[3], - binary: true - }); - return true; - } -} + +/***/ }), + +/***/ 48953: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const compareBuild = __webpack_require__(48966) +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort /***/ }), -/* 130 */, -/* 131 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; +/***/ 26671: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +const parse = __webpack_require__(74067) +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid -const fs = __webpack_require__(747); -const { Readable } = __webpack_require__(413); -const sysPath = __webpack_require__(622); -const { promisify } = __webpack_require__(669); -const picomatch = __webpack_require__(827); -const readdir = promisify(fs.readdir); -const stat = promisify(fs.stat); -const lstat = promisify(fs.lstat); -const realpath = promisify(fs.realpath); +/***/ }), -/** - * @typedef {Object} EntryInfo - * @property {String} path - * @property {String} fullPath - * @property {fs.Stats=} stats - * @property {fs.Dirent=} dirent - * @property {String} basename - */ +/***/ 57489: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -const BANG = '!'; -const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP']); -const FILE_TYPE = 'files'; -const DIR_TYPE = 'directories'; -const FILE_DIR_TYPE = 'files_directories'; -const EVERYTHING_TYPE = 'all'; -const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE]; +// just pre-load all the stuff that index.js lazily exports +const internalRe = __webpack_require__(97559) +module.exports = { + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: __webpack_require__(14762).SEMVER_SPEC_VERSION, + SemVer: __webpack_require__(2975), + compareIdentifiers: __webpack_require__(34170).compareIdentifiers, + rcompareIdentifiers: __webpack_require__(34170).rcompareIdentifiers, + parse: __webpack_require__(74067), + valid: __webpack_require__(26671), + clean: __webpack_require__(52966), + inc: __webpack_require__(29124), + diff: __webpack_require__(16860), + major: __webpack_require__(96452), + minor: __webpack_require__(77016), + patch: __webpack_require__(82172), + prerelease: __webpack_require__(74711), + compare: __webpack_require__(17188), + rcompare: __webpack_require__(30949), + compareLoose: __webpack_require__(86840), + compareBuild: __webpack_require__(48966), + sort: __webpack_require__(48953), + rsort: __webpack_require__(71435), + gt: __webpack_require__(39778), + lt: __webpack_require__(24605), + eq: __webpack_require__(78230), + neq: __webpack_require__(18407), + gte: __webpack_require__(56172), + lte: __webpack_require__(80885), + cmp: __webpack_require__(27323), + coerce: __webpack_require__(43236), + Comparator: __webpack_require__(2400), + Range: __webpack_require__(17151), + satisfies: __webpack_require__(62634), + toComparators: __webpack_require__(57575), + maxSatisfying: __webpack_require__(85564), + minSatisfying: __webpack_require__(97612), + minVersion: __webpack_require__(82834), + validRange: __webpack_require__(57458), + outside: __webpack_require__(50717), + gtr: __webpack_require__(79576), + ltr: __webpack_require__(7789), + intersects: __webpack_require__(26145), + simplifyRange: __webpack_require__(15636), + subset: __webpack_require__(62928), +} -const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code); -const normalizeFilter = filter => { - if (filter === undefined) return; - if (typeof filter === 'function') return filter; +/***/ }), - if (typeof filter === 'string') { - const glob = picomatch(filter.trim()); - return entry => glob(entry.basename); - } +/***/ 14762: +/***/ ((module) => { - if (Array.isArray(filter)) { - const positive = []; - const negative = []; - for (const item of filter) { - const trimmed = item.trim(); - if (trimmed.charAt(0) === BANG) { - negative.push(picomatch(trimmed.slice(1))); - } else { - positive.push(picomatch(trimmed)); - } - } +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' - if (negative.length > 0) { - if (positive.length > 0) { - return entry => - positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename)); - } - return entry => !negative.some(f => f(entry.basename)); - } - return entry => positive.some(f => f(entry.basename)); - } -}; +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 -class ReaddirpStream extends Readable { - static get defaultOptions() { - return { - root: '.', - /* eslint-disable no-unused-vars */ - fileFilter: (path) => true, - directoryFilter: (path) => true, - /* eslint-enable no-unused-vars */ - type: FILE_TYPE, - lstat: false, - depth: 2147483648, - alwaysStat: false - }; - } +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 - constructor(options = {}) { - super({ - objectMode: true, - autoDestroy: true, - highWaterMark: options.highWaterMark || 4096 - }); - const opts = { ...ReaddirpStream.defaultOptions, ...options }; - const { root, type } = opts; +module.exports = { + SEMVER_SPEC_VERSION, + MAX_LENGTH, + MAX_SAFE_INTEGER, + MAX_SAFE_COMPONENT_LENGTH +} - this._fileFilter = normalizeFilter(opts.fileFilter); - this._directoryFilter = normalizeFilter(opts.directoryFilter); - const statMethod = opts.lstat ? lstat : stat; - // Use bigint stats if it's windows and stat() supports options (node 10+). - if (process.platform === 'win32' && stat.length === 3) { - this._stat = path => statMethod(path, { bigint: true }); - } else { - this._stat = statMethod; - } +/***/ }), - this._maxDepth = opts.depth; - this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); - this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); - this._wantsEverything = type === EVERYTHING_TYPE; - this._root = sysPath.resolve(root); - this._isDirent = ('Dirent' in fs) && !opts.alwaysStat; - this._statsProp = this._isDirent ? 'dirent' : 'stats'; - this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent }; +/***/ 4709: +/***/ ((module) => { - // Launch stream with one parent, the root dir. - this.parents = [this._exploreDir(root, 1)]; - this.reading = false; - this.parent = undefined; - } +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} - async _read(batch) { - if (this.reading) return; - this.reading = true; +module.exports = debug - try { - while (!this.destroyed && batch > 0) { - const { path, depth, files = [] } = this.parent || {}; - if (files.length > 0) { - const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path)); - for (const entry of await Promise.all(slice)) { - if (this.destroyed) return; +/***/ }), - const entryType = await this._getEntryType(entry); - if (entryType === 'directory' && this._directoryFilter(entry)) { - if (depth <= this._maxDepth) { - this.parents.push(this._exploreDir(entry.fullPath, depth + 1)); - } +/***/ 34170: +/***/ ((module) => { - if (this._wantsDir) { - this.push(entry); - batch--; - } - } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) { - if (this._wantsFile) { - this.push(entry); - batch--; - } - } - } - } else { - const parent = this.parents.pop(); - if (!parent) { - this.push(null); - break; - } - this.parent = await parent; - if (this.destroyed) return; - } - } - } catch (error) { - this.destroy(error); - } finally { - this.reading = false; - } - } +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) - async _exploreDir(path, depth) { - let files; - try { - files = await readdir(path, this._rdOptions); - } catch (error) { - this._onError(error); - } - return {files, depth, path}; + if (anum && bnum) { + a = +a + b = +b } - async _formatEntry(dirent, path) { - let entry; - try { - const basename = this._isDirent ? dirent.name : dirent; - const fullPath = sysPath.resolve(sysPath.join(path, basename)); - entry = {path: sysPath.relative(this._root, fullPath), fullPath, basename}; - entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath); - } catch (err) { - this._onError(err); - } - return entry; - } + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} - _onError(err) { - if (isNormalFlowError(err) && !this.destroyed) { - this.emit('warn', err); - } else { - this.destroy(err); - } - } +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) - async _getEntryType(entry) { - // entry may be undefined, because a warning or an error were emitted - // and the statsProp is undefined - const stats = entry && entry[this._statsProp]; - if (!stats) { - return; - } - if (stats.isFile()) { - return 'file'; - } - if (stats.isDirectory()) { - return 'directory'; - } - if (stats && stats.isSymbolicLink()) { - try { - const entryRealPath = await realpath(entry.fullPath); - const entryRealPathStats = await lstat(entryRealPath); - if (entryRealPathStats.isFile()) { - return 'file'; - } - if (entryRealPathStats.isDirectory()) { - return 'directory'; - } - } catch (error) { - this._onError(error); - } - } - } +module.exports = { + compareIdentifiers, + rcompareIdentifiers +} - _includeAsFile(entry) { - const stats = entry && entry[this._statsProp]; - return stats && this._wantsEverything && !stats.isDirectory(); - } -} +/***/ }), -/** - * @typedef {Object} ReaddirpArguments - * @property {Function=} fileFilter - * @property {Function=} directoryFilter - * @property {String=} type - * @property {Number=} depth - * @property {String=} root - * @property {Boolean=} lstat - * @property {Boolean=} bigint - */ +/***/ 97559: +/***/ ((module, exports, __webpack_require__) => { -/** - * Main function which ends up calling readdirRec and reads all files and directories in given root recursively. - * @param {String} root Root directory - * @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth - */ -const readdirp = (root, options = {}) => { - let type = options.entryType || options.type; - if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility - if (type) options.type = type; - if (!root) { - throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)'); - } else if (typeof root !== 'string') { - throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)'); - } else if (type && !ALL_TYPES.includes(type)) { - throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`); - } +const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(14762) +const debug = __webpack_require__(4709) +exports = module.exports = {} - options.root = root; - return new ReaddirpStream(options); -}; +// The actual regexps go on exports.re +const re = exports.re = [] +const src = exports.src = [] +const t = exports.t = {} +let R = 0 -const readdirpPromise = (root, options = {}) => { - return new Promise((resolve, reject) => { - const files = []; - readdirp(root, options) - .on('data', entry => files.push(entry)) - .on('end', () => resolve(files)) - .on('error', error => reject(error)); - }); -}; +const createToken = (name, value, isGlobal) => { + const index = R++ + debug(index, value) + t[name] = index + src[index] = value + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) +} -readdirp.promise = readdirpPromise; -readdirp.ReaddirpStream = ReaddirpStream; -readdirp.default = readdirp; +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. -module.exports = readdirp; +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') -/***/ }), -/* 132 */, -/* 133 */ -/***/ (function(module) { +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. -"use strict"; +createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') +// ## Main Version +// Three dot-separated numeric identifiers. -let BINARY_REGEXP = /\.(jpeg|jpg|gif|png|bmp|ico)$/i; +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) -module.exports = { - /** - * The order that this parser will run, in relation to other parsers. - * - * @type {number} - */ - order: 400, +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) - /** - * Whether to allow "empty" files (zero bytes). - * - * @type {boolean} - */ - allowEmpty: true, +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. - /** - * Determines whether this parser can parse a given file reference. - * Parsers that return true will be tried, in order, until one successfully parses the file. - * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case - * every parser will be tried. - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {boolean} - */ - canParse (file) { - // Use this parser if the file is a Buffer, and has a known binary extension - return Buffer.isBuffer(file.data) && BINARY_REGEXP.test(file.url); - }, +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) - /** - * Parses the given data as a Buffer (byte array). - * - * @param {object} file - An object containing information about the referenced file - * @param {string} file.url - The full URL of the referenced file - * @param {string} file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.) - * @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver - * @returns {Promise} - */ - parse (file) { - if (Buffer.isBuffer(file.data)) { - return file.data; - } - else { - // This will reject if data is anything other than a string or typed array - return Buffer.from(file.data); - } - } -}; +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. -/***/ }), -/* 134 */, -/* 135 */, -/* 136 */, -/* 137 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) -"use strict"; +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. -var implementation = __webpack_require__(476); +createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') -var supportsDescriptors = __webpack_require__(359).supportsDescriptors; -var $gOPD = Object.getOwnPropertyDescriptor; -var $TypeError = TypeError; +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. -module.exports = function getPolyfill() { - if (!supportsDescriptors) { - throw new $TypeError('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors'); - } - if ((/a/mig).flags === 'gim') { - var descriptor = $gOPD(RegExp.prototype, 'flags'); - if (descriptor && typeof descriptor.get === 'function' && typeof (/a/).dotAll === 'boolean') { - return descriptor.get; - } - } - return implementation; -}; +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. -/***/ }), -/* 138 */ -/***/ (function(module) { +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. -"use strict"; +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) +createToken('FULL', `^${src[t.FULLPLAIN]}$`) -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) - return str.replace(matchOperatorsRe, '\\$&'); -}; +createToken('GTLT', '((?:<|>)?=?)') +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) -/***/ }), -/* 139 */, -/* 140 */, -/* 141 */, -/* 142 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCE', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) -module.exports = which -which.sync = whichSync +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') -var isWindows = process.platform === 'win32' || - process.env.OSTYPE === 'cygwin' || - process.env.OSTYPE === 'msys' +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' -var path = __webpack_require__(622) -var COLON = isWindows ? ';' : ':' -var isexe = __webpack_require__(742) +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) -function getNotFoundError (cmd) { - var er = new Error('not found: ' + cmd) - er.code = 'ENOENT' +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') - return er -} +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' -function getPathInfo (cmd, opt) { - var colon = opt.colon || COLON - var pathEnv = opt.path || process.env.PATH || '' - var pathExt = [''] +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) - pathEnv = pathEnv.split(colon) +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) - var pathExtExe = '' - if (isWindows) { - pathEnv.unshift(process.cwd()) - pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM') - pathExt = pathExtExe.split(colon) +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) - // Always test the cmd itself first. isexe will check to make sure - // it's found in the pathExt set. - if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') - pathExt.unshift('') - } +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) - // If it has a slash, then we don't bother searching the pathenv. - // just check the file itself, and that's it. - if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) - pathEnv = [''] +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') - return { - env: pathEnv, - ext: pathExt, - extExe: pathExtExe - } -} -function which (cmd, opt, cb) { - if (typeof opt === 'function') { - cb = opt - opt = {} - } +/***/ }), - var info = getPathInfo(cmd, opt) - var pathEnv = info.env - var pathExt = info.ext - var pathExtExe = info.extExe - var found = [] +/***/ 79576: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - ;(function F (i, l) { - if (i === l) { - if (opt.all && found.length) - return cb(null, found) - else - return cb(getNotFoundError(cmd)) - } +// Determine if version is greater than all the versions possible in the range. +const outside = __webpack_require__(50717) +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr - var pathPart = pathEnv[i] - if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') - pathPart = pathPart.slice(1, -1) - var p = path.join(pathPart, cmd) - if (!pathPart && (/^\.[\\\/]/).test(cmd)) { - p = cmd.slice(0, 2) + p - } - ;(function E (ii, ll) { - if (ii === ll) return F(i + 1, l) - var ext = pathExt[ii] - isexe(p + ext, { pathExt: pathExtExe }, function (er, is) { - if (!er && is) { - if (opt.all) - found.push(p + ext) - else - return cb(null, p + ext) - } - return E(ii + 1, ll) - }) - })(0, pathExt.length) - })(0, pathEnv.length) +/***/ }), + +/***/ 26145: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(17151) +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) } +module.exports = intersects -function whichSync (cmd, opt) { - opt = opt || {} - var info = getPathInfo(cmd, opt) - var pathEnv = info.env - var pathExt = info.ext - var pathExtExe = info.extExe - var found = [] +/***/ }), - for (var i = 0, l = pathEnv.length; i < l; i ++) { - var pathPart = pathEnv[i] - if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') - pathPart = pathPart.slice(1, -1) +/***/ 7789: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - var p = path.join(pathPart, cmd) - if (!pathPart && /^\.[\\\/]/.test(cmd)) { - p = cmd.slice(0, 2) + p - } - for (var j = 0, ll = pathExt.length; j < ll; j ++) { - var cur = p + pathExt[j] - var is - try { - is = isexe.sync(cur, { pathExt: pathExtExe }) - if (is) { - if (opt.all) - found.push(cur) - else - return cur - } - } catch (ex) {} - } - } +const outside = __webpack_require__(50717) +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr - if (opt.all && found.length) - return found - if (opt.nothrow) - return null +/***/ }), - throw getNotFoundError(cmd) +/***/ 85564: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const SemVer = __webpack_require__(2975) +const Range = __webpack_require__(17151) + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max } +module.exports = maxSatisfying /***/ }), -/* 143 */, -/* 144 */, -/* 145 */, -/* 146 */ -/***/ (function(module) { -"use strict"; +/***/ 97612: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate_uniqueItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; +const SemVer = __webpack_require__(2975) +const Range = __webpack_require__(17151) +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null } - if (($schema || $isData) && it.opts.uniqueItems !== false) { - if ($isData) { - out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { '; - } - out += ' var i = ' + ($data) + '.length , ' + ($valid) + ' = true , j; if (i > 1) { '; - var $itemType = it.schema.items && it.schema.items.type, - $typeIsArray = Array.isArray($itemType); - if (!$itemType || $itemType == 'object' || $itemType == 'array' || ($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0))) { - out += ' outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } '; - } else { - out += ' var itemIndices = {}, item; for (;i--;) { var item = ' + ($data) + '[i]; '; - var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); - out += ' if (' + (it.util[$method]($itemType, 'item', true)) + ') continue; '; - if ($typeIsArray) { - out += ' if (typeof item == \'string\') item = \'"\' + item; '; - } - out += ' if (typeof itemIndices[item] == \'number\') { ' + ($valid) + ' = false; j = itemIndices[item]; break; } itemIndices[item] = i; } '; - } - out += ' } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; } - } - return out; + }) + return min } +module.exports = minSatisfying /***/ }), -/* 147 */, -/* 148 */, -/* 149 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; +/***/ 82834: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var path = __webpack_require__(622); +const SemVer = __webpack_require__(2975) +const Range = __webpack_require__(17151) +const gt = __webpack_require__(39778) -module.exports = function express(env, app) { - function NunjucksView(name, opts) { - this.name = name; - this.path = name; - this.defaultEngine = opts.defaultEngine; - this.ext = path.extname(name); +const minVersion = (range, loose) => { + range = new Range(range, loose) - if (!this.ext && !this.defaultEngine) { - throw new Error('No default engine was specified and no extension was provided.'); - } + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } - if (!this.ext) { - this.name += this.ext = (this.defaultEngine[0] !== '.' ? '.' : '') + this.defaultEngine; - } + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver } - NunjucksView.prototype.render = function render(opts, cb) { - env.render(this.name, opts, cb); - }; + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] - app.set('view', NunjucksView); - app.set('nunjucksEnv', env); - return env; -}; - -/***/ }), -/* 150 */, -/* 151 */, -/* 152 */, -/* 153 */ -/***/ (function(module) { - -"use strict"; - -module.exports = function generate_properties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl; - var $schemaKeys = Object.keys($schema || {}), - $pProperties = it.schema.patternProperties || {}, - $pPropertyKeys = Object.keys($pProperties), - $aProperties = it.schema.additionalProperties, - $someProperties = $schemaKeys.length || $pPropertyKeys.length, - $noAdditional = $aProperties === false, - $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length, - $removeAdditional = it.opts.removeAdditional, - $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - var $required = it.schema.required; - if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required); - out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;'; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined;'; - } - if ($checkAdditional) { - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - if ($someProperties) { - out += ' var isAdditional' + ($lvl) + ' = !(false '; - if ($schemaKeys.length) { - if ($schemaKeys.length > 8) { - out += ' || validate.schema' + ($schemaPath) + '.hasOwnProperty(' + ($key) + ') '; - } else { - var arr1 = $schemaKeys; - if (arr1) { - var $propertyKey, i1 = -1, - l1 = arr1.length - 1; - while (i1 < l1) { - $propertyKey = arr1[i1 += 1]; - out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' '; - } - } - } - } - if ($pPropertyKeys.length) { - var arr2 = $pPropertyKeys; - if (arr2) { - var $pProperty, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $pProperty = arr2[$i += 1]; - out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') '; - } - } - } - out += ' ); if (isAdditional' + ($lvl) + ') { '; - } - if ($removeAdditional == 'all') { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - var $currentErrorPath = it.errorPath; - var $additionalProperty = '\' + ' + $key + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - } - if ($noAdditional) { - if ($removeAdditional) { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - out += ' ' + ($nextValid) + ' = false; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalProperties'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is an invalid additional property'; - } else { - out += 'should NOT have additional properties'; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - out += ' break; '; - } - } - } else if ($additionalIsSchema) { - if ($removeAdditional == 'failing') { - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - } else { - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - } - } - it.errorPath = $currentErrorPath; - } - if ($someProperties) { - out += ' } '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - var $useDefaults = it.opts.useDefaults && !it.compositeRule; - if ($schemaKeys.length) { - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - var $prop = it.util.getProperty($propertyKey), - $passData = $data + $prop, - $hasDefault = $useDefaults && $sch.default !== undefined; - $it.schema = $sch; - $it.schemaPath = $schemaPath + $prop; - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); - $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); - $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - $code = it.util.varReplace($code, $nextData, $passData); - var $useData = $passData; - } else { - var $useData = $nextData; - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; '; - } - if ($hasDefault) { - out += ' ' + ($code) + ' '; - } else { - if ($requiredHash && $requiredHash[$propertyKey]) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = false; '; - var $currentErrorPath = it.errorPath, - $currErrSchemaPath = $errSchemaPath, - $missingProperty = it.util.escapeQuotes($propertyKey); - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - $errSchemaPath = it.errSchemaPath + '/required'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - it.errorPath = $currentErrorPath; - out += ' } else { '; - } else { - if ($breakOnError) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = true; } else { '; - } else { - out += ' if (' + ($useData) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ' ) { '; - } - } - out += ' ' + ($code) + ' } '; - } - } - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($pPropertyKeys.length) { - var arr4 = $pPropertyKeys; - if (arr4) { - var $pProperty, i4 = -1, - l4 = arr4.length - 1; - while (i4 < l4) { - $pProperty = arr4[i4 += 1]; - var $sch = $pProperties[$pProperty]; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - $it.schema = $sch; - $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); - $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else ' + ($nextValid) + ' = true; '; + compver.prerelease.push(0) } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver } - } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) } - } + }) } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + + if (minver && range.test(minver)) { + return minver } - out = it.util.cleanUpCode(out); - return out; + + return null } +module.exports = minVersion /***/ }), -/* 154 */ -/***/ (function(module) { -"use strict"; +/***/ 50717: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate_contains(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId, - $nonEmptySchema = (it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all)); - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($nonEmptySchema) { - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (' + ($nextValid) + ') break; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {'; - } else { - out += ' if (' + ($data) + '.length == 0) {'; +const SemVer = __webpack_require__(2975) +const Comparator = __webpack_require__(2400) +const {ANY} = Comparator +const Range = __webpack_require__(17151) +const satisfies = __webpack_require__(62634) +const gt = __webpack_require__(39778) +const lt = __webpack_require__(24605) +const lte = __webpack_require__(80885) +const gte = __webpack_require__(56172) + +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) + + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should contain a valid item\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let high = null + let low = null + + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - if ($nonEmptySchema) { - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - } - if (it.opts.allErrors) { - out += ' } '; } - out = it.util.cleanUpCode(out); - return out; + return true } +module.exports = outside -/***/ }), -/* 155 */, -/* 156 */, -/* 157 */, -/* 158 */, -/* 159 */, -/* 160 */, -/* 161 */, -/* 162 */, -/* 163 */, -/* 164 */, -/* 165 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; +/***/ }), -var escapeStringRegexp = __webpack_require__(138); +/***/ 15636: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies = __webpack_require__(62634) +const compare = __webpack_require__(17188) +module.exports = (versions, range, options) => { + const set = [] + let min = null + let prev = null + const v = versions.sort((a, b) => compare(a, b, options)) + for (const version of v) { + const included = satisfies(version, range, options) + if (included) { + prev = version + if (!min) + min = version + } else { + if (prev) { + set.push([min, prev]) + } + prev = null + min = null + } + } + if (min) + set.push([min, null]) + + const ranges = [] + for (const [min, max] of set) { + if (min === max) + ranges.push(min) + else if (!max && min === v[0]) + ranges.push('*') + else if (!max) + ranges.push(`>=${min}`) + else if (min === v[0]) + ranges.push(`<=${max}`) + else + ranges.push(`${min} - ${max}`) + } + const simplified = ranges.join(' || ') + const original = typeof range.raw === 'string' ? range.raw : String(range) + return simplified.length < original.length ? simplified : range +} -module.exports = function (str, target) { - if (typeof str !== 'string' || typeof target !== 'string') { - throw new TypeError('Expected a string'); - } - return str.replace(new RegExp('(?:' + escapeStringRegexp(target) + '){2,}', 'g'), target); -}; +/***/ }), +/***/ 62928: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/***/ }), -/* 166 */, -/* 167 */, -/* 168 */, -/* 169 */, -/* 170 */, -/* 171 */, -/* 172 */, -/* 173 */, -/* 174 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +const Range = __webpack_require__(17151) +const { ANY } = __webpack_require__(2400) +const satisfies = __webpack_require__(62634) +const compare = __webpack_require__(17188) -"use strict"; +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else return false +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If LT +// - If LT.semver is greater than that of any > comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If any C is a = range, and GT or LT are set, return false +// - Else return true + +const subset = (sub, dom, options) => { + sub = new Range(sub, options) + dom = new Range(dom, options) + let sawNonNull = false + + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options) + sawNonNull = sawNonNull || isSub !== null + if (isSub) + continue OUTER + } + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) + return false + } + return true +} +const simpleSubset = (sub, dom, options) => { + if (sub.length === 1 && sub[0].semver === ANY) + return dom.length === 1 && dom[0].semver === ANY -var bind = __webpack_require__(739); + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') + gt = higherGT(gt, c, options) + else if (c.operator === '<' || c.operator === '<=') + lt = lowerLT(lt, c, options) + else + eqSet.add(c.semver) + } -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); + if (eqSet.size > 1) + return null + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) + return null + else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) + return null + } -/***/ }), -/* 175 */, -/* 176 */, -/* 177 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) + return null -const { addExtensions } = __webpack_require__(696); -const Base = __webpack_require__(31); + if (lt && !satisfies(eq, String(lt), options)) + return null -/** - * Implements functions to deal with the Contact object. - * @class - * @extends Base - * @returns {Contact} - */ -class Contact extends Base { - /** - * @returns {string} - */ - name() { - return this._json.name; - } - - /** - * @returns {string} - */ - url() { - return this._json.url; + for (const c of dom) { + if (!satisfies(eq, String(c), options)) + return false + } + return true } - - /** - * @returns {string} - */ - email() { - return this._json.email; + + let higher, lower + let hasDomLT, hasDomGT + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c) + return false + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) + return false + } + if (lt) { + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c) + return false + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) + return false + } + if (!c.operator && (lt || gt) && gtltComp !== 0) + return false } -} -module.exports = addExtensions(Contact); + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) + return false + if (lt && hasDomGT && !gt && gtltComp !== 0) + return false -/***/ }), -/* 178 */, -/* 179 */, -/* 180 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + return true +} -"use strict"; +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) + return b + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a +} +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) + return b + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a +} +module.exports = subset -var common = __webpack_require__(740); +/***/ }), -function Mark(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; -} +/***/ 57575: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +const Range = __webpack_require__(17151) -Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) - if (!this.buffer) return null; +module.exports = toComparators - indent = indent || 4; - maxLength = maxLength || 75; - head = ''; - start = this.position; +/***/ }), - while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { - start -= 1; - if (this.position - start > (maxLength / 2 - 1)) { - head = ' ... '; - start += 5; - break; - } +/***/ 57458: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Range = __webpack_require__(17151) +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null } +} +module.exports = validRange - tail = ''; - end = this.position; - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - if (end - this.position > (maxLength / 2 - 1)) { - tail = ' ... '; - end -= 5; - break; - } - } +/***/ }), - snippet = this.buffer.slice(start, end); +/***/ 3149: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - return common.repeat(' ', indent) + head + snippet + tail + '\n' + - common.repeat(' ', indent + this.position - start + head.length) + '^'; +const toJsonSchema = __webpack_require__(17040); + +module.exports = { + parse, + getMimeTypes }; +async function parse({ message, defaultSchemaFormat }) { + const transformed = toJsonSchema(message.payload, { + cloneSchema: true, + keepNotSupported: [ + 'discriminator', + 'readOnly', + 'writeOnly', + 'deprecated', + 'xml', + 'example', + ], + }); + + iterateSchema(transformed); -Mark.prototype.toString = function toString(compact) { - var snippet, where = ''; + message['x-parser-original-schema-format'] = message.schemaFormat || defaultSchemaFormat; + message['x-parser-original-payload'] = message.payload; + message.payload = transformed; + delete message.schemaFormat; +}; - if (this.name) { - where += 'in "' + this.name + '" '; +function iterateSchema(schema) { + if (schema.example !== undefined) { + const examples = schema.examples || []; + examples.push(schema.example); + schema.examples = examples; + delete schema.example; } - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); + if (schema.$schema !== undefined) { + delete schema.$schema; + } - if (!compact) { - snippet = this.getSnippet(); + aliasProps(schema.properties); + aliasProps(schema.patternProperties); + aliasProps(schema.additionalProperties); + aliasProps(schema.items); + aliasProps(schema.additionalItems); + aliasProps(schema.oneOf); + aliasProps(schema.anyOf); + aliasProps(schema.allOf); + aliasProps(schema.not); +} - if (snippet) { - where += ':\n' + snippet; +function aliasProps(obj) { + for (const key in obj) { + const prop = obj[key]; + + if (prop.xml !== undefined) { + prop['x-xml'] = prop.xml; + delete prop.xml; } + + iterateSchema(obj[key]); } +} - return where; -}; +function getMimeTypes() { + return [ + 'application/vnd.oai.openapi;version=3.0.0', + 'application/vnd.oai.openapi+json;version=3.0.0', + 'application/vnd.oai.openapi+yaml;version=3.0.0', + ]; +} +/***/ }), -module.exports = Mark; +/***/ 69162: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +const Ajv = __webpack_require__(64941); +const ParserError = __webpack_require__(21978); +const asyncapi = __webpack_require__(78100); +const { improveAjvErrors } = __webpack_require__(12065); -/***/ }), -/* 181 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +module.exports = { + parse, + getMimeTypes +}; -"use strict"; +/** + * @private + */ +async function parse({ message, originalAsyncAPIDocument, fileFormat, parsedAsyncAPIDocument, pathToPayload }) { + const payload = message.payload; + if (!payload) return; + + const ajv = new Ajv({ + jsonPointers: true, + allErrors: true, + schemaId: 'id', + logger: false, + }); + const payloadSchema = preparePayloadSchema(asyncapi[parsedAsyncAPIDocument.asyncapi]); + const validate = ajv.compile(payloadSchema); + const valid = validate(payload); + + if (!valid) throw new ParserError({ + type: 'schema-validation-errors', + title: 'This is not a valid AsyncAPI Schema Object.', + parsedJSON: parsedAsyncAPIDocument, + validationErrors: improveAjvErrors(addFullPathToDataPath(validate.errors, pathToPayload), originalAsyncAPIDocument, fileFormat), + }); +} -Object.defineProperty(exports, "__esModule", { value: true }); -const extend_error_1 = __webpack_require__(196); -const normalize_1 = __webpack_require__(661); -const to_json_1 = __webpack_require__(648); -const constructor = Ono; -exports.Ono = constructor; /** - * Returns an object containing all properties of the given Error object, - * which can be used with `JSON.stringify()`. + * @private */ -Ono.toJSON = function toJSON(error) { - return to_json_1.toJSON.call(error); -}; +function getMimeTypes() { + return [ + 'application/vnd.aai.asyncapi;version=2.0.0', + 'application/vnd.aai.asyncapi+json;version=2.0.0', + 'application/vnd.aai.asyncapi+yaml;version=2.0.0', + 'application/schema;version=draft-07', + 'application/schema+json;version=draft-07', + 'application/schema+yaml;version=draft-07', + ]; +} + /** - * Creates an `Ono` instance for a specifc error type. + * To validate schema of the payload we just need a small portion of official AsyncAPI spec JSON Schema, the definition of the schema must be + * a main part of the JSON Schema + * + * @private + * @param {Object} asyncapiSchema AsyncAPI specification JSON Schema + * @returns {Object} valid JSON Schema document describing format of AsyncAPI-valid schema for message payload */ -// tslint:disable-next-line: variable-name -function Ono(ErrorConstructor, options) { - options = normalize_1.normalizeOptions(options); - function ono(...args) { - let { originalError, props, message } = normalize_1.normalizeArgs(args, options); - // Create a new error of the specified type - let newError = new ErrorConstructor(message); - // Extend the error with the properties of the original error and the `props` object - extend_error_1.extendError(newError, originalError, props); - return newError; +function preparePayloadSchema(asyncapiSchema) { + return { + $ref: '#/definitions/schema', + definitions: asyncapiSchema.definitions + }; +} + +/** + * Errors from Ajv contain dataPath information about parameter relative to parsed payload message. + * This function enriches dataPath with additional information on where is the parameter located in AsyncAPI document + * + * @private + * @param {Array} errors Ajv errors + * @param {String} path Path to location of the payload schema in AsyncAPI Document + * @returns {Array} same object as received in input but with modified datePath property so it contain full path relative to AsyncAPI document + */ +function addFullPathToDataPath(errors, path) { + return errors.map((err) => ({ + ...err, + ...{ + dataPath: `${path}${err.dataPath}` } - ono[Symbol.species] = ErrorConstructor; - return ono; + })); } -//# sourceMappingURL=constructor.js.map + + /***/ }), -/* 182 */, -/* 183 */ -/***/ (function(module) { -"use strict"; +/***/ 10254: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate__limitItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; +const ParserError = __webpack_require__(21978); +const { parseUrlVariables, getMissingProps, groupValidationErrors, tilde, parseUrlQueryParameters, setNotProvidedParams } = __webpack_require__(12065); +const validationError = 'validation-errors'; + +/** + * Validates if variables provided in the url have corresponding variable object defined + * @private + * @param {Object} parsedJSON parsed AsyncAPI document + * @param {String} asyncapiYAMLorJSON AsyncAPI document in string + * @param {String} initialFormat information of the document was oryginally JSON or YAML + * @returns {Boolean} true in case the document is valid, otherwise throws ParserError + */ +function validateServerVariables(parsedJSON, asyncapiYAMLorJSON, initialFormat) { + const srvs = parsedJSON.servers; + if (!srvs) return true; + + const srvsMap = new Map(Object.entries(srvs)); + const notProvidedVariables = new Map(); + + srvsMap.forEach((val, key) => { + const variables = parseUrlVariables(val.url); + const notProvidedServerVars = notProvidedVariables.get(tilde(key)); + if (!variables) return; + + const missingServerVariables = getMissingProps(variables, val.variables); + if (!missingServerVariables.length) return; + + notProvidedVariables.set(tilde(key), + notProvidedServerVars + ? notProvidedServerVars.concat(missingServerVariables) + : missingServerVariables); + }); + + if (notProvidedVariables.size) { + throw new ParserError({ + type: validationError, + title: 'Not all server variables are described with variable object', + parsedJSON, + validationErrors: groupValidationErrors('servers', 'server does not have a corresponding variable object for', notProvidedVariables, asyncapiYAMLorJSON, initialFormat) + }); } - var $op = $keyword == 'maxItems' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + + return true; +} + +/** + * Validates if operationIds are duplicated in the document + * + * @private + * @param {Object} parsedJSON parsed AsyncAPI document + * @param {String} asyncapiYAMLorJSON AsyncAPI document in string + * @param {String} initialFormat information of the document was oryginally JSON or YAML + * @returns {Boolean} true in case the document is valid, otherwise throws ParserError + */ +function validateOperationId(parsedJSON, asyncapiYAMLorJSON, initialFormat, operations) { + const chnls = parsedJSON.channels; + if (!chnls) return true; + const chnlsMap = new Map(Object.entries(chnls)); + //it is a map of paths, the one that is a duplicate and the one that is duplicated + const duplicatedOperations = new Map(); + //is is a 2-dimentional array that holds information with operationId value and its path + const allOperations = []; + + const addDuplicateToMap = (op, channelName, opName) => { + const operationId = op.operationId; + if (!operationId) return; + + const operationPath = `${tilde(channelName)}/${opName}/operationId`; + const isOperationIdDuplicated = allOperations.filter(v => v[0] === operationId); + if (!isOperationIdDuplicated.length) return allOperations.push([operationId, operationPath]); + + //isOperationIdDuplicated always holds one record and it is an array of paths, the one that is a duplicate and the one that is duplicated + duplicatedOperations.set(operationPath, isOperationIdDuplicated[0][1]); + }; + + chnlsMap.forEach((chnlObj, chnlName) => { + operations.forEach(opName => { + const op = chnlObj[String(opName)]; + if (op) addDuplicateToMap(op, chnlName, opName); + }); + }); + + if (duplicatedOperations.size) { + throw new ParserError({ + type: validationError, + title: 'operationId must be unique across all the operations.', + parsedJSON, + validationErrors: groupValidationErrors('channels', 'is a duplicate of', duplicatedOperations, asyncapiYAMLorJSON, initialFormat) + }); } - out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxItems') { - out += 'more'; - } else { - out += 'less'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; + + return true; +} + +/** + * Validates if server security is declared properly and the name has a corresponding security schema definition in components with the same name + * + * @private + * @param {Object} parsedJSON parsed AsyncAPI document + * @param {String} asyncapiYAMLorJSON AsyncAPI document in string + * @param {String} initialFormat information of the document was oryginally JSON or YAML + * @param {String[]} specialSecTypes list of security types that can have data in array + * @returns {Boolean} true in case the document is valid, otherwise throws ParserError + */ +function validateServerSecurity(parsedJSON, asyncapiYAMLorJSON, initialFormat, specialSecTypes) { + const srvs = parsedJSON.servers; + if (!srvs) return true; + + const root = 'servers'; + const srvsMap = new Map(Object.entries(srvs)); + + const missingSecSchema = new Map(), + invalidSecurityValues = new Map(); + + //we need to validate every server specified in the document + srvsMap.forEach((server, serverName) => { + const serverSecInfo = server.security; + + if (!serverSecInfo) return true; + + //server security info is an array of many possible values + serverSecInfo.forEach(secObj => { + Object.keys(secObj).forEach(secName => { + //security schema is located in components object, we need to find if there is security schema with the same name as the server security info object + const schema = findSecuritySchema(secName, parsedJSON.components); + const srvrSecurityPath = `${serverName}/security/${secName}`; + + if (!schema.length) return missingSecSchema.set(srvrSecurityPath); + + //findSecuritySchema returns type always on index 1. Type is needed further to validate if server security info can be or not an empty array + const schemaType = schema[1]; + if (!isSrvrSecProperArray(schemaType, specialSecTypes, secObj, secName)) invalidSecurityValues.set(srvrSecurityPath, schemaType); + }); + }); + }); + + if (missingSecSchema.size) { + throw new ParserError({ + type: validationError, + title: 'Server security name must correspond to a security scheme which is declared in the security schemes under the components object.', + parsedJSON, + validationErrors: groupValidationErrors(root, 'doesn\'t have a corresponding security schema under the components object', missingSecSchema, asyncapiYAMLorJSON, initialFormat) + }); } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; + + if (invalidSecurityValues.size) { + throw new ParserError({ + type: validationError, + title: 'Server security value must be an empty array if corresponding security schema type is not oauth2 or openIdConnect.', + parsedJSON, + validationErrors: groupValidationErrors(root, 'security info must have an empty array because its corresponding security schema type is', invalidSecurityValues, asyncapiYAMLorJSON, initialFormat) + }); + } + + return true; +} + +/** + * Searches for server security corresponding object in security schema object + * @private + * @param {String} securityName name of the server security element that you want to localize in the security schema object + * @param {Object} components components object from the AsyncAPI document + * @returns {String[]} there are 2 elements in array, index 0 is the name of the security schema object and index 1 is it's type + */ +function findSecuritySchema(securityName, components) { + const secSchemes = components && components.securitySchemes; + const secSchemesMap = secSchemes ? new Map(Object.entries(secSchemes)) : new Map(); + const schemaInfo = []; + + //using for loop here as there is no point to iterate over all entries as it is enough to find first matching element + for (const [schemaName, schema] of secSchemesMap.entries()) { + if (schemaName === securityName) { + schemaInfo.push(schemaName, schema.type); + return schemaInfo; } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; } - out += '} '; - if ($breakOnError) { - out += ' else { '; + return schemaInfo; +} + +/** + * Validates if given server security is a proper empty array when security type requires it + * @private + * @param {String} schemaType security type, like httpApiKey or userPassword + * @param {String[]} specialSecTypes list of special types that do not have to be an empty array + * @param {Object} secObj server security object + * @param {String} secName name os server security object + * @returns {String[]} there are 2 elements in array, index 0 is the name of the security schema object and index 1 is it's type + */ +function isSrvrSecProperArray(schemaType, specialSecTypes, secObj, secName) { + if (!specialSecTypes.includes(schemaType)) { + const securityObjValue = secObj[String(secName)]; + + return !securityObjValue.length; } - return out; + + return true; +} + +/** + * Validates if parameters specified in the channel have corresponding parameters object defined and if name does not contain url parameters + * + * @private + * @param {Object} parsedJSON parsed AsyncAPI document + * @param {String} asyncapiYAMLorJSON AsyncAPI document in string + * @param {String} initialFormat information of the document was oryginally JSON or YAML + * @returns {Boolean} true in case the document is valid, otherwise throws ParserError + */ +function validateChannels(parsedJSON, asyncapiYAMLorJSON, initialFormat) { + const chnls = parsedJSON.channels; + if (!chnls) return true; + + const chnlsMap = new Map(Object.entries(chnls)); + const notProvidedParams = new Map(); //return object for missing parameters + const invalidChannelName = new Map(); //return object for invalid channel names with query parameters + + chnlsMap.forEach((val, key) => { + const variables = parseUrlVariables(key); + const notProvidedChannelParams = notProvidedParams.get(tilde(key)); + const queryParameters = parseUrlQueryParameters(key); + + //channel variable validation: fill return obeject with missing parameters + if (variables) { + setNotProvidedParams(variables, val, key, notProvidedChannelParams, notProvidedParams); + } + + //channel name validation: fill return object with channels containing query parameters + if (queryParameters) { + invalidChannelName.set(tilde(key), + queryParameters); + } + }); + + //combine validation errors of both checks and output them as one array + const parameterValidationErrors = groupValidationErrors('channels', 'channel does not have a corresponding parameter object for', notProvidedParams, asyncapiYAMLorJSON, initialFormat); + const nameValidationErrors = groupValidationErrors('channels', 'channel contains invalid name with url query parameters', invalidChannelName, asyncapiYAMLorJSON, initialFormat); + const allValidationErrors = parameterValidationErrors.concat(nameValidationErrors); + + //channel variable validation: throw exception if channel validation failes + if (notProvidedParams.size || invalidChannelName.size) { + throw new ParserError({ + type: validationError, + title: 'Channel validation failed', + parsedJSON, + validationErrors: allValidationErrors + }); + } + + return true; } +module.exports = { + validateServerVariables, + validateOperationId, + validateServerSecurity, + validateChannels +}; + /***/ }), -/* 184 */, -/* 185 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -const Operation = __webpack_require__(573); +/***/ 21978: +/***/ ((module) => { + +const ERROR_URL_PREFIX = 'https://github.com/asyncapi/parser-js/'; + +const buildError = (from, to) => { + to.type = from.type.startsWith(ERROR_URL_PREFIX) ? from.type : `${ERROR_URL_PREFIX}${from.type}`; + to.title = from.title; + if (from.detail) to.detail = from.detail; + if (from.validationErrors) to.validationErrors = from.validationErrors; + if (from.parsedJSON) to.parsedJSON = from.parsedJSON; + if (from.location) to.location = from.location; + if (from.refs) to.refs = from.refs; + return to; +}; /** - * Implements functions to deal with a PublishOperation object. - * @class - * @extends Operation - * @returns {PublishOperation} + * Represents an error while trying to parse an AsyncAPI document. + * @alias module:@asyncapi/parser#ParserError + * @extends Error */ -class PublishOperation extends Operation { - /** - * @returns {boolean} - */ - isPublish() { - return true; - } - +class ParserError extends Error { /** - * @returns {boolean} + * Instantiates an error + * @param {Object} definition + * @param {String} definition.type The type of the error. + * @param {String} definition.title The message of the error. + * @param {String} [definition.detail] A string containing more detailed information about the error. + * @param {Object} [definition.parsedJSON] The resulting JSON after YAML transformation. Or the JSON object if the this was the initial format. + * @param {Object[]} [definition.validationErrors] The errors resulting from the validation. For more information, see https://www.npmjs.com/package/better-ajv-errors. + * @param {String} definition.validationErrors.title A validation error message. + * @param {String} definition.validationErrors.jsonPointer The path to the field that contains the error. Uses JSON Pointer format. + * @param {Number} definition.validationErrors.startLine The line where the error starts in the AsyncAPI document. + * @param {Number} definition.validationErrors.startColumn The column where the error starts in the AsyncAPI document. + * @param {Number} definition.validationErrors.startOffset The offset (starting from the beginning of the document) where the error starts in the AsyncAPI document. + * @param {Number} definition.validationErrors.endLine The line where the error ends in the AsyncAPI document. + * @param {Number} definition.validationErrors.endColumn The column where the error ends in the AsyncAPI document. + * @param {Number} definition.validationErrors.endOffset The offset (starting from the beginning of the document) where the error ends in the AsyncAPI document. + * @param {Object} [definition.location] Error location details after trying to parse an invalid JSON or YAML document. + * @param {Number} definition.location.startLine The line of the YAML/JSON document where the error starts. + * @param {Number} definition.location.startColumn The column of the YAML/JSON document where the error starts. + * @param {Number} definition.location.startOffset The offset (starting from the beginning of the document) where the error starts in the YAML/JSON AsyncAPI document. + * @param {Object[]} [definition.refs] Error details after trying to resolve $ref's. + * @param {String} definition.refs.title A validation error message. + * @param {String} definition.refs.jsonPointer The path to the field that contains the error. Uses JSON Pointer format. + * @param {Number} definition.refs.startLine The line where the error starts in the AsyncAPI document. + * @param {Number} definition.refs.startColumn The column where the error starts in the AsyncAPI document. + * @param {Number} definition.refs.startOffset The offset (starting from the beginning of the document) where the error starts in the AsyncAPI document. + * @param {Number} definition.refs.endLine The line where the error ends in the AsyncAPI document. + * @param {Number} definition.refs.endColumn The column where the error ends in the AsyncAPI document. + * @param {Number} definition.refs.endOffset The offset (starting from the beginning of the document) where the error ends in the AsyncAPI document. */ - isSubscribe() { - return false; + constructor(def) { + super(); + buildError(def, this); + this.message = def.title; } /** - * @returns {string} + * Returns a JS object representation of the error. */ - kind() { - return 'publish'; + toJS() { + return buildError(this, {}); } } -module.exports = PublishOperation; +module.exports = ParserError; /***/ }), -/* 186 */, -/* 187 */, -/* 188 */ -/***/ (function(module) { -"use strict"; +/***/ 44479: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate_not(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - if (it.util.schemaHasRules($schema, it.RULES.all)) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.createErrors = false; - var $allErrorsOption; - if ($it.opts.allErrors) { - $allErrorsOption = $it.opts.allErrors; - $it.opts.allErrors = false; - } - out += ' ' + (it.validate($it)) + ' '; - $it.createErrors = true; - if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (' + ($nextValid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } +const parser = __webpack_require__(32720); +const defaultAsyncAPISchemaParser = __webpack_require__(69162); + +parser.registerSchemaParser(defaultAsyncAPISchemaParser); + +module.exports = parser; + + +/***/ }), + +/***/ 78280: +/***/ ((module) => { + +module.exports = (txt, reviver, context = 20) => { + try { + return JSON.parse(txt, reviver); + } catch (e) { + handleJsonNotString(txt); + const syntaxErr = e.message.match(/^Unexpected token.*position\s+(\d+)/i); + const errIdxBrokenJson = e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 : null; + const errIdx = syntaxErr ? +syntaxErr[1] : errIdxBrokenJson; + handleErrIdxNotNull(e, txt, errIdx, context); + e.offset = errIdx; + const lines = txt.substr(0, errIdx).split('\n'); + e.startLine = lines.length; + e.startColumn = lines[lines.length - 1].length; + throw e; + } +}; + +function handleJsonNotString(txt) { + if (typeof txt !== 'string') { + const isEmptyArray = Array.isArray(txt) && txt.length === 0; + const errorMessage = `Cannot parse ${ + isEmptyArray ? 'an empty array' : String(txt)}`; + throw new TypeError(errorMessage); + } +} + +function handleErrIdxNotNull(e, txt, errIdx, context) { + if (errIdx !== null) { + const start = errIdx <= context + ? 0 + : errIdx - context; + const end = errIdx + context >= txt.length + ? txt.length + : errIdx + context; + e.message += ` while parsing near '${ + start === 0 ? '' : '...' + }${txt.slice(start, end)}${ + end === txt.length ? '' : '...' + }'`; } else { - out += ' var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if ($breakOnError) { - out += ' if (false) { '; - } + e.message += ` while parsing '${txt.slice(0, context * 2)}'`; } - return out; } /***/ }), -/* 189 */, -/* 190 */ -/***/ (function(module) { -"use strict"; +/***/ 58052: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate__limitProperties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $op = $keyword == 'maxProperties' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxProperties') { - out += 'more'; - } else { - out += 'less'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' properties\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - - -/***/ }), -/* 191 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +const { getMapValueByKey } = __webpack_require__(12065); -// Adapted from work by jorge@jorgechamorro.com on 2010-11-25 -(function () { - "use strict"; +/** + * Implements functions to deal with the common Bindings object. + * @mixin + */ +const MixinBindings = { + /** + * @returns {boolean} + */ + hasBindings() { + return !!(this._json.bindings && Object.keys(this._json.bindings).length); + }, - function noop() {} + /** + * @returns {Object} + */ + bindings() { + return this.hasBindings() ? this._json.bindings : {}; + }, - var fs = __webpack_require__(747) - , forEachAsync = __webpack_require__(724).forEachAsync - , EventEmitter = __webpack_require__(614).EventEmitter - , TypeEmitter = __webpack_require__(381) - , util = __webpack_require__(669) - , path = __webpack_require__(622) - ; + /** + * @returns {string[]} + */ + bindingProtocols() { + return Object.keys(this.bindings()); + }, - function appendToDirs(stat) { - /*jshint validthis:true*/ - if(stat.flag && stat.flag === NO_DESCEND) { return; } - this.push(stat.name); - } + /** + * @param {string} name - Name of the binding. + * @returns {boolean} + */ + hasBinding(name) { + return this.hasBindings() && !!this._json.bindings[String(name)]; + }, - function wFilesHandlerWrapper(items) { - /*jshint validthis:true*/ - this._wFilesHandler(noop, items); - } + /** + * @param {string} name - Name of the binding. + * @returns {(Object | null)} + */ + binding(name) { + return getMapValueByKey(this._json.bindings, name); + }, +}; - function Walker(pathname, options, sync) { - EventEmitter.call(this); +module.exports = MixinBindings; - var me = this - ; - options = options || {}; - me._wStat = options.followLinks && 'stat' || 'lstat'; - me._wStatSync = me._wStat + 'Sync'; - me._wsync = sync; - me._wq = []; - me._wqueue = [me._wq]; - me._wcurpath = undefined; - me._wfilters = options.filters || []; - me._wfirstrun = true; - me._wcurpath = pathname; +/***/ }), - if (me._wsync) { - //console.log('_walkSync'); - me._wWalk = me._wWalkSync; - } else { - //console.log('_walkASync'); - me._wWalk = me._wWalkAsync; - } +/***/ 13518: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - options.listeners = options.listeners || {}; - Object.keys(options.listeners).forEach(function (event) { - var callbacks = options.listeners[event] - ; +const { getMapValueByKey } = __webpack_require__(12065); - if ('function' === typeof callbacks) { - callbacks = [callbacks]; - } +/** + * Implements functions to deal with the description field. + * @mixin + */ +const MixinDescription = { + /** + * @returns {boolean} + */ + hasDescription() { + return !!this._json.description; + }, - callbacks.forEach(function (callback) { - me.on(event, callback); - }); - }); + /** + * @returns {(string | null)} + */ + description() { + return getMapValueByKey(this._json, 'description'); + }, +}; - me._wWalk(); - } +module.exports = MixinDescription; - // Inherits must come before prototype additions - util.inherits(Walker, EventEmitter); - Walker.prototype._wLstatHandler = function (err, stat) { - var me = this - ; +/***/ }), - stat = stat || {}; - stat.name = me._wcurfile; +/***/ 44001: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (err) { - stat.error = err; - //me.emit('error', curpath, stat); - // TODO v3.0 (don't noop the next if there are listeners) - me.emit('nodeError', me._wcurpath, stat, noop); - me._wfnodegroups.errors.push(stat); - me._wCurFileCallback(); - } else { - TypeEmitter.sortFnodesByType(stat, me._wfnodegroups); - // NOTE: wCurFileCallback doesn't need thisness, so this is okay - TypeEmitter.emitNodeType(me, me._wcurpath, stat, me._wCurFileCallback, me); - } - }; - Walker.prototype._wFilesHandler = function (cont, file) { - var statPath - , me = this - ; +const { getMapValueOfType } = __webpack_require__(12065); +const ExternalDocs = __webpack_require__(89147); - me._wcurfile = file; - me._wCurFileCallback = cont; - me.emit('name', me._wcurpath, file, noop); +/** + * Implements functions to deal with the ExternalDocs object. + * @mixin + */ +const MixinExternalDocs = { + /** + * @returns {boolean} + */ + hasExternalDocs() { + return !!(this._json.externalDocs && Object.keys(this._json.externalDocs).length); + }, - statPath = me._wcurpath + path.sep + file; + /** + * @returns {(ExternalDocs | null)} + */ + externalDocs() { + return getMapValueOfType(this._json, 'externalDocs', ExternalDocs); + }, +}; - if (!me._wsync) { - // TODO how to remove this anony? - fs[me._wStat](statPath, function (err, stat) { - me._wLstatHandler(err, stat); - }); - return; - } +module.exports = MixinExternalDocs; - try { - me._wLstatHandler(null, fs[me._wStatSync](statPath)); - } catch(e) { - me._wLstatHandler(e); - } - }; - Walker.prototype._wOnEmitDone = function () { - var me = this - , dirs = [] - ; - me._wfnodegroups.directories.forEach(appendToDirs, dirs); - dirs.forEach(me._wJoinPath, me); - me._wqueue.push(me._wq = dirs); - me._wNext(); - }; - Walker.prototype._wPostFilesHandler = function () { - var me = this - ; +/***/ }), - if (me._wfnodegroups.errors.length) { - // TODO v3.0 (don't noop the next) - // .errors is an array of stats with { name: name, error: error } - me.emit('errors', me._wcurpath, me._wfnodegroups.errors, noop); - } - // XXX emitNodeTypes still needs refactor - TypeEmitter.emitNodeTypeGroups(me, me._wcurpath, me._wfnodegroups, me._wOnEmitDone, me); - }; - Walker.prototype._wReadFiles = function () { - var me = this - ; +/***/ 25999: +/***/ ((module) => { - if (!me._wcurfiles || 0 === me._wcurfiles.length) { - return me._wNext(); - } +/** + * Implements functions to deal with the SpecificationExtensions object. + * @mixin + */ +const MixinSpecificationExtensions = { + /** + * @returns {boolean} + */ + hasExtensions() { + return !!this.extensionKeys().length; + }, - // TODO could allow user to selectively stat - // and don't stat if there are no stat listeners - me.emit('names', me._wcurpath, me._wcurfiles, noop); + /** + * @returns {Object} + */ + extensions() { + const result = {}; + Object.entries(this._json).forEach(([key, value]) => { + if ((/^x-[\w\d\.\-\_]+$/).test(key)) { + result[String(key)] = value; + } + }); + return result; + }, - if (me._wsync) { - me._wcurfiles.forEach(wFilesHandlerWrapper, me); - me._wPostFilesHandler(); - } else { - forEachAsync(me._wcurfiles, me._wFilesHandler, me).then(me._wPostFilesHandler); - } - }; - Walker.prototype._wReaddirHandler = function (err, files) { - var fnodeGroups = TypeEmitter.createNodeGroups() - , me = this - , parent - , child - ; + /** + * @returns {string[]} + */ + extensionKeys() { + return Object.keys(this.extensions()); + }, - me._wfnodegroups = fnodeGroups; - me._wcurfiles = files; + /** + * @returns {string[]} + */ + extKeys() { + return this.extensionKeys(); + }, - // no error, great - if (!err) { - me._wReadFiles(); - return; + /** + * @param {string} key - Extension key. + * @returns {boolean} + */ + hasExtension(key) { + if (!key.startsWith('x-')) { + return false; } + return !!this._json[String(key)]; + }, - // TODO path.sep - me._wcurpath = me._wcurpath.replace(/\/$/, ''); - - // error? not first run? => directory error - if (!me._wfirstrun) { - // TODO v3.0 (don't noop the next if there are listeners) - me.emit('directoryError', me._wcurpath, { error: err }, noop); - // TODO v3.0 - //me.emit('directoryError', me._wcurpath.replace(/^(.*)\/.*$/, '$1'), { name: me._wcurpath.replace(/^.*\/(.*)/, '$1'), error: err }, noop); - me._wReadFiles(); - return; + /** + * @param {string} key - Extension key. + * @returns {any} + */ + extension(key) { + if (!key.startsWith('x-')) { + return null; } + return this._json[String(key)]; + }, - // error? first run? => maybe a file, maybe a true error - me._wfirstrun = false; - - // readdir failed (might be a file), try a stat on the parent - parent = me._wcurpath.replace(/^(.*)\/.*$/, '$1'); - fs[me._wStat](parent, function (e, stat) { + /** + * @param {string} key - Extension key. + * @returns {boolean} + */ + hasExt(key) { + return this.hasExtension(key); + }, - if (stat) { - // success - // now try stat on this as a child of the parent directory - child = me._wcurpath.replace(/^.*\/(.*)$/, '$1'); - me._wcurfiles = [child]; - me._wcurpath = parent; - } else { - // TODO v3.0 - //me.emit('directoryError', me._wcurpath.replace(/^(.*)\/.*$/, '$1'), { name: me._wcurpath.replace(/^.*\/(.*)/, '$1'), error: err }, noop); - // TODO v3.0 (don't noop the next) - // the original readdir error, not the parent stat error - me.emit('nodeError', me._wcurpath, { error: err }, noop); - } + /** + * @param {string} key - Extension key. + * @returns {any} + */ + ext(key) { + return this.extension(key); + }, +}; - me._wReadFiles(); - }); - }; - Walker.prototype._wFilter = function () { - var me = this - , exclude - ; +module.exports = MixinSpecificationExtensions; - // Stop directories that contain filter keywords - // from continuing through the walk process - exclude = me._wfilters.some(function (filter) { - if (me._wcurpath.match(filter)) { - return true; - } - }); - return exclude; - }; - Walker.prototype._wWalkSync = function () { - //console.log('walkSync'); - var err - , files - , me = this - ; +/***/ }), - try { - files = fs.readdirSync(me._wcurpath); - } catch(e) { - err = e; - } +/***/ 74301: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - me._wReaddirHandler(err, files); - }; - Walker.prototype._wWalkAsync = function () { - //console.log('walkAsync'); - var me = this - ; +const Tag = __webpack_require__(71238); - // TODO how to remove this anony? - fs.readdir(me._wcurpath, function (err, files) { - me._wReaddirHandler(err, files); - }); - }; - Walker.prototype._wNext = function () { - var me = this - ; +/** + * Implements functions to deal with the Tags object. + * @mixin + */ +const MixinTags = { + /** + * @returns {boolean} + */ + hasTags() { + return !!(Array.isArray(this._json.tags) && this._json.tags.length); + }, - if (me._paused) { - return; - } - if (me._wq.length) { - me._wcurpath = me._wq.pop(); - while (me._wq.length && me._wFilter()) { - me._wcurpath = me._wq.pop(); - } - if (me._wcurpath && !me._wFilter()) { - me._wWalk(); - } else { - me._wNext(); - } - return; - } - me._wqueue.length -= 1; - if (me._wqueue.length) { - me._wq = me._wqueue[me._wqueue.length - 1]; - return me._wNext(); - } + /** + * @returns {Tag[]} + */ + tags() { + return this.hasTags() ? this._json.tags.map(t => new Tag(t)) : []; + }, - // To not break compatibility - //process.nextTick(function () { - me.emit('end'); - //}); - }; - Walker.prototype._wJoinPath = function (v, i, o) { - var me = this - ; + /** + * @returns {string[]} + */ + tagNames() { + return this.hasTags() ? this._json.tags.map(t => t.name) : []; + }, - o[i] = [me._wcurpath, path.sep, v].join(''); - }; - Walker.prototype.pause = function () { - this._paused = true; - }; - Walker.prototype.resume = function () { - this._paused = false; - this._wNext(); - }; + /** + * @param {string} name - Name of the tag. + * @returns {boolean} + */ + hasTag(name) { + return this.hasTags() && this._json.tags.some(t => t.name === name); + }, - exports.walk = function (path, opts) { - return new Walker(path, opts, false); - }; + /** + * @param {string} name - Name of the tag. + * @returns {(Tag | null)} + */ + tag(name) { + const tg = this.hasTags() && this._json.tags.find(t => t.name === name); + return tg ? new Tag(tg) : null; + }, +}; - exports.walkSync = function (path, opts) { - return new Walker(path, opts, true); - }; -}()); +module.exports = MixinTags; /***/ }), -/* 192 */, -/* 193 */, -/* 194 */ -/***/ (function(module) { - -"use strict"; +/***/ 41527: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var isArray = Array.isArray; -var keyList = Object.keys; -var hasProp = Object.prototype.hasOwnProperty; +const { createMapOfType, getMapValueOfType, mix } = __webpack_require__(12065); -module.exports = function equal(a, b) { - if (a === b) return true; +const Base = __webpack_require__(69281); +const Info = __webpack_require__(72420); +const Server = __webpack_require__(27549); +const Channel = __webpack_require__(50342); +const Components = __webpack_require__(14396); - if (a && b && typeof a == 'object' && typeof b == 'object') { - var arrA = isArray(a) - , arrB = isArray(b) - , i - , length - , key; +const MixinExternalDocs = __webpack_require__(44001); +const MixinTags = __webpack_require__(74301); +const MixinSpecificationExtensions = __webpack_require__(25999); - if (arrA && arrB) { - length = a.length; - if (length != b.length) return false; - for (i = length; i-- !== 0;) - if (!equal(a[i], b[i])) return false; - return true; - } +const xParserMessageName = 'x-parser-message-name'; +const xParserSchemaId = 'x-parser-schema-id'; +const xParserCircle = 'x-parser-circular'; +const xParserCircleProps = 'x-parser-circular-props'; - if (arrA != arrB) return false; +/** + * Implements functions to deal with the AsyncAPI document. + * @class + * @alias module:@asyncapi/parser#AsyncAPIDocument + * @extends Base + * @mixes MixinTags + * @mixes MixinExternalDocs + * @mixes MixinSpecificationExtensions + * @returns {AsyncAPIDocument} + */ +class AsyncAPIDocument extends Base { + constructor(...args) { + super(...args); - var dateA = a instanceof Date - , dateB = b instanceof Date; - if (dateA != dateB) return false; - if (dateA && dateB) return a.getTime() == b.getTime(); + assignNameToAnonymousMessages(this); + assignNameToComponentMessages(this); - var regexpA = a instanceof RegExp - , regexpB = b instanceof RegExp; - if (regexpA != regexpB) return false; - if (regexpA && regexpB) return a.toString() == b.toString(); + assignUidToComponentSchemas(this); + assignUidToParameterSchemas(this); + assignIdToAnonymousSchemas(this); + } - var keys = keyList(a); - length = keys.length; + /** + * @returns {string} + */ + version() { + return this._json.asyncapi; + } - if (length !== keyList(b).length) - return false; + /** + * @returns {Info} + */ + info() { + return new Info(this._json.info); + } - for (i = length; i-- !== 0;) - if (!hasProp.call(b, keys[i])) return false; + /** + * @returns {string} + */ + id() { + return this._json.id; + } - for (i = length; i-- !== 0;) { - key = keys[i]; - if (!equal(a[key], b[key])) return false; - } + /** + * @returns {boolean} + */ + hasServers() { + return !!this._json.servers; + } - return true; + /** + * @returns {Object} + */ + servers() { + return createMapOfType(this._json.servers, Server); } - return a!==a && b!==b; -}; + /** + * @param {string} name - Name of the server. + * @returns {Server} + */ + server(name) { + return getMapValueOfType(this._json.servers, name, Server); + } + /** + * @returns {boolean} + */ + hasChannels() { + return !!this._json.channels; + } -/***/ }), -/* 195 */, -/* 196 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { + /** + * @returns {Object} + */ + channels() { + return createMapOfType(this._json.channels, Channel, this); + } -"use strict"; + /** + * @returns {string[]} + */ + channelNames() { + if (!this._json.channels) return []; + return Object.keys(this._json.channels); + } -Object.defineProperty(exports, "__esModule", { value: true }); -const isomorphic_node_1 = __webpack_require__(665); -const stack_1 = __webpack_require__(21); -const to_json_1 = __webpack_require__(648); -const protectedProps = ["name", "message", "stack"]; -/** - * Extends the new error with the properties of the original error and the `props` object. - * - * @param newError - The error object to extend - * @param originalError - The original error object, if any - * @param props - Additional properties to add, if any - */ -function extendError(newError, originalError, props) { - extendStack(newError, originalError); - // Copy properties from the original error - if (originalError && typeof originalError === "object") { - mergeErrors(newError, originalError); + /** + * @param {string} name - Name of the channel. + * @returns {Channel} + */ + channel(name) { + return getMapValueOfType(this._json.channels, name, Channel, this); + } + + /** + * @returns {string} + */ + defaultContentType() { + return this._json.defaultContentType || null; + } + + /** + * @returns {boolean} + */ + hasComponents() { + return !!this._json.components; + } + + /** + * @returns {Components} + */ + components() { + if (!this._json.components) return null; + return new Components(this._json.components); + } + + /** + * @returns {boolean} + */ + hasMessages() { + return !!this.allMessages().size; + } + + /** + * @returns {Map} + */ + allMessages() { + const messages = new Map(); + + if (this.hasChannels()) { + this.channelNames().forEach(channelName => { + const channel = this.channel(channelName); + if (channel.hasPublish()) { + channel.publish().messages().forEach(m => { + messages.set(m.uid(), m); + }); + } + if (channel.hasSubscribe()) { + channel.subscribe().messages().forEach(m => { + messages.set(m.uid(), m); + }); + } + }); } - // The default `toJSON` method doesn't output props like `name`, `message`, `stack`, etc. - // So replace it with one that outputs every property of the error. - newError.toJSON = to_json_1.toJSON; - // On Node.js, add support for the `util.inspect()` method - if (isomorphic_node_1.addInspectMethod) { - isomorphic_node_1.addInspectMethod(newError); + + if (this.hasComponents()) { + Object.values(this.components().messages()).forEach(m => { + messages.set(m.uid(), m); + }); } - // Finally, copy custom properties that were specified by the user. - // These props OVERWRITE any previous props - if (props && typeof props === "object") { - Object.assign(newError, props); + + return messages; + } + + /** + * @returns {Map} + */ + allSchemas() { + const schemas = new Map(); + const callback = (schema) => { + if (schema.uid()) { + schemas.set(schema.uid(), schema); + } + }; + schemaDocument(this, callback); + if (this.hasComponents()) { + Object.values(this.components().schemas()).forEach(s => { + recursiveSchema(s, callback); + }); } + + return schemas; + } + + /** + * @returns {boolean} + */ + hasCircular() { + return !!this._json[String(xParserCircle)]; + } } -exports.extendError = extendError; + /** - * Extend the error stack to include its cause + * Assign message keys as message name to all the component messages. + * + * @private + * @param {AsyncAPIDocument} doc */ -function extendStack(newError, originalError) { - let stackProp = Object.getOwnPropertyDescriptor(newError, "stack"); - if (stack_1.isLazyStack(stackProp)) { - stack_1.lazyJoinStacks(stackProp, newError, originalError); - } - else if (stack_1.isWritableStack(stackProp)) { - newError.stack = stack_1.joinStacks(newError, originalError); +function assignNameToComponentMessages(doc) { + if (doc.hasComponents()) { + for (const [key, m] of Object.entries(doc.components().messages())) { + if (m.name() === undefined) { + m.json()[String(xParserMessageName)] = key; + } } + } } + /** - * Merges properties of the original error with the new error. - * - * @param newError - The error object to extend - * @param originalError - The original error object, if any + * Assign parameter keys as uid for the parameter schema. + * + * @private + * @param {AsyncAPIDocument} doc */ -function mergeErrors(newError, originalError) { - // Get the original error's keys - // NOTE: We specifically exclude properties that we have already set on the new error. - // This is _especially_ important for the `stack` property, because this property has - // a lazy getter in some environments - let keys = to_json_1.getDeepKeys(originalError, protectedProps); - // HACK: We have to cast the errors to `any` so we can use symbol indexers. - // see https://github.com/Microsoft/TypeScript/issues/1863 - // tslint:disable: no-any no-unsafe-any - let _newError = newError; - let _originalError = originalError; - for (let key of keys) { - if (_newError[key] === undefined) { - try { - _newError[key] = _originalError[key]; - } - catch (e) { - // This property is read-only, so it can't be copied - } - } +function assignUidToParameterSchemas(doc) { + doc.channelNames().forEach(channelName => { + const channel = doc.channel(channelName); + for (const [parameterKey, parameterSchema] of Object.entries(channel.parameters())) { + parameterSchema.json()[String(xParserSchemaId)] = parameterKey; } + }); } -//# sourceMappingURL=extend-error.js.map -/***/ }), -/* 197 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/** + * Assign uid to component schemas. + * + * @private + * @param {AsyncAPIDocument} doc + */ +function assignUidToComponentSchemas(doc) { + if (doc.hasComponents()) { + for (const [key, s] of Object.entries(doc.components().schemas())) { + s.json()[String(xParserSchemaId)] = key; + } + } +} -module.exports = isexe -isexe.sync = sync +/** + * Assign anonymous names to nameless messages. + * + * @private + * @param {AsyncAPIDocument} doc + */ +function assignNameToAnonymousMessages(doc) { + let anonymousMessageCounter = 0; -var fs = __webpack_require__(747) + if (doc.hasChannels()) { + doc.channelNames().forEach(channelName => { + const channel = doc.channel(channelName); + if (channel.hasPublish()) addNameToKey(channel.publish().messages(),++anonymousMessageCounter); + if (channel.hasSubscribe()) addNameToKey(channel.subscribe().messages(),++anonymousMessageCounter); + }); + } +} -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, options)) - }) +/** + * Add anonymous name to key if no name provided. + * + * @private + * @param {Message} map of messages + */ +function addNameToKey(messages, number) { + messages.forEach(m => { + if (m.name() === undefined) { + m.json()[String(xParserMessageName)] = ``; + } + }); } -function sync (path, options) { - return checkStat(fs.statSync(path), options) +/** + * Function that indicates that a circular reference was detected. + * @private + * @param {Schema} schema schema that is currently accessed and need to be checked if it is a first time + * @param {Array} seenObjects list of objects that were already seen during recursion + */ +function isCircular(schema, seenObjects) { + return seenObjects.includes(schema.json()); } -function checkStat (stat, options) { - return stat.isFile() && checkMode(stat, options) +/** + * Mark schema as being a circular ref + * + * @private + * @param {Schema} schema schema that should be marked as circular + */ +function markCircular(schema, prop) { + if (schema.type() === 'array') return schema.json()[String(xParserCircle)] = true; + + const circPropsList = schema.json()[String(xParserCircleProps)] || []; + circPropsList.push(prop); + schema.json()[String(xParserCircleProps)] = circPropsList; } -function checkMode (stat, options) { - var mod = stat.mode - var uid = stat.uid - var gid = stat.gid +/** + * Callback that is called foreach schema found + * @private + * @callback FoundSchemaCallback + * @param {Schema} schema found. +*/ +/** + * Recursively go through each schema and execute callback. + * + * @private + * @param {Schema} schema found. + * @param {FoundSchemaCallback} callback + */ +function recursiveSchema(schemaContent, callback) { + if (schemaContent === null) return; + const seenObj = []; - var myUid = options.uid !== undefined ? - options.uid : process.getuid && process.getuid() - var myGid = options.gid !== undefined ? - options.gid : process.getgid && process.getgid() + return crawl(schemaContent, seenObj, callback); +} - var u = parseInt('100', 8) - var g = parseInt('010', 8) - var o = parseInt('001', 8) - var ug = u | g +/** + * Schema crawler + * + * @private + * @param {Schema} schemaContent schema. + * @param {Array} seenObj schema elements that crowler went through already. + * @param {Function} callback(schema) + * the function that is called foreach schema found. + * schema {Schema}: the found schema. + */ +function crawl(schema, seenObj, callback) { + if (isCircular(schema, seenObj)) return true; - var ret = (mod & o) || - (mod & g) && gid === myGid || - (mod & u) && uid === myUid || - (mod & ug) && myUid === 0 + seenObj.push(schema.json()); + callback(schema); + if (schema.type() !== undefined) { + switch (schema.type()) { + case 'object': + recursiveSchemaObject(schema, seenObj, callback); + break; + case 'array': + recursiveSchemaArray(schema, seenObj, callback); + break; + } + } else { + //check for allOf, oneOf, anyOf + const checkCombiningSchemas = (combineArray) => { + if (combineArray !== null && combineArray.length > 0) { + combineArray.forEach(combineSchema => { + if (crawl(combineSchema, seenObj, callback)) markCircular(schema); + }); + } + }; + checkCombiningSchemas(schema.allOf()); + checkCombiningSchemas(schema.anyOf()); + checkCombiningSchemas(schema.oneOf()); + } - return ret + seenObj.pop(); } +/** + * Go through each channel and for each parameter, and message payload and headers recursively call the callback for each schema. + * + * @private + * @param {AsyncAPIDocument} doc + * @param {FoundSchemaCallback} callback + */ +function schemaDocument(doc, callback) { + if (doc.hasChannels()) { + doc.channelNames().forEach(channelName => { + const channel = doc.channel(channelName); + + Object.values(channel.parameters()).forEach(p => { + recursiveSchema(p.schema(), callback); + }); -/***/ }), -/* 198 */, -/* 199 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + if (channel.hasPublish()) { + channel.publish().messages().forEach(m => { + recursiveSchema(m.headers(), callback); + recursiveSchema(m.payload(), callback); + }); + } + if (channel.hasSubscribe()) { + channel.subscribe().messages().forEach(m => { + recursiveSchema(m.headers(), callback); + recursiveSchema(m.payload(), callback); + }); + } + }); + } +} -const path = __webpack_require__(622) +/** + * Gives schemas id to all anonymous schemas. + * + * @private + * @param {AsyncAPIDocument} doc + */ +function assignIdToAnonymousSchemas(doc) { + let anonymousSchemaCounter = 0; + const callback = (schema) => { + if (!schema.uid()) { + schema.json()[String(xParserSchemaId)] = ``; + } + }; + schemaDocument(doc, callback); +} /** - * Generate default location for basePath. - * - * @param {string} basePath - Path to generate location for. - * @param {string} ext - Generated location document extension. - * @return {string} Generated location with "file://" prefix. + * Recursively go through schema of object type and execute callback. + * + * @private + * @param {Schema} schema Object type. + * @param {Array} seenObj schema elements that crawler went through already. + * @param {Function} callback(schema) + * the function that is called foreach schema found. + * schema {Schema}: the found schema. */ -function genBasePathLocation (basePath, ext) { - if (basePath.endsWith(`.${ext}`)) { - return `file://${basePath}` +function recursiveSchemaObject(schema, seenObj, callback) { + if (schema.additionalProperties() !== undefined && typeof schema.additionalProperties() !== 'boolean') { + const additionalSchema = schema.additionalProperties(); + if (crawl(additionalSchema, seenObj, callback)) markCircular(schema); + } + if (schema.properties() !== null) { + const props = schema.properties(); + for (const [prop, propertySchema] of Object.entries(props)) { + if (crawl(propertySchema, seenObj, callback)) markCircular(schema, prop); + } } - const docName = `basepath_default_doc.${ext}` - return `file://${path.resolve(basePath, docName)}` } /** - * Validates draft version. - * - * @param {string} draft - Output JSON Schema draft version. - * throws {Error} If specified draft is not supported. + * Recursively go through schema of array type and execute callback. + * + * @private + * @param {Schema} schema Array type. + * @param {Array} seenObj schema elements that crowler went through already. + * @param {Function} callback(schema) + * the function that is called foreach schema found. + * schema {Schema}: the found schema. */ -function validateDraft (draft) { - const supportedDrafts = ['04', '06', '07'] - if (supportedDrafts.indexOf(draft) < 0) { - throw new Error( - `Unsupported draft version. Supported versions are: ${supportedDrafts}`) +function recursiveSchemaArray(schema, seenObj, callback) { + if (schema.additionalItems() !== undefined) { + const additionalArrayItems = schema.additionalItems(); + if (crawl(additionalArrayItems, seenObj, callback)) markCircular(schema); + } + + if (schema.items() !== null) { + if (Array.isArray(schema.items())) { + schema.items().forEach(arraySchema => { + if (crawl(arraySchema, seenObj, callback)) markCircular(schema); + }); + } else if (crawl(schema.items(), seenObj, callback)) markCircular(schema); } } -module.exports = { - genBasePathLocation: genBasePathLocation, - validateDraft: validateDraft, - DEFAULT_DRAFT: '07' +module.exports = mix(AsyncAPIDocument, MixinTags, MixinExternalDocs, MixinSpecificationExtensions); + + +/***/ }), + +/***/ 69281: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const ParserError = __webpack_require__(21978); + +/** + * Implements common functionality for all the models. + * @class + * @alias module:@asyncapi/parser#Base + * @returns {Base} + */ +class Base { + constructor (json) { + if (!json) throw new ParserError(`Invalid JSON to instantiate the ${this.constructor.name} object.`); + this._json = json; + } + + /** + * @returns {any} + */ + json(key) { + if (key === undefined) return this._json; + if (!this._json) return; + return this._json[String(key)]; + } } +module.exports = Base; + /***/ }), -/* 200 */, -/* 201 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -var convertFromSchema = __webpack_require__(647) -var InvalidInputError = __webpack_require__(70) +/***/ 80945: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = convertFromParameter +const { mix } = __webpack_require__(12065); -// Convert from OpenAPI 3.0 `ParameterObject` to JSON schema v4 -function convertFromParameter (parameter, options) { - if (parameter.schema !== undefined) { - return convertParameterSchema(parameter, parameter.schema, options) - } else if (parameter.content !== undefined) { - return convertFromContents(parameter, options) - } else { - if (options.strictMode) { - throw new InvalidInputError('OpenAPI parameter must have either a \'schema\' or a \'content\' property') - } - return convertParameterSchema(parameter, {}, options) +const Base = __webpack_require__(69281); +const Schema = __webpack_require__(36659); + +const MixinDescription = __webpack_require__(13518); +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with a ChannelParameter object. + * @class + * @alias module:@asyncapi/parser#ChannelParameter + * @extends Base + * @mixes MixinDescription + * @mixes MixinSpecificationExtensions + * @returns {ChannelParameter} + */ +class ChannelParameter extends Base { + /** + * @returns {string} + */ + location() { + return this._json.location; + } + + /** + * @returns {Schema} + */ + schema() { + if (!this._json.schema) return null; + return new Schema(this._json.schema); } } -function convertFromContents (parameter, options) { - var schemas = {} +module.exports = mix(ChannelParameter, MixinDescription, MixinSpecificationExtensions); - for (var mime in parameter.content) { - schemas[mime] = convertParameterSchema(parameter, parameter.content[mime].schema, options) + +/***/ }), + +/***/ 50342: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const { createMapOfType, getMapValueOfType, mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); +const ChannelParameter = __webpack_require__(80945); +const PublishOperation = __webpack_require__(45460); +const SubscribeOperation = __webpack_require__(99065); + +const MixinDescription = __webpack_require__(13518); +const MixinBindings = __webpack_require__(58052); +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with a Channel object. + * @class + * @alias module:@asyncapi/parser#Channel + * @extends Base + * @mixes MixinDescription + * @mixes MixinBindings + * @mixes MixinSpecificationExtensions + * @returns {Channel} + */ +class Channel extends Base { + /** + * @returns {Object} + */ + parameters() { + return createMapOfType(this._json.parameters, ChannelParameter); } - return schemas -} + /** + * @param {string} name - Name of the parameter. + * @returns {ChannelParameter} + */ + parameter(name) { + return getMapValueOfType(this._json.parameters, name, ChannelParameter); + } -function convertParameterSchema (parameter, schema, options) { - var jsonSchema = convertFromSchema(schema || {}, options) + /** + * @returns {boolean} + */ + hasParameters() { + return !!this._json.parameters; + } - if (parameter.description) { - jsonSchema.description = parameter.description + /** + * @returns {PublishOperation} + */ + publish() { + if (!this._json.publish) return null; + return new PublishOperation(this._json.publish); } - return jsonSchema + /** + * @returns {SubscribeOperation} + */ + subscribe() { + if (!this._json.subscribe) return null; + return new SubscribeOperation(this._json.subscribe); + } + + /** + * @returns {boolean} + */ + hasPublish() { + return !!this._json.publish; + } + + /** + * @returns {boolean} + */ + hasSubscribe() { + return !!this._json.subscribe; + } } +module.exports = mix(Channel, MixinDescription, MixinBindings, MixinSpecificationExtensions); + /***/ }), -/* 202 */, -/* 203 */ -/***/ (function(module) { -"use strict"; +/***/ 14396: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate_custom(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; +const { createMapOfType, getMapValueOfType, mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); +const Message = __webpack_require__(49739); +const Schema = __webpack_require__(36659); +const SecurityScheme = __webpack_require__(53601); +const ChannelParameter = __webpack_require__(80945); +const CorrelationId = __webpack_require__(89843); +const OperationTrait = __webpack_require__(61348); +const MessageTrait = __webpack_require__(2888); + +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with a Components object. + * @class + * @alias module:@asyncapi/parser#Components + * @extends Base + * @mixes MixinSpecificationExtensions + * @returns {Components} + */ +class Components extends Base { + /** + * @returns {Object} + */ + messages() { + return createMapOfType(this._json.messages, Message); } - var $rule = this, - $definition = 'definition' + $lvl, - $rDef = $rule.definition, - $closingBraces = ''; - var $compile, $inline, $macro, $ruleValidate, $validateCode; - if ($isData && $rDef.$data) { - $validateCode = 'keywordValidate' + $lvl; - var $validateSchema = $rDef.validateSchema; - out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; - } else { - $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); - if (!$ruleValidate) return; - $schemaValue = 'validate.schema' + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; + + /** + * @returns {Message} + */ + message(name) { + return getMapValueOfType(this._json.messages, name, Message); } - var $ruleErrs = $validateCode + '.errors', - $i = 'i' + $lvl, - $ruleErr = 'ruleErr' + $lvl, - $asyncKeyword = $rDef.async; - if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); - if (!($inline || $macro)) { - out += '' + ($ruleErrs) + ' = null;'; + + /** + * @returns {Object} + */ + schemas() { + return createMapOfType(this._json.schemas, Schema); } - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($isData && $rDef.$data) { - $closingBraces += '}'; - out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; - if ($validateSchema) { - $closingBraces += '}'; - out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; - } + + /** + * @returns {Schema} + */ + schema(name) { + return getMapValueOfType(this._json.schemas, name, Schema); } - if ($inline) { - if ($rDef.statements) { - out += ' ' + ($ruleValidate.validate) + ' '; - } else { - out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; - } - } else if ($macro) { - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - $it.schema = $ruleValidate.validate; - $it.schemaPath = ''; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($code); - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - out += ' ' + ($validateCode) + '.call( '; - if (it.opts.passContext) { - out += 'this'; - } else { - out += 'self'; - } - if ($compile || $rDef.schema === false) { - out += ' , ' + ($data) + ' '; - } else { - out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; - } - out += ' , (dataPath || \'\')'; - if (it.errorPath != '""') { - out += ' + ' + (it.errorPath); - } - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; - var def_callRuleValidate = out; - out = $$outStack.pop(); - if ($rDef.errors === false) { - out += ' ' + ($valid) + ' = '; - if ($asyncKeyword) { - out += '' + (it.yieldAwait); - } - out += '' + (def_callRuleValidate) + '; '; - } else { - if ($asyncKeyword) { - $ruleErrs = 'customErrors' + $lvl; - out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = ' + (it.yieldAwait) + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; - } else { - out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; - } - } + + /** + * @returns {Object} + */ + securitySchemes() { + return createMapOfType(this._json.securitySchemes, SecurityScheme); } - if ($rDef.modifying) { - out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; + + /** + * @returns {SecurityScheme} + */ + securityScheme(name) { + return getMapValueOfType(this._json.securitySchemes, name, SecurityScheme); } - out += '' + ($closingBraces); - if ($rDef.valid) { - if ($breakOnError) { - out += ' if (true) { '; - } - } else { - out += ' if ( '; - if ($rDef.valid === undefined) { - out += ' !'; - if ($macro) { - out += '' + ($nextValid); - } else { - out += '' + ($valid); - } - } else { - out += ' ' + (!$rDef.valid) + ' '; - } - out += ') { '; - $errorKeyword = $rule.keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - var def_customError = out; - out = $$outStack.pop(); - if ($inline) { - if ($rDef.errors) { - if ($rDef.errors != 'full') { - out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '} + */ + parameters() { + return createMapOfType(this._json.parameters, ChannelParameter); + } + + /** + * @returns {ChannelParameter} + */ + parameter(name) { + return getMapValueOfType(this._json.parameters, name, ChannelParameter); + } + + /** + * @returns {Object} + */ + correlationIds() { + return createMapOfType(this._json.correlationIds, CorrelationId); + } + + /** + * @returns {CorrelationId} + */ + correlationId(name) { + return getMapValueOfType(this._json.correlationIds, name, CorrelationId); + } + + /** + * @returns {Object} + */ + operationTraits() { + return createMapOfType(this._json.operationTraits, OperationTrait); + } + + /** + * @returns {OperationTrait} + */ + operationTrait(name) { + return getMapValueOfType(this._json.operationTraits, name, OperationTrait); + } + + /** + * @returns {Object} + */ + messageTraits() { + return createMapOfType(this._json.messageTraits, MessageTrait); + } + + /** + * @returns {MessageTrait} + */ + messageTrait(name) { + return getMapValueOfType(this._json.messageTraits, name, MessageTrait); } - return out; } +module.exports = mix(Components, MixinSpecificationExtensions); + /***/ }), -/* 204 */, -/* 205 */, -/* 206 */, -/* 207 */, -/* 208 */, -/* 209 */, -/* 210 */, -/* 211 */ -/***/ (function(module) { -module.exports = require("https"); +/***/ 66913: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + + +const { mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); + +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with the Contact object. + * @class + * @alias module:@asyncapi/parser#Contact + * @extends Base + * @mixes MixinSpecificationExtensions + * @returns {Contact} + */ +class Contact extends Base { + /** + * @returns {string} + */ + name() { + return this._json.name; + } + + /** + * @returns {string} + */ + url() { + return this._json.url; + } + + /** + * @returns {string} + */ + email() { + return this._json.email; + } +} + +module.exports = mix(Contact, MixinSpecificationExtensions); + + +/***/ }), + +/***/ 89843: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const { mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); + +const MixinDescription = __webpack_require__(13518); +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with a CorrelationId object. + * @class + * @alias module:@asyncapi/parser#CorrelationId + * @extends Base + * @mixes MixinDescription + * @mixes MixinSpecificationExtensions + * @returns {CorrelationId} + */ +class CorrelationId extends Base { + /** + * @returns {string} + */ + location() { + return this._json.location; + } +} + +module.exports = mix(CorrelationId, MixinSpecificationExtensions, MixinDescription); + + +/***/ }), + +/***/ 89147: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const { mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); + +const MixinDescription = __webpack_require__(13518); +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with an ExternalDocs object. + * @class + * @alias module:@asyncapi/parser#ExternalDocs + * @extends Base + * @mixes MixinDescription + * @mixes MixinSpecificationExtensions + * @returns {ExternalDocs} + */ +class ExternalDocs extends Base { + /** + * @returns {string} + */ + url() { + return this._json.url; + } +} + +module.exports = mix(ExternalDocs, MixinDescription, MixinSpecificationExtensions); + + +/***/ }), + +/***/ 72420: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const { mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); +const License = __webpack_require__(44352); +const Contact = __webpack_require__(66913); + +const MixinDescription = __webpack_require__(13518); +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with the Info object. + * @class + * @alias module:@asyncapi/parser#Info + * @extends Base + * @mixes MixinDescription + * @mixes MixinSpecificationExtensions + * @returns {Info} + */ +class Info extends Base { + /** + * @returns {string} + */ + title() { + return this._json.title; + } + + /** + * @returns {string} + */ + version() { + return this._json.version; + } + + /** + * @returns {(string | undefined)} + */ + termsOfService() { + return this._json.termsOfService; + } + + /** + * @returns {License} + */ + license() { + if (!this._json.license) return null; + return new License(this._json.license); + } + + /** + * @returns {Contact} + */ + contact() { + if (!this._json.contact) return null; + return new Contact(this._json.contact); + } +} + +module.exports = mix(Info, MixinDescription, MixinSpecificationExtensions); + + +/***/ }), + +/***/ 44352: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const { mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); + +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with the License object. + * @class + * @alias module:@asyncapi/parser#License + * @extends Base + * @mixes MixinSpecificationExtensions + * @returns {License} + */ +class License extends Base { + /** + * @returns {string} + */ + name() { + return this._json.name; + } + + /** + * @returns {string} + */ + url() { + return this._json.url; + } +} + +module.exports = mix(License, MixinSpecificationExtensions); + + +/***/ }), + +/***/ 2888: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const MessageTraitable = __webpack_require__(70050); + +/** + * Implements functions to deal with a MessageTrait object. + * @class + * @alias module:@asyncapi/parser#MessageTrait + * @extends MessageTraitable + * @returns {MessageTrait} + */ +class MessageTrait extends MessageTraitable { +} + +module.exports = MessageTrait; + + +/***/ }), + +/***/ 70050: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const { getMapValueOfType, mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); +const Schema = __webpack_require__(36659); +const CorrelationId = __webpack_require__(89843); + +const MixinDescription = __webpack_require__(13518); +const MixinExternalDocs = __webpack_require__(44001); +const MixinTags = __webpack_require__(74301); +const MixinBindings = __webpack_require__(58052); +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with a the common properties that Message and MessageTrait objects have. + * @class + * @alias module:@asyncapi/parser#MessageTraitable + * @extends Base + * @mixes MixinDescription + * @mixes MixinTags + * @mixes MixinExternalDocs + * @mixes MixinBindings + * @mixes MixinSpecificationExtensions + * @returns {MessageTraitable} + */ +class MessageTraitable extends Base { + /** + * @returns {Schema} + */ + headers() { + if (!this._json.headers) return null; + return new Schema(this._json.headers); + } + + /** + * @param {string} name - Name of the header. + * @returns {Schema} + */ + header(name) { + if (!this._json.headers) return null; + return getMapValueOfType(this._json.headers.properties, name, Schema); + } + + /** + * @returns {CorrelationId} + */ + correlationId() { + if (!this._json.correlationId) return null; + return new CorrelationId(this._json.correlationId); + } + + /** + * @returns {string} + */ + schemaFormat() { + return 'application/schema+json;version=draft-07'; + } + + /** + * @returns {string} + */ + contentType() { + return this._json.contentType; + } + + /** + * @returns {string} + */ + name() { + return this._json.name; + } + + /** + * @returns {string} + */ + title() { + return this._json.title; + } + + /** + * @returns {string} + */ + summary() { + return this._json.summary; + } + + /** + * @returns {any[]} + */ + examples() { + return this._json.examples; + } +} + +module.exports = mix(MessageTraitable, MixinDescription, MixinTags, MixinExternalDocs, MixinBindings, MixinSpecificationExtensions); + /***/ }), -/* 212 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -const MessageTraitable = __webpack_require__(604); -const Schema = __webpack_require__(671); +/***/ 49739: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const MessageTraitable = __webpack_require__(70050); +const Schema = __webpack_require__(36659); /** * Implements functions to deal with a Message object. * @class + * @alias module:@asyncapi/parser#Message * @extends MessageTraitable * @returns {Message} */ @@ -8852,5375 +9352,4807 @@ module.exports = Message; /***/ }), -/* 213 */, -/* 214 */ -/***/ (function(module) { -"use strict"; +/***/ 92548: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function generate_format(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - if (it.opts.format === false) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $unknownFormats = it.opts.unknownFormats, - $allowUnknown = Array.isArray($unknownFormats); - if ($isData) { - var $format = 'format' + $lvl, - $isObject = 'isObject' + $lvl, - $formatType = 'formatType' + $lvl; - out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { '; - if (it.async) { - out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; '; - } - out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; - } - out += ' ('; - if ($unknownFormats != 'ignore') { - out += ' (' + ($schemaValue) + ' && !' + ($format) + ' '; - if ($allowUnknown) { - out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 '; - } - out += ') || '; - } - out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? '; - if (it.async) { - out += ' (async' + ($lvl) + ' ? ' + (it.yieldAwait) + ' ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) '; - } else { - out += ' ' + ($format) + '(' + ($data) + ') '; - } - out += ' : ' + ($format) + '.test(' + ($data) + '))))) {'; - } else { - var $format = it.formats[$schema]; - if (!$format) { - if ($unknownFormats == 'ignore') { - it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else { - throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); - } - } - var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate; - var $formatType = $isObject && $format.type || 'string'; - if ($isObject) { - var $async = $format.async === true; - $format = $format.validate; - } - if ($formatType != $ruleType) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - if ($async) { - if (!it.async) throw new Error('async format in sync schema'); - var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; - out += ' if (!(' + (it.yieldAwait) + ' ' + ($formatRef) + '(' + ($data) + '))) { '; - } else { - out += ' if (! '; - var $formatRef = 'formats' + it.util.getProperty($schema); - if ($isObject) $formatRef += '.validate'; - if (typeof $format == 'function') { - out += ' ' + ($formatRef) + '(' + ($data) + ') '; - } else { - out += ' ' + ($formatRef) + '.test(' + ($data) + ') '; - } - out += ') { '; - } +const { mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); + +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with a OAuthFlow object. + * @class + * @alias module:@asyncapi/parser#OAuthFlow + * @extends Base + * @mixes MixinSpecificationExtensions + * @returns {OAuthFlow} + */ +class OAuthFlow extends Base { + /** + * @returns {string} + */ + authorizationUrl() { + return this._json.authorizationUrl; } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match format "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; + + /** + * @returns {string} + */ + tokenUrl() { + return this._json.tokenUrl; } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + + /** + * @returns {string} + */ + refreshUrl() { + return this._json.refreshUrl; } - out += ' } '; - if ($breakOnError) { - out += ' else { '; + + /** + * @returns {Object} + */ + scopes() { + return this._json.scopes; } - return out; } +module.exports = mix(OAuthFlow, MixinSpecificationExtensions); + /***/ }), -/* 215 */ -/***/ (function(__unusedmodule, exports) { -"use strict"; +/***/ 61348: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +const OperationTraitable = __webpack_require__(62685); /** - * Returns the given plugins as an array, rather than an object map. - * All other methods in this module expect an array of plugins rather than an object map. - * - * @param {object} plugins - A map of plugin objects - * @return {object[]} + * Implements functions to deal with a OperationTrait object. + * @class + * @alias module:@asyncapi/parser#OperationTrait + * @extends OperationTraitable + * @returns {OperationTrait} */ -exports.all = function (plugins) { - return Object.keys(plugins) - .filter((key) => { - return typeof plugins[key] === "object"; - }) - .map((key) => { - plugins[key].name = key; - return plugins[key]; - }); -}; +class OperationTrait extends OperationTraitable { +} -/** - * Filters the given plugins, returning only the ones return `true` for the given method. - * - * @param {object[]} plugins - An array of plugin objects - * @param {string} method - The name of the filter method to invoke for each plugin - * @param {object} file - A file info object, which will be passed to each method - * @return {object[]} - */ -exports.filter = function (plugins, method, file) { - return plugins - .filter((plugin) => { - return !!getResult(plugin, method, file); - }); -}; +module.exports = OperationTrait; -/** - * Sorts the given plugins, in place, by their `order` property. - * - * @param {object[]} plugins - An array of plugin objects - * @returns {object[]} - */ -exports.sort = function (plugins) { - for (let plugin of plugins) { - plugin.order = plugin.order || Number.MAX_SAFE_INTEGER; - } - return plugins.sort((a, b) => { return a.order - b.order; }); -}; +/***/ }), + +/***/ 62685: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const { mix } = __webpack_require__(12065); + +const Base = __webpack_require__(69281); + +const MixinDescription = __webpack_require__(13518); +const MixinTags = __webpack_require__(74301); +const MixinExternalDocs = __webpack_require__(44001); +const MixinBindings = __webpack_require__(58052); +const MixinSpecificationExtensions = __webpack_require__(25999); /** - * Runs the specified method of the given plugins, in order, until one of them returns a successful result. - * Each method can return a synchronous value, a Promise, or call an error-first callback. - * If the promise resolves successfully, or the callback is called without an error, then the result - * is immediately returned and no further plugins are called. - * If the promise rejects, or the callback is called with an error, then the next plugin is called. - * If ALL plugins fail, then the last error is thrown. - * - * @param {object[]} plugins - An array of plugin objects - * @param {string} method - The name of the method to invoke for each plugin - * @param {object} file - A file info object, which will be passed to each method - * @returns {Promise} + * Implements functions to deal with the common properties Operation and OperationTrait object have. + * @class + * @alias module:@asyncapi/parser#OperationTraitable + * @extends Base + * @mixes MixinDescription + * @mixes MixinTags + * @mixes MixinExternalDocs + * @mixes MixinBindings + * @mixes MixinSpecificationExtensions + * @returns {OperationTraitable} */ -exports.run = function (plugins, method, file, $refs) { - let plugin, lastError, index = 0; - - return new Promise(((resolve, reject) => { - runNextPlugin(); +class OperationTraitable extends Base { + /** + * @returns {string} + */ + id() { + return this._json.operationId; + } + + /** + * @returns {string} + */ + summary() { + return this._json.summary; + } +} - function runNextPlugin () { - plugin = plugins[index++]; - if (!plugin) { - // There are no more functions, so re-throw the last error - return reject(lastError); - } +module.exports = mix(OperationTraitable, MixinDescription, MixinTags, MixinExternalDocs, MixinBindings, MixinSpecificationExtensions); - try { - // console.log(' %s', plugin.name); - let result = getResult(plugin, method, file, callback, $refs); - if (result && typeof result.then === "function") { - // A promise was returned - result.then(onSuccess, onError); - } - else if (result !== undefined) { - // A synchronous result was returned - onSuccess(result); - } - // else { the callback will be called } - } - catch (e) { - onError(e); - } - } - function callback (err, result) { - if (err) { - onError(err); - } - else { - onSuccess(result); - } - } +/***/ }), - function onSuccess (result) { - // console.log(' success'); - resolve({ - plugin, - result - }); - } +/***/ 35682: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - function onError (err) { - // console.log(' %s', err.message || err); - lastError = err; - runNextPlugin(); - } - })); -}; +const OperationTraitable = __webpack_require__(62685); +const Message = __webpack_require__(49739); /** - * Returns the value of the given property. - * If the property is a function, then the result of the function is returned. - * If the value is a RegExp, then it will be tested against the file URL. - * If the value is an aray, then it will be compared against the file extension. - * - * @param {object} obj - The object whose property/method is called - * @param {string} prop - The name of the property/method to invoke - * @param {object} file - A file info object, which will be passed to the method - * @param {function} [callback] - A callback function, which will be passed to the method - * @returns {*} + * Implements functions to deal with an Operation object. + * @class + * @alias module:@asyncapi/parser#Operation + * @extends OperationTraitable + * @returns {Operation} */ -function getResult (obj, prop, file, callback, $refs) { - let value = obj[prop]; - - if (typeof value === "function") { - return value.apply(obj, [file, callback, $refs]); +class Operation extends OperationTraitable { + /** + * @returns {boolean} + */ + hasMultipleMessages() { + if (this._json.message && this._json.message.oneOf && this._json.message.oneOf.length > 1) return true; + if (!this._json.message) return false; + return false; } - - if (!callback) { - // The synchronous plugin functions (canParse and canRead) - // allow a "shorthand" syntax, where the user can match - // files by RegExp or by file extension. - if (value instanceof RegExp) { - return value.test(file.url); - } - else if (typeof value === "string") { - return value === file.extension; - } - else if (Array.isArray(value)) { - return value.indexOf(file.extension) !== -1; - } + + /** + * @returns {Message[]} + */ + messages() { + if (!this._json.message) return []; + if (this._json.message.oneOf) return this._json.message.oneOf.map(m => new Message(m)); + return [new Message(this._json.message)]; + } + + /** + * @returns {Message} + */ + message(index) { + if (!this._json.message) return null; + if (!this._json.message.oneOf) return new Message(this._json.message); + if (typeof index !== 'number') return null; + if (index > this._json.message.oneOf.length - 1) return null; + return new Message(this._json.message.oneOf[+index]); } - - return value; } +module.exports = Operation; -/***/ }), -/* 216 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; +/***/ }), -var ruleModules = __webpack_require__(404) - , toHash = __webpack_require__(676).toHash; +/***/ 45460: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function rules() { - var RULES = [ - { type: 'number', - rules: [ { 'maximum': ['exclusiveMaximum'] }, - { 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] }, - { type: 'string', - rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] }, - { type: 'array', - rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] }, - { type: 'object', - rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames', - { 'properties': ['additionalProperties', 'patternProperties'] } ] }, - { rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] } - ]; +const Operation = __webpack_require__(35682); - var ALL = [ 'type', '$comment' ]; - var KEYWORDS = [ - '$schema', '$id', 'id', '$data', 'title', - 'description', 'default', 'definitions', - 'examples', 'readOnly', 'writeOnly', - 'contentMediaType', 'contentEncoding', - 'additionalItems', 'then', 'else' - ]; - var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ]; - RULES.all = toHash(ALL); - RULES.types = toHash(TYPES); +/** + * Implements functions to deal with a PublishOperation object. + * @class + * @alias module:@asyncapi/parser#PublishOperation + * @extends Operation + * @returns {PublishOperation} + */ +class PublishOperation extends Operation { + /** + * @returns {boolean} + */ + isPublish() { + return true; + } + + /** + * @returns {boolean} + */ + isSubscribe() { + return false; + } - RULES.forEach(function (group) { - group.rules = group.rules.map(function (keyword) { - var implKeywords; - if (typeof keyword == 'object') { - var key = Object.keys(keyword)[0]; - implKeywords = keyword[key]; - keyword = key; - implKeywords.forEach(function (k) { - ALL.push(k); - RULES.all[k] = true; - }); - } - ALL.push(keyword); - var rule = RULES.all[keyword] = { - keyword: keyword, - code: ruleModules[keyword], - implements: implKeywords - }; - return rule; - }); + /** + * @returns {string} + */ + kind() { + return 'publish'; + } +} - RULES.all.$comment = { - keyword: '$comment', - code: ruleModules.$comment - }; +module.exports = PublishOperation; - if (group.type) RULES.types[group.type] = group; - }); - RULES.keywords = toHash(ALL.concat(KEYWORDS)); - RULES.custom = {}; +/***/ }), - return RULES; -}; +/***/ 36659: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +const { createMapOfType, mix } = __webpack_require__(12065); -/***/ }), -/* 217 */, -/* 218 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +const Base = __webpack_require__(69281); -const { createMapOfType, getMapKeyOfType, addExtensions } = __webpack_require__(696); -const Base = __webpack_require__(31); -const ServerVariable = __webpack_require__(567); -const ServerSecurityRequirement = __webpack_require__(26); +const MixinDescription = __webpack_require__(13518); +const MixinExternalDocs = __webpack_require__(44001); +const MixinSpecificationExtensions = __webpack_require__(25999); /** - * Implements functions to deal with a Server object. + * Implements functions to deal with a Schema object. * @class + * @alias module:@asyncapi/parser#Schema * @extends Base - * @returns {Server} + * @mixes MixinDescription + * @mixes MixinExternalDocs + * @mixes MixinSpecificationExtensions + * @returns {Schema} */ -class Server extends Base { +class Schema extends Base { /** * @returns {string} */ - description() { - return this._json.description; + uid() { + return this.$id() || this.ext('x-parser-schema-id'); } - + /** * @returns {string} */ - url() { - return this._json.url; + $id() { + return this._json.$id; } - + /** - * @returns {string} + * @returns {number} */ - protocol() { - return this._json.protocol; + multipleOf() { + return this._json.multipleOf; } - + /** - * @returns {string} + * @returns {number} */ - protocolVersion() { - return this._json.protocolVersion; + maximum() { + return this._json.maximum; } - + /** - * @returns {Object} + * @returns {number} */ - variables() { - return createMapOfType(this._json.variables, ServerVariable); + exclusiveMaximum() { + return this._json.exclusiveMaximum; } - + /** - * @param {string} name - Name of the server variable. - * @returns {ServerVariable} + * @returns {number} */ - variable(name) { - return getMapKeyOfType(this._json.variables, name, ServerVariable); + minimum() { + return this._json.minimum; } - + /** - * @returns {boolean} + * @returns {number} */ - hasVariables() { - return !!this._json.variables; + exclusiveMinimum() { + return this._json.exclusiveMinimum; } - + /** - * @returns {ServerSecurityRequirement[]} + * @returns {number} */ - security() { - if (!this._json.security) return null; - return this._json.security.map(sec => new ServerSecurityRequirement(sec)); + maxLength() { + return this._json.maxLength; } - + /** - * @returns {Object} + * @returns {number} */ - bindings() { - return this._json.bindings || null; + minLength() { + return this._json.minLength; } - + /** - * @param {string} name - Name of the binding. - * @returns {Object} + * @returns {string} */ - binding(name) { - return this._json.bindings ? this._json.bindings[name] : null; + pattern() { + return this._json.pattern; } -} - -module.exports = addExtensions(Server); - - -/***/ }), -/* 219 */, -/* 220 */ -/***/ (function(module) { - -"use strict"; - -module.exports = function generate_enum(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; + + /** + * @returns {number} + */ + maxItems() { + return this._json.maxItems; } - var $i = 'i' + $lvl, - $vSchema = 'schema' + $lvl; - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';'; + + /** + * @returns {number} + */ + minItems() { + return this._json.minItems; } - out += 'var ' + ($valid) + ';'; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; + + /** + * @returns {boolean} + */ + uniqueItems() { + return !!this._json.uniqueItems; } - out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }'; - if ($isData) { - out += ' } '; + + /** + * @returns {number} + */ + maxProperties() { + return this._json.maxProperties; } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to one of the allowed values\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; + + /** + * @returns {number} + */ + minProperties() { + return this._json.minProperties; } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; + + /** + * @returns {string[]} + */ + required() { + return this._json.required; + } + + /** + * @returns {any[]} + */ + enum() { + return this._json.enum; + } + + /** + * @returns {string|string[]} + */ + type() { + return this._json.type; + } + + /** + * @returns {Schema[]} + */ + allOf() { + if (!this._json.allOf) return null; + return this._json.allOf.map(s => new Schema(s)); + } + + /** + * @returns {Schema[]} + */ + oneOf() { + if (!this._json.oneOf) return null; + return this._json.oneOf.map(s => new Schema(s)); + } + + /** + * @returns {Schema[]} + */ + anyOf() { + if (!this._json.anyOf) return null; + return this._json.anyOf.map(s => new Schema(s)); + } + + /** + * @returns {Schema} + */ + not() { + if (!this._json.not) return null; + return new Schema(this._json.not); + } + + /** + * @returns {Schema|Schema[]} + */ + items() { + if (!this._json.items) return null; + if (Array.isArray(this._json.items)) { + return this._json.items.map(s => new Schema(s)); } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + return new Schema(this._json.items); } - out += ' }'; - if ($breakOnError) { - out += ' else { '; + + /** + * @returns {Object} + */ + properties() { + return createMapOfType(this._json.properties, Schema); + } + + /** + * @returns {boolean|Schema} + */ + additionalProperties() { + const ap = this._json.additionalProperties; + if (ap === undefined || ap === null) return; + if (typeof ap === 'boolean') return ap; + return new Schema(ap); + } + + /** + * @returns {Schema} + */ + additionalItems() { + const ai = this._json.additionalItems; + if (ai === undefined || ai === null) return; + return new Schema(ai); + } + + /** + * @returns {Object} + */ + patternProperties() { + return createMapOfType(this._json.patternProperties, Schema); } - return out; -} - - -/***/ }), -/* 221 */ -/***/ (function(module) { - -module.exports = {"$schema":"http://json-schema.org/draft-07/schema#","$id":"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON Schema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}; - -/***/ }), -/* 222 */, -/* 223 */, -/* 224 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -// This file will automatically be rewired to web-loader.js when -// building for the browser -module.exports = __webpack_require__(37); - -/***/ }), -/* 225 */ -/***/ (function(__unusedmodule, exports) { -"use strict"; + /** + * @returns {any} + */ + const() { + return this._json.const; + } + /** + * @returns {Schema} + */ + contains() { + if (!this._json.contains) return null; + return new Schema(this._json.contains); + } -exports.isInteger = num => { - if (typeof num === 'number') { - return Number.isInteger(num); + /** + * @returns {Object} + */ + dependencies() { + if (!this._json.dependencies) return null; + const result = {}; + Object.entries(this._json.dependencies).forEach(([key, value]) => { + result[String(key)] = !Array.isArray(value) ? new Schema(value) : value; + }); + return result; } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isInteger(Number(num)); + + /** + * @returns {Schema} + */ + propertyNames() { + if (!this._json.propertyNames) return null; + return new Schema(this._json.propertyNames); } - return false; -}; -/** - * Find a node of the given type - */ + /** + * @returns {Schema} + */ + if() { + if (!this._json.if) return null; + return new Schema(this._json.if); + } -exports.find = (node, type) => node.nodes.find(node => node.type === type); + /** + * @returns {Schema} + */ + then() { + if (!this._json.then) return null; + return new Schema(this._json.then); + } -/** - * Find a node of the given type - */ + /** + * @returns {Schema} + */ + else() { + if (!this._json.else) return null; + return new Schema(this._json.else); + } -exports.exceedsLimit = (min, max, step = 1, limit) => { - if (limit === false) return false; - if (!exports.isInteger(min) || !exports.isInteger(max)) return false; - return ((Number(max) - Number(min)) / Number(step)) >= limit; -}; + /** + * @returns {string} + */ + format() { + return this._json.format; + } -/** - * Escape the given node with '\\' before node.value - */ + /** + * @returns {string} + */ + contentEncoding() { + return this._json.contentEncoding; + } -exports.escapeNode = (block, n = 0, type) => { - let node = block.nodes[n]; - if (!node) return; + /** + * @returns {string} + */ + contentMediaType() { + return this._json.contentMediaType; + } - if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { - if (node.escaped !== true) { - node.value = '\\' + node.value; - node.escaped = true; - } + /** + * @returns {Object} + */ + definitions() { + return createMapOfType(this._json.definitions, Schema); } -}; -/** - * Returns true if the given brace node should be enclosed in literal braces - */ + /** + * @returns {string} + */ + title() { + return this._json.title; + } -exports.encloseBrace = node => { - if (node.type !== 'brace') return false; - if ((node.commas >> 0 + node.ranges >> 0) === 0) { - node.invalid = true; - return true; + /** + * @returns {any} + */ + default() { + return this._json.default; } - return false; -}; -/** - * Returns true if a brace node is invalid. - */ + /** + * @returns {boolean} + */ + deprecated() { + return this._json.deprecated; + } -exports.isInvalidBrace = block => { - if (block.type !== 'brace') return false; - if (block.invalid === true || block.dollar) return true; - if ((block.commas >> 0 + block.ranges >> 0) === 0) { - block.invalid = true; - return true; + /** + * @returns {string} + */ + discriminator() { + return this._json.discriminator; } - if (block.open !== true || block.close !== true) { - block.invalid = true; - return true; + /** + * @returns {boolean} + */ + readOnly() { + return !!this._json.readOnly; } - return false; -}; -/** - * Returns true if a node is an open or close node - */ + /** + * @returns {boolean} + */ + writeOnly() { + return !!this._json.writeOnly; + } -exports.isOpenOrClose = node => { - if (node.type === 'open' || node.type === 'close') { - return true; + /** + * @returns {any[]} + */ + examples() { + return this._json.examples; } - return node.open === true || node.close === true; -}; -/** - * Reduce an array of text nodes. - */ + /** + * @returns {boolean} + */ + isCircular() { + return !!this.ext('x-parser-circular'); + } -exports.reduce = nodes => nodes.reduce((acc, node) => { - if (node.type === 'text') acc.push(node.value); - if (node.type === 'range') node.type = 'text'; - return acc; -}, []); + /** + * @returns {boolean} + */ + hasCircularProps() { + return !!this.ext('x-parser-circular-props'); + } -/** - * Flatten an array - */ + /** + * @returns {string[]} + */ + circularProps() { + return this.ext('x-parser-circular-props'); + } +} -exports.flatten = (...args) => { - const result = []; - const flat = arr => { - for (let i = 0; i < arr.length; i++) { - let ele = arr[i]; - Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele); - } - return result; - }; - flat(args); - return result; -}; +module.exports = mix(Schema, MixinDescription, MixinExternalDocs, MixinSpecificationExtensions); /***/ }), -/* 226 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; +/***/ 53601: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +const { createMapOfType, mix } = __webpack_require__(12065); -var fs = null - , path = __webpack_require__(622) - , jsonFile = __webpack_require__(103) - , json = __webpack_require__(944) - , fse = {}; +const Base = __webpack_require__(69281); +const OAuthFlow = __webpack_require__(92548); -try { - // optional dependency - fs = __webpack_require__(598) -} catch (er) { - fs = __webpack_require__(747) +const MixinDescription = __webpack_require__(13518); +const MixinSpecificationExtensions = __webpack_require__(25999); + +/** + * Implements functions to deal with a SecurityScheme object. + * @class + * @alias module:@asyncapi/parser#SecurityScheme + * @extends Base + * @mixes MixinDescription + * @mixes MixinSpecificationExtensions + * @returns {SecurityScheme} + */ +class SecurityScheme extends Base { + /** + * @returns {string} + */ + type() { + return this._json.type; + } + + /** + * @returns {string} + */ + name() { + return this._json.name; + } + + /** + * @returns {string} + */ + in() { + return this._json.in; + } + + /** + * @returns {string} + */ + scheme() { + return this._json.scheme; + } + + /** + * @returns {string} + */ + bearerFormat() { + return this._json.bearerFormat; + } + + /** + * @returns {string} + */ + openIdConnectUrl() { + return this._json.openIdConnectUrl; + } + + /** + * @returns {Object} + */ + flows() { + return createMapOfType(this._json.flows, OAuthFlow); + } } -Object.keys(fs).forEach(function(key) { - var func = fs[key]; - if (typeof func == 'function') - fse[key] = func; -}); +module.exports = mix(SecurityScheme, MixinDescription, MixinSpecificationExtensions); -fs = fse; -// copy +/***/ }), -fs.copy = __webpack_require__(766).copy; +/***/ 55817: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -// remove +const Base = __webpack_require__(69281); -var remove = __webpack_require__(366); -fs.remove = remove.remove; -fs.removeSync = remove.removeSync; -fs['delete'] = fs.remove -fs.deleteSync = fs.removeSync +/** + * Implements functions to deal with a ServerSecurityRequirement object. + * @class + * @alias module:@asyncapi/parser#ServerSecurityRequirement + * @extends Base + * @returns {ServerSecurityRequirement} + */ +class ServerSecurityRequirement extends Base { +} -// mkdir +module.exports = ServerSecurityRequirement; -var mkdir = __webpack_require__(777) -fs.mkdirs = mkdir.mkdirs -fs.mkdirsSync = mkdir.mkdirsSync -fs.mkdirp = mkdir.mkdirs -fs.mkdirpSync = mkdir.mkdirsSync -// create +/***/ }), -var create = __webpack_require__(897) -fs.createFile = create.createFile; -fs.createFileSync = create.createFileSync; +/***/ 96217: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -//deprecated -fs.touch = function touch() { - console.log('fs.touch() is deprecated. Please use fs.createFile().') - fs.createFile.apply(null, arguments) -} +const { mix } = __webpack_require__(12065); -fs.touchSync = function touchSync() { - console.log('fs.touchSync() is deprecated. Please use fs.createFileSync().') - fs.createFileSync.apply(null, arguments) -} +const Base = __webpack_require__(69281); -// output +const MixinDescription = __webpack_require__(13518); +const MixinSpecificationExtensions = __webpack_require__(25999); -var output = __webpack_require__(814); -fs.outputFile = output.outputFile; -fs.outputFileSync = output.outputFileSync; +/** + * Implements functions to deal with a ServerVariable object. + * @class + * @alias module:@asyncapi/parser#ServerVariable + * @extends Base + * @mixes MixinDescription + * @mixes MixinSpecificationExtensions + * @returns {ServerVariable} + */ +class ServerVariable extends Base { + /** + * @returns {any[]} + */ + allowedValues() { + return this._json.enum; + } -// read + /** + * @param {string} name - Name of the variable. + * @returns {boolean} + */ + allows(name) { + if (this._json.enum === undefined) return true; + return this._json.enum.includes(name); + } -/*fs.readTextFile = function(file, callback) { - return fs.readFile(file, 'utf8', callback) + /** + * @returns {boolean} + */ + hasAllowedValues() { + return this._json.enum !== undefined; + } + + /** + * @returns {string} + */ + defaultValue() { + return this._json.default; + } + + /** + * @returns {boolean} + */ + hasDefaultValue() { + return this._json.default !== undefined; + } + + /** + * @returns {string[]} + */ + examples() { + return this._json.examples; + } } -fs.readTextFileSync = function(file, callback) { - return fs.readFileSync(file, 'utf8') -}*/ +module.exports = mix(ServerVariable, MixinDescription, MixinSpecificationExtensions); -// json files -fs.readJsonFile = jsonFile.readFile; -fs.readJSONFile = jsonFile.readFile; -fs.readJsonFileSync = jsonFile.readFileSync; -fs.readJSONFileSync = jsonFile.readFileSync; +/***/ }), -fs.readJson = jsonFile.readFile; -fs.readJSON = jsonFile.readFile; -fs.readJsonSync = jsonFile.readFileSync; -fs.readJSONSync = jsonFile.readFileSync; +/***/ 27549: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -fs.outputJsonSync = json.outputJsonSync; -fs.outputJSONSync = json.outputJsonSync; -fs.outputJson = json.outputJson; -fs.outputJSON = json.outputJson; +const { createMapOfType, getMapValueOfType, mix } = __webpack_require__(12065); -fs.writeJsonFile = jsonFile.writeFile; -fs.writeJSONFile = jsonFile.writeFile; -fs.writeJsonFileSync = jsonFile.writeFileSync; -fs.writeJSONFileSync = jsonFile.writeFileSync; +const Base = __webpack_require__(69281); +const ServerVariable = __webpack_require__(96217); +const ServerSecurityRequirement = __webpack_require__(55817); -fs.writeJson = jsonFile.writeFile; -fs.writeJSON = jsonFile.writeFile; -fs.writeJsonSync = jsonFile.writeFileSync; -fs.writeJSONSync = jsonFile.writeFileSync; +const MixinDescription = __webpack_require__(13518); +const MixinBindings = __webpack_require__(58052); +const MixinSpecificationExtensions = __webpack_require__(25999); +/** + * Implements functions to deal with a Server object. + * @class + * @alias module:@asyncapi/parser#Server + * @extends Base + * @mixes MixinDescription + * @mixes MixinBindings + * @mixes MixinSpecificationExtensions + * @returns {Server} + */ +class Server extends Base { + /** + * @returns {string} + */ + url() { + return this._json.url; + } -module.exports = fs + /** + * @returns {string} + */ + protocol() { + return this._json.protocol; + } -jsonFile.spaces = 2; //set to 2 -module.exports.jsonfile = jsonFile; //so users of fs-extra can modify jsonFile.spaces; + /** + * @returns {string} + */ + protocolVersion() { + return this._json.protocolVersion; + } + /** + * @returns {Object} + */ + variables() { + return createMapOfType(this._json.variables, ServerVariable); + } + /** + * @param {string} name - Name of the server variable. + * @returns {ServerVariable} + */ + variable(name) { + return getMapValueOfType(this._json.variables, name, ServerVariable); + } -/***/ }), -/* 227 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + /** + * @returns {boolean} + */ + hasVariables() { + return !!this._json.variables; + } -"use strict"; + /** + * @returns {ServerSecurityRequirement[]} + */ + security() { + if (!this._json.security) return null; + return this._json.security.map(sec => new ServerSecurityRequirement(sec)); + } +} +module.exports = mix(Server, MixinDescription, MixinBindings, MixinSpecificationExtensions); -const stringify = __webpack_require__(382); -/** - * Constants - */ +/***/ }), -const { - MAX_LENGTH, - CHAR_BACKSLASH, /* \ */ - CHAR_BACKTICK, /* ` */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_RIGHT_SQUARE_BRACKET, /* ] */ - CHAR_DOUBLE_QUOTE, /* " */ - CHAR_SINGLE_QUOTE, /* ' */ - CHAR_NO_BREAK_SPACE, - CHAR_ZERO_WIDTH_NOBREAK_SPACE -} = __webpack_require__(807); +/***/ 99065: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Operation = __webpack_require__(35682); /** - * parse + * Implements functions to deal with a SubscribeOperation object. + * @class + * @alias module:@asyncapi/parser#SubscribeOperation + * @extends Operation + * @returns {SubscribeOperation} */ - -const parse = (input, options = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); +class SubscribeOperation extends Operation { + /** + * @returns {boolean} + */ + isPublish() { + return false; } - - let opts = options || {}; - let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - if (input.length > max) { - throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + + /** + * @returns {boolean} + */ + isSubscribe() { + return true; } - let ast = { type: 'root', input, nodes: [] }; - let stack = [ast]; - let block = ast; - let prev = ast; - let brackets = 0; - let length = input.length; - let index = 0; - let depth = 0; - let value; - let memo = {}; - /** - * Helpers + * @returns {string} */ + kind() { + return 'subscribe'; + } +} - const advance = () => input[index++]; - const push = node => { - if (node.type === 'text' && prev.type === 'dot') { - prev.type = 'text'; - } - - if (prev && prev.type === 'text' && node.type === 'text') { - prev.value += node.value; - return; - } +module.exports = SubscribeOperation; - block.nodes.push(node); - node.parent = block; - node.prev = prev; - prev = node; - return node; - }; - push({ type: 'bos' }); +/***/ }), - while (index < length) { - block = stack[stack.length - 1]; - value = advance(); +/***/ 71238: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - /** - * Invalid chars - */ +const { mix } = __webpack_require__(12065); - if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { - continue; - } +const Base = __webpack_require__(69281); - /** - * Escaped chars - */ +const MixinDescription = __webpack_require__(13518); +const MixinExternalDocs = __webpack_require__(44001); +const MixinSpecificationExtensions = __webpack_require__(25999); - if (value === CHAR_BACKSLASH) { - push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); - continue; - } +/** + * Implements functions to deal with a Tag object. + * @class + * @alias module:@asyncapi/parser#Tag + * @extends Base + * @mixes MixinDescription + * @mixes MixinExternalDocs + * @mixes MixinSpecificationExtensions + * @returns {Tag} + */ +class Tag extends Base { + /** + * @returns {string} + */ + name() { + return this._json.name; + } +} - /** - * Right square bracket (literal): ']' - */ +module.exports = mix(Tag, MixinDescription, MixinExternalDocs, MixinSpecificationExtensions); - if (value === CHAR_RIGHT_SQUARE_BRACKET) { - push({ type: 'text', value: '\\' + value }); - continue; - } - /** - * Left square bracket: '[' - */ +/***/ }), - if (value === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; +/***/ 32720: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - let closed = true; - let next; +const path = __webpack_require__(85622); +const Ajv = __webpack_require__(64941); +const fetch = __webpack_require__(80467); +const asyncapi = __webpack_require__(78100); +const $RefParser = __webpack_require__(85862); +const mergePatch = __webpack_require__(29674)/* .apply */ .nn; +const ParserError = __webpack_require__(21978); +const { validateChannels, validateServerVariables, validateOperationId, validateServerSecurity } = __webpack_require__(10254); +const { toJS, findRefs, getLocationOf, improveAjvErrors } = __webpack_require__(12065); +const AsyncAPIDocument = __webpack_require__(41527); - while (index < length && (next = advance())) { - value += next; +const DEFAULT_SCHEMA_FORMAT = 'application/vnd.aai.asyncapi;version=2.0.0'; +const OPERATIONS = ['publish', 'subscribe']; +//the only security types that can have a non empty array in the server security item +const SPECIAL_SECURITY_TYPES = ['oauth2', 'openIdConnect']; +const PARSERS = {}; +const xParserCircle = 'x-parser-circular'; - if (next === CHAR_LEFT_SQUARE_BRACKET) { - brackets++; - continue; - } +/** + * @module @asyncapi/parser + */ +module.exports = { + parse, + parseFromUrl, + registerSchemaParser, + ParserError, + AsyncAPIDocument, +}; - if (next === CHAR_BACKSLASH) { - value += advance(); - continue; - } +/** + * Parses and validate an AsyncAPI document from YAML or JSON. + * + * @param {String} 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. + * @returns {Promise} The parsed AsyncAPI document. + */ +async function parse(asyncapiYAMLorJSON, options = {}) { + let parsedJSON; + let initialFormat; - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - brackets--; + options.path = options.path || `${process.cwd()}${path.sep}`; - if (brackets === 0) { - break; - } - } - } + try { + ({ initialFormat, parsedJSON } = toJS(asyncapiYAMLorJSON)); - push({ type: 'text', value }); - continue; + if (typeof parsedJSON !== 'object') { + throw new ParserError({ + type: 'impossible-to-convert-to-json', + title: 'Could not convert AsyncAPI to JSON.', + detail: 'Most probably the AsyncAPI document contains invalid YAML or YAML features not supported in JSON.' + }); } - - /** - * Parentheses - */ - - if (value === CHAR_LEFT_PARENTHESES) { - block = push({ type: 'paren', nodes: [] }); - stack.push(block); - push({ type: 'text', value }); - continue; + + if (!parsedJSON.asyncapi) { + throw new ParserError({ + type: 'missing-asyncapi-field', + title: 'The `asyncapi` field is missing.', + parsedJSON, + }); } - - if (value === CHAR_RIGHT_PARENTHESES) { - if (block.type !== 'paren') { - push({ type: 'text', value }); - continue; - } - block = stack.pop(); - push({ type: 'text', value }); - block = stack[stack.length - 1]; - continue; + + if (parsedJSON.asyncapi.startsWith('1.') || !asyncapi[parsedJSON.asyncapi]) { + throw new ParserError({ + type: 'unsupported-version', + title: `Version ${parsedJSON.asyncapi} is not supported.`, + detail: 'Please use latest version of the specification.', + parsedJSON, + validationErrors: [getLocationOf('/asyncapi', asyncapiYAMLorJSON, initialFormat)], + }); } - /** - * Quotes: '|"|` - */ + if (options.applyTraits === undefined) options.applyTraits = true; - if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { - let open = value; - let next; + const refParser = new $RefParser; + //because of Ajv lacks support for circular refs, parser should not resolve them before Ajv validation and first needs to ignore them and leave circular $refs to successfully validate the document + //this is done pair to advice from Ajv creator https://github.com/ajv-validator/ajv/issues/1122#issuecomment-559378449 + //later we perform full dereference of circular refs if they occure + await dereference(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, { ...options, dereference: { circular: 'ignore' } }); + + const ajv = new Ajv({ + jsonPointers: true, + allErrors: true, + schemaId: 'id', + logger: false, + }); + + ajv.addMetaSchema(__webpack_require__(52689)); + + const validate = ajv.compile(asyncapi[parsedJSON.asyncapi]); + const valid = validate(parsedJSON); + if (!valid) throw new ParserError({ + type: 'validation-errors', + title: 'There were errors validating the AsyncAPI document.', + parsedJSON, + validationErrors: improveAjvErrors(validate.errors, asyncapiYAMLorJSON, initialFormat), + }); - if (options.keepQuotes !== true) { - value = ''; - } + await customDocumentOperations(parsedJSON, asyncapiYAMLorJSON, initialFormat, options); + if (refParser.$refs.circular) await handleCircularRefs(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, options); + } catch (e) { + if (e instanceof ParserError) throw e; + throw new ParserError({ + type: 'unexpected-error', + title: e.message, + parsedJSON, + }); + } - while (index < length && (next = advance())) { - if (next === CHAR_BACKSLASH) { - value += next + advance(); - continue; - } + return new AsyncAPIDocument(parsedJSON); +} - if (next === open) { - if (options.keepQuotes === true) value += next; - break; - } +/** + * Fetches an AsyncAPI document from the given URL and passes its content to the `parse` method. + * + * @param {String} url URL where the AsyncAPI document is located. + * @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. + * @returns {Promise} The parsed AsyncAPI document. + */ +function parseFromUrl(url, fetchOptions, options) { + //Why not just addinga default to the arguments list? + //All function parameters with default values should be declared after the function parameters without default values. Otherwise, it makes it impossible for callers to take advantage of defaults; they must re-specify the defaulted values or pass undefined in order to "get to" the non-default parameters. + //To not break the API by changing argument position and to silet the linter it is just better to move adding + if (!fetchOptions) fetchOptions = {}; - value += next; - } + return new Promise((resolve, reject) => { + fetch(url, fetchOptions) + .then(res => res.text()) + .then(doc => parse(doc, options)) + .then(result => resolve(result)) + .catch(reject); + }); +} - push({ type: 'text', value }); - continue; - } +async function dereference(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, options) { + try { + return await refParser.dereference(options.path, parsedJSON, { + continueOnError: true, + parse: options.parse, + resolve: options.resolve, + dereference: options.dereference, + }); + } catch (err) { + throw new ParserError({ + type: 'dereference-error', + title: err.errors[0].message, + parsedJSON, + refs: findRefs(err.errors, initialFormat, asyncapiYAMLorJSON), + }); + } +} - /** - * Left curly brace: '{' - */ +/* + * In case of circular refs, this function dereferences the spec again to dereference circular dependencies + * Special property is added to the document that indicates it contains circular refs +*/ +async function handleCircularRefs(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, options) { + await dereference(refParser, parsedJSON, initialFormat, asyncapiYAMLorJSON, { ...options, dereference: { circular: true } }); + //mark entire document as containing circular references + parsedJSON[String(xParserCircle)] = true; +} - if (value === CHAR_LEFT_CURLY_BRACE) { - depth++; +async function customDocumentOperations(parsedJSON, asyncapiYAMLorJSON, initialFormat, options) { + validateServerVariables(parsedJSON, asyncapiYAMLorJSON, initialFormat); + validateServerSecurity(parsedJSON, asyncapiYAMLorJSON, initialFormat, SPECIAL_SECURITY_TYPES); - let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; - let brace = { - type: 'brace', - open: true, - close: false, - dollar, - depth, - commas: 0, - ranges: 0, - nodes: [] - }; + if (!parsedJSON.channels) return; + + validateChannels(parsedJSON, asyncapiYAMLorJSON, initialFormat); + validateOperationId(parsedJSON, asyncapiYAMLorJSON, initialFormat, OPERATIONS); - block = push(brace); - stack.push(block); - push({ type: 'open', value }); - continue; - } + await customChannelsOperations(parsedJSON, asyncapiYAMLorJSON, initialFormat, options); +} - /** - * Right curly brace: '}' - */ +async function validateAndConvertMessage(msg, originalAsyncAPIDocument, fileFormat, parsedAsyncAPIDocument, pathToPayload) { + const schemaFormat = msg.schemaFormat || DEFAULT_SCHEMA_FORMAT; - if (value === CHAR_RIGHT_CURLY_BRACE) { - if (block.type !== 'brace') { - push({ type: 'text', value }); - continue; - } + await PARSERS[String(schemaFormat)]({ + schemaFormat, + message: msg, + defaultSchemaFormat: DEFAULT_SCHEMA_FORMAT, + originalAsyncAPIDocument, + parsedAsyncAPIDocument, + fileFormat, + pathToPayload + }); - let type = 'close'; - block = stack.pop(); - block.close = true; + msg.schemaFormat = DEFAULT_SCHEMA_FORMAT; +} - push({ type, value }); - depth--; +/** + * Registers a new schema parser. Schema parsers are in charge of parsing and transforming payloads to AsyncAPI Schema format. + * + * @param {Object} parserModule The schema parser module containing parse() and getMimeTypes() functions. + */ +function registerSchemaParser(parserModule) { + if (typeof parserModule !== 'object' + || typeof parserModule.parse !== 'function' + || typeof parserModule.getMimeTypes !== 'function') + throw new ParserError({ + type: 'impossible-to-register-parser', + title: 'parserModule must have parse() and getMimeTypes() functions.' + }); - block = stack[stack.length - 1]; - continue; + parserModule.getMimeTypes().forEach((schemaFormat) => { + PARSERS[String(schemaFormat)] = parserModule.parse; + }); +} + +function applyTraits(js) { + if (Array.isArray(js.traits)) { + for (const trait of js.traits) { + for (const key in trait) { + js[String(key)] = mergePatch(js[String(key)], trait[String(key)]); + } } - /** - * Comma: ',' - */ + js['x-parser-original-traits'] = js.traits; + delete js.traits; + } +} - if (value === CHAR_COMMA && depth > 0) { - if (block.ranges > 0) { - block.ranges = 0; - let open = block.nodes.shift(); - block.nodes = [open, { type: 'text', value: stringify(block) }]; +/** + * Triggers additional operations on the AsyncAPI channels like traits application or message validation and conversion + * + * @private + * + * @param {Object} parsedJSON parsed AsyncAPI document + * @param {String} asyncapiYAMLorJSON AsyncAPI document in string + * @param {String} initialFormat information of the document was oryginally JSON or YAML + * @param {Object} options Configuration options. + */ +async function customChannelsOperations(parsedJSON, asyncapiYAMLorJSON, initialFormat, options) { + const promisesArray = []; + Object.entries(parsedJSON.channels).forEach(([channelName, channel]) => { + promisesArray.push(...OPERATIONS.map(async (opName) => { + const op = channel[String(opName)]; + if (!op) return; + + const messages = op.message ? (op.message.oneOf || [op.message]) : []; + if (options.applyTraits) { + applyTraits(op); + messages.forEach(m => applyTraits(m)); + } + const pathToPayload = `/channels/${channelName}/${opName}/message/payload`; + for (const m of messages) { + await validateAndConvertMessage(m, asyncapiYAMLorJSON, initialFormat, parsedJSON, pathToPayload); } + })); + }); + await Promise.all(promisesArray); +} - push({ type: 'comma', value }); - block.commas++; - continue; - } +/***/ }), - /** - * Dot: '.' - */ +/***/ 12065: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - if (value === CHAR_DOT && depth > 0 && block.commas === 0) { - let siblings = block.nodes; +const YAML = __webpack_require__(21917); +const { yamlAST, loc } = __webpack_require__(54178); +const jsonAST = __webpack_require__(86675); +const jsonParseBetterErrors = __webpack_require__(78280); +const ParserError = __webpack_require__(21978); - if (depth === 0 || siblings.length === 0) { - push({ type: 'text', value }); - continue; - } +const jsonPointerToArray = jsonPointer => (jsonPointer || '/').split('/').splice(1); - if (prev.type === 'dot') { - block.range = []; - prev.value += value; - prev.type = 'range'; +const utils = module.exports; - if (block.nodes.length !== 3 && block.nodes.length !== 5) { - block.invalid = true; - block.ranges = 0; - prev.type = 'text'; - continue; - } +const getAST = (asyncapiYAMLorJSON, initialFormat) => { + if (initialFormat === 'yaml') { + return yamlAST(asyncapiYAMLorJSON); + } else if (initialFormat === 'json') { + return jsonAST(asyncapiYAMLorJSON); + } +}; - block.ranges++; - block.args = []; - continue; - } +const findNode = (obj, location) => { + for (const key of location) { + obj = obj ? obj[utils.untilde(key)] : null; + } + return obj; +}; - if (prev.type === 'range') { - siblings.pop(); +const findNodeInAST = (ast, location) => { + let obj = ast; + for (const key of location) { + if (!Array.isArray(obj.children)) return; + let childArray; - let before = siblings[siblings.length - 1]; - before.value += prev.value + value; - prev = before; - block.ranges--; - continue; - } + const child = obj.children.find(c => { + if (!c) return; - push({ type: 'dot', value }); - continue; - } + if (c.type === 'Object') return childArray = c.children.find(a => a.key.value === utils.untilde(key)); + return c.type === 'Property' && c.key && c.key.value === utils.untilde(key); + }); - /** - * Text - */ + if (!child) return; + obj = childArray ? childArray.value : child.value; + } + return obj; +}; - push({ type: 'text', value }); +const findLocationOf = (keys, ast, initialFormat) => { + if (initialFormat === 'js') return { jsonPointer: `/${keys.join('/')}` }; + + let node; + if (initialFormat === 'yaml') { + node = findNode(ast, keys); + } else if (initialFormat === 'json') { + node = findNodeInAST(ast, keys); } - // Mark imbalanced braces and brackets as invalid - do { - block = stack.pop(); + if (!node) return { jsonPointer: `/${keys.join('/')}` }; - if (block.type !== 'root') { - block.nodes.forEach(node => { - if (!node.nodes) { - if (node.type === 'open') node.isOpen = true; - if (node.type === 'close') node.isClose = true; - if (!node.nodes) node.type = 'text'; - node.invalid = true; - } - }); + let info; + if (initialFormat === 'yaml') { + // disable eslint because loc is a Symbol + // eslint-disable-next-line security/detect-object-injection + info = node[loc]; + } else if (initialFormat === 'json') { + info = node.loc; + } - // get the location of the block on parent.nodes (block's siblings) - let parent = stack[stack.length - 1]; - let index = parent.nodes.indexOf(block); - // replace the (invalid) block with it's nodes - parent.nodes.splice(index, 1, ...block.nodes); + if (!info) return { jsonPointer: `/${keys.join('/')}` }; + + return { + jsonPointer: `/${keys.join('/')}`, + startLine: info.start.line, + startColumn: info.start.column + 1, + startOffset: info.start.offset, + endLine: info.end ? info.end.line : undefined, + endColumn: info.end ? info.end.column + 1 : undefined, + endOffset: info.end ? info.end.offset : undefined, + }; +}; + +const getMapValue = (obj, key, Type) => { + if (typeof key !== 'string' || !obj) return null; + const v = obj[String(key)]; + if (v === undefined) return null; + return Type ? new Type(v) : v; +}; + +utils.tilde = (str) => { + return str.replace(/[~\/]{1}/g, (m) => { + switch (m) { + case '/': return '~1'; + case '~': return '~0'; } - } while (stack.length > 0); + return m; + }); +}; - push({ type: 'eos' }); - return ast; +utils.untilde = (str) => { + if (!str.includes('~')) return str; + return str.replace(/~[01]/g, (m) => { + switch (m) { + case '~1': return '/'; + case '~0': return '~'; + } + return m; + }); }; -module.exports = parse; +utils.toJS = (asyncapiYAMLorJSON) => { + if (!asyncapiYAMLorJSON) { + throw new ParserError({ + type: 'null-or-falsey-document', + title: 'Document can\'t be null or falsey.', + }); + } + + if (asyncapiYAMLorJSON.constructor && asyncapiYAMLorJSON.constructor.name === 'Object') { + return { + initialFormat: 'js', + parsedJSON: asyncapiYAMLorJSON, + }; + } + + if (typeof asyncapiYAMLorJSON !== 'string') { + throw new ParserError({ + type: 'invalid-document-type', + title: 'The AsyncAPI document has to be either a string or a JS object.', + }); + } + if (asyncapiYAMLorJSON.trimLeft().startsWith('{')) { + try { + return { + initialFormat: 'json', + parsedJSON: jsonParseBetterErrors(asyncapiYAMLorJSON), + }; + } catch (e) { + throw new ParserError({ + type: 'invalid-json', + title: 'The provided JSON is not valid.', + detail: e.message, + location: { + startOffset: e.offset, + startLine: e.startLine, + startColumn: e.startColumn, + }, + }); + } + } else { + try { + return { + initialFormat: 'yaml', + parsedJSON: YAML.safeLoad(asyncapiYAMLorJSON), + }; + } catch (err) { + throw new ParserError({ + type: 'invalid-yaml', + title: 'The provided YAML is not valid.', + detail: err.message, + location: { + startOffset: err.mark.position, + startLine: err.mark.line + 1, + startColumn: err.mark.column + 1, + }, + }); + } + } +}; +utils.createMapOfType = (obj, Type) => { + const result = {}; + if (!obj) return result; -/***/ }), -/* 228 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + Object.entries(obj).forEach(([key, value]) => { + result[String(key)] = new Type(value); + }); -"use strict"; + return result; +}; +utils.getMapValueOfType = (obj, key, Type) => { + return getMapValue(obj, key, Type); +}; -var Type = __webpack_require__(945); +utils.getMapValueByKey = (obj, key) => { + return getMapValue(obj, key); +}; -function resolveYamlBoolean(data) { - if (data === null) return false; +/** + * Extends a given model with additional methods related to frequently recurring models + * @function mix + * @private + * @param {Object} model model to extend + * @param {Array} mixins array with mixins to extend the model with + */ +utils.mix = (model, ...mixins) => { + let duplicatedMethods = false; + function checkDuplication(mixin) { + // check duplication of model in mixins array + if (model === mixin) return true; + // check duplication of model's methods + duplicatedMethods = Object.keys(mixin).some(mixinMethod => model.prototype.hasOwnProperty(mixinMethod)); + return duplicatedMethods; + } + + if (mixins.some(checkDuplication)) { + if (duplicatedMethods) { + throw new Error(`invalid mix function: model ${model.name} has at least one method that it is trying to replace by mixin`); + } else { + throw new Error(`invalid mix function: cannot use the model ${model.name} as a mixin`); + } + } + mixins.forEach(mixin => Object.assign(model.prototype, mixin)); + return model; +}; - var max = data.length; +utils.findRefs = (errors, initialFormat, asyncapiYAMLorJSON) => { + let refs = []; - return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) || - (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE')); -} + errors.map(({ path }) => refs.push({ location: [...path.map(utils.tilde), '$ref'] })); -function constructYamlBoolean(data) { - return data === 'true' || - data === 'True' || - data === 'TRUE'; -} + if (initialFormat === 'js') { + return refs.map(ref => ({ jsonPointer: `/${ref.location.join('/')}` })); + } -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} + if (initialFormat === 'yaml') { + const pseudoAST = yamlAST(asyncapiYAMLorJSON); + refs = refs.map(ref => findLocationOf(ref.location, pseudoAST, initialFormat)); + } else if (initialFormat === 'json') { + const ast = jsonAST(asyncapiYAMLorJSON); + refs = refs.map(ref => findLocationOf(ref.location, ast, initialFormat)); + } -module.exports = new Type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { return object ? 'true' : 'false'; }, - uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; }, - camelcase: function (object) { return object ? 'True' : 'False'; } - }, - defaultStyle: 'lowercase' -}); + return refs; +}; +utils.getLocationOf = (jsonPointer, asyncapiYAMLorJSON, initialFormat) => { + const ast = getAST(asyncapiYAMLorJSON, initialFormat); + if (!ast) return { jsonPointer }; -/***/ }), -/* 229 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + return findLocationOf(jsonPointerToArray(jsonPointer), ast, initialFormat); +}; + +utils.improveAjvErrors = (errors, asyncapiYAMLorJSON, initialFormat) => { + const ast = getAST(asyncapiYAMLorJSON, initialFormat); + return errors.map(error => { + const defaultLocation = { jsonPointer: error.dataPath || '/' }; -const Operation = __webpack_require__(573); + return { + title: `${error.dataPath || '/'} ${error.message}`, + location: ast ? findLocationOf(jsonPointerToArray(error.dataPath), ast, initialFormat) : defaultLocation, + }; + }); +}; /** - * Implements functions to deal with a SubscribeOperation object. - * @class - * @extends Operation - * @returns {SubscribeOperation} + * It parses the string and returns an array with all values that are between curly braces, including braces + * @function parseUrlVariables + * @private */ -class SubscribeOperation extends Operation { - /** - * @returns {boolean} - */ - isPublish() { - return false; - } +utils.parseUrlVariables = str => { + if (typeof str !== 'string') return; + + return str.match(/{(.+?)}/g); +}; + +/** + * It parses the string and returns url parameters as string + * @function parseUrlQueryParameters + * @private + */ +utils.parseUrlQueryParameters = str => { + if (typeof str !== 'string') return; - /** - * @returns {boolean} - */ - isSubscribe() { - return true; - } + return str.match(/\?((.*=.*)(&?))/g); +}; - /** - * @returns {string} - */ - kind() { - return 'subscribe'; - } -} +/** + * Returns an array of not existing properties in provided object with names specified in provided array + * @function getMissingProps + * @private + */ +utils.getMissingProps = (arr, obj) => { + arr = arr.map(val => val.replace(/[{}]/g, '')); -module.exports = SubscribeOperation; + if (!obj) return arr; + + return arr.filter(val => { + return !obj.hasOwnProperty(val); + }); +}; +/** + * Returns array of errors messages compatible with validationErrors parameter from ParserError + * + * @function groupValidationErrors + * @private + * @param {String} root name of the root element in the AsyncAPI document, for example channels + * @param {String} errorMessage the text of the custom error message that will follow the path that points the error + * @param {Map} errorElements map of error elements cause the validation error might happen in many places in the document. + * The key should have a path information where the error was found, the value holds information about error element but it is not mandatory + * @param {String} asyncapiYAMLorJSON AsyncAPI document in string + * @param {String} initialFormat information of the document was oryginally JSON or YAML + * @returns {Array} Object has always 2 keys, title and location. Title is a combination of errorElement key + errorMessage + errorElement value. + * Location is the object with information about location of the issue in the file and json Pointer + */ +utils.groupValidationErrors = (root, errorMessage, errorElements, asyncapiYAMLorJSON, initialFormat) => { + const errors = []; -/***/ }), -/* 230 */, -/* 231 */, -/* 232 */, -/* 233 */ -/***/ (function(module) { + errorElements.forEach((val, key) => { + if (typeof val === 'string') val = utils.untilde(val); -"use strict"; + errors.push({ + title: val ? `${ utils.untilde(key) } ${errorMessage}: ${val}` : `${ utils.untilde(key) } ${errorMessage}`, + location: utils.getLocationOf(`/${root}/${key}`, asyncapiYAMLorJSON, initialFormat) + }); + }); -module.exports = function generate_dependencies(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $schemaDeps = {}, - $propertyDeps = {}, - $ownProperties = it.opts.ownProperties; - for ($property in $schema) { - var $sch = $schema[$property]; - var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; - $deps[$property] = $sch; - } - out += 'var ' + ($errs) + ' = errors;'; - var $currentErrorPath = it.errorPath; - out += 'var missing' + ($lvl) + ';'; - for (var $property in $propertyDeps) { - $deps = $propertyDeps[$property]; - if ($deps.length) { - out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; - } - if ($breakOnError) { - out += ' && ( '; - var arr1 = $deps; - if (arr1) { - var $propertyKey, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $propertyKey = arr1[$i += 1]; - if ($i) { - out += ' || '; - } - var $prop = it.util.getProperty($propertyKey), - $useData = $data + $prop; - out += ' ( ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; - } - } - out += ')) { '; - var $propertyPath = 'missing' + $lvl, - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should have '; - if ($deps.length == 1) { - out += 'property ' + (it.util.escapeQuotes($deps[0])); - } else { - out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))); - } - out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { - /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } else { - out += ' ) { '; - var arr2 = $deps; - if (arr2) { - var $propertyKey, i2 = -1, - l2 = arr2.length - 1; - while (i2 < l2) { - $propertyKey = arr2[i2 += 1]; - var $prop = it.util.getProperty($propertyKey), - $missingProperty = it.util.escapeQuotes($propertyKey), - $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should have '; - if ($deps.length == 1) { - out += 'property ' + (it.util.escapeQuotes($deps[0])); - } else { - out += 'properties ' + (it.util.escapeQuotes($deps.join(", "))); - } - out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; - } - } - } - out += ' } '; - if ($breakOnError) { - $closingBraces += '}'; - out += ' else { '; - } - } + return errors; +}; + +/** + * extend map with channel params missing corresponding param object + * + * @function setNotProvidedParams + * @private + * @param {Array} variables array of all identified URL variables in a channel name + * @param {Object} val the channel object for which to identify the missing parameters + * @param {String} key the channel name. + * @param {Array} notProvidedChannelParams concatinated list of missing parameters for all channels + * @param {Map} notProvidedParams result map of all missing parameters extended by this function + */ +utils.setNotProvidedParams = (variables, val, key, notProvidedChannelParams, notProvidedParams) => { + const missingChannelParams = utils.getMissingProps(variables, val.parameters); + + if (missingChannelParams.length) { + notProvidedParams.set(utils.tilde(key), + notProvidedChannelParams + ? notProvidedChannelParams.concat(missingChannelParams) + : missingChannelParams); } - it.errorPath = $currentErrorPath; - var $currentBaseId = $it.baseId; - for (var $property in $schemaDeps) { - var $sch = $schemaDeps[$property]; - if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) { - out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') '; - } - out += ') { '; - $it.schema = $sch; - $it.schemaPath = $schemaPath + it.util.getProperty($property); - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property); - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } +}; + +/***/ }), + +/***/ 54443: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const yaml = __webpack_require__(21917); +const r2j = __webpack_require__(33601); + +module.exports = { + parse, + getMimeTypes +}; + +async function parse({ message, defaultSchemaFormat }) { + try { + let payload = message.payload; + if (typeof payload === 'object') { + payload = `#%RAML 1.0 Library\n${ + yaml.safeDump({ types: { tmpType: payload } })}`; } + + // Draft 6 is compatible with 7. + const jsonModel = await r2j.dt2js(payload, 'tmpType', { draft: '06' }); + const convertedType = jsonModel.definitions.tmpType; + + message['x-parser-original-schema-format'] = message.schemaFormat || defaultSchemaFormat; + message['x-parser-original-payload'] = payload; + message.payload = convertedType; + delete message.schemaFormat; + } catch (e) { + console.error(e); } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - out = it.util.cleanUpCode(out); - return out; +}; + +function getMimeTypes() { + return [ + 'application/raml+yaml;version=1.0', + ]; } + /***/ }), -/* 234 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -var npm = __webpack_require__(48); -var fs = __webpack_require__(747); -var path = __webpack_require__(622); -var semver = __webpack_require__(280); +/***/ 78100: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var LOAD_ERR = 'NPM_LOAD_ERR', - INSTALL_ERR = 'NPM_INSTALL_ERR', - VIEW_ERR = 'NPM_VIEW_ERR'; +module.exports = { + '1.0.0': __webpack_require__(26727), + '1.1.0': __webpack_require__(56409), + '1.2.0': __webpack_require__(14679), + '2.0.0-rc1': __webpack_require__(34146), + '2.0.0-rc2': __webpack_require__(49121), + '2.0.0': __webpack_require__(88547), +}; -/** - * Created with IntelliJ IDEA. - * User: leiko - * Date: 30/01/14 - * Time: 10:28 - */ -var npmi = function (options, callback) { - callback = callback || function () {}; - var name = options.name, - pkgName = options.pkgName || name, - version = options.version || 'latest', - installPath = options.path || '.', - forceInstall = options.forceInstall || false, - localInstall = options.localInstall || false, - npmLoad = options.npmLoad || {loglevel: 'silent'}, - savedPrefix = null; +/***/ }), - function viewCallback(installedVersion) { - return function (err, view) { - if (err) { - // reset npm.prefix to saved value - npm.prefix = savedPrefix; - err.code = VIEW_ERR; - return callback(err); - } +/***/ 54178: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - // npm view success - var latestVersion = Object.keys(view)[0]; - if ((typeof latestVersion !== 'undefined') && (latestVersion === installedVersion)) { - // reset npm.prefix to saved value - npm.prefix = savedPrefix; - return callback(); - } else { - npm.commands.install(installPath, [name+'@'+latestVersion], installCallback); - } - } - } +const { load, Kind } = __webpack_require__(68342); - function checkInstalled(isTarball) { - var module = name+'@'+version; +const loc = Symbol('pseudo-yaml-ast-loc'); +const hasOwnProp = (obj, key) => (obj && typeof obj === 'object' && Object.prototype.hasOwnProperty.call(obj, key)); +const isUndefined = v => v === undefined; +const isNull = v => v === null; - if (isTarball) { - module = name; - if (pkgName === name) { - console.warn('npmi warn: install "'+name+'" from tarball/folder without options.pkgName specified => forceInstall: true'); - } - } +const isPrimitive = v => + Number.isNaN(v) || isNull(v) || isUndefined(v) || typeof v === 'symbol'; - // check that version matches - fs.readFile(path.resolve(installPath, 'node_modules', pkgName, 'package.json'), function (err, pkgRawData) { - if (err) { - // hmm, something went wrong while reading module's package.json file - // lets try to reinstall it just in case - return npm.commands.install(installPath, [module], installCallback); - } +const isPrimitiveNode = node => + isPrimitive(node.value) || !hasOwnProp(node, 'value'); - var pkg = JSON.parse(pkgRawData); - if (version === 'latest') { - // specified version is "latest" which means nothing for a comparison check - if (isTarball) { - // when a package is already installed and it comes from a tarball, you have to specify - // a real version => warn - console.warn('npmi warn: install from tarball without options.version specified => forceInstall: true'); - return npm.commands.install(installPath, [module], installCallback); - } else { - // so we need to ask npm to give us a view of the module from remote registry - // in order to check if it really is the latest one that is currently installed - return npm.commands.view([name], true, viewCallback(pkg.version)); - } +const isBetween = (start, pos, end) => pos <= end && pos >= start; - } else if (pkg.version === version) { - // package is installed and version matches - // reset npm.prefix to saved value - npm.prefix = savedPrefix; - return callback(); +const getLoc = (input, { start = 0, end = 0 }) => { + const lines = input.split(/\n/); - } else { - // version does not match: reinstall - return npm.commands.install(installPath, [module], installCallback); - } - }); - } + const loc = { + start: {}, + end: {} + }; - function installCallback(err, result) { - // reset npm.prefix to saved value - npm.prefix = savedPrefix; + let sum = 0; - if (err) { - err.code = INSTALL_ERR; - } + for (const i of lines.keys()) { + const line = lines[i]; + const ls = sum; + const le = sum + line.length; - callback(err, result); + if (isUndefined(loc.start.line) && isBetween(ls, start, le)) { + loc.start.line = i + 1; + loc.start.column = start - ls; + loc.start.offset = start; } - function loadCallback(err) { - if (err) { - err.code = LOAD_ERR; - return callback(err); - } + if (isUndefined(loc.end.line) && isBetween(ls, end, le)) { + loc.end.line = i + 1; + loc.end.column = end - ls; + loc.end.offset = end; + } - // npm loaded successfully - savedPrefix = npm.prefix; // save current npm.prefix - npm.prefix = installPath; // change npm.prefix to given installPath - if (!name) { - // just want to do an "npm install" where a package.json is - npm.commands.install(installPath, [], installCallback); + sum = le + 1; // +1 because the break is also a char + } - } else if (localInstall) { - if (forceInstall) { - // local install won't work with version specified - npm.commands.install(installPath, [name], installCallback); - } else { - // check if there is already a local install of this module - fs.readFile(path.resolve(name, 'package.json'), 'utf8', function (err, sourcePkgData) { - if (err) { - // reset npm.prefix to saved value - npm.prefix = savedPrefix; - callback(err); + return loc; +}; - } else { - try { - var sourcePkg = JSON.parse(sourcePkgData) - } catch (err) { - // reset npm.prefix to saved value - npm.prefix = savedPrefix; - callback(err); - return; - } +const visitors = { + MAP: (node = {}, input = '', ctx = {}) => + Object.assign(walk(node.mappings, input), { + [loc]: getLoc(input, { + start: node.startPosition, + end: node.endPosition + }) + }), + MAPPING: (node = {}, input = '', ctx = {}) => { + const value = walk([node.value], input); + + if (!isPrimitive(value)) { + value[loc] = getLoc(input, { + start: node.startPosition, + end: node.endPosition + }); + } - var pkgName = sourcePkg.name || path.basename(name); - fs.readFile(path.resolve(installPath, 'node_modules', pkgName, 'package.json'), 'utf8', function (err, targetPkgData) { - if (err) { - // file probably doesn't exist, or is corrupted: install - // local install won't work with version specified - npm.commands.install(installPath, [name], installCallback); - } else { - // there is a module that looks a lot like the one you want to install: do some checks - try { - var targetPkg = JSON.parse(targetPkgData); - } catch (err) { - // reset npm.prefix to saved value - npm.prefix = savedPrefix; - callback(err); - return; - } + return Object.assign(ctx, { + [node.key.value]: value + }); + }, + SCALAR: (node = {}, input = '') => { + if (isPrimitiveNode(node)) { + return node.value; + } - if (semver.gt(sourcePkg.version, targetPkg.version)) { - // install because current found version seems outdated - // local install won't work with version specified - npm.commands.install(installPath, [name], installCallback); - } else { - // reset npm.prefix to saved value - npm.prefix = savedPrefix; - callback(); - } - } - }); - } - }); - } - } else { - if (forceInstall) { - // reinstall package module - if (name.indexOf('/') === -1) { - // not a tarball - npm.commands.install(installPath, [name+'@'+version], installCallback); - } else { - // do not specify version for tarball - npm.commands.install(installPath, [name], installCallback); - } - - } else { - // check if package is installed - checkInstalled(name.indexOf('/') !== -1); - } - } - } - - npm.load(npmLoad, loadCallback); -}; - -npmi.LOAD_ERR = LOAD_ERR; -npmi.INSTALL_ERR = INSTALL_ERR; -npmi.VIEW_ERR = VIEW_ERR; + const _loc = getLoc(input, { + start: node.startPosition, + end: node.endPosition + }); -npmi.NPM_VERSION = npm.version; + const wrappable = Constructor => () => { + const v = new Constructor(node.value); + v[loc] = _loc; + return v; + }; -module.exports = npmi; + const object = () => { + node.value[loc] = _loc; + return node.value; + }; -/***/ }), -/* 235 */, -/* 236 */, -/* 237 */ -/***/ (function(module) { + const types = { + boolean: wrappable(Boolean), + number: wrappable(Number), + string: wrappable(String), + function: object, + object + }; -"use strict"; + return types[typeof node.value](); + }, + SEQ: (node = {}, input = '') => { + const items = walk(node.items, input, []); + items[loc] = getLoc(input, { + start: node.startPosition, + end: node.endPosition + }); -var traverse = module.exports = function (schema, opts, cb) { - // Legacy support for v0.3.1 and earlier. - if (typeof opts == 'function') { - cb = opts; - opts = {}; + return items; } - - cb = opts.cb || cb; - var pre = (typeof cb == 'function') ? cb : cb.pre || function() {}; - var post = cb.post || function() {}; - - _traverse(opts, pre, post, schema, '', schema); }; +const walk = (nodes = [], input, ctx = {}) => { + const onNode = (node, ctx, fallback) => { + let visitor; + if (node) visitor = visitors[Kind[node.kind]]; + return visitor ? visitor(node, input, ctx) : fallback; + }; -traverse.keywords = { - additionalItems: true, - items: true, - contains: true, - additionalProperties: true, - propertyNames: true, - not: true -}; - -traverse.arrayKeywords = { - items: true, - allOf: true, - anyOf: true, - oneOf: true -}; + const walkObj = () => + nodes.reduce((sum, node) => { + return onNode(node, sum, sum); + }, ctx); -traverse.propsKeywords = { - definitions: true, - properties: true, - patternProperties: true, - dependencies: true -}; + const walkArr = () => + nodes.map(node => onNode(node, ctx, null), ctx).filter(Boolean); -traverse.skipKeywords = { - default: true, - enum: true, - const: true, - required: true, - maximum: true, - minimum: true, - exclusiveMaximum: true, - exclusiveMinimum: true, - multipleOf: true, - maxLength: true, - minLength: true, - pattern: true, - format: true, - maxItems: true, - minItems: true, - uniqueItems: true, - maxProperties: true, - minProperties: true + return Array.isArray(ctx) ? walkArr() : walkObj(); }; - -function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { - if (schema && typeof schema == 'object' && !Array.isArray(schema)) { - pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); - for (var key in schema) { - var sch = schema[key]; - if (Array.isArray(sch)) { - if (key in traverse.arrayKeywords) { - for (var i=0; i walk([load(input)], input); /***/ }), -/* 238 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; +/***/ 50326: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -const Options = __webpack_require__(16); - -module.exports = normalizeArgs; +"use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Ono = void 0; +const extend_error_1 = __webpack_require__(43561); +const normalize_1 = __webpack_require__(19322); +const to_json_1 = __webpack_require__(24833); +const constructor = Ono; +exports.Ono = constructor; /** - * Normalizes the given arguments, accounting for optional args. - * - * @param {Arguments} args - * @returns {object} + * Creates an `Ono` instance for a specifc error type. */ -function normalizeArgs (args) { - let path, schema, options, callback; - args = Array.prototype.slice.call(args); - - if (typeof args[args.length - 1] === "function") { - // The last parameter is a callback function - callback = args.pop(); - } - - if (typeof args[0] === "string") { - // The first parameter is the path - path = args[0]; - if (typeof args[2] === "object") { - // The second parameter is the schema, and the third parameter is the options - schema = args[1]; - options = args[2]; +// eslint-disable-next-line @typescript-eslint/naming-convention +function Ono(ErrorConstructor, options) { + options = normalize_1.normalizeOptions(options); + function ono(...args) { + let { originalError, props, message } = normalize_1.normalizeArgs(args, options); + // Create a new error of the specified type + let newError = new ErrorConstructor(message); + // Extend the error with the properties of the original error and the `props` object + return extend_error_1.extendError(newError, originalError, props); + } + ono[Symbol.species] = ErrorConstructor; + return ono; +} +/** + * Returns an object containing all properties of the given Error object, + * which can be used with `JSON.stringify()`. + */ +Ono.toJSON = function toJSON(error) { + return to_json_1.toJSON.call(error); +}; +/** + * Extends the given Error object with enhanced Ono functionality, such as nested stack traces, + * additional properties, and improved support for `JSON.stringify()`. + */ +Ono.extend = function extend(error, originalError, props) { + if (props || originalError instanceof Error) { + return extend_error_1.extendError(error, originalError, props); + } + else if (originalError) { + return extend_error_1.extendError(error, undefined, originalError); } else { - // The second parameter is the options - schema = undefined; - options = args[1]; + return extend_error_1.extendError(error); } - } - else { - // The first parameter is the schema - path = ""; - schema = args[0]; - options = args[1]; - } - - if (!(options instanceof Options)) { - options = new Options(options); - } - - return { - path, - schema, - options, - callback - }; -} - +}; +//# sourceMappingURL=constructor.js.map /***/ }), -/* 239 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -var deepEqual = __webpack_require__(253); -var convert = __webpack_require__(302); - -module.exports = openapiSchemaToJsonSchema; -module.exports.fromSchema = openapiSchemaToJsonSchema; -module.exports.fromParameter = openapiParameterToJsonSchema; -function openapiSchemaToJsonSchema(schema, options) { - options = resolveOptions(options); +/***/ 43561: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - if (options.cloneSchema) { - schema = JSON.parse(JSON.stringify(schema)); - } +"use strict"; - var jsonSchema = convert.fromSchema(schema, options); - return jsonSchema; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.extendError = void 0; +const isomorphic_node_1 = __webpack_require__(26315); +const stack_1 = __webpack_require__(55254); +const to_json_1 = __webpack_require__(24833); +const protectedProps = ["name", "message", "stack"]; +/** + * Extends the new error with the properties of the original error and the `props` object. + * + * @param newError - The error object to extend + * @param originalError - The original error object, if any + * @param props - Additional properties to add, if any + */ +function extendError(error, originalError, props) { + let onoError = error; + extendStack(onoError, originalError); + // Copy properties from the original error + if (originalError && typeof originalError === "object") { + mergeErrors(onoError, originalError); + } + // The default `toJSON` method doesn't output props like `name`, `message`, `stack`, etc. + // So replace it with one that outputs every property of the error. + onoError.toJSON = to_json_1.toJSON; + // On Node.js, add support for the `util.inspect()` method + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (isomorphic_node_1.addInspectMethod) { + isomorphic_node_1.addInspectMethod(onoError); + } + // Finally, copy custom properties that were specified by the user. + // These props OVERWRITE any previous props + if (props && typeof props === "object") { + Object.assign(onoError, props); + } + return onoError; } - -function openapiParameterToJsonSchema(parameter, options) { - options = resolveOptions(options); - - if (options.cloneSchema) { - parameter = JSON.parse(JSON.stringify(parameter)); - } - - var jsonSchema = convert.fromParameter(parameter, options); - return jsonSchema; +exports.extendError = extendError; +/** + * Extend the error stack to include its cause + */ +function extendStack(newError, originalError) { + let stackProp = Object.getOwnPropertyDescriptor(newError, "stack"); + if (stack_1.isLazyStack(stackProp)) { + stack_1.lazyJoinStacks(stackProp, newError, originalError); + } + else if (stack_1.isWritableStack(stackProp)) { + newError.stack = stack_1.joinStacks(newError, originalError); + } } +/** + * Merges properties of the original error with the new error. + * + * @param newError - The error object to extend + * @param originalError - The original error object, if any + */ +function mergeErrors(newError, originalError) { + // Get the original error's keys + // NOTE: We specifically exclude properties that we have already set on the new error. + // This is _especially_ important for the `stack` property, because this property has + // a lazy getter in some environments + let keys = to_json_1.getDeepKeys(originalError, protectedProps); + // HACK: We have to cast the errors to `any` so we can use symbol indexers. + // see https://github.com/Microsoft/TypeScript/issues/1863 + let _newError = newError; + let _originalError = originalError; + for (let key of keys) { + if (_newError[key] === undefined) { + try { + _newError[key] = _originalError[key]; + } + catch (e) { + // This property is read-only, so it can't be copied + } + } + } +} +//# sourceMappingURL=extend-error.js.map -function resolveOptions(options) { - var notSupported = [ - 'nullable', 'discriminator', 'readOnly', - 'writeOnly', 'xml', 'externalDocs', - 'example', 'deprecated' - ]; - - options = options || {}; - options.dateToDateTime = options.dateToDateTime || false; - options.cloneSchema = options.cloneSchema == false ? false : true; - options.supportPatternProperties = options.supportPatternProperties || false; - options.keepNotSupported = options.keepNotSupported || []; - options.strictMode = options.strictMode == false ? false : true; - - if (typeof options.patternPropertiesHandler !== 'function') { - options.patternPropertiesHandler = patternPropertiesHandler; - } - - options._removeProps = []; - - if (options.removeReadOnly === true) { - options._removeProps.push('readOnly'); - } +/***/ }), - if (options.removeWriteOnly === true) { - options._removeProps.push('writeOnly'); - } +/***/ 33436: +/***/ (function(module, exports, __webpack_require__) { - options._structs = ['allOf', 'anyOf', 'oneOf', 'not', 'items', 'additionalProperties']; - options._notSupported = resolveNotSupported(notSupported, options.keepNotSupported); +"use strict"; - return options; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ono = void 0; +/* eslint-env commonjs */ +const singleton_1 = __webpack_require__(54760); +Object.defineProperty(exports, "ono", ({ enumerable: true, get: function () { return singleton_1.ono; } })); +var constructor_1 = __webpack_require__(50326); +Object.defineProperty(exports, "Ono", ({ enumerable: true, get: function () { return constructor_1.Ono; } })); +__exportStar(__webpack_require__(97905), exports); +exports.default = singleton_1.ono; +// CommonJS default export hack +if ( true && typeof module.exports === "object") { + module.exports = Object.assign(module.exports.default, module.exports); } +//# sourceMappingURL=index.js.map -function patternPropertiesHandler(schema) { - var pattern; - var patternsObj = schema.patternProperties; - var additProps = schema.additionalProperties; +/***/ }), - if (typeof additProps !== 'object') { - return schema; - } +/***/ 26315: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - for (pattern in patternsObj) { - if (deepEqual(patternsObj[pattern], additProps)) { - schema.additionalProperties = false; - break; - } - } +"use strict"; - return schema; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.addInspectMethod = exports.format = void 0; +const util = __webpack_require__(31669); +const to_json_1 = __webpack_require__(24833); +// The `inspect()` method is actually a Symbol, not a string key. +// https://nodejs.org/api/util.html#util_util_inspect_custom +const inspectMethod = util.inspect.custom || Symbol.for("nodejs.util.inspect.custom"); +/** + * Ono supports Node's `util.format()` formatting for error messages. + * + * @see https://nodejs.org/api/util.html#util_util_format_format_args + */ +exports.format = util.format; +/** + * Adds an `inspect()` method to support Node's `util.inspect()` function. + * + * @see https://nodejs.org/api/util.html#util_util_inspect_custom + */ +function addInspectMethod(newError) { + // @ts-expect-error - TypeScript doesn't support symbol indexers + newError[inspectMethod] = inspect; +} +exports.addInspectMethod = addInspectMethod; +/** + * Returns a representation of the error for Node's `util.inspect()` method. + * + * @see https://nodejs.org/api/util.html#util_custom_inspection_functions_on_objects + */ +function inspect() { + // HACK: We have to cast the objects to `any` so we can use symbol indexers. + // see https://github.com/Microsoft/TypeScript/issues/1863 + let pojo = {}; + let error = this; + for (let key of to_json_1.getDeepKeys(error)) { + let value = error[key]; + pojo[key] = value; + } + // Don't include the `inspect()` method on the output object, + // otherwise it will cause `util.inspect()` to go into an infinite loop + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete + delete pojo[inspectMethod]; + return pojo; } +//# sourceMappingURL=isomorphic.node.js.map -function resolveNotSupported(notSupported, toRetain) { - var i = 0; - var index; +/***/ }), - for (i; i < toRetain.length; i++) { - index = notSupported.indexOf(toRetain[i]); +/***/ 19322: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - if (index >= 0) { - notSupported.splice(index, 1); - } - } +"use strict"; - return notSupported; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.normalizeArgs = exports.normalizeOptions = void 0; +const isomorphic_node_1 = __webpack_require__(26315); +/** + * Normalizes Ono options, accounting for defaults and optional options. + */ +function normalizeOptions(options) { + options = options || {}; + return { + concatMessages: options.concatMessages === undefined ? true : Boolean(options.concatMessages), + format: options.format === undefined ? isomorphic_node_1.format + : (typeof options.format === "function" ? options.format : false), + }; } - +exports.normalizeOptions = normalizeOptions; +/** + * Normalizes the Ono arguments, accounting for defaults, options, and optional arguments. + */ +function normalizeArgs(args, options) { + let originalError; + let props; + let formatArgs; + let message = ""; + // Determine which arguments were actually specified + if (typeof args[0] === "string") { + formatArgs = args; + } + else if (typeof args[1] === "string") { + if (args[0] instanceof Error) { + originalError = args[0]; + } + else { + props = args[0]; + } + formatArgs = args.slice(1); + } + else { + originalError = args[0]; + props = args[1]; + formatArgs = args.slice(2); + } + // If there are any format arguments, then format the error message + if (formatArgs.length > 0) { + if (options.format) { + message = options.format.apply(undefined, formatArgs); + } + else { + message = formatArgs.join(" "); + } + } + if (options.concatMessages && originalError && originalError.message) { + // The inner-error's message will be added to the new message + message += (message ? " \n" : "") + originalError.message; + } + return { originalError, props, message }; +} +exports.normalizeArgs = normalizeArgs; +//# sourceMappingURL=normalize.js.map /***/ }), -/* 240 */ -/***/ (function(module) { - -module.exports = ["3dm","3ds","3g2","3gp","7z","a","aac","adp","ai","aif","aiff","alz","ape","apk","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","oga","ogg","ogv","otf","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rtf","rz","s3m","s7z","scpt","sgi","shar","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]; -/***/ }), -/* 241 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 54760: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -const { addExtensions } = __webpack_require__(696); -const MessageTraitable = __webpack_require__(604); +"use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ono = void 0; +const constructor_1 = __webpack_require__(50326); +const singleton = ono; +exports.ono = singleton; +ono.error = new constructor_1.Ono(Error); +ono.eval = new constructor_1.Ono(EvalError); +ono.range = new constructor_1.Ono(RangeError); +ono.reference = new constructor_1.Ono(ReferenceError); +ono.syntax = new constructor_1.Ono(SyntaxError); +ono.type = new constructor_1.Ono(TypeError); +ono.uri = new constructor_1.Ono(URIError); +const onoMap = ono; /** - * Implements functions to deal with a MessageTrait object. - * @class - * @extends Base - * @returns {MessageTrait} + * Creates a new error with the specified message, properties, and/or inner error. + * If an inner error is provided, then the new error will match its type, if possible. */ -class MessageTrait extends MessageTraitable { +function ono(...args) { + let originalError = args[0]; + // Is the first argument an Error-like object? + if (typeof originalError === "object" && typeof originalError.name === "string") { + // Try to find an Ono singleton method that matches this error type + for (let typedOno of Object.values(onoMap)) { + if (typeof typedOno === "function" && typedOno.name === "ono") { + let species = typedOno[Symbol.species]; + if (species && species !== Error && (originalError instanceof species || originalError.name === species.name)) { + // Create an error of the same type + return typedOno.apply(undefined, args); + } + } + } + } + // By default, create a base Error object + return ono.error.apply(undefined, args); } - -module.exports = addExtensions(MessageTrait); - +//# sourceMappingURL=singleton.js.map /***/ }), -/* 242 */, -/* 243 */ -/***/ (function(module) { + +/***/ 55254: +/***/ ((__unused_webpack_module, exports) => { "use strict"; -module.exports = function generate__limit(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $isMax = $keyword == 'maximum', - $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum', - $schemaExcl = it.schema[$exclusiveKeyword], - $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, - $op = $isMax ? '<' : '>', - $notOp = $isMax ? '>' : '<', - $errorKeyword = undefined; - if ($isDataExcl) { - var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), - $exclusive = 'exclusive' + $lvl, - $exclType = 'exclType' + $lvl, - $exclIsNumber = 'exclIsNumber' + $lvl, - $opExpr = 'op' + $lvl, - $opStr = '\' + ' + $opExpr + ' + \''; - out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; - $schemaValueExcl = 'schemaExcl' + $lvl; - out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; - var $errorKeyword = $exclusiveKeyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.lazyJoinStacks = exports.joinStacks = exports.isWritableStack = exports.isLazyStack = void 0; +const newline = /\r?\n/; +const onoCall = /\bono[ @]/; +/** + * Is the property lazily computed? + */ +function isLazyStack(stackProp) { + return Boolean(stackProp && + stackProp.configurable && + typeof stackProp.get === "function"); +} +exports.isLazyStack = isLazyStack; +/** + * Is the stack property writable? + */ +function isWritableStack(stackProp) { + return Boolean( + // If there is no stack property, then it's writable, since assigning it will create it + !stackProp || + stackProp.writable || + typeof stackProp.set === "function"); +} +exports.isWritableStack = isWritableStack; +/** + * Appends the original `Error.stack` property to the new Error's stack. + */ +function joinStacks(newError, originalError) { + let newStack = popStack(newError.stack); + let originalStack = originalError ? originalError.stack : undefined; + if (newStack && originalStack) { + return newStack + "\n\n" + originalStack; } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + else { + return newStack || originalStack; } - out += ' } else if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; +} +exports.joinStacks = joinStacks; +/** + * Calls `joinStacks` lazily, when the `Error.stack` property is accessed. + */ +function lazyJoinStacks(lazyStack, newError, originalError) { + if (originalError) { + Object.defineProperty(newError, "stack", { + get: () => { + let newStack = lazyStack.get.apply(newError); + return joinStacks({ stack: newStack }, originalError); + }, + enumerable: false, + configurable: true + }); } - out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';'; - } else { - var $exclIsNumber = typeof $schemaExcl == 'number', - $opStr = $op; - if ($exclIsNumber && $isData) { - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; - } else { - if ($exclIsNumber && $schema === undefined) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaExcl; - $notOp += '='; - } else { - if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); - if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $notOp += '='; - } else { - $exclusive = false; - $opStr += '='; + else { + lazyPopStack(newError, lazyStack); + } +} +exports.lazyJoinStacks = lazyJoinStacks; +/** + * Removes Ono from the stack, so that the stack starts at the original error location + */ +function popStack(stack) { + if (stack) { + let lines = stack.split(newline); + // Find the Ono call(s) in the stack, and remove them + let onoStart; + for (let i = 0; i < lines.length; i++) { + let line = lines[i]; + if (onoCall.test(line)) { + if (onoStart === undefined) { + // We found the first Ono call in the stack trace. + // There may be other subsequent Ono calls as well. + onoStart = i; + } + } + else if (onoStart !== undefined) { + // We found the first non-Ono call after one or more Ono calls. + // So remove the Ono call lines from the stack trace + lines.splice(onoStart, i - onoStart); + break; + } + } + if (lines.length > 0) { + return lines.join("\n"); } - } - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; } - } - $errorKeyword = $errorKeyword || $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be ' + ($opStr) + ' '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } + // If we get here, then the stack doesn't contain a call to `ono`. + // This may be due to minification or some optimization of the JS engine. + // So just return the stack as-is. + return stack; +} +/** + * Calls `popStack` lazily, when the `Error.stack` property is accessed. + */ +function lazyPopStack(error, lazyStack) { + Object.defineProperty(error, "stack", { + get: () => popStack(lazyStack.get.apply(error)), + enumerable: false, + configurable: true + }); +} +//# sourceMappingURL=stack.js.map + +/***/ }), + +/***/ 24833: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getDeepKeys = exports.toJSON = void 0; +const nonJsonTypes = ["function", "symbol", "undefined"]; +const protectedProps = ["constructor", "prototype", "__proto__"]; +const objectPrototype = Object.getPrototypeOf({}); +/** + * Custom JSON serializer for Error objects. + * Returns all built-in error properties, as well as extended properties. + */ +function toJSON() { + // HACK: We have to cast the objects to `any` so we can use symbol indexers. + // see https://github.com/Microsoft/TypeScript/issues/1863 + let pojo = {}; + let error = this; + for (let key of getDeepKeys(error)) { + if (typeof key === "string") { + let value = error[key]; + let type = typeof value; + if (!nonJsonTypes.includes(type)) { + pojo[key] = value; + } + } } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + return pojo; +} +exports.toJSON = toJSON; +/** + * Returns own, inherited, enumerable, non-enumerable, string, and symbol keys of `obj`. + * Does NOT return members of the base Object prototype, or the specified omitted keys. + */ +function getDeepKeys(obj, omit = []) { + let keys = []; + // Crawl the prototype chain, finding all the string and symbol keys + while (obj && obj !== objectPrototype) { + keys = keys.concat(Object.getOwnPropertyNames(obj), Object.getOwnPropertySymbols(obj)); + obj = Object.getPrototypeOf(obj); } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; + // De-duplicate the list of keys + let uniqueKeys = new Set(keys); + // Remove any omitted keys + for (let key of omit.concat(protectedProps)) { + uniqueKeys.delete(key); } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; + return uniqueKeys; } - +exports.getDeepKeys = getDeepKeys; +//# sourceMappingURL=to-json.js.map /***/ }), -/* 244 */, -/* 245 */, -/* 246 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + +/***/ 97905: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const util_1 = __webpack_require__(31669); +//# sourceMappingURL=types.js.map -var URI = __webpack_require__(853) - , equal = __webpack_require__(194) - , util = __webpack_require__(676) - , SchemaObject = __webpack_require__(925) - , traverse = __webpack_require__(237); +/***/ }), -module.exports = resolve; +/***/ 17040: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -resolve.normalizeId = normalizeId; -resolve.fullPath = getFullPath; -resolve.url = resolveUrl; -resolve.ids = resolveIds; -resolve.inlineRef = inlineRef; -resolve.schema = resolveSchema; +var deepEqual = __webpack_require__(28206); +var convert = __webpack_require__(66486); -/** - * [resolve and compile the references ($ref)] - * @this Ajv - * @param {Function} compile reference to schema compilation funciton (localCompile) - * @param {Object} root object with information about the root schema for the current schema - * @param {String} ref reference to resolve - * @return {Object|Function} schema object (if the schema can be inlined) or validation function - */ -function resolve(compile, root, ref) { - /* jshint validthis: true */ - var refVal = this._refs[ref]; - if (typeof refVal == 'string') { - if (this._refs[refVal]) refVal = this._refs[refVal]; - else return resolve.call(this, compile, root, refVal); - } +module.exports = openapiSchemaToJsonSchema; +module.exports.fromSchema = openapiSchemaToJsonSchema; +module.exports.fromParameter = openapiParameterToJsonSchema; - refVal = refVal || this._schemas[ref]; - if (refVal instanceof SchemaObject) { - return inlineRef(refVal.schema, this._opts.inlineRefs) - ? refVal.schema - : refVal.validate || this._compile(refVal); - } +function openapiSchemaToJsonSchema(schema, options) { + options = resolveOptions(options); - var res = resolveSchema.call(this, root, ref); - var schema, v, baseId; - if (res) { - schema = res.schema; - root = res.root; - baseId = res.baseId; - } + var jsonSchema = convert.fromSchema(schema, options); + return jsonSchema; +} - if (schema instanceof SchemaObject) { - v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId); - } else if (schema !== undefined) { - v = inlineRef(schema, this._opts.inlineRefs) - ? schema - : compile.call(this, schema, root, undefined, baseId); - } +function openapiParameterToJsonSchema(parameter, options) { + options = resolveOptions(options); - return v; + var jsonSchema = convert.fromParameter(parameter, options); + return jsonSchema; } +function resolveOptions(options) { + var notSupported = [ + 'nullable', 'discriminator', 'readOnly', + 'writeOnly', 'xml', 'externalDocs', + 'example', 'deprecated' + ]; -/** - * Resolve schema, its root and baseId - * @this Ajv - * @param {Object} root root object with properties schema, refVal, refs - * @param {String} ref reference to resolve - * @return {Object} object with properties schema, root, baseId - */ -function resolveSchema(root, ref) { - /* jshint validthis: true */ - var p = URI.parse(ref) - , refPath = _getFullPath(p) - , baseId = getFullPath(this._getId(root.schema)); - if (Object.keys(root.schema).length === 0 || refPath !== baseId) { - var id = normalizeId(refPath); - var refVal = this._refs[id]; - if (typeof refVal == 'string') { - return resolveRecursive.call(this, root, refVal, p); - } else if (refVal instanceof SchemaObject) { - if (!refVal.validate) this._compile(refVal); - root = refVal; - } else { - refVal = this._schemas[id]; - if (refVal instanceof SchemaObject) { - if (!refVal.validate) this._compile(refVal); - if (id == normalizeId(ref)) - return { schema: refVal, root: root, baseId: baseId }; - root = refVal; - } else { - return; - } - } - if (!root.schema) return; - baseId = getFullPath(this._getId(root.schema)); - } - return getJsonPointer.call(this, p, baseId, root.schema, root); -} + options = options || {}; + options.dateToDateTime = options.dateToDateTime || false; + options.cloneSchema = options.cloneSchema == false ? false : true; + options.supportPatternProperties = options.supportPatternProperties || false; + options.keepNotSupported = options.keepNotSupported || []; + options.strictMode = options.strictMode == false ? false : true; + if (typeof options.patternPropertiesHandler !== 'function') { + options.patternPropertiesHandler = patternPropertiesHandler; + } -/* @this Ajv */ -function resolveRecursive(root, ref, parsedRef) { - /* jshint validthis: true */ - var res = resolveSchema.call(this, root, ref); - if (res) { - var schema = res.schema; - var baseId = res.baseId; - root = res.root; - var id = this._getId(schema); - if (id) baseId = resolveUrl(baseId, id); - return getJsonPointer.call(this, parsedRef, baseId, schema, root); - } -} + options._removeProps = []; + if (options.removeReadOnly === true) { + options._removeProps.push('readOnly'); + } -var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']); -/* @this Ajv */ -function getJsonPointer(parsedRef, baseId, schema, root) { - /* jshint validthis: true */ - parsedRef.fragment = parsedRef.fragment || ''; - if (parsedRef.fragment.slice(0,1) != '/') return; - var parts = parsedRef.fragment.split('/'); + if (options.removeWriteOnly === true) { + options._removeProps.push('writeOnly'); + } - for (var i = 1; i < parts.length; i++) { - var part = parts[i]; - if (part) { - part = util.unescapeFragment(part); - schema = schema[part]; - if (schema === undefined) break; - var id; - if (!PREVENT_SCOPE_CHANGE[part]) { - id = this._getId(schema); - if (id) baseId = resolveUrl(baseId, id); - if (schema.$ref) { - var $ref = resolveUrl(baseId, schema.$ref); - var res = resolveSchema.call(this, root, $ref); - if (res) { - schema = res.schema; - root = res.root; - baseId = res.baseId; - } - } - } - } - } - if (schema !== undefined && schema !== root.schema) - return { schema: schema, root: root, baseId: baseId }; + options._structs = ['allOf', 'anyOf', 'oneOf', 'not', 'items', 'additionalProperties']; + options._notSupported = resolveNotSupported(notSupported, options.keepNotSupported); + + return options; } +function patternPropertiesHandler(schema) { + var pattern; + var patternsObj = schema.patternProperties; + var additProps = schema.additionalProperties; -var SIMPLE_INLINED = util.toHash([ - 'type', 'format', 'pattern', - 'maxLength', 'minLength', - 'maxProperties', 'minProperties', - 'maxItems', 'minItems', - 'maximum', 'minimum', - 'uniqueItems', 'multipleOf', - 'required', 'enum' -]); -function inlineRef(schema, limit) { - if (limit === false) return false; - if (limit === undefined || limit === true) return checkNoRef(schema); - else if (limit) return countKeys(schema) <= limit; -} + if (typeof additProps !== 'object') { + return schema; + } + for (pattern in patternsObj) { + if (deepEqual(patternsObj[pattern], additProps)) { + schema.additionalProperties = false; + break; + } + } -function checkNoRef(schema) { - var item; - if (Array.isArray(schema)) { - for (var i=0; i= 0) { + notSupported.splice(index, 1); + } + } -function getFullPath(id, normalize) { - if (normalize !== false) id = normalizeId(id); - var p = URI.parse(id); - return _getFullPath(p); + return notSupported; } -function _getFullPath(p) { - return URI.serialize(p).split('#')[0] + '#'; -} +/***/ }), +/***/ 66486: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var TRAILING_SLASH_HASH = /#\/?$/; -function normalizeId(id) { - return id ? id.replace(TRAILING_SLASH_HASH, '') : ''; +var convertFromSchema = __webpack_require__(64228) +var convertFromParameter = __webpack_require__(53859) + +module.exports = { + fromSchema: convertFromSchema, + fromParameter: convertFromParameter } -function resolveUrl(baseId, id) { - id = normalizeId(id); - return URI.resolve(baseId, id); -} +/***/ }), +/***/ 53859: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* @this Ajv */ -function resolveIds(schema) { - var schemaId = normalizeId(this._getId(schema)); - var baseIds = {'': schemaId}; - var fullPaths = {'': getFullPath(schemaId, false)}; - var localRefs = {}; - var self = this; +var convertFromSchema = __webpack_require__(64228) +var InvalidInputError = __webpack_require__(67667) - traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { - if (jsonPtr === '') return; - var id = self._getId(sch); - var baseId = baseIds[parentJsonPtr]; - var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword; - if (keyIndex !== undefined) - fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex)); - - if (typeof id == 'string') { - id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id); +module.exports = convertFromParameter - var refVal = self._refs[id]; - if (typeof refVal == 'string') refVal = self._refs[refVal]; - if (refVal && refVal.schema) { - if (!equal(sch, refVal.schema)) - throw new Error('id "' + id + '" resolves to more than one schema'); - } else if (id != normalizeId(fullPath)) { - if (id[0] == '#') { - if (localRefs[id] && !equal(sch, localRefs[id])) - throw new Error('id "' + id + '" resolves to more than one schema'); - localRefs[id] = sch; - } else { - self._refs[id] = fullPath; - } - } +// Convert from OpenAPI 3.0 `ParameterObject` to JSON schema v4 +function convertFromParameter (parameter, options) { + if (parameter.schema !== undefined) { + return convertParameterSchema(parameter, parameter.schema, options) + } else if (parameter.content !== undefined) { + return convertFromContents(parameter, options) + } else { + if (options.strictMode) { + throw new InvalidInputError('OpenAPI parameter must have either a \'schema\' or a \'content\' property') } - baseIds[jsonPtr] = baseId; - fullPaths[jsonPtr] = fullPath; - }); - - return localRefs; + return convertParameterSchema(parameter, {}, options) + } } +function convertFromContents (parameter, options) { + var schemas = {} -/***/ }), -/* 247 */ -/***/ (function(module) { - -module.exports = InvalidTypeError + for (var mime in parameter.content) { + schemas[mime] = convertParameterSchema(parameter, parameter.content[mime].schema, options) + } -function InvalidTypeError (message) { - this.name = 'InvalidTypeError' - this.message = message + return schemas } -InvalidTypeError.prototype = Error.prototype +function convertParameterSchema (parameter, schema, options) { + var jsonSchema = convertFromSchema(schema || {}, options) + + if (parameter.description) { + jsonSchema.description = parameter.description + } + + return jsonSchema +} /***/ }), -/* 248 */, -/* 249 */, -/* 250 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -var constants = __webpack_require__(619) +/***/ 64228: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var origCwd = process.cwd -var cwd = null +var isObject = __webpack_require__(45397)/* .isObject */ .K +var InvalidTypeError = __webpack_require__(8277) -var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform +module.exports = convertFromSchema -process.cwd = function() { - if (!cwd) - cwd = origCwd.call(process) - return cwd -} -try { - process.cwd() -} catch (er) {} +// Convert from OpenAPI 3.0 `SchemaObject` to JSON schema v4 +function convertFromSchema (schema, options) { + schema = convertSchema(schema, options) -var chdir = process.chdir -process.chdir = function(d) { - cwd = null - chdir.call(process, d) + schema.$schema = 'http://json-schema.org/draft-04/schema#' + + return schema } -module.exports = patch +function convertSchema (schema, options) { + if (options.cloneSchema) { + schema = Object.assign({}, schema); + } -function patch (fs) { - // (re-)implement some things that are known busted or missing. + var structs = options._structs; + var notSupported = options._notSupported; + var strictMode = options.strictMode; + var i = 0; + var j = 0; + var struct = null; - // lchmod, broken prior to 0.6.2 - // back-port the fix here. - if (constants.hasOwnProperty('O_SYMLINK') && - process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs) - } + for (i; i < structs.length; i++) { + struct = structs[i] - // lutimes implementation, or no-op - if (!fs.lutimes) { - patchLutimes(fs) - } + if (Array.isArray(schema[struct])) { + var cloned = false; - // https://github.com/isaacs/node-graceful-fs/issues/4 - // Chown should not fail on einval or eperm if non-root. - // It should not fail on enosys ever, as this just indicates - // that a fs doesn't support the intended operation. + for (j; j < schema[struct].length; j++) { + if (!isObject(schema[struct][j])) { + if (options.cloneSchema && !cloned) { + cloned = true; + schema[struct] = schema[struct].slice(); + } - fs.chown = chownFix(fs.chown) - fs.fchown = chownFix(fs.fchown) - fs.lchown = chownFix(fs.lchown) + schema[struct].splice(j, 1) + j-- + continue + } - fs.chmod = chmodFix(fs.chmod) - fs.fchmod = chmodFix(fs.fchmod) - fs.lchmod = chmodFix(fs.lchmod) + schema[struct][j] = convertSchema(schema[struct][j], options) + } + } else if (schema[struct] === null) { + delete schema[struct] + } else if (typeof schema[struct] === 'object') { + schema[struct] = convertSchema(schema[struct], options) + } + } - fs.chownSync = chownFixSync(fs.chownSync) - fs.fchownSync = chownFixSync(fs.fchownSync) - fs.lchownSync = chownFixSync(fs.lchownSync) + if ('properties' in schema) { + schema.properties = convertProperties(schema.properties, options) - fs.chmodSync = chmodFixSync(fs.chmodSync) - fs.fchmodSync = chmodFixSync(fs.fchmodSync) - fs.lchmodSync = chmodFixSync(fs.lchmodSync) + if (Array.isArray(schema.required)) { + schema.required = cleanRequired(schema.required, schema.properties) - fs.stat = statFix(fs.stat) - fs.fstat = statFix(fs.fstat) - fs.lstat = statFix(fs.lstat) + if (schema.required.length === 0) { + delete schema.required + } + } + if (Object.keys(schema.properties).length === 0) { + delete schema.properties + } + } - fs.statSync = statFixSync(fs.statSync) - fs.fstatSync = statFixSync(fs.fstatSync) - fs.lstatSync = statFixSync(fs.lstatSync) + if (strictMode) { + validateType(schema.type) + } - // if lchmod/lchown do not exist, then make them no-ops - if (!fs.lchmod) { - fs.lchmod = function (path, mode, cb) { - if (cb) process.nextTick(cb) - } - fs.lchmodSync = function () {} - } - if (!fs.lchown) { - fs.lchown = function (path, uid, gid, cb) { - if (cb) process.nextTick(cb) - } - fs.lchownSync = function () {} - } + schema = convertTypes(schema) + schema = convertFormat(schema, options) - // on Windows, A/V software can lock the directory, causing this - // to fail with an EACCES or EPERM if the directory contains newly - // created files. Try again on failure, for up to 60 seconds. + if ('x-patternProperties' in schema && options.supportPatternProperties) { + schema = convertPatternProperties(schema, options.patternPropertiesHandler) + } - // Set the timeout this long because some Windows Anti-Virus, such as Parity - // bit9, may lock files for up to a minute, causing npm package install - // failures. Also, take care to yield the scheduler. Windows scheduling gives - // CPU to a busy looping process, which can cause the program causing the lock - // contention to be starved of CPU by node, so the contention doesn't resolve. - if (platform === "win32") { - fs.rename = (function (fs$rename) { return function (from, to, cb) { - var start = Date.now() - var backoff = 0; - fs$rename(from, to, function CB (er) { - if (er - && (er.code === "EACCES" || er.code === "EPERM") - && Date.now() - start < 60000) { - setTimeout(function() { - fs.stat(to, function (stater, st) { - if (stater && stater.code === "ENOENT") - fs$rename(from, to, CB); - else - cb(er) - }) - }, backoff) - if (backoff < 100) - backoff += 10; - return; - } - if (cb) cb(er) - }) - }})(fs.rename) - } + for (i = 0; i < notSupported.length; i++) { + delete schema[notSupported[i]] + } - // if read() returns EAGAIN, then just try it again. - fs.read = (function (fs$read) { - function read (fd, buffer, offset, length, position, callback_) { - var callback - if (callback_ && typeof callback_ === 'function') { - var eagCounter = 0 - callback = function (er, _, __) { - if (er && er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } - callback_.apply(this, arguments) - } - } - return fs$read.call(fs, fd, buffer, offset, length, position, callback) - } + return schema +} - // This ensures `util.promisify` works as it does for native `fs.read`. - read.__proto__ = fs$read - return read - })(fs.read) +function validateType (type) { + var validTypes = ['integer', 'number', 'string', 'boolean', 'object', 'array', 'null'] - fs.readSync = (function (fs$readSync) { return function (fd, buffer, offset, length, position) { - var eagCounter = 0 - while (true) { - try { - return fs$readSync.call(fs, fd, buffer, offset, length, position) - } catch (er) { - if (er.code === 'EAGAIN' && eagCounter < 10) { - eagCounter ++ - continue - } - throw er - } - } - }})(fs.readSync) + if (validTypes.indexOf(type) < 0 && type !== undefined) { + throw new InvalidTypeError('Type ' + JSON.stringify(type) + ' is not a valid type') + } +} - function patchLchmod (fs) { - fs.lchmod = function (path, mode, callback) { - fs.open( path - , constants.O_WRONLY | constants.O_SYMLINK - , mode - , function (err, fd) { - if (err) { - if (callback) callback(err) - return - } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - fs.fchmod(fd, mode, function (err) { - fs.close(fd, function(err2) { - if (callback) callback(err || err2) - }) - }) - }) - } +function convertProperties (properties, options) { + var key; + var property; + var props = {}; + var removeProp; - fs.lchmodSync = function (path, mode) { - var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + if (!isObject(properties)) { + return props + } - // prefer to return the chmod error, if one occurs, - // but still try to close, and report closing errors if they occur. - var threw = true - var ret - try { - ret = fs.fchmodSync(fd, mode) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } - } + for (key in properties) { + property = properties[key] - function patchLutimes (fs) { - if (constants.hasOwnProperty("O_SYMLINK")) { - fs.lutimes = function (path, at, mt, cb) { - fs.open(path, constants.O_SYMLINK, function (er, fd) { - if (er) { - if (cb) cb(er) - return - } - fs.futimes(fd, at, mt, function (er) { - fs.close(fd, function (er2) { - if (cb) cb(er || er2) - }) - }) - }) - } + if (!isObject(property)) { + continue + } - fs.lutimesSync = function (path, at, mt) { - var fd = fs.openSync(path, constants.O_SYMLINK) - var ret - var threw = true - try { - ret = fs.futimesSync(fd, at, mt) - threw = false - } finally { - if (threw) { - try { - fs.closeSync(fd) - } catch (er) {} - } else { - fs.closeSync(fd) - } - } - return ret - } + removeProp = options._removeProps.some(function (prop) { + return property[prop] === true + }) - } else { - fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } - fs.lutimesSync = function () {} - } - } + if (removeProp) { + continue + } - function chmodFix (orig) { - if (!orig) return orig - return function (target, mode, cb) { - return orig.call(fs, target, mode, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } + props[key] = convertSchema(property, options) + } - function chmodFixSync (orig) { - if (!orig) return orig - return function (target, mode) { - try { - return orig.call(fs, target, mode) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } + return props +} +function convertTypes (schema) { + if (schema.type !== undefined && schema.nullable === true) { + schema.type = [schema.type, 'null'] - function chownFix (orig) { - if (!orig) return orig - return function (target, uid, gid, cb) { - return orig.call(fs, target, uid, gid, function (er) { - if (chownErOk(er)) er = null - if (cb) cb.apply(this, arguments) - }) - } - } + if (Array.isArray(schema.enum)) { + schema.enum = schema.enum.concat([null]) + } + } - function chownFixSync (orig) { - if (!orig) return orig - return function (target, uid, gid) { - try { - return orig.call(fs, target, uid, gid) - } catch (er) { - if (!chownErOk(er)) throw er - } - } - } + return schema +} - function statFix (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options, cb) { - if (typeof options === 'function') { - cb = options - options = null - } - function callback (er, stats) { - if (stats) { - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - } - if (cb) cb.apply(this, arguments) - } - return options ? orig.call(fs, target, options, callback) - : orig.call(fs, target, callback) - } - } +function convertFormat (schema, options) { + var format = schema.format + var settings = { + MIN_INT_32: 0 - Math.pow(2, 31), + MAX_INT_32: Math.pow(2, 31) - 1, + MIN_INT_64: 0 - Math.pow(2, 63), + MAX_INT_64: Math.pow(2, 63) - 1, + MIN_FLOAT: 0 - Math.pow(2, 128), + MAX_FLOAT: Math.pow(2, 128) - 1, + MIN_DOUBLE: 0 - Number.MAX_VALUE, + MAX_DOUBLE: Number.MAX_VALUE, - function statFixSync (orig) { - if (!orig) return orig - // Older versions of Node erroneously returned signed integers for - // uid + gid. - return function (target, options) { - var stats = options ? orig.call(fs, target, options) - : orig.call(fs, target) - if (stats.uid < 0) stats.uid += 0x100000000 - if (stats.gid < 0) stats.gid += 0x100000000 - return stats; - } - } + // Matches base64 (RFC 4648) + // Matches `standard` base64 not `base64url`. The specification does not + // exclude it but current ongoing OpenAPI plans will distinguish btoh. + BYTE_PATTERN: '^[\\w\\d+\\/=]*$' + } - // ENOSYS means that the fs doesn't support the op. Just ignore - // that, because it doesn't matter. - // - // if there's no getuid, or if getuid() is something other - // than 0, and the error is EINVAL or EPERM, then just ignore - // it. - // - // This specific case is a silent failure in cp, install, tar, - // and most other unix tools that manage permissions. - // - // When running as root, or if other types of errors are - // encountered, then it's strict. - function chownErOk (er) { - if (!er) - return true + // Valid JSON schema v4 formats + var FORMATS = ['date-time', 'email', 'hostname', 'ipv4', 'ipv6', 'uri', 'uri-reference'] - if (er.code === "ENOSYS") - return true + if (format === undefined || FORMATS.indexOf(format) !== -1) { + return schema + } - var nonroot = !process.getuid || process.getuid() !== 0 - if (nonroot) { - if (er.code === "EINVAL" || er.code === "EPERM") - return true - } + if (format === 'date' && options.dateToDateTime === true) { + return convertFormatDate(schema) + } - return false - } -} + var formatConverters = { + int32: convertFormatInt32, + int64: convertFormatInt64, + float: convertFormatFloat, + double: convertFormatDouble, + byte: convertFormatByte + } + var converter = formatConverters[format] -/***/ }), -/* 251 */, -/* 252 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + if (converter === undefined) { return schema } -"use strict"; + return converter(schema, settings) +} +function convertFormatInt32 (schema, settings) { + if ((!schema.minimum && schema.minimum !== 0) || schema.minimum < settings.MIN_INT_32) { + schema.minimum = settings.MIN_INT_32; + } + if ((!schema.maximum && schema.maximum !== 0) || schema.maximum > settings.MAX_INT_32) { + schema.maximum = settings.MAX_INT_32; + } + return schema +} -const wap = __webpack_require__(284).WebApiParser -const utils = __webpack_require__(199) +function convertFormatInt64 (schema, settings) { + if ((!schema.minimum && schema.minimum !== 0) || schema.minimum < settings.MIN_INT_64) { + schema.minimum = settings.MIN_INT_64; + } + if ((!schema.maximum && schema.maximum !== 0) || schema.maximum > settings.MAX_INT_64) { + schema.maximum = settings.MAX_INT_64; + } + return schema +} -/** - * Converts RAML data type to JSON schema. - * - * @param {string} ramlData - RAML file content. - * @param {string} typeName - Name of the type to be converted. - * @param {object} options - Options to use in conversion: - * basePath: Resolve references relative to this path. - * draft: Output JSON Schema draft version. - * validate: Validate output JSON Schema with Ajv. - * @return {object} JSON Schema containing converted type. - */ -async function dt2js (ramlData, typeName, options = {}) { - const patchedData = patchRamlData(ramlData, typeName) - let model - if (options.basePath) { - const location = utils.genBasePathLocation(options.basePath, 'raml') - model = await wap.raml10.parse(patchedData, location) - } else { - model = await wap.raml10.parse(patchedData) - } - const resolved = await wap.raml10.resolve(model) - let jsonSchema - try { - jsonSchema = resolved.getDeclarationByName(typeName) - .buildJsonSchema() - } catch (err) { - throw new Error( - `Failed to convert to JSON Schema: ${err.toString()}`) - } - jsonSchema = JSON.stringify( - JSON.parse(jsonSchema), - (key, val) => fixStructureInconsistencies( - removeXAmfProperties( - fixFileTypeProperties(val))), - 2 - ) - const finalSchema = migrateDraft(JSON.parse(jsonSchema), options.draft) - if (options.validate) { - validateJsonSchema(finalSchema) - } - return finalSchema +function convertFormatFloat (schema, settings) { + if ((!schema.minimum && schema.minimum !== 0) || schema.minimum < settings.MIN_FLOAT) { + schema.minimum = settings.MIN_FLOAT; + } + if ((!schema.maximum && schema.maximum !== 0) || schema.maximum > settings.MAX_FLOAT) { + schema.maximum = settings.MAX_FLOAT; + } + return schema } -/** - * Migrates JSON Schema draft. - * - * @param {object} schema - JSON Schema containing converted type. - * @param {string} draft - Output JSON Schema draft version. - * @return {object} JSON Schema with migrated draft version. - */ -function migrateDraft (schema, draft = utils.DEFAULT_DRAFT) { - utils.validateDraft(draft) - if (draft === '04') { - return schema - } +function convertFormatDouble (schema, settings) { + if ((!schema.minimum && schema.minimum !== 0) || schema.minimum < settings.MIN_DOUBLE) { + schema.minimum = settings.MIN_DOUBLE; + } + if ((!schema.maximum && schema.maximum !== 0) || schema.maximum > settings.MAX_DOUBLE) { + schema.maximum = settings.MAX_DOUBLE; + } + return schema +} - const migrate = __webpack_require__(800) - const mSchema = migrate.draft6(schema) - if (draft === '07') { - mSchema.$schema = 'http://json-schema.org/draft-07/schema#' - } - return mSchema +function convertFormatDate (schema) { + schema.format = 'date-time' + return schema } -/** - * Patches RAML string to be a regular RAML API doc with an endpoint. - * Is necessary to make it work with resolution. - * - * @param {string} ramlData - RAML file content. - * @param {string} typeName - Name of the type to be converted. - * @return {string} Patched RAML content. - */ -function patchRamlData (ramlData, typeName) { - let dataPieces = ramlData.split('\n') - dataPieces = dataPieces.filter(p => !!p) - dataPieces[0] = '#%RAML 1.0' - dataPieces.push(` -/for/conversion/${typeName}: - get: - responses: - 200: - body: - application/json: - type: ${typeName}`) - return dataPieces.join('\n') +function convertFormatByte (schema, settings) { + schema.pattern = settings.BYTE_PATTERN + return schema } -/** - * Fixes JSON Schema structure inconsistencies. - * In particular: - * - Changes 'examples' value to array (new in draft06); - * - * @param {object} obj - Object to be fixed. - * @return {object} Fixed object. - */ -function fixStructureInconsistencies (obj) { - if (!obj || obj.constructor !== Object) { - return obj - } +function convertPatternProperties (schema, handler) { + if (isObject(schema['x-patternProperties'])) { + schema.patternProperties = schema['x-patternProperties'] + } - if (obj.examples) { - obj.examples = Object.values(obj.examples) - } - return obj + delete schema['x-patternProperties'] + + return handler(schema) } -/** - * Fixes "type: file" objects converted from RAML. - * See https://github.com/aml-org/amf/issues/539 - * - * @param {object} obj - Object to be fixed. - * @return {object} Fixed object. - */ -function fixFileTypeProperties (obj) { - if (!obj || obj.constructor !== Object) { - return obj - } +function cleanRequired (required, properties) { + required = required || [] + properties = properties || {} + let remainedRequired = [] - if (obj.type === 'file') { - obj.type = 'string' - obj.media = { - binaryEncoding: 'binary' - } - const fileTypes = obj['x-amf-fileTypes'] || [] - if (fileTypes.length > 0) { - obj.media.anyOf = fileTypes.map(el => { - return { mediaType: el } - }) + for (let i = 0; i < required.length; i++) { + if (properties[required[i]]) { + remainedRequired.push(required[i]) } - delete obj['x-amf-fileTypes'] - } - return obj + } + + return remainedRequired } -/** - * Removes "x-amf-" prefixes from object properties. - * - * @param {object} obj - Object to be fixed. - * @return {object} Fixed object. - */ -function removeXAmfProperties (obj) { - if (!obj || obj.constructor !== Object) { - return obj - } - const newObj = {} - Object.entries(obj).map(([k, v]) => { - k = k.startsWith('x-amf-facet-') ? k.replace('x-amf-facet-', '') : k - k = k.startsWith('x-amf-') ? k.replace('x-amf-', '') : k - newObj[k] = v - }) - return newObj -} +/***/ }), -/** - * Validates JSON Schema. - * - * @param {object} obj - JSON Schema object. - * @throws {Error} Invalid JSON Schema. - * @throws {Error} Validation requires "ajv" to be installed. - */ -function validateJsonSchema (obj) { - let Ajv - try { - Ajv = __webpack_require__(514) - } catch (err) { - throw new Error( - `Validation requires "ajv" to be installed. ${err.message}`) - } - const ajv = new Ajv({ allErrors: true, schemaId: 'auto' }) +/***/ 67667: +/***/ ((module) => { - if (obj.$schema.indexOf('draft-04') > -1) { - ajv.addMetaSchema(__webpack_require__(780)) - } else if (obj.$schema.indexOf('draft-06') > -1) { - ajv.addMetaSchema(__webpack_require__(337)) - } +module.exports = InvalidInputError - const valid = ajv.validateSchema(obj) - if (!valid) { - const errorsText = ajv.errorsText(ajv.errors, { separator: '; ' }) - throw new Error(`Invalid JSON Schema: ${errorsText}`) - } +function InvalidInputError (message) { + this.name = 'InvalidInputError' + this.message = message } -module.exports.dt2js = dt2js +InvalidInputError.prototype = new Error() /***/ }), -/* 253 */ -/***/ (function(module, __unusedexports, __webpack_require__) { -var objectKeys = __webpack_require__(786); -var isArguments = __webpack_require__(6); -var is = __webpack_require__(412); -var isRegex = __webpack_require__(682); -var flags = __webpack_require__(330); -var isDate = __webpack_require__(878); +/***/ 8277: +/***/ ((module) => { -var getTime = Date.prototype.getTime; +module.exports = InvalidTypeError -function deepEqual(actual, expected, options) { - var opts = options || {}; +function InvalidTypeError (message) { + this.name = 'InvalidTypeError' + this.message = message +} - // 7.1. All identical values are equivalent, as determined by ===. - if (opts.strict ? is(actual, expected) : actual === expected) { - return true; - } +InvalidTypeError.prototype = Error.prototype - // 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==. - if (!actual || !expected || (typeof actual !== 'object' && typeof expected !== 'object')) { - return opts.strict ? is(actual, expected) : actual == expected; - } - /* - * 7.4. For all other Object pairs, including Array objects, equivalence is - * determined by having the same number of owned properties (as verified - * with Object.prototype.hasOwnProperty.call), the same set of keys - * (although not necessarily the same order), equivalent values for every - * corresponding key, and an identical 'prototype' property. Note: this - * accounts for both named and indexed properties on Arrays. - */ - // eslint-disable-next-line no-use-before-define - return objEquiv(actual, expected, opts); -} +/***/ }), -function isUndefinedOrNull(value) { - return value === null || value === undefined; -} +/***/ 45397: +/***/ ((__unused_webpack_module, exports) => { -function isBuffer(x) { - if (!x || typeof x !== 'object' || typeof x.length !== 'number') { - return false; - } - if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { - return false; - } - if (x.length > 0 && typeof x[0] !== 'number') { - return false; - } - return true; +exports.K = function (maybeObj) { + return maybeObj !== null && typeof maybeObj === 'object' } -function objEquiv(a, b, opts) { - /* eslint max-statements: [2, 50] */ - var i, key; - if (typeof a !== typeof b) { return false; } - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) { return false; } - - // an identical 'prototype' property. - if (a.prototype !== b.prototype) { return false; } - if (isArguments(a) !== isArguments(b)) { return false; } +/***/ }), - var aIsRegex = isRegex(a); - var bIsRegex = isRegex(b); - if (aIsRegex !== bIsRegex) { return false; } - if (aIsRegex || bIsRegex) { - return a.source === b.source && flags(a) === flags(b); - } +/***/ 13980: +/***/ (function(module) { - if (isDate(a) && isDate(b)) { - return getTime.call(a) === getTime.call(b); - } +// MIT license (by Elan Shanker). +(function(globals) { + 'use strict'; - var aIsBuffer = isBuffer(a); - var bIsBuffer = isBuffer(b); - if (aIsBuffer !== bIsBuffer) { return false; } - if (aIsBuffer || bIsBuffer) { // && would work too, because both are true or both false here - if (a.length !== b.length) { return false; } - for (i = 0; i < a.length; i++) { - if (a[i] !== b[i]) { return false; } + var executeSync = function(){ + var args = Array.prototype.slice.call(arguments); + if (typeof args[0] === 'function'){ + args[0].apply(null, args.splice(1)); } - return true; - } - - if (typeof a !== typeof b) { return false; } - - try { - var ka = objectKeys(a); - var kb = objectKeys(b); - } catch (e) { // happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates hasOwnProperty) - if (ka.length !== kb.length) { return false; } - - // the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - // ~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) { return false; } - } - // equivalent values for every corresponding key, and ~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!deepEqual(a[key], b[key], opts)) { return false; } - } - - return true; -} - -module.exports = deepEqual; - + }; -/***/ }), -/* 254 */, -/* 255 */, -/* 256 */, -/* 257 */, -/* 258 */, -/* 259 */, -/* 260 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + var executeAsync = function(fn){ + if (typeof setImmediate === 'function') { + setImmediate(fn); + } else if (typeof process !== 'undefined' && process.nextTick) { + process.nextTick(fn); + } else { + setTimeout(fn, 0); + } + }; -const yaml = __webpack_require__(414); -const r2j = __webpack_require__(946); + var makeIterator = function (tasks) { + var makeCallback = function (index) { + var fn = function () { + if (tasks.length) { + tasks[index].apply(null, arguments); + } + return fn.next(); + }; + fn.next = function () { + return (index < tasks.length - 1) ? makeCallback(index + 1): null; + }; + return fn; + }; + return makeCallback(0); + }; + + var _isArray = Array.isArray || function(maybeArray){ + return Object.prototype.toString.call(maybeArray) === '[object Array]'; + }; -module.exports = async ({ message, defaultSchemaFormat }) => { - try { - let payload = message.payload; - if (typeof payload === 'object') { - payload = '#%RAML 1.0 Library\n' + - yaml.safeDump({ types: { tmpType: payload } }); + var waterfall = function (tasks, callback, forceAsync) { + var nextTick = forceAsync ? executeAsync : executeSync; + callback = callback || function () {}; + if (!_isArray(tasks)) { + var err = new Error('First argument to waterfall must be an array of functions'); + return callback(err); } + if (!tasks.length) { + return callback(); + } + var wrapIterator = function (iterator) { + return function (err) { + if (err) { + callback.apply(null, arguments); + callback = function () {}; + } else { + var args = Array.prototype.slice.call(arguments, 1); + var next = iterator.next(); + if (next) { + args.push(wrapIterator(next)); + } else { + args.push(callback); + } + nextTick(function () { + iterator.apply(null, args); + }); + } + }; + }; + wrapIterator(makeIterator(tasks))(); + }; - // Draft 6 is compatible with 7. - const jsonModel = await r2j.dt2js(payload, 'tmpType', { draft: '06' }); - const convertedType = jsonModel.definitions.tmpType; - - message['x-parser-original-schema-format'] = message.schemaFormat || defaultSchemaFormat; - message['x-parser-original-payload'] = payload; - message.payload = convertedType; - delete message.schemaFormat; - } catch (e) { - console.error(e); + if (typeof define !== 'undefined' && define.amd) { + define([], function () { + return waterfall; + }); // RequireJS + } else if ( true && module.exports) { + module.exports = waterfall; // CommonJS + } else { + globals.waterfall = waterfall; //