├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .github └── workflows │ ├── add-good-first-issue-labels.yml │ ├── automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml │ ├── automerge-for-humans-merging.yml │ ├── automerge-for-humans-remove-ready-to-merge-label-on-edit.yml │ ├── automerge-orphans.yml │ ├── automerge.yml │ ├── autoupdate.yml │ ├── bounty-program-commands.yml │ ├── bump.yml │ ├── help-command.yml │ ├── if-nodejs-pr-testing.yml │ ├── if-nodejs-release.yml │ ├── if-nodejs-version-bump.yml │ ├── issues-prs-notifications.yml │ ├── lint-pr-title.yml │ ├── notify-tsc-members-mention.yml │ ├── please-take-a-look-command.yml │ ├── release-announcements.yml │ ├── scripts │ ├── README.md │ └── mailchimp │ │ ├── htmlContent.js │ │ ├── index.js │ │ ├── package-lock.json │ │ └── package.json │ ├── stale-issues-prs.yml │ ├── transfer-issue.yml │ ├── update-maintainers-trigger.yaml │ ├── update-pr.yml │ └── welcome-first-time-contrib.yml ├── .gitignore ├── .npmignore ├── .releaserc ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── jest.config.ts ├── package-lock.json ├── package.json ├── src ├── index.ts └── json-schema-v3.ts ├── test ├── documents │ ├── invalid-asyncapi.yaml │ ├── invalid.json │ ├── valid-asyncapi.yaml │ └── valid.json └── parser.spec.ts ├── tsconfig.cjs.json └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # top-most EditorConfig file 2 | root = true 3 | 4 | # Unix-style newlines with a newline ending every file 5 | [*] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | 9 | [*.js] 10 | indent_size = 2 11 | indent_style = space -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.tgz 3 | .vscode 4 | .DS_Store 5 | /docs 6 | /coverage 7 | /lib 8 | /esm 9 | /cjs -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | parser: "@typescript-eslint/parser" 2 | 3 | env: 4 | node: true 5 | es6: true 6 | jest: true 7 | 8 | plugins: 9 | - "@typescript-eslint" 10 | - sonarjs 11 | - security 12 | - github 13 | 14 | extends: 15 | - eslint:recommended 16 | - plugin:@typescript-eslint/eslint-recommended 17 | - plugin:@typescript-eslint/recommended 18 | - plugin:sonarjs/recommended 19 | - plugin:security/recommended 20 | 21 | parserOptions: 22 | ecmaVersion: 2018 23 | 24 | rules: 25 | # Ignore Rules 26 | strict: 0 27 | no-underscore-dangle: 0 28 | no-mixed-requires: 0 29 | no-process-exit: 0 30 | no-warning-comments: 0 31 | no-use-before-define: 0 32 | curly: 0 33 | no-multi-spaces: 0 34 | no-alert: 0 35 | consistent-return: 0 36 | consistent-this: [0, self] 37 | func-style: 0 38 | max-nested-callbacks: 0 39 | camelcase: 0 40 | no-dupe-class-members: 0 41 | security/detect-object-injection: 0 42 | sonarjs/no-small-switch: 0 43 | sonarjs/no-nested-template-literals: 0 44 | 45 | # Warnings 46 | no-debugger: 1 47 | no-empty: 1 48 | no-invalid-regexp: 1 49 | no-unused-expressions: 1 50 | no-native-reassign: 1 51 | no-fallthrough: 1 52 | sonarjs/cognitive-complexity: 1 53 | 54 | # Errors 55 | eqeqeq: 2 56 | no-undef: 2 57 | no-dupe-keys: 2 58 | no-empty-character-class: 2 59 | no-self-compare: 2 60 | valid-typeof: 2 61 | handle-callback-err: 2 62 | no-shadow-restricted-names: 2 63 | no-new-require: 2 64 | no-mixed-spaces-and-tabs: 2 65 | block-scoped-var: 2 66 | no-else-return: 2 67 | no-throw-literal: 2 68 | no-void: 2 69 | radix: 2 70 | wrap-iife: [2, outside] 71 | no-shadow: 0 72 | no-path-concat: 2 73 | valid-jsdoc: [0, {requireReturn: false, requireParamDescription: false, requireReturnDescription: false}] 74 | 75 | # stylistic errors 76 | no-spaced-func: 2 77 | semi-spacing: 2 78 | quotes: [2, 'single'] 79 | key-spacing: [2, { beforeColon: false, afterColon: true }] 80 | indent: [2, 2] 81 | no-lonely-if: 2 82 | no-floating-decimal: 2 83 | brace-style: [2, 1tbs, { allowSingleLine: true }] 84 | comma-style: [2, last] 85 | no-multiple-empty-lines: [2, {max: 1}] 86 | no-nested-ternary: 2 87 | operator-assignment: [2, always] 88 | padded-blocks: [2, never] 89 | quote-props: [2, as-needed] 90 | keyword-spacing: [2, {'before': true, 'after': true, 'overrides': {}}] 91 | space-before-blocks: [2, always] 92 | array-bracket-spacing: [2, never] 93 | computed-property-spacing: [2, never] 94 | space-in-parens: [2, never] 95 | space-unary-ops: [2, {words: true, nonwords: false}] 96 | wrap-regex: 2 97 | linebreak-style: 0 98 | semi: [2, always] 99 | arrow-spacing: [2, {before: true, after: true}] 100 | no-class-assign: 2 101 | no-const-assign: 2 102 | no-this-before-super: 2 103 | no-var: 2 104 | object-shorthand: [2, always] 105 | prefer-arrow-callback: 2 106 | prefer-const: 2 107 | prefer-spread: 2 108 | prefer-template: 2 109 | 110 | # TypeScript 111 | "@typescript-eslint/no-empty-interface": "off" 112 | "@typescript-eslint/no-use-before-define": ["off"] 113 | "@typescript-eslint/no-empty-function": "off" 114 | "@typescript-eslint/ban-ts-comment": "off" 115 | "@typescript-eslint/no-explicit-any": "off" 116 | "@typescript-eslint/explicit-module-boundary-types": "off" 117 | "@typescript-eslint/no-this-alias": "off" 118 | "@typescript-eslint/no-unnecessary-type-constraint": "off" 119 | "@typescript-eslint/ban-types": "off" 120 | 121 | overrides: 122 | - files: 123 | - "test/**" 124 | - "*.spec.ts" 125 | - "*.test.ts" 126 | rules: 127 | prefer-arrow-callback: 0 128 | sonarjs/no-duplicate-string: 0 129 | security/detect-object-injection: 0 130 | security/detect-non-literal-fs-filename: 0 131 | "@typescript-eslint/no-non-null-assertion": 0 132 | "@typescript-eslint/no-unused-vars": 0 -------------------------------------------------------------------------------- /.github/workflows/add-good-first-issue-labels.yml: -------------------------------------------------------------------------------- 1 | # This workflow is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # Purpose of this workflow is to enable anyone to label issue with 'Good First Issue' and 'area/*' with a single command. 5 | name: Add 'Good First Issue' and 'area/*' labels # if proper comment added 6 | 7 | on: 8 | issue_comment: 9 | types: 10 | - created 11 | 12 | jobs: 13 | add-labels: 14 | if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (contains(github.event.comment.body, '/good-first-issue') || contains(github.event.comment.body, '/gfi' ))}} 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Add label 18 | uses: actions/github-script@v7 19 | with: 20 | github-token: ${{ secrets.GH_TOKEN }} 21 | script: | 22 | const areas = ['javascript', 'typescript', 'java' , 'go', 'docs', 'ci-cd', 'design']; 23 | const words = context.payload.comment.body.trim().split(" "); 24 | const areaIndex = words.findIndex((word)=> word === '/gfi' || word === '/good-first-issue') + 1 25 | let area = words[areaIndex]; 26 | switch(area){ 27 | case 'ts': 28 | area = 'typescript'; 29 | break; 30 | case 'js': 31 | area = 'javascript'; 32 | break; 33 | case 'markdown': 34 | area = 'docs'; 35 | break; 36 | } 37 | if(!areas.includes(area)){ 38 | const message = `Hey @${context.payload.sender.login}, your message doesn't follow the requirements, you can try \`/help\`.` 39 | 40 | await github.rest.issues.createComment({ 41 | issue_number: context.issue.number, 42 | owner: context.repo.owner, 43 | repo: context.repo.repo, 44 | body: message 45 | }) 46 | } else { 47 | 48 | // remove area if there is any before adding new labels. 49 | const currentLabels = (await github.rest.issues.listLabelsOnIssue({ 50 | issue_number: context.issue.number, 51 | owner: context.repo.owner, 52 | repo: context.repo.repo, 53 | })).data.map(label => label.name); 54 | 55 | const shouldBeRemoved = currentLabels.filter(label => (label.startsWith('area/') && !label.endsWith(area))); 56 | shouldBeRemoved.forEach(label => { 57 | github.rest.issues.deleteLabel({ 58 | owner: context.repo.owner, 59 | repo: context.repo.repo, 60 | name: label, 61 | }); 62 | }); 63 | 64 | // Add new labels. 65 | github.rest.issues.addLabels({ 66 | issue_number: context.issue.number, 67 | owner: context.repo.owner, 68 | repo: context.repo.repo, 69 | labels: ['good first issue', `area/${area}`] 70 | }); 71 | } 72 | -------------------------------------------------------------------------------- /.github/workflows/automerge-for-humans-add-ready-to-merge-or-do-not-merge-label.yml: -------------------------------------------------------------------------------- 1 | # This workflow is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # Purpose of this workflow is to enable anyone to label PR with the following labels: 5 | # `ready-to-merge` and `do-not-merge` labels to get stuff merged or blocked from merging 6 | # `autoupdate` to keep a branch up-to-date with the target branch 7 | 8 | name: Label PRs # if proper comment added 9 | 10 | on: 11 | issue_comment: 12 | types: 13 | - created 14 | 15 | jobs: 16 | add-ready-to-merge-label: 17 | if: > 18 | github.event.issue.pull_request && 19 | github.event.issue.state != 'closed' && 20 | github.actor != 'asyncapi-bot' && 21 | ( 22 | contains(github.event.comment.body, '/ready-to-merge') || 23 | contains(github.event.comment.body, '/rtm' ) 24 | ) 25 | 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: Add ready-to-merge label 29 | uses: actions/github-script@v7 30 | with: 31 | github-token: ${{ secrets.GH_TOKEN }} 32 | script: | 33 | const prDetailsUrl = context.payload.issue.pull_request.url; 34 | const { data: pull } = await github.request(prDetailsUrl); 35 | const { draft: isDraft} = pull; 36 | if(!isDraft) { 37 | console.log('adding ready-to-merge label...'); 38 | github.rest.issues.addLabels({ 39 | issue_number: context.issue.number, 40 | owner: context.repo.owner, 41 | repo: context.repo.repo, 42 | labels: ['ready-to-merge'] 43 | }) 44 | } 45 | 46 | const { data: comparison } = 47 | await github.rest.repos.compareCommitsWithBasehead({ 48 | owner: pull.head.repo.owner.login, 49 | repo: pull.head.repo.name, 50 | basehead: `${pull.base.label}...${pull.head.label}`, 51 | }); 52 | if (comparison.behind_by !== 0 && pull.mergeable_state === 'behind') { 53 | console.log(`This branch is behind the target by ${comparison.behind_by} commits`) 54 | console.log('adding out-of-date comment...'); 55 | github.rest.issues.createComment({ 56 | issue_number: context.issue.number, 57 | owner: context.repo.owner, 58 | repo: context.repo.repo, 59 | body: `Hello, @${{ github.actor }}! 👋🏼 60 | This PR is not up to date with the base branch and can't be merged. 61 | Please update your branch manually with the latest version of the base branch. 62 | PRO-TIP: To request an update from the upstream branch, simply comment \`/u\` or \`/update\` and our bot will handle the update operation promptly. 63 | 64 | The only requirement for this to work is to enable [Allow edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) option in your PR. Also the update will not work if your fork is located in an organization, not under your personal profile. 65 | Thanks 😄` 66 | }) 67 | } 68 | 69 | add-do-not-merge-label: 70 | if: > 71 | github.event.issue.pull_request && 72 | github.event.issue.state != 'closed' && 73 | github.actor != 'asyncapi-bot' && 74 | ( 75 | contains(github.event.comment.body, '/do-not-merge') || 76 | contains(github.event.comment.body, '/dnm' ) 77 | ) 78 | runs-on: ubuntu-latest 79 | steps: 80 | - name: Add do-not-merge label 81 | uses: actions/github-script@v7 82 | with: 83 | github-token: ${{ secrets.GH_TOKEN }} 84 | script: | 85 | github.rest.issues.addLabels({ 86 | issue_number: context.issue.number, 87 | owner: context.repo.owner, 88 | repo: context.repo.repo, 89 | labels: ['do-not-merge'] 90 | }) 91 | add-autoupdate-label: 92 | if: > 93 | github.event.issue.pull_request && 94 | github.event.issue.state != 'closed' && 95 | github.actor != 'asyncapi-bot' && 96 | ( 97 | contains(github.event.comment.body, '/autoupdate') || 98 | contains(github.event.comment.body, '/au' ) 99 | ) 100 | runs-on: ubuntu-latest 101 | steps: 102 | - name: Add autoupdate label 103 | uses: actions/github-script@v7 104 | with: 105 | github-token: ${{ secrets.GH_TOKEN }} 106 | script: | 107 | github.rest.issues.addLabels({ 108 | issue_number: context.issue.number, 109 | owner: context.repo.owner, 110 | repo: context.repo.repo, 111 | labels: ['autoupdate'] 112 | }) 113 | -------------------------------------------------------------------------------- /.github/workflows/automerge-for-humans-merging.yml: -------------------------------------------------------------------------------- 1 | # This workflow is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # Purpose of this workflow is to allow people to merge PR without a need of maintainer doing it. If all checks are in place (including maintainers approval) - JUST MERGE IT! 5 | name: Automerge For Humans 6 | 7 | on: 8 | pull_request_target: 9 | types: 10 | - labeled 11 | - unlabeled 12 | - synchronize 13 | - opened 14 | - edited 15 | - ready_for_review 16 | - reopened 17 | - unlocked 18 | 19 | jobs: 20 | automerge-for-humans: 21 | # it runs only if PR actor is not a bot, at least not a bot that we know 22 | if: | 23 | github.event.pull_request.draft == false && 24 | (github.event.pull_request.user.login != 'asyncapi-bot' || 25 | github.event.pull_request.user.login != 'dependabot[bot]' || 26 | github.event.pull_request.user.login != 'dependabot-preview[bot]') 27 | runs-on: ubuntu-latest 28 | steps: 29 | - name: Get PR authors 30 | id: authors 31 | uses: actions/github-script@v7 32 | with: 33 | script: | 34 | // Get paginated list of all commits in the PR 35 | try { 36 | const commitOpts = github.rest.pulls.listCommits.endpoint.merge({ 37 | owner: context.repo.owner, 38 | repo: context.repo.repo, 39 | pull_number: context.issue.number 40 | }); 41 | 42 | const commits = await github.paginate(commitOpts); 43 | 44 | if (commits.length === 0) { 45 | core.setFailed('No commits found in the PR'); 46 | return ''; 47 | } 48 | 49 | // Get unique authors from the commits list 50 | const authors = commits.reduce((acc, commit) => { 51 | const username = commit.author?.login || commit.commit.author?.name; 52 | if (username && !acc[username]) { 53 | acc[username] = { 54 | name: commit.commit.author?.name, 55 | email: commit.commit.author?.email, 56 | } 57 | } 58 | 59 | return acc; 60 | }, {}); 61 | 62 | return authors; 63 | } catch (error) { 64 | core.setFailed(error.message); 65 | return []; 66 | } 67 | 68 | - name: Create commit message 69 | id: create-commit-message 70 | uses: actions/github-script@v7 71 | with: 72 | script: | 73 | const authors = ${{ steps.authors.outputs.result }}; 74 | 75 | if (Object.keys(authors).length === 0) { 76 | core.setFailed('No authors found in the PR'); 77 | return ''; 78 | } 79 | 80 | // Create a string of the form "Co-authored-by: Name " 81 | // ref: https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors 82 | const coAuthors = Object.values(authors).map(author => { 83 | return `Co-authored-by: ${author.name} <${author.email}>`; 84 | }).join('\n'); 85 | 86 | core.debug(coAuthors);; 87 | 88 | return coAuthors; 89 | 90 | - name: Automerge PR 91 | uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6 92 | env: 93 | GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}" 94 | MERGE_LABELS: "!do-not-merge,ready-to-merge" 95 | MERGE_METHOD: "squash" 96 | # Using the output of the previous step (`Co-authored-by: ...` lines) as commit description. 97 | # Important to keep 2 empty lines as https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line mentions 98 | MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})\n\n\n${{ fromJSON(steps.create-commit-message.outputs.result) }}" 99 | MERGE_RETRIES: "20" 100 | MERGE_RETRY_SLEEP: "30000" 101 | -------------------------------------------------------------------------------- /.github/workflows/automerge-for-humans-remove-ready-to-merge-label-on-edit.yml: -------------------------------------------------------------------------------- 1 | # This workflow is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # Defence from evil contributor that after adding `ready-to-merge` all suddenly makes evil commit or evil change in PR title 5 | # Label is removed once above action is detected 6 | name: Remove ready-to-merge label 7 | 8 | on: 9 | pull_request_target: 10 | types: 11 | - synchronize 12 | - edited 13 | 14 | jobs: 15 | remove-ready-label: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Remove label 19 | uses: actions/github-script@v7 20 | with: 21 | github-token: ${{ secrets.GH_TOKEN }} 22 | script: | 23 | const labelToRemove = 'ready-to-merge'; 24 | const labels = context.payload.pull_request.labels; 25 | const isLabelPresent = labels.some(label => label.name === labelToRemove) 26 | if(!isLabelPresent) return; 27 | github.rest.issues.removeLabel({ 28 | issue_number: context.issue.number, 29 | owner: context.repo.owner, 30 | repo: context.repo.repo, 31 | name: labelToRemove 32 | }) 33 | -------------------------------------------------------------------------------- /.github/workflows/automerge-orphans.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | name: 'Notify on failing automerge' 5 | 6 | on: 7 | schedule: 8 | - cron: "0 0 * * *" 9 | 10 | jobs: 11 | identify-orphans: 12 | if: startsWith(github.repository, 'asyncapi/') 13 | name: Find orphans and notify 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Checkout repository 17 | uses: actions/checkout@v4 18 | - name: Get list of orphans 19 | uses: actions/github-script@v7 20 | id: orphans 21 | with: 22 | github-token: ${{ secrets.GITHUB_TOKEN }} 23 | script: | 24 | const query = `query($owner:String!, $name:String!) { 25 | repository(owner:$owner, name:$name){ 26 | pullRequests(first: 100, states: OPEN){ 27 | nodes{ 28 | title 29 | url 30 | author { 31 | resourcePath 32 | } 33 | } 34 | } 35 | } 36 | }`; 37 | const variables = { 38 | owner: context.repo.owner, 39 | name: context.repo.repo 40 | }; 41 | const { repository: { pullRequests: { nodes } } } = await github.graphql(query, variables); 42 | 43 | let orphans = nodes.filter( (pr) => pr.author.resourcePath === '/asyncapi-bot' || pr.author.resourcePath === '/apps/dependabot') 44 | 45 | if (orphans.length) { 46 | core.setOutput('found', 'true'); 47 | //Yes, this is very naive approach to assume there is just one PR causing issues, there can be a case that more PRs are affected the same day 48 | //The thing is that handling multiple PRs will increase a complexity in this PR that in my opinion we should avoid 49 | //The other PRs will be reported the next day the action runs, or person that checks first url will notice the other ones 50 | core.setOutput('url', orphans[0].url); 51 | core.setOutput('title', orphans[0].title); 52 | } 53 | - if: steps.orphans.outputs.found == 'true' 54 | name: Convert markdown to slack markdown 55 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 56 | id: issuemarkdown 57 | with: 58 | markdown: "-> [${{steps.orphans.outputs.title}}](${{steps.orphans.outputs.url}})" 59 | - if: steps.orphans.outputs.found == 'true' 60 | name: Send info about orphan to slack 61 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 62 | env: 63 | SLACK_WEBHOOK: ${{secrets.SLACK_CI_FAIL_NOTIFY}} 64 | SLACK_TITLE: 🚨 Not merged PR that should be automerged 🚨 65 | SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}} 66 | MSG_MINIMAL: true -------------------------------------------------------------------------------- /.github/workflows/automerge.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo. 3 | 4 | name: Automerge PRs from bots 5 | 6 | on: 7 | pull_request_target: 8 | types: 9 | - opened 10 | - synchronize 11 | 12 | jobs: 13 | autoapprove-for-bot: 14 | name: Autoapprove PR comming from a bot 15 | if: > 16 | contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]"]'), github.event.pull_request.user.login) && 17 | contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]"]'), github.actor) && 18 | !contains(github.event.pull_request.labels.*.name, 'released') 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Autoapproving 22 | uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 is used https://github.com/hmarr/auto-approve-action/releases/tag/v3.2.1 23 | with: 24 | github-token: "${{ secrets.GH_TOKEN_BOT_EVE }}" 25 | 26 | - name: Label autoapproved 27 | uses: actions/github-script@v7 28 | with: 29 | github-token: ${{ secrets.GH_TOKEN }} 30 | script: | 31 | github.rest.issues.addLabels({ 32 | issue_number: context.issue.number, 33 | owner: context.repo.owner, 34 | repo: context.repo.repo, 35 | labels: ['autoapproved', 'autoupdate'] 36 | }) 37 | 38 | automerge-for-bot: 39 | name: Automerge PR autoapproved by a bot 40 | needs: [autoapprove-for-bot] 41 | runs-on: ubuntu-latest 42 | steps: 43 | - name: Automerging 44 | uses: pascalgn/automerge-action@22948e0bc22f0aa673800da838595a3e7347e584 #v0.15.6 https://github.com/pascalgn/automerge-action/releases/tag/v0.15.6 45 | env: 46 | GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}" 47 | GITHUB_LOGIN: asyncapi-bot 48 | MERGE_LABELS: "!do-not-merge" 49 | MERGE_METHOD: "squash" 50 | MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})" 51 | MERGE_RETRIES: "20" 52 | MERGE_RETRY_SLEEP: "30000" 53 | -------------------------------------------------------------------------------- /.github/workflows/autoupdate.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # This workflow is designed to work with: 5 | # - autoapprove and automerge workflows for dependabot and asyncapibot. 6 | # - special release branches that we from time to time create in upstream repos. If we open up PRs for them from the very beginning of the release, the release branch will constantly update with new things from the destination branch they are opened against 7 | 8 | # It uses GitHub Action that auto-updates pull requests branches, whenever changes are pushed to their destination branch. 9 | # Autoupdating to latest destination branch works only in the context of upstream repo and not forks 10 | 11 | name: autoupdate 12 | 13 | on: 14 | push: 15 | branches-ignore: 16 | - 'version-bump/**' 17 | - 'dependabot/**' 18 | - 'bot/**' 19 | - 'all-contributors/**' 20 | 21 | jobs: 22 | autoupdate-for-bot: 23 | if: startsWith(github.repository, 'asyncapi/') 24 | name: Autoupdate autoapproved PR created in the upstream 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Autoupdating 28 | uses: docker://chinthakagodawita/autoupdate-action:v1 29 | env: 30 | GITHUB_TOKEN: '${{ secrets.GH_TOKEN_BOT_EVE }}' 31 | PR_FILTER: "labelled" 32 | PR_LABELS: "autoupdate" 33 | PR_READY_STATE: "ready_for_review" 34 | MERGE_CONFLICT_ACTION: "ignore" 35 | -------------------------------------------------------------------------------- /.github/workflows/bounty-program-commands.yml: -------------------------------------------------------------------------------- 1 | # This workflow is centrally managed at https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repository, as they will be overwritten with 3 | # changes made to the same file in the abovementioned repository. 4 | 5 | # The purpose of this workflow is to allow Bounty Team members 6 | # (https://github.com/orgs/asyncapi/teams/bounty_team) to issue commands to the 7 | # organization's global AsyncAPI bot related to the Bounty Program, while at the 8 | # same time preventing unauthorized users from misusing them. 9 | 10 | name: Bounty Program commands 11 | 12 | on: 13 | issue_comment: 14 | types: 15 | - created 16 | 17 | env: 18 | BOUNTY_PROGRAM_LABELS_JSON: | 19 | [ 20 | {"name": "bounty", "color": "0e8a16", "description": "Participation in the Bounty Program"} 21 | ] 22 | 23 | jobs: 24 | guard-against-unauthorized-use: 25 | if: > 26 | github.actor != ('aeworxet' || 'thulieblack') && 27 | ( 28 | startsWith(github.event.comment.body, '/bounty' ) 29 | ) 30 | 31 | runs-on: ubuntu-latest 32 | 33 | steps: 34 | - name: ❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command 35 | uses: actions/github-script@v7 36 | with: 37 | github-token: ${{ secrets.GH_TOKEN }} 38 | script: | 39 | const commentText = `❌ @${{github.actor}} is not authorized to use the Bounty Program's commands. 40 | These commands can only be used by members of the [Bounty Team](https://github.com/orgs/asyncapi/teams/bounty_team).`; 41 | 42 | console.log(`❌ @${{github.actor}} made an unauthorized attempt to use a Bounty Program's command.`); 43 | github.rest.issues.createComment({ 44 | issue_number: context.issue.number, 45 | owner: context.repo.owner, 46 | repo: context.repo.repo, 47 | body: commentText 48 | }) 49 | 50 | add-label-bounty: 51 | if: > 52 | github.actor == ('aeworxet' || 'thulieblack') && 53 | ( 54 | startsWith(github.event.comment.body, '/bounty' ) 55 | ) 56 | 57 | runs-on: ubuntu-latest 58 | 59 | steps: 60 | - name: Add label `bounty` 61 | uses: actions/github-script@v7 62 | with: 63 | github-token: ${{ secrets.GH_TOKEN }} 64 | script: | 65 | const BOUNTY_PROGRAM_LABELS = JSON.parse(process.env.BOUNTY_PROGRAM_LABELS_JSON); 66 | let LIST_OF_LABELS_FOR_REPO = await github.rest.issues.listLabelsForRepo({ 67 | owner: context.repo.owner, 68 | repo: context.repo.repo, 69 | }); 70 | 71 | LIST_OF_LABELS_FOR_REPO = LIST_OF_LABELS_FOR_REPO.data.map(key => key.name); 72 | 73 | if (!LIST_OF_LABELS_FOR_REPO.includes(BOUNTY_PROGRAM_LABELS[0].name)) { 74 | await github.rest.issues.createLabel({ 75 | owner: context.repo.owner, 76 | repo: context.repo.repo, 77 | name: BOUNTY_PROGRAM_LABELS[0].name, 78 | color: BOUNTY_PROGRAM_LABELS[0].color, 79 | description: BOUNTY_PROGRAM_LABELS[0].description 80 | }); 81 | } 82 | 83 | console.log('Adding label `bounty`...'); 84 | github.rest.issues.addLabels({ 85 | issue_number: context.issue.number, 86 | owner: context.repo.owner, 87 | repo: context.repo.repo, 88 | labels: [BOUNTY_PROGRAM_LABELS[0].name] 89 | }) 90 | 91 | remove-label-bounty: 92 | if: > 93 | github.actor == ('aeworxet' || 'thulieblack') && 94 | ( 95 | startsWith(github.event.comment.body, '/unbounty' ) 96 | ) 97 | 98 | runs-on: ubuntu-latest 99 | 100 | steps: 101 | - name: Remove label `bounty` 102 | uses: actions/github-script@v7 103 | with: 104 | github-token: ${{ secrets.GH_TOKEN }} 105 | script: | 106 | const BOUNTY_PROGRAM_LABELS = JSON.parse(process.env.BOUNTY_PROGRAM_LABELS_JSON); 107 | let LIST_OF_LABELS_FOR_ISSUE = await github.rest.issues.listLabelsOnIssue({ 108 | owner: context.repo.owner, 109 | repo: context.repo.repo, 110 | issue_number: context.issue.number, 111 | }); 112 | 113 | LIST_OF_LABELS_FOR_ISSUE = LIST_OF_LABELS_FOR_ISSUE.data.map(key => key.name); 114 | 115 | if (LIST_OF_LABELS_FOR_ISSUE.includes(BOUNTY_PROGRAM_LABELS[0].name)) { 116 | console.log('Removing label `bounty`...'); 117 | github.rest.issues.removeLabel({ 118 | issue_number: context.issue.number, 119 | owner: context.repo.owner, 120 | repo: context.repo.repo, 121 | name: [BOUNTY_PROGRAM_LABELS[0].name] 122 | }) 123 | } 124 | -------------------------------------------------------------------------------- /.github/workflows/bump.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # Purpose of this action is to update npm package in libraries that use it. It is like dependabot for asyncapi npm modules only. 5 | # It runs in a repo after merge of release commit and searches for other packages that use released package. Every found package gets updated with lates version 6 | 7 | name: Bump package version in dependent repos - if Node project 8 | 9 | on: 10 | # It cannot run on release event as when release is created then version is not yet bumped in package.json 11 | # This means we cannot extract easily latest version and have a risk that package is not yet on npm 12 | push: 13 | branches: 14 | - master 15 | 16 | jobs: 17 | bump-in-dependent-projects: 18 | name: Bump this package in repositories that depend on it 19 | if: startsWith(github.event.commits[0].message, 'chore(release):') 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: Checkout repo 23 | uses: actions/checkout@v4 24 | - name: Check if Node.js project and has package.json 25 | id: packagejson 26 | run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT 27 | - if: steps.packagejson.outputs.exists == 'true' 28 | name: Bumping latest version of this package in other repositories 29 | uses: derberg/npm-dependency-manager-for-your-github-org@1eafd3bf3974f21d395c1abac855cb04b295d570 # using v6.-.- https://github.com/derberg/npm-dependency-manager-for-your-github-org/releases/tag/v6 30 | with: 31 | github_token: ${{ secrets.GH_TOKEN }} 32 | committer_username: asyncapi-bot 33 | committer_email: info@asyncapi.io 34 | repos_to_ignore: spec,bindings,saunter,server-api 35 | custom_id: "dependency update from asyncapi bot" 36 | -------------------------------------------------------------------------------- /.github/workflows/help-command.yml: -------------------------------------------------------------------------------- 1 | # This workflow is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | name: Create help comment 5 | 6 | on: 7 | issue_comment: 8 | types: 9 | - created 10 | 11 | jobs: 12 | create_help_comment_pr: 13 | if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }} 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: Add comment to PR 17 | uses: actions/github-script@v7 18 | with: 19 | github-token: ${{ secrets.GH_TOKEN }} 20 | script: | 21 | //Yes to add comment to PR the same endpoint is use that we use to create a comment in issue 22 | //For more details http://developer.github.com/v3/issues/comments/ 23 | //Also proved by this action https://github.com/actions-ecosystem/action-create-comment/blob/main/src/main.ts 24 | github.rest.issues.createComment({ 25 | issue_number: context.issue.number, 26 | owner: context.repo.owner, 27 | repo: context.repo.repo, 28 | body: `Hello, @${{ github.actor }}! 👋🏼 29 | 30 | I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand! 31 | 32 | At the moment the following comments are supported in pull requests: 33 | 34 | - \`/please-take-a-look\` or \`/ptal\` - This comment will add a comment to the PR asking for attention from the reviewrs who have not reviewed the PR yet. 35 | - \`/ready-to-merge\` or \`/rtm\` - This comment will trigger automerge of PR in case all required checks are green, approvals in place and do-not-merge label is not added 36 | - \`/do-not-merge\` or \`/dnm\` - This comment will block automerging even if all conditions are met and ready-to-merge label is added 37 | - \`/autoupdate\` or \`/au\` - This comment will add \`autoupdate\` label to the PR and keeps your PR up-to-date to the target branch's future changes. Unless there is a merge conflict or it is a draft PR. (Currently only works for upstream branches.) 38 | - \`/update\` or \`/u\` - This comment will update the PR with the latest changes from the target branch. Unless there is a merge conflict or it is a draft PR. NOTE: this only updates the PR once, so if you need to update again, you need to call the command again.` 39 | }) 40 | 41 | create_help_comment_issue: 42 | if: ${{ !github.event.issue.pull_request && startsWith(github.event.comment.body, '/help') && github.actor != 'asyncapi-bot' }} 43 | runs-on: ubuntu-latest 44 | steps: 45 | - name: Add comment to Issue 46 | uses: actions/github-script@v7 47 | with: 48 | github-token: ${{ secrets.GH_TOKEN }} 49 | script: | 50 | github.rest.issues.createComment({ 51 | issue_number: context.issue.number, 52 | owner: context.repo.owner, 53 | repo: context.repo.repo, 54 | body: `Hello, @${{ github.actor }}! 👋🏼 55 | 56 | I'm 🧞🧞🧞 Genie 🧞🧞🧞 from the magic lamp. Looks like somebody needs a hand! 57 | 58 | At the moment the following comments are supported in issues: 59 | 60 | - \`/good-first-issue {js | ts | java | go | docs | design | ci-cd}\` or \`/gfi {js | ts | java | go | docs | design | ci-cd}\` - label an issue as a \`good first issue\`. 61 | example: \`/gfi js\` or \`/good-first-issue ci-cd\` 62 | - \`/transfer-issue {repo-name}\` or \`/ti {repo-name}\` - transfer issue from the source repository to the other repository passed by the user. example: \`/ti cli\` or \`/transfer-issue cli\`.` 63 | }) -------------------------------------------------------------------------------- /.github/workflows/if-nodejs-pr-testing.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # It does magic only if there is package.json file in the root of the project 5 | name: PR testing - if Node project 6 | 7 | on: 8 | pull_request: 9 | types: [opened, reopened, synchronize, ready_for_review] 10 | 11 | jobs: 12 | test-nodejs-pr: 13 | name: Test NodeJS PR - ${{ matrix.os }} 14 | runs-on: ${{ matrix.os }} 15 | strategy: 16 | matrix: 17 | # Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner. 18 | # See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001 19 | os: [ubuntu-latest, macos-13, windows-latest] 20 | steps: 21 | - if: > 22 | !github.event.pull_request.draft && !( 23 | (github.actor == 'asyncapi-bot' && ( 24 | startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || 25 | startsWith(github.event.pull_request.title, 'chore(release):') 26 | )) || 27 | (github.actor == 'asyncapi-bot-eve' && ( 28 | startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || 29 | startsWith(github.event.pull_request.title, 'chore(release):') 30 | )) || 31 | (github.actor == 'allcontributors[bot]' && 32 | startsWith(github.event.pull_request.title, 'docs: add') 33 | ) 34 | ) 35 | id: should_run 36 | name: Should Run 37 | run: echo "shouldrun=true" >> $GITHUB_OUTPUT 38 | shell: bash 39 | - if: steps.should_run.outputs.shouldrun == 'true' 40 | name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows 41 | run: | 42 | git config --global core.autocrlf false 43 | git config --global core.eol lf 44 | shell: bash 45 | - if: steps.should_run.outputs.shouldrun == 'true' 46 | name: Checkout repository 47 | uses: actions/checkout@v4 48 | - if: steps.should_run.outputs.shouldrun == 'true' 49 | name: Check if Node.js project and has package.json 50 | id: packagejson 51 | run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT 52 | shell: bash 53 | - if: steps.packagejson.outputs.exists == 'true' 54 | name: Check package-lock version 55 | uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master 56 | id: lockversion 57 | - if: steps.packagejson.outputs.exists == 'true' 58 | name: Setup Node.js 59 | uses: actions/setup-node@v4 60 | with: 61 | node-version: "${{ steps.lockversion.outputs.version }}" 62 | - if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest' 63 | #npm cli 10 is buggy because of some cache issue 64 | name: Install npm cli 8 65 | shell: bash 66 | run: npm install -g npm@8.19.4 67 | - if: steps.packagejson.outputs.exists == 'true' 68 | name: Install dependencies 69 | shell: bash 70 | run: npm ci 71 | - if: steps.packagejson.outputs.exists == 'true' 72 | name: Test 73 | run: npm test --if-present 74 | - if: steps.packagejson.outputs.exists == 'true' && matrix.os == 'ubuntu-latest' 75 | #linting should run just one and not on all possible operating systems 76 | name: Run linter 77 | run: npm run lint --if-present 78 | - if: steps.packagejson.outputs.exists == 'true' 79 | name: Run release assets generation to make sure PR does not break it 80 | shell: bash 81 | run: npm run generate:assets --if-present 82 | -------------------------------------------------------------------------------- /.github/workflows/if-nodejs-release.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # It does magic only if there is package.json file in the root of the project 5 | name: Release - if Node project 6 | 7 | on: 8 | push: 9 | branches: 10 | - master 11 | # below lines are not enough to have release supported for these branches 12 | # make sure configuration of `semantic-release` package mentions these branches 13 | - next-spec 14 | - next-major 15 | - next-major-spec 16 | - beta 17 | - alpha 18 | - next 19 | 20 | jobs: 21 | 22 | test-nodejs: 23 | # We just check the message of first commit as there is always just one commit because we squash into one before merging 24 | # "commits" contains array of objects where one of the properties is commit "message" 25 | # Release workflow will be skipped if release conventional commits are not used 26 | if: | 27 | startsWith( github.repository, 'asyncapi/' ) && 28 | (startsWith( github.event.commits[0].message , 'fix:' ) || 29 | startsWith( github.event.commits[0].message, 'fix!:' ) || 30 | startsWith( github.event.commits[0].message, 'feat:' ) || 31 | startsWith( github.event.commits[0].message, 'feat!:' )) 32 | name: Test NodeJS release on ${{ matrix.os }} 33 | runs-on: ${{ matrix.os }} 34 | strategy: 35 | matrix: 36 | # Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner. 37 | # See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001 38 | os: [ubuntu-latest, macos-13, windows-latest] 39 | steps: 40 | - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows 41 | run: | 42 | git config --global core.autocrlf false 43 | git config --global core.eol lf 44 | shell: bash 45 | - name: Checkout repository 46 | uses: actions/checkout@v4 47 | - name: Check if Node.js project and has package.json 48 | id: packagejson 49 | run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT 50 | shell: bash 51 | - if: steps.packagejson.outputs.exists == 'true' 52 | name: Check package-lock version 53 | uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master 54 | id: lockversion 55 | - if: steps.packagejson.outputs.exists == 'true' 56 | name: Setup Node.js 57 | uses: actions/setup-node@v4 58 | with: 59 | node-version: "${{ steps.lockversion.outputs.version }}" 60 | - if: steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest' 61 | name: Install npm cli 8 62 | shell: bash 63 | #npm cli 10 is buggy because of some cache issues 64 | run: npm install -g npm@8.19.4 65 | - if: steps.packagejson.outputs.exists == 'true' 66 | name: Install dependencies 67 | shell: bash 68 | run: npm ci 69 | - if: steps.packagejson.outputs.exists == 'true' 70 | name: Run test 71 | run: npm test --if-present 72 | - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel 73 | name: Report workflow run status to Slack 74 | uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 #using https://github.com/8398a7/action-slack/releases/tag/v3.16.2 75 | with: 76 | status: ${{ job.status }} 77 | fields: repo,action,workflow 78 | text: 'Release workflow failed in testing job' 79 | env: 80 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} 81 | 82 | release: 83 | needs: [test-nodejs] 84 | name: Publish to any of NPM, Github, or Docker Hub 85 | runs-on: ubuntu-latest 86 | steps: 87 | - name: Set git to use LF #to once and for all finish neverending fight between Unix and Windows 88 | run: | 89 | git config --global core.autocrlf false 90 | git config --global core.eol lf 91 | - name: Checkout repository 92 | uses: actions/checkout@v4 93 | - name: Check if Node.js project and has package.json 94 | id: packagejson 95 | run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT 96 | shell: bash 97 | - if: steps.packagejson.outputs.exists == 'true' 98 | name: Check package-lock version 99 | uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master 100 | id: lockversion 101 | - if: steps.packagejson.outputs.exists == 'true' 102 | name: Setup Node.js 103 | uses: actions/setup-node@v4 104 | with: 105 | node-version: "${{ steps.lockversion.outputs.version }}" 106 | - if: steps.packagejson.outputs.exists == 'true' 107 | name: Install dependencies 108 | shell: bash 109 | run: npm ci 110 | - if: steps.packagejson.outputs.exists == 'true' 111 | name: Add plugin for conventional commits for semantic-release 112 | run: npm install --save-dev conventional-changelog-conventionalcommits@5.0.0 113 | - if: steps.packagejson.outputs.exists == 'true' 114 | name: Publish to any of NPM, Github, and Docker Hub 115 | id: release 116 | env: 117 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} 118 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 119 | DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} 120 | DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} 121 | GIT_AUTHOR_NAME: asyncapi-bot 122 | GIT_AUTHOR_EMAIL: info@asyncapi.io 123 | GIT_COMMITTER_NAME: asyncapi-bot 124 | GIT_COMMITTER_EMAIL: info@asyncapi.io 125 | run: npx semantic-release@19.0.4 126 | - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel 127 | name: Report workflow run status to Slack 128 | uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 #using https://github.com/8398a7/action-slack/releases/tag/v3.16.2 129 | with: 130 | status: ${{ job.status }} 131 | fields: repo,action,workflow 132 | text: 'Release workflow failed in release job' 133 | env: 134 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} 135 | -------------------------------------------------------------------------------- /.github/workflows/if-nodejs-version-bump.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # It does magic only if there is package.json file in the root of the project 5 | name: Version bump - if Node.js project 6 | 7 | on: 8 | release: 9 | types: 10 | - published 11 | 12 | jobs: 13 | version_bump: 14 | name: Generate assets and bump NodeJS 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout repository 18 | uses: actions/checkout@v4 19 | with: 20 | # target branch of release. More info https://docs.github.com/en/rest/reference/repos#releases 21 | # in case release is created from release branch then we need to checkout from given branch 22 | # if @semantic-release/github is used to publish, the minimum version is 7.2.0 for proper working 23 | ref: ${{ github.event.release.target_commitish }} 24 | - name: Check if Node.js project and has package.json 25 | id: packagejson 26 | run: test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT 27 | - if: steps.packagejson.outputs.exists == 'true' 28 | name: Check package-lock version 29 | uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master 30 | id: lockversion 31 | - if: steps.packagejson.outputs.exists == 'true' 32 | name: Setup Node.js 33 | uses: actions/setup-node@v4 34 | with: 35 | node-version: "${{ steps.lockversion.outputs.version }}" 36 | cache: 'npm' 37 | cache-dependency-path: '**/package-lock.json' 38 | - if: steps.packagejson.outputs.exists == 'true' 39 | name: Install dependencies 40 | run: npm ci 41 | - if: steps.packagejson.outputs.exists == 'true' 42 | name: Assets generation 43 | run: npm run generate:assets --if-present 44 | - if: steps.packagejson.outputs.exists == 'true' 45 | name: Bump version in package.json 46 | # There is no need to substract "v" from the tag as version script handles it 47 | # When adding "bump:version" script in package.json, make sure no tags are added by default (--no-git-tag-version) as they are already added by release workflow 48 | # When adding "bump:version" script in package.json, make sure --allow-same-version is set in case someone forgot and updated package.json manually and we want to avoide this action to fail and raise confusion 49 | run: VERSION=${{github.event.release.tag_name}} npm run bump:version 50 | - if: steps.packagejson.outputs.exists == 'true' 51 | name: Create Pull Request with updated asset files including package.json 52 | uses: peter-evans/create-pull-request@38e0b6e68b4c852a5500a94740f0e535e0d7ba54 # use 4.2.4 https://github.com/peter-evans/create-pull-request/releases/tag/v4.2.4 53 | with: 54 | token: ${{ secrets.GH_TOKEN }} 55 | commit-message: 'chore(release): ${{github.event.release.tag_name}}' 56 | committer: asyncapi-bot 57 | author: asyncapi-bot 58 | title: 'chore(release): ${{github.event.release.tag_name}}' 59 | body: 'Version bump in package.json for release [${{github.event.release.tag_name}}](${{github.event.release.html_url}})' 60 | branch: version-bump/${{github.event.release.tag_name}} 61 | - if: failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel 62 | name: Report workflow run status to Slack 63 | uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 #using https://github.com/8398a7/action-slack/releases/tag/v3.16.2 64 | with: 65 | status: ${{ job.status }} 66 | fields: repo,action,workflow 67 | text: 'Unable to bump the version in package.json after the release' 68 | env: 69 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CI_FAIL_NOTIFY }} -------------------------------------------------------------------------------- /.github/workflows/issues-prs-notifications.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # This action notifies community on slack whenever there is a new issue, PR or discussion started in given repository 5 | name: Notify slack 6 | 7 | on: 8 | issues: 9 | types: [opened, reopened] 10 | 11 | pull_request_target: 12 | types: [opened, reopened, ready_for_review] 13 | 14 | discussion: 15 | types: [created] 16 | 17 | jobs: 18 | issue: 19 | if: github.event_name == 'issues' && github.actor != 'asyncapi-bot' && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' 20 | name: Notify slack on every new issue 21 | runs-on: ubuntu-latest 22 | steps: 23 | - name: Convert markdown to slack markdown for issue 24 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 25 | id: issuemarkdown 26 | with: 27 | markdown: "[${{github.event.issue.title}}](${{github.event.issue.html_url}}) \n ${{github.event.issue.body}}" 28 | - name: Send info about issue 29 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 30 | env: 31 | SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}} 32 | SLACK_TITLE: 🐛 New Issue in ${{github.repository}} 🐛 33 | SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}} 34 | MSG_MINIMAL: true 35 | 36 | pull_request: 37 | if: github.event_name == 'pull_request_target' && github.actor != 'asyncapi-bot' && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' 38 | name: Notify slack on every new pull request 39 | runs-on: ubuntu-latest 40 | steps: 41 | - name: Convert markdown to slack markdown for pull request 42 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 43 | id: prmarkdown 44 | with: 45 | markdown: "[${{github.event.pull_request.title}}](${{github.event.pull_request.html_url}}) \n ${{github.event.pull_request.body}}" 46 | - name: Send info about pull request 47 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 48 | env: 49 | SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}} 50 | SLACK_TITLE: 💪 New Pull Request in ${{github.repository}} 💪 51 | SLACK_MESSAGE: ${{steps.prmarkdown.outputs.text}} 52 | MSG_MINIMAL: true 53 | 54 | discussion: 55 | if: github.event_name == 'discussion' && github.actor != 'asyncapi-bot' && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' 56 | name: Notify slack on every new pull request 57 | runs-on: ubuntu-latest 58 | steps: 59 | - name: Convert markdown to slack markdown for pull request 60 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 61 | id: discussionmarkdown 62 | with: 63 | markdown: "[${{github.event.discussion.title}}](${{github.event.discussion.html_url}}) \n ${{github.event.discussion.body}}" 64 | - name: Send info about pull request 65 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 66 | env: 67 | SLACK_WEBHOOK: ${{secrets.SLACK_GITHUB_NEWISSUEPR}} 68 | SLACK_TITLE: 💬 New Discussion in ${{github.repository}} 💬 69 | SLACK_MESSAGE: ${{steps.discussionmarkdown.outputs.text}} 70 | MSG_MINIMAL: true 71 | -------------------------------------------------------------------------------- /.github/workflows/lint-pr-title.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | name: Lint PR title 5 | 6 | on: 7 | pull_request_target: 8 | types: [opened, reopened, synchronize, edited, ready_for_review] 9 | 10 | jobs: 11 | lint-pr-title: 12 | name: Lint PR title 13 | runs-on: ubuntu-latest 14 | steps: 15 | # Since this workflow is REQUIRED for a PR to be mergable, we have to have this 'if' statement in step level instead of job level. 16 | - if: ${{ !contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]", "allcontributors[bot]"]'), github.actor) }} 17 | uses: amannn/action-semantic-pull-request@c3cd5d1ea3580753008872425915e343e351ab54 #version 5.2.0 https://github.com/amannn/action-semantic-pull-request/releases/tag/v5.2.0 18 | id: lint_pr_title 19 | env: 20 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN}} 21 | with: 22 | subjectPattern: ^(?![A-Z]).+$ 23 | subjectPatternError: | 24 | The subject "{subject}" found in the pull request title "{title}" should start with a lowercase character. 25 | 26 | # Comments the error message from the above lint_pr_title action 27 | - if: ${{ always() && steps.lint_pr_title.outputs.error_message != null && !contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]", "allcontributors[bot]"]'), github.actor)}} 28 | name: Comment on PR 29 | uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd #use 2.5.0 https://github.com/marocchino/sticky-pull-request-comment/releases/tag/v2.5.0 30 | with: 31 | header: pr-title-lint-error 32 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN}} 33 | message: | 34 | 35 | We require all PRs to follow [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). 36 | More details 👇🏼 37 | ``` 38 | ${{ steps.lint_pr_title.outputs.error_message}} 39 | ``` 40 | # deletes the error comment if the title is correct 41 | - if: ${{ steps.lint_pr_title.outputs.error_message == null }} 42 | name: delete the comment 43 | uses: marocchino/sticky-pull-request-comment@3d60a5b2dae89d44e0c6ddc69dd7536aec2071cd #use 2.5.0 https://github.com/marocchino/sticky-pull-request-comment/releases/tag/v2.5.0 44 | with: 45 | header: pr-title-lint-error 46 | delete: true 47 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN}} 48 | -------------------------------------------------------------------------------- /.github/workflows/notify-tsc-members-mention.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # This action notifies community on slack whenever there is a new issue, PR or discussion started in given repository 5 | name: Notify slack and email subscribers whenever TSC members are mentioned in GitHub 6 | 7 | on: 8 | issue_comment: 9 | types: 10 | - created 11 | 12 | discussion_comment: 13 | types: 14 | - created 15 | 16 | issues: 17 | types: 18 | - opened 19 | 20 | pull_request_target: 21 | types: 22 | - opened 23 | 24 | discussion: 25 | types: 26 | - created 27 | 28 | jobs: 29 | issue: 30 | if: github.event_name == 'issues' && contains(github.event.issue.body, '@asyncapi/tsc_members') 31 | name: TSC notification on every new issue 32 | runs-on: ubuntu-latest 33 | steps: 34 | - name: Checkout repository 35 | uses: actions/checkout@v4 36 | - name: Setup Node.js 37 | uses: actions/setup-node@v4 38 | with: 39 | node-version: 16 40 | cache: 'npm' 41 | cache-dependency-path: '**/package-lock.json' 42 | ######### 43 | # Handling Slack notifications 44 | ######### 45 | - name: Convert markdown to slack markdown 46 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 47 | id: issuemarkdown 48 | with: 49 | markdown: "[${{github.event.issue.title}}](${{github.event.issue.html_url}}) \n ${{github.event.issue.body}}" 50 | - name: Send info about issue 51 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 52 | env: 53 | SLACK_WEBHOOK: ${{secrets.SLACK_TSC_MEMBERS_NOTIFY}} 54 | SLACK_TITLE: 🆘 New issue that requires TSC Members attention 🆘 55 | SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}} 56 | MSG_MINIMAL: true 57 | ######### 58 | # Handling Mailchimp notifications 59 | ######### 60 | - name: Install deps 61 | run: npm install 62 | working-directory: ./.github/workflows/scripts/mailchimp 63 | - name: Send email with MailChimp 64 | uses: actions/github-script@v7 65 | env: 66 | CALENDAR_ID: ${{ secrets.CALENDAR_ID }} 67 | CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} 68 | MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} 69 | with: 70 | script: | 71 | const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); 72 | sendEmail('${{github.event.issue.html_url}}', '${{github.event.issue.title}}'); 73 | 74 | pull_request: 75 | if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.body, '@asyncapi/tsc_members') 76 | name: TSC notification on every new pull request 77 | runs-on: ubuntu-latest 78 | steps: 79 | - name: Checkout repository 80 | uses: actions/checkout@v4 81 | - name: Setup Node.js 82 | uses: actions/setup-node@v4 83 | with: 84 | node-version: 16 85 | cache: 'npm' 86 | cache-dependency-path: '**/package-lock.json' 87 | ######### 88 | # Handling Slack notifications 89 | ######### 90 | - name: Convert markdown to slack markdown 91 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 92 | id: prmarkdown 93 | with: 94 | markdown: "[${{github.event.pull_request.title}}](${{github.event.pull_request.html_url}}) \n ${{github.event.pull_request.body}}" 95 | - name: Send info about pull request 96 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 97 | env: 98 | SLACK_WEBHOOK: ${{secrets.SLACK_TSC_MEMBERS_NOTIFY}} 99 | SLACK_TITLE: 🆘 New PR that requires TSC Members attention 🆘 100 | SLACK_MESSAGE: ${{steps.prmarkdown.outputs.text}} 101 | MSG_MINIMAL: true 102 | ######### 103 | # Handling Mailchimp notifications 104 | ######### 105 | - name: Install deps 106 | run: npm install 107 | working-directory: ./.github/workflows/scripts/mailchimp 108 | - name: Send email with MailChimp 109 | uses: actions/github-script@v7 110 | env: 111 | CALENDAR_ID: ${{ secrets.CALENDAR_ID }} 112 | CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} 113 | MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} 114 | with: 115 | script: | 116 | const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); 117 | sendEmail('${{github.event.pull_request.html_url}}', '${{github.event.pull_request.title}}'); 118 | 119 | discussion: 120 | if: github.event_name == 'discussion' && contains(github.event.discussion.body, '@asyncapi/tsc_members') 121 | name: TSC notification on every new discussion 122 | runs-on: ubuntu-latest 123 | steps: 124 | - name: Checkout repository 125 | uses: actions/checkout@v4 126 | - name: Setup Node.js 127 | uses: actions/setup-node@v4 128 | with: 129 | node-version: 16 130 | cache: 'npm' 131 | cache-dependency-path: '**/package-lock.json' 132 | ######### 133 | # Handling Slack notifications 134 | ######### 135 | - name: Convert markdown to slack markdown 136 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 137 | id: discussionmarkdown 138 | with: 139 | markdown: "[${{github.event.discussion.title}}](${{github.event.discussion.html_url}}) \n ${{github.event.discussion.body}}" 140 | - name: Send info about pull request 141 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 142 | env: 143 | SLACK_WEBHOOK: ${{secrets.SLACK_TSC_MEMBERS_NOTIFY}} 144 | SLACK_TITLE: 🆘 New discussion that requires TSC Members attention 🆘 145 | SLACK_MESSAGE: ${{steps.discussionmarkdown.outputs.text}} 146 | MSG_MINIMAL: true 147 | ######### 148 | # Handling Mailchimp notifications 149 | ######### 150 | - name: Install deps 151 | run: npm install 152 | working-directory: ./.github/workflows/scripts/mailchimp 153 | - name: Send email with MailChimp 154 | uses: actions/github-script@v7 155 | env: 156 | CALENDAR_ID: ${{ secrets.CALENDAR_ID }} 157 | CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} 158 | MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} 159 | with: 160 | script: | 161 | const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); 162 | sendEmail('${{github.event.discussion.html_url}}', '${{github.event.discussion.title}}'); 163 | 164 | issue_comment: 165 | if: ${{ github.event_name == 'issue_comment' && !github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members') }} 166 | name: TSC notification on every new comment in issue 167 | runs-on: ubuntu-latest 168 | steps: 169 | - name: Checkout repository 170 | uses: actions/checkout@v4 171 | - name: Setup Node.js 172 | uses: actions/setup-node@v4 173 | with: 174 | node-version: 16 175 | cache: 'npm' 176 | cache-dependency-path: '**/package-lock.json' 177 | ######### 178 | # Handling Slack notifications 179 | ######### 180 | - name: Convert markdown to slack markdown 181 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 182 | id: issuemarkdown 183 | with: 184 | markdown: "[${{github.event.issue.title}}](${{github.event.comment.html_url}}) \n ${{github.event.comment.body}}" 185 | - name: Send info about issue comment 186 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 187 | env: 188 | SLACK_WEBHOOK: ${{secrets.SLACK_TSC_MEMBERS_NOTIFY}} 189 | SLACK_TITLE: 🆘 New comment under existing issue that requires TSC Members attention 🆘 190 | SLACK_MESSAGE: ${{steps.issuemarkdown.outputs.text}} 191 | MSG_MINIMAL: true 192 | ######### 193 | # Handling Mailchimp notifications 194 | ######### 195 | - name: Install deps 196 | run: npm install 197 | working-directory: ./.github/workflows/scripts/mailchimp 198 | - name: Send email with MailChimp 199 | uses: actions/github-script@v7 200 | env: 201 | CALENDAR_ID: ${{ secrets.CALENDAR_ID }} 202 | CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} 203 | MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} 204 | with: 205 | script: | 206 | const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); 207 | sendEmail('${{github.event.comment.html_url}}', '${{github.event.issue.title}}'); 208 | 209 | pr_comment: 210 | if: github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members') 211 | name: TSC notification on every new comment in pr 212 | runs-on: ubuntu-latest 213 | steps: 214 | - name: Checkout repository 215 | uses: actions/checkout@v4 216 | - name: Setup Node.js 217 | uses: actions/setup-node@v4 218 | with: 219 | node-version: 16 220 | cache: 'npm' 221 | cache-dependency-path: '**/package-lock.json' 222 | ######### 223 | # Handling Slack notifications 224 | ######### 225 | - name: Convert markdown to slack markdown 226 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 227 | id: prmarkdown 228 | with: 229 | markdown: "[${{github.event.issue.title}}](${{github.event.comment.html_url}}) \n ${{github.event.comment.body}}" 230 | - name: Send info about PR comment 231 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 232 | env: 233 | SLACK_WEBHOOK: ${{secrets.SLACK_TSC_MEMBERS_NOTIFY}} 234 | SLACK_TITLE: 🆘 New comment under existing PR that requires TSC Members attention 🆘 235 | SLACK_MESSAGE: ${{steps.prmarkdown.outputs.text}} 236 | MSG_MINIMAL: true 237 | ######### 238 | # Handling Mailchimp notifications 239 | ######### 240 | - name: Install deps 241 | run: npm install 242 | working-directory: ./.github/workflows/scripts/mailchimp 243 | - name: Send email with MailChimp 244 | uses: actions/github-script@v7 245 | env: 246 | CALENDAR_ID: ${{ secrets.CALENDAR_ID }} 247 | CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} 248 | MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} 249 | with: 250 | script: | 251 | const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); 252 | sendEmail('${{github.event.comment.html_url}}', '${{github.event.issue.title}}'); 253 | 254 | discussion_comment: 255 | if: github.event_name == 'discussion_comment' && contains(github.event.comment.body, '@asyncapi/tsc_members') 256 | name: TSC notification on every new comment in discussion 257 | runs-on: ubuntu-latest 258 | steps: 259 | - name: Checkout repository 260 | uses: actions/checkout@v4 261 | - name: Setup Node.js 262 | uses: actions/setup-node@v4 263 | with: 264 | node-version: 16 265 | cache: 'npm' 266 | cache-dependency-path: '**/package-lock.json' 267 | ######### 268 | # Handling Slack notifications 269 | ######### 270 | - name: Convert markdown to slack markdown 271 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 272 | id: discussionmarkdown 273 | with: 274 | markdown: "[${{github.event.discussion.title}}](${{github.event.comment.html_url}}) \n ${{github.event.comment.body}}" 275 | - name: Send info about discussion comment 276 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 277 | env: 278 | SLACK_WEBHOOK: ${{secrets.SLACK_TSC_MEMBERS_NOTIFY}} 279 | SLACK_TITLE: 🆘 New comment under existing discussion that requires TSC Members attention 🆘 280 | SLACK_MESSAGE: ${{steps.discussionmarkdown.outputs.text}} 281 | MSG_MINIMAL: true 282 | ######### 283 | # Handling Mailchimp notifications 284 | ######### 285 | - name: Install deps 286 | run: npm install 287 | working-directory: ./.github/workflows/scripts/mailchimp 288 | - name: Send email with MailChimp 289 | uses: actions/github-script@v7 290 | env: 291 | CALENDAR_ID: ${{ secrets.CALENDAR_ID }} 292 | CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} 293 | MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} 294 | with: 295 | script: | 296 | const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); 297 | sendEmail('${{github.event.comment.html_url}}', '${{github.event.discussion.title}}'); 298 | -------------------------------------------------------------------------------- /.github/workflows/please-take-a-look-command.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # It uses Github actions to listen for comments on issues and pull requests and 5 | # if the comment contains /please-take-a-look or /ptal it will add a comment pinging 6 | # the code-owners who are reviewers for PR 7 | 8 | name: Please take a Look 9 | 10 | on: 11 | issue_comment: 12 | types: [created] 13 | 14 | jobs: 15 | ping-for-attention: 16 | if: > 17 | github.event.issue.pull_request && 18 | github.event.issue.state != 'closed' && 19 | github.actor != 'asyncapi-bot' && 20 | ( 21 | contains(github.event.comment.body, '/please-take-a-look') || 22 | contains(github.event.comment.body, '/ptal') || 23 | contains(github.event.comment.body, '/PTAL') 24 | ) 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Check for Please Take a Look Command 28 | uses: actions/github-script@v7 29 | with: 30 | github-token: ${{ secrets.GH_TOKEN }} 31 | script: | 32 | const prDetailsUrl = context.payload.issue.pull_request.url; 33 | const { data: pull } = await github.request(prDetailsUrl); 34 | const reviewers = pull.requested_reviewers.map(reviewer => reviewer.login); 35 | 36 | const { data: reviews } = await github.rest.pulls.listReviews({ 37 | owner: context.repo.owner, 38 | repo: context.repo.repo, 39 | pull_number: context.issue.number 40 | }); 41 | 42 | const reviewersWhoHaveReviewed = reviews.map(review => review.user.login); 43 | 44 | const reviewersWhoHaveNotReviewed = reviewers.filter(reviewer => !reviewersWhoHaveReviewed.includes(reviewer)); 45 | 46 | if (reviewersWhoHaveNotReviewed.length > 0) { 47 | const comment = reviewersWhoHaveNotReviewed.filter(reviewer => reviewer !== 'asyncapi-bot-eve' ).map(reviewer => `@${reviewer}`).join(' '); 48 | await github.rest.issues.createComment({ 49 | issue_number: context.issue.number, 50 | owner: context.repo.owner, 51 | repo: context.repo.repo, 52 | body: `${comment} Please take a look at this PR. Thanks! :wave:` 53 | }); 54 | } 55 | -------------------------------------------------------------------------------- /.github/workflows/release-announcements.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | name: 'Announce releases in different channels' 5 | 6 | on: 7 | release: 8 | types: 9 | - published 10 | 11 | jobs: 12 | 13 | slack-announce: 14 | name: Slack - notify on every release 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout repository 18 | uses: actions/checkout@v4 19 | - name: Convert markdown to slack markdown for issue 20 | uses: asyncapi/.github/.github/actions/slackify-markdown@master 21 | id: markdown 22 | with: 23 | markdown: "[${{github.event.release.tag_name}}](${{github.event.release.html_url}}) \n ${{ github.event.release.body }}" 24 | - name: Send info about release to Slack 25 | uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # Using v2.3.2 26 | env: 27 | SLACK_WEBHOOK: ${{ secrets.SLACK_RELEASES }} 28 | SLACK_TITLE: Release ${{github.event.release.tag_name}} for ${{github.repository}} is out in the wild 😱💪🍾🎂 29 | SLACK_MESSAGE: ${{steps.markdown.outputs.text}} 30 | MSG_MINIMAL: true 31 | 32 | twitter-announce: 33 | name: Twitter - notify on minor and major releases 34 | runs-on: ubuntu-latest 35 | steps: 36 | - name: Checkout repo 37 | uses: actions/checkout@v4 38 | - name: Get version of last and previous release 39 | uses: actions/github-script@v7 40 | id: versions 41 | with: 42 | github-token: ${{ secrets.GITHUB_TOKEN }} 43 | script: | 44 | const query = `query($owner:String!, $name:String!) { 45 | repository(owner:$owner, name:$name){ 46 | releases(first: 2, orderBy: {field: CREATED_AT, direction: DESC}) { 47 | nodes { 48 | name 49 | } 50 | } 51 | } 52 | }`; 53 | const variables = { 54 | owner: context.repo.owner, 55 | name: context.repo.repo 56 | }; 57 | const { repository: { releases: { nodes } } } = await github.graphql(query, variables); 58 | core.setOutput('lastver', nodes[0].name); 59 | // In case of first release in the package, there is no such thing as previous error, so we set info about previous version only once we have it 60 | // We should tweet about the release no matter of the type as it is initial release 61 | if (nodes.length != 1) core.setOutput('previousver', nodes[1].name); 62 | - name: Identify release type 63 | id: releasetype 64 | # if previousver is not provided then this steps just logs information about missing version, no errors 65 | run: echo "type=$(npx -q -p semver-diff-cli semver-diff ${{steps.versions.outputs.previousver}} ${{steps.versions.outputs.lastver}})" >> $GITHUB_OUTPUT 66 | - name: Get name of the person that is behind the newly released version 67 | id: author 68 | run: echo "name=$(git log -1 --pretty=format:'%an')" >> $GITHUB_OUTPUT 69 | - name: Publish information about the release to Twitter # tweet only if detected version change is not a patch 70 | # tweet goes out even if the type is not major or minor but "You need provide version number to compare." 71 | # it is ok, it just means we did not identify previous version as we are tweeting out information about the release for the first time 72 | if: steps.releasetype.outputs.type != 'null' && steps.releasetype.outputs.type != 'patch' # null means that versions are the same 73 | uses: m1ner79/Github-Twittction@d1e508b6c2170145127138f93c49b7c46c6ff3a7 # using 2.0.0 https://github.com/m1ner79/Github-Twittction/releases/tag/v2.0.0 74 | with: 75 | twitter_status: "Release ${{github.event.release.tag_name}} for ${{github.repository}} is out in the wild 😱💪🍾🎂\n\nThank you for the contribution ${{ steps.author.outputs.name }} ${{github.event.release.html_url}}" 76 | twitter_consumer_key: ${{ secrets.TWITTER_CONSUMER_KEY }} 77 | twitter_consumer_secret: ${{ secrets.TWITTER_CONSUMER_SECRET }} 78 | twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN_KEY }} 79 | twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} -------------------------------------------------------------------------------- /.github/workflows/scripts/README.md: -------------------------------------------------------------------------------- 1 | The entire `scripts` directory is centrally managed in [.github](https://github.com/asyncapi/.github/) repository. Any changes in this folder should be done in central repository. -------------------------------------------------------------------------------- /.github/workflows/scripts/mailchimp/htmlContent.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This code is centrally managed in https://github.com/asyncapi/.github/ 3 | * Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 4 | */ 5 | module.exports = (link, title) => { 6 | 7 | return ` 8 | 9 | 10 | 11 | 19 | 20 | 21 | 22 | *|MC:SUBJECT|* 23 | 24 | 350 | 351 | 352 | 353 | 354 |
355 | 356 | 357 | 489 | 490 |
358 | 359 | 364 | 365 | 366 | 405 | 406 | 407 | 443 | 444 | 445 | 480 | 481 |
367 | 368 | 369 | 402 | 403 | 404 |
370 | 374 | 375 | 378 | 379 | 380 | 381 | 391 | 392 |
382 | 383 | Hey *|FNAME|*,
384 |
385 | There is a new topic at AsyncAPI Initiative that requires Technical Steering Committee attention. 386 |
387 | Please have a look if it is just something you need to be aware of, or maybe your vote is needed. 388 |
389 | Topic: ${ title }. 390 |
393 | 396 | 397 | 401 |
408 | 409 | 410 | 411 | 412 | 440 | 441 | 442 |
413 | 417 | 418 | 421 | 422 | 423 | 424 | 429 | 430 |
425 | 426 | Cheers,
427 | AsyncAPI Initiative 428 |
431 | 434 | 435 | 439 |
446 | 447 | 448 | 477 | 478 | 479 |
449 | 453 | 454 | 457 | 458 | 459 | 460 | 466 | 467 |
461 | 462 | Want to change how you receive these emails?
463 | You can update your preferences or unsubscribe from this list.
464 |   465 |
468 | 471 | 472 | 476 |
482 | 487 | 488 |
491 |
492 | 493 | 494 | ` 495 | } -------------------------------------------------------------------------------- /.github/workflows/scripts/mailchimp/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This code is centrally managed in https://github.com/asyncapi/.github/ 3 | * Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 4 | */ 5 | const mailchimp = require('@mailchimp/mailchimp_marketing'); 6 | const core = require('@actions/core'); 7 | const htmlContent = require('./htmlContent.js'); 8 | 9 | /** 10 | * Sending API request to mailchimp to schedule email to subscribers 11 | * Input is the URL to issue/discussion or other resource 12 | */ 13 | module.exports = async (link, title) => { 14 | 15 | let newCampaign; 16 | 17 | mailchimp.setConfig({ 18 | apiKey: process.env.MAILCHIMP_API_KEY, 19 | server: 'us12' 20 | }); 21 | 22 | /* 23 | * First we create campaign 24 | */ 25 | try { 26 | newCampaign = await mailchimp.campaigns.create({ 27 | type: 'regular', 28 | recipients: { 29 | list_id: '6e3e437abe', 30 | segment_opts: { 31 | match: 'any', 32 | conditions: [{ 33 | condition_type: 'Interests', 34 | field: 'interests-2801e38b9f', 35 | op: 'interestcontains', 36 | value: ['f7204f9b90'] 37 | }] 38 | } 39 | }, 40 | settings: { 41 | subject_line: `TSC attention required: ${ title }`, 42 | preview_text: 'Check out the latest topic that TSC members have to be aware of', 43 | title: `New topic info - ${ new Date(Date.now()).toUTCString()}`, 44 | from_name: 'AsyncAPI Initiative', 45 | reply_to: 'info@asyncapi.io', 46 | } 47 | }); 48 | } catch (error) { 49 | return core.setFailed(`Failed creating campaign: ${ JSON.stringify(error) }`); 50 | } 51 | 52 | /* 53 | * Content of the email is added separately after campaign creation 54 | */ 55 | try { 56 | await mailchimp.campaigns.setContent(newCampaign.id, { html: htmlContent(link, title) }); 57 | } catch (error) { 58 | return core.setFailed(`Failed adding content to campaign: ${ JSON.stringify(error) }`); 59 | } 60 | 61 | /* 62 | * We schedule an email to send it immediately 63 | */ 64 | try { 65 | //schedule for next hour 66 | //so if this code was created by new issue creation at 9:46, the email is scheduled for 10:00 67 | //is it like this as schedule has limitiations and you cannot schedule email for 9:48 68 | const scheduleDate = new Date(Date.parse(new Date(Date.now()).toISOString()) + 1 * 1 * 60 * 60 * 1000); 69 | scheduleDate.setUTCMinutes(00); 70 | 71 | await mailchimp.campaigns.schedule(newCampaign.id, { 72 | schedule_time: scheduleDate.toISOString(), 73 | }); 74 | } catch (error) { 75 | return core.setFailed(`Failed scheduling email: ${ JSON.stringify(error) }`); 76 | } 77 | 78 | core.info(`New email campaign created`); 79 | } -------------------------------------------------------------------------------- /.github/workflows/scripts/mailchimp/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "schedule-email", 3 | "lockfileVersion": 2, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "name": "schedule-email", 8 | "license": "Apache 2.0", 9 | "dependencies": { 10 | "@actions/core": "1.6.0", 11 | "@mailchimp/mailchimp_marketing": "3.0.74" 12 | } 13 | }, 14 | "node_modules/@actions/core": { 15 | "version": "1.6.0", 16 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", 17 | "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", 18 | "dependencies": { 19 | "@actions/http-client": "^1.0.11" 20 | } 21 | }, 22 | "node_modules/@actions/http-client": { 23 | "version": "1.0.11", 24 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", 25 | "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", 26 | "dependencies": { 27 | "tunnel": "0.0.6" 28 | } 29 | }, 30 | "node_modules/@mailchimp/mailchimp_marketing": { 31 | "version": "3.0.74", 32 | "resolved": "https://registry.npmjs.org/@mailchimp/mailchimp_marketing/-/mailchimp_marketing-3.0.74.tgz", 33 | "integrity": "sha512-039iu4GRr7wpXqweBLuS05wvOBtPxSa31cjxgftBYSt7031f0sHEi8Up2DicfbSuQK0AynPDeVyuxrb31Lx+yQ==", 34 | "dependencies": { 35 | "dotenv": "^8.2.0", 36 | "superagent": "3.8.1" 37 | }, 38 | "engines": { 39 | "node": ">=10.0.0" 40 | } 41 | }, 42 | "node_modules/asynckit": { 43 | "version": "0.4.0", 44 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 45 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 46 | }, 47 | "node_modules/call-bind": { 48 | "version": "1.0.2", 49 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 50 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 51 | "dependencies": { 52 | "function-bind": "^1.1.1", 53 | "get-intrinsic": "^1.0.2" 54 | }, 55 | "funding": { 56 | "url": "https://github.com/sponsors/ljharb" 57 | } 58 | }, 59 | "node_modules/combined-stream": { 60 | "version": "1.0.8", 61 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 62 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 63 | "dependencies": { 64 | "delayed-stream": "~1.0.0" 65 | }, 66 | "engines": { 67 | "node": ">= 0.8" 68 | } 69 | }, 70 | "node_modules/component-emitter": { 71 | "version": "1.3.0", 72 | "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", 73 | "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" 74 | }, 75 | "node_modules/cookiejar": { 76 | "version": "2.1.3", 77 | "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.3.tgz", 78 | "integrity": "sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==" 79 | }, 80 | "node_modules/core-util-is": { 81 | "version": "1.0.3", 82 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", 83 | "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" 84 | }, 85 | "node_modules/delayed-stream": { 86 | "version": "1.0.0", 87 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 88 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", 89 | "engines": { 90 | "node": ">=0.4.0" 91 | } 92 | }, 93 | "node_modules/dotenv": { 94 | "version": "8.6.0", 95 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", 96 | "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", 97 | "engines": { 98 | "node": ">=10" 99 | } 100 | }, 101 | "node_modules/extend": { 102 | "version": "3.0.2", 103 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 104 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 105 | }, 106 | "node_modules/form-data": { 107 | "version": "2.5.1", 108 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", 109 | "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", 110 | "dependencies": { 111 | "asynckit": "^0.4.0", 112 | "combined-stream": "^1.0.6", 113 | "mime-types": "^2.1.12" 114 | }, 115 | "engines": { 116 | "node": ">= 0.12" 117 | } 118 | }, 119 | "node_modules/formidable": { 120 | "version": "1.2.6", 121 | "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", 122 | "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==", 123 | "deprecated": "Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau", 124 | "funding": { 125 | "url": "https://ko-fi.com/tunnckoCore/commissions" 126 | } 127 | }, 128 | "node_modules/function-bind": { 129 | "version": "1.1.1", 130 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 131 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 132 | }, 133 | "node_modules/get-intrinsic": { 134 | "version": "1.1.1", 135 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", 136 | "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", 137 | "dependencies": { 138 | "function-bind": "^1.1.1", 139 | "has": "^1.0.3", 140 | "has-symbols": "^1.0.1" 141 | }, 142 | "funding": { 143 | "url": "https://github.com/sponsors/ljharb" 144 | } 145 | }, 146 | "node_modules/has": { 147 | "version": "1.0.3", 148 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 149 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 150 | "dependencies": { 151 | "function-bind": "^1.1.1" 152 | }, 153 | "engines": { 154 | "node": ">= 0.4.0" 155 | } 156 | }, 157 | "node_modules/has-symbols": { 158 | "version": "1.0.3", 159 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 160 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", 161 | "engines": { 162 | "node": ">= 0.4" 163 | }, 164 | "funding": { 165 | "url": "https://github.com/sponsors/ljharb" 166 | } 167 | }, 168 | "node_modules/inherits": { 169 | "version": "2.0.4", 170 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 171 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 172 | }, 173 | "node_modules/isarray": { 174 | "version": "1.0.0", 175 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 176 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 177 | }, 178 | "node_modules/methods": { 179 | "version": "1.1.2", 180 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 181 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", 182 | "engines": { 183 | "node": ">= 0.6" 184 | } 185 | }, 186 | "node_modules/mime": { 187 | "version": "1.6.0", 188 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 189 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", 190 | "bin": { 191 | "mime": "cli.js" 192 | }, 193 | "engines": { 194 | "node": ">=4" 195 | } 196 | }, 197 | "node_modules/mime-db": { 198 | "version": "1.52.0", 199 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 200 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", 201 | "engines": { 202 | "node": ">= 0.6" 203 | } 204 | }, 205 | "node_modules/mime-types": { 206 | "version": "2.1.35", 207 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 208 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 209 | "dependencies": { 210 | "mime-db": "1.52.0" 211 | }, 212 | "engines": { 213 | "node": ">= 0.6" 214 | } 215 | }, 216 | "node_modules/ms": { 217 | "version": "2.1.3", 218 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 219 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 220 | }, 221 | "node_modules/object-inspect": { 222 | "version": "1.12.0", 223 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", 224 | "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", 225 | "funding": { 226 | "url": "https://github.com/sponsors/ljharb" 227 | } 228 | }, 229 | "node_modules/process-nextick-args": { 230 | "version": "2.0.1", 231 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 232 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 233 | }, 234 | "node_modules/qs": { 235 | "version": "6.10.3", 236 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", 237 | "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", 238 | "dependencies": { 239 | "side-channel": "^1.0.4" 240 | }, 241 | "engines": { 242 | "node": ">=0.6" 243 | }, 244 | "funding": { 245 | "url": "https://github.com/sponsors/ljharb" 246 | } 247 | }, 248 | "node_modules/readable-stream": { 249 | "version": "2.3.7", 250 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 251 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 252 | "dependencies": { 253 | "core-util-is": "~1.0.0", 254 | "inherits": "~2.0.3", 255 | "isarray": "~1.0.0", 256 | "process-nextick-args": "~2.0.0", 257 | "safe-buffer": "~5.1.1", 258 | "string_decoder": "~1.1.1", 259 | "util-deprecate": "~1.0.1" 260 | } 261 | }, 262 | "node_modules/readable-stream/node_modules/safe-buffer": { 263 | "version": "5.1.2", 264 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 265 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 266 | }, 267 | "node_modules/side-channel": { 268 | "version": "1.0.4", 269 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", 270 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", 271 | "dependencies": { 272 | "call-bind": "^1.0.0", 273 | "get-intrinsic": "^1.0.2", 274 | "object-inspect": "^1.9.0" 275 | }, 276 | "funding": { 277 | "url": "https://github.com/sponsors/ljharb" 278 | } 279 | }, 280 | "node_modules/string_decoder": { 281 | "version": "1.1.1", 282 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 283 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 284 | "dependencies": { 285 | "safe-buffer": "~5.1.0" 286 | } 287 | }, 288 | "node_modules/string_decoder/node_modules/safe-buffer": { 289 | "version": "5.1.2", 290 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 291 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 292 | }, 293 | "node_modules/superagent": { 294 | "version": "3.8.1", 295 | "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.8.1.tgz", 296 | "integrity": "sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==", 297 | "deprecated": "Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at .", 298 | "dependencies": { 299 | "component-emitter": "^1.2.0", 300 | "cookiejar": "^2.1.0", 301 | "debug": "^3.1.0", 302 | "extend": "^3.0.0", 303 | "form-data": "^2.3.1", 304 | "formidable": "^1.1.1", 305 | "methods": "^1.1.1", 306 | "mime": "^1.4.1", 307 | "qs": "^6.5.1", 308 | "readable-stream": "^2.0.5" 309 | }, 310 | "engines": { 311 | "node": ">= 4.0" 312 | } 313 | }, 314 | "node_modules/superagent/node_modules/debug": { 315 | "version": "3.2.7", 316 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", 317 | "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", 318 | "dependencies": { 319 | "ms": "^2.1.1" 320 | } 321 | }, 322 | "node_modules/tunnel": { 323 | "version": "0.0.6", 324 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 325 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", 326 | "engines": { 327 | "node": ">=0.6.11 <=0.7.0 || >=0.7.3" 328 | } 329 | }, 330 | "node_modules/util-deprecate": { 331 | "version": "1.0.2", 332 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 333 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 334 | } 335 | }, 336 | "dependencies": { 337 | "@actions/core": { 338 | "version": "1.6.0", 339 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", 340 | "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", 341 | "requires": { 342 | "@actions/http-client": "^1.0.11" 343 | } 344 | }, 345 | "@actions/http-client": { 346 | "version": "1.0.11", 347 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", 348 | "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", 349 | "requires": { 350 | "tunnel": "0.0.6" 351 | } 352 | }, 353 | "@mailchimp/mailchimp_marketing": { 354 | "version": "3.0.74", 355 | "resolved": "https://registry.npmjs.org/@mailchimp/mailchimp_marketing/-/mailchimp_marketing-3.0.74.tgz", 356 | "integrity": "sha512-039iu4GRr7wpXqweBLuS05wvOBtPxSa31cjxgftBYSt7031f0sHEi8Up2DicfbSuQK0AynPDeVyuxrb31Lx+yQ==", 357 | "requires": { 358 | "dotenv": "^8.2.0", 359 | "superagent": "3.8.1" 360 | } 361 | }, 362 | "asynckit": { 363 | "version": "0.4.0", 364 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 365 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 366 | }, 367 | "call-bind": { 368 | "version": "1.0.2", 369 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 370 | "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 371 | "requires": { 372 | "function-bind": "^1.1.1", 373 | "get-intrinsic": "^1.0.2" 374 | } 375 | }, 376 | "combined-stream": { 377 | "version": "1.0.8", 378 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 379 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 380 | "requires": { 381 | "delayed-stream": "~1.0.0" 382 | } 383 | }, 384 | "component-emitter": { 385 | "version": "1.3.0", 386 | "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", 387 | "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" 388 | }, 389 | "cookiejar": { 390 | "version": "2.1.3", 391 | "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.3.tgz", 392 | "integrity": "sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==" 393 | }, 394 | "core-util-is": { 395 | "version": "1.0.3", 396 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", 397 | "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" 398 | }, 399 | "delayed-stream": { 400 | "version": "1.0.0", 401 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 402 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 403 | }, 404 | "dotenv": { 405 | "version": "8.6.0", 406 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", 407 | "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==" 408 | }, 409 | "extend": { 410 | "version": "3.0.2", 411 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 412 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 413 | }, 414 | "form-data": { 415 | "version": "2.5.1", 416 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", 417 | "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", 418 | "requires": { 419 | "asynckit": "^0.4.0", 420 | "combined-stream": "^1.0.6", 421 | "mime-types": "^2.1.12" 422 | } 423 | }, 424 | "formidable": { 425 | "version": "1.2.6", 426 | "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", 427 | "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==" 428 | }, 429 | "function-bind": { 430 | "version": "1.1.1", 431 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 432 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 433 | }, 434 | "get-intrinsic": { 435 | "version": "1.1.1", 436 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", 437 | "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", 438 | "requires": { 439 | "function-bind": "^1.1.1", 440 | "has": "^1.0.3", 441 | "has-symbols": "^1.0.1" 442 | } 443 | }, 444 | "has": { 445 | "version": "1.0.3", 446 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 447 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 448 | "requires": { 449 | "function-bind": "^1.1.1" 450 | } 451 | }, 452 | "has-symbols": { 453 | "version": "1.0.3", 454 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 455 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" 456 | }, 457 | "inherits": { 458 | "version": "2.0.4", 459 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 460 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 461 | }, 462 | "isarray": { 463 | "version": "1.0.0", 464 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 465 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 466 | }, 467 | "methods": { 468 | "version": "1.1.2", 469 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 470 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 471 | }, 472 | "mime": { 473 | "version": "1.6.0", 474 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 475 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 476 | }, 477 | "mime-db": { 478 | "version": "1.52.0", 479 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 480 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" 481 | }, 482 | "mime-types": { 483 | "version": "2.1.35", 484 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 485 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 486 | "requires": { 487 | "mime-db": "1.52.0" 488 | } 489 | }, 490 | "ms": { 491 | "version": "2.1.3", 492 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 493 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" 494 | }, 495 | "object-inspect": { 496 | "version": "1.12.0", 497 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", 498 | "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==" 499 | }, 500 | "process-nextick-args": { 501 | "version": "2.0.1", 502 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 503 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 504 | }, 505 | "qs": { 506 | "version": "6.10.3", 507 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", 508 | "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", 509 | "requires": { 510 | "side-channel": "^1.0.4" 511 | } 512 | }, 513 | "readable-stream": { 514 | "version": "2.3.7", 515 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 516 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 517 | "requires": { 518 | "core-util-is": "~1.0.0", 519 | "inherits": "~2.0.3", 520 | "isarray": "~1.0.0", 521 | "process-nextick-args": "~2.0.0", 522 | "safe-buffer": "~5.1.1", 523 | "string_decoder": "~1.1.1", 524 | "util-deprecate": "~1.0.1" 525 | }, 526 | "dependencies": { 527 | "safe-buffer": { 528 | "version": "5.1.2", 529 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 530 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 531 | } 532 | } 533 | }, 534 | "side-channel": { 535 | "version": "1.0.4", 536 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", 537 | "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", 538 | "requires": { 539 | "call-bind": "^1.0.0", 540 | "get-intrinsic": "^1.0.2", 541 | "object-inspect": "^1.9.0" 542 | } 543 | }, 544 | "string_decoder": { 545 | "version": "1.1.1", 546 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 547 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 548 | "requires": { 549 | "safe-buffer": "~5.1.0" 550 | }, 551 | "dependencies": { 552 | "safe-buffer": { 553 | "version": "5.1.2", 554 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 555 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 556 | } 557 | } 558 | }, 559 | "superagent": { 560 | "version": "3.8.1", 561 | "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.8.1.tgz", 562 | "integrity": "sha512-VMBFLYgFuRdfeNQSMLbxGSLfmXL/xc+OO+BZp41Za/NRDBet/BNbkRJrYzCUu0u4GU0i/ml2dtT8b9qgkw9z6Q==", 563 | "requires": { 564 | "component-emitter": "^1.2.0", 565 | "cookiejar": "^2.1.0", 566 | "debug": "^3.1.0", 567 | "extend": "^3.0.0", 568 | "form-data": "^2.3.1", 569 | "formidable": "^1.1.1", 570 | "methods": "^1.1.1", 571 | "mime": "^1.4.1", 572 | "qs": "^6.5.1", 573 | "readable-stream": "^2.0.5" 574 | }, 575 | "dependencies": { 576 | "debug": { 577 | "version": "3.2.7", 578 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", 579 | "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", 580 | "requires": { 581 | "ms": "^2.1.1" 582 | } 583 | } 584 | } 585 | }, 586 | "tunnel": { 587 | "version": "0.0.6", 588 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 589 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" 590 | }, 591 | "util-deprecate": { 592 | "version": "1.0.2", 593 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 594 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 595 | } 596 | } 597 | } -------------------------------------------------------------------------------- /.github/workflows/scripts/mailchimp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "schedule-email", 3 | "description": "This code is responsible for scheduling an email campaign. This file is centrally managed in https://github.com/asyncapi/.github/", 4 | "license": "Apache 2.0", 5 | "dependencies": { 6 | "@actions/core": "1.6.0", 7 | "@mailchimp/mailchimp_marketing": "3.0.74" 8 | } 9 | } -------------------------------------------------------------------------------- /.github/workflows/stale-issues-prs.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | name: Manage stale issues and PRs 5 | 6 | on: 7 | schedule: 8 | - cron: "0 0 * * *" 9 | 10 | jobs: 11 | stale: 12 | if: startsWith(github.repository, 'asyncapi/') 13 | name: Mark issue or PR as stale 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 #v9.1.0 but pointing to commit for security reasons 17 | with: 18 | repo-token: ${{ secrets.GITHUB_TOKEN }} 19 | stale-issue-message: | 20 | This issue has been automatically marked as stale because it has not had recent activity :sleeping: 21 | 22 | It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation. 23 | 24 | There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under [open governance model](https://github.com/asyncapi/community/blob/master/CHARTER.md). 25 | 26 | Let us figure out together how to push this issue forward. Connect with us through [one of many communication channels](https://github.com/asyncapi/community/issues/1) we established here. 27 | 28 | Thank you for your patience :heart: 29 | stale-pr-message: | 30 | This pull request has been automatically marked as stale because it has not had recent activity :sleeping: 31 | 32 | It will be closed in 120 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation. 33 | 34 | There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under [open governance model](https://github.com/asyncapi/community/blob/master/CHARTER.md). 35 | 36 | Let us figure out together how to push this pull request forward. Connect with us through [one of many communication channels](https://github.com/asyncapi/community/issues/1) we established here. 37 | 38 | Thank you for your patience :heart: 39 | days-before-stale: 120 40 | days-before-close: 120 41 | stale-issue-label: stale 42 | stale-pr-label: stale 43 | exempt-issue-labels: keep-open 44 | exempt-pr-labels: keep-open 45 | close-issue-reason: not_planned 46 | -------------------------------------------------------------------------------- /.github/workflows/transfer-issue.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | name: Transfer Issues between repositories 5 | 6 | on: 7 | issue_comment: 8 | types: 9 | - created 10 | 11 | permissions: 12 | issues: write 13 | 14 | jobs: 15 | transfer: 16 | if: ${{(!github.event.issue.pull_request && github.event.issue.state != 'closed' && github.actor != 'asyncapi-bot') && (startsWith(github.event.comment.body, '/transfer-issue') || startsWith(github.event.comment.body, '/ti'))}} 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Checkout Repository 20 | uses: actions/checkout@v4 21 | - name: Extract Input 22 | id: extract_step 23 | env: 24 | COMMENT: "${{ github.event.comment.body }}" 25 | run: | 26 | REPO=$(echo $COMMENT | awk '{print $2}') 27 | echo repo=$REPO >> $GITHUB_OUTPUT 28 | - name: Check Repo 29 | uses: actions/github-script@v7 30 | with: 31 | github-token: ${{secrets.GH_TOKEN}} 32 | script: | 33 | const r = "${{github.repository}}" 34 | const [owner, repo] = r.split('/') 35 | const repoToMove = process.env.REPO_TO_MOVE 36 | const issue_number = context.issue.number 37 | try { 38 | const {data} = await github.rest.repos.get({ 39 | owner, 40 | repo: repoToMove 41 | }) 42 | }catch (e) { 43 | const body = `${repoToMove} is not a repo under ${owner}. You can only transfer issue to repos that belong to the same organization.` 44 | await github.rest.issues.createComment({ 45 | owner, 46 | repo, 47 | issue_number, 48 | body 49 | }) 50 | process.exit(1) 51 | } 52 | env: 53 | REPO_TO_MOVE: ${{steps.extract_step.outputs.repo}} 54 | - name: Transfer Issue 55 | id: transferIssue 56 | working-directory: ./ 57 | run: | 58 | gh issue transfer ${{github.event.issue.number}} asyncapi/${{steps.extract_step.outputs.repo}} 59 | env: 60 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 61 | 62 | -------------------------------------------------------------------------------- /.github/workflows/update-maintainers-trigger.yaml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | name: Trigger MAINTAINERS.yaml file update 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | paths: 10 | # Check all valid CODEOWNERS locations: 11 | # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-file-location 12 | - 'CODEOWNERS' 13 | - '.github/CODEOWNERS' 14 | - '.docs/CODEOWNERS' 15 | 16 | jobs: 17 | trigger-maintainers-update: 18 | name: Trigger updating MAINTAINERS.yaml because of CODEOWNERS change 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - name: Repository Dispatch 23 | uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # https://github.com/peter-evans/repository-dispatch/releases/tag/v3.0.0 24 | with: 25 | # The PAT with the 'public_repo' scope is required 26 | token: ${{ secrets.GH_TOKEN }} 27 | repository: ${{ github.repository_owner }}/community 28 | event-type: trigger-maintainers-update 29 | -------------------------------------------------------------------------------- /.github/workflows/update-pr.yml: -------------------------------------------------------------------------------- 1 | # This workflow is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | # This workflow will run on every comment with /update or /u. And will create merge-commits for the PR. 5 | # This also works with forks, not only with branches in the same repository/organization. 6 | # Currently, does not work with forks in different organizations. 7 | 8 | # This workflow will be distributed to all repositories in the AsyncAPI organization 9 | 10 | name: Update PR branches from fork 11 | 12 | on: 13 | issue_comment: 14 | types: [created] 15 | 16 | jobs: 17 | update-pr: 18 | if: > 19 | startsWith(github.repository, 'asyncapi/') && 20 | github.event.issue.pull_request && 21 | github.event.issue.state != 'closed' && ( 22 | contains(github.event.comment.body, '/update') || 23 | contains(github.event.comment.body, '/u') 24 | ) 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Get Pull Request Details 28 | id: pr 29 | uses: actions/github-script@v7 30 | with: 31 | github-token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} 32 | previews: 'merge-info-preview' # https://docs.github.com/en/graphql/overview/schema-previews#merge-info-preview-more-detailed-information-about-a-pull-requests-merge-state-preview 33 | script: | 34 | const prNumber = context.payload.issue.number; 35 | core.debug(`PR Number: ${prNumber}`); 36 | const { data: pr } = await github.rest.pulls.get({ 37 | owner: context.repo.owner, 38 | repo: context.repo.repo, 39 | pull_number: prNumber 40 | }); 41 | 42 | // If the PR has conflicts, we don't want to update it 43 | const updateable = ['behind', 'blocked', 'unknown', 'draft', 'clean'].includes(pr.mergeable_state); 44 | console.log(`PR #${prNumber} is ${pr.mergeable_state} and is ${updateable ? 'updateable' : 'not updateable'}`); 45 | core.setOutput('updateable', updateable); 46 | 47 | core.debug(`Updating PR #${prNumber} with head ${pr.head.sha}`); 48 | 49 | return { 50 | id: pr.node_id, 51 | number: prNumber, 52 | head: pr.head.sha, 53 | } 54 | - name: Update the Pull Request 55 | if: steps.pr.outputs.updateable == 'true' 56 | uses: actions/github-script@v7 57 | with: 58 | github-token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }} 59 | script: | 60 | const mutation = `mutation update($input: UpdatePullRequestBranchInput!) { 61 | updatePullRequestBranch(input: $input) { 62 | pullRequest { 63 | mergeable 64 | } 65 | } 66 | }`; 67 | 68 | const pr_details = ${{ steps.pr.outputs.result }}; 69 | 70 | try { 71 | const { data } = await github.graphql(mutation, { 72 | input: { 73 | pullRequestId: pr_details.id, 74 | expectedHeadOid: pr_details.head, 75 | } 76 | }); 77 | } catch (GraphQLError) { 78 | core.debug(GraphQLError); 79 | if ( 80 | GraphQLError.name === 'GraphqlResponseError' && 81 | GraphQLError.errors.some( 82 | error => error.type === 'FORBIDDEN' || error.type === 'UNAUTHORIZED' 83 | ) 84 | ) { 85 | // Add comment to PR if the bot doesn't have permissions to update the PR 86 | const comment = `Hi @${context.actor}. Update of PR has failed. It can be due to one of the following reasons: 87 | - I don't have permissions to update this PR. To update your fork with upstream using bot you need to enable [Allow edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) option in the PR. 88 | - The fork is located in an organization, not under your personal profile. No solution for that. You are on your own with manual update. 89 | - There may be a conflict in the PR. Please resolve the conflict and try again.`; 90 | 91 | await github.rest.issues.createComment({ 92 | owner: context.repo.owner, 93 | repo: context.repo.repo, 94 | issue_number: context.issue.number, 95 | body: comment 96 | }); 97 | 98 | core.setFailed('Bot does not have permissions to update the PR'); 99 | } else { 100 | core.setFailed(GraphQLError.message); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /.github/workflows/welcome-first-time-contrib.yml: -------------------------------------------------------------------------------- 1 | # This action is centrally managed in https://github.com/asyncapi/.github/ 2 | # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo 3 | 4 | name: Welcome first time contributors 5 | 6 | on: 7 | pull_request_target: 8 | types: 9 | - opened 10 | issues: 11 | types: 12 | - opened 13 | 14 | jobs: 15 | welcome: 16 | name: Post welcome message 17 | if: ${{ !contains(fromJson('["asyncapi-bot", "dependabot[bot]", "dependabot-preview[bot]", "allcontributors[bot]"]'), github.actor) }} 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/github-script@v7 21 | with: 22 | github-token: ${{ secrets.GITHUB_TOKEN }} 23 | script: | 24 | const issueMessage = `Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our [contributors guide](https://github.com/asyncapi/community/blob/master/CONTRIBUTING.md) and the instructions about a [basic recommended setup](https://github.com/asyncapi/community/blob/master/git-workflow.md) useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out [this issue](https://github.com/asyncapi/asyncapi/issues/115).`; 25 | const prMessage = `Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our [contributors guide](https://github.com/asyncapi/community/blob/master/CONTRIBUTING.md) useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out [this issue](https://github.com/asyncapi/asyncapi/issues/115).`; 26 | if (!issueMessage && !prMessage) { 27 | throw new Error('Action must have at least one of issue-message or pr-message set'); 28 | } 29 | const isIssue = !!context.payload.issue; 30 | let isFirstContribution; 31 | if (isIssue) { 32 | const query = `query($owner:String!, $name:String!, $contributer:String!) { 33 | repository(owner:$owner, name:$name){ 34 | issues(first: 1, filterBy: {createdBy:$contributer}){ 35 | totalCount 36 | } 37 | } 38 | }`; 39 | const variables = { 40 | owner: context.repo.owner, 41 | name: context.repo.repo, 42 | contributer: context.payload.sender.login 43 | }; 44 | const { repository: { issues: { totalCount } } } = await github.graphql(query, variables); 45 | isFirstContribution = totalCount === 1; 46 | } else { 47 | const query = `query($qstr: String!) { 48 | search(query: $qstr, type: ISSUE, first: 1) { 49 | issueCount 50 | } 51 | }`; 52 | const variables = { 53 | "qstr": `repo:${context.repo.owner}/${context.repo.repo} type:pr author:${context.payload.sender.login}`, 54 | }; 55 | const { search: { issueCount } } = await github.graphql(query, variables); 56 | isFirstContribution = issueCount === 1; 57 | } 58 | 59 | if (!isFirstContribution) { 60 | console.log(`Not the users first contribution.`); 61 | return; 62 | } 63 | const message = isIssue ? issueMessage : prMessage; 64 | // Add a comment to the appropriate place 65 | if (isIssue) { 66 | const issueNumber = context.payload.issue.number; 67 | console.log(`Adding message: ${message} to issue #${issueNumber}`); 68 | await github.rest.issues.createComment({ 69 | owner: context.payload.repository.owner.login, 70 | repo: context.payload.repository.name, 71 | issue_number: issueNumber, 72 | body: message 73 | }); 74 | } 75 | else { 76 | const pullNumber = context.payload.pull_request.number; 77 | console.log(`Adding message: ${message} to pull request #${pullNumber}`); 78 | await github.rest.pulls.createReview({ 79 | owner: context.payload.repository.owner.login, 80 | repo: context.payload.repository.name, 81 | pull_number: pullNumber, 82 | body: message, 83 | event: 'COMMENT' 84 | }); 85 | } 86 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.tgz 3 | .vscode 4 | .DS_Store 5 | /docs 6 | /coverage 7 | /lib 8 | /esm 9 | /cjs -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.tgz 3 | *.swp 4 | .github 5 | .all-contributorsrc 6 | .editorconfig 7 | assets/logo.png 8 | vscode 9 | coverage 10 | node_modules -------------------------------------------------------------------------------- /.releaserc: -------------------------------------------------------------------------------- 1 | --- 2 | branches: 3 | - master 4 | # by default release workflow reacts on push not only to master. 5 | #This is why out of the box sematic release is configured for all these branches 6 | - name: next-spec 7 | prerelease: true 8 | - name: next-major 9 | prerelease: true 10 | - name: next-major-spec 11 | prerelease: true 12 | - name: beta 13 | prerelease: true 14 | - name: alpha 15 | prerelease: true 16 | - name: next 17 | prerelease: true 18 | plugins: 19 | - - "@semantic-release/commit-analyzer" 20 | - preset: conventionalcommits 21 | - - "@semantic-release/release-notes-generator" 22 | - preset: conventionalcommits 23 | - "@semantic-release/npm" 24 | - "@semantic-release/github" 25 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This file provides an overview of code owners in this repository. 2 | 3 | # Each line is a file pattern followed by one or more owners. 4 | # The last matching pattern has the most precedence. 5 | # For more details, read the following article on GitHub: https://help.github.com/articles/about-codeowners/. 6 | 7 | # The default owners are automatically added as reviewers when you open a pull request unless different owners are specified in the file. 8 | * @fmvilas @smoya @asyncapi-bot-eve 9 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | - Using welcoming and inclusive language 12 | - Being respectful of differing viewpoints and experiences 13 | - Gracefully accepting constructive criticism 14 | - Focusing on what is best for the community 15 | - Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | - Trolling, insulting/derogatory comments, and personal or political attacks 21 | - Public or private harassment 22 | - Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | - Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at fmvilas@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to AsyncAPI 2 | We love your input! We want to make contributing to this project as easy and transparent as possible. 3 | 4 | ## Contribution recogniton 5 | 6 | We use [All Contributors](https://allcontributors.org/docs/en/specification) specification to handle recognitions. For more details read [this](https://github.com/asyncapi/community/blob/master/recognize-contributors.md) document. 7 | 8 | ## Summary of the contribution flow 9 | 10 | The following is a summary of the ideal contribution flow. Please, note that Pull Requests can also be rejected by the maintainers when appropriate. 11 | 12 | ``` 13 | ┌───────────────────────┐ 14 | │ │ 15 | │ Open an issue │ 16 | │ (a bug report or a │ 17 | │ feature request) │ 18 | │ │ 19 | └───────────────────────┘ 20 | ⇩ 21 | ┌───────────────────────┐ 22 | │ │ 23 | │ Open a Pull Request │ 24 | │ (only after issue │ 25 | │ is approved) │ 26 | │ │ 27 | └───────────────────────┘ 28 | ⇩ 29 | ┌───────────────────────┐ 30 | │ │ 31 | │ Your changes will │ 32 | │ be merged and │ 33 | │ published on the next │ 34 | │ release │ 35 | │ │ 36 | └───────────────────────┘ 37 | ``` 38 | 39 | ## Code of Conduct 40 | AsyncAPI has adopted a Code of Conduct that we expect project participants to adhere to. Please [read the full text](./CODE_OF_CONDUCT.md) so that you can understand what sort of behaviour is expected. 41 | 42 | ## Our Development Process 43 | We use Github to host code, to track issues and feature requests, as well as accept pull requests. 44 | 45 | ## Issues 46 | [Open an issue](https://github.com/asyncapi/asyncapi/issues/new) **only** if you want to report a bug or a feature. Don't open issues for questions or support, instead join our [Slack workspace](https://www.asyncapi.com/slack-invite) and ask there. Don't forget to follow our [Slack Etiquette](https://github.com/asyncapi/community/blob/master/slack-etiquette.md) while interacting with community members! It's more likely you'll get help, and much faster! 47 | 48 | ## Bug Reports and Feature Requests 49 | 50 | Please use our issues templates that provide you with hints on what information we need from you to help you out. 51 | 52 | ## Pull Requests 53 | 54 | **Please, make sure you open an issue before starting with a Pull Request, unless it's a typo or a really obvious error.** Pull requests are the best way to propose changes to the specification. Get familiar with our document that explains [Git workflow](https://github.com/asyncapi/community/blob/master/git-workflow.md) used in our repositories. 55 | 56 | ## Conventional commits 57 | 58 | Our repositories follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) specification. Releasing to GitHub and NPM is done with the support of [semantic-release](https://semantic-release.gitbook.io/semantic-release/). 59 | 60 | Pull requests should have a title that follows the specification, otherwise, merging is blocked. If you are not familiar with the specification simply ask maintainers to modify. You can also use this cheatsheet if you want: 61 | 62 | - `fix: ` prefix in the title indicates that PR is a bug fix and PATCH release must be triggered. 63 | - `feat: ` prefix in the title indicates that PR is a feature and MINOR release must be triggered. 64 | - `docs: ` prefix in the title indicates that PR is only related to the documentation and there is no need to trigger release. 65 | - `chore: ` prefix in the title indicates that PR is only related to cleanup in the project and there is no need to trigger release. 66 | - `test: ` prefix in the title indicates that PR is only related to tests and there is no need to trigger release. 67 | - `refactor: ` prefix in the title indicates that PR is only related to refactoring and there is no need to trigger release. 68 | 69 | What about MAJOR release? just add `!` to the prefix, like `fix!: ` or `refactor!: ` 70 | 71 | Prefix that follows specification is not enough though. Remember that the title must be clear and descriptive with usage of [imperative mood](https://chris.beams.io/posts/git-commit/#imperative). 72 | 73 | Happy contributing :heart: 74 | 75 | ## License 76 | When you submit changes, your submissions are understood to be under the same [Apache 2.0 License](https://github.com/asyncapi/asyncapi/blob/master/LICENSE) that covers the project. Feel free to [contact the maintainers](https://www.asyncapi.com/slack-invite) if that's a concern. 77 | 78 | ## References 79 | This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/master/CONTRIBUTING.md). -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright The Linux Foundation 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenAPI Schema Parser 2 | 3 | An AsyncAPI schema parser for OpenAPI 3.0.x and Swagger 2.x schemas. 4 | 5 | > **Note** 6 | > Version >= `3.0.0` of package is only supported by `@asyncapi/parser` version >= `2.0.0`. 7 | 8 | 9 | 10 | 11 | 12 | - [Installation](#installation) 13 | - [Usage](#usage) 14 | 15 | 16 | 17 | ## Installation 18 | 19 | ```bash 20 | npm install @asyncapi/openapi-schema-parser 21 | // OR 22 | yarn add @asyncapi/openapi-schema-parser 23 | ``` 24 | 25 | ## Usage 26 | 27 | ```ts 28 | import { Parser } from '@asyncapi/parser'; 29 | import { OpenAPISchemaParser } from '@asyncapi/openapi-schema-parser'; 30 | 31 | const parser = new Parser(); 32 | parser.registerSchemaParser(OpenAPISchemaParser()); 33 | 34 | const asyncapiWithOpenAPI = ` 35 | asyncapi: 2.0.0 36 | info: 37 | title: Example with OpenAPI 38 | version: 0.1.0 39 | channels: 40 | example: 41 | publish: 42 | message: 43 | schemaFormat: 'application/vnd.oai.openapi;version=3.0.0' 44 | payload: # The following is an OpenAPI schema 45 | type: object 46 | properties: 47 | title: 48 | type: string 49 | nullable: true 50 | author: 51 | type: string 52 | example: Jack Johnson 53 | `; 54 | 55 | const { document } = await parser.parse(asyncapiWithOpenAPI); 56 | ``` 57 | 58 | ```js 59 | const { Parser } = require('@asyncapi/parser'); 60 | const { OpenAPISchemaParser } = require('@asyncapi/openapi-schema-parser'); 61 | 62 | const parser = new Parser(); 63 | parser.registerSchemaParser(OpenAPISchemaParser()); 64 | 65 | const asyncapiWithOpenAPI = ` 66 | asyncapi: 2.0.0 67 | info: 68 | title: Example with OpenAPI 69 | version: 0.1.0 70 | channels: 71 | example: 72 | publish: 73 | message: 74 | schemaFormat: 'application/vnd.oai.openapi;version=3.0.0' 75 | payload: # The following is an OpenAPI schema 76 | type: object 77 | properties: 78 | title: 79 | type: string 80 | nullable: true 81 | author: 82 | type: string 83 | example: Jack Johnson 84 | `; 85 | 86 | const { document } = await parser.parse(asyncapiWithOpenAPI); 87 | ``` 88 | 89 | It also supports referencing remote OpenAPI schemas: 90 | 91 | ```ts 92 | import { Parser } from '@asyncapi/parser'; 93 | import { OpenAPISchemaParser } from '@asyncapi/openapi-schema-parser'; 94 | 95 | const parser = new Parser(); 96 | parser.registerSchemaParser(OpenAPISchemaParser()); 97 | 98 | const asyncapiWithOpenAPI = ` 99 | asyncapi: 2.0.0 100 | info: 101 | title: Example with OpenAPI 102 | version: 0.1.0 103 | channels: 104 | example: 105 | publish: 106 | message: 107 | schemaFormat: 'application/vnd.oai.openapi;version=3.0.0' 108 | payload: 109 | $ref: 'yourserver.com/schemas#/Book' 110 | `; 111 | 112 | const { document } = await parser.parse(asyncapiWithOpenAPI); 113 | ``` 114 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { Config } from '@jest/types'; 2 | 3 | const config: Config.InitialOptions = { 4 | coverageReporters: [ 5 | 'text' 6 | ], 7 | transform: { 8 | '^.+\\.(t|j)sx?$': '@swc/jest', 9 | }, 10 | // The root of your source code, typically /src 11 | // `` is a token Jest substitutes 12 | roots: [''], 13 | moduleNameMapper: { 14 | '^nimma/legacy$': '/node_modules/nimma/dist/legacy/cjs/index.js', 15 | '^nimma/(.*)': '/node_modules/nimma/dist/cjs/$1', 16 | '^@stoplight/spectral-ruleset-bundler/(.*)$': '/node_modules/@stoplight/spectral-ruleset-bundler/dist/$1' 17 | }, 18 | 19 | // Test spec file resolution pattern 20 | // Matches parent folder `__tests__` and filename 21 | // should contain `test` or `spec`. 22 | testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.[jt]sx?$', 23 | // Module file extensions for importing 24 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], 25 | testTimeout: 10000, 26 | collectCoverageFrom: [ 27 | 'src/**' 28 | ], 29 | }; 30 | 31 | export default config; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@asyncapi/openapi-schema-parser", 3 | "version": "3.0.24", 4 | "description": "An AsyncAPI schema parser for OpenAPI 3.0.x and Swagger 2.x schemas.", 5 | "scripts": { 6 | "build": "npm run build:esm && npm run build:cjs", 7 | "build:esm": "tsc", 8 | "build:cjs": "tsc --project ./tsconfig.cjs.json", 9 | "test": "cross-env CI=true jest --coverage", 10 | "lint": "eslint --max-warnings 0 --config .eslintrc .", 11 | "lint:fix": "eslint --max-warnings 0 --config .eslintrc . --fix", 12 | "generate:readme:toc": "markdown-toc -i \"README.md\"", 13 | "generate:assets": "npm run build && npm run generate:readme:toc", 14 | "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION", 15 | "prepublishOnly": "npm run generate:assets", 16 | "release": "semantic-release" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/asyncapi/openapi-schema-parser.git" 21 | }, 22 | "keywords": [ 23 | "asyncapi", 24 | "openapi", 25 | "swagger", 26 | "schema", 27 | "parser" 28 | ], 29 | "author": { 30 | "name": "The AsyncAPI maintainers", 31 | "url": "https://www.asyncapi.com" 32 | }, 33 | "publishConfig": { 34 | "access": "public" 35 | }, 36 | "license": "Apache-2.0", 37 | "bugs": { 38 | "url": "https://github.com/asyncapi/openapi-schema-parser/issues" 39 | }, 40 | "homepage": "https://github.com/asyncapi/openapi-schema-parser#readme", 41 | "sideEffects": false, 42 | "main": "cjs/index.js", 43 | "module": "esm/index.js", 44 | "types": "esm/index.d.ts", 45 | "files": [ 46 | "/esm", 47 | "/cjs", 48 | "LICENSE", 49 | "README.md" 50 | ], 51 | "dependencies": { 52 | "@asyncapi/parser": "^3.1.0", 53 | "@openapi-contrib/openapi-schema-to-json-schema": "~3.2.0", 54 | "ajv": "^8.11.0", 55 | "ajv-errors": "^3.0.0", 56 | "ajv-formats": "^2.1.1" 57 | }, 58 | "devDependencies": { 59 | "@jest/types": "^29.2.1", 60 | "@semantic-release/commit-analyzer": "^9.0.2", 61 | "@semantic-release/github": "^8.0.6", 62 | "@semantic-release/npm": "^9.0.1", 63 | "@semantic-release/release-notes-generator": "^10.0.3", 64 | "@swc/core": "^1.3.9", 65 | "@swc/jest": "^0.2.23", 66 | "@types/jest": "^29.2.0", 67 | "@typescript-eslint/eslint-plugin": "^5.36.2", 68 | "@typescript-eslint/parser": "^5.36.2", 69 | "conventional-changelog-conventionalcommits": "^4.2.3", 70 | "cross-env": "^7.0.3", 71 | "eslint": "^8.23.0", 72 | "eslint-plugin-github": "^4.3.7", 73 | "eslint-plugin-security": "^1.5.0", 74 | "eslint-plugin-sonarjs": "^0.15.0", 75 | "jest": "^29.2.1", 76 | "markdown-toc": "^1.2.0", 77 | "semantic-release": "^19.0.5", 78 | "ts-node": "^10.9.1", 79 | "typescript": "^4.8.4" 80 | }, 81 | "release": { 82 | "branches": [ 83 | "master" 84 | ], 85 | "plugins": [ 86 | [ 87 | "@semantic-release/commit-analyzer", 88 | { 89 | "preset": "conventionalcommits" 90 | } 91 | ], 92 | [ 93 | "@semantic-release/release-notes-generator", 94 | { 95 | "preset": "conventionalcommits" 96 | } 97 | ], 98 | "@semantic-release/npm", 99 | [ 100 | "@semantic-release/github", 101 | { 102 | "assets": [] 103 | } 104 | ] 105 | ] 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import Ajv from 'ajv'; 2 | import addFormats from 'ajv-formats'; 3 | import ajvErrors from 'ajv-errors'; 4 | import { jsonSchemaV3 } from './json-schema-v3'; 5 | // eslint-disable-next-line @typescript-eslint/no-var-requires 6 | const toJsonSchema = require('@openapi-contrib/openapi-schema-to-json-schema'); 7 | 8 | import type { SchemaParser, ValidateSchemaInput, ParseSchemaInput, SchemaValidateResult, SpecTypesV2 } from '@asyncapi/parser'; 9 | import type { ValidateFunction, ErrorObject } from 'ajv'; 10 | 11 | export function OpenAPISchemaParser(): SchemaParser { 12 | return { 13 | validate, 14 | parse, 15 | getMimeTypes, 16 | }; 17 | } 18 | export default OpenAPISchemaParser; 19 | 20 | async function validate(input: ValidateSchemaInput): Promise { 21 | const validator = getAjvInstance().getSchema('openapi') as ValidateFunction; 22 | 23 | let result: SchemaValidateResult[] = []; 24 | const valid = validator(input.data); 25 | if (!valid && validator.errors) { 26 | result = ajvToSpectralResult(input.path, [...validator.errors]); 27 | } 28 | 29 | return result; 30 | } 31 | 32 | async function parse(input: ParseSchemaInput): Promise { 33 | const transformed = toJsonSchema(input.data, { 34 | cloneSchema: true, 35 | keepNotSupported: [ 36 | 'discriminator', 37 | 'readOnly', 38 | 'writeOnly', 39 | 'deprecated', 40 | 'xml', 41 | 'example', 42 | ], 43 | }); 44 | 45 | iterateSchema(transformed); 46 | return transformed; 47 | } 48 | 49 | function getMimeTypes() { 50 | return [ 51 | 'application/vnd.oai.openapi;version=3.0.0', 52 | 'application/vnd.oai.openapi+json;version=3.0.0', 53 | 'application/vnd.oai.openapi+yaml;version=3.0.0', 54 | ]; 55 | } 56 | 57 | function ajvToSpectralResult(path: Array, errors: ErrorObject[]): SchemaValidateResult[] { 58 | return errors.map(error => { 59 | return { 60 | message: error.message, 61 | path: [...path, ...error.instancePath.replace(/^\//, '').split('/')], 62 | }; 63 | }) as SchemaValidateResult[]; 64 | } 65 | 66 | function iterateSchema(schema: any) { 67 | if (schema.example !== undefined) { 68 | const examples = schema.examples || []; 69 | examples.push(schema.example); 70 | schema.examples = examples; 71 | delete schema.example; 72 | } 73 | 74 | if (schema.$schema !== undefined) { 75 | delete schema.$schema; 76 | } 77 | 78 | aliasProps(schema.properties); 79 | aliasProps(schema.patternProperties); 80 | aliasProps(schema.additionalProperties); 81 | aliasProps(schema.items); 82 | aliasProps(schema.additionalItems); 83 | aliasProps(schema.oneOf); 84 | aliasProps(schema.anyOf); 85 | aliasProps(schema.allOf); 86 | aliasProps(schema.not); 87 | } 88 | 89 | function aliasProps(obj: any) { 90 | for (const key in obj) { 91 | const prop = obj[key]; 92 | 93 | if (prop.xml !== undefined) { 94 | prop['x-xml'] = prop.xml; 95 | delete prop.xml; 96 | } 97 | 98 | iterateSchema(obj[key]); 99 | } 100 | } 101 | 102 | let ajv: Ajv | undefined; 103 | function getAjvInstance(): Ajv { 104 | if (ajv) { 105 | return ajv; 106 | } 107 | 108 | ajv = new Ajv({ 109 | allErrors: true, 110 | meta: true, 111 | messages: true, 112 | strict: false, 113 | allowUnionTypes: true, 114 | unicodeRegExp: false, 115 | }); 116 | 117 | addFormats(ajv); 118 | ajvErrors(ajv); 119 | ajv.addSchema(jsonSchemaV3, 'openapi'); 120 | 121 | return ajv; 122 | } -------------------------------------------------------------------------------- /src/json-schema-v3.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | // From https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json 3 | export const jsonSchemaV3 ={ 4 | type: 'object', 5 | definitions: { 6 | Reference: { 7 | type: 'object', 8 | required: ['$ref'], 9 | patternProperties: { 10 | '^\\$ref$': { 11 | type: 'string', 12 | format: 'uri-reference' 13 | } 14 | } 15 | }, 16 | Discriminator: { 17 | type: 'object', 18 | required: ['propertyName'], 19 | properties: { 20 | propertyName: { 21 | type: 'string' 22 | }, 23 | mapping: { 24 | type: 'object', 25 | additionalProperties: { 26 | type: 'string' 27 | } 28 | } 29 | } 30 | }, 31 | ExternalDocumentation: { 32 | type: 'object', 33 | required: ['url'], 34 | properties: { 35 | description: { 36 | type: 'string' 37 | }, 38 | url: { 39 | type: 'string', 40 | format: 'uri-reference' 41 | } 42 | }, 43 | patternProperties: { 44 | '^x-': {} 45 | }, 46 | additionalProperties: false 47 | }, 48 | XML: { 49 | type: 'object', 50 | properties: { 51 | name: { 52 | type: 'string' 53 | }, 54 | namespace: { 55 | type: 'string', 56 | format: 'uri' 57 | }, 58 | prefix: { 59 | type: 'string' 60 | }, 61 | attribute: { 62 | type: 'boolean', 63 | default: false 64 | }, 65 | wrapped: { 66 | type: 'boolean', 67 | default: false 68 | } 69 | }, 70 | patternProperties: { 71 | '^x-': {} 72 | }, 73 | additionalProperties: false 74 | } 75 | }, 76 | properties: { 77 | title: { 78 | type: 'string' 79 | }, 80 | multipleOf: { 81 | type: 'number', 82 | exclusiveMinimum: 0 83 | }, 84 | maximum: { 85 | type: 'number' 86 | }, 87 | exclusiveMaximum: { 88 | type: 'boolean', 89 | default: false 90 | }, 91 | minimum: { 92 | type: 'number' 93 | }, 94 | exclusiveMinimum: { 95 | type: 'boolean', 96 | default: false 97 | }, 98 | maxLength: { 99 | type: 'integer', 100 | minimum: 0 101 | }, 102 | minLength: { 103 | type: 'integer', 104 | minimum: 0, 105 | default: 0 106 | }, 107 | pattern: { 108 | type: 'string', 109 | format: 'regex' 110 | }, 111 | maxItems: { 112 | type: 'integer', 113 | minimum: 0 114 | }, 115 | minItems: { 116 | type: 'integer', 117 | minimum: 0, 118 | default: 0 119 | }, 120 | uniqueItems: { 121 | type: 'boolean', 122 | default: false 123 | }, 124 | maxProperties: { 125 | type: 'integer', 126 | minimum: 0 127 | }, 128 | minProperties: { 129 | type: 'integer', 130 | minimum: 0, 131 | default: 0 132 | }, 133 | required: { 134 | type: 'array', 135 | items: { 136 | type: 'string' 137 | }, 138 | minItems: 1, 139 | uniqueItems: true 140 | }, 141 | enum: { 142 | type: 'array', 143 | items: {}, 144 | minItems: 1, 145 | uniqueItems: false 146 | }, 147 | type: { 148 | type: 'string', 149 | enum: ['array', 'boolean', 'integer', 'number', 'object', 'string'] 150 | }, 151 | not: { 152 | oneOf: [ 153 | { 154 | $ref: '#' 155 | }, 156 | { 157 | $ref: '#/definitions/Reference' 158 | } 159 | ] 160 | }, 161 | allOf: { 162 | type: 'array', 163 | items: { 164 | oneOf: [ 165 | { 166 | $ref: '#' 167 | }, 168 | { 169 | $ref: '#/definitions/Reference' 170 | } 171 | ] 172 | } 173 | }, 174 | oneOf: { 175 | type: 'array', 176 | items: { 177 | oneOf: [ 178 | { 179 | $ref: '#' 180 | }, 181 | { 182 | $ref: '#/definitions/Reference' 183 | } 184 | ] 185 | } 186 | }, 187 | anyOf: { 188 | type: 'array', 189 | items: { 190 | oneOf: [ 191 | { 192 | $ref: '#' 193 | }, 194 | { 195 | $ref: '#/definitions/Reference' 196 | } 197 | ] 198 | } 199 | }, 200 | items: { 201 | oneOf: [ 202 | { 203 | $ref: '#' 204 | }, 205 | { 206 | $ref: '#/definitions/Reference' 207 | } 208 | ] 209 | }, 210 | properties: { 211 | type: 'object', 212 | additionalProperties: { 213 | oneOf: [ 214 | { 215 | $ref: '#' 216 | }, 217 | { 218 | $ref: '#/definitions/Reference' 219 | } 220 | ] 221 | } 222 | }, 223 | additionalProperties: { 224 | oneOf: [ 225 | { 226 | $ref: '#' 227 | }, 228 | { 229 | $ref: '#/definitions/Reference' 230 | }, 231 | { 232 | type: 'boolean' 233 | } 234 | ], 235 | default: true 236 | }, 237 | description: { 238 | type: 'string' 239 | }, 240 | format: { 241 | type: 'string' 242 | }, 243 | default: {}, 244 | nullable: { 245 | type: 'boolean', 246 | default: false 247 | }, 248 | discriminator: { 249 | $ref: '#/definitions/Discriminator' 250 | }, 251 | readOnly: { 252 | type: 'boolean', 253 | default: false 254 | }, 255 | writeOnly: { 256 | type: 'boolean', 257 | default: false 258 | }, 259 | example: {}, 260 | externalDocs: { 261 | $ref: '#/definitions/ExternalDocumentation' 262 | }, 263 | deprecated: { 264 | type: 'boolean', 265 | default: false 266 | }, 267 | xml: { 268 | $ref: '#/definitions/XML' 269 | } 270 | }, 271 | patternProperties: { 272 | '^x-': {} 273 | }, 274 | additionalProperties: false 275 | }; -------------------------------------------------------------------------------- /test/documents/invalid-asyncapi.yaml: -------------------------------------------------------------------------------- 1 | asyncapi: 2.4.0 2 | info: 3 | title: My API 4 | version: '1.0.0' 5 | 6 | channels: 7 | myChannel: 8 | publish: 9 | message: 10 | $ref: '#/components/messages/testMessage' 11 | 12 | components: 13 | messages: 14 | testMessage: 15 | schemaFormat: 'application/vnd.oai.openapi;version=3.0.0' 16 | payload: 17 | type: object 18 | nullable: true 19 | example: 20 | name: Fran 21 | properties: 22 | name: 23 | type: nonexistent 24 | surname: 25 | format: {} 26 | -------------------------------------------------------------------------------- /test/documents/invalid.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaFormat":"application/vnd.oai.openapi;version=3.0.0", 3 | "payload": { 4 | "properties": { 5 | "name": { 6 | "type": "nonexistent" 7 | }, 8 | "surname": { 9 | "format": {} 10 | } 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /test/documents/valid-asyncapi.yaml: -------------------------------------------------------------------------------- 1 | asyncapi: 2.4.0 2 | info: 3 | title: My API 4 | version: '1.0.0' 5 | 6 | channels: 7 | myChannel: 8 | publish: 9 | message: 10 | $ref: '#/components/messages/testMessage' 11 | 12 | components: 13 | messages: 14 | testMessage: 15 | schemaFormat: application/vnd.oai.openapi;version=3.0.0 16 | payload: 17 | type: object 18 | nullable: true 19 | example: 20 | name: Fran 21 | properties: 22 | name: 23 | type: string 24 | discriminatorTest: 25 | discriminator: 26 | propertyName: objectType 27 | oneOf: 28 | - type: object 29 | properties: 30 | objectType: 31 | type: string 32 | prop1: 33 | type: string 34 | - type: object 35 | properties: 36 | objectType: 37 | type: string 38 | prop2: 39 | type: string 40 | test: 41 | type: object 42 | properties: 43 | testing: 44 | type: string 45 | 46 | -------------------------------------------------------------------------------- /test/documents/valid.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaFormat":"application/vnd.oai.openapi;version=3.0.0", 3 | "payload":{ 4 | "type":"object", 5 | "nullable":true, 6 | "example":{ 7 | "name":"Fran" 8 | }, 9 | "properties":{ 10 | "name":{ 11 | "type":"string" 12 | }, 13 | "discriminatorTest":{ 14 | "discriminator":{"propertyName": "objectType"}, 15 | "oneOf":[ 16 | { 17 | "type":"object", 18 | "properties":{ 19 | "objectType":{ 20 | "type":"string" 21 | }, 22 | "prop1":{ 23 | "type":"string" 24 | } 25 | } 26 | }, 27 | { 28 | "type":"object", 29 | "properties":{ 30 | "objectType":{ 31 | "type":"string" 32 | }, 33 | "prop2":{ 34 | "type":"string" 35 | } 36 | } 37 | } 38 | ] 39 | }, 40 | "test":{ 41 | "type":"object", 42 | "properties":{ 43 | "testing":{ 44 | "type":"string" 45 | } 46 | } 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /test/parser.spec.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs'; 2 | import * as path from 'path'; 3 | import { Parser } from '@asyncapi/parser'; 4 | import { OpenAPISchemaParser } from '../src'; 5 | 6 | import type { ParseSchemaInput, ValidateSchemaInput, SchemaValidateResult, Diagnostic } from '@asyncapi/parser'; 7 | 8 | const inputWithValidOpenApi3 = toParseInput(fs.readFileSync(path.resolve(__dirname, './documents/valid.json'), 'utf8')); 9 | const outputWithValidOpenApi3 = '{"type":["object","null"],"properties":{"name":{"type":"string"},"discriminatorTest":{"discriminator":{"propertyName":"objectType"},"oneOf":[{"type":"object","properties":{"objectType":{"type":"string"},"prop1":{"type":"string"}}},{"type":"object","properties":{"objectType":{"type":"string"},"prop2":{"type":"string"}}}]},"test":{"type":"object","properties":{"testing":{"type":"string"}}}},"examples":[{"name":"Fran"}]}'; 10 | 11 | const inputWithInvalidOpenApi3 = toParseInput(fs.readFileSync(path.resolve(__dirname, './documents/invalid.json'), 'utf8')); 12 | 13 | const inputWithValidAsyncAPI = fs.readFileSync(path.resolve(__dirname, './documents/valid-asyncapi.yaml'), 'utf8'); 14 | 15 | const inputWithInvalidAsyncAPI = fs.readFileSync(path.resolve(__dirname, './documents/invalid-asyncapi.yaml'), 'utf8'); 16 | 17 | describe('OpenAPISchemaParser', function () { 18 | const parser = OpenAPISchemaParser(); 19 | const coreParser = new Parser(); 20 | coreParser.registerSchemaParser(parser); 21 | 22 | it('should return Mime Types', async function () { 23 | expect(parser.getMimeTypes()).not.toEqual([]); 24 | }); 25 | 26 | it('should parse OpenAPI 3', async function() { 27 | await doParseTest(inputWithValidOpenApi3, outputWithValidOpenApi3); 28 | }); 29 | 30 | it('should validate valid OpenAPI 3', async function() { 31 | const diagnostics = await parser.validate(inputWithValidOpenApi3); 32 | expect(diagnostics).toHaveLength(0); 33 | }); 34 | 35 | it('should validate invalid OpenAPI 3', async function() { 36 | const diagnostics = await parser.validate(inputWithInvalidOpenApi3); 37 | expect(diagnostics).toHaveLength(6); 38 | expect(diagnostics).toEqual([ 39 | { 40 | message: 'must be equal to one of the allowed values', 41 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties', 'name', 'type'] 42 | }, 43 | { 44 | message: 'must have required property \'$ref\'', 45 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties', 'name'] 46 | }, 47 | { 48 | message: 'must match exactly one schema in oneOf', 49 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties','name'] 50 | }, 51 | { 52 | message: 'must be string', 53 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties','surname','format'] 54 | }, 55 | { 56 | message: 'must have required property \'$ref\'', 57 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties','surname'] 58 | }, 59 | { 60 | message: 'must match exactly one schema in oneOf', 61 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties','surname'] 62 | } 63 | ]); 64 | }); 65 | 66 | it('should parse valid AsyncAPI', async function() { 67 | const { document, diagnostics } = await coreParser.parse(inputWithValidAsyncAPI); 68 | expect(filterDiagnostics(diagnostics, 'asyncapi2-schemas')).toHaveLength(0); 69 | doParseCoreTest((document?.json()?.channels?.myChannel?.publish?.message as any)?.payload, outputWithValidOpenApi3); 70 | doParseCoreTest((document?.json()?.components?.messages?.testMessage as any)?.payload, outputWithValidOpenApi3); 71 | }); 72 | 73 | it('should validate valid AsyncAPI', async function() { 74 | const diagnostics = await coreParser.validate(inputWithValidAsyncAPI); 75 | expect(filterDiagnostics(diagnostics, 'asyncapi2-schemas')).toHaveLength(0); 76 | }); 77 | 78 | it('should validate invalid AsyncAPI', async function() { 79 | const diagnostics = await coreParser.validate(inputWithInvalidAsyncAPI); 80 | expect(filterDiagnostics(diagnostics, 'asyncapi2-schemas')).toHaveLength(12); 81 | expectDiagnostics(diagnostics, 'asyncapi2-schemas', [ 82 | // in channels 83 | { 84 | message: 'must have required property \'$ref\'', 85 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties', 'name'] 86 | }, 87 | { 88 | message: 'must match exactly one schema in oneOf', 89 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties', 'name'] 90 | }, 91 | { 92 | message: 'must be equal to one of the allowed values', 93 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties', 'name', 'type'] 94 | }, 95 | { 96 | message: 'must have required property \'$ref\'', 97 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties', 'surname'] 98 | }, 99 | { 100 | message: 'must match exactly one schema in oneOf', 101 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties', 'surname'] 102 | }, 103 | { 104 | message: 'must be string', 105 | path: ['channels', 'myChannel', 'publish', 'message', 'payload', 'properties', 'surname', 'format'] 106 | }, 107 | 108 | // in components.messages 109 | { 110 | message: 'must have required property \'$ref\'', 111 | path: ['components', 'messages', 'testMessage', 'payload', 'properties', 'name'] 112 | }, 113 | { 114 | message: 'must match exactly one schema in oneOf', 115 | path: ['components', 'messages', 'testMessage', 'payload', 'properties','name'] 116 | }, 117 | { 118 | message: 'must be equal to one of the allowed values', 119 | path: ['components', 'messages', 'testMessage', 'payload', 'properties', 'name', 'type'] 120 | }, 121 | { 122 | message: 'must have required property \'$ref\'', 123 | path: ['components', 'messages', 'testMessage', 'payload', 'properties', 'surname'] 124 | }, 125 | { 126 | message: 'must match exactly one schema in oneOf', 127 | path: ['components', 'messages', 'testMessage', 'payload', 'properties', 'surname'] 128 | }, 129 | { 130 | message: 'must be string', 131 | path: ['components', 'messages', 'testMessage', 'payload', 'properties', 'surname', 'format'] 132 | }, 133 | ]); 134 | }); 135 | 136 | async function doParseTest(originalInput: ParseSchemaInput, expectedOutput: string) { 137 | const input = { ...originalInput }; 138 | const result = await parser.parse(input); 139 | 140 | // Check that the return value of parse() is the expected JSON Schema. 141 | expect(result).toEqual(JSON.parse(expectedOutput)); 142 | } 143 | 144 | async function doParseCoreTest(parsedSchema: any, expectedOutput: string) { 145 | const result = JSON.parse(JSON.stringify(parsedSchema, (field: string, value: unknown) => { 146 | if (field === 'x-parser-schema-id') return; 147 | return value; 148 | })); 149 | 150 | // Check that the return value of parse() is the expected JSON Schema. 151 | expect(result).toEqual(JSON.parse(expectedOutput)); 152 | } 153 | }); 154 | 155 | function toParseInput(raw: string): ParseSchemaInput | ValidateSchemaInput { 156 | const message = JSON.parse(raw); 157 | return { 158 | asyncapi: { 159 | semver: { 160 | version: '2.5.0', 161 | major: 2, 162 | minor: 5, 163 | patch: 0 164 | }, 165 | source: '', 166 | parsed: {} as any, 167 | }, 168 | data: message.payload, 169 | meta: { 170 | message, 171 | }, 172 | path: ['channels', 'myChannel', 'publish', 'message', 'payload'], 173 | schemaFormat: message.schemaFormat, 174 | defaultSchemaFormat: 'application/vnd.aai.asyncapi;version=2.5.0', 175 | }; 176 | } 177 | 178 | function filterDiagnostics(diagnostics: Diagnostic[], code: string) { 179 | return diagnostics.filter(d => d.code === code); 180 | } 181 | 182 | function expectDiagnostics(diagnostics: Diagnostic[], code: string, results: SchemaValidateResult[]) { 183 | expect(filterDiagnostics(diagnostics, code)).toEqual(results.map(e => expect.objectContaining(e))); 184 | } -------------------------------------------------------------------------------- /tsconfig.cjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "./cjs" 6 | } 7 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "outDir": "./esm", 4 | "baseUrl": "./src", 5 | "target": "es6", 6 | "module": "esnext", 7 | "lib": [ 8 | "esnext", 9 | ], 10 | "declaration": true, 11 | "allowJs": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true, 14 | "allowSyntheticDefaultImports": true, 15 | "strict": true, 16 | "forceConsistentCasingInFileNames": true, 17 | "noFallthroughCasesInSwitch": true, 18 | "moduleResolution": "node", 19 | "resolveJsonModule": true, 20 | "isolatedModules": true, 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } 26 | --------------------------------------------------------------------------------