├── .eslintignore ├── .gitattributes ├── .github ├── dependabot.yml ├── linters │ ├── .eslintrc.yml │ ├── .markdown-lint.yml │ ├── .yaml-lint.yml │ └── tsconfig.json └── workflows │ ├── check-dist.yml │ ├── linter.yml │ └── sanity-test.yml ├── .gitignore ├── .node-version ├── .prettierignore ├── .prettierrc.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── THIRD_PARTY_LICENSES.txt ├── action.yml ├── dist ├── LICENSE.txt ├── index.js ├── index.js.map └── sourcemap-register.js ├── package-lock.json ├── package.json ├── script └── release ├── src ├── index.ts └── main.ts └── tsconfig.json /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | dist/** -diff linguist-generated=true 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: 'github-actions' 4 | directory: '/' 5 | schedule: 6 | interval: weekly 7 | day: 'sunday' 8 | time: '10:00' 9 | groups: 10 | actions-minor: 11 | update-types: 12 | - 'minor' 13 | - 'patch' 14 | 15 | - package-ecosystem: 'npm' 16 | directory: '/' 17 | schedule: 18 | interval: weekly 19 | day: 'sunday' 20 | time: '08:00' 21 | groups: 22 | npm-development: 23 | dependency-type: 'development' 24 | update-types: 25 | - 'patch' 26 | npm-production: 27 | dependency-type: 'production' 28 | update-types: 29 | - 'patch' 30 | -------------------------------------------------------------------------------- /.github/linters/.eslintrc.yml: -------------------------------------------------------------------------------- 1 | env: 2 | node: true 3 | es6: true 4 | 5 | globals: 6 | Atomics: readonly 7 | SharedArrayBuffer: readonly 8 | 9 | ignorePatterns: 10 | - '!.*' 11 | - '**/node_modules/.*' 12 | - '**/dist/.*' 13 | - '*.json' 14 | 15 | parser: '@typescript-eslint/parser' 16 | 17 | parserOptions: 18 | ecmaVersion: 2023 19 | sourceType: module 20 | project: 21 | - './.github/linters/tsconfig.json' 22 | - './tsconfig.json' 23 | 24 | plugins: 25 | - '@typescript-eslint' 26 | - eslint-plugin-prettier 27 | 28 | extends: 29 | - eslint:recommended 30 | - plugin:@typescript-eslint/eslint-recommended 31 | - plugin:@typescript-eslint/recommended 32 | - plugin:eslint-plugin-prettier/recommended 33 | 34 | rules: 35 | { 36 | 'camelcase': 'off', 37 | 'eslint-comments/no-use': 'off', 38 | 'eslint-comments/no-unused-disable': 'off', 39 | 'i18n-text/no-en': 'off', 40 | 'import/no-namespace': 'off', 41 | 'no-console': 'off', 42 | 'no-unused-vars': 'off', 43 | 'prettier/prettier': 'error', 44 | 'semi': 'off', 45 | '@typescript-eslint/array-type': 'error', 46 | '@typescript-eslint/await-thenable': 'error', 47 | '@typescript-eslint/ban-ts-comment': 'error', 48 | '@typescript-eslint/consistent-type-assertions': 'error', 49 | '@typescript-eslint/explicit-member-accessibility': ['error', { 'accessibility': 'no-public' }], 50 | '@typescript-eslint/explicit-function-return-type': ['error', { 'allowExpressions': true }], 51 | '@typescript-eslint/func-call-spacing': ['error', 'never'], 52 | '@typescript-eslint/no-array-constructor': 'error', 53 | '@typescript-eslint/no-empty-interface': 'error', 54 | '@typescript-eslint/no-explicit-any': 'error', 55 | '@typescript-eslint/no-extraneous-class': 'error', 56 | '@typescript-eslint/no-for-in-array': 'error', 57 | '@typescript-eslint/no-inferrable-types': 'error', 58 | '@typescript-eslint/no-misused-new': 'error', 59 | '@typescript-eslint/no-namespace': 'error', 60 | '@typescript-eslint/no-non-null-assertion': 'warn', 61 | '@typescript-eslint/no-require-imports': 'error', 62 | '@typescript-eslint/no-unnecessary-qualifier': 'error', 63 | '@typescript-eslint/no-unnecessary-type-assertion': 'error', 64 | '@typescript-eslint/no-unused-vars': 'error', 65 | '@typescript-eslint/no-useless-constructor': 'error', 66 | '@typescript-eslint/no-var-requires': 'error', 67 | '@typescript-eslint/prefer-for-of': 'warn', 68 | '@typescript-eslint/prefer-function-type': 'warn', 69 | '@typescript-eslint/prefer-includes': 'error', 70 | '@typescript-eslint/prefer-string-starts-ends-with': 'error', 71 | '@typescript-eslint/promise-function-async': 'error', 72 | '@typescript-eslint/require-array-sort-compare': 'error', 73 | '@typescript-eslint/restrict-plus-operands': 'error', 74 | '@typescript-eslint/semi': ['error', 'never'], 75 | '@typescript-eslint/space-before-function-paren': 'off', 76 | '@typescript-eslint/type-annotation-spacing': 'error', 77 | '@typescript-eslint/unbound-method': 'error' 78 | } 79 | -------------------------------------------------------------------------------- /.github/linters/.markdown-lint.yml: -------------------------------------------------------------------------------- 1 | # Unordered list style 2 | MD004: 3 | style: dash 4 | 5 | MD013: 6 | line_length: 120 7 | ignore_code_blocks: true 8 | 9 | # Ordered list item prefix 10 | MD029: 11 | style: one 12 | 13 | # Spaces after list markers 14 | MD030: 15 | ul_single: 1 16 | ol_single: 1 17 | ul_multi: 1 18 | ol_multi: 1 19 | 20 | # Code block style 21 | MD046: 22 | style: fenced 23 | -------------------------------------------------------------------------------- /.github/linters/.yaml-lint.yml: -------------------------------------------------------------------------------- 1 | rules: 2 | document-end: disable 3 | document-start: 4 | level: warning 5 | present: false 6 | line-length: 7 | level: warning 8 | max: 120 9 | allow-non-breakable-words: true 10 | allow-non-breakable-inline-mappings: true 11 | -------------------------------------------------------------------------------- /.github/linters/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": "../../tsconfig.json", 4 | "compilerOptions": { 5 | "noEmit": true 6 | }, 7 | "include": ["../../src/**/*"], 8 | "exclude": ["../../dist", "../../node_modules", "*.json"] 9 | } 10 | -------------------------------------------------------------------------------- /.github/workflows/check-dist.yml: -------------------------------------------------------------------------------- 1 | name: Check Transpiled JavaScript 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | permissions: 12 | contents: read 13 | 14 | jobs: 15 | check-dist: 16 | name: Check dist/ 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - name: Checkout 21 | id: checkout 22 | uses: actions/checkout@v4 23 | 24 | - name: Setup Node.js 25 | id: setup-node 26 | uses: actions/setup-node@v4 27 | with: 28 | node-version-file: .node-version 29 | cache: npm 30 | 31 | - name: Install Dependencies 32 | id: install 33 | run: npm ci 34 | 35 | - name: Build dist/ Directory 36 | id: build 37 | run: npm run bundle 38 | 39 | # This will fail the workflow if the `dist/` directory is different than 40 | # expected. 41 | - name: Compare Directories 42 | id: diff 43 | run: | 44 | if [ ! -d dist/ ]; then 45 | echo "Expected dist/ directory does not exist. See status below:" 46 | ls -la ./ 47 | exit 1 48 | fi 49 | if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then 50 | echo "Detected uncommitted changes after build. See status below:" 51 | git diff --ignore-space-at-eol --text dist/ 52 | exit 1 53 | fi 54 | 55 | # If `dist/` was different than expected, upload the expected version as a 56 | # workflow artifact. 57 | - if: ${{ failure() && steps.diff.outcome == 'failure' }} 58 | name: Upload Artifact 59 | id: upload 60 | uses: actions/upload-artifact@v4 61 | with: 62 | name: dist 63 | path: dist/ 64 | -------------------------------------------------------------------------------- /.github/workflows/linter.yml: -------------------------------------------------------------------------------- 1 | name: Lint Codebase 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | permissions: 12 | contents: read 13 | packages: read 14 | statuses: write 15 | 16 | jobs: 17 | lint: 18 | name: Lint Codebase 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - name: Checkout 23 | id: checkout 24 | uses: actions/checkout@v4 25 | with: 26 | fetch-depth: 0 27 | 28 | - name: Setup Node.js 29 | id: setup-node 30 | uses: actions/setup-node@v4 31 | with: 32 | node-version-file: .node-version 33 | cache: npm 34 | 35 | - name: Install Dependencies 36 | id: install 37 | run: npm ci 38 | 39 | - name: Lint Codebase 40 | id: super-linter 41 | uses: github/super-linter/slim@v6 42 | env: 43 | DEFAULT_BRANCH: main 44 | FILTER_REGEX_EXCLUDE: dist/**/* 45 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 46 | TYPESCRIPT_DEFAULT_STYLE: prettier 47 | VALIDATE_ALL_CODEBASE: true 48 | VALIDATE_JAVASCRIPT_STANDARD: false 49 | VALIDATE_JSCPD: false 50 | -------------------------------------------------------------------------------- /.github/workflows/sanity-test.yml: -------------------------------------------------------------------------------- 1 | name: Sanity test of run-oci-cli-command 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | 11 | permissions: 12 | contents: read 13 | 14 | jobs: 15 | test-action: 16 | name: Sanity test run-oci-cli-command action 17 | runs-on: ubuntu-latest 18 | env: 19 | OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }} 20 | OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }} 21 | OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }} 22 | OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }} 23 | OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }} 24 | 25 | steps: 26 | - uses: actions/checkout@v4 27 | 28 | - name: Get IAM region list 29 | id: test-action-iam-region-list 30 | uses: ./ 31 | with: 32 | command: iam region list 33 | silent: false 34 | 35 | - name: Echo IAM region list 36 | id: echo-os-ns-get 37 | run: | 38 | echo "Output: ${{ steps.test-action-iam-region-list.outputs.output}}" 39 | echo "Raw output: ${{ steps.test-action-iam-region-list.outputs.raw_output}}" 40 | 41 | - name: Test non-JSON output 42 | id: test-non-json-output 43 | uses: ./ 44 | with: 45 | command: --output=table iam region list 46 | silent: false 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | 84 | # Gatsby files 85 | .cache/ 86 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 87 | # https://nextjs.org/blog/next-9-1#public-directory-support 88 | # public 89 | 90 | # vuepress build output 91 | .vuepress/dist 92 | 93 | # Serverless directories 94 | .serverless/ 95 | 96 | # FuseBox cache 97 | .fusebox/ 98 | 99 | # DynamoDB Local files 100 | .dynamodb/ 101 | 102 | # TernJS port file 103 | .tern-port 104 | 105 | # Unpacked transpile 106 | lib 107 | 108 | .DS_Store 109 | -------------------------------------------------------------------------------- /.node-version: -------------------------------------------------------------------------------- 1 | 20.6.0 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "tabWidth": 2, 4 | "useTabs": false, 5 | "semi": false, 6 | "singleQuote": true, 7 | "quoteProps": "as-needed", 8 | "jsxSingleQuote": false, 9 | "trailingComma": "none", 10 | "bracketSpacing": true, 11 | "bracketSameLine": true, 12 | "arrowParens": "avoid", 13 | "proseWrap": "always", 14 | "htmlWhitespaceSensitivity": "css", 15 | "endOfLine": "lf" 16 | } 17 | -------------------------------------------------------------------------------- /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 6 | participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, 7 | disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, 8 | socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 9 | 10 | ## Our Standards 11 | 12 | Examples of behavior that contributes to creating a positive environment include: 13 | 14 | - Using welcoming and inclusive language 15 | - Being respectful of differing viewpoints and experiences 16 | - Gracefully accepting constructive criticism 17 | - Focusing on what is best for the community 18 | - Showing empathy towards other community members 19 | 20 | Examples of unacceptable behavior by participants include: 21 | 22 | - The use of sexualized language or imagery and unwelcome sexual attention or advances 23 | - Trolling, insulting/derogatory comments, and personal or political attacks 24 | - Public or private harassment 25 | - Publishing others' private information, such as a physical or electronic address, without explicit permission 26 | - Other conduct which could reasonably be considered inappropriate in a professional setting 27 | 28 | ## Our Responsibilities 29 | 30 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take 31 | appropriate and fair corrective action in response to any instances of unacceptable behavior. 32 | 33 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, 34 | issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any 35 | contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 36 | 37 | ## Scope 38 | 39 | This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the 40 | project or its community in public spaces. Examples of representing a project or community include using an official 41 | project email address, posting via an official social media account, or acting as an appointed representative at an 42 | online or offline event. Representation of a project may be further defined and clarified by project maintainers. 43 | 44 | ## Enforcement 45 | 46 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at 47 | . All complaints will be reviewed and investigated and will result in a response that is 48 | deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with 49 | regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 50 | 51 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent 52 | repercussions as determined by other members of the project's leadership. 53 | 54 | ## Attribution 55 | 56 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at 57 | . 58 | 59 | [homepage]: https://www.contributor-covenant.org 60 | 61 | For answers to common questions about this code of conduct, see 62 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to this repository 2 | 3 | We welcome your contributions! There are multiple ways to contribute, even if you're not a developer. 4 | 5 | ## Opening issues 6 | 7 | If you think you've found a security vulnerability, do not open a GitHub issue. Instead, follow the instructions in our 8 | [security policy][SEC]. 9 | 10 | To report a bug or request an enhancement that is not related to a security vulnerabiliity, open a GitHub issue. When 11 | filing a bug, remember that the better written the bug is, the more easier and more likely it is to be reproduced and 12 | fixed. 13 | 14 | ## Pre-requisites for code or documentation submissions 15 | 16 | Before we can review or accept any source code or documentation-related contribution, you will need digitally sign the 17 | [Oracle Contributor Agreement][OCA] (OCA) using the OCA Signing Service. This only needs to be done once, so if you've 18 | signed it for another repository or project, there is no need to sign again. 19 | 20 | All your commit messages must include the following line using the same name and email address you used to sign the OCA: 21 | 22 | ```text 23 | Signed-off-by: Your Name 24 | ``` 25 | 26 | This can be automatically added to pull requests by committing with `--sign-off` or `-s`, e.g. 27 | 28 | ```text 29 | git commit --signoff 30 | ``` 31 | 32 | We can only accept pull requests from contributors who have been verified as having signed the OCA. 33 | 34 | ## Commit messages 35 | 36 | This project uses [Conventional Commits][CONCOM] and is [Commitizen][CZ] friendly. 37 | 38 | If you already have Commitizen installed, you can run `git cz ...` instead of `git commit ...` and Commitizen will make 39 | sure your commit message is in the right format and provides all the necessary information. 40 | 41 | If you don't have Commitizen installed, a pre-commit `git` hook will analyze your commit message and report anything 42 | that needs to be fixed. For example: 43 | 44 | ```shell 45 | $ git commit -m "Updated the contribution guide." 46 | ⧗ input: Updated the contribution guide. 47 | ✖ subject may not be empty [subject-empty] 48 | ✖ type may not be empty [type-empty] 49 | ⚠ message must be signed off [signed-off-by] 50 | 51 | ✖ found 2 problems, 1 warnings 52 | ⓘ Get help: https://github.com/oracle-actions/.github/blob/main/CONTRIBUTING.md#commit-messages 53 | 54 | husky - commit-msg hook exited with code 1 (error) 55 | ``` 56 | 57 | If you have any questions, please check the [Conventional Commits FAQ][CCFAQ], [start a discussion][DISC] or [open an 58 | issue][ISSUE]. 59 | 60 | ## Pull request process 61 | 62 | 1. Ensure there is an issue created to track and discuss the fix or enhancement you intend to submit. 63 | 1. Fork this repository 64 | 1. Create a branch in your fork to implement the changes. We recommend using the issue number as part of your branch 65 | name, e.g. `1234-fixes` 66 | 1. Ensure that any documentation is updated with the changes that are required by your change. 67 | 1. Ensure that any samples are updated if the base image has been changed. 68 | 1. Submit the pull request. _Do not leave the pull request blank_. Explain exactly what your changes are meant to do and 69 | provide simple steps on how to validate your changes. Ensure that you reference the issue you created as well. 70 | 1. We will assign the pull request to specific people for review before it is merged. 71 | 72 | ## Code of conduct 73 | 74 | Our [Code of Conduct](./CODE_OF_CONDUCT.md) is adapted from the [Contributor Covenant][CC], version 1.4, available at 75 | . 76 | 77 | [OCA]: https://oca.opensource.oracle.com 78 | [CC]: https://www.contributor-covenant.org 79 | [SEC]: ./SECURITY.md 80 | [CONCOM]: https://www.conventionalcommits.org 81 | [CZ]: https://commitizen.github.io/cz-cli/ 82 | [CCFAQ]: https://www.conventionalcommits.org/en/v1.0.0/#faq 83 | [DISC]: ./discussions 84 | [ISSUE]: ./issues 85 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021, 2022, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # run-oci-cli-command 2 | 3 | This GitHub Action installs the OCI CLI and then runs the specified command. This action will automatically cache the 4 | OCI CLI install to speed up any subsequent steps that use this action. 5 | 6 | ## Required environment variables 7 | 8 | The following [OCI CLI environment variables][1] must be defined for at least the `run-oci-cli-command` task: 9 | 10 | - `OCI_CLI_USER` 11 | - `OCI_CLI_TENANCY` 12 | - `OCI_CLI_FINGERPRINT` 13 | - `OCI_CLI_KEY_CONTENT` 14 | - `OCI_CLI_REGION` 15 | 16 | We recommend using GitHub Secrets to store these values. If you have more than one `run-oci-cli-command` task, consider 17 | [defining your environment variables][2] at the job or workflow level. 18 | 19 | ## Inputs 20 | 21 | - `command` (required): the [command and arguments][3] to provide to the `oci` tool. 22 | - `query`: (optional) a [JMESPath query][4] to run on the response JSON before output. 23 | 24 | ### Output masking 25 | 26 | By default, the output(s) from the command are masked from the GitHub Actions log and GitHub console, to prevent leaking 27 | any credential or confidential information. The following option will disable that masking and is intended for debugging 28 | purposes only: 29 | 30 | - `silent`: (Optional; default: _true_) If set to _false_ the action will not mask or suppress the command or outputs 31 | from the logs or console. 32 | 33 | > **Note:** the output does not need to be visible in the log to be used as an input by another task. 34 | 35 | ## Outputs 36 | 37 | - `output`: will contain the results of the command. 38 | - `raw_output`: if the output of a given query is a single string value, `raw_output` will return the string without 39 | surrounding quotes. 40 | 41 | > **Note:** filtering the `output` or `raw_output` by piping it through another tool like `jq` may result in the 42 | > filtered output being visible in the job logs. We recommend using the `query` parameter whenever possible. 43 | 44 | If the result of the command is not valid JSON, it will not be visible unless `silent` is set to _false_. 45 | 46 | ## Sample workflow 47 | 48 | The following example lists all compute instances found in the `testing` compartment of the `OCI_CLI_TENANCY` in the 49 | `OCI_CLI_REGION` region. 50 | 51 | To change the name of the compartment, modifying the `query` parameter of the `find-compartment-id` step. 52 | 53 | To change which fields are returned, modify the `query` parameter of the `find-instances` step. 54 | 55 | ```yaml 56 | jobs: 57 | my-instances: 58 | runs-on: ubuntu-latest 59 | name: List the display name and shape of the instances in my compartment 60 | env: 61 | OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }} 62 | OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }} 63 | OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }} 64 | OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }} 65 | OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }} 66 | steps: 67 | - name: Retrieve the OCID of a named compartment in tenancy 68 | uses: oracle-actions/run-oci-cli-command@v1.3.2 69 | id: find-compartment-id 70 | with: 71 | command: 'iam compartment list --compartment-id-in-subtree=true' 72 | query: "data[?name=='testing'].id" 73 | 74 | - name: Retrieve the display name and shape of the instances in my compartment 75 | uses: oracle-actions/run-oci-cli-command@v1.3.2 76 | id: find-instances 77 | with: 78 | command: 'compute instance list --compartment-id ${{ steps.find-compartment-id.outputs.raw_output }}' 79 | query: 'data[*].{name: \"display-name\", shape: shape}' 80 | 81 | - name: List the display name and shape of the instances in my compartment 82 | run: | 83 | echo ${{ steps.find-instances.outputs.output }} | jq . 84 | ``` 85 | 86 | Consult the [JMESPath documentation][4] for details on how to create more complex queries and result formatting and 87 | [`action.yml`](./action.yml) for more detail on how to configure this action.. 88 | 89 | ## Contributing 90 | 91 | We welcome contributions from the community. Before submitting a pull request, please 92 | [review our contribution guide](./CONTRIBUTING.md). 93 | 94 | ## Security 95 | 96 | Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process. 97 | 98 | ## License 99 | 100 | Copyright (c) 2021, 2024, Oracle and/or its affiliates. 101 | 102 | Released under the Universal Permissive License v1.0 as shown at . 103 | 104 | [1]: https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/clienvironmentvariables.htm 105 | [2]: https://docs.github.com/en/actions/learn-github-actions/environment-variables 106 | [3]: https://docs.oracle.com/en-us/iaas/tools/oci-cli/3.2.0/oci_cli_docs/ 107 | [4]: https://jmespath.org/ 108 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting security vulnerabilities 2 | 3 | Oracle values the independent security research community and believes that responsible disclosure of security 4 | vulnerabilities helps us ensure the security and privacy of all our users. 5 | 6 | Please do NOT raise a GitHub Issue to report a security vulnerability. If you believe you have found a security 7 | vulnerability, please submit a report to preferably with a proof of concept. Please 8 | review some additional information on [how to report security vulnerabilities to Oracle][1]. We encourage people who 9 | contact Oracle Security to use email encryption using [our encryption key][2]. 10 | 11 | We ask that you do not use other channels or contact the project maintainers directly. 12 | 13 | Non-vulnerability related security issues including ideas for new or improved security features are welcome on GitHub 14 | Issues. 15 | 16 | ## Security updates, alerts and bulletins 17 | 18 | Security updates will be released on a regular cadence. Many of our projects will typically release security fixes in 19 | conjunction with the [Oracle Critical Patch Update][3] program. Security updates are released on the Tuesday closest to 20 | the 17th day of January, April, July and October. A prerelease announcement will be published on the Thursday preceding 21 | each release. Additional information, including past advisories, is available on our [security alerts][3] page. 22 | 23 | ## Security-related information 24 | 25 | We will provide security related information such as a threat model, considerations for secure use, or any known 26 | security issues in our documentation. Please note that labs and sample code are intended to demonstrate a concept and 27 | may not be sufficiently hardened for production use. 28 | 29 | [1]: https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html 30 | [2]: https://www.oracle.com/security-alerts/encryptionkey.html 31 | [3]: https://www.oracle.com/security-alerts/ 32 | -------------------------------------------------------------------------------- /THIRD_PARTY_LICENSES.txt: -------------------------------------------------------------------------------- 1 | 2 | ----------------------- Dependencies Grouped by License ------------ 3 | -------- Dependency 4 | @actions/http-client@1.0.11 5 | -------- Copyrights 6 | Copyright (c) GitHub, Inc. 7 | 8 | -------- Dependencies Summary 9 | @actions/http-client@1.0.11 10 | 11 | -------- License used by Dependencies 12 | Actions Http Client for Node.js 13 | 14 | Copyright (c) GitHub, Inc. 15 | 16 | All rights reserved. 17 | 18 | MIT License 19 | 20 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 21 | associated documentation files (the "Software"), to deal in the Software without restriction, 22 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 23 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 24 | subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 27 | 28 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 29 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 30 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 31 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 32 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 | 34 | 35 | ----------------------- Dependencies Grouped by License ------------ 36 | -------- Dependency 37 | semver@6.3.0 38 | -------- Copyrights 39 | Copyright (c) Isaac Z. Schlueter and Contributors 40 | Copyright Isaac Z. Schlueter 41 | 42 | -------- Dependencies Summary 43 | semver@6.3.0 44 | 45 | -------- License used by Dependencies 46 | SPDX:ISC 47 | Permission to use, copy, modify, and/or distribute this 48 | software for any purpose with or without fee is hereby granted, provided that 49 | the above copyright notice and this permission notice appear in all copies. 50 | 51 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 52 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 53 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 54 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 55 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 56 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 57 | PERFORMANCE OF THIS SOFTWARE. 58 | 59 | ----------------------- Dependencies Grouped by License ------------ 60 | -------- Dependency 61 | @actions/core@1.6.0 62 | -------- Copyrights 63 | Copyright 2019 GitHub 64 | 65 | -------- Dependency 66 | @actions/exec@1.1.0 67 | -------- Copyrights 68 | Copyright 2019 GitHub 69 | Copyright Joyent, Inc. and other Node contributors. All rights reserved. 70 | 71 | -------- Dependency 72 | @actions/io@1.1.1 73 | -------- Copyrights 74 | Copyright 2019 GitHub 75 | 76 | -------- Dependency 77 | @actions/tool-cache@1.7.1 78 | -------- Copyrights 79 | Copyright 2019 GitHub 80 | 81 | -------- Dependency 82 | tunnel@0.0.6 83 | -------- Copyrights 84 | Copyright (c) 2012 Koichi Kobayashi 85 | 86 | -------- Dependency 87 | uuid@3.4.0 88 | -------- Copyrights 89 | Copyright (c) 2010-2016 Robert Kieffer and other contributors 90 | Copyright 2011, Sebastian Tschan 91 | Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 92 | 93 | -------- Dependencies Summary 94 | @actions/core@1.6.0 95 | @actions/exec@1.1.0 96 | @actions/io@1.1.1 97 | @actions/tool-cache@1.7.1 98 | tunnel@0.0.6 99 | uuid@3.4.0 100 | 101 | -------- License used by Dependencies 102 | SPDX:MIT 103 | Permission is hereby granted, free of charge, to any person 104 | obtaining a copy of this software and associated documentation files 105 | (the "Software"), to deal in the Software without restriction, including without 106 | limitation the rights to use, copy, modify, merge, publish, distribute, 107 | sublicense, and/or sell copies of the Software, and to permit persons to whom 108 | the Software is furnished to do so, subject to the following conditions: 109 | 110 | The above copyright notice and this permission notice shall be included in all 111 | copies or substantial portions of the Software. 112 | 113 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 114 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 115 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 116 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 117 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 118 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 119 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, 2024 Oracle and/or its affiliates. 2 | # Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. 3 | --- 4 | name: Run an Oracle Cloud Infrastructure (OCI) CLI command 5 | description: Run an Oracle Cloud Infrastructure (OCI) CLI command 6 | inputs: 7 | command: 8 | description: >- 9 | The command and arguments to provide to the "oci" tool. Most commands specify a service, followed by a resource 10 | type and then an action, e.g. "iam user list --compartment-id " 11 | required: true 12 | query: 13 | description: >- 14 | (Optional) JMESPath query [http://jmespath.org/] to run on the response JSON before output. 15 | required: false 16 | default: '' 17 | silent: 18 | description: >- 19 | (Default: true) If set to 'False', will stream the output of the command directly to the log. This may leak 20 | confidential information. We recomment keep this as false except for debugging purposes. 21 | required: false 22 | default: 'True' 23 | outputs: 24 | output: 25 | description: Response output in JSON format 26 | raw_output: 27 | description: >- 28 | If the output of a given query is a single string value, this will return the string without surrounding quotes. 29 | branding: 30 | icon: 'circle' 31 | color: 'red' 32 | runs: 33 | using: 'node20' 34 | main: 'dist/index.js' 35 | -------------------------------------------------------------------------------- /dist/LICENSE.txt: -------------------------------------------------------------------------------- 1 | @actions/core 2 | MIT 3 | The MIT License (MIT) 4 | 5 | Copyright 2019 GitHub 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | 13 | @actions/exec 14 | MIT 15 | The MIT License (MIT) 16 | 17 | Copyright 2019 GitHub 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | @actions/http-client 26 | MIT 27 | Actions Http Client for Node.js 28 | 29 | Copyright (c) GitHub, Inc. 30 | 31 | All rights reserved. 32 | 33 | MIT License 34 | 35 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 36 | associated documentation files (the "Software"), to deal in the Software without restriction, 37 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 38 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 39 | subject to the following conditions: 40 | 41 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 42 | 43 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 44 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 45 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 46 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 47 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 48 | 49 | 50 | @actions/io 51 | MIT 52 | The MIT License (MIT) 53 | 54 | Copyright 2019 GitHub 55 | 56 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 57 | 58 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 59 | 60 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 61 | 62 | tunnel 63 | MIT 64 | The MIT License (MIT) 65 | 66 | Copyright (c) 2012 Koichi Kobayashi 67 | 68 | Permission is hereby granted, free of charge, to any person obtaining a copy 69 | of this software and associated documentation files (the "Software"), to deal 70 | in the Software without restriction, including without limitation the rights 71 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 72 | copies of the Software, and to permit persons to whom the Software is 73 | furnished to do so, subject to the following conditions: 74 | 75 | The above copyright notice and this permission notice shall be included in 76 | all copies or substantial portions of the Software. 77 | 78 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 79 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 80 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 81 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 82 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 83 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 84 | THE SOFTWARE. 85 | 86 | 87 | uuid 88 | MIT 89 | The MIT License (MIT) 90 | 91 | Copyright (c) 2010-2020 Robert Kieffer and other contributors 92 | 93 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 94 | 95 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 96 | 97 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 98 | -------------------------------------------------------------------------------- /dist/sourcemap-register.js: -------------------------------------------------------------------------------- 1 | (()=>{var e={650:e=>{var r=Object.prototype.toString;var n=typeof Buffer.alloc==="function"&&typeof Buffer.allocUnsafe==="function"&&typeof Buffer.from==="function";function isArrayBuffer(e){return r.call(e).slice(8,-1)==="ArrayBuffer"}function fromArrayBuffer(e,r,t){r>>>=0;var o=e.byteLength-r;if(o<0){throw new RangeError("'offset' is out of bounds")}if(t===undefined){t=o}else{t>>>=0;if(t>o){throw new RangeError("'length' is out of bounds")}}return n?Buffer.from(e.slice(r,r+t)):new Buffer(new Uint8Array(e.slice(r,r+t)))}function fromString(e,r){if(typeof r!=="string"||r===""){r="utf8"}if(!Buffer.isEncoding(r)){throw new TypeError('"encoding" must be a valid string encoding')}return n?Buffer.from(e,r):new Buffer(e,r)}function bufferFrom(e,r,t){if(typeof e==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(e)){return fromArrayBuffer(e,r,t)}if(typeof e==="string"){return fromString(e,r)}return n?Buffer.from(e):new Buffer(e)}e.exports=bufferFrom},274:(e,r,n)=>{var t=n(339);var o=Object.prototype.hasOwnProperty;var i=typeof Map!=="undefined";function ArraySet(){this._array=[];this._set=i?new Map:Object.create(null)}ArraySet.fromArray=function ArraySet_fromArray(e,r){var n=new ArraySet;for(var t=0,o=e.length;t=0){return r}}else{var n=t.toSetString(e);if(o.call(this._set,n)){return this._set[n]}}throw new Error('"'+e+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(e){if(e>=0&&e{var t=n(190);var o=5;var i=1<>1;return r?-n:n}r.encode=function base64VLQ_encode(e){var r="";var n;var i=toVLQSigned(e);do{n=i&a;i>>>=o;if(i>0){n|=u}r+=t.encode(n)}while(i>0);return r};r.decode=function base64VLQ_decode(e,r,n){var i=e.length;var s=0;var l=0;var c,p;do{if(r>=i){throw new Error("Expected more digits in base 64 VLQ value.")}p=t.decode(e.charCodeAt(r++));if(p===-1){throw new Error("Invalid base64 digit: "+e.charAt(r-1))}c=!!(p&u);p&=a;s=s+(p<{var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(0<=e&&e{r.GREATEST_LOWER_BOUND=1;r.LEAST_UPPER_BOUND=2;function recursiveSearch(e,n,t,o,i,a){var u=Math.floor((n-e)/2)+e;var s=i(t,o[u],true);if(s===0){return u}else if(s>0){if(n-u>1){return recursiveSearch(u,n,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return n1){return recursiveSearch(e,u,t,o,i,a)}if(a==r.LEAST_UPPER_BOUND){return u}else{return e<0?-1:e}}}r.search=function search(e,n,t,o){if(n.length===0){return-1}var i=recursiveSearch(-1,n.length,e,n,t,o||r.GREATEST_LOWER_BOUND);if(i<0){return-1}while(i-1>=0){if(t(n[i],n[i-1],true)!==0){break}--i}return i}},680:(e,r,n)=>{var t=n(339);function generatedPositionAfter(e,r){var n=e.generatedLine;var o=r.generatedLine;var i=e.generatedColumn;var a=r.generatedColumn;return o>n||o==n&&a>=i||t.compareByGeneratedPositionsInflated(e,r)<=0}function MappingList(){this._array=[];this._sorted=true;this._last={generatedLine:-1,generatedColumn:0}}MappingList.prototype.unsortedForEach=function MappingList_forEach(e,r){this._array.forEach(e,r)};MappingList.prototype.add=function MappingList_add(e){if(generatedPositionAfter(this._last,e)){this._last=e;this._array.push(e)}else{this._sorted=false;this._array.push(e)}};MappingList.prototype.toArray=function MappingList_toArray(){if(!this._sorted){this._array.sort(t.compareByGeneratedPositionsInflated);this._sorted=true}return this._array};r.H=MappingList},758:(e,r)=>{function swap(e,r,n){var t=e[r];e[r]=e[n];e[n]=t}function randomIntInRange(e,r){return Math.round(e+Math.random()*(r-e))}function doQuickSort(e,r,n,t){if(n{var t;var o=n(339);var i=n(345);var a=n(274).I;var u=n(449);var s=n(758).U;function SourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}return n.sections!=null?new IndexedSourceMapConsumer(n,r):new BasicSourceMapConsumer(n,r)}SourceMapConsumer.fromSourceMap=function(e,r){return BasicSourceMapConsumer.fromSourceMap(e,r)};SourceMapConsumer.prototype._version=3;SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{configurable:true,enumerable:true,get:function(){if(!this.__generatedMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{configurable:true,enumerable:true,get:function(){if(!this.__originalMappings){this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._charIsMappingSeparator=function SourceMapConsumer_charIsMappingSeparator(e,r){var n=e.charAt(r);return n===";"||n===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(e,r){throw new Error("Subclasses must implement _parseMappings")};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.GREATEST_LOWER_BOUND=1;SourceMapConsumer.LEAST_UPPER_BOUND=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(e,r,n){var t=r||null;var i=n||SourceMapConsumer.GENERATED_ORDER;var a;switch(i){case SourceMapConsumer.GENERATED_ORDER:a=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:a=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;a.map((function(e){var r=e.source===null?null:this._sources.at(e.source);r=o.computeSourceURL(u,r,this._sourceMapURL);return{source:r,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:e.name===null?null:this._names.at(e.name)}}),this).forEach(e,t)};SourceMapConsumer.prototype.allGeneratedPositionsFor=function SourceMapConsumer_allGeneratedPositionsFor(e){var r=o.getArg(e,"line");var n={source:o.getArg(e,"source"),originalLine:r,originalColumn:o.getArg(e,"column",0)};n.source=this._findSourceIndex(n.source);if(n.source<0){return[]}var t=[];var a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,i.LEAST_UPPER_BOUND);if(a>=0){var u=this._originalMappings[a];if(e.column===undefined){var s=u.originalLine;while(u&&u.originalLine===s){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}else{var l=u.originalColumn;while(u&&u.originalLine===r&&u.originalColumn==l){t.push({line:o.getArg(u,"generatedLine",null),column:o.getArg(u,"generatedColumn",null),lastColumn:o.getArg(u,"lastGeneratedColumn",null)});u=this._originalMappings[++a]}}}return t};r.SourceMapConsumer=SourceMapConsumer;function BasicSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sources");var u=o.getArg(n,"names",[]);var s=o.getArg(n,"sourceRoot",null);var l=o.getArg(n,"sourcesContent",null);var c=o.getArg(n,"mappings");var p=o.getArg(n,"file",null);if(t!=this._version){throw new Error("Unsupported version: "+t)}if(s){s=o.normalize(s)}i=i.map(String).map(o.normalize).map((function(e){return s&&o.isAbsolute(s)&&o.isAbsolute(e)?o.relative(s,e):e}));this._names=a.fromArray(u.map(String),true);this._sources=a.fromArray(i,true);this._absoluteSources=this._sources.toArray().map((function(e){return o.computeSourceURL(s,e,r)}));this.sourceRoot=s;this.sourcesContent=l;this._mappings=c;this._sourceMapURL=r;this.file=p}BasicSourceMapConsumer.prototype=Object.create(SourceMapConsumer.prototype);BasicSourceMapConsumer.prototype.consumer=SourceMapConsumer;BasicSourceMapConsumer.prototype._findSourceIndex=function(e){var r=e;if(this.sourceRoot!=null){r=o.relative(this.sourceRoot,r)}if(this._sources.has(r)){return this._sources.indexOf(r)}var n;for(n=0;n1){v.source=l+_[1];l+=_[1];v.originalLine=i+_[2];i=v.originalLine;v.originalLine+=1;v.originalColumn=a+_[3];a=v.originalColumn;if(_.length>4){v.name=c+_[4];c+=_[4]}}m.push(v);if(typeof v.originalLine==="number"){d.push(v)}}}s(m,o.compareByGeneratedPositionsDeflated);this.__generatedMappings=m;s(d,o.compareByOriginalPositions);this.__originalMappings=d};BasicSourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(e,r,n,t,o,a){if(e[n]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+e[n])}if(e[t]<0){throw new TypeError("Column must be greater than or equal to 0, got "+e[t])}return i.search(e,r,o,a)};BasicSourceMapConsumer.prototype.computeColumnSpans=function SourceMapConsumer_computeColumnSpans(){for(var e=0;e=0){var t=this._generatedMappings[n];if(t.generatedLine===r.generatedLine){var i=o.getArg(t,"source",null);if(i!==null){i=this._sources.at(i);i=o.computeSourceURL(this.sourceRoot,i,this._sourceMapURL)}var a=o.getArg(t,"name",null);if(a!==null){a=this._names.at(a)}return{source:i,line:o.getArg(t,"originalLine",null),column:o.getArg(t,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}};BasicSourceMapConsumer.prototype.hasContentsOfAllSources=function BasicSourceMapConsumer_hasContentsOfAllSources(){if(!this.sourcesContent){return false}return this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return e==null}))};BasicSourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(e,r){if(!this.sourcesContent){return null}var n=this._findSourceIndex(e);if(n>=0){return this.sourcesContent[n]}var t=e;if(this.sourceRoot!=null){t=o.relative(this.sourceRoot,t)}var i;if(this.sourceRoot!=null&&(i=o.urlParse(this.sourceRoot))){var a=t.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(a)){return this.sourcesContent[this._sources.indexOf(a)]}if((!i.path||i.path=="/")&&this._sources.has("/"+t)){return this.sourcesContent[this._sources.indexOf("/"+t)]}}if(r){return null}else{throw new Error('"'+t+'" is not in the SourceMap.')}};BasicSourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(e){var r=o.getArg(e,"source");r=this._findSourceIndex(r);if(r<0){return{line:null,column:null,lastColumn:null}}var n={source:r,originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")};var t=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",SourceMapConsumer.GREATEST_LOWER_BOUND));if(t>=0){var i=this._originalMappings[t];if(i.source===n.source){return{line:o.getArg(i,"generatedLine",null),column:o.getArg(i,"generatedColumn",null),lastColumn:o.getArg(i,"lastGeneratedColumn",null)}}}return{line:null,column:null,lastColumn:null}};t=BasicSourceMapConsumer;function IndexedSourceMapConsumer(e,r){var n=e;if(typeof e==="string"){n=o.parseSourceMapInput(e)}var t=o.getArg(n,"version");var i=o.getArg(n,"sections");if(t!=this._version){throw new Error("Unsupported version: "+t)}this._sources=new a;this._names=new a;var u={line:-1,column:0};this._sections=i.map((function(e){if(e.url){throw new Error("Support for url field in sections not implemented.")}var n=o.getArg(e,"offset");var t=o.getArg(n,"line");var i=o.getArg(n,"column");if(t{var t=n(449);var o=n(339);var i=n(274).I;var a=n(680).H;function SourceMapGenerator(e){if(!e){e={}}this._file=o.getArg(e,"file",null);this._sourceRoot=o.getArg(e,"sourceRoot",null);this._skipValidation=o.getArg(e,"skipValidation",false);this._sources=new i;this._names=new i;this._mappings=new a;this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(e){var r=e.sourceRoot;var n=new SourceMapGenerator({file:e.file,sourceRoot:r});e.eachMapping((function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};if(e.source!=null){t.source=e.source;if(r!=null){t.source=o.relative(r,t.source)}t.original={line:e.originalLine,column:e.originalColumn};if(e.name!=null){t.name=e.name}}n.addMapping(t)}));e.sources.forEach((function(t){var i=t;if(r!==null){i=o.relative(r,t)}if(!n._sources.has(i)){n._sources.add(i)}var a=e.sourceContentFor(t);if(a!=null){n.setSourceContent(t,a)}}));return n};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(e){var r=o.getArg(e,"generated");var n=o.getArg(e,"original",null);var t=o.getArg(e,"source",null);var i=o.getArg(e,"name",null);if(!this._skipValidation){this._validateMapping(r,n,t,i)}if(t!=null){t=String(t);if(!this._sources.has(t)){this._sources.add(t)}}if(i!=null){i=String(i);if(!this._names.has(i)){this._names.add(i)}}this._mappings.add({generatedLine:r.line,generatedColumn:r.column,originalLine:n!=null&&n.line,originalColumn:n!=null&&n.column,source:t,name:i})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(e,r){var n=e;if(this._sourceRoot!=null){n=o.relative(this._sourceRoot,n)}if(r!=null){if(!this._sourcesContents){this._sourcesContents=Object.create(null)}this._sourcesContents[o.toSetString(n)]=r}else if(this._sourcesContents){delete this._sourcesContents[o.toSetString(n)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(e,r,n){var t=r;if(r==null){if(e.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}t=e.file}var a=this._sourceRoot;if(a!=null){t=o.relative(a,t)}var u=new i;var s=new i;this._mappings.unsortedForEach((function(r){if(r.source===t&&r.originalLine!=null){var i=e.originalPositionFor({line:r.originalLine,column:r.originalColumn});if(i.source!=null){r.source=i.source;if(n!=null){r.source=o.join(n,r.source)}if(a!=null){r.source=o.relative(a,r.source)}r.originalLine=i.line;r.originalColumn=i.column;if(i.name!=null){r.name=i.name}}}var l=r.source;if(l!=null&&!u.has(l)){u.add(l)}var c=r.name;if(c!=null&&!s.has(c)){s.add(c)}}),this);this._sources=u;this._names=s;e.sources.forEach((function(r){var t=e.sourceContentFor(r);if(t!=null){if(n!=null){r=o.join(n,r)}if(a!=null){r=o.relative(a,r)}this.setSourceContent(r,t)}}),this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(e,r,n,t){if(r&&typeof r.line!=="number"&&typeof r.column!=="number"){throw new Error("original.line and original.column are not numbers -- you probably meant to omit "+"the original mapping entirely and only map the generated position. If so, pass "+"null for the original mapping instead of an object with empty or null values.")}if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!r&&!n&&!t){return}else if(e&&"line"in e&&"column"in e&&r&&"line"in r&&"column"in r&&e.line>0&&e.column>=0&&r.line>0&&r.column>=0&&n){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:n,original:r,name:t}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var e=0;var r=1;var n=0;var i=0;var a=0;var u=0;var s="";var l;var c;var p;var f;var g=this._mappings.toArray();for(var h=0,d=g.length;h0){if(!o.compareByGeneratedPositionsInflated(c,g[h-1])){continue}l+=","}}l+=t.encode(c.generatedColumn-e);e=c.generatedColumn;if(c.source!=null){f=this._sources.indexOf(c.source);l+=t.encode(f-u);u=f;l+=t.encode(c.originalLine-1-i);i=c.originalLine-1;l+=t.encode(c.originalColumn-n);n=c.originalColumn;if(c.name!=null){p=this._names.indexOf(c.name);l+=t.encode(p-a);a=p}}s+=l}return s};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(e,r){return e.map((function(e){if(!this._sourcesContents){return null}if(r!=null){e=o.relative(r,e)}var n=o.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,n)?this._sourcesContents[n]:null}),this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){e.file=this._file}if(this._sourceRoot!=null){e.sourceRoot=this._sourceRoot}if(this._sourcesContents){e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)}return e};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this.toJSON())};r.h=SourceMapGenerator},351:(e,r,n)=>{var t;var o=n(591).h;var i=n(339);var a=/(\r?\n)/;var u=10;var s="$$$isSourceNode$$$";function SourceNode(e,r,n,t,o){this.children=[];this.sourceContents={};this.line=e==null?null:e;this.column=r==null?null:r;this.source=n==null?null:n;this.name=o==null?null:o;this[s]=true;if(t!=null)this.add(t)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(e,r,n){var t=new SourceNode;var o=e.split(a);var u=0;var shiftNextLine=function(){var e=getNextLine();var r=getNextLine()||"";return e+r;function getNextLine(){return u=0;r--){this.prepend(e[r])}}else if(e[s]||typeof e==="string"){this.children.unshift(e)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e)}return this};SourceNode.prototype.walk=function SourceNode_walk(e){var r;for(var n=0,t=this.children.length;n0){r=[];for(n=0;n{function getArg(e,r,n){if(r in e){return e[r]}else if(arguments.length===3){return n}else{throw new Error('"'+r+'" is a required argument.')}}r.getArg=getArg;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;var t=/^data:.+\,.+$/;function urlParse(e){var r=e.match(n);if(!r){return null}return{scheme:r[1],auth:r[2],host:r[3],port:r[4],path:r[5]}}r.urlParse=urlParse;function urlGenerate(e){var r="";if(e.scheme){r+=e.scheme+":"}r+="//";if(e.auth){r+=e.auth+"@"}if(e.host){r+=e.host}if(e.port){r+=":"+e.port}if(e.path){r+=e.path}return r}r.urlGenerate=urlGenerate;function normalize(e){var n=e;var t=urlParse(e);if(t){if(!t.path){return e}n=t.path}var o=r.isAbsolute(n);var i=n.split(/\/+/);for(var a,u=0,s=i.length-1;s>=0;s--){a=i[s];if(a==="."){i.splice(s,1)}else if(a===".."){u++}else if(u>0){if(a===""){i.splice(s+1,u);u=0}else{i.splice(s,2);u--}}}n=i.join("/");if(n===""){n=o?"/":"."}if(t){t.path=n;return urlGenerate(t)}return n}r.normalize=normalize;function join(e,r){if(e===""){e="."}if(r===""){r="."}var n=urlParse(r);var o=urlParse(e);if(o){e=o.path||"/"}if(n&&!n.scheme){if(o){n.scheme=o.scheme}return urlGenerate(n)}if(n||r.match(t)){return r}if(o&&!o.host&&!o.path){o.host=r;return urlGenerate(o)}var i=r.charAt(0)==="/"?r:normalize(e.replace(/\/+$/,"")+"/"+r);if(o){o.path=i;return urlGenerate(o)}return i}r.join=join;r.isAbsolute=function(e){return e.charAt(0)==="/"||n.test(e)};function relative(e,r){if(e===""){e="."}e=e.replace(/\/$/,"");var n=0;while(r.indexOf(e+"/")!==0){var t=e.lastIndexOf("/");if(t<0){return r}e=e.slice(0,t);if(e.match(/^([^\/]+:\/)?\/*$/)){return r}++n}return Array(n+1).join("../")+r.substr(e.length+1)}r.relative=relative;var o=function(){var e=Object.create(null);return!("__proto__"in e)}();function identity(e){return e}function toSetString(e){if(isProtoString(e)){return"$"+e}return e}r.toSetString=o?identity:toSetString;function fromSetString(e){if(isProtoString(e)){return e.slice(1)}return e}r.fromSetString=o?identity:fromSetString;function isProtoString(e){if(!e){return false}var r=e.length;if(r<9){return false}if(e.charCodeAt(r-1)!==95||e.charCodeAt(r-2)!==95||e.charCodeAt(r-3)!==111||e.charCodeAt(r-4)!==116||e.charCodeAt(r-5)!==111||e.charCodeAt(r-6)!==114||e.charCodeAt(r-7)!==112||e.charCodeAt(r-8)!==95||e.charCodeAt(r-9)!==95){return false}for(var n=r-10;n>=0;n--){if(e.charCodeAt(n)!==36){return false}}return true}function compareByOriginalPositions(e,r,n){var t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0||n){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0){return t}t=e.generatedLine-r.generatedLine;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositionsDeflated(e,r,n){var t=e.generatedLine-r.generatedLine;if(t!==0){return t}t=e.generatedColumn-r.generatedColumn;if(t!==0||n){return t}t=strcmp(e.source,r.source);if(t!==0){return t}t=e.originalLine-r.originalLine;if(t!==0){return t}t=e.originalColumn-r.originalColumn;if(t!==0){return t}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsDeflated=compareByGeneratedPositionsDeflated;function strcmp(e,r){if(e===r){return 0}if(e===null){return 1}if(r===null){return-1}if(e>r){return 1}return-1}function compareByGeneratedPositionsInflated(e,r){var n=e.generatedLine-r.generatedLine;if(n!==0){return n}n=e.generatedColumn-r.generatedColumn;if(n!==0){return n}n=strcmp(e.source,r.source);if(n!==0){return n}n=e.originalLine-r.originalLine;if(n!==0){return n}n=e.originalColumn-r.originalColumn;if(n!==0){return n}return strcmp(e.name,r.name)}r.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;function parseSourceMapInput(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}r.parseSourceMapInput=parseSourceMapInput;function computeSourceURL(e,r,n){r=r||"";if(e){if(e[e.length-1]!=="/"&&r[0]!=="/"){e+="/"}r=e+r}if(n){var t=urlParse(n);if(!t){throw new Error("sourceMapURL could not be parsed")}if(t.path){var o=t.path.lastIndexOf("/");if(o>=0){t.path=t.path.substring(0,o+1)}}r=join(urlGenerate(t),r)}return normalize(r)}r.computeSourceURL=computeSourceURL},997:(e,r,n)=>{n(591).h;r.SourceMapConsumer=n(952).SourceMapConsumer;n(351)},284:(e,r,n)=>{e=n.nmd(e);var t=n(997).SourceMapConsumer;var o=n(17);var i;try{i=n(147);if(!i.existsSync||!i.readFileSync){i=null}}catch(e){}var a=n(650);function dynamicRequire(e,r){return e.require(r)}var u=false;var s=false;var l=false;var c="auto";var p={};var f={};var g=/^data:application\/json[^,]+base64,/;var h=[];var d=[];function isInBrowser(){if(c==="browser")return true;if(c==="node")return false;return typeof window!=="undefined"&&typeof XMLHttpRequest==="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function hasGlobalProcessEventEmitter(){return typeof process==="object"&&process!==null&&typeof process.on==="function"}function globalProcessVersion(){if(typeof process==="object"&&process!==null){return process.version}else{return""}}function globalProcessStderr(){if(typeof process==="object"&&process!==null){return process.stderr}}function globalProcessExit(e){if(typeof process==="object"&&process!==null&&typeof process.exit==="function"){return process.exit(e)}}function handlerExec(e){return function(r){for(var n=0;n"}var n=this.getLineNumber();if(n!=null){r+=":"+n;var t=this.getColumnNumber();if(t){r+=":"+t}}}var o="";var i=this.getFunctionName();var a=true;var u=this.isConstructor();var s=!(this.isToplevel()||u);if(s){var l=this.getTypeName();if(l==="[object Object]"){l="null"}var c=this.getMethodName();if(i){if(l&&i.indexOf(l)!=0){o+=l+"."}o+=i;if(c&&i.indexOf("."+c)!=i.length-c.length-1){o+=" [as "+c+"]"}}else{o+=l+"."+(c||"")}}else if(u){o+="new "+(i||"")}else if(i){o+=i}else{o+=r;a=false}if(a){o+=" ("+r+")"}return o}function cloneCallSite(e){var r={};Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((function(n){r[n]=/^(?:is|get)/.test(n)?function(){return e[n].call(e)}:e[n]}));r.toString=CallSiteToString;return r}function wrapCallSite(e,r){if(r===undefined){r={nextPosition:null,curPosition:null}}if(e.isNative()){r.curPosition=null;return e}var n=e.getFileName()||e.getScriptNameOrSourceURL();if(n){var t=e.getLineNumber();var o=e.getColumnNumber()-1;var i=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;var a=i.test(globalProcessVersion())?0:62;if(t===1&&o>a&&!isInBrowser()&&!e.isEval()){o-=a}var u=mapSourcePosition({source:n,line:t,column:o});r.curPosition=u;e=cloneCallSite(e);var s=e.getFunctionName;e.getFunctionName=function(){if(r.nextPosition==null){return s()}return r.nextPosition.name||s()};e.getFileName=function(){return u.source};e.getLineNumber=function(){return u.line};e.getColumnNumber=function(){return u.column+1};e.getScriptNameOrSourceURL=function(){return u.source};return e}var l=e.isEval()&&e.getEvalOrigin();if(l){l=mapEvalOrigin(l);e=cloneCallSite(e);e.getEvalOrigin=function(){return l};return e}return e}function prepareStackTrace(e,r){if(l){p={};f={}}var n=e.name||"Error";var t=e.message||"";var o=n+": "+t;var i={nextPosition:null,curPosition:null};var a=[];for(var u=r.length-1;u>=0;u--){a.push("\n at "+wrapCallSite(r[u],i));i.nextPosition=i.curPosition}i.curPosition=i.nextPosition=null;return o+a.reverse().join("")}function getErrorSource(e){var r=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(e.stack);if(r){var n=r[1];var t=+r[2];var o=+r[3];var a=p[n];if(!a&&i&&i.existsSync(n)){try{a=i.readFileSync(n,"utf8")}catch(e){a=""}}if(a){var u=a.split(/(?:\r\n|\r|\n)/)[t-1];if(u){return n+":"+t+"\n"+u+"\n"+new Array(o).join(" ")+"^"}}}return null}function printErrorAndExit(e){var r=getErrorSource(e);var n=globalProcessStderr();if(n&&n._handle&&n._handle.setBlocking){n._handle.setBlocking(true)}if(r){console.error();console.error(r)}console.error(e.stack);globalProcessExit(1)}function shimEmitUncaughtException(){var e=process.emit;process.emit=function(r){if(r==="uncaughtException"){var n=arguments[1]&&arguments[1].stack;var t=this.listeners(r).length>0;if(n&&!t){return printErrorAndExit(arguments[1])}}return e.apply(this,arguments)}}var S=h.slice(0);var _=d.slice(0);r.wrapCallSite=wrapCallSite;r.getErrorSource=getErrorSource;r.mapSourcePosition=mapSourcePosition;r.retrieveSourceMap=v;r.install=function(r){r=r||{};if(r.environment){c=r.environment;if(["node","browser","auto"].indexOf(c)===-1){throw new Error("environment "+c+" was unknown. Available options are {auto, browser, node}")}}if(r.retrieveFile){if(r.overrideRetrieveFile){h.length=0}h.unshift(r.retrieveFile)}if(r.retrieveSourceMap){if(r.overrideRetrieveSourceMap){d.length=0}d.unshift(r.retrieveSourceMap)}if(r.hookRequire&&!isInBrowser()){var n=dynamicRequire(e,"module");var t=n.prototype._compile;if(!t.__sourceMapSupport){n.prototype._compile=function(e,r){p[r]=e;f[r]=undefined;return t.call(this,e,r)};n.prototype._compile.__sourceMapSupport=true}}if(!l){l="emptyCacheBetweenOperations"in r?r.emptyCacheBetweenOperations:false}if(!u){u=true;Error.prepareStackTrace=prepareStackTrace}if(!s){var o="handleUncaughtExceptions"in r?r.handleUncaughtExceptions:true;try{var i=dynamicRequire(e,"worker_threads");if(i.isMainThread===false){o=false}}catch(e){}if(o&&hasGlobalProcessEventEmitter()){s=true;shimEmitUncaughtException()}}};r.resetRetrieveHandlers=function(){h.length=0;d.length=0;h=S.slice(0);d=_.slice(0);v=handlerExec(d);m=handlerExec(h)}},147:e=>{"use strict";e.exports=require("fs")},17:e=>{"use strict";e.exports=require("path")}};var r={};function __webpack_require__(n){var t=r[n];if(t!==undefined){return t.exports}var o=r[n]={id:n,loaded:false,exports:{}};var i=true;try{e[n](o,o.exports,__webpack_require__);i=false}finally{if(i)delete r[n]}o.loaded=true;return o.exports}(()=>{__webpack_require__.nmd=e=>{e.paths=[];if(!e.children)e.children=[];return e}})();if(typeof __webpack_require__!=="undefined")__webpack_require__.ab=__dirname+"/";var n={};(()=>{__webpack_require__(284).install()})();module.exports=n})(); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@oracle-actions/run-oci-cli-command", 3 | "description": "Run an Oracle Cloud Infrastructure (OCI) CLI command", 4 | "version": "1.3.2", 5 | "author": { 6 | "name": "Oracle Cloud Infrastructure", 7 | "email": "oci-dax-tools_ww@oracle.com" 8 | }, 9 | "private": true, 10 | "homepage": "https://github.com/oracle-actions/run-oci-cli-command#readme", 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/oracle-actions/run-oci-cli-command.git" 14 | }, 15 | "bugs": { 16 | "url": "https://github.com/oracle-actions/run-oci-cli-command/issues" 17 | }, 18 | "keywords": [ 19 | "github", 20 | "actions", 21 | "oracle-cloud", 22 | "oracle-cloud-infrastructure" 23 | ], 24 | "exports": { 25 | ".": "./dist/index.js" 26 | }, 27 | "engines": { 28 | "node": ">=20" 29 | }, 30 | "scripts": { 31 | "bundle": "npm run format:write && npm run package", 32 | "format:write": "npx prettier --write .", 33 | "format:check": "npx prettier --check .", 34 | "lint": "npx eslint . -c ./.github/linters/.eslintrc.yml", 35 | "package": "npx ncc build src/index.ts -o dist --source-map --license LICENSE.txt", 36 | "all": "npm run format:write && npm run lint && npm run package" 37 | }, 38 | "files": [ 39 | "LICENSE.txt", 40 | "THIRD_PARTY_LICENSES.txt", 41 | "dist/*" 42 | ], 43 | "license": "UPL-1.0", 44 | "dependencies": { 45 | "@actions/core": "^1.10.1", 46 | "@actions/exec": "^1.1.1", 47 | "@actions/io": "^1.1.3", 48 | "@actions/tool-cache": "^2.0.1" 49 | }, 50 | "devDependencies": { 51 | "@types/node": "^20.16.5", 52 | "@typescript-eslint/eslint-plugin": "^7.18.0", 53 | "@typescript-eslint/parser": "^7.18.0", 54 | "@vercel/ncc": "^0.38.1", 55 | "eslint": "^8.57.0", 56 | "eslint-config-prettier": "^9.1.0", 57 | "eslint-plugin-prettier": "^5.2.1", 58 | "prettier": "^3.3.3", 59 | "prettier-eslint": "^16.3.0", 60 | "typescript": "^5.5.4", 61 | "typescript-eslint": "^8.4.0" 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /script/release: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # About: 4 | # 5 | # This is a helper script to tag and push a new release. GitHub Actions use 6 | # release tags to allow users to select a specific version of the action to use. 7 | # 8 | # See: https://github.com/actions/typescript-action#publishing-a-new-release 9 | # 10 | # This script will do the following: 11 | # 12 | # 1. Get the latest release tag 13 | # 2. Prompt the user for a new release tag 14 | # 3. Tag the new release 15 | # 4. Push the new tag to the remote 16 | # 17 | # Usage: 18 | # 19 | # script/release 20 | 21 | # Terminal colors 22 | OFF='\033[0m' 23 | RED='\033[0;31m' 24 | GREEN='\033[0;32m' 25 | BLUE='\033[0;34m' 26 | 27 | # Get the latest release tag 28 | latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)") 29 | 30 | if [[ -z "$latest_tag" ]]; then 31 | # There are no existing release tags 32 | echo -e "No tags found (yet) - Continue to create and push your first tag" 33 | latest_tag="[unknown]" 34 | fi 35 | 36 | # Display the latest release tag 37 | echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}" 38 | 39 | # Prompt the user for the new release tag 40 | read -r -p 'Enter a new release tag (vX.X.X format): ' new_tag 41 | 42 | # Validate the new release tag 43 | tag_regex='v[0-9]+\.[0-9]+\.[0-9]+$' 44 | if echo "$new_tag" | grep -q -E "$tag_regex"; then 45 | echo -e "Tag: ${BLUE}$new_tag${OFF} is valid" 46 | else 47 | # Release tag is not `vX.X.X` format 48 | echo -e "Tag: ${BLUE}$new_tag${OFF} is ${RED}not valid${OFF} (must be in vX.X.X format)" 49 | exit 1 50 | fi 51 | 52 | # Tag the new release 53 | git tag -a "$new_tag" -m "$new_tag Release" 54 | echo -e "${GREEN}Tagged: $new_tag${OFF}" 55 | 56 | # Push the new tag to the remote 57 | git push --tags 58 | echo -e "${GREEN}Release tag pushed to remote${OFF}" 59 | echo -e "${GREEN}Done!${OFF}" 60 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2024, Oracle and/or its affiliates. 2 | * Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. 3 | */ 4 | import { runOciCliCommand } from './main' 5 | 6 | // eslint-disable-next-line @typescript-eslint/no-floating-promises 7 | runOciCliCommand() 8 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2021, 2024 Oracle and/or its affiliates. 3 | * Licensed under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl. 4 | */ 5 | 6 | import * as core from '@actions/core' 7 | import * as io from '@actions/io' 8 | import * as exec from '@actions/exec' 9 | 10 | import * as fs from 'fs' 11 | import * as os from 'os' 12 | import * as path from 'path' 13 | 14 | /** 15 | * Test if the content of a variable has a valid JSON structure 16 | */ 17 | function isJson(item: string): boolean { 18 | let value = typeof item !== 'string' ? JSON.stringify(item) : item 19 | try { 20 | value = JSON.parse(value) 21 | } catch { 22 | return false 23 | } 24 | 25 | return typeof value === 'object' && value !== null 26 | } 27 | 28 | /** 29 | * Install the OCI CLI (if ncessary) and then run the command specified by 30 | * the user workflow. By default, the action suppresses/masks the command 31 | * and output from the GitHub console and logs to avoid leaking confidential 32 | * data. 33 | * 34 | */ 35 | export async function runOciCliCommand(): Promise { 36 | if (!fs.existsSync(path.join(os.homedir(), '.oci-cli-installed'))) { 37 | core.startGroup('Installing Oracle Cloud Infrastructure CLI') 38 | const cli = await exec.getExecOutput('python -m pip install oci-cli') 39 | 40 | if (cli && cli.exitCode == 0) { 41 | fs.writeFileSync(path.join(os.homedir(), '.oci-cli-installed'), 'success') 42 | } 43 | core.endGroup() 44 | } 45 | 46 | const cliBin = await io.which('oci', true) 47 | const cliArgs = core 48 | .getInput('command', { required: true }) 49 | .replace(/^(oci\s)/, '') 50 | .trim() 51 | const jmesPath = core.getInput('query') ? `--query "${core.getInput('query').trim()}"` : '' 52 | core.info('Executing Oracle Cloud Infrastructure CLI command') 53 | const silent = core.getBooleanInput('silent', { required: false }) 54 | 55 | const cliCommand = `${cliBin} ${jmesPath} ${cliArgs}` 56 | if (silent) core.setSecret(cliCommand) 57 | 58 | const cliResult = await exec.getExecOutput(cliCommand, [], { silent: silent }) 59 | let output = '' 60 | let raw_output = '' 61 | 62 | if (cliResult && cliResult.exitCode == 0) { 63 | if (cliResult.stdout && isJson(cliResult.stdout)) { 64 | const stdout = JSON.parse(cliResult.stdout) 65 | output = JSON.stringify(JSON.stringify(stdout)) 66 | if (Object.keys(stdout).length == 1) { 67 | raw_output = String(Object.values(stdout)[0]) 68 | } 69 | } else { 70 | output = cliResult.stdout 71 | raw_output = cliResult.stdout 72 | } 73 | 74 | if (silent && output) core.setSecret(output) 75 | core.setOutput('output', output) 76 | 77 | if (silent && raw_output) core.setSecret(raw_output) 78 | core.setOutput('raw_output', raw_output) 79 | } else { 80 | if (cliResult.stderr && isJson(cliResult.stderr)) { 81 | const stderr = JSON.parse(cliResult.stderr) 82 | output = JSON.stringify(JSON.stringify(stderr)) 83 | } else { 84 | output = cliResult.stderr 85 | } 86 | core.setFailed(`Failed: ${output}`) 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "compilerOptions": { 4 | "target": "es2022", 5 | "module": "NodeNext", 6 | "rootDir": "./src", 7 | "moduleResolution": "NodeNext", 8 | "baseUrl": "./", 9 | "sourceMap": true, 10 | "outDir": "./dist", 11 | "noImplicitAny": true, 12 | "esModuleInterop": true, 13 | "forceConsistentCasingInFileNames": true, 14 | "strict": true, 15 | "skipLibCheck": true, 16 | "newLine": "lf" 17 | }, 18 | "exclude": ["./dist", "node_modules"] 19 | } 20 | --------------------------------------------------------------------------------